19declare(strict_types=1);
45 $this->sess_repo =
$repo->notesSession();
46 $this->db_repo =
$repo->note();
47 $this->db_settings_repo =
$repo->settings();
48 $this->note_access =
$domain->noteAccess();
54 $this->sess_repo->setSortAscending($asc);
59 return $this->sess_repo->getSortAscending();
65 bool $use_provided_creation_date =
false
67 if (!$use_provided_creation_date) {
70 $note = $this->db_repo->createNote($note);
72 $this->
notification->notifyObserver($observer,
"new", $note);
77 if ($this->note_access->canDelete($note,
$user_id, $public_deletion_enabled)) {
78 $this->db_repo->deleteNote($note->
getId());
87 $note = $this->db_repo->getById(
$id);
88 if ($this->note_access->canEdit($note)) {
89 $this->db_repo->updateNoteText(
$id, $text);
90 $note = $this->db_repo->getById(
$id);
92 $this->
notification->notifyObserver($observer,
"update", $note);
102 int $type = Note::PRIVATE,
103 bool $incl_sub =
false,
105 bool $ascending =
false,
107 string $search_text =
""
109 return $this->db_repo->getNotesForContext(
126 int $type = Note::PRIVATE,
127 bool $incl_sub =
false,
129 bool $ascending =
false,
137 return $this->db_repo->getNotesForContext(
154 int $type = Note::PRIVATE,
155 bool $incl_sub =
false,
157 bool $ascending =
false,
159 string $search_text =
""
161 return $this->db_repo->getNotesForObjIds(
175 int $type = Note::PRIVATE,
176 bool $incl_sub =
false,
179 return $this->db_repo->getNrOfNotesForContext(
195 $tree = $this->domain->repositoryTree();
196 $user_id = $this->domain->user()->getId();
197 $fav_rep = new \ilFavouritesDBRepository();
199 $ids = $this->db_repo->getRelatedObjIdsOfUser(
$user_id, $type);
200 $ids = array_filter($ids,
function (
$id) {
201 return \ilObject::_exists(
$id);
204 if ($type === Note::PUBLIC) {
207 $fav_obj_ids = array_map(
function ($i) {
209 }, $fav_rep->getFavouritesOfUser(
$user_id));
210 if (count($fav_obj_ids) > 0) {
211 $fav_obj_ids = $this->db_repo->filterObjectsWithNotes($fav_obj_ids, Note::PUBLIC);
212 $ids = array_unique(array_merge($ids, $fav_obj_ids));
215 $ids = array_filter($ids,
function (
$id) {
216 return $this->commentsActive(
$id);
220 $wsp_tree = new \ilWorkspaceTree(
$user_id);
222 $ids = array_filter($ids,
function (
$id) use ($wsp_tree) {
226 if ($wsp_tree->lookupNodeId(
$id) > 0) {
240 return $this->db_repo->getById(
$id);
249 return $this->db_settings_repo->commentsActive($obj_id);
255 return $this->db_settings_repo->commentsActiveMultiple($obj_ids);
263 bool $a_activate =
true
265 $this->db_settings_repo->activateComments(
281 return $this->db_repo->getUserCount($obj_id, $sub_obj_id, $obj_type);
290 bool $no_sub_objs =
false
292 return $this->db_repo->countNotesAndCommentsMultipleObjects(
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
withCreationDate(string $creation_date)
setSortAscending(bool $asc)
createNote(Note $note, array $observer, bool $use_provided_creation_date=false)
AccessManager $note_access
NoteDBRepository $db_repo
getNrOfNotesForContext(Context $context, int $type=Note::PRIVATE, bool $incl_sub=false, int $author=0)
deleteNote(Note $note, int $user_id, $public_deletion_enabled=false)
getNotesForRepositoryObjId(int $obj_id, int $type=Note::PRIVATE, bool $incl_sub=false, int $author=0, bool $ascending=false, string $since="")
Get all notes related to a specific repository object.
updateNoteText(int $id, string $text, array $observer)
getNotesForContext(Context $context, int $type=Note::PRIVATE, bool $incl_sub=false, int $author=0, bool $ascending=false, string $since="", string $search_text="")
Get all notes related to a specific context.
InternalDataService $data
activateComments(int $obj_id, bool $a_activate=true)
Activate notes feature.
InternalDomainService $domain
__construct(InternalDataService $data, InternalRepoService $repo, InternalDomainService $domain)
NotificationsManager $notification
commentsActiveMultiple(array $obj_ids)
InternalRepoService $repo
getRelatedObjectsOfUser(int $type)
Get all untrashed objects that have either notes/comments of the user attached, or are favourites of ...
countNotesAndCommentsMultipleObjects(array $obj_ids, bool $no_sub_objs=false)
Get all notes related to multiple repository objects (current user)
getNotesForRepositoryObjIds(array $obj_ids, int $type=Note::PRIVATE, bool $incl_sub=false, int $author=0, bool $ascending=false, string $since="", string $search_text="")
Get all notes related to a specific repository object.
getUserCount(int $obj_id, int $sub_obj_id, string $obj_type)
How many users have attached a note/comment to a given object?
NoteSettingsDBRepository $db_settings_repo
commentsActive(int $obj_id)
Are comments activated for object?
NotesSessionRepository $sess_repo
Class ilObject Basic functions for all objects.
static _hasUntrashedReference(int $obj_id)
checks whether an object has at least one reference that is not in trash
static now()
Return current timestamp in Y-m-d H:i:s format.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists('../ilias.ini.php'))