6 include_once (
"Services/Notes/classes/class.ilNote.php");
31 function ilNoteGUI($a_rep_obj_id =
"", $a_obj_id =
"", $a_obj_type =
"", $a_include_subobjects =
false)
35 $lng->loadLanguageModule(
"notes");
37 $ilCtrl->saveParameter($this,
"notes_only");
38 $this->only =
$_GET[
"notes_only"];
40 $this->rep_obj_id = $a_rep_obj_id;
41 $this->obj_id = $a_obj_id;
42 $this->obj_type = $a_obj_type;
43 $this->inc_sub = $a_include_subobjects;
46 if(!$this->obj_type && $a_rep_obj_id)
51 $this->ajax = $ilCtrl->isAsynch();
56 $this->anchor_jump =
true;
57 $this->add_note_form =
false;
58 $this->edit_note_form =
false;
59 $this->private_enabled =
false;
61 $id = $this->rep_obj_id.
"_".$this->obj_id.
"_".$this->obj_type;
65 $this->public_enabled =
true;
69 $this->public_enabled =
false;
71 $this->enable_hiding =
false;
72 $this->targets_enabled =
false;
73 $this->multi_selection =
false;
74 $this->export_html =
false;
76 $this->comments_settings =
false;
78 $this->note_img = array(
81 "alt" => $lng->txt(
"note")),
84 "alt" => $lng->txt(
"note").
", ".$lng->txt(
"important")),
87 "alt" => $lng->txt(
"note").
", ".$lng->txt(
"question")),
90 "alt" => $lng->txt(
"note").
", ".$lng->txt(
"pro")),
93 "alt" => $lng->txt(
"note").
", ".$lng->txt(
"contra"))
96 $this->comment_img = array(
99 "alt" => $lng->txt(
"notes_comment")),
102 "alt" => $lng->txt(
"notes_comment").
", ".$lng->txt(
"important")),
105 "alt" => $lng->txt(
"notes_comment").
", ".$lng->txt(
"question")),
108 "alt" => $lng->txt(
"notes_comment").
", ".$lng->txt(
"pro")),
111 "alt" => $lng->txt(
"notes_comment").
", ".$lng->txt(
"contra"))
123 $cmd = $this->ctrl->getCmd(
"getNotesHTML");
124 $next_class = $this->ctrl->getNextClass($this);
129 return $this->
$cmd();
139 $this->private_enabled = $a_enable;
147 $this->public_enabled = $a_enable;
155 $this->comments_settings = $a_enable;
163 $this->public_deletion_enabled = $a_enable;
171 $this->enable_hiding = $a_enable;
179 $this->targets_enabled = $a_enable;
187 $this->multi_selection = $a_enable;
195 $this->anchor_jump = $a_enable;
205 $this->repository_mode = (bool)$a_value;
218 $ilCtrl->setParameter($this,
"notes_only",
"notes");
219 $this->only =
"notes";
232 $ilCtrl->setParameter($this,
"notes_only",
"comments");
233 $this->only =
"comments";
245 $lng->loadLanguageModule(
"notes");
247 $ntpl =
new ilTemplate(
"tpl.notes_and_comments.html",
true,
true,
251 $hide_comments = ($this->only ==
"notes");
252 $hide_notes = ($this->only ==
"comments");
253 switch($ilCtrl->getCmd())
261 $hide_comments =
true;
272 if ($this->private_enabled && $this->public_enabled
273 && $this->only !=
"notes")
275 $this->private_enabled =
false;
279 if ($this->private_enabled && ($ilUser->getId() != ANONYMOUS_USER_ID)
282 $ntpl->setCurrentBlock(
"notes_col");
284 $ntpl->parseCurrentBlock();
288 $comments_col =
false;
289 if ($this->public_enabled && (!$this->delete_note || $this->public_deletion_enabled)
293 $comments_col =
true;
297 if ($this->comments_settings && !$hide_comments && !$this->delete_note
298 && !$this->edit_note_form && !$this->add_note_form && $ilUser->getId() != ANONYMOUS_USER_ID)
300 $notes_settings =
new ilSetting(
"notes");
301 $id = $this->rep_obj_id.
"_".$this->obj_id.
"_".$this->obj_type;
307 $this->
renderLink($ntpl,
"comments_settings", $lng->txt(
"notes_deactivate_comments"),
308 "deactivateComments",
"notes_top");
309 $ntpl->setCurrentBlock(
"comments_settings2");
313 $this->
renderLink($ntpl,
"comments_settings", $lng->txt(
"notes_activate_comments"),
314 "activateComments",
"notes_top");
315 $ntpl->setCurrentBlock(
"comments_settings2");
317 if ($this->ajax && !$comments_col)
319 $ntpl->setVariable(
"COMMENTS_MESS",
320 $ntpl->getMessageHTML($lng->txt(
"comments_feature_currently_not_activated_for_object"),
"info"));
323 $ntpl->parseCurrentBlock();
327 $ntpl->setVariable(
"COMMENTS",
"");
330 $comments_col =
true;
335 $ntpl->setCurrentBlock(
"comments_col");
340 $ntpl->parseCurrentBlock();
359 $notes_settings =
new ilSetting(
"notes");
361 if ($this->comments_settings)
363 $id = $this->rep_obj_id.
"_".$this->obj_id.
"_".$this->obj_type;
368 $ilCtrl->redirectByClass(
"ilnotegui",
"showNotes",
"", $this->ajax);
379 $notes_settings =
new ilSetting(
"notes");
381 if ($this->comments_settings)
383 $id = $this->rep_obj_id.
"_".$this->obj_id.
"_".$this->obj_type;
388 $ilCtrl->redirectByClass(
"ilnotegui",
"showNotes",
"", $this->ajax);
399 include_once(
"./Services/User/classes/class.ilUserUtil.php");
409 $user_setting_notes_public_all =
"y";
410 $user_setting_notes_by_type =
"y";
412 if ($this->delete_note || $this->export_html || $this->print)
414 if (
$_GET[
"note_id"] !=
"")
416 $filter =
$_GET[
"note_id"];
424 $this->obj_type, $a_type, $this->inc_sub, $filter,
425 $user_setting_notes_public_all, $this->repository_mode);
427 $this->obj_type, $a_type, $this->inc_sub, $filter,
428 "", $this->repository_mode);
430 $tpl =
new ilTemplate(
"tpl.notes_list.html",
true,
true,
"Services/Notes");
433 $cnt_str = (count($all_notes) > 0)
434 ?
" (".count($all_notes).
")"
437 if (!$this->export_html)
439 $tpl->setCurrentBlock(
"notes_img");
443 $tpl->setVariable(
"ALT_NOTES", $lng->txt(
"icon").
" ".$lng->txt(
"notes_public_comments"));
448 $tpl->setVariable(
"ALT_NOTES", $lng->txt(
"icon").
" ".$lng->txt(
"private_notes"));
450 $tpl->parseCurrentBlock();
456 switch($this->obj_type)
460 include_once
"Services/ContainerReference/classes/class.ilContainerReference.php";
477 $title .=
" - ".$sub_title;
481 $tpl->setCurrentBlock(
"title");
482 $tpl->setVariable(
"TITLE",
$img.
" ".$title);
483 $tpl->parseCurrentBlock();
486 if ($this->delete_note)
492 $tpl->setVariable(
"TXT_NOTES", $lng->txt(
"private_notes").$cnt_str);
493 $ilCtrl->setParameterByClass(
"ilnotegui",
"note_type",
IL_NOTE_PRIVATE);
497 $tpl->setVariable(
"TXT_NOTES", $lng->txt(
"notes_public_comments").$cnt_str);
498 $ilCtrl->setParameterByClass(
"ilnotegui",
"note_type",
IL_NOTE_PUBLIC);
500 $anch = $this->anchor_jump
503 $tpl->setVariable(
"FORMACTION", $ilCtrl->getFormAction($this,
"getNotesHTML", $anch));
506 $os =
"onsubmit = \"ilNotes.cmdAjaxForm(event, '".
507 $ilCtrl->getFormActionByClass(
"ilnotegui",
"",
"",
true).
508 "'); return false;\"";
509 $tpl->setVariable(
"ON_SUBMIT_FORM", $os);
510 $tpl->setVariable(
"FORM_ID",
"Ajax");
513 if ($this->export_html || $this->print)
515 $tpl->touchBlock(
"print_style");
519 if (!$this->add_note_form && !$this->edit_note_form && !$this->delete_note &&
520 !$this->export_html && !$this->print && $ilUser->getId() != ANONYMOUS_USER_ID)
526 $tpl->setCurrentBlock(
"add_note_btn");
529 $tpl->setVariable(
"TXT_ADD_NOTE", $lng->txt(
"notes_add_comment"));
533 $tpl->setVariable(
"TXT_ADD_NOTE", $lng->txt(
"add_note"));
535 $tpl->setVariable(
"LINK_ADD_NOTE", $ilCtrl->getLinkTargetByClass(
"ilnotegui",
"addNoteForm").
537 $tpl->parseCurrentBlock();
543 if (count($all_notes) > 0 && $this->enable_hiding && !$this->delete_note
544 && !$this->export_html && !$this->print && !$this->edit_note_form
545 && !$this->add_note_form)
547 if ($user_setting_notes_by_type ==
"n")
551 $txt = $lng->txt(
"notes_show_comments");
555 $txt = $lng->txt(
"show_".$suffix.
"_notes");
557 $this->
renderLink(
$tpl,
"show_notes", $txt,
"showNotes",
"notes_top");
562 if (($ilUser->getId() != ANONYMOUS_USER_ID))
566 $txt = $lng->txt(
"notes_hide_comments");
570 $txt = $lng->txt(
"hide_".$suffix.
"_notes");
572 $this->
renderLink(
$tpl,
"hide_notes", $txt,
"hideNotes",
"notes_top");
577 if ($user_setting_notes_public_all ==
"n")
579 $this->
renderLink(
$tpl,
"all_pub_notes", $lng->txt(
"notes_all_comments"),
580 "showAllPublicNotes",
"notes_top");
584 $this->
renderLink(
$tpl,
"my_pub_notes", $lng->txt(
"notes_my_comments"),
585 "showMyPublicNotes",
"notes_top");
593 if (!$this->edit_note_form && $user_setting_notes_by_type !=
"n" &&
594 !$this->delete_note && $ilUser->getId() != ANONYMOUS_USER_ID)
601 $tpl->setCurrentBlock(
"edit_note_form");
603 $tpl->setVariable(
"EDIT_FORM", $this->form_tpl->get());
604 $tpl->parseCurrentBlock();
606 $tpl->parseCurrentBlock();
607 $tpl->setCurrentBlock(
"note_row");
608 $tpl->parseCurrentBlock();
612 if ($user_setting_notes_by_type !=
"n" || !$this->enable_hiding)
617 $notes_given =
false;
618 foreach($notes as $note)
620 if ($this->edit_note_form && ($note->getId() ==
$_GET[
"note_id"])
621 && $a_type ==
$_GET[
"note_type"])
627 $tpl->setCurrentBlock(
"edit_note_form");
629 $tpl->setVariable(
"EDIT_FORM", $this->form_tpl->get());
630 $tpl->parseCurrentBlock();
638 && !$this->delete_note
639 && !$this->export_html && !$this->print
640 && !$this->edit_note_form && !$this->add_note_form)
642 $ilCtrl->setParameterByClass(
"ilnotegui",
"note_id", $note->getId());
644 "deleteNote",
"note_".$note->getId());
648 if ($this->multi_selection && !$this->delete_note)
650 $tpl->setCurrentBlock(
"checkbox_col");
651 $tpl->setVariable(
"CHK_NOTE",
"note[]");
652 $tpl->setVariable(
"CHK_NOTE_ID", $note->getId());
653 $tpl->parseCurrentBlock();
661 if (!$this->delete_note && !$this->export_html && !$this->print
662 && !$this->edit_note_form && !$this->add_note_form)
664 $ilCtrl->setParameterByClass(
"ilnotegui",
"note_id", $note->getId());
666 "editNoteForm",
"note_edit");
670 $tpl->setVariable(
"CNT_COL", $cnt_col);
678 $tpl->setCurrentBlock(
"user_img");
679 $tpl->setVariable(
"USR_IMG",
681 $tpl->setVariable(
"USR_ALT", $lng->txt(
"user_image").
": ".
683 $tpl->parseCurrentBlock();
684 $tpl->setVariable(
"TXT_USR",
689 if ($note->getUpdateDate() != null)
691 $tpl->setVariable(
"TXT_LAST_EDIT", $lng->txt(
"last_edited_on"));
692 $tpl->setVariable(
"DATE_LAST_EDIT",
697 $tpl->setVariable(
"VAL_DATE",
702 if ($this->delete_note)
704 $tpl->setCurrentBlock(
"delete_ids");
705 $tpl->setVariable(
"HID_NOTE",
"note[]");
706 $tpl->setVariable(
"HID_NOTE_ID", $note->getId());
707 $tpl->parseCurrentBlock();
709 $target = $note->getObject();
713 $target[
"obj_type"], $target[
"obj_id"]);
715 $rowclass = ($rowclass !=
"tblrow1")
718 if (!$this->export_html && !$this->print)
720 $tpl->setCurrentBlock(
"note_img");
723 $tpl->setVariable(
"IMG_NOTE", $this->comment_img[$note->getLabel()][
"img"]);
724 $tpl->setVariable(
"ALT_NOTE", $this->comment_img[$note->getLabel()][
"alt"]);
728 $tpl->setVariable(
"IMG_NOTE", $this->note_img[$note->getLabel()][
"img"]);
729 $tpl->setVariable(
"ALT_NOTE", $this->note_img[$note->getLabel()][
"alt"]);
731 $tpl->parseCurrentBlock();
735 switch ($note->getLabel())
738 $tpl->setVariable(
"EXP_ICON",
"[ ]");
742 $tpl->setVariable(
"EXP_ICON",
"[!]");
746 $tpl->setVariable(
"EXP_ICON",
"[?]");
750 $tpl->setVariable(
"EXP_ICON",
"[+]");
754 $tpl->setVariable(
"EXP_ICON",
"[-]");
758 $tpl->setCurrentBlock(
"note");
759 $tpl->setVariable(
"ROWCLASS", $rowclass);
760 $text = (trim($note->getText()) !=
"")
761 ? nl2br($note->getText())
762 :
"<p class='subtitle'>".$lng->txt(
"note_content_removed").
"</p>";
763 $tpl->setVariable(
"NOTE_TEXT", $text);
764 $tpl->setVariable(
"VAL_SUBJECT", $note->getSubject());
765 $tpl->setVariable(
"NOTE_ID", $note->getId());
769 $tpl->parseCurrentBlock();
771 $tpl->setCurrentBlock(
"note_row");
772 $tpl->parseCurrentBlock();
778 $tpl->setCurrentBlock(
"no_notes");
781 $tpl->setVariable(
"NO_NOTES", $lng->txt(
"notes_no_comments"));
787 $tpl->parseCurrentBlock();
793 if ($this->multi_selection && !$this->delete_note && !$this->edit_note_form
794 && count($notes) > 0)
798 $tpl->setCurrentBlock(
"delete_cmd");
799 $tpl->setVariable(
"TXT_DELETE_NOTES", $this->lng->txt(
"delete"));
800 $tpl->parseCurrentBlock();
803 $tpl->setCurrentBlock(
"multiple_commands");
804 $tpl->setVariable(
"TXT_SELECT_ALL", $this->lng->txt(
"select_all"));
806 $tpl->setVariable(
"ALT_ARROW", $this->lng->txt(
"actions"));
807 $tpl->setVariable(
"TXT_PRINT_NOTES", $this->lng->txt(
"print"));
808 $tpl->setVariable(
"TXT_EXPORT_NOTES", $this->lng->txt(
"exp_html"));
809 $tpl->parseCurrentBlock();
813 if ($this->delete_note)
815 $tpl->setCurrentBlock(
"delete_cancel");
816 $tpl->setVariable(
"TXT_DEL_NOTES", $this->lng->txt(
"delete"));
817 $tpl->setVariable(
"TXT_CANCEL_DEL_NOTES", $this->lng->txt(
"cancel"));
818 $tpl->parseCurrentBlock();
824 $tpl->touchBlock(
"print_js");
825 $tpl->setCurrentBlock(
"print_back");
826 $tpl->setVariable(
"LINK_BACK", $this->ctrl->getLinkTarget($this,
"showNotes"));
827 $tpl->setVariable(
"TXT_BACK", $this->lng->txt(
"back"));
828 $tpl->parseCurrentBlock();
833 switch(
$_GET[
"note_mess"] !=
"" ?
$_GET[
"note_mess"] : $this->note_mess)
837 $mtxt = $lng->txt(
"msg_obj_modified");
842 $mtxt = $lng->txt(
"notes_notes_deleted");
847 $mtxt = $lng->txt(
"notes_note_deleted");
852 $mtxt = $lng->txt(
"form_input_not_valid");
857 $mtxt = $lng->txt(
"info_delete_sure");
862 $mtxt = $lng->txt(
"no_checkbox");
867 $tpl->setVariable(
"MESS",
$tpl->getMessageHTML($mtxt, $mtype));
871 $tpl->setVariable(
"MESS",
"");
876 if ($this->delete_note && count($notes) == 0)
895 global $objDefinition,
$ilCtrl;
898 $parent_class =
"ilObj".$objDefinition->getClassName($parent_type).
"GUI";
899 $parent_path = $ilCtrl->lookupClassPath($parent_class);
900 include_once $parent_path;
901 if(method_exists($parent_class,
"lookupSubObjectTitle"))
903 return call_user_func_array(array($parent_class,
"lookupSubObjectTitle"), array($parent_obj_id, $sub_obj_id));
914 if ($ilUser->getId() == ANONYMOUS_USER_ID)
920 if (($a_note->getType() ==
IL_NOTE_PRIVATE && $a_note->getAuthor() == $ilUser->getId()) ||
938 if ($a_note->getAuthor() == $ilUser->getId()
939 && ($ilUser->getId() != ANONYMOUS_USER_ID))
952 public function initNoteForm($a_mode =
"edit", $a_type, $a_note = null)
956 $this->form_tpl =
new ilTemplate(
"tpl.notes_edit.html",
true,
true,
"Services/Notes");
960 $this->form_tpl->setVariable(
"NOTE_ID", $a_note->getId());
963 if ($a_mode ==
"create")
965 $this->form_tpl->setVariable(
"TXT_CMD", ($a_type ==
IL_NOTE_PUBLIC)
966 ? $lng->txt(
"note_add_comment")
967 : $lng->txt(
"note_add_note"));
968 $this->form_tpl->setVariable(
"CMD",
"addNote");
972 $this->form_tpl->setVariable(
"TXT_CMD", ($a_type ==
IL_NOTE_PUBLIC)
973 ? $lng->txt(
"note_update_comment")
974 : $lng->txt(
"note_update_note"));
975 $this->form_tpl->setVariable(
"CMD",
"updateNote");
979 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
981 $this->form->setOpenTag(
false);
982 $this->form->setCloseTag(
false);
983 $this->form->setDisableStandardMessage(
true);
1005 $ta->setValue($a_note->getText());
1007 $this->form->addItem($ta);
1029 $hi->setValue(
$_GET[
"note_id"]);
1030 $this->form->addItem($hi);
1034 if ($a_mode ==
"create")
1036 $this->form->addCommandButton(
"addNote", $lng->txt(
"save"));
1044 $this->form->addCommandButton(
"updateNote", $lng->txt(
"save"));
1051 $ilCtrl->setParameter($this,
"note_type", $a_type);
1052 $this->form->setFormAction($this->ctrl->getFormAction($this));
1063 $tpl =
new ilTemplate(
"tpl.pd_note.html",
true,
true,
"Services/Notes");
1064 $note =
new ilNote($note_id);
1065 $target = $note->getObject();
1067 if ($note->getAuthor() != $ilUser->getId())
1073 $alt = $lng->txt(
"note");
1075 $tpl->setCurrentBlock(
"edit_note");
1076 $ilCtrl->setParameterByClass(
"ilnotegui",
"rel_obj", $target[
"rep_obj_id"]);
1077 $ilCtrl->setParameterByClass(
"ilnotegui",
"note_id", $note_id);
1078 $ilCtrl->setParameterByClass(
"ilnotegui",
"note_type", $note->getType());
1079 $tpl->setVariable(
"LINK_EDIT_NOTE",
1080 $ilCtrl->getLinkTargetByClass(array(
"ilpersonaldesktopgui",
"ilpdnotesgui",
"ilnotegui"),
1082 $tpl->setVariable(
"TXT_EDIT_NOTE", $lng->txt(
"edit"));
1083 $tpl->parseCurrentBlock();
1084 $ilCtrl->clearParametersByClass(
"ilnotegui");
1086 $tpl->setCurrentBlock(
"note_img");
1087 $tpl->setVariable(
"IMG_NOTE", $this->note_img[$note->getLabel()][
"img"]);
1088 $tpl->setVariable(
"ALT_NOTE", $this->note_img[$note->getLabel()][
"alt"]);
1089 $tpl->parseCurrentBlock();
1092 if ($note->getUpdateDate() != null)
1094 $tpl->setVariable(
"TXT_LAST_EDIT", $lng->txt(
"last_edited_on"));
1095 $tpl->setVariable(
"DATE_LAST_EDIT",
1101 $tpl->setVariable(
"VAL_DATE",
1105 $tpl->setVariable(
"VAL_SUBJECT", $note->getSubject());
1106 $text = (trim($note->getText()) !=
"")
1107 ? nl2br($note->getText())
1108 :
"<p class='subtitle'>".$lng->txt(
"note_content_removed").
"</p>";
1109 $tpl->setVariable(
"NOTE_TEXT", $text);
1110 $this->
showTargets(
$tpl, $target[
"rep_obj_id"], $note_id, $target[
"obj_type"], $target[
"obj_id"]);
1119 global $tree, $ilAccess, $objDefinition,
$ilUser;
1121 if ($this->targets_enabled)
1123 if ($a_rep_obj_id > 0)
1131 $vis_ref_ids = array();
1134 if ($ilAccess->checkAccess(
"visible",
"", $ref_id))
1141 if (count($vis_ref_ids) > 0)
1143 foreach($vis_ref_ids as $vis_ref_id)
1146 $sub_link = $sub_title =
"";
1147 if ($type ==
"sahs")
1149 $link =
"goto.php?target=sahs_".$vis_ref_id;
1151 if ($a_obj_type ==
"sco" || $a_obj_type ==
"seqc" || $a_obj_type ==
"chap" || $a_obj_type ==
"pg")
1153 $sub_link =
"goto.php?target=sahs_".$vis_ref_id.
"_".$a_obj_id;
1154 include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
1159 else if ($a_obj_type !=
"pg")
1161 if (!is_object($this->item_list_gui[$type]))
1163 $class = $objDefinition->getClassName($type);
1164 $location = $objDefinition->getLocation($type);
1165 $full_class =
"ilObj".$class.
"ListGUI";
1166 include_once(
$location.
"/class.".$full_class.
".php");
1167 $this->item_list_gui[$type] =
new $full_class();
1172 if($a_obj_type ==
"crsr" || $a_obj_type ==
"catr")
1174 include_once
"Services/ContainerReference/classes/class.ilContainerReference.php";
1182 $this->item_list_gui[$type]->initItem($vis_ref_id, $a_rep_obj_id, $title);
1183 $link = $this->item_list_gui[$type]->getCommandLink(
"infoScreen");
1188 $link = $this->item_list_gui[$type]->appendRepositoryFrameParameter($link).
"#note_".$a_note_id;
1193 $link =
"goto.php?target=pg_".$a_obj_id.
"_".$vis_ref_id;
1196 $par_id = $tree->getParentId($vis_ref_id);
1199 if ($sub_link !=
"")
1201 if ($this->export_html || $this->print)
1203 $tpl->setCurrentBlock(
"exp_target_sub_object");
1207 $tpl->setCurrentBlock(
"target_sub_object");
1208 $tpl->setVariable(
"LINK_SUB_TARGET", $sub_link);
1210 $tpl->setVariable(
"TXT_SUB_TARGET", $sub_title);
1211 $tpl->setVariable(
"IMG_SUB_TARGET", $sub_icon);
1212 $tpl->parseCurrentBlock();
1216 if ($this->export_html || $this->print)
1218 $tpl->setCurrentBlock(
"exp_target_object");
1222 $tpl->setCurrentBlock(
"target_object");
1223 $tpl->setVariable(
"LINK_TARGET", $link);
1225 $tpl->setVariable(
"TXT_CONTAINER",
1228 $tpl->setVariable(
"IMG_CONTAINER",
1231 $tpl->setVariable(
"TXT_TARGET", $title);
1232 $tpl->setVariable(
"IMG_TARGET",
1235 $tpl->parseCurrentBlock();
1237 $tpl->touchBlock(
"target_objects");
1244 if(!$this->wsp_tree)
1246 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
1247 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
1251 $node_id = $this->wsp_tree->lookupNodeId($a_rep_obj_id);
1252 if($this->wsp_access_handler->checkAccess(
"visible",
"", $node_id))
1254 $path = $this->wsp_tree->getPathFull($node_id);
1257 $item = array_pop(
$path);
1258 $parent = array_pop(
$path);
1260 if(!$parent[
"title"])
1262 $parent[
"title"] = $this->lng->txt(
"wsp_personal_workspace");
1272 $item[
"title"] .=
" (".$sub_title.
")";
1283 $parent[
"title"] = $this->lng->txt(
"wsp_tab_shared").
1284 " (".ilObject::_lookupOwnerName($owner).
")";
1286 $link =
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace&dsh=".
1291 if ($this->export_html || $this->print)
1293 $tpl->setCurrentBlock(
"exp_target_object");
1297 $tpl->setCurrentBlock(
"target_object");
1298 $tpl->setVariable(
"LINK_TARGET", $link);
1304 $tpl->setVariable(
"TXT_CONTAINER", $parent[
"title"]);
1305 $tpl->setVariable(
"IMG_CONTAINER",
1308 $tpl->setVariable(
"TXT_TARGET", $item[
"title"]);
1309 $tpl->setVariable(
"IMG_TARGET",
1312 $tpl->parseCurrentBlock();
1329 $ilUser->setPref(
"notes_".$suffix,
"y");
1331 $this->add_note_form =
true;
1361 if (
$_POST[
"note"] !=
"")
1364 $note->setObject($this->obj_type, $this->rep_obj_id, $this->obj_id);
1365 $note->setInRepository($this->repository_mode);
1366 $note->setType(
$_GET[
"note_type"]);
1367 $note->setAuthor($ilUser->getId());
1368 $note->setText(ilUtil::stripslashes(
$_POST[
"note"]));
1375 $ilCtrl->setParameter($this,
"note_mess",
"mod");
1378 $ilCtrl->redirect($this,
"showNotes",
"notes_top", $this->ajax);
1407 $ilCtrl->setParameter($this,
"note_mess",
"mod");
1409 $ilCtrl->redirect($this,
"showNotes",
"notes_top", $this->ajax);
1411 $ilCtrl->redirect($this,
"showNotes",
"notes_top", $this->ajax);
1412 $this->note_mess =
"frmfld";
1413 $this->form->setValuesByPost();
1414 $_GET[
"note_id"] = $note->getId();
1415 $_GET[
"note_type"] = $note->getType();
1424 $this->edit_note_form =
true;
1434 $this->delete_note =
true;
1435 $this->note_mess =
"qdel";
1448 $this->note_mess =
"noc";
1452 $this->delete_note =
true;
1453 $this->note_mess =
"qdel";
1475 foreach(
$_POST[
"note"] as $id)
1486 $ilCtrl->setParameter($this,
"note_mess",
"ntsdel");
1490 $ilCtrl->setParameter($this,
"note_mess",
"ntdel");
1492 $ilCtrl->redirect($this,
"showNotes",
"notes_top", $this->ajax);
1502 $this->export_html =
true;
1503 $this->multi_selection =
false;
1515 $this->print =
true;
1516 $this->multi_selection =
false;
1531 $ilUser->writePref(
"notes_".$suffix,
"y");
1546 $ilUser->writePref(
"notes_".$suffix,
"n");
1558 $ilUser->writePref(
"notes_pub_all",
"y");
1570 $ilUser->writePref(
"notes_pub_all",
"n");
1582 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
1584 include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
1586 $tpl->addJavascript(
"./Services/Notes/js/ilNotes.js");
1588 $tpl->addOnLoadCode(
"ilNotes.setAjaxUrl('".$a_ajax_url.
"');");
1600 if ($a_update_code === null)
1602 $a_update_code =
"null";
1606 $a_update_code =
"'".$a_update_code.
"'";
1609 return "ilNotes.listNotes(event, '".$a_hash.
"', ".$a_update_code.
");";
1621 if ($a_update_code === null)
1623 $a_update_code =
"null";
1627 $a_update_code =
"'".$a_update_code.
"'";
1630 return "ilNotes.listComments(event, '".$a_hash.
"', ".$a_update_code.
");";
1642 protected static function buildAjaxHash($a_node_type, $a_node_id, $a_sub_id, $a_sub_type)
1644 return $a_node_type.
";".$a_node_id.
";".$a_sub_id.
";".$a_sub_type;
1650 function renderLink($a_tpl, $a_var, $a_txt, $a_cmd, $a_anchor =
"")
1654 $low_var = strtolower($a_var);
1655 $up_var = strtoupper($a_var);
1659 $a_tpl->setVariable(
"LINK_".$up_var,
"#");
1660 $oc =
"onclick = \"ilNotes.cmdAjaxLink(event, '".
1661 $ilCtrl->getLinkTargetByClass(
"ilnotegui", $a_cmd,
"",
true).
1663 $a_tpl->setVariable(
"ON_CLICK_".$up_var, $oc);
1667 $a_tpl->setVariable(
"LINK_".$up_var,
1668 $ilCtrl->getLinkTargetByClass(
"ilnotegui", $a_cmd, $a_anchor));
1671 $a_tpl->setCurrentBlock($low_var);
1672 $a_tpl->setVariable(
"TXT_".$up_var, $a_txt);
1673 $a_tpl->parseCurrentBlock();
1683 $this->observer[] = $a_callback;
1694 if(
sizeof($this->observer))
1696 foreach($this->observer as $item)
1698 $param = $a_note->getObject();
1699 $param[
"action"] = $a_action;
1700 $param[
"note_id"] = $a_note->getId();
1702 call_user_func_array($item, $param);