ILIAS  trunk Revision v12.0_alpha-1227-g7ff6d300864
class.ilNoteGUI.php
Go to the documentation of this file.
1<?php
2
23
28{
29 protected \ILIAS\Notes\InternalDomainService $domain;
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 array|int $rep_obj_id;
58 protected ilCtrl $ctrl;
59 protected ilLanguage $lng;
60 protected ilObjUser $user;
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;
80 protected int $note_type = Note::PRIVATE;
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 protected int $recipient = 0;
91
101 public function __construct(
102 array|int $a_rep_obj_id = 0,
103 int $a_obj_id = 0,
104 string $a_obj_type = "",
105 bool $a_include_subobjects = false,
106 int $a_news_id = 0,
107 bool $ajax = true,
108 string $search_text = ""
109 ) {
110 global $DIC;
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->domain = $ns->domain();
131 $this->gui = $ns->gui();
132 $this->notes_access = $ns->domain()->noteAccess();
133
134 $this->lng->loadLanguageModule("notes");
135
136 $ilCtrl->saveParameter($this, "notes_only");
137
138 $this->rep_obj_id = $a_rep_obj_id;
139 $this->obj_id = $a_obj_id;
140 $this->obj_type = $a_obj_type;
141 $this->inc_sub = $a_include_subobjects;
142 $this->news_id = $a_news_id;
143
144 // auto-detect object type
145 if (!is_array($a_rep_obj_id) && !$this->obj_type && $a_rep_obj_id) {
146 $this->obj_type = ilObject::_lookupType($a_rep_obj_id);
147 }
148
149 $this->ajax = $ajax;
150
151 $this->ctrl = $ilCtrl;
152
153 $this->add_note_form = false;
154 $this->edit_note_form = false;
155 $this->private_enabled = false;
156
157 if (!is_array($this->rep_obj_id)) {
158 if ($this->manager->commentsActive($this->rep_obj_id)) {
159 $this->public_enabled = true;
160 } else {
161 $this->public_enabled = false;
162 }
163 }
164 $this->targets_enabled = false;
165 $this->export_html = false;
166 $this->print = false;
167 $this->comments_settings = false;
168
169 // default: notes for repository objects
170 $this->setRepositoryMode(true);
171
172 $this->ctrl->saveParameter($this, "note_type");
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 {
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 case strtolower(ilCommentGUI::class):
230 $gui = $this->gui->getCommentsGUI(
231 $this->rep_obj_id,
232 $this->obj_id,
233 $this->obj_type,
234 $this->news_id,
235 $this->inc_sub,
236 $this->ajax,
237 $this->search_text
238 );
239 $gui->enableCommentsSettings($this->comments_settings);
240 $this->ctrl->forwardCommand($gui);
241 break;
242
243 default:
244 return $this->$cmd();
245 }
246 }
247
248 public function enablePrivateNotes(bool $a_enable = true): void
249 {
250 $this->private_enabled = $a_enable;
251 }
252
253 public function enablePublicNotes(bool $a_enable = true): void
254 {
255 $this->public_enabled = $a_enable;
256 }
257
258 public function enableCommentsSettings(bool $a_enable = true): void
259 {
260 $this->comments_settings = $a_enable;
261 }
262
263 public function enablePublicNotesDeletion(bool $a_enable = true): void
264 {
265 $this->public_deletion_enabled = $a_enable;
266 }
267
268 // enable target objects
269 public function enableTargets(bool $a_enable = true): void
270 {
271 $this->targets_enabled = $a_enable;
272 }
273
274 public function setRepositoryMode(bool $a_value): void
275 {
276 $this->repository_mode = $a_value;
277 }
278
279 public function getNotesHTML(): string
280 {
281 $ilCtrl = $this->ctrl;
282 $ilCtrl->setParameter($this, "notes_type", Note::PRIVATE);
283 return $this->getListHTML($a_init_form = true);
284 }
285
286 public function getListHTML(bool $a_init_form = true): string
287 {
288 $content = $this->getNoteListHTML($a_init_form);
289 return $this->renderContent($content);
290 }
291
292 protected function renderComponents(array $components): string
293 {
294 if ($this->ctrl->isAsynch()) {
295 return $this->ui->renderer()->renderAsync($components);
296 }
297 return $this->ui->renderer()->render($components);
298 }
299
300 // temporary forward to commentGUI
301 protected function getCommentsHTML(): string
302 {
303 $this->ctrl->redirectByClass(ilCommentGUI::class, "getListHTML", "", $this->ajax);
304 return "";
305 }
306
307 public function activateComments(): void
308 {
309 $ilCtrl = $this->ctrl;
310
311 if ($this->comments_settings) {
312 $this->manager->activateComments($this->rep_obj_id, true);
313 }
314
315 $ilCtrl->redirectByClass(static::class, "getListHTML", "", $this->ajax);
316 }
317
318 public function deactivateComments(): void
319 {
320 $ilCtrl = $this->ctrl;
321
322 if ($this->comments_settings) {
323 $this->manager->activateComments($this->rep_obj_id, false);
324 }
325
326 $ilCtrl->redirectByClass(static::class, "getListHTML", "", $this->ajax);
327 }
328
332 protected function getNotes(): array
333 {
334 if ($this->notes === null) {
335 $ilUser = $this->user;
336 $filter = null;
337 if ($this->export_html || $this->print) {
338 if ($this->requested_note_id > 0) {
339 $filter = $this->requested_note_id;
340 } else {
341 $filter = $this->request->getNoteText();
342 }
343 }
344
345 $ascending = $this->manager->getSortAscending();
346 if ($this->only_latest) {
347 $order = false;
348 }
349 $author_id = ($this->note_type === Note::PRIVATE)
350 ? $ilUser->getId()
351 : 0;
352
353 if (!is_array($this->rep_obj_id)) {
354 $notes = $this->manager->getNotesForContext(
355 $this->data->context(
356 $this->rep_obj_id,
357 $this->obj_id,
358 $this->obj_type,
359 $this->news_id,
360 $this->repository_mode
361 ),
364 $author_id,
365 $ascending,
366 "",
368 );
369 } else {
370 $notes = $this->manager->getNotesForRepositoryObjIds(
371 $this->rep_obj_id,
372 $this->note_type,
373 $this->inc_sub,
374 $author_id,
375 $ascending,
376 "",
377 $this->search_text
378 );
379 }
380 $this->notes = $notes;
381 }
382 return $this->notes;
383 }
384
385 public function getNoteListHTML(
386 bool $a_init_form = true
387 ): string {
388 $lng = $this->lng;
389 $ilCtrl = $this->ctrl;
390 $f = $this->ui->factory();
391 $ilUser = $this->user;
392
393 $mtype = "";
394
395 $notes = $this->getNotes();
396
397 $tpl = new ilTemplate("tpl.notes_list.html", true, true, "components/ILIAS/Notes");
398
399 // show counter if notes are hidden
400 $cnt_str = (count($notes) > 0)
401 ? " (" . count($notes) . ")"
402 : "";
403
404 // origin header
405 $origin_header = $this->getOriginHeader();
406 if ($origin_header != "") {
407 $tpl->setCurrentBlock("title");
408 $tpl->setVariable("TITLE", $origin_header);
409 $tpl->parseCurrentBlock();
410 }
411
412 $tpl->setVariable("TXT_NOTES", $this->getListTitle() . $cnt_str);
413 $anch = "";
414
415 // show add new note text area
416 if (!$this->edit_note_form && !is_array($this->rep_obj_id) &&
417 !$this->hide_new_form && $ilUser->getId() !== ANONYMOUS_USER_ID) {
418 $tpl->setCurrentBlock("edit_note_form");
419 $b_caption = $this->getAddText();
420 $b = $this->ui->factory()->button()->standard(
421 $b_caption,
422 "#"
423 );
424 $tpl->setVariable("EDIT_STYLE", "display:none;");
425 $tpl->setVariable(
426 "EDIT_FORM_ACTION",
427 $ilCtrl->getFormActionByClass(static::class, "addNote", "", true)
428 );
429 $tpl->setVariable(
430 "TXT_CANCEL",
431 $this->lng->txt("cancel")
432 );
433 $tpl->setVariable(
434 "EDIT_FORM_BUTTON",
435 $this->renderComponents([$b])
436 );
437 $tpl->setVariable(
438 "EDIT_FORM",
439 $this->getNoteForm("create", $this->note_type)->render()
440 );
441 $tpl->parseCurrentBlock();
442 }
443
444 // list all notes
447
448 $notes_given = false;
449
450 // edit form
451 if ($this->edit_note_form) {
452 $note = $this->manager->getById($this->requested_note_id);
453 $ilCtrl->setParameterByClass(static::class, "note_id", $this->requested_note_id);
454 $tpl->setVariable(
455 "EDIT_FORM_ACTION",
456 $ilCtrl->getFormActionByClass(static::class, "updateNote", "", true)
457 );
458 $tpl->setVariable(
459 "CANCEL_FORM_ACTION",
460 $ilCtrl->getFormActionByClass(static::class, "cancelUpdateNote", "", true)
461 );
462 $tpl->setVariable("NOTE_FOCUS", "1");
463 $tpl->setVariable(
464 "TXT_CANCEL",
465 $this->lng->txt("cancel")
466 );
467 $tpl->setVariable(
468 "EDIT_FORM",
469 $this->getNoteForm("edit", $this->note_type, $note)->render()
470 );
471 $tpl->parseCurrentBlock();
472 }
473
474 $items = [];
475 $item_groups = [];
476 $text_placeholders = [];
477 $texts = [];
478 $last_obj_id = null;
479 foreach ($notes as $note) {
480 if ($this->only_latest && $notes_given) {
481 continue;
482 }
483
484 $current_obj_id = $note->getContext()->getObjId();
485 if ($last_obj_id !== null && $current_obj_id !== $last_obj_id) {
486 $it_group_title = $this->getItemGroupTitle($last_obj_id);
487 $item_groups[] = $f->item()->group($it_group_title, $items);
488 $items = [];
489 }
490 $last_obj_id = $current_obj_id;
491
492 $items[] = $this->getItemForNote($note);
493 $notes_given = true;
494
495 $text_placeholders[] = $this->getNoteTextPlaceholder($note);
496 $texts[] = $this->getNoteText($note);
497 }
498
499 $it_group_title = $this->getItemGroupTitle((int) $last_obj_id);
500 $item_groups[] = $f->item()->group($it_group_title, $items);
501
502 if ($notes_given) {
503 if (!is_array($this->rep_obj_id)) {
504 $title = $item_groups[0]->getTitle();
505 $item_groups[0] = $f->item()->group("", $item_groups[0]->getItems());
506 } else {
507 $title = "";
508 }
509 $panel = $f->panel()->listing()->standard($title, $item_groups);
510 if (!is_array($this->rep_obj_id) && !$this->no_actions) {
511 $panel = $panel->withActions($this->getSortationControl());
512 }
513 $html = $this->renderComponents([$panel]);
514 $html = str_replace($text_placeholders, $texts, $html);
515 $tpl->setVariable("NOTES_LIST", $html);
516 } elseif (!is_array($this->rep_obj_id)) {
517 $it_group_title = $this->getItemGroupTitle($this->rep_obj_id);
518 $item_groups = [$f->item()->group($it_group_title, [])];
519 $panel = $f->panel()->listing()->standard("", $item_groups);
520 $mess_txt = "";
521 if ($this->show_empty_list_message) {
522 $mess_txt = $this->getNoEntriesText($this->search_text !== "");
523 $mess = $f->messageBox()->info($mess_txt);
524 //$html = $this->renderComponents([$panel, $mess]);
525 $html = $this->renderComponents([$mess]);
526 $tpl->setVariable("NOTES_LIST", $html);
527 }
528 } elseif ($this->search_text !== "") {
529 $mess_txt = $this->getNoEntriesText(true);
530 $mess = $f->messageBox()->info($mess_txt);
531 $tpl->setVariable("NOTES_LIST", $this->renderComponents([$mess]));
532 }
533
535
536 // message
537 $mtxt = "";
538 switch ($this->requested_note_mess !== "" ? $this->requested_note_mess : $this->note_mess) {
539 case "mod":
540 $mtype = "success";
541 $mtxt = $lng->txt("msg_obj_modified");
542 break;
543
544 case "ntsdel":
545 $mtype = "success";
546 $mtxt = $this->getDeletedMultipleText();
547 break;
548
549 case "ntdel":
550 $mtype = "success";
551 $mtxt = $this->getDeletedSingleText();
552 break;
553
554 case "frmfld":
555 $mtype = "failure";
556 $mtxt = $lng->txt("form_input_not_valid");
557 break;
558
559 case "qdel":
560 $mtype = "question";
561 $mtxt = $lng->txt("info_delete_sure");
562 break;
563
564 case "noc":
565 $mtype = "failure";
566 $mtxt = $lng->txt("no_checkbox");
567 break;
568 }
569 if ($mtxt !== "") {
570 $tpl->setVariable("MESS", ilUtil::getSystemMessageHTML($mtxt, $mtype));
571 } else {
572 $tpl->setVariable("MESS", "");
573 }
574
575 if ($this->widget_header !== "") {
576 $tpl->setVariable("WIDGET_HEADER", $this->widget_header);
577 }
578
579 return $tpl->get();
580 }
581
582 protected function getListTitle(): string
583 {
584 return $this->lng->txt("private_notes");
585 }
586
587 protected function getAddText(): string
588 {
589 return $this->lng->txt("note_add_note");
590 }
591
592 protected function getDeletedMultipleText(): string
593 {
594 return $this->lng->txt("notes_notes_deleted");
595 }
596
597 protected function getDeletedSingleText(): string
598 {
599 return $this->lng->txt("notes_note_deleted");
600 }
601
602 protected function getLatestItemText(): string
603 {
604 return "";
605 }
606
607 protected function getAddEditItemText(): string
608 {
609 return $this->lng->txt("notes_add_edit_note");
610 }
611
612 protected function getNoEntriesText(bool $search): string
613 {
614 if (!$search) {
615 $mess_txt = $this->lng->txt("notes_no_notes");
616 } else {
617 $mess_txt = $this->lng->txt("notes_no_notes_found");
618 }
619 return $mess_txt;
620 }
621
625 //protected function getSortationControl() : \ILIAS\UI\Component\ViewControl\Sortation
626 protected function getSortationControl(): \ILIAS\UI\Component\Dropdown\Standard
627 {
628 /*
629 $c = $this->lng->txt("create_date") . ", ";
630 $options = [
631 'desc' => $c . $this->lng->txt("sorting_desc"),
632 'asc' => $c . $this->lng->txt("sorting_asc")
633 ];
634 $select_option = (true)
635 ? 'asc'
636 : 'desc';
637 $s = $this->ui->factory()->viewControl()->sortation($options, $select_option)
638 ->withTargetURL($this->ctrl->getLinkTarget($this, "setSortation"), 'sortation');
639 */
640 $dd_buttons = [];
641 if ($this->manager->getSortAscending()) {
642 $dd_buttons[] = $this->getShyButton(
643 "sort",
644 $this->lng->txt("notes_sort_desc"),
645 "listSortDesc",
646 "",
647 0
648 );
649 } else {
650 $dd_buttons[] = $this->getShyButton(
651 "sort",
652 $this->lng->txt("notes_sort_asc"),
653 "listSortAsc",
654 "",
655 0
656 );
657 }
658
659 $s = $this->ui->factory()->dropdown()->standard(
660 $dd_buttons
661 );
662
663 return $s;
664 }
665
666 protected function getItemGroupTitle(int $obj_id = 0): string
667 {
668 if (!$this->show_header) {
669 return "";
670 }
671 if (!is_array($this->rep_obj_id) && !$this->getUseObjectTitleHeader()) {
672 $it_group_title = $this->lng->txt("notes");
673 } else {
674 $it_group_title = ($obj_id)
675 ? ilObject::_lookupTitle($obj_id)
676 : $this->lng->txt("note_without_object");
677 }
678 return $it_group_title;
679 }
680
686 protected function getItemForNote(
687 Note $note,
688 bool $actions = true
689 ): \ILIAS\UI\Component\Item\Item {
690 $f = $this->ui->factory();
691 $ctrl = $this->ctrl;
692 //return $f->item()->standard("");
693
694 $dd_buttons = [];
695
696 // edit note stuff for all private notes
697 if ($actions && $this->notes_access->canEdit($note)) {
698 if (!$this->export_html && !$this->print
699 && !$this->edit_note_form && !$this->add_note_form && !$this->no_actions) {
700 $ctrl->setParameterByClass(static::class, "note_id", $note->getId());
701 $dd_buttons[] = $this->getShyButton(
702 "edit_note",
703 $this->lng->txt("edit"),
704 "editNoteForm",
705 "note_" . $note->getId(),
706 $note->getId()
707 );
708 }
709 }
710
711 // delete note stuff for all private notes
712 if ($actions && !$this->export_html && !$this->print
713 && !$this->no_actions
714 && $this->notes_access->canDelete($note)) {
715 $ctrl->setParameterByClass(static::class, "note_id", $note->getId());
716 $dd_buttons[] = $this->getShyButton(
717 "delete_note",
718 $this->lng->txt("delete"),
719 "deleteNote",
720 "note_" . $note->getId(),
721 $note->getId()
722 );
723 }
724
725
727
728 $properties = [];
729
730 // origin
731 if ($this->targets_enabled) {
732 $target = $this->getTarget($note);
733 if ($target["title"] !== "") {
734 if ($target["link"] === "") {
735 $properties[$this->lng->txt("notes_origin")] = $target["title"];
736 } else {
737 $properties[$this->lng->txt("notes_origin")] = $f
738 ->button()
739 ->shy(
740 $target["title"],
741 $target["link"]
742 );
743 }
744 }
745 }
746
747 // output author account and creation date
748 $img_path = "";
749 $img_alt = "";
750 $avatar = null;
751 $title = $this->getItemTitle($note);
752 if ($note->getType() === Note::PUBLIC) {
753 $avatar = $this->gui->profile()->getAvatar($note->getAuthor());
754 }
755 $this->addItemProperties($note, $properties);
756
757 // last edited
758 if ($note->getUpdateDate() !== null) {
759 $properties[$this->lng->txt("last_edited_on")] = ilDatePresentation::formatDate(
760 new ilDate(
761 $note->getUpdateDate(),
763 )
764 );
765 }
766
767 $item = $f->item()->standard($title)
768 ->withDescription($this->getNoteTextPlaceholder($note))
769 ->withProperties($properties);
770 if (!is_null($avatar)) {
771 $item = $item->withLeadAvatar($avatar);
772 }
773 if (count($dd_buttons) > 0) {
774 $item = $item->withActions(
775 $f->dropdown()->standard($dd_buttons)
776 );
777 }
778 return $item;
779 }
780
781 protected function getItemTitle(Note $note): string
782 {
784 if ($note->getType() === Note::PUBLIC) {
785 $title = ilUserUtil::getNamePresentation($note->getAuthor(), false, false);
786 } else {
787 $title = $creation_date;
788 }
789 return $title;
790 }
791
792 protected function addItemProperties(Note $note, array &$properties): void
793 {
795 if ($note->getType() === Note::PUBLIC) {
796 $properties[$this->lng->txt("create_date")] = $creation_date;
797 }
798 }
799
800 protected function getNoteTextPlaceholder(Note $note): string
801 {
802 return "##note-text-" . $note->getId() . "##";
803 }
804
805 protected function getNoteText(Note $note): string
806 {
807 return (trim($note->getText()) !== "")
808 ? nl2br(htmlentities($note->getText()))
809 : $this->lng->txt("note_content_removed");
810 }
811
815 protected function getSubObjectTitle(
816 int $parent_obj_id,
817 int $sub_obj_id
818 ): string {
819 $objDefinition = $this->obj_definition;
820 $parent_type = ilObject::_lookupType($parent_obj_id);
821 if ($parent_type === "") {
822 return "";
823 }
824 $parent_class = "ilObj" . $objDefinition->getClassName($parent_type) . "GUI";
825 if (method_exists($parent_class, "lookupSubObjectTitle")) {
826 return call_user_func_array(array($parent_class, "lookupSubObjectTitle"), array($parent_obj_id, $sub_obj_id));
827 }
828 return "";
829 }
830
831 protected function getNoteForm(
832 string $mode,
833 int $type,
834 ?Note $note = null
835 ): \ILIAS\Repository\Form\FormAdapterGUI {
836 global $DIC;
837
838 $label_key = "note";
839 $label_key .= ($mode === "create")
840 ? "_add"
841 : "_update";
842 $label_key .= "_" . $this->getFormLabelKey($type);
843 $cmd = ($mode === "create")
844 ? "addNote"
845 : "updateNote";
846
847 $value = ($note)
848 ? $note->getText()
849 : "";
850 if ($cmd === "updateNote") {
851 $this->ctrl->setParameter($this, "note_id", $this->requested_note_id);
852 }
853 $action = $this->ctrl->getFormActionByClass(static::class, $cmd, "");
854 $form = $this->gui->form([static::class], $action)
855 ->section("props", $this->lng->txt($label_key))
856 ->textarea("note", $this->lng->txt("note_text"), "", $value);
857 return $form;
858 }
859
860 protected function getFormLabelKey(): string
861 {
862 return "note";
863 }
864
868 public function getTarget(
869 Note $note
870 ): array {
871 $tree = $this->tree;
872 $ilAccess = $this->access;
873 $objDefinition = $this->obj_definition;
874 $ilUser = $this->user;
875
876 $title = "";
877 $link = "";
878
879 $a_note_id = $note->getId();
880 $context = $note->getContext();
881 $a_obj_type = $context->getType();
882 $a_obj_id = $context->getSubObjId();
883
884 if ($context->getObjId() > 0) {
885 // get first visible reference
886 $vis_ref_id = 0;
887 $ref_ids = ilObject::_getAllReferences($context->getObjId());
888 foreach ($ref_ids as $ref_id) {
889 if ($vis_ref_id > 0) {
890 break;
891 }
892 if ($ilAccess->checkAccess("visible", "", $ref_id)) {
893 $vis_ref_id = $ref_id;
894 }
895 }
896
897 // if we got the reference id
898 if ($vis_ref_id > 0) {
899 $type = ilObject::_lookupType($vis_ref_id, true);
900 $title = ilObject::_lookupTitle($context->getObjId());
901
902 if ($type === "poll") {
903 $link = ilLink::_getLink($vis_ref_id, "poll");
904 } elseif ($a_obj_type !== "pg") {
905 if (!isset($this->item_list_gui[$type])) {
906 $class = $objDefinition->getClassName($type);
907 $full_class = "ilObj" . $class . "ListGUI";
908 $this->item_list_gui[$type] = new $full_class();
909 }
910
911 // for references, get original title
912 // (link will lead to orignal, which basically is wrong though)
913 if ($a_obj_type === "crsr" || $a_obj_type === "catr" || $a_obj_type === "grpr") {
914 $tgt_obj_id = ilContainerReference::_lookupTargetId($context->getObjId());
915 $title = ilObject::_lookupTitle($tgt_obj_id);
916 }
917 $this->item_list_gui[$type]->initItem($vis_ref_id, $context->getObjId(), $title, $a_obj_type);
918 $link = $this->item_list_gui[$type]->getCommandLink("infoScreen");
919 if ($link === "") {
920 $link = (string) $this->domain->staticUrl()->builder()->build($type, new ReferenceId($vis_ref_id));
921 } else {
922 $link = $this->item_list_gui[$type]->appendRepositoryFrameParameter($link) . "#note_" . $a_note_id;
923 }
924 } else {
925 $title = ilObject::_lookupTitle($context->getObjId());
926 $link = "goto.php?target=pg_" . $a_obj_id . "_" . $vis_ref_id;
927 }
928 } else { // personal workspace
929 // we only need 1 instance
930 if (!isset($this->wsp_tree)) {
931 $this->wsp_tree = new ilWorkspaceTree($ilUser->getId());
932 $this->wsp_access_handler = new ilWorkspaceAccessHandler($this->wsp_tree);
933 }
934 $node_id = $this->wsp_tree->lookupNodeId($context->getObjId());
935 if ($this->wsp_access_handler->checkAccess("visible", "", $node_id)) {
936 $path = $this->wsp_tree->getPathFull($node_id);
937 if ($path) {
938 $item = array_pop($path);
939 $title = $item["title"];
940 $link = ilWorkspaceAccessHandler::getGotoLink($node_id, $context->getObjId());
941 }
942 // shared resource
943 else {
944 $owner = ilObject::_lookupOwner($context->getObjId());
945 $title = ilObject::_lookupTitle($context->getObjId()) .
946 " (" . ilObject::_lookupOwnerName($owner) . ")";
947 $link = "ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace&dsh=" .
948 $owner;
949 }
950 }
951 }
952 }
953 return [
954 "title" => $title,
955 "link" => $link,
956 ];
957 }
958
962 public function addNoteForm(
963 bool $a_init_form = true
964 ): string {
965 $this->add_note_form = true;
966 return $this->getListHTML($a_init_form);
967 }
968
972 public function cancelAddNote(): string
973 {
974 return $this->getListHTML();
975 }
976
980 public function cancelUpdateNote(): string
981 {
982 return $this->getListHTML();
983 }
984
988 public function addNote(): void
989 {
990 $ilUser = $this->user;
991 $ilCtrl = $this->ctrl;
992
993 $text = $this->getNoteForm(
994 "create",
995 $this->note_type
996 )->getData("note") ?? "";
997
998 //if ($this->form->checkInput())
999 if ($text !== "" && !is_array($this->rep_obj_id)) {
1000 $context = $this->data->context(
1001 $this->rep_obj_id,
1002 $this->obj_id,
1003 $this->obj_type,
1004 $this->news_id,
1005 $this->repository_mode
1006 );
1007 $note = $this->data->note(
1008 0,
1009 $context,
1010 $text,
1011 $ilUser->getId(),
1012 $this->note_type,
1013 0,
1014 0,
1015 $this->recipient
1016 );
1017 $this->manager->createNote(
1018 $note,
1019 $this->observer
1020 );
1021
1022 $ilCtrl->setParameter($this, "note_mess", "mod");
1023 }
1024 $ilCtrl->redirect($this, "getListHTML", "", $this->ctrl->isAsynch());
1025 }
1026
1027 public function updateNote(): void
1028 {
1029 $ilCtrl = $this->ctrl;
1030
1031 $note = $this->manager->getById($this->requested_note_id);
1032 $text = $this->getNoteForm(
1033 "edit",
1034 $this->note_type
1035 )->getData("note") ?? "";
1036
1037 if ($this->notes_access->canEdit($note)) {
1038 $this->manager->updateNoteText(
1039 $this->requested_note_id,
1040 $text,
1041 $this->observer
1042 );
1043 $ilCtrl->setParameter($this, "note_mess", "mod");
1044 }
1045 $ilCtrl->redirect($this, "getListHTML", "", $this->ctrl->isAsynch());
1046 }
1047
1051 public function editNoteForm(
1052 bool $a_init_form = true
1053 ): string {
1054 $this->edit_note_form = true;
1055
1056 return $this->getListHTML($a_init_form);
1057 }
1058
1062 public function renderContent(string $content): string
1063 {
1064 $lng = $this->lng;
1065 $ctrl = $this->ctrl;
1066
1067 $ntpl = new ilTemplate(
1068 "tpl.notes_and_comments.html",
1069 true,
1070 true,
1071 "components/ILIAS/Notes"
1072 );
1073
1074 if (!$ctrl->isAsynch()) {
1075 $ntpl->setVariable("OUTER_ID", " id='notes_embedded_outer' ");
1076 }
1077
1078 $ntpl->setVariable("CONTENT", $content);
1079
1080 if ($ctrl->isAsynch() && !$this->request->isFilterCommand()) {
1081 echo $ntpl->get();
1082 exit;
1083 }
1084
1085 return $ntpl->get();
1086 }
1087
1088 protected function deleteNote(): string
1089 {
1092
1093 $f = $this->ui->factory();
1094 $ctrl = $this->ctrl;
1095 $ctrl->setParameter($this, "note_id", $this->requested_note_id);
1096 $note = $this->manager->getById($this->requested_note_id);
1097
1098 $text = $this->getDeleteText();
1099
1100 $mess = $f->messageBox()->confirmation($text);
1101 $item = $this->getItemForNote($note, false);
1102
1103 $b1 = $this->getButton(
1104 "",
1105 $this->lng->txt("cancel"),
1106 "cancelDelete"
1107 );
1108 $b2 = $this->getButton(
1109 "",
1110 $this->lng->txt("delete"),
1111 "confirmDelete"
1112 );
1113
1114 $it_group_title = $this->getItemGroupTitle($note->getContext()->getObjId());
1115 $item_groups = [$f->item()->group($it_group_title, [$item])];
1116 $panel = $f->panel()->listing()->standard("", $item_groups);
1117
1118 $html = $this->renderComponents([$mess, $panel, $b2, $b1]);
1119 $html = str_replace($this->getNoteTextPlaceholder($note), $this->getNoteText($note), $html);
1120
1121 return $this->renderContent($html);
1122 }
1123
1124 protected function getDeleteText(): string
1125 {
1126 return $this->lng->txt("notes_delete_note");
1127 }
1128
1129 public function cancelDelete(): string
1130 {
1131 return $this->getListHTML();
1132 }
1133
1134 public function confirmDelete(): void
1135 {
1136 $ilCtrl = $this->ctrl;
1137
1138 $cnt = 0;
1139 $ids = [$this->request->getNoteId()];
1140 foreach ($ids as $id) {
1141 $note = $this->manager->getById($id);
1142 if ($this->notes_access->canDelete($note, $this->user->getId(), $this->public_deletion_enabled)) {
1143 $this->manager->deleteNote($note, $this->user->getId(), $this->public_deletion_enabled);
1144 $cnt++;
1145 }
1146 }
1147 if ($cnt > 1) {
1148 $ilCtrl->setParameter($this, "note_mess", "ntsdel");
1149 } else {
1150 $ilCtrl->setParameter($this, "note_mess", "ntdel");
1151 }
1152 $ilCtrl->redirect($this, "getListHTML", "", $this->ajax);
1153 }
1154
1158 public function exportNotesHTML(): void
1159 {
1160 $tpl = new ilGlobalTemplate("tpl.main.html", true, true);
1161
1162 $this->export_html = true;
1163 //$tpl->setVariable("CONTENT", $this->getListHTML());
1164 //ilUtil::deliverData($tpl->get(), "notes.html");
1165
1166 $authors = array_unique(array_map(function (Note $note) {
1167 return $note->getAuthor();
1168 }, $this->getNotes()));
1169 $export = new \ILIAS\Notes\Export\NotesHtmlExport(
1170 $this->note_type,
1171 $this->user->getId(),
1172 $authors
1173 );
1174 $export->exportHTML($this->getListHTML());
1175 }
1176
1180 public static function getListNotesJSCall(
1181 string $a_hash,
1182 ?string $a_update_code = null
1183 ): string {
1184 if ($a_update_code === null) {
1185 $a_update_code = "null";
1186 } else {
1187 $a_update_code = "'" . $a_update_code . "'";
1188 }
1189
1190 return "ilNotes.listNotes(event, '" . $a_hash . "', " . $a_update_code . ");";
1191 }
1192
1196 public static function getListCommentsJSCall(
1197 string $a_hash,
1198 ?string $a_update_code = null
1199 ): string {
1200 if ($a_update_code === null) {
1201 $a_update_code = "null";
1202 } else {
1203 $a_update_code = "'" . $a_update_code . "'";
1204 }
1205
1206 return "ilNotes.listComments(event, '" . $a_hash . "', " . $a_update_code . ");";
1207 }
1208
1212 public function getShyButton(
1213 string $a_var,
1214 string $a_txt,
1215 string $a_cmd,
1216 string $a_anchor = "",
1217 int $note_id = 0
1218 ): \ILIAS\UI\Component\Button\Shy {
1219 $ctrl = $this->ctrl;
1220 $f = $this->ui->factory();
1221
1222 $class = static::class;
1223 if ($this->ajax) {
1224 $button = $f->button()->shy(
1225 $a_txt,
1226 "#"
1227 )->withOnLoadCode(function ($id) use ($ctrl, $a_cmd, $note_id, $class) {
1228 $ctrl->setParameterByClass($class, "note_id", $note_id);
1229 return
1230 "document.querySelector('#$id').addEventListener('click', () => { ilNotes.cmdAjaxLink(event, '" .
1231 $ctrl->getLinkTargetByClass($class, $a_cmd, "", true) .
1232 "');});";
1233 });
1234 } else {
1235 $button = $f->button()->shy(
1236 $a_txt,
1237 $ctrl->getLinkTargetByClass($class, $a_cmd, $a_anchor)
1238 );
1239 }
1240 return $button;
1241 }
1242
1246 public function getButton(
1247 string $a_var,
1248 string $a_txt,
1249 string $a_cmd,
1250 string $a_anchor = ""
1251 ): \ILIAS\UI\Component\Button\Standard {
1252 $ctrl = $this->ctrl;
1253 $f = $this->ui->factory();
1254
1255 if ($this->ajax) {
1256 $button = $f->button()->standard(
1257 $a_txt,
1258 "#"
1259 )->withOnLoadCode(function ($id) use ($ctrl, $a_cmd) {
1260 return
1261 "document.querySelector('#$id').addEventListener('click', () => { ilNotes.cmdAjaxLink(event, '" .
1262 $ctrl->getLinkTargetByClass(static::class, $a_cmd, "", true) .
1263 "');});";
1264 });
1265 } else {
1266 $button = $f->button()->standard(
1267 $a_txt,
1268 $ctrl->getLinkTargetByClass(static::class, $a_cmd, $a_anchor)
1269 );
1270 }
1271 return $button;
1272 }
1273
1277 public function addObserver(
1278 callable $a_callback
1279 ): void {
1280 $this->observer[] = $a_callback;
1281 }
1282
1283 protected function listSortAsc(): string
1284 {
1285 $this->manager->setSortAscending(true);
1286 return $this->getListHTML();
1287 }
1288
1289 protected function listSortDesc(): string
1290 {
1291 $this->manager->setSortAscending(false);
1292 return $this->getListHTML();
1293 }
1294
1295
1296 public function setExportMode(): void
1297 {
1298 $this->hide_new_form = true;
1299 $this->no_actions = true;
1300 $this->enable_sorting = false;
1301 $this->user_img_export_html = true;
1302 }
1303
1304 protected function getOriginHeader(): string
1305 {
1306 if (!is_array($this->rep_obj_id) && !$this->only_latest && $this->ctrl->isAsynch()) {
1307 switch ($this->obj_type) {
1308 case "grpr":
1309 case "catr":
1310 case "crsr":
1311 $title = ilContainerReference::_lookupTitle($this->rep_obj_id);
1312 break;
1313
1314 default:
1315 $title = ilObject::_lookupTitle($this->rep_obj_id);
1316 break;
1317 }
1318
1319 $img = ilUtil::img(ilObject::_getIcon($this->rep_obj_id, "tiny"));
1320
1321 // add sub-object if given
1322 if ($this->obj_id) {
1323 $sub_title = $this->getSubObjectTitle($this->rep_obj_id, $this->obj_id);
1324 if ($sub_title) {
1325 $title .= " - " . $sub_title;
1326 }
1327 }
1328
1329 return $img . " " . $title;
1330 }
1331 return "";
1332 }
1333
1334 public function getGlyph(): string
1335 {
1336 $f = $this->ui->factory();
1337 $r = $this->ui->renderer();
1338 $lng = $this->lng;
1339 $ctrl = $this->ctrl;
1340 $ctrl->setParameter($this, "news_id", $this->news_id);
1343 null,
1344 ilObject::_lookupType($this->rep_obj_id),
1345 $this->rep_obj_id,
1346 $this->obj_type,
1347 $this->obj_id,
1348 $this->news_id
1349 );
1350
1351 $context = $this->data->context(
1352 $this->rep_obj_id,
1353 $this->obj_id,
1354 $this->obj_type,
1355 $this->news_id
1356 );
1357
1358 $cnt[$this->rep_obj_id][$this->note_type] = $this->manager->getNrOfNotesForContext($context, $this->note_type);
1359 $cnt = $cnt[$this->rep_obj_id][$this->note_type] ?? 0;
1360
1361 $widget_el_id = "notew_" . str_replace(";", "_", $hash);
1362 $ctrl->setParameter($this, "hash", $hash);
1363 $update_url = $ctrl->getLinkTarget($this, "updateGlyph", "", true, false);
1364 $query_url = $ctrl->getLinkTarget($this, "getListHtml", "", true, false);
1365 $comps = array();
1366 $c = $f->counter()->status((int) $cnt);
1367 $comps[] = $f->button()->shy('', '')
1368 ->withSymbol($f->symbol()->glyph()->comment()->withCounter($c))
1369 ->withAdditionalOnLoadCode(function ($id) use ($hash, $query_url) {
1370 $code = "$('#$id').attr('data-note-key','$hash');\n";
1371 $code .= "$('#$id').attr('data-note-ui-type','trigger');\n";
1372 $code .= "$('#$id').attr('data-note-query-url','" . $query_url . "');\n";
1373 $code .= "$(\"#$id\").click(function(event) { ilNotes.clickTrigger(event)});";
1374 return $code;
1375 });
1376 if ($this->ctrl->isAsynch()) {
1377 $html = $r->renderAsync($comps);
1378 } else {
1379 $html = $r->render($comps);
1380 }
1381 $html = "<span id='" . $widget_el_id . "' data-note-key='$hash' data-note-ui-type='widget' data-note-update-url='$update_url'>" . $html . "</span>";
1382 $ctrl->setParameter($this, "news_id", $this->requested_news_id);
1383 return $html;
1384 }
1385
1386 public function getNumber(): string
1387 {
1388 $f = $this->ui->factory();
1389 $r = $this->ui->renderer();
1390 $lng = $this->lng;
1391 $ctrl = $this->ctrl;
1392 $ctrl->setParameter($this, "news_id", $this->news_id);
1395 null,
1396 ilObject::_lookupType($this->rep_obj_id),
1397 $this->rep_obj_id,
1398 $this->obj_type,
1399 $this->obj_id,
1400 $this->news_id
1401 );
1402
1403 $context = $this->data->context(
1404 $this->rep_obj_id,
1405 $this->obj_id,
1406 $this->obj_type,
1407 $this->news_id
1408 );
1409
1410 $cnt[$this->rep_obj_id][$this->note_type] = $this->manager->getNrOfNotesForContext($context, $this->note_type);
1411 $cnt = $cnt[$this->rep_obj_id][$this->note_type] ?? 0;
1412
1413 $widget_el_id = "notew_" . str_replace(";", "_", $hash);
1414 $ctrl->setParameter($this, "hash", $hash);
1415 $update_url = $ctrl->getLinkTarget($this, "updateNumber", "", true, false);
1416 $query_url = $ctrl->getLinkTarget($this, "getListHtml", "", true, false);
1417 $comps = array();
1418 $comps[] = $f->button()->shy($cnt, "#")->withAdditionalOnLoadCode(function ($id) use ($hash, $query_url) {
1419 $code = "$('#$id').attr('data-note-key','$hash');\n";
1420 $code .= "$('#$id').attr('data-note-ui-type','trigger');\n";
1421 $code .= "$('#$id').attr('data-note-query-url','" . $query_url . "');\n";
1422 $code .= "$(\"#$id\").click(function(event) { ilNotes.clickTrigger(event)});";
1423 return $code;
1424 });
1425 if ($this->ctrl->isAsynch()) {
1426 $html = $r->renderAsync($comps);
1427 } else {
1428 $html = $r->render($comps);
1429 }
1430 //echo "<br>" . $widget_el_id . ":" . $update_url . "<br>";
1431 $html = "<span id='" . $widget_el_id . "' data-note-key='$hash' data-note-ui-type='widget' data-note-update-url='$update_url'>" . $html . "</span>";
1432 $ctrl->setParameter($this, "news_id", $this->requested_news_id);
1433 return $html;
1434 }
1435
1436 public function getTriggerShyButton(): \ILIAS\UI\Component\Button\Shy
1437 {
1438 $f = $this->ui->factory();
1439 $r = $this->ui->renderer();
1440 $lng = $this->lng;
1441 $ctrl = $this->ctrl;
1442 $ctrl->setParameter($this, "news_id", $this->news_id);
1445 null,
1446 ilObject::_lookupType($this->rep_obj_id),
1447 $this->rep_obj_id,
1448 $this->obj_type,
1449 $this->obj_id,
1450 $this->news_id
1451 );
1452
1453 $context = $this->data->context(
1454 $this->rep_obj_id,
1455 $this->obj_id,
1456 $this->obj_type,
1457 $this->news_id
1458 );
1459
1460 $widget_el_id = "notew_" . str_replace(";", "_", $hash);
1461 $ctrl->setParameter($this, "hash", $hash);
1462 $update_url = $ctrl->getLinkTarget($this, "updateNumber", "", true, false);
1463 $query_url = $ctrl->getLinkTarget($this, "getListHtml", "", true, false);
1464 $but = $f->button()->shy($this->lng->txt("comments"), "#")->withAdditionalOnLoadCode(function ($id) use ($hash, $query_url) {
1465 $code = "$('#$id').attr('data-note-key','$hash');\n";
1466 $code .= "$('#$id').attr('data-note-ui-type','trigger');\n";
1467 $code .= "$('#$id').attr('data-note-query-url','" . $query_url . "');\n";
1468 $code .= "$(\"#$id\").click(function(event) { ilNotes.clickTrigger(event)});";
1469 return $code;
1470 });
1471 return $but;
1472 }
1473
1474 public function getWidget(): string
1475 {
1476 $f = $this->ui->factory();
1477 $r = $this->ui->renderer();
1478 $lng = $this->lng;
1479 $ctrl = $this->ctrl;
1480 $ctrl->setParameter($this, "news_id", $this->news_id);
1483 null,
1484 ilObject::_lookupType($this->rep_obj_id),
1485 $this->rep_obj_id,
1486 $this->obj_type,
1487 $this->obj_id,
1488 $this->news_id
1489 );
1490
1491 $context = $this->data->context(
1492 $this->rep_obj_id,
1493 $this->obj_id,
1494 $this->obj_type,
1495 $this->news_id
1496 );
1497
1498 $cnt[$this->rep_obj_id][$this->note_type] = $this->manager->getNrOfNotesForContext($context, $this->note_type);
1499 $cnt = $cnt[$this->rep_obj_id][$this->note_type] ?? 0;
1500
1501 $tpl = new ilTemplate("tpl.note_widget_header.html", true, true, "components/ILIAS/Notes");
1502 $widget_el_id = "notew_" . str_replace(";", "_", $hash);
1503 $ctrl->setParameter($this, "hash", $hash);
1504 $update_url = $ctrl->getLinkTarget($this, "updateWidget", "", true, false);
1505 $query_url = $ctrl->getLinkTarget($this, "getListHtml", "", true, false);
1506 $comps = array();
1507 if ($cnt > 0) {
1508 $c = $f->counter()->status((int) $cnt);
1509 $comps[] = $f->button()->shy('', '#')
1510 ->withSymbol($f->symbol()->glyph()->comment()->withCounter($c))
1511 ->withAdditionalOnLoadCode(function ($id) use ($hash, $query_url) {
1512 $code = "$('#$id').attr('data-note-key','$hash');\n";
1513 $code .= "$('#$id').attr('data-note-ui-type','trigger');\n";
1514 $code .= "$('#$id').attr('data-note-query-url','" . $query_url . "');\n";
1515 $code .= "$(\"#$id\").click(function(event) { ilNotes.clickTrigger(event)});";
1516 return $code;
1517 });
1518 $comps[] = $f->divider()->vertical();
1519 $tpl->setVariable("GLYPH", $r->render($comps));
1520 $tpl->setVariable("TXT_LATEST", $this->getLatestItemText());
1521 }
1522
1523 $b = $f->button()->shy($this->getAddEditItemText(), "#")->withAdditionalOnLoadCode(function ($id) use ($hash, $query_url) {
1524 $code = "$('#$id').attr('data-note-key','$hash');\n";
1525 $code .= "$('#$id').attr('data-note-ui-type','trigger');\n";
1526 $code .= "$('#$id').attr('data-note-query-url','" . $query_url . "');\n";
1527 $code .= "$(\"#$id\").click(function(event) { ilNotes.clickTrigger(event)});";
1528 return $code;
1529 });
1530 if ($ctrl->isAsynch()) {
1531 $tpl->setVariable("SHY_BUTTON", $r->renderAsync($b));
1532 } else {
1533 $tpl->setVariable("SHY_BUTTON", $r->render($b));
1534 }
1535
1536 $this->widget_header = $tpl->get();
1537
1538 $this->hide_new_form = true;
1539 $this->only_latest = true;
1540 $this->no_actions = true;
1541 $html = "<div id='" . $widget_el_id . "' data-note-key='$hash' data-note-ui-type='widget' data-note-update-url='$update_url'>" . $this->getNoteListHTML() . "</div>";
1542 $ctrl->setParameter($this, "news_id", $this->requested_news_id);
1543 return $html;
1544 }
1545
1546 protected function updateWidget(): void
1547 {
1548 echo $this->getWidget();
1549 exit;
1550 }
1551
1552 protected function updateGlyph(): void
1553 {
1554 echo $this->getGlyph();
1555 exit;
1556 }
1557
1558 protected function updateNumber(): void
1559 {
1560 echo $this->getNumber();
1561 exit;
1562 }
1563
1564}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
factory()
$components
const IL_CAL_DATETIME
return true
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.
static _lookupTitle(int $obj_id)
static _lookupTargetId(int $a_obj_id)
Class ilCtrl provides processing control methods.
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
@inheritDoc
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
@inheritDoc
isAsynch()
@inheritDoc
setParameterByClass(string $a_class, string $a_parameter, $a_value)
@inheritDoc
getLinkTargetByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
@inheritDoc
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
Class for single dates.
special template class to simplify handling of ITX/PEAR
language handling
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...
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
@ilCtrl_Calls ilNoteGUI: ilCommentGUI
static getListNotesJSCall(string $a_hash, ?string $a_update_code=null)
Get list notes js call.
getTarget(Note $note)
show related objects as links
ILIAS Notes InternalGUIService $gui
ilWorkspaceAccessHandler $wsp_access_handler
ilWorkspaceTree $wsp_tree
StandardGUIRequest $request
getNoteText(Note $note)
renderComponents(array $components)
ilSetting $settings
bool $edit_note_form
bool $enable_sorting
getShyButton(string $a_var, string $a_txt, string $a_cmd, string $a_anchor="", int $note_id=0)
string $widget_header
addNote()
add note
NotesManager $manager
getItemTitle(Note $note)
addItemProperties(Note $note, array &$properties)
static getListCommentsJSCall(string $a_hash, ?string $a_update_code=null)
Get list comments js call.
bool $repository_mode
getNoEntriesText(bool $search)
getNoteListHTML(bool $a_init_form=true)
setShowEmptyListMessage(bool $a_val)
bool $comments_settings
renderContent(string $content)
Render content into notes wrapper.
ilObjectDefinition $obj_definition
getItemForNote(Note $note, bool $actions=true)
getListHTML(bool $a_init_form=true)
addNoteForm(bool $a_init_form=true)
get notes list including add note area
ilObjUser $user
enablePublicNotesDeletion(bool $a_enable=true)
string $note_mess
enablePrivateNotes(bool $a_enable=true)
string $default_command
bool $use_obj_title_header
string $obj_type
enableCommentsSettings(bool $a_enable=true)
getButton(string $a_var, string $a_txt, string $a_cmd, string $a_anchor="")
bool $add_note_form
bool $private_enabled
bool $show_empty_list_message
exportNotesHTML()
export selected notes to html
cancelAddNote()
cancel add note
string $search_text
ILIAS Notes InternalDomainService $domain
getNoteForm(string $mode, int $type, ?Note $note=null)
editNoteForm(bool $a_init_form=true)
get notes list including add note area
array int $rep_obj_id
__construct(array|int $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="")
setRepositoryMode(bool $a_value)
cancelUpdateNote()
cancel edit note
setDefaultCommand(string $a_val)
ilLanguage $lng
bool $public_enabled
string $requested_note_mess
enablePublicNotes(bool $a_enable=true)
getSubObjectTitle(int $parent_obj_id, int $sub_obj_id)
Get sub object title if available with callback.
ILIAS Notes AccessManager $notes_access
bool $user_img_export_html
setHideNewForm(bool $a_val)
getNoteTextPlaceholder(Note $note)
ilTemplate $form_tpl
setShowHeader(bool $a_val)
setUseObjectTitleHeader(bool $a_val)
bool $hide_new_form
ilLogger $log
enableTargets(bool $a_enable=true)
array $item_list_gui
ILIAS DI UIServices $ui
ilAccessHandler $access
bool $public_deletion_enabled
ILIAS Notes InternalDataService $data
int $requested_news_id
int $requested_note_id
addObserver(callable $a_callback)
Add observer.
getItemGroupTitle(int $obj_id=0)
bool $targets_enabled
User class.
parses the objects.xml it handles the xml-description of all ilias objects
static _lookupType(int $id, bool $reference=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _lookupOwnerName(int $owner_id)
Lookup owner name for owner id.
static _lookupOwner(int $obj_id)
Lookup owner user ID for object ID.
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupTitle(int $obj_id)
ILIAS Setting Class.
special template class to simplify handling of ITX/PEAR
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
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=null)
Default behaviour is:
static getSystemMessageHTML(string $a_txt, string $a_type="info")
Get HTML for a system message.
static img(string $a_src, ?string $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
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="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ANONYMOUS_USER_ID
Definition: constants.php:27
$c
Definition: deliver.php:25
exit
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
$ref_id
Definition: ltiauth.php:66
$path
Definition: ltiservices.php:30
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: Bulky.php:21
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $lng
Definition: privfeed.php:31
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26
$text
Definition: xapiexit.php:21