This repository has been archived on 2024-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
epubreader/lib/Db/Bookmark.php

102 lines
2.3 KiB
PHP
Raw Normal View History

2020-04-21 20:37:42 +00:00
<?php
/**
* @author Frank de Lange
* @copyright 2015 Frank de Lange
*
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace OCA\Epubreader\Db;
2020-04-21 20:37:42 +00:00
class Bookmark extends ReaderEntity implements \JsonSerializable {
2023-06-16 14:58:23 +00:00
protected $userId; // user
protected $fileId; // book (identified by fileId) for which this mark is valid
protected $type; // type, defaults to "bookmark"
protected $name; // name, defaults to $location
protected $value; // bookmark value (format-specific, eg. page number for PDF, CFI for epub, etc)
protected $content; // bookmark content (annotations etc), can be empty
protected $lastModified; // modification timestamp
public function jsonSerialize(): array {
return [
'id' => $this->getId(),
'userId' => $this->getUserId(),
'fileId' => $this->getFileId(),
'type' => $this->getType(),
'name' => $this->getName(),
'value' => static::conditional_json_decode($this->getValue()),
'content' => static::conditional_json_decode($this->getContent()),
'lastModified' => $this->getLastModified()
];
}
public function toService() {
return [
'name' => $this->getName(),
'type' => $this->getType(),
'value' => $this->conditional_json_decode($this->getValue()),
'content' => $this->conditional_json_decode($this->getContent()),
'lastModified' => $this->getLastModified(),
];
}
public function getUserId() {
return $this->userId;
}
public function setUserId($userId) {
$this->userId = $userId;
}
public function getFileId() {
return $this->fileId;
}
2023-06-16 15:21:29 +00:00
public function setFileId(int $fileId) {
2023-06-16 14:58:23 +00:00
$this->fileId = $fileId;
}
public function getType() {
return $this->type;
}
2020-04-21 20:37:42 +00:00
2023-06-16 14:58:23 +00:00
public function setType($type) {
$this->type = $type;
}
public function getName() {
return $this->name;
}
2023-06-16 15:21:29 +00:00
public function setName(string $name) {
2023-06-16 14:58:23 +00:00
$this->name = $name;
}
public function getValue() {
return $this->value;
}
2023-06-16 15:21:29 +00:00
public function setValue(string $value) {
2023-06-16 14:58:23 +00:00
$this->value = $value;
}
public function getContent() {
return $this->content;
}
public function setContent($content) {
$this->content = $content;
}
public function getLastModified() {
return $this->lastModified;
}
public function setLastModified($lastModified) {
$this->lastModified = $lastModified;
}
}