6 include_once(
"Services/Notes/classes/class.ilNote.php");
109 $a_include_subobjects =
false,
114 $this->
user = $DIC->user();
116 $this->obj_definition = $DIC[
"objDefinition"];
117 $this->tree = $DIC->repositoryTree();
118 $this->access = $DIC->access();
119 $this->
ui = $DIC->ui();
121 $lng = $DIC->language();
123 $lng->loadLanguageModule(
"notes");
125 $ilCtrl->saveParameter($this,
"notes_only");
126 $this->only =
$_GET[
"notes_only"];
128 $this->rep_obj_id = $a_rep_obj_id;
129 $this->obj_id = $a_obj_id;
130 $this->obj_type = $a_obj_type;
131 $this->inc_sub = $a_include_subobjects;
132 $this->news_id = $a_news_id;
135 if (!$this->obj_type && $a_rep_obj_id) {
139 $this->ajax =
$ilCtrl->isAsynch();
144 $this->anchor_jump =
true;
145 $this->add_note_form =
false;
146 $this->edit_note_form =
false;
147 $this->private_enabled =
false;
150 $this->public_enabled =
true;
152 $this->public_enabled =
false;
154 $this->enable_hiding =
false;
155 $this->targets_enabled =
false;
156 $this->multi_selection =
false;
157 $this->export_html =
false;
158 $this->print =
false;
159 $this->comments_settings =
false;
161 $this->note_img = array(
164 "alt" =>
$lng->txt(
"note")),
167 "alt" =>
$lng->txt(
"note") .
", " .
$lng->txt(
"important")),
170 "alt" =>
$lng->txt(
"note") .
", " .
$lng->txt(
"question")),
173 "alt" =>
$lng->txt(
"note") .
", " .
$lng->txt(
"pro")),
176 "alt" =>
$lng->txt(
"note") .
", " .
$lng->txt(
"contra"))
179 $this->comment_img = array(
182 "alt" =>
$lng->txt(
"notes_comment")),
185 "alt" =>
$lng->txt(
"notes_comment") .
", " .
$lng->txt(
"important")),
188 "alt" =>
$lng->txt(
"notes_comment") .
", " .
$lng->txt(
"question")),
191 "alt" =>
$lng->txt(
"notes_comment") .
", " .
$lng->txt(
"pro")),
194 "alt" =>
$lng->txt(
"notes_comment") .
", " .
$lng->txt(
"contra"))
208 $this->default_command = $a_val;
227 $next_class = $this->ctrl->getNextClass($this);
229 switch ($next_class) {
231 return $this->$cmd();
241 $this->private_enabled = $a_enable;
249 $this->public_enabled = $a_enable;
257 $this->comments_settings = $a_enable;
265 $this->public_deletion_enabled = $a_enable;
273 $this->enable_hiding = $a_enable;
281 $this->targets_enabled = $a_enable;
289 $this->multi_selection = $a_enable;
297 $this->anchor_jump = $a_enable;
307 $this->repository_mode = (bool) $a_value;
320 $ilCtrl->setParameter($this,
"notes_only",
"notes");
321 $this->only =
"notes";
334 $ilCtrl->setParameter($this,
"notes_only",
"comments");
335 $this->only =
"comments";
350 $lng->loadLanguageModule(
"notes");
353 "tpl.notes_and_comments.html",
360 $hide_comments = ($this->only ==
"notes");
361 $hide_notes = ($this->only ==
"comments");
368 $hide_comments =
true;
378 if ($this->private_enabled && $this->public_enabled
379 && $this->only !=
"notes") {
380 $this->private_enabled =
false;
384 if ($this->private_enabled && (
$ilUser->getId() != ANONYMOUS_USER_ID)
386 $ntpl->setCurrentBlock(
"notes_col");
388 $ntpl->parseCurrentBlock();
393 $comments_col =
false;
394 if ($this->public_enabled && (!$this->delete_note || $this->public_deletion_enabled ||
$ilSetting->get(
"comments_del_user", 0))
395 && !$hide_comments ) {
397 $comments_col =
true;
401 if ($this->comments_settings && !$hide_comments && !$this->delete_note
402 && !$this->edit_note_form && !$this->add_note_form &&
$ilUser->getId() != ANONYMOUS_USER_ID) {
407 if ($this->news_id == 0) {
411 $lng->txt(
"notes_deactivate_comments"),
412 "deactivateComments",
416 $ntpl->setCurrentBlock(
"comments_settings2");
421 $lng->txt(
"notes_activate_comments"),
425 $ntpl->setCurrentBlock(
"comments_settings2");
427 if ($this->ajax && !$comments_col) {
434 $ntpl->parseCurrentBlock();
436 if (!$comments_col) {
437 $ntpl->setVariable(
"COMMENTS",
"");
440 $comments_col =
true;
444 $ntpl->setCurrentBlock(
"comments_col");
448 $ntpl->parseCurrentBlock();
466 if ($this->comments_settings) {
470 $ilCtrl->redirectByClass(
"ilnotegui",
"showNotes",
"", $this->ajax);
480 if ($this->comments_settings) {
484 $ilCtrl->redirectByClass(
"ilnotegui",
"showNotes",
"", $this->ajax);
496 include_once(
"./Services/User/classes/class.ilUserUtil.php");
502 $user_setting_notes_public_all =
"y";
503 $user_setting_notes_by_type =
"y";
505 if ($this->delete_note || $this->export_html || $this->print) {
506 if (
$_GET[
"note_id"] !=
"") {
507 $filter =
$_GET[
"note_id"];
513 $order = (bool)
$_SESSION[
"comments_sort_asc"];
514 if ($this->only_latest) {
526 $user_setting_notes_public_all,
527 $this->repository_mode,
532 $tpl =
new ilTemplate(
"tpl.notes_list.html",
true,
true,
"Services/Notes");
535 include_once(
"./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php");
536 $tpl->setCurrentBlock(
"close_img");
538 $tpl->parseCurrentBlock();
542 $cnt_str = (count($notes) > 0)
543 ?
" (" . count($notes) .
")" 547 if ($this->ajax && !$this->only_latest) {
548 switch ($this->obj_type) {
552 include_once
"Services/ContainerReference/classes/class.ilContainerReference.php";
567 $title .=
" - " . $sub_title;
571 $tpl->setCurrentBlock(
"title");
572 $tpl->setVariable(
"TITLE",
$img .
" " . $title);
573 $tpl->parseCurrentBlock();
576 if ($this->delete_note) {
580 $tpl->setVariable(
"TXT_NOTES",
$lng->txt(
"private_notes") . $cnt_str);
583 $tpl->setVariable(
"TXT_NOTES",
$lng->txt(
"notes_public_comments") . $cnt_str);
586 $anch = $this->anchor_jump
589 if (!$this->only_latest) {
590 $tpl->setVariable(
"FORMACTION",
$ilCtrl->getFormAction($this,
"getNotesHTML", $anch));
592 $os =
"onsubmit = \"ilNotes.cmdAjaxForm(event, '" .
593 $ilCtrl->getFormActionByClass(
"ilnotegui",
"",
"",
true) .
594 "'); return false;\"";
595 $tpl->setVariable(
"ON_SUBMIT_FORM", $os);
596 $tpl->setVariable(
"FORM_ID",
"id='ilNoteFormAjax'");
601 if ($this->export_html || $this->print) {
602 $tpl->touchBlock(
"print_style");
626 if (count($notes) > 0 && $this->enable_hiding && !$this->delete_note
627 && !$this->export_html && !$this->print && !$this->edit_note_form
628 && !$this->add_note_form) {
629 if ($user_setting_notes_by_type ==
"n") {
631 $txt =
$lng->txt(
"notes_show_comments");
633 $txt =
$lng->txt(
"show_" . $suffix .
"_notes");
638 if ((
$ilUser->getId() != ANONYMOUS_USER_ID)) {
640 $txt =
$lng->txt(
"notes_hide_comments");
642 $txt =
$lng->txt(
"hide_" . $suffix .
"_notes");
648 if ($user_setting_notes_public_all ==
"n") {
652 $lng->txt(
"notes_all_comments"),
653 "showAllPublicNotes",
660 $lng->txt(
"notes_my_comments"),
671 if (!$this->edit_note_form && $user_setting_notes_by_type !=
"n" &&
677 $tpl->setCurrentBlock(
"edit_note_form");
679 $tpl->setVariable(
"EDIT_FORM", $this->form_tpl->get());
680 $tpl->parseCurrentBlock();
682 $tpl->parseCurrentBlock();
683 $tpl->setCurrentBlock(
"note_row");
684 $tpl->parseCurrentBlock();
688 if ($user_setting_notes_by_type !=
"n" || !$this->enable_hiding) {
692 if (
sizeof($notes) && !$this->only_latest) {
693 if ((
int)
$_SESSION[
"comments_sort_asc"] == 1) {
694 $sort_txt =
$lng->txt(
"notes_sort_desc");
695 $sort_cmd =
"listSortDesc";
697 $sort_txt =
$lng->txt(
"notes_sort_asc");
698 $sort_cmd =
"listSortAsc";
700 $this->
renderLink(
$tpl,
"sort_list", $sort_txt, $sort_cmd, $anch);
703 $notes_given =
false;
704 foreach ($notes as $note) {
705 if ($this->only_latest && $notes_given) {
710 if ($this->edit_note_form && ($note->getId() ==
$_GET[
"note_id"])
715 $tpl->setCurrentBlock(
"edit_note_form");
717 $tpl->setVariable(
"EDIT_FORM", $this->form_tpl->get());
718 $tpl->parseCurrentBlock();
724 && !$this->delete_note
725 && !$this->export_html && !$this->print
726 && !$this->edit_note_form && !$this->add_note_form && !$this->no_actions) {
727 $ilCtrl->setParameterByClass(
"ilnotegui",
"note_id", $note->getId());
733 "note_" . $note->getId()
738 if ($this->multi_selection && !$this->delete_note) {
739 $tpl->setVariable(
"CHECKBOX_CLASS",
"ilNotesCheckboxes");
740 $tpl->setCurrentBlock(
"checkbox_col");
741 $tpl->setVariable(
"CHK_NOTE",
"note[]");
742 $tpl->setVariable(
"CHK_NOTE_ID", $note->getId());
743 $tpl->parseCurrentBlock();
749 if (!$this->delete_note && !$this->export_html && !$this->print
750 && !$this->edit_note_form && !$this->add_note_form && !$this->no_actions) {
751 $ilCtrl->setParameterByClass(
"ilnotegui",
"note_id", $note->getId());
762 $tpl->setVariable(
"CNT_COL", $cnt_col);
769 $tpl->setCurrentBlock(
"user_img");
774 $tpl->setVariable(
"USR_ALT",
$lng->txt(
"user_image") .
": " .
776 $tpl->parseCurrentBlock();
784 if ($note->getUpdateDate() != null) {
785 $tpl->setVariable(
"TXT_LAST_EDIT",
$lng->txt(
"last_edited_on"));
798 if ($this->delete_note) {
799 $tpl->setCurrentBlock(
"delete_ids");
800 $tpl->setVariable(
"HID_NOTE",
"note[]");
801 $tpl->setVariable(
"HID_NOTE_ID", $note->getId());
802 $tpl->parseCurrentBlock();
804 $target = $note->getObject();
807 $tpl->setCurrentBlock(
"note");
808 $text = (trim($note->getText()) !=
"")
809 ? nl2br($note->getText())
810 :
"<p class='subtitle'>" .
$lng->txt(
"note_content_removed") .
"</p>";
811 $tpl->setVariable(
"NOTE_TEXT", $text);
812 $tpl->setVariable(
"VAL_SUBJECT", $note->getSubject());
813 $tpl->setVariable(
"NOTE_ID", $note->getId());
821 $tpl->parseCurrentBlock();
823 $tpl->setCurrentBlock(
"note_row");
824 $tpl->parseCurrentBlock();
829 $tpl->setCurrentBlock(
"no_notes");
831 $tpl->setVariable(
"NO_NOTES",
$lng->txt(
"notes_no_comments"));
833 $tpl->parseCurrentBlock();
839 if ($this->multi_selection && !$this->delete_note && !$this->edit_note_form
840 && count($notes) > 0) {
842 $tpl->setCurrentBlock(
"delete_cmd");
843 $tpl->setVariable(
"TXT_DELETE_NOTES", $this->lng->txt(
"delete"));
844 $tpl->parseCurrentBlock();
847 $tpl->setCurrentBlock(
"multiple_commands");
848 $tpl->setVariable(
"TXT_SELECT_ALL", $this->lng->txt(
"select_all"));
850 $tpl->setVariable(
"ALT_ARROW", $this->lng->txt(
"actions"));
851 $tpl->setVariable(
"TXT_PRINT_NOTES", $this->lng->txt(
"print"));
852 $tpl->setVariable(
"TXT_EXPORT_NOTES", $this->lng->txt(
"exp_html"));
853 $tpl->parseCurrentBlock();
857 if ($this->delete_note) {
858 $tpl->setCurrentBlock(
"delete_cancel");
859 $tpl->setVariable(
"TXT_DEL_NOTES", $this->lng->txt(
"delete"));
860 $tpl->setVariable(
"TXT_CANCEL_DEL_NOTES", $this->lng->txt(
"cancel"));
861 $tpl->parseCurrentBlock();
866 $tpl->touchBlock(
"print_js");
867 $tpl->setCurrentBlock(
"print_back");
868 $tpl->setVariable(
"LINK_BACK", $this->ctrl->getLinkTarget($this,
"showNotes"));
869 $tpl->setVariable(
"TXT_BACK", $this->lng->txt(
"back"));
870 $tpl->parseCurrentBlock();
875 switch (
$_GET[
"note_mess"] !=
"" ?
$_GET[
"note_mess"] : $this->note_mess) {
878 $mtxt =
$lng->txt(
"msg_obj_modified");
884 ?
$lng->txt(
"notes_notes_deleted")
885 :
$lng->txt(
"notes_comments_deleted");
891 ?
$lng->txt(
"notes_note_deleted")
892 :
$lng->txt(
"notes_comment_deleted");
897 $mtxt =
$lng->txt(
"form_input_not_valid");
902 $mtxt =
$lng->txt(
"info_delete_sure");
907 $mtxt =
$lng->txt(
"no_checkbox");
913 $tpl->setVariable(
"MESS",
"");
916 if ($this->widget_header !=
"") {
917 $tpl->setVariable(
"WIDGET_HEADER", $this->widget_header);
921 if ($this->delete_note && count($notes) == 0) {
941 $parent_class =
"ilObj" . $objDefinition->getClassName($parent_type) .
"GUI";
942 $parent_path =
$ilCtrl->lookupClassPath($parent_class);
943 include_once $parent_path;
944 if (method_exists($parent_class,
"lookupSubObjectTitle")) {
945 return call_user_func_array(array($parent_class,
"lookupSubObjectTitle"), array($parent_obj_id, $sub_obj_id));
957 if (
$ilUser->getId() == ANONYMOUS_USER_ID) {
961 $is_author = ($a_note->getAuthor() ==
$ilUser->getId());
985 if ($a_note->getAuthor() ==
$ilUser->getId()
986 && (
$ilUser->getId() != ANONYMOUS_USER_ID)) {
1003 $this->form_tpl =
new ilTemplate(
"tpl.notes_edit.html",
true,
true,
"Services/Notes");
1005 ?
$lng->txt(
"comment")
1006 :
$lng->txt(
"note"));
1010 $this->form_tpl->setVariable(
"NOTE_ID", $a_note->getId());
1013 if ($a_mode ==
"create") {
1015 ?
$lng->txt(
"note_add_comment")
1016 :
$lng->txt(
"note_add_note"));
1017 $this->form_tpl->setVariable(
"CMD",
"addNote");
1020 ?
$lng->txt(
"note_update_comment")
1021 :
$lng->txt(
"note_update_note"));
1022 $this->form_tpl->setVariable(
"CMD",
"updateNote");
1026 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
1028 $this->form->setOpenTag(
false);
1029 $this->form->setCloseTag(
false);
1030 $this->form->setDisableStandardMessage(
true);
1051 $ta->setValue($a_note->getText());
1053 $this->form->addItem($ta);
1074 $hi->setValue(
$_GET[
"note_id"]);
1075 $this->form->addItem($hi);
1079 if ($a_mode ==
"create") {
1080 $this->form->addCommandButton(
"addNote",
$lng->txt(
"save"));
1086 $this->form->addCommandButton(
"updateNote",
$lng->txt(
"save"));
1094 $this->form->setFormAction($this->ctrl->getFormAction($this));
1106 $tpl =
new ilTemplate(
"tpl.pd_note.html",
true,
true,
"Services/Notes");
1107 $note =
new ilNote($note_id);
1108 $target = $note->getObject();
1110 if ($note->getAuthor() !=
$ilUser->getId()) {
1114 $tpl->setCurrentBlock(
"edit_note");
1115 $ilCtrl->setParameterByClass(
"ilnotegui",
"rel_obj", $target[
"rep_obj_id"]);
1116 $ilCtrl->setParameterByClass(
"ilnotegui",
"note_id", $note_id);
1117 $ilCtrl->setParameterByClass(
"ilnotegui",
"note_type", $note->getType());
1120 $ilCtrl->getLinkTargetByClass(
1121 array(
"ildashboardgui",
"ilpdnotesgui",
"ilnotegui"),
1125 $tpl->setVariable(
"TXT_EDIT_NOTE",
$lng->txt(
"edit"));
1126 $tpl->parseCurrentBlock();
1127 $ilCtrl->clearParametersByClass(
"ilnotegui");
1130 if ($note->getUpdateDate() != null) {
1131 $tpl->setVariable(
"TXT_LAST_EDIT",
$lng->txt(
"last_edited_on"));
1144 $tpl->setVariable(
"VAL_SUBJECT", $note->getSubject());
1145 $text = (trim($note->getText()) !=
"")
1146 ? nl2br($note->getText())
1147 :
"<p class='subtitle'>" .
$lng->txt(
"note_content_removed") .
"</p>";
1148 $tpl->setVariable(
"NOTE_TEXT", $text);
1163 if (!$this->targets_enabled) {
1167 $a_note_id = $a_note->getId();
1168 $target = $a_note->getObject();
1169 $a_obj_type = $target[
"obj_type"];
1170 $a_obj_id = $target[
"obj_id"];
1172 $target_tpl =
new ilTemplate(
"tpl.note_target_object.html",
true,
true,
"Services/Notes");
1174 if ($target[
"rep_obj_id"] > 0) {
1180 $vis_ref_ids = array();
1181 foreach ($ref_ids as $ref_id) {
1182 if ($ilAccess->checkAccess(
"visible",
"", $ref_id)) {
1183 $vis_ref_ids[] = $ref_id;
1188 if (count($vis_ref_ids) > 0) {
1189 foreach ($vis_ref_ids as $vis_ref_id) {
1193 $sub_link = $sub_title =
"";
1194 if (
$type ==
"sahs") {
1195 $link =
"goto.php?target=sahs_" . $vis_ref_id;
1196 if ($a_obj_type ==
"sco" || $a_obj_type ==
"seqc" || $a_obj_type ==
"chap" || $a_obj_type ==
"pg") {
1197 $sub_link =
"goto.php?target=sahs_" . $vis_ref_id .
"_" . $a_obj_id;
1198 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1201 } elseif (
$type ==
"poll") {
1202 include_once
"Services/Link/classes/class.ilLink.php";
1204 } elseif ($a_obj_type !=
"pg") {
1205 if (!is_object($this->item_list_gui[
$type])) {
1206 $class = $objDefinition->getClassName($type);
1207 $location = $objDefinition->getLocation($type);
1208 $full_class =
"ilObj" . $class .
"ListGUI";
1209 include_once(
$location .
"/class." . $full_class .
".php");
1210 $this->item_list_gui[
$type] =
new $full_class();
1215 if ($a_obj_type ==
"crsr" || $a_obj_type ==
"catr" || $a_obj_type ==
"grpr") {
1216 include_once
"Services/ContainerReference/classes/class.ilContainerReference.php";
1220 $this->item_list_gui[
$type]->initItem($vis_ref_id, $target[
"rep_obj_id"], $title, $a_obj_type);
1221 $link = $this->item_list_gui[
$type]->getCommandLink(
"infoScreen");
1226 $link = $this->item_list_gui[
$type]->appendRepositoryFrameParameter($link) .
"#note_" . $a_note_id;
1229 $link =
"goto.php?target=pg_" . $a_obj_id .
"_" . $vis_ref_id;
1232 $par_id =
$tree->getParentId($vis_ref_id);
1235 if ($sub_link !=
"") {
1236 if ($this->export_html || $this->print) {
1237 $target_tpl->setCurrentBlock(
"exp_target_sub_object");
1239 $target_tpl->setCurrentBlock(
"target_sub_object");
1240 $target_tpl->setVariable(
"LINK_SUB_TARGET", $sub_link);
1242 $target_tpl->setVariable(
"TXT_SUB_TARGET", $sub_title);
1243 $target_tpl->parseCurrentBlock();
1247 if ($this->export_html || $this->print) {
1248 $target_tpl->setCurrentBlock(
"exp_target_object");
1250 $target_tpl->setCurrentBlock(
"target_object");
1251 $target_tpl->setVariable(
"LINK_TARGET", $link);
1253 $target_tpl->setVariable(
1259 $target_tpl->setVariable(
"TXT_TARGET", $title);
1261 $target_tpl->parseCurrentBlock();
1263 $target_tpl->touchBlock(
"target_objects");
1269 if (!$this->wsp_tree) {
1270 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
1271 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
1275 $node_id = $this->wsp_tree->lookupNodeId($target[
"rep_obj_id"]);
1276 if ($this->wsp_access_handler->checkAccess(
"visible",
"", $node_id)) {
1277 $path = $this->wsp_tree->getPathFull($node_id);
1279 $item = array_pop($path);
1280 $parent = array_pop($path);
1282 if (!$parent[
"title"]) {
1283 $parent[
"title"] = $this->lng->txt(
"personal_resources");
1291 $item[
"title"] .=
" (" . $sub_title .
")";
1301 $parent[
"title"] = $this->lng->txt(
"wsp_tab_shared") .
1304 $link =
"ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace&dsh=" .
1309 if ($this->export_html || $this->print) {
1310 $target_tpl->setCurrentBlock(
"exp_target_object");
1312 $target_tpl->setCurrentBlock(
"target_object");
1313 $target_tpl->setVariable(
"LINK_TARGET", $link);
1319 $target_tpl->setVariable(
"TXT_CONTAINER", $parent[
"title"]);
1321 $target_tpl->setVariable(
"TXT_TARGET", $item[
"title"]);
1323 $target_tpl->parseCurrentBlock();
1327 return $target_tpl->get();
1340 $ilUser->setPref(
"notes_" . $suffix,
"y");
1342 $this->add_note_form =
true;
1374 if (
$_POST[
"note"] !=
"") {
1376 $note->setObject($this->obj_type, $this->rep_obj_id, $this->obj_id, $this->news_id);
1377 $note->setInRepository($this->repository_mode);
1378 $note->setType(
$_GET[
"note_type"]);
1379 $note->setAuthor(
$ilUser->getId());
1380 $note->setText(ilUtil::stripslashes(
$_POST[
"note"]));
1387 $ilCtrl->setParameter($this,
"note_mess",
"mod");
1390 $ilCtrl->redirect($this,
"showNotes",
"notes_top", $this->ajax);
1423 $ilCtrl->setParameter($this,
"note_mess",
"mod");
1425 $ilCtrl->redirect($this,
"showNotes",
"notes_top", $this->ajax);
1427 $ilCtrl->redirect($this,
"showNotes",
"notes_top", $this->ajax);
1428 $this->note_mess =
"frmfld";
1429 $this->form->setValuesByPost();
1430 $_GET[
"note_id"] = $note->getId();
1431 $_GET[
"note_type"] = $note->getType();
1440 $this->edit_note_form =
true;
1450 $this->delete_note =
true;
1451 $this->note_mess =
"qdel";
1463 $this->note_mess =
"noc";
1465 $this->delete_note =
true;
1466 $this->note_mess =
"qdel";
1490 foreach (
$_POST[
"note"] as $id) {
1498 $ilCtrl->setParameter($this,
"note_mess",
"ntsdel");
1500 $ilCtrl->setParameter($this,
"note_mess",
"ntdel");
1502 $ilCtrl->redirect($this,
"showNotes",
"notes_top", $this->ajax);
1512 $this->export_html =
true;
1513 $this->multi_selection =
false;
1525 $this->print =
true;
1526 $this->multi_selection =
false;
1542 $ilUser->writePref(
"notes_" . $suffix,
"y");
1557 $ilUser->writePref(
"notes_" . $suffix,
"n");
1569 $ilUser->writePref(
"notes_pub_all",
"y");
1581 $ilUser->writePref(
"notes_pub_all",
"n");
1593 if ($a_main_tpl != null) {
1598 $lng = $DIC->language();
1600 $lng->loadLanguageModule(
"notes");
1602 include_once(
"./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
1605 $lng->toJs(array(
"private_notes",
"notes_public_comments"),
$tpl);
1607 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
1609 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
1611 $tpl->addJavascript(
"./Services/Notes/js/ilNotes.js");
1613 $tpl->addOnLoadCode(
"ilNotes.setAjaxUrl('" . $a_ajax_url .
"');");
1625 if ($a_update_code === null) {
1626 $a_update_code =
"null";
1628 $a_update_code =
"'" . $a_update_code .
"'";
1631 return "ilNotes.listNotes(event, '" . $a_hash .
"', " . $a_update_code .
");";
1643 if ($a_update_code === null) {
1644 $a_update_code =
"null";
1646 $a_update_code =
"'" . $a_update_code .
"'";
1649 return "ilNotes.listComments(event, '" . $a_hash .
"', " . $a_update_code .
");";
1661 protected static function buildAjaxHash($a_node_type, $a_node_id, $a_sub_id, $a_sub_type)
1663 return $a_node_type .
";" . $a_node_id .
";" . $a_sub_id .
";" . $a_sub_type;
1669 public function renderLink($a_tpl, $a_var, $a_txt, $a_cmd, $a_anchor =
"")
1673 $low_var = strtolower($a_var);
1674 $up_var = strtoupper($a_var);
1677 $a_tpl->setVariable(
"LINK_" . $up_var,
"#");
1678 $oc =
"onclick = \"ilNotes.cmdAjaxLink(event, '" .
1679 $ilCtrl->getLinkTargetByClass(
"ilnotegui", $a_cmd,
"",
true) .
1681 $a_tpl->setVariable(
"ON_CLICK_" . $up_var, $oc);
1683 $a_tpl->setVariable(
1685 $ilCtrl->getLinkTargetByClass(
"ilnotegui", $a_cmd, $a_anchor)
1689 $a_tpl->setCurrentBlock($low_var);
1690 $a_tpl->setVariable(
"TXT_" . $up_var, $a_txt);
1691 $a_tpl->parseCurrentBlock();
1701 $this->observer[] = $a_callback;
1712 if (is_array($this->observer) && count($this->observer) > 0) {
1713 foreach ($this->observer as $item) {
1714 $param = $a_note->getObject();
1716 unset(
$param[
'news_id']);
1717 $param[
"action"] = $a_action;
1718 $param[
"note_id"] = $a_note->getId();
1720 call_user_func_array($item,
$param);
1726 $ref = (int)
$_GET[
'ref_id'];
1728 if ($this->obj_type ==
"pg") {
1735 $gui->observeNoteAction($this->rep_obj_id, $this->obj_id, $this->obj_type, $a_action, $a_note->getId());
1738 if ($this->obj_type ==
"wpg") {
1740 $gui->observeNoteAction($this->obj_id, $this->obj_id, $this->obj_type, $a_action, $a_note->getId());
1749 return $this->getNotesHtml();
1755 return $this->getNotesHtml();
1778 $f = $this->
ui->factory();
1779 $r = $this->
ui->renderer();
1783 $ctrl->setParameter($this,
"news_id", $this->news_id);
1797 $tpl =
new ilTemplate(
"tpl.note_widget_header.html",
true,
true,
"Services/Notes");
1798 $widget_el_id =
"notew_" . str_replace(
";",
"_", $hash);
1799 $ctrl->setParameter($this,
"hash", $hash);
1800 $update_url =
$ctrl->getLinkTarget($this,
"updateWidget",
"",
true,
false);
1803 $c =
$f->counter()->status((
int) $cnt);
1804 $comps[] =
$f->symbol()->glyph()->comment()->withCounter(
$c)->withAdditionalOnLoadCode(
function ($id) use ($hash, $update_url, $widget_el_id) {
1805 return "$(\"#$id\").click(function(event) { " . self::getListCommentsJSCall($hash,
"ilNotes.updateWidget(\"" . $widget_el_id .
"\",\"" . $update_url .
"\");") .
"});";
1807 $comps[] =
$f->divider()->vertical();
1808 $tpl->setVariable(
"GLYPH", $r->render($comps));
1809 $tpl->setVariable(
"TXT_LATEST",
$lng->txt(
"notes_latest_comment"));
1814 return "$(\"#$id\").click(function(event) { " . self::getListCommentsJSCall($hash,
"ilNotes.updateWidget(\"" . $widget_el_id .
"\",\"" . $update_url .
"\");") .
"});";
1816 if (
$ctrl->isAsynch()) {
1817 $tpl->setVariable(
"SHY_BUTTON", $r->renderAsync(
$b));
1819 $tpl->setVariable(
"SHY_BUTTON", $r->render(
$b));
1822 $this->widget_header =
$tpl->get();
1824 $this->hide_new_form =
true;
1825 $this->only_latest =
true;
1826 $this->no_actions =
true;
1828 $ctrl->setParameter($this,
"news_id",
$_GET[
"news_id"]);
static _lookupLogin($a_user_id)
lookup login
checkDeletion($a_note)
Check whether deletion is allowed.
getOnlyCommentsHTML()
Get only comments html.
static _lookupTitle($a_obj_id)
Lookup Title.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getNotesHTML($a_init_form=true)
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
enableCommentsSettings($a_enable=true)
enable private notes
getNoteListHTML($a_type=IL_NOTE_PRIVATE, $a_init_form=true)
get notes/comments list as html code
initNoteForm($a_mode="edit", $a_type, $a_note=null)
Init note form.
setRepositoryMode($a_value)
Set repository mode.
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_news_id=0)
Are comments activated for object?
enableMultiSelection($a_enable=true)
enable multi selection (checkboxes and commands)
enableAnchorJump($a_enable=true)
enable anchor for form jump
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
special template class to simplify handling of ITX/PEAR
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
getPDNoteHTML($note_id)
Note display for personal desktop.
getOnlyNotesHTML()
Get only notes html.
static getSystemMessageHTML($a_txt, $a_type="info")
Get HTML for a system message.
static initJS(ilGlobalTemplateInterface $a_main_tpl=null)
Init javascript.
executeCommand()
execute command
static get($a_glyph, $a_text="")
Get glyph html.
getDefaultCommand()
Get default command.
Access handler for personal workspace.
renderLink($a_tpl, $a_var, $a_txt, $a_cmd, $a_anchor="")
Render a link.
static setUseRelativeDates($a_status)
set use relative dates
static _lookupTitle($a_id)
lookup object title
static _getNotesOfObject( $a_rep_obj_id, $a_obj_id, $a_obj_type, $a_type=IL_NOTE_PRIVATE, $a_incl_sub=false, $a_filter="", $a_all_public="y", $a_repository_mode=true, $a_sort_ascending=false, $a_news_id=0)
get all notes related to a specific object
withAdditionalOnLoadCode(\Closure $binder)
deactivateComments()
Deactivate Comments.
checkEdit($a_note)
Check edit.
static initPanel($a_resize=false, ilGlobalTemplateInterface $a_main_tpl=null)
Init yui panel.
enablePublicNotes($a_enable=true)
enable public notes
static initJavascript($a_ajax_url, $a_type=IL_NOTE_PRIVATE, ilGlobalTemplateInterface $a_main_tpl=null)
Init javascript.
editNoteForm($a_init_form=true)
get notes list including add note area
activateComments()
Activate Comments.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
enableTargets($a_enable=true)
enable target objects
static _getAllReferences($a_id)
get all reference ids of object
static getListNotesJSCall($a_hash, $a_update_code=null)
Get list notes js call.
Tree handler for personal workspace.
static useRelativeDates()
check if relative dates are used
getSubObjectTitle($parent_obj_id, $sub_obj_id)
Get sub object title if available with callback.
Class ilLMPresentationGUI.
exportNotesHTML()
export selected notes to html
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
deleteNote()
delete note confirmation
static _lookupTitle($a_obj_id)
Overwitten from base class.
static getGotoLink($a_node_id, $a_obj_id, $a_additional=null)
enableHiding($a_enable=true)
enable hiding
static _countNotesAndComments( $a_rep_obj_id, $a_sub_obj_id=null, $a_obj_type="", $a_news_id=0)
Get all notes related to a specific object.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
updateWidget()
Update widget.
showAllPublicNotes()
show all public notes to user
addObserver($a_callback)
Add observer.
cancelUpdateNote()
cancel edit note
Class ilWikiPage GUI class.
static _lookupOwner($a_id)
lookup object owner
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static buildAjaxHash( $a_node_type, $a_node_id, $a_obj_type, $a_obj_id, $a_sub_type=null, $a_sub_id=null, $a_news_id=0)
Build ajax hash.
static _lookupType($a_id, $a_reference=false)
lookup object type
cancelDelete()
cancel deletion of note
static getListCommentsJSCall($a_hash, $a_update_code=null)
Get list comments js call.
notifyObserver($a_action, $a_note)
Notify observers on update/create.
renderTargets($a_note)
show related objects as links
showMyPublicNotes()
show only public notes of user
printNotes()
notes print view screen
enablePublicNotesDeletion($a_enable=true)
enable public notes
confirmDelete()
cancel deletion of note
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
static activateComments($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
Activate notes feature.
This class represents a text area property in a property form.
static _getPersonalPicturePath( $a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
addNoteForm($a_init_form=true)
get notes list including add note area
enablePrivateNotes($a_enable=true)
enable private notes
static buildAjaxHash($a_node_type, $a_node_id, $a_sub_id, $a_sub_type)
Combine properties to hash.
deleteNotes()
delete notes confirmation
static _lookupOwnerName($a_owner_id)
lookup owner name for owner id
cancelAddNote()
cancel add note
static _lookupTargetId($a_obj_id)
lookup target id
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
getCommentsWidget()
Get widget.
setDefaultCommand($a_val)
Set default command.
__construct( $a_rep_obj_id="", $a_obj_id="", $a_obj_type="", $a_include_subobjects=false, $a_news_id=0)
constructor, specifies notes set