29 protected \ILIAS\Notes\InternalDomainService
$domain;
34 protected \ILIAS\Notes\InternalGUIService
$gui;
37 protected \ILIAS\Notes\InternalDataService
$data;
70 protected \ILIAS\DI\UIServices
$ui;
102 array|
int $a_rep_obj_id = 0,
104 string $a_obj_type =
"",
105 bool $a_include_subobjects =
false,
111 $this->
user = $DIC->user();
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();
122 $ns =
$DIC->notes()->internal();
129 $this->data = $ns->data();
130 $this->domain = $ns->domain();
131 $this->gui = $ns->gui();
132 $this->notes_access = $ns->domain()->noteAccess();
134 $this->
lng->loadLanguageModule(
"notes");
136 $ilCtrl->saveParameter($this,
"notes_only");
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;
145 if (!is_array($a_rep_obj_id) && !$this->obj_type && $a_rep_obj_id) {
151 $this->
ctrl = $ilCtrl;
153 $this->add_note_form =
false;
154 $this->edit_note_form =
false;
155 $this->private_enabled =
false;
157 if (!is_array($this->rep_obj_id)) {
158 if ($this->manager->commentsActive($this->rep_obj_id)) {
159 $this->public_enabled =
true;
161 $this->public_enabled =
false;
164 $this->targets_enabled =
false;
165 $this->export_html =
false;
166 $this->print =
false;
167 $this->comments_settings =
false;
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();
180 $this->show_empty_list_message = $a_val;
190 $this->show_header = $a_val;
201 $this->use_obj_title_header = $a_val;
211 $this->default_command = $a_val;
216 $this->hide_new_form = $a_val;
227 $next_class = $this->
ctrl->getNextClass($this);
228 switch ($next_class) {
229 case strtolower(ilCommentGUI::class):
230 $gui = $this->gui->getCommentsGUI(
239 $gui->enableCommentsSettings($this->comments_settings);
240 $this->
ctrl->forwardCommand($gui);
244 return $this->$cmd();
250 $this->private_enabled = $a_enable;
255 $this->public_enabled = $a_enable;
260 $this->comments_settings = $a_enable;
265 $this->public_deletion_enabled = $a_enable;
271 $this->targets_enabled = $a_enable;
276 $this->repository_mode = $a_value;
282 $ilCtrl->
setParameter($this,
"notes_type", Note::PRIVATE);
294 if ($this->
ctrl->isAsynch()) {
295 return $this->
ui->renderer()->renderAsync($components);
297 return $this->
ui->renderer()->render($components);
303 $this->
ctrl->redirectByClass(ilCommentGUI::class,
"getListHTML",
"", $this->ajax);
311 if ($this->comments_settings) {
312 $this->manager->activateComments($this->rep_obj_id,
true);
315 $ilCtrl->
redirectByClass(static::class,
"getListHTML",
"", $this->ajax);
322 if ($this->comments_settings) {
323 $this->manager->activateComments($this->rep_obj_id,
false);
326 $ilCtrl->
redirectByClass(static::class,
"getListHTML",
"", $this->ajax);
334 if ($this->notes ===
null) {
337 if ($this->export_html || $this->print) {
338 if ($this->requested_note_id > 0) {
341 $filter = $this->request->getNoteText();
345 $ascending = $this->manager->getSortAscending();
346 if ($this->only_latest) {
349 $author_id = ($this->note_type === Note::PRIVATE)
353 if (!is_array($this->rep_obj_id)) {
354 $notes = $this->manager->getNotesForContext(
355 $this->data->context(
360 $this->repository_mode
370 $notes = $this->manager->getNotesForRepositoryObjIds(
386 bool $a_init_form =
true
390 $f = $this->
ui->factory();
397 $tpl =
new ilTemplate(
"tpl.notes_list.html",
true,
true,
"components/ILIAS/Notes");
400 $cnt_str = (count(
$notes) > 0)
401 ?
" (" . count(
$notes) .
")"
406 if ($origin_header !=
"") {
407 $tpl->setCurrentBlock(
"title");
408 $tpl->setVariable(
"TITLE", $origin_header);
409 $tpl->parseCurrentBlock();
412 $tpl->setVariable(
"TXT_NOTES", $this->
getListTitle() . $cnt_str);
416 if (!$this->edit_note_form && !is_array($this->rep_obj_id) &&
418 $tpl->setCurrentBlock(
"edit_note_form");
420 $b = $this->
ui->factory()->button()->standard(
424 $tpl->setVariable(
"EDIT_STYLE",
"display:none;");
427 $ilCtrl->getFormActionByClass(static::class,
"addNote",
"",
true)
431 $this->
lng->txt(
"cancel")
439 $this->
getNoteForm(
"create", $this->note_type)->render()
441 $tpl->parseCurrentBlock();
448 $notes_given =
false;
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);
456 $ilCtrl->getFormActionByClass(static::class,
"updateNote",
"",
true)
459 "CANCEL_FORM_ACTION",
460 $ilCtrl->getFormActionByClass(static::class,
"cancelUpdateNote",
"",
true)
462 $tpl->setVariable(
"NOTE_FOCUS",
"1");
465 $this->
lng->txt(
"cancel")
469 $this->
getNoteForm(
"edit", $this->note_type, $note)->render()
471 $tpl->parseCurrentBlock();
476 $text_placeholders = [];
479 foreach (
$notes as $note) {
480 if ($this->only_latest && $notes_given) {
484 $current_obj_id = $note->getContext()->getObjId();
485 if ($last_obj_id !==
null && $current_obj_id !== $last_obj_id) {
487 $item_groups[] =
$f->item()->group($it_group_title, $items);
490 $last_obj_id = $current_obj_id;
500 $item_groups[] =
$f->item()->group($it_group_title, $items);
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());
509 $panel =
$f->panel()->listing()->standard($title, $item_groups);
510 if (!is_array($this->rep_obj_id) && !$this->no_actions) {
514 $html = str_replace($text_placeholders, $texts, $html);
515 $tpl->setVariable(
"NOTES_LIST", $html);
516 } elseif (!is_array($this->rep_obj_id)) {
518 $item_groups = [
$f->item()->group($it_group_title, [])];
519 $panel =
$f->panel()->listing()->standard(
"", $item_groups);
521 if ($this->show_empty_list_message) {
523 $mess =
$f->messageBox()->info($mess_txt);
526 $tpl->setVariable(
"NOTES_LIST", $html);
528 } elseif ($this->search_text !==
"") {
530 $mess =
$f->messageBox()->info($mess_txt);
538 switch ($this->requested_note_mess !==
"" ? $this->requested_note_mess : $this->note_mess) {
541 $mtxt =
$lng->
txt(
"msg_obj_modified");
556 $mtxt =
$lng->
txt(
"form_input_not_valid");
561 $mtxt =
$lng->
txt(
"info_delete_sure");
566 $mtxt =
$lng->
txt(
"no_checkbox");
572 $tpl->setVariable(
"MESS",
"");
575 if ($this->widget_header !==
"") {
576 $tpl->setVariable(
"WIDGET_HEADER", $this->widget_header);
584 return $this->
lng->txt(
"private_notes");
589 return $this->
lng->txt(
"note_add_note");
594 return $this->
lng->txt(
"notes_notes_deleted");
599 return $this->
lng->txt(
"notes_note_deleted");
609 return $this->
lng->txt(
"notes_add_edit_note");
615 $mess_txt = $this->
lng->txt(
"notes_no_notes");
617 $mess_txt = $this->
lng->txt(
"notes_no_notes_found");
641 if ($this->manager->getSortAscending()) {
642 $dd_buttons[] = $this->getShyButton(
644 $this->
lng->txt(
"notes_sort_desc"),
650 $dd_buttons[] = $this->getShyButton(
652 $this->
lng->txt(
"notes_sort_asc"),
659 $s = $this->
ui->factory()->dropdown()->standard(
668 if (!$this->show_header) {
671 if (!is_array($this->rep_obj_id) && !$this->getUseObjectTitleHeader()) {
672 $it_group_title = $this->
lng->txt(
"notes");
674 $it_group_title = ($obj_id)
676 : $this->
lng->txt(
"note_without_object");
678 return $it_group_title;
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) {
701 $dd_buttons[] = $this->getShyButton(
703 $this->
lng->txt(
"edit"),
705 "note_" . $note->
getId(),
712 if ($actions && !$this->export_html && !$this->print
713 && !$this->no_actions
714 && $this->notes_access->canDelete($note)) {
716 $dd_buttons[] = $this->getShyButton(
718 $this->
lng->txt(
"delete"),
720 "note_" . $note->
getId(),
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"];
737 $properties[$this->
lng->txt(
"notes_origin")] =
$f
751 $title = $this->getItemTitle($note);
752 if ($note->
getType() === Note::PUBLIC) {
753 $avatar = $this->gui->profile()->getAvatar($note->
getAuthor());
755 $this->addItemProperties($note, $properties);
767 $item =
$f->item()->standard($title)
768 ->withDescription($this->getNoteTextPlaceholder($note))
769 ->withProperties($properties);
770 if (!is_null($avatar)) {
771 $item = $item->withLeadAvatar($avatar);
773 if (count($dd_buttons) > 0) {
774 $item = $item->withActions(
775 $f->dropdown()->standard($dd_buttons)
784 if ($note->
getType() === Note::PUBLIC) {
787 $title = $creation_date;
795 if ($note->
getType() === Note::PUBLIC) {
796 $properties[$this->
lng->txt(
"create_date")] = $creation_date;
802 return "##note-text-" . $note->
getId() .
"##";
807 return (trim($note->
getText()) !==
"")
808 ? nl2br(htmlentities($note->
getText()))
809 : $this->
lng->txt(
"note_content_removed");
819 $objDefinition = $this->obj_definition;
821 if ($parent_type ===
"") {
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));
835 ): \
ILIAS\Repository\Form\FormAdapterGUI {
839 $label_key .= ($mode ===
"create")
842 $label_key .=
"_" . $this->getFormLabelKey($type);
843 $cmd = ($mode ===
"create")
850 if ($cmd ===
"updateNote") {
851 $this->
ctrl->setParameter($this,
"note_id", $this->requested_note_id);
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);
872 $ilAccess = $this->access;
873 $objDefinition = $this->obj_definition;
874 $ilUser = $this->user;
879 $a_note_id = $note->
getId();
881 $a_obj_type = $context->getType();
882 $a_obj_id = $context->getSubObjId();
884 if ($context->getObjId() > 0) {
888 foreach ($ref_ids as
$ref_id) {
889 if ($vis_ref_id > 0) {
892 if ($ilAccess->checkAccess(
"visible",
"",
$ref_id)) {
898 if ($vis_ref_id > 0) {
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();
913 if ($a_obj_type ===
"crsr" || $a_obj_type ===
"catr" || $a_obj_type ===
"grpr") {
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");
920 $link = (string) $this->domain->staticUrl()->builder()->build($type,
new ReferenceId($vis_ref_id));
922 $link = $this->item_list_gui[$type]->appendRepositoryFrameParameter($link) .
"#note_" . $a_note_id;
926 $link =
"goto.php?target=pg_" . $a_obj_id .
"_" . $vis_ref_id;
930 if (!isset($this->wsp_tree)) {
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);
938 $item = array_pop(
$path);
939 $title = $item[
"title"];
947 $link =
"ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace&dsh=" .
963 bool $a_init_form =
true
965 $this->add_note_form =
true;
966 return $this->getListHTML($a_init_form);
974 return $this->getListHTML();
982 return $this->getListHTML();
990 $ilUser = $this->user;
991 $ilCtrl = $this->ctrl;
993 $text = $this->getNoteForm(
996 )->getData(
"note") ??
"";
999 if (
$text !==
"" && !is_array($this->rep_obj_id)) {
1000 $context = $this->data->context(
1005 $this->repository_mode
1007 $note = $this->data->note(
1017 $this->manager->createNote(
1022 $ilCtrl->setParameter($this,
"note_mess",
"mod");
1024 $ilCtrl->redirect($this,
"getListHTML",
"", $this->
ctrl->isAsynch());
1029 $ilCtrl = $this->ctrl;
1031 $note = $this->manager->getById($this->requested_note_id);
1032 $text = $this->getNoteForm(
1035 )->getData(
"note") ??
"";
1037 if ($this->notes_access->canEdit($note)) {
1038 $this->manager->updateNoteText(
1039 $this->requested_note_id,
1043 $ilCtrl->setParameter($this,
"note_mess",
"mod");
1045 $ilCtrl->redirect($this,
"getListHTML",
"", $this->
ctrl->isAsynch());
1052 bool $a_init_form =
true
1054 $this->edit_note_form =
true;
1056 return $this->getListHTML($a_init_form);
1065 $ctrl = $this->ctrl;
1068 "tpl.notes_and_comments.html",
1071 "components/ILIAS/Notes"
1075 $ntpl->setVariable(
"OUTER_ID",
" id='notes_embedded_outer' ");
1078 $ntpl->setVariable(
"CONTENT", $content);
1080 if ($ctrl->
isAsynch() && !$this->request->isFilterCommand()) {
1085 return $ntpl->get();
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);
1098 $text = $this->getDeleteText();
1100 $mess =
$f->messageBox()->confirmation(
$text);
1101 $item = $this->getItemForNote($note,
false);
1103 $b1 = $this->getButton(
1105 $this->
lng->txt(
"cancel"),
1108 $b2 = $this->getButton(
1110 $this->
lng->txt(
"delete"),
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);
1118 $html = $this->renderComponents([$mess, $panel, $b2, $b1]);
1119 $html = str_replace($this->getNoteTextPlaceholder($note), $this->getNoteText($note), $html);
1121 return $this->renderContent($html);
1126 return $this->
lng->txt(
"notes_delete_note");
1131 return $this->getListHTML();
1136 $ilCtrl = $this->ctrl;
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);
1148 $ilCtrl->setParameter($this,
"note_mess",
"ntsdel");
1150 $ilCtrl->setParameter($this,
"note_mess",
"ntdel");
1152 $ilCtrl->redirect($this,
"getListHTML",
"", $this->ajax);
1162 $this->export_html =
true;
1166 $authors = array_unique(array_map(
function (
Note $note) {
1168 }, $this->getNotes()));
1169 $export = new \ILIAS\Notes\Export\NotesHtmlExport(
1171 $this->
user->getId(),
1174 $export->exportHTML($this->getListHTML());
1182 ?
string $a_update_code =
null
1184 if ($a_update_code === null) {
1185 $a_update_code =
"null";
1187 $a_update_code =
"'" . $a_update_code .
"'";
1190 return "ilNotes.listNotes(event, '" . $a_hash .
"', " . $a_update_code .
");";
1198 ?
string $a_update_code =
null
1200 if ($a_update_code === null) {
1201 $a_update_code =
"null";
1203 $a_update_code =
"'" . $a_update_code .
"'";
1206 return "ilNotes.listComments(event, '" . $a_hash .
"', " . $a_update_code .
");";
1216 string $a_anchor =
"",
1219 $ctrl = $this->
ctrl;
1220 $f = $this->
ui->factory();
1222 $class = static::class;
1224 $button =
$f->button()->shy(
1227 )->withOnLoadCode(
function (
$id) use ($ctrl, $a_cmd, $note_id, $class) {
1230 "document.querySelector('#$id').addEventListener('click', () => { ilNotes.cmdAjaxLink(event, '" .
1235 $button =
$f->button()->shy(
1250 string $a_anchor =
""
1252 $ctrl = $this->
ctrl;
1253 $f = $this->
ui->factory();
1256 $button =
$f->button()->standard(
1259 )->withOnLoadCode(
function (
$id) use ($ctrl, $a_cmd) {
1261 "document.querySelector('#$id').addEventListener('click', () => { ilNotes.cmdAjaxLink(event, '" .
1266 $button =
$f->button()->standard(
1278 callable $a_callback
1280 $this->observer[] = $a_callback;
1285 $this->manager->setSortAscending(
true);
1286 return $this->getListHTML();
1291 $this->manager->setSortAscending(
false);
1292 return $this->getListHTML();
1298 $this->hide_new_form =
true;
1299 $this->no_actions =
true;
1300 $this->enable_sorting =
false;
1301 $this->user_img_export_html =
true;
1306 if (!is_array($this->rep_obj_id) && !$this->only_latest && $this->
ctrl->isAsynch()) {
1307 switch ($this->obj_type) {
1322 if ($this->obj_id) {
1323 $sub_title = $this->getSubObjectTitle($this->rep_obj_id, $this->obj_id);
1325 $title .=
" - " . $sub_title;
1329 return $img .
" " . $title;
1336 $f = $this->
ui->factory();
1337 $r = $this->
ui->renderer();
1339 $ctrl = $this->ctrl;
1351 $context = $this->data->context(
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;
1361 $widget_el_id =
"notew_" . str_replace(
";",
"_", $hash);
1363 $update_url = $ctrl->
getLinkTarget($this,
"updateGlyph",
"",
true,
false);
1364 $query_url = $ctrl->
getLinkTarget($this,
"getListHtml",
"",
true,
false);
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)});";
1376 if ($this->
ctrl->isAsynch()) {
1377 $html = $r->renderAsync($comps);
1379 $html = $r->render($comps);
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);
1388 $f = $this->
ui->factory();
1389 $r = $this->
ui->renderer();
1391 $ctrl = $this->ctrl;
1403 $context = $this->data->context(
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;
1413 $widget_el_id =
"notew_" . str_replace(
";",
"_", $hash);
1415 $update_url = $ctrl->
getLinkTarget($this,
"updateNumber",
"",
true,
false);
1416 $query_url = $ctrl->
getLinkTarget($this,
"getListHtml",
"",
true,
false);
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)});";
1425 if ($this->
ctrl->isAsynch()) {
1426 $html = $r->renderAsync($comps);
1428 $html = $r->render($comps);
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);
1438 $f = $this->
ui->factory();
1439 $r = $this->
ui->renderer();
1441 $ctrl = $this->ctrl;
1453 $context = $this->data->context(
1460 $widget_el_id =
"notew_" . str_replace(
";",
"_", $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)});";
1476 $f = $this->
ui->factory();
1477 $r = $this->
ui->renderer();
1479 $ctrl = $this->ctrl;
1491 $context = $this->data->context(
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;
1501 $tpl =
new ilTemplate(
"tpl.note_widget_header.html",
true,
true,
"components/ILIAS/Notes");
1502 $widget_el_id =
"notew_" . str_replace(
";",
"_", $hash);
1504 $update_url = $ctrl->
getLinkTarget($this,
"updateWidget",
"",
true,
false);
1505 $query_url = $ctrl->
getLinkTarget($this,
"getListHtml",
"",
true,
false);
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)});";
1518 $comps[] =
$f->divider()->vertical();
1519 $tpl->setVariable(
"GLYPH", $r->render($comps));
1520 $tpl->setVariable(
"TXT_LATEST", $this->getLatestItemText());
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)});";
1531 $tpl->setVariable(
"SHY_BUTTON", $r->renderAsync(
$b));
1533 $tpl->setVariable(
"SHY_BUTTON", $r->render(
$b));
1536 $this->widget_header = $tpl->get();
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);
1548 echo $this->getWidget();
1554 echo $this->getGlyph();
1560 echo $this->getNumber();
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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
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 useRelativeDates()
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,)
special template class to simplify handling of ITX/PEAR
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
renderComponents(array $components)
getShyButton(string $a_var, string $a_txt, string $a_cmd, string $a_anchor="", int $note_id=0)
addItemProperties(Note $note, array &$properties)
static getListCommentsJSCall(string $a_hash, ?string $a_update_code=null)
Get list comments js call.
getNoEntriesText(bool $search)
getNoteListHTML(bool $a_init_form=true)
setShowEmptyListMessage(bool $a_val)
renderContent(string $content)
Render content into notes wrapper.
ilObjectDefinition $obj_definition
getItemForNote(Note $note, bool $actions=true)
getUseObjectTitleHeader()
getListHTML(bool $a_init_form=true)
addNoteForm(bool $a_init_form=true)
get notes list including add note area
enablePublicNotesDeletion(bool $a_enable=true)
enablePrivateNotes(bool $a_enable=true)
bool $use_obj_title_header
enableCommentsSettings(bool $a_enable=true)
getButton(string $a_var, string $a_txt, string $a_cmd, string $a_anchor="")
bool $show_empty_list_message
exportNotesHTML()
export selected notes to html
cancelAddNote()
cancel add note
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
__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)
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)
setShowHeader(bool $a_val)
setUseObjectTitleHeader(bool $a_val)
enableTargets(bool $a_enable=true)
getShowEmptyListMessage()
bool $public_deletion_enabled
ILIAS Notes InternalDataService $data
addObserver(callable $a_callback)
Add observer.
getItemGroupTitle(int $obj_id=0)
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)
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...
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
if(!file_exists('../ilias.ini.php'))