diff --git a/public/site/plugins/classes/Author.php b/public/site/plugins/classes/Author.php index 1df1b9d..bdda519 100644 --- a/public/site/plugins/classes/Author.php +++ b/public/site/plugins/classes/Author.php @@ -1,6 +1,6 @@ template() == 'project' ? $page : $page->parent(); - $file = $data['file']; - $position = $data['position']; - $replies = $data['replies'] ?? []; - $text = $data['text']; - $author = $data['author']; - $date = $data['date']; - $id = $data['id']; - $type = $data['type'] ?? 'comment'; - - $this->location = [ - 'page' => [ - 'uri' => (string) $page->uri(), - 'title' => (string) $page->title(), - ], - 'href' => (string) $data['href'], - 'project' => [ - 'title' => (string) $project->title(), - 'uri' => (string) $project->uri(), - ], - 'file' => $file ? [ - 'uuid' => (string) $file->uuid(), - 'url' => (string) $file->uuid() - ] : false, - ]; - - $this->replies = $replies ?? []; - $this->text = $text; - $this->author = [ - 'name' => (string) $author->name(), - 'email' => (string) $author->email(), - 'uuid' => (string) $author->uuid(), - 'role' => (string) $author->role(), - ]; - $this->date = $date; - $this->id = $id; - $this->type = $type; - $this->isRead = false; - $this->position = $position; - } - - public function location() { - return $this->location; - } - - public function file() { - return $this->location['file']; - } - - public function replies() { - return $this->replies; - } - - public function text() { - return $this->text; - } - - public function author() { - return $this->author; - } - - public function date() { - return $this->date; - } - - public function id() { - return $this->id; - } - - public function type() { - return $this->type; - } - - public function isRead() { - return $this->isRead; - } - - public function read() { - $this->isRead = true; - return $this->isRead; + $this->type = $data["type"]; + $this->location = new Location($data["location"]); + $this->text = $data["text"]; + $this->author = new Author($data["author"]); + $this->date = $data["date"]; + $this->id = $data["id"]; + $this->isRead = "false"; } - public function unread() { - $this->isRead = false; - return $this->isRead; - } - - public function pageIndex() { - $this->position['pageIndex']; - } - public function toArray() { return [ 'location' => $this->location, diff --git a/public/site/plugins/notifications/index.php b/public/site/plugins/notifications/index.php index 1a5c6ea..0e05df4 100644 --- a/public/site/plugins/notifications/index.php +++ b/public/site/plugins/notifications/index.php @@ -6,12 +6,12 @@ load([ F::loadClasses([ 'adrienpayet\\notifications\\Notification' => __DIR__ . '/src/Notification.php', - 'adrienpayet\\notifications\\location\\Location' => __DIR__ . '/src/location/Location.php', - 'adrienpayet\\notifications\\location\\PageDetails' => __DIR__ . '/src/location/PageDetails.php', - 'adrienpayet\\notifications\\location\\ProjectDetails' => __DIR__ . '/src/location/ProjectDetails.php', - 'adrienpayet\\notifications\\location\\FileDetails' => __DIR__ . '/src/location/FileDetails.php', - 'adrienpayet\\notifications\\Position' => __DIR__ . '/src/Position.php', - 'adrienpayet\\Author' => __DIR__ . '/../classes/Author.php' + 'adrienpayet\\D2P\\data\\Position' => __DIR__ . '/../classes/Position.php', + 'adrienpayet\\D2P\data\Author' => __DIR__ . '/../classes/Author.php', + 'adrienpayet\\D2P\\data\\location\\Location' => __DIR__ . '/../classes/location/Location.php', + 'adrienpayet\\D2P\\data\\location\\PageDetails' => __DIR__ . '/../classes/location/PageDetails.php', + 'adrienpayet\\D2P\\data\\location\\ProjectDetails' => __DIR__ . '/../classes/location/ProjectDetails.php', + 'adrienpayet\\D2P\\data\\location\\FileDetails' => __DIR__ . '/../classes/location/FileDetails.php', ]); diff --git a/public/site/plugins/notifications/src/Notification.php b/public/site/plugins/notifications/src/Notification.php index b9f040b..6f2dc69 100644 --- a/public/site/plugins/notifications/src/Notification.php +++ b/public/site/plugins/notifications/src/Notification.php @@ -1,8 +1,8 @@ author = new Author($data["author"]); $this->date = $data["date"]; $this->id = $data["id"]; - $this->isRead = $data["isRead"]; + $this->isRead = "false"; if ($data["type"] === "comment") { $this->position = new Position($data["position"]);