3 declare(strict_types=1);
46 $this->db_repo = $repo->
note();
47 $this->db_settings_repo = $repo->
settings();
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);
75 public function deleteNote(
Note $note,
int $user_id, $public_deletion_enabled =
false): void
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);
103 bool $incl_sub =
false,
105 bool $ascending =
false,
107 string $search_text =
"" 109 return $this->db_repo->getNotesForContext(
127 bool $incl_sub =
false,
129 bool $ascending =
false,
137 return $this->db_repo->getNotesForContext(
155 bool $incl_sub =
false,
157 bool $ascending =
false,
159 string $search_text =
"" 161 return $this->db_repo->getNotesForObjIds(
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);
208 $fav_obj_ids = array_map(
function (
$i) {
210 }, $fav_rep->getFavouritesOfUser($user_id));
211 if (count($fav_obj_ids) > 0) {
212 $fav_obj_ids = $this->db_repo->filterObjectsWithNotes($fav_obj_ids,
Note::PUBLIC);
213 $ids = array_unique(array_merge($ids, $fav_obj_ids));
216 $ids = array_filter($ids,
function (
$id) {
221 $wsp_tree = new \ilWorkspaceTree($user_id);
223 $ids = array_filter($ids,
function (
$id) use ($wsp_tree) {
227 if ($wsp_tree->lookupNodeId(
$id) > 0) {
241 return $this->db_repo->getById($id);
250 return $this->db_settings_repo->commentsActive($obj_id);
256 return $this->db_settings_repo->commentsActiveMultiple($obj_ids);
264 bool $a_activate =
true 266 $this->db_settings_repo->activateComments(
282 return $this->db_repo->getUserCount($obj_id, $sub_obj_id, $obj_type);
291 bool $no_sub_objs =
false 293 return $this->db_repo->countNotesAndCommentsMultipleObjects(
295 $this->domain->user()->getId(),
Notes internal repo service.
NoteSettingsDBRepository $db_settings_repo
deleteNote(Note $note, int $user_id, $public_deletion_enabled=false)
getNrOfNotesForContext(Context $context, int $type=Note::PRIVATE, bool $incl_sub=false, int $author=0)
countNotesAndCommentsMultipleObjects(array $obj_ids, bool $no_sub_objs=false)
Get all notes related to multiple repository objects (current user)
NoteDBRepository $db_repo
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.
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.
Repository internal data service.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
AccessManager $note_access
NotificationsManager $notification
activateComments(int $obj_id, bool $a_activate=true)
Activate notes feature.
__construct(InternalDataService $data, InternalRepoService $repo, InternalDomainService $domain)
InternalDataService $data
InternalDomainService $domain
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.
withCreationDate(string $creation_date)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
InternalRepoService $repo
getUserCount(int $obj_id, int $sub_obj_id, string $obj_type)
How many users have attached a note/comment to a given object?
updateNoteText(int $id, string $text, array $observer)
getRelatedObjectsOfUser(int $type)
Get all untrashed objects that have either notes/comments of the user attached, or are favourites of ...
createNote(Note $note, array $observer, bool $use_provided_creation_date=false)
static _lookupType(int $id, bool $reference=false)
commentsActive(int $obj_id)
Are comments activated for object?
NotesSessionRepository $sess_repo
setSortAscending(bool $asc)
commentsActiveMultiple(array $obj_ids)
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.