ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilNoteGUI.php
Go to the documentation of this file.
1 <?php
2 
22 
28 class ilNoteGUI
29 {
33  protected ?array $notes = null;
34  protected \ILIAS\Notes\InternalGUIService $gui;
35  protected string $search_text;
36  protected \ILIAS\Notes\AccessManager $notes_access;
37  protected \ILIAS\Notes\InternalDataService $data;
40  protected bool $public_enabled;
43  protected bool $targets_enabled = false;
44  protected bool $export_html = false;
45  protected bool $print = false;
46  protected bool $comments_settings = false;
47  protected string $obj_type;
48  protected bool $private_enabled;
49  protected bool $edit_note_form;
50  protected bool $add_note_form;
51  protected bool $ajax;
52  protected bool $inc_sub;
53  protected int $obj_id;
57  protected $rep_obj_id;
58  protected ilCtrl $ctrl;
59  protected ilLanguage $lng;
60  protected ilObjUser $user;
61  protected ilSetting $settings;
63  protected ilTree $tree;
65  public bool $public_deletion_enabled = false;
66  public bool $repository_mode = false;
67  public bool $old = false;
68  protected string $default_command = "getListHTML";
69  protected array $observer = [];
70  protected \ILIAS\DI\UIServices $ui;
71  protected int $news_id = 0;
72  protected bool $hide_new_form = false;
73  protected bool $only_latest = false; // Show only latest note/comment
74  protected string $widget_header = "";
75  protected bool $no_actions = false; // Do not show edit/delete actions
76  protected bool $enable_sorting = true;
77  protected bool $user_img_export_html = false;
78  protected ilLogger $log;
79  protected ilTemplate $form_tpl;
80  protected int $requested_note_type = 0;
81  protected int $requested_note_id = 0;
82  protected string $requested_note_mess = "";
83  protected int $requested_news_id = 0;
84  protected bool $delete_note = false;
85  protected string $note_mess = "";
86  protected array $item_list_gui = [];
87  protected bool $use_obj_title_header = true;
88  protected bool $show_empty_list_message = true;
89  protected bool $show_header = true;
90 
100  public function __construct(
101  $a_rep_obj_id = 0,
102  int $a_obj_id = 0,
103  string $a_obj_type = "",
104  bool $a_include_subobjects = false,
105  int $a_news_id = 0,
106  bool $ajax = true,
107  string $search_text = ""
108  ) {
109  global $DIC;
110 
111  $this->user = $DIC->user();
112  $this->settings = $DIC->settings();
113  $this->obj_definition = $DIC["objDefinition"];
114  $this->tree = $DIC->repositoryTree();
115  $this->access = $DIC->access();
116  $this->ui = $DIC->ui();
117  $ilCtrl = $DIC->ctrl();
118  $this->lng = $DIC->language();
119  $this->log = ilLoggerFactory::getLogger('note');
120  $this->search_text = $search_text;
121 
122  $ns = $DIC->notes()->internal();
123  $this->manager = $ns
124  ->domain()
125  ->notes();
126  $this->request = $ns
127  ->gui()
128  ->standardRequest();
129  $this->data = $ns->data();
130  $this->gui = $ns->gui();
131  $this->notes_access = $ns->domain()->noteAccess();
132 
133  $this->lng->loadLanguageModule("notes");
134 
135  $ilCtrl->saveParameter($this, "notes_only");
136 
137  $this->rep_obj_id = $a_rep_obj_id;
138  $this->obj_id = $a_obj_id;
139  $this->obj_type = $a_obj_type;
140  $this->inc_sub = $a_include_subobjects;
141  $this->news_id = $a_news_id;
142 
143  // auto-detect object type
144  if (!is_array($a_rep_obj_id) && !$this->obj_type && $a_rep_obj_id) {
145  $this->obj_type = ilObject::_lookupType($a_rep_obj_id);
146  }
147 
148  $this->ajax = $ajax;
149 
150  $this->ctrl = $ilCtrl;
151 
152  $this->add_note_form = false;
153  $this->edit_note_form = false;
154  $this->private_enabled = false;
155 
156  if (!is_array($this->rep_obj_id)) {
157  if ($this->manager->commentsActive($this->rep_obj_id)) {
158  $this->public_enabled = true;
159  } else {
160  $this->public_enabled = false;
161  }
162  }
163  $this->targets_enabled = false;
164  $this->export_html = false;
165  $this->print = false;
166  $this->comments_settings = false;
167 
168  // default: notes for repository objects
169  $this->setRepositoryMode(true);
170 
171  $this->ctrl->saveParameter($this, "note_type");
172  $this->requested_note_type = $this->request->getNoteType();
173  $this->requested_note_id = $this->request->getNoteId();
174  $this->requested_note_mess = $this->request->getNoteMess();
175  $this->requested_news_id = $this->request->getNewsId();
176  }
177 
178  public function setShowEmptyListMessage(bool $a_val): void
179  {
180  $this->show_empty_list_message = $a_val;
181  }
182 
183  public function getShowEmptyListMessage(): bool
184  {
186  }
187 
188  public function setShowHeader(bool $a_val): void
189  {
190  $this->show_header = $a_val;
191  }
192 
193  public function getShowHeader(): bool
194  {
195  return $this->show_header;
196  }
197 
198 
199  public function setUseObjectTitleHeader(bool $a_val): void
200  {
201  $this->use_obj_title_header = $a_val;
202  }
203 
204  public function getUseObjectTitleHeader(): bool
205  {
207  }
208 
209  public function setDefaultCommand(string $a_val): void
210  {
211  $this->default_command = $a_val;
212  }
213 
214  public function setHideNewForm(bool $a_val): void
215  {
216  $this->hide_new_form = $a_val;
217  }
218 
219  public function getDefaultCommand(): string
220  {
221  return $this->default_command;
222  }
223 
224  public function executeCommand()
225  {
226  $cmd = $this->ctrl->getCmd($this->getDefaultCommand());
227  $next_class = $this->ctrl->getNextClass($this);
228  switch ($next_class) {
229  default:
230  return $this->$cmd();
231  }
232  }
233 
234  public function enablePrivateNotes(bool $a_enable = true): void
235  {
236  $this->private_enabled = $a_enable;
237  }
238 
239  public function enablePublicNotes(bool $a_enable = true): void
240  {
241  $this->public_enabled = $a_enable;
242  }
243 
244  public function enableCommentsSettings(bool $a_enable = true): void
245  {
246  $this->comments_settings = $a_enable;
247  }
248 
249  public function enablePublicNotesDeletion(bool $a_enable = true): void
250  {
251  $this->public_deletion_enabled = $a_enable;
252  }
253 
254  // enable target objects
255  public function enableTargets(bool $a_enable = true): void
256  {
257  $this->targets_enabled = $a_enable;
258  }
259 
260  public function setRepositoryMode(bool $a_value): void
261  {
262  $this->repository_mode = $a_value;
263  }
264 
265  public function getNotesHTML(): string
266  {
267  $ilCtrl = $this->ctrl;
268  $ilCtrl->setParameter($this, "notes_type", Note::PRIVATE);
269  $this->requested_note_type = Note::PRIVATE;
270  return $this->getListHTML($a_init_form = true);
271  }
272 
273  public function getCommentsHTML(): string
274  {
275  if ($this->ajax) {
276  $this->gui->initJavascript();
277  }
278  $ilCtrl = $this->ctrl;
279  $ilCtrl->setParameter($this, "notes_type", Note::PUBLIC);
280  $this->requested_note_type = Note::PUBLIC;
281  return $this->getListHTML($a_init_form = true);
282  }
283 
284  public function getListHTML(bool $a_init_form = true): string
285  {
287  $lng = $this->lng;
288  $ilCtrl = $this->ctrl;
290 
291  $content = "";
292  if ($this->requested_note_type === Note::PRIVATE && $ilUser->getId() !== ANONYMOUS_USER_ID) {
293  $content = $this->getNoteListHTML(Note::PRIVATE, $a_init_form);
294  }
295  // #15948 - public enabled vs. comments_settings
296  if ($this->requested_note_type === Note::PUBLIC) {
297  $active = true;
298  // news items (in timeline) do not check, if the object has news activated!
299  if (!is_array($this->rep_obj_id) && $this->news_id === 0) {
300 
301  // if common object settings are used, we check for activation
302  // 37713, 37701
303  // removed setting check due to 41511
304  //if ($this->comments_settings) {
305  $active = $this->manager->commentsActive($this->rep_obj_id);
306  //}
307  }
308  if ($active) {
309  $content = $this->getNoteListHTML(Note::PUBLIC, $a_init_form);
310  }
311 
312  // Comments Settings
313  if (!is_array($this->rep_obj_id) && $this->comments_settings && $ilUser->getId() !== ANONYMOUS_USER_ID) {
314  $active = $this->manager->commentsActive($this->rep_obj_id);
315  if ($active) {
316  if ($this->news_id === 0) {
317  $content .= $this->renderComponents([$this->getShyButton(
318  "comments_settings",
319  $lng->txt("notes_deactivate_comments"),
320  "deactivateComments",
321  ""
322  )
323  ]);
324  }
325  } else {
326  $content .= $this->renderComponents([$this->getShyButton(
327  "comments_settings",
328  $lng->txt("notes_activate_comments"),
329  "activateComments",
330  ""
331  )
332  ]);
333  /*
334  if ($this->ajax && !$comments_col) {
335  $ntpl->setVariable(
336  "COMMENTS_MESS",
337  ilUtil::getSystemMessageHTML($lng->txt("comments_feature_currently_not_activated_for_object"), "info")
338  );
339  }*/
340  }
341  }
342  }
343  return $this->renderContent($content);
344  }
345 
346  protected function renderComponents(array $components): string
347  {
348  if ($this->ctrl->isAsynch()) {
349  return $this->ui->renderer()->renderAsync($components);
350  }
351  return $this->ui->renderer()->render($components);
352  }
353 
354  public function activateComments(): void
355  {
356  $ilCtrl = $this->ctrl;
357 
358  if ($this->comments_settings) {
359  $this->manager->activateComments($this->rep_obj_id, true);
360  }
361 
362  $ilCtrl->redirectByClass("ilnotegui", "getCommentsHTML", "", $this->ajax);
363  }
364 
365  public function deactivateComments(): void
366  {
367  $ilCtrl = $this->ctrl;
368 
369  if ($this->comments_settings) {
370  $this->manager->activateComments($this->rep_obj_id, false);
371  }
372 
373  $ilCtrl->redirectByClass("ilnotegui", "getCommentsHTML", "", $this->ajax);
374  }
375 
379  protected function getNotes(int $a_type): array
380  {
381  if ($this->notes === null) {
383  $filter = null;
384  if ($this->export_html || $this->print) {
385  if ($this->requested_note_id > 0) {
386  $filter = $this->requested_note_id;
387  } else {
388  $filter = $this->request->getNoteText();
389  }
390  }
391 
392  $ascending = $this->manager->getSortAscending();
393  if ($this->only_latest) {
394  $order = false;
395  }
396  $author_id = ($a_type === Note::PRIVATE)
397  ? $ilUser->getId()
398  : 0;
399 
400  if (!is_array($this->rep_obj_id)) {
401  $notes = $this->manager->getNotesForContext(
402  $this->data->context(
403  $this->rep_obj_id,
404  $this->obj_id,
405  $this->obj_type,
406  $this->news_id,
407  $this->repository_mode
408  ),
409  $a_type,
411  $author_id,
412  $ascending,
413  "",
415  );
416  } else {
417  $notes = $this->manager->getNotesForRepositoryObjIds(
418  $this->rep_obj_id,
419  $a_type,
420  $this->inc_sub,
421  $author_id,
422  $ascending,
423  "",
424  $this->search_text
425  );
426  }
427  $this->notes = $notes;
428  }
429  return $this->notes;
430  }
431 
432  public function getNoteListHTML(
433  int $a_type = Note::PRIVATE,
434  bool $a_init_form = true
435  ): string {
436  $lng = $this->lng;
437  $ilCtrl = $this->ctrl;
438  $f = $this->ui->factory();
440 
441  $mtype = "";
442 
443  $suffix = ($a_type === Note::PRIVATE)
444  ? "private"
445  : "public";
446 
447  $notes = $this->getNotes($a_type);
448 
449  $tpl = new ilTemplate("tpl.notes_list.html", true, true, "Services/Notes");
450 
451  // show counter if notes are hidden
452  $cnt_str = (count($notes) > 0)
453  ? " (" . count($notes) . ")"
454  : "";
455 
456  // origin header
457  $origin_header = $this->getOriginHeader();
458  if ($origin_header != "") {
459  $tpl->setCurrentBlock("title");
460  $tpl->setVariable("TITLE", $origin_header);
461  $tpl->parseCurrentBlock();
462  }
463 
464  if ($a_type === Note::PRIVATE) {
465  $tpl->setVariable("TXT_NOTES", $lng->txt("private_notes") . $cnt_str);
466  $ilCtrl->setParameterByClass("ilnotegui", "note_type", Note::PRIVATE);
467  } else {
468  $tpl->setVariable("TXT_NOTES", $lng->txt("notes_public_comments") . $cnt_str);
469  $ilCtrl->setParameterByClass("ilnotegui", "note_type", Note::PUBLIC);
470  }
471  $anch = "";
472 
473  // show add new note text area
474  if (!$this->edit_note_form && !is_array($this->rep_obj_id) &&
475  !$this->hide_new_form && $ilUser->getId() !== ANONYMOUS_USER_ID) {
476  $tpl->setCurrentBlock("edit_note_form");
477  $b_caption = ($this->requested_note_type === Note::PRIVATE)
478  ? $this->lng->txt("note_add_note")
479  : $this->lng->txt("note_add_comment");
480  $b = $this->ui->factory()->button()->standard(
481  $b_caption,
482  "#"
483  );
484  $tpl->setVariable("EDIT_STYLE", "display:none;");
485  $tpl->setVariable(
486  "EDIT_FORM_ACTION",
487  $ilCtrl->getFormActionByClass("ilnotegui", "addNote", "", true)
488  );
489  $tpl->setVariable(
490  "TXT_CANCEL",
491  $this->lng->txt("cancel")
492  );
493  $tpl->setVariable(
494  "EDIT_FORM_BUTTON",
495  $this->renderComponents([$b])
496  );
497  $tpl->setVariable(
498  "EDIT_FORM",
499  $this->getNoteForm("create", $a_type)->render()
500  );
501  $tpl->parseCurrentBlock();
502  }
503 
504  // list all notes
507 
508  $notes_given = false;
509 
510  // edit form
511  if ($this->edit_note_form && $a_type === $this->requested_note_type) {
512  $note = $this->manager->getById($this->requested_note_id);
513  $ilCtrl->setParameterByClass("ilnotegui", "note_id", $this->requested_note_id);
514  $tpl->setVariable(
515  "EDIT_FORM_ACTION",
516  $ilCtrl->getFormActionByClass("ilnotegui", "updateNote", "", true)
517  );
518  $tpl->setVariable(
519  "CANCEL_FORM_ACTION",
520  $ilCtrl->getFormActionByClass("ilnotegui", "cancelUpdateNote", "", true)
521  );
522  $tpl->setVariable("NOTE_FOCUS", "1");
523  $tpl->setVariable(
524  "TXT_CANCEL",
525  $this->lng->txt("cancel")
526  );
527  $tpl->setVariable(
528  "EDIT_FORM",
529  $this->getNoteForm("edit", $a_type, $note)->render()
530  );
531  $tpl->parseCurrentBlock();
532  }
533 
534  $items = [];
535  $item_groups = [];
536  $text_placeholders = [];
537  $texts = [];
538  $last_obj_id = null;
539  foreach ($notes as $note) {
540  if ($this->only_latest && $notes_given) {
541  continue;
542  }
543 
544  $current_obj_id = $note->getContext()->getObjId();
545  if ($last_obj_id !== null && $current_obj_id !== $last_obj_id) {
546  $it_group_title = $this->getItemGroupTitle($last_obj_id);
547  $item_groups[] = $f->item()->group($it_group_title, $items);
548  $items = [];
549  }
550  $last_obj_id = $current_obj_id;
551 
552  $items[] = $this->getItemForNote($note);
553  $notes_given = true;
554 
555  $text_placeholders[] = $this->getNoteTextPlaceholder($note);
556  $texts[] = $this->getNoteText($note);
557  }
558 
559  $it_group_title = $this->getItemGroupTitle((int) $last_obj_id);
560  $item_groups[] = $f->item()->group($it_group_title, $items);
561 
562  if ($notes_given) {
563  if (!is_array($this->rep_obj_id)) {
564  $title = $item_groups[0]->getTitle();
565  $item_groups[0] = $f->item()->group("", $item_groups[0]->getItems());
566  } else {
567  $title = "";
568  }
569  $panel = $f->panel()->listing()->standard($title, $item_groups);
570  if (!is_array($this->rep_obj_id)) {
571  $panel = $panel->withActions($this->getSortationControl());
572  }
573  $html = $this->renderComponents([$panel]);
574  $html = str_replace($text_placeholders, $texts, $html);
575  $tpl->setVariable("NOTES_LIST", $html);
576  } elseif (!is_array($this->rep_obj_id)) {
577  $it_group_title = $this->getItemGroupTitle($this->rep_obj_id);
578  $item_groups = [$f->item()->group($it_group_title, [])];
579  $panel = $f->panel()->listing()->standard("", $item_groups);
580  $mess_txt = "";
581  if ($this->show_empty_list_message) {
582  if ($this->search_text === "") {
583  $mess_txt = ($this->requested_note_type === Note::PRIVATE)
584  ? $lng->txt("notes_no_notes")
585  : $lng->txt("notes_no_comments");
586  } else {
587  $mess_txt = ($this->requested_note_type === Note::PRIVATE)
588  ? $lng->txt("notes_no_notes_found")
589  : $lng->txt("notes_no_comments_found");
590  }
591  $mess = $f->messageBox()->info($mess_txt);
592  //$html = $this->renderComponents([$panel, $mess]);
593  $html = $this->renderComponents([$mess]);
594  $tpl->setVariable("NOTES_LIST", $html);
595  }
596  } elseif ($this->search_text !== "") {
597  $mess_txt = ($this->requested_note_type === Note::PRIVATE)
598  ? $lng->txt("notes_no_notes_found")
599  : $lng->txt("notes_no_comments_found");
600  $mess = $f->messageBox()->info($mess_txt);
601  $tpl->setVariable("NOTES_LIST", $this->renderComponents([$mess]));
602  }
603 
605 
606  // message
607  $mtxt = "";
608  switch ($this->requested_note_mess !== "" ? $this->requested_note_mess : $this->note_mess) {
609  case "mod":
610  $mtype = "success";
611  $mtxt = $lng->txt("msg_obj_modified");
612  break;
613 
614  case "ntsdel":
615  $mtype = "success";
616  $mtxt = ($a_type === Note::PRIVATE)
617  ? $lng->txt("notes_notes_deleted")
618  : $lng->txt("notes_comments_deleted");
619  break;
620 
621  case "ntdel":
622  $mtype = "success";
623  $mtxt = ($a_type === Note::PRIVATE)
624  ? $lng->txt("notes_note_deleted")
625  : $lng->txt("notes_comment_deleted");
626  break;
627 
628  case "frmfld":
629  $mtype = "failure";
630  $mtxt = $lng->txt("form_input_not_valid");
631  break;
632 
633  case "qdel":
634  $mtype = "question";
635  $mtxt = $lng->txt("info_delete_sure");
636  break;
637 
638  case "noc":
639  $mtype = "failure";
640  $mtxt = $lng->txt("no_checkbox");
641  break;
642  }
643  if ($mtxt !== "") {
644  $tpl->setVariable("MESS", ilUtil::getSystemMessageHTML($mtxt, $mtype));
645  } else {
646  $tpl->setVariable("MESS", "");
647  }
648 
649  if ($this->widget_header !== "") {
650  $tpl->setVariable("WIDGET_HEADER", $this->widget_header);
651  }
652 
653  return $tpl->get();
654  }
655 
659  //protected function getSortationControl() : \ILIAS\UI\Component\ViewControl\Sortation
660  protected function getSortationControl(): \ILIAS\UI\Component\Dropdown\Standard
661  {
662  /*
663  $c = $this->lng->txt("create_date") . ", ";
664  $options = [
665  'desc' => $c . $this->lng->txt("sorting_desc"),
666  'asc' => $c . $this->lng->txt("sorting_asc")
667  ];
668  $select_option = (true)
669  ? 'asc'
670  : 'desc';
671  $s = $this->ui->factory()->viewControl()->sortation($options)
672  ->withTargetURL($this->ctrl->getLinkTarget($this, "setSortation"), 'sortation')
673  ->withLabel($options[$select_option]);*/
674  $dd_buttons = [];
675  if ($this->manager->getSortAscending()) {
676  $dd_buttons[] = $this->getShyButton(
677  "sort",
678  $this->lng->txt("notes_sort_desc"),
679  "listSortDesc",
680  "",
681  0
682  );
683  } else {
684  $dd_buttons[] = $this->getShyButton(
685  "sort",
686  $this->lng->txt("notes_sort_asc"),
687  "listSortAsc",
688  "",
689  0
690  );
691  }
692 
693  $s = $this->ui->factory()->dropdown()->standard(
694  $dd_buttons
695  );
696 
697  return $s;
698  }
699 
700  protected function getItemGroupTitle(int $obj_id = 0): string
701  {
702  if (!$this->show_header) {
703  return "";
704  }
705  if (!is_array($this->rep_obj_id) && !$this->getUseObjectTitleHeader()) {
706  $it_group_title = ($this->requested_note_type === Note::PRIVATE)
707  ? $this->lng->txt("notes")
708  : $this->lng->txt("notes_comments");
709  } else {
710  $it_group_title = ($obj_id)
711  ? ilObject::_lookupTitle($obj_id)
712  : $this->lng->txt("note_without_object");
713  }
714  return $it_group_title;
715  }
716 
722  protected function getItemForNote(
723  Note $note,
724  bool $actions = true
725  ): \ILIAS\UI\Component\Item\Item {
726  $f = $this->ui->factory();
727  $ctrl = $this->ctrl;
728 
729 
730  $dd_buttons = [];
731 
732  // edit note stuff for all private notes
733  if ($actions && $this->notes_access->canEdit($note)) {
734  if (!$this->export_html && !$this->print
735  && !$this->edit_note_form && !$this->add_note_form && !$this->no_actions) {
736  $ctrl->setParameterByClass("ilnotegui", "note_id", $note->getId());
737  $dd_buttons[] = $this->getShyButton(
738  "edit_note",
739  $this->lng->txt("edit"),
740  "editNoteForm",
741  "note_" . $note->getId(),
742  $note->getId()
743  );
744  }
745  }
746 
747  // delete note stuff for all private notes
748  if ($actions && !$this->export_html && !$this->print
749  && !$this->no_actions
750  && $this->notes_access->canDelete($note)) {
751  $ctrl->setParameterByClass("ilnotegui", "note_id", $note->getId());
752  $dd_buttons[] = $this->getShyButton(
753  "delete_note",
754  $this->lng->txt("delete"),
755  "deleteNote",
756  "note_" . $note->getId(),
757  $note->getId()
758  );
759  }
760 
761 
762  $creation_date = ilDatePresentation::formatDate(new ilDate($note->getCreationDate(), IL_CAL_DATETIME));
763 
764  $properties = [];
765 
766  // origin
767  if ($this->targets_enabled) {
768  $target = $this->getTarget($note);
769  if ($target["title"] !== "") {
770  if ($target["link"] === "") {
771  $properties[$this->lng->txt("notes_origin")] = $target["title"];
772  } else {
773  $properties[$this->lng->txt("notes_origin")] = $f
774  ->button()
775  ->shy(
776  $target["title"],
777  $target["link"]
778  );
779  }
780  }
781  }
782 
783  // output author account and creation date
784  $img_path = "";
785  $img_alt = "";
786  $avatar = null;
787  if ($note->getType() === Note::PUBLIC) {
788  $avatar = ilObjUser::_getAvatar($note->getAuthor());
789  $title = ilUserUtil::getNamePresentation($note->getAuthor(), false, false);
790  $properties[$this->lng->txt("create_date")] = $creation_date;
791  } else {
792  $title = $creation_date;
793  }
794 
795  // last edited
796  if ($note->getUpdateDate() !== null) {
797  $properties[$this->lng->txt("last_edited_on")] = ilDatePresentation::formatDate(
798  new ilDate(
799  $note->getUpdateDate(),
801  )
802  );
803  }
804 
805  $item = $f->item()->standard($title)
806  ->withDescription($this->getNoteTextPlaceholder($note))
807  ->withProperties($properties);
808  if (!is_null($avatar)) {
809  $item = $item->withLeadAvatar($avatar);
810  }
811  if (count($dd_buttons) > 0) {
812  $item = $item->withActions(
813  $f->dropdown()->standard($dd_buttons)
814  );
815  }
816  return $item;
817  }
818 
819  protected function getNoteTextPlaceholder(Note $note): string
820  {
821  return "##note-text-" . $note->getId() . "##";
822  }
823 
824  protected function getNoteText(Note $note): string
825  {
826  return (trim($note->getText()) !== "")
827  ? nl2br(htmlentities($note->getText()))
828  : $this->lng->txt("note_content_removed");
829  }
830 
834  protected function getSubObjectTitle(
835  int $parent_obj_id,
836  int $sub_obj_id
837  ): string {
838  $objDefinition = $this->obj_definition;
839  $parent_type = ilObject::_lookupType($parent_obj_id);
840  if ($parent_type === "") {
841  return "";
842  }
843  $parent_class = "ilObj" . $objDefinition->getClassName($parent_type) . "GUI";
844  if (method_exists($parent_class, "lookupSubObjectTitle")) {
845  return call_user_func_array(array($parent_class, "lookupSubObjectTitle"), array($parent_obj_id, $sub_obj_id));
846  }
847  return "";
848  }
849 
850  protected function getNoteForm(
851  string $mode,
852  int $type,
853  Note $note = null
854  ): \ILIAS\Repository\Form\FormAdapterGUI {
855  global $DIC;
856 
857  $label_key = "note";
858  $label_key .= ($mode === "create")
859  ? "_add"
860  : "_update";
861  $label_key .= ($type === Note::PUBLIC)
862  ? "_comment"
863  : "_note";
864  $cmd = ($mode === "create")
865  ? "addNote"
866  : "updateNote";
867 
868  $value = ($note)
869  ? $note->getText()
870  : "";
871  if ($cmd === "updateNote") {
872  $this->ctrl->setParameter($this, "note_id", $this->requested_note_id);
873  }
874  $action = $this->ctrl->getFormAction($this, $cmd, "");
875  $form = $this->gui->form(self::class, $action)
876  ->section("props", $this->lng->txt($label_key))
877  ->textarea("note", $this->lng->txt("note_text"), "", $value);
878  return $form;
879  }
880 
884  public function getTarget(
885  Note $note
886  ): array {
887  $tree = $this->tree;
888  $ilAccess = $this->access;
889  $objDefinition = $this->obj_definition;
891 
892  $title = "";
893  $link = "";
894 
895  $a_note_id = $note->getId();
896  $context = $note->getContext();
897  $a_obj_type = $context->getType();
898  $a_obj_id = $context->getSubObjId();
899 
900  if ($context->getObjId() > 0) {
901 
902  // get first visible reference
903  $vis_ref_id = 0;
904  $ref_ids = ilObject::_getAllReferences($context->getObjId());
905  foreach ($ref_ids as $ref_id) {
906  if ($vis_ref_id > 0) {
907  break;
908  }
909  if ($ilAccess->checkAccess("visible", "", $ref_id)) {
910  $vis_ref_id = $ref_id;
911  }
912  }
913 
914  // if we got the reference id
915  if ($vis_ref_id > 0) {
916  $type = ilObject::_lookupType($vis_ref_id, true);
917  $title = ilObject::_lookupTitle($context->getObjId());
918 
919  if ($type === "poll") {
920  $link = ilLink::_getLink($vis_ref_id, "poll");
921  } elseif ($a_obj_type !== "pg") {
922  if (!isset($this->item_list_gui[$type])) {
923  $class = $objDefinition->getClassName($type);
924  $full_class = "ilObj" . $class . "ListGUI";
925  $this->item_list_gui[$type] = new $full_class();
926  }
927 
928  // for references, get original title
929  // (link will lead to orignal, which basically is wrong though)
930  if ($a_obj_type === "crsr" || $a_obj_type === "catr" || $a_obj_type === "grpr") {
931  $tgt_obj_id = ilContainerReference::_lookupTargetId($context->getObjId());
932  $title = ilObject::_lookupTitle($tgt_obj_id);
933  }
934  $this->item_list_gui[$type]->initItem($vis_ref_id, $context->getObjId(), $title, $a_obj_type);
935  $link = $this->item_list_gui[$type]->getCommandLink("infoScreen");
936  $link = $this->item_list_gui[$type]->appendRepositoryFrameParameter($link) . "#note_" . $a_note_id;
937  } else {
938  $title = ilObject::_lookupTitle($context->getObjId());
939  $link = "goto.php?target=pg_" . $a_obj_id . "_" . $vis_ref_id;
940  }
941  } else { // personal workspace
942  // we only need 1 instance
943  if (!isset($this->wsp_tree)) {
944  $this->wsp_tree = new ilWorkspaceTree($ilUser->getId());
945  $this->wsp_access_handler = new ilWorkspaceAccessHandler($this->wsp_tree);
946  }
947  $node_id = $this->wsp_tree->lookupNodeId($context->getObjId());
948  if ($this->wsp_access_handler->checkAccess("visible", "", $node_id)) {
949  $path = $this->wsp_tree->getPathFull($node_id);
950  if ($path) {
951  $item = array_pop($path);
952  $title = $item["title"];
953  $link = ilWorkspaceAccessHandler::getGotoLink($node_id, $context->getObjId());
954  }
955  // shared resource
956  else {
957  $owner = ilObject::_lookupOwner($context->getObjId());
958  $title = ilObject::_lookupTitle($context->getObjId()) .
959  " (" . ilObject::_lookupOwnerName($owner) . ")";
960  $link = "ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace&dsh=" .
961  $owner;
962  }
963  }
964  }
965  }
966  return [
967  "title" => $title,
968  "link" => $link,
969  ];
970  }
971 
975  public function addNoteForm(
976  bool $a_init_form = true
977  ): string {
978  $this->add_note_form = true;
979  return $this->getListHTML($a_init_form);
980  }
981 
985  public function cancelAddNote(): string
986  {
987  return $this->getListHTML();
988  }
989 
993  public function cancelUpdateNote(): string
994  {
995  return $this->getListHTML();
996  }
997 
1001  public function addNote(): void
1002  {
1003  $ilUser = $this->user;
1004  $ilCtrl = $this->ctrl;
1005 
1006  $text = $this->getNoteForm(
1007  "create",
1008  $this->requested_note_type
1009  )->getData("note") ?? "";
1010 
1011  //if ($this->form->checkInput())
1012  if ($text !== "" && !is_array($this->rep_obj_id)) {
1013  $context = $this->data->context(
1014  $this->rep_obj_id,
1015  $this->obj_id,
1016  $this->obj_type,
1017  $this->news_id,
1018  $this->repository_mode
1019  );
1020  $note = $this->data->note(
1021  0,
1022  $context,
1023  $text,
1024  $ilUser->getId(),
1026  );
1027  $this->manager->createNote(
1028  $note,
1029  $this->observer
1030  );
1031 
1032  $ilCtrl->setParameter($this, "note_mess", "mod");
1033  }
1034  $ilCtrl->redirect($this, "getListHTML", "", $this->ctrl->isAsynch());
1035  }
1036 
1037  public function updateNote(): void
1038  {
1039  $ilCtrl = $this->ctrl;
1040 
1041  $note = $this->manager->getById($this->requested_note_id);
1042  $text = $this->getNoteForm(
1043  "edit",
1044  $this->requested_note_type
1045  )->getData("note") ?? "";
1046 
1047  if ($this->notes_access->canEdit($note)) {
1048  $this->manager->updateNoteText(
1049  $this->requested_note_id,
1050  $text,
1051  $this->observer
1052  );
1053  $ilCtrl->setParameter($this, "note_mess", "mod");
1054  }
1055  $ilCtrl->redirect($this, "getListHTML", "", $this->ctrl->isAsynch());
1056  }
1057 
1061  public function editNoteForm(
1062  bool $a_init_form = true
1063  ): string {
1064  $this->edit_note_form = true;
1065 
1066  return $this->getListHTML($a_init_form);
1067  }
1068 
1072  public function renderContent(string $content): string
1073  {
1074  $lng = $this->lng;
1075  $ctrl = $this->ctrl;
1076 
1077  $ntpl = new ilTemplate(
1078  "tpl.notes_and_comments.html",
1079  true,
1080  true,
1081  "Services/Notes"
1082  );
1083 
1084  if (!$ctrl->isAsynch()) {
1085  $ntpl->setVariable("OUTER_ID", " id='notes_embedded_outer' ");
1086  }
1087 
1088  $ntpl->setVariable("CONTENT", $content);
1089 
1090  if ($ctrl->isAsynch() && !$this->request->isFilterCommand()) {
1091  echo $ntpl->get();
1092  exit;
1093  }
1094 
1095  return $ntpl->get();
1096  }
1097 
1098  protected function deleteNote(): string
1099  {
1102 
1103  $f = $this->ui->factory();
1104  $ctrl = $this->ctrl;
1105  $ctrl->setParameter($this, "note_id", $this->requested_note_id);
1106  $note = $this->manager->getById($this->requested_note_id);
1107 
1108  $text = ($this->requested_note_type === Note::PRIVATE)
1109  ? $this->lng->txt("notes_delete_note")
1110  : $this->lng->txt("notes_delete_comment");
1111 
1112  $mess = $f->messageBox()->confirmation($text);
1113  $item = $this->getItemForNote($note, false);
1114 
1115  $b1 = $this->getButton(
1116  "",
1117  $this->lng->txt("cancel"),
1118  "cancelDelete"
1119  );
1120  $b2 = $this->getButton(
1121  "",
1122  $this->lng->txt("delete"),
1123  "confirmDelete"
1124  );
1125 
1126  $it_group_title = $this->getItemGroupTitle($note->getContext()->getObjId());
1127  $item_groups = [$f->item()->group($it_group_title, [$item])];
1128  $panel = $f->panel()->listing()->standard("", $item_groups);
1129 
1130  $html = $this->renderComponents([$mess, $panel, $b2, $b1]);
1131  $html = str_replace($this->getNoteTextPlaceholder($note), $this->getNoteText($note), $html);
1132 
1133  return $this->renderContent($html);
1134  }
1135 
1136  public function cancelDelete(): string
1137  {
1138  return $this->getListHTML();
1139  }
1140 
1141  public function confirmDelete(): void
1142  {
1143  $ilCtrl = $this->ctrl;
1144 
1145  $cnt = 0;
1146  $ids = [$this->request->getNoteId()];
1147  foreach ($ids as $id) {
1148  $note = $this->manager->getById($id);
1149  if ($this->notes_access->canDelete($note, $this->user->getId(), $this->public_deletion_enabled)) {
1150  $this->manager->deleteNote($note, $this->user->getId(), $this->public_deletion_enabled);
1151  $cnt++;
1152  }
1153  }
1154  if ($cnt > 1) {
1155  $ilCtrl->setParameter($this, "note_mess", "ntsdel");
1156  } else {
1157  $ilCtrl->setParameter($this, "note_mess", "ntdel");
1158  }
1159  $ilCtrl->redirect($this, "getListHTML", "", $this->ajax);
1160  }
1161 
1165  public function exportNotesHTML(): void
1166  {
1167  $tpl = new ilGlobalTemplate("tpl.main.html", true, true);
1168 
1169  $this->export_html = true;
1170  //$tpl->setVariable("CONTENT", $this->getListHTML());
1171  //ilUtil::deliverData($tpl->get(), "notes.html");
1172 
1173  $authors = array_unique(array_map(function (Note $note) {
1174  return $note->getAuthor();
1175  }, $this->getNotes($this->requested_note_type)));
1176  $export = new \ILIAS\Notes\Export\NotesHtmlExport(
1177  $this->requested_note_type,
1178  $this->user->getId(),
1179  $authors
1180  );
1181  $export->exportHTML($this->getListHTML());
1182  }
1183 
1187  public static function getListNotesJSCall(
1188  string $a_hash,
1189  string $a_update_code = null
1190  ): string {
1191  if ($a_update_code === null) {
1192  $a_update_code = "null";
1193  } else {
1194  $a_update_code = "'" . $a_update_code . "'";
1195  }
1196 
1197  return "ilNotes.listNotes(event, '" . $a_hash . "', " . $a_update_code . ");";
1198  }
1199 
1203  public static function getListCommentsJSCall(
1204  string $a_hash,
1205  string $a_update_code = null
1206  ): string {
1207  if ($a_update_code === null) {
1208  $a_update_code = "null";
1209  } else {
1210  $a_update_code = "'" . $a_update_code . "'";
1211  }
1212 
1213  return "ilNotes.listComments(event, '" . $a_hash . "', " . $a_update_code . ");";
1214  }
1215 
1219  public function getShyButton(
1220  string $a_var,
1221  string $a_txt,
1222  string $a_cmd,
1223  string $a_anchor = "",
1224  int $note_id = 0
1225  ): \ILIAS\UI\Component\Button\Shy {
1226  $ctrl = $this->ctrl;
1227  $f = $this->ui->factory();
1228 
1229  if ($this->ajax) {
1230  $button = $f->button()->shy(
1231  $a_txt,
1232  "#"
1233  )->withOnLoadCode(function ($id) use ($ctrl, $a_cmd, $note_id) {
1234  $ctrl->setParameterByClass("ilnotegui", "note_id", $note_id);
1235  return
1236  "$('#$id').on('click', () => { ilNotes.cmdAjaxLink(event, '" .
1237  $ctrl->getLinkTargetByClass("ilnotegui", $a_cmd, "", true) .
1238  "');});";
1239  });
1240  } else {
1241  $button = $f->button()->shy(
1242  $a_txt,
1243  $ctrl->getLinkTargetByClass("ilnotegui", $a_cmd, $a_anchor)
1244  );
1245  }
1246  return $button;
1247  }
1248 
1252  public function getButton(
1253  string $a_var,
1254  string $a_txt,
1255  string $a_cmd,
1256  string $a_anchor = ""
1257  ): \ILIAS\UI\Component\Button\Standard {
1258  $ctrl = $this->ctrl;
1259  $f = $this->ui->factory();
1260 
1261  if ($this->ajax) {
1262  $button = $f->button()->standard(
1263  $a_txt,
1264  "#"
1265  )->withOnLoadCode(function ($id) use ($ctrl, $a_cmd) {
1266  return
1267  "$('#$id').on('click', () => { ilNotes.cmdAjaxLink(event, '" .
1268  $ctrl->getLinkTargetByClass("ilnotegui", $a_cmd, "", true) .
1269  "');});";
1270  });
1271  } else {
1272  $button = $f->button()->standard(
1273  $a_txt,
1274  $ctrl->getLinkTargetByClass("ilnotegui", $a_cmd, $a_anchor)
1275  );
1276  }
1277  return $button;
1278  }
1279 
1283  public function addObserver(
1284  callable $a_callback
1285  ): void {
1286  $this->observer[] = $a_callback;
1287  }
1288 
1289  protected function listSortAsc(): string
1290  {
1291  $this->manager->setSortAscending(true);
1292  return $this->getListHTML();
1293  }
1294 
1295  protected function listSortDesc(): string
1296  {
1297  $this->manager->setSortAscending(false);
1298  return $this->getListHTML();
1299  }
1300 
1304  public function getHTML(): string
1305  {
1306  $this->gui->initJavascript();
1307  return $this->getCommentsWidget();
1308  }
1309 
1310  protected function getCommentsWidget(): string
1311  {
1312  $f = $this->ui->factory();
1313  $r = $this->ui->renderer();
1314  $lng = $this->lng;
1315  $ctrl = $this->ctrl;
1316  $ctrl->setParameter($this, "news_id", $this->news_id);
1319  null,
1320  ilObject::_lookupType($this->rep_obj_id),
1321  $this->rep_obj_id,
1322  $this->obj_type,
1323  $this->obj_id,
1324  $this->news_id
1325  );
1326 
1327  $context = $this->data->context(
1328  $this->rep_obj_id,
1329  $this->obj_id,
1330  $this->obj_type,
1331  $this->news_id
1332  );
1333 
1334  $cnt[$this->rep_obj_id][Note::PUBLIC] = $this->manager->getNrOfNotesForContext($context, Note::PUBLIC);
1335  $cnt[$this->rep_obj_id][Note::PRIVATE] = $this->manager->getNrOfNotesForContext($context, Note::PRIVATE);
1336  $cnt = $cnt[$this->rep_obj_id][Note::PUBLIC] ?? 0;
1337 
1338  $tpl = new ilTemplate("tpl.note_widget_header.html", true, true, "Services/Notes");
1339  $widget_el_id = "notew_" . str_replace(";", "_", $hash);
1340  $ctrl->setParameter($this, "hash", $hash);
1341  $update_url = $ctrl->getLinkTarget($this, "updateWidget", "", true, false);
1342  $comps = array();
1343  if ($cnt > 0) {
1344  $c = $f->counter()->status((int) $cnt);
1345  $comps[] = $f->symbol()->glyph()->comment()->withCounter($c)->withAdditionalOnLoadCode(function ($id) use ($hash, $update_url, $widget_el_id) {
1346  return "$(\"#$id\").click(function(event) { " . self::getListCommentsJSCall($hash, "ilNotes.updateWidget(\"" . $widget_el_id . "\",\"" . $update_url . "\");") . "});";
1347  });
1348  $comps[] = $f->divider()->vertical();
1349  $tpl->setVariable("GLYPH", $r->render($comps));
1350  $tpl->setVariable("TXT_LATEST", $lng->txt("notes_latest_comment"));
1351  }
1352 
1353  $b = $f->button()->shy($lng->txt("notes_add_edit_comment"), "#")->withAdditionalOnLoadCode(function ($id) use ($hash, $update_url, $widget_el_id) {
1354  return "$(\"#$id\").click(function(event) { " . self::getListCommentsJSCall($hash, "ilNotes.updateWidget(\"" . $widget_el_id . "\",\"" . $update_url . "\");") . "});";
1355  });
1356  if ($ctrl->isAsynch()) {
1357  $tpl->setVariable("SHY_BUTTON", $r->renderAsync($b));
1358  } else {
1359  $tpl->setVariable("SHY_BUTTON", $r->render($b));
1360  }
1361 
1362  $this->widget_header = $tpl->get();
1363 
1364  $this->hide_new_form = true;
1365  $this->only_latest = true;
1366  $this->no_actions = true;
1367  $html = "<div id='" . $widget_el_id . "'>" . $this->getNoteListHTML(Note::PUBLIC) . "</div>";
1368  $ctrl->setParameter($this, "news_id", $this->requested_news_id);
1369  return $html;
1370  }
1371 
1372  public function setExportMode(): void
1373  {
1374  $this->hide_new_form = true;
1375  $this->no_actions = true;
1376  $this->enable_sorting = false;
1377  $this->user_img_export_html = true;
1378  }
1379 
1380  protected function updateWidget(): void
1381  {
1382  echo $this->getCommentsWidget();
1383  exit;
1384  }
1385 
1386  protected function getOriginHeader(): string
1387  {
1388  if (!is_array($this->rep_obj_id) && !$this->only_latest && $this->ctrl->isAsynch()) {
1389  switch ($this->obj_type) {
1390  case "grpr":
1391  case "catr":
1392  case "crsr":
1393  $title = ilContainerReference::_lookupTitle($this->rep_obj_id);
1394  break;
1395 
1396  default:
1397  $title = ilObject::_lookupTitle($this->rep_obj_id);
1398  break;
1399  }
1400 
1401  $img = ilUtil::img(ilObject::_getIcon($this->rep_obj_id, "tiny"));
1402 
1403  // add sub-object if given
1404  if ($this->obj_id) {
1405  $sub_title = $this->getSubObjectTitle($this->rep_obj_id, $this->obj_id);
1406  if ($sub_title) {
1407  $title .= " - " . $sub_title;
1408  }
1409  }
1410 
1411  return $img . " " . $title;
1412  }
1413  return "";
1414  }
1415 }
getButton(string $a_var, string $a_txt, string $a_cmd, string $a_anchor="")
bool $enable_sorting
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
exit
Definition: login.php:28
static getSystemMessageHTML(string $a_txt, string $a_type="info")
Get HTML for a system message.
enableCommentsSettings(bool $a_enable=true)
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
StandardGUIRequest $request
static _lookupTitle(int $obj_id)
$context
Definition: webdav.php:29
redirectByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false)
Class Factory.
const IL_CAL_DATETIME
$c
Definition: cli.php:38
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
ILIAS Notes AccessManager $notes_access
const ANONYMOUS_USER_ID
Definition: constants.php:27
static getLogger(string $a_component_id)
Get component logger.
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
bool $edit_note_form
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
bool $show_empty_list_message
special template class to simplify handling of ITX/PEAR
$type
getItemGroupTitle(int $obj_id=0)
bool $comments_settings
string $obj_type
if(isset($_FILES['img_file']) &&is_array($_FILES['img_file'])) $panel
Definition: imgupload.php:198
getNotes(int $a_type)
int $requested_note_type
array $item_list_gui
ILIAS DI UIServices $ui
Class ChatMainBarProvider .
static _getAllReferences(int $id)
get all reference ids for object ID
NotesManager $manager
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getGotoLink(int $a_node_id, int $a_obj_id, string $a_additional="")
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
addNoteForm(bool $a_init_form=true)
get notes list including add note area
ilWorkspaceAccessHandler $wsp_access_handler
setDefaultCommand(string $a_val)
enablePrivateNotes(bool $a_enable=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setParameterByClass(string $a_class, string $a_parameter, $a_value)
__construct( $a_rep_obj_id=0, int $a_obj_id=0, string $a_obj_type="", bool $a_include_subobjects=false, int $a_news_id=0, bool $ajax=true, string $search_text="")
int $requested_news_id
static _lookupOwner(int $obj_id)
Lookup owner user ID for object ID.
ilObjectDefinition $obj_definition
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
ilSetting $settings
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
string $requested_note_mess
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$path
Definition: ltiservices.php:32
bool $repository_mode
getItemForNote(Note $note, bool $actions=true)
ilWorkspaceTree $wsp_tree
static _getAvatar(int $a_usr_id)
Notes GUI class.
ILIAS Notes InternalGUIService $gui
bool $user_img_export_html
enableTargets(bool $a_enable=true)
bool $add_note_form
global $DIC
Definition: feed.php:28
getNoteTextPlaceholder(Note $note)
exportNotesHTML()
export selected notes to html
parses the objects.xml it handles the xml-description of all ilias objects
bool $public_deletion_enabled
setUseObjectTitleHeader(bool $a_val)
getSubObjectTitle(int $parent_obj_id, int $sub_obj_id)
Get sub object title if available with callback.
$ref_id
Definition: ltiauth.php:67
setHideNewForm(bool $a_val)
ilLanguage $lng
ilAccessHandler $access
getListHTML(bool $a_init_form=true)
static _lookupTitle(int $obj_id)
string $note_mess
addNote()
add note
bool $private_enabled
ilObjUser $user
setRepositoryMode(bool $a_value)
getNoteText(Note $note)
setShowEmptyListMessage(bool $a_val)
setShowHeader(bool $a_val)
string $default_command
cancelUpdateNote()
cancel edit note
ilTemplate $form_tpl
string $widget_header
string $search_text
bool $targets_enabled
bool $hide_new_form
enablePublicNotesDeletion(bool $a_enable=true)
int $requested_note_id
getShyButton(string $a_var, string $a_txt, string $a_cmd, string $a_anchor="", int $note_id=0)
bool $use_obj_title_header
addObserver(callable $a_callback)
Add observer.
$img
Definition: imgupload.php:83
bool $public_enabled
static buildAjaxHash(int $node_type, ?int $node_id, string $obj_type, int $obj_id, string $sub_type=null, int $sub_id=null, int $news_id=0)
Build ajax hash.
renderContent(string $content)
Render content into notes wrapper.
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
static getListNotesJSCall(string $a_hash, string $a_update_code=null)
Get list notes js call.
getNoteForm(string $mode, int $type, Note $note=null)
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:34
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getHTML()
Get HTML.
static _lookupTargetId(int $a_obj_id)
enablePublicNotes(bool $a_enable=true)
static _lookupOwnerName(int $owner_id)
Lookup owner name for owner id.
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
static getListCommentsJSCall(string $a_hash, string $a_update_code=null)
Get list comments js call.
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
static _lookupType(int $id, bool $reference=false)
static setUseRelativeDates(bool $a_status)
set use relative dates
cancelAddNote()
cancel add note
getNoteListHTML(int $a_type=Note::PRIVATE, bool $a_init_form=true)
ilLogger $log
getTarget(Note $note)
show related objects as links
editNoteForm(bool $a_init_form=true)
get notes list including add note area
ILIAS Notes InternalDataService $data
renderComponents(array $components)