6include_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();
 
  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) {
 
  430                        $ntpl->getMessageHTML(
$lng->txt(
"comments_feature_currently_not_activated_for_object"), 
"info")
 
  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");
 
  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", 
"Ajax");
 
  601        if ($this->export_html || $this->
print) {
 
  602            $tpl->touchBlock(
"print_style");
 
  606        if (!$this->add_note_form && !$this->edit_note_form && !$this->delete_note &&
 
  607            !$this->export_html && !$this->
print && 
$ilUser->getId() != ANONYMOUS_USER_ID && !$this->hide_new_form) {
 
  608            if (!$this->inc_sub) {      
 
  611                    $tpl->setCurrentBlock(
"add_note_btn");
 
  613                        $tpl->setVariable(
"TXT_ADD_NOTE", 
$lng->txt(
"notes_add_comment"));
 
  615                        $tpl->setVariable(
"TXT_ADD_NOTE", 
$lng->txt(
"add_note"));
 
  617                    $tpl->setVariable(
"LINK_ADD_NOTE", 
$ilCtrl->getLinkTargetByClass(
"ilnotegui", 
"addNoteForm") .
 
  619                    $tpl->parseCurrentBlock();
 
  625        if (count($notes) > 0 && $this->enable_hiding && !$this->delete_note
 
  626            && !$this->export_html && !$this->
print && !$this->edit_note_form
 
  627            && !$this->add_note_form) {
 
  628            if ($user_setting_notes_by_type == 
"n") {
 
  630                    $txt = 
$lng->txt(
"notes_show_comments");
 
  632                    $txt = 
$lng->txt(
"show_" . $suffix . 
"_notes");
 
  637                if ((
$ilUser->getId() != ANONYMOUS_USER_ID)) {
 
  639                        $txt = 
$lng->txt(
"notes_hide_comments");
 
  641                        $txt = 
$lng->txt(
"hide_" . $suffix . 
"_notes");
 
  647                        if ($user_setting_notes_public_all == 
"n") {
 
  651                                $lng->txt(
"notes_all_comments"),
 
  652                                "showAllPublicNotes",
 
  659                                $lng->txt(
"notes_my_comments"),
 
  670        if (!$this->edit_note_form && $user_setting_notes_by_type != 
"n" &&
 
  671            !$this->delete_note && 
$ilUser->getId() != ANONYMOUS_USER_ID && !$this->hide_new_form) {
 
  676            $tpl->setCurrentBlock(
"edit_note_form");
 
  678            $tpl->setVariable(
"EDIT_FORM", $this->form_tpl->get());
 
  679            $tpl->parseCurrentBlock();
 
  681            $tpl->parseCurrentBlock();
 
  682            $tpl->setCurrentBlock(
"note_row");
 
  683            $tpl->parseCurrentBlock();
 
  687        if ($user_setting_notes_by_type != 
"n" || !$this->enable_hiding) {
 
  691            if (
sizeof($notes) && !$this->only_latest) {
 
  692                if ((
int) 
$_SESSION[
"comments_sort_asc"] == 1) {
 
  693                    $sort_txt = 
$lng->txt(
"notes_sort_desc");
 
  694                    $sort_cmd = 
"listSortDesc";
 
  696                    $sort_txt = 
$lng->txt(
"notes_sort_asc");
 
  697                    $sort_cmd = 
"listSortAsc";
 
  699                $this->
renderLink(
$tpl, 
"sort_list", $sort_txt, $sort_cmd, $anch);
 
  702            $notes_given = 
false;
 
  703            foreach ($notes as $note) {
 
  704                if ($this->only_latest && $notes_given) {
 
  709                if ($this->edit_note_form && ($note->getId() == 
$_GET[
"note_id"])
 
  714                    $tpl->setCurrentBlock(
"edit_note_form");
 
  716                    $tpl->setVariable(
"EDIT_FORM", $this->form_tpl->get());
 
  717                    $tpl->parseCurrentBlock();
 
  723                        && !$this->delete_note
 
  724                        && !$this->export_html && !$this->
print 
  725                        && !$this->edit_note_form && !$this->add_note_form && !$this->no_actions) {
 
  726                        $ilCtrl->setParameterByClass(
"ilnotegui", 
"note_id", $note->getId());
 
  732                            "note_" . $note->getId()
 
  737                    if ($this->multi_selection && !$this->delete_note) {
 
  738                        $tpl->setVariable(
"CHECKBOX_CLASS", 
"ilNotesCheckboxes");
 
  739                        $tpl->setCurrentBlock(
"checkbox_col");
 
  740                        $tpl->setVariable(
"CHK_NOTE", 
"note[]");
 
  741                        $tpl->setVariable(
"CHK_NOTE_ID", $note->getId());
 
  742                        $tpl->parseCurrentBlock();
 
  748                        if (!$this->delete_note && !$this->export_html && !$this->
print 
  749                            && !$this->edit_note_form && !$this->add_note_form && !$this->no_actions) {
 
  750                            $ilCtrl->setParameterByClass(
"ilnotegui", 
"note_id", $note->getId());
 
  761                    $tpl->setVariable(
"CNT_COL", $cnt_col);
 
  768                        $tpl->setCurrentBlock(
"user_img");
 
  771                            ilObjUser::_getPersonalPicturePath($note->getAuthor(), 
"xxsmall")
 
  773                        $tpl->setVariable(
"USR_ALT", 
$lng->txt(
"user_image") . 
": " .
 
  775                        $tpl->parseCurrentBlock();
 
  783                    if ($note->getUpdateDate() != 
null) {
 
  784                        $tpl->setVariable(
"TXT_LAST_EDIT", 
$lng->txt(
"last_edited_on"));
 
  797                    if ($this->delete_note) {
 
  798                        $tpl->setCurrentBlock(
"delete_ids");
 
  799                        $tpl->setVariable(
"HID_NOTE", 
"note[]");
 
  800                        $tpl->setVariable(
"HID_NOTE_ID", $note->getId());
 
  801                        $tpl->parseCurrentBlock();
 
  806                    $tpl->setCurrentBlock(
"note");
 
  807                    $text = (trim($note->getText()) != 
"")
 
  808                        ? nl2br($note->getText())
 
  809                        : 
"<p class='subtitle'>" . 
$lng->txt(
"note_content_removed") . 
"</p>";
 
  811                    $tpl->setVariable(
"VAL_SUBJECT", $note->getSubject());
 
  812                    $tpl->setVariable(
"NOTE_ID", $note->getId());
 
  820                    $tpl->parseCurrentBlock();
 
  822                $tpl->setCurrentBlock(
"note_row");
 
  823                $tpl->parseCurrentBlock();
 
  828                $tpl->setCurrentBlock(
"no_notes");
 
  830                    $tpl->setVariable(
"NO_NOTES", 
$lng->txt(
"notes_no_comments"));
 
  832                $tpl->parseCurrentBlock();
 
  838            if ($this->multi_selection && !$this->delete_note && !$this->edit_note_form
 
  839                && count($notes) > 0) {
 
  841                    $tpl->setCurrentBlock(
"delete_cmd");
 
  842                    $tpl->setVariable(
"TXT_DELETE_NOTES", $this->lng->txt(
"delete"));
 
  843                    $tpl->parseCurrentBlock();
 
  846                $tpl->setCurrentBlock(
"multiple_commands");
 
  847                $tpl->setVariable(
"TXT_SELECT_ALL", $this->lng->txt(
"select_all"));
 
  849                $tpl->setVariable(
"ALT_ARROW", $this->lng->txt(
"actions"));
 
  850                $tpl->setVariable(
"TXT_PRINT_NOTES", $this->lng->txt(
"print"));
 
  851                $tpl->setVariable(
"TXT_EXPORT_NOTES", $this->lng->txt(
"exp_html"));
 
  852                $tpl->parseCurrentBlock();
 
  856            if ($this->delete_note) {
 
  857                $tpl->setCurrentBlock(
"delete_cancel");
 
  858                $tpl->setVariable(
"TXT_DEL_NOTES", $this->lng->txt(
"delete"));
 
  859                $tpl->setVariable(
"TXT_CANCEL_DEL_NOTES", $this->lng->txt(
"cancel"));
 
  860                $tpl->parseCurrentBlock();
 
  865                $tpl->touchBlock(
"print_js");
 
  866                $tpl->setCurrentBlock(
"print_back");
 
  867                $tpl->setVariable(
"LINK_BACK", $this->ctrl->getLinkTarget($this, 
"showNotes"));
 
  868                $tpl->setVariable(
"TXT_BACK", $this->lng->txt(
"back"));
 
  869                $tpl->parseCurrentBlock();
 
  874        switch (
$_GET[
"note_mess"] != 
"" ? 
$_GET[
"note_mess"] : $this->note_mess) {
 
  877                $mtxt = 
$lng->txt(
"msg_obj_modified");
 
  883                    ? 
$lng->txt(
"notes_notes_deleted")
 
  884                    : 
$lng->txt(
"notes_comments_deleted");
 
  890                    ? 
$lng->txt(
"notes_note_deleted")
 
  891                    : 
$lng->txt(
"notes_comment_deleted");
 
  896                $mtxt = 
$lng->txt(
"form_input_not_valid");
 
  901                $mtxt = 
$lng->txt(
"info_delete_sure");
 
  906                $mtxt = 
$lng->txt(
"no_checkbox");
 
  912            $tpl->setVariable(
"MESS", 
"");
 
  915        if ($this->widget_header != 
"") {
 
  916            $tpl->setVariable(
"WIDGET_HEADER", $this->widget_header);
 
  920        if ($this->delete_note && count($notes) == 0) {
 
  940        $parent_class = 
"ilObj" . $objDefinition->getClassName($parent_type) . 
"GUI";
 
  941        $parent_path = 
$ilCtrl->lookupClassPath($parent_class);
 
  942        include_once $parent_path;
 
  943        if (method_exists($parent_class, 
"lookupSubObjectTitle")) {
 
  944            return call_user_func_array(array($parent_class, 
"lookupSubObjectTitle"), array($parent_obj_id, $sub_obj_id));
 
  956        if (
$ilUser->getId() == ANONYMOUS_USER_ID) {
 
  960        $is_author = ($a_note->getAuthor() == 
$ilUser->getId());
 
  984        if ($a_note->getAuthor() == 
$ilUser->getId()
 
  985            && (
$ilUser->getId() != ANONYMOUS_USER_ID)) {
 
 1002        $this->form_tpl = 
new ilTemplate(
"tpl.notes_edit.html", 
true, 
true, 
"Services/Notes");
 
 1005            $this->form_tpl->setVariable(
"NOTE_ID", $a_note->getId());
 
 1008        if ($a_mode == 
"create") {
 
 1010                ? 
$lng->txt(
"note_add_comment")
 
 1011                : 
$lng->txt(
"note_add_note"));
 
 1012            $this->form_tpl->setVariable(
"CMD", 
"addNote");
 
 1015                ? 
$lng->txt(
"note_update_comment")
 
 1016                : 
$lng->txt(
"note_update_note"));
 
 1017            $this->form_tpl->setVariable(
"CMD", 
"updateNote");
 
 1021        include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
 
 1023        $this->form->setOpenTag(
false);
 
 1024        $this->form->setCloseTag(
false);
 
 1025        $this->form->setDisableStandardMessage(
true);
 
 1046            $ta->setValue($a_note->getText());
 
 1048        $this->form->addItem($ta);
 
 1069            $hi->setValue(
$_GET[
"note_id"]);
 
 1070            $this->form->addItem($hi);
 
 1074        if ($a_mode == 
"create") {
 
 1075            $this->form->addCommandButton(
"addNote", 
$lng->txt(
"save"));
 
 1081            $this->form->addCommandButton(
"updateNote", 
$lng->txt(
"save"));
 
 1089        $this->form->setFormAction($this->ctrl->getFormAction($this));
 
 1101        $tpl = 
new ilTemplate(
"tpl.pd_note.html", 
true, 
true, 
"Services/Notes");
 
 1102        $note = 
new ilNote($note_id);
 
 1105        if ($note->getAuthor() != 
$ilUser->getId()) {
 
 1109        $tpl->setCurrentBlock(
"edit_note");
 
 1110        $ilCtrl->setParameterByClass(
"ilnotegui", 
"rel_obj", 
$target[
"rep_obj_id"]);
 
 1111        $ilCtrl->setParameterByClass(
"ilnotegui", 
"note_id", $note_id);
 
 1112        $ilCtrl->setParameterByClass(
"ilnotegui", 
"note_type", $note->getType());
 
 1115            $ilCtrl->getLinkTargetByClass(
 
 1116                array(
"ilpersonaldesktopgui", 
"ilpdnotesgui", 
"ilnotegui"),
 
 1120        $tpl->setVariable(
"TXT_EDIT_NOTE", 
$lng->txt(
"edit"));
 
 1121        $tpl->parseCurrentBlock();
 
 1122        $ilCtrl->clearParametersByClass(
"ilnotegui");
 
 1125        if ($note->getUpdateDate() != 
null) {
 
 1126            $tpl->setVariable(
"TXT_LAST_EDIT", 
$lng->txt(
"last_edited_on"));
 
 1139        $tpl->setVariable(
"VAL_SUBJECT", $note->getSubject());
 
 1140        $text = (trim($note->getText()) != 
"")
 
 1141            ? nl2br($note->getText())
 
 1142            : 
"<p class='subtitle'>" . 
$lng->txt(
"note_content_removed") . 
"</p>";
 
 1158        if (!$this->targets_enabled) {
 
 1162        $a_note_id = $a_note->getId();
 
 1163        $target = $a_note->getObject();
 
 1164        $a_obj_type = 
$target[
"obj_type"];
 
 1165        $a_obj_id = 
$target[
"obj_id"];
 
 1167        $target_tpl = 
new ilTemplate(
"tpl.note_target_object.html", 
true, 
true, 
"Services/Notes");
 
 1169        if (
$target[
"rep_obj_id"] > 0) {
 
 1175                $vis_ref_ids = array();
 
 1176                foreach ($ref_ids as $ref_id) {
 
 1177                    if ($ilAccess->checkAccess(
"visible", 
"", $ref_id)) {
 
 1178                        $vis_ref_ids[] = $ref_id;
 
 1183                if (count($vis_ref_ids) > 0) {
 
 1184                    foreach ($vis_ref_ids as $vis_ref_id) {
 
 1188                        $sub_link = $sub_title = 
"";
 
 1189                        if (
$type == 
"sahs") {          
 
 1190                            $link = 
"goto.php?target=sahs_" . $vis_ref_id;
 
 1191                            if ($a_obj_type == 
"sco" || $a_obj_type == 
"seqc" || $a_obj_type == 
"chap" || $a_obj_type == 
"pg") {
 
 1192                                $sub_link = 
"goto.php?target=sahs_" . $vis_ref_id . 
"_" . $a_obj_id;
 
 1193                                include_once(
"./Modules/Scorm2004/classes/class.ilSCORM2004Node.php");
 
 1196                        } elseif (
$type == 
"poll") {
 
 1197                            include_once 
"Services/Link/classes/class.ilLink.php";
 
 1199                        } elseif ($a_obj_type != 
"pg") {
 
 1200                            if (!is_object($this->item_list_gui[
$type])) {
 
 1201                                $class = $objDefinition->getClassName(
$type);
 
 1203                                $full_class = 
"ilObj" . $class . 
"ListGUI";
 
 1204                                include_once(
$location . 
"/class." . $full_class . 
".php");
 
 1205                                $this->item_list_gui[
$type] = 
new $full_class();
 
 1210                            if ($a_obj_type == 
"crsr" || $a_obj_type == 
"catr" || $a_obj_type == 
"grpr") {
 
 1211                                include_once 
"Services/ContainerReference/classes/class.ilContainerReference.php";
 
 1216                            $link = $this->item_list_gui[
$type]->getCommandLink(
"infoScreen");
 
 1221                            $link = $this->item_list_gui[
$type]->appendRepositoryFrameParameter($link) . 
"#note_" . $a_note_id;
 
 1224                            $link = 
"goto.php?target=pg_" . $a_obj_id . 
"_" . $vis_ref_id;
 
 1227                        $par_id = 
$tree->getParentId($vis_ref_id);
 
 1230                        if ($sub_link != 
"") {
 
 1231                            if ($this->export_html || $this->
print) {
 
 1232                                $target_tpl->setCurrentBlock(
"exp_target_sub_object");
 
 1234                                $target_tpl->setCurrentBlock(
"target_sub_object");
 
 1235                                $target_tpl->setVariable(
"LINK_SUB_TARGET", $sub_link);
 
 1237                            $target_tpl->setVariable(
"TXT_SUB_TARGET", $sub_title);
 
 1238                            $target_tpl->parseCurrentBlock();
 
 1242                        if ($this->export_html || $this->
print) {
 
 1243                            $target_tpl->setCurrentBlock(
"exp_target_object");
 
 1245                            $target_tpl->setCurrentBlock(
"target_object");
 
 1246                            $target_tpl->setVariable(
"LINK_TARGET", $link);
 
 1248                        $target_tpl->setVariable(
 
 1254                        $target_tpl->setVariable(
"TXT_TARGET", 
$title);
 
 1256                        $target_tpl->parseCurrentBlock();
 
 1258                    $target_tpl->touchBlock(
"target_objects");
 
 1264                if (!$this->wsp_tree) {
 
 1265                    include_once 
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
 
 1266                    include_once 
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
 
 1270                $node_id = $this->wsp_tree->lookupNodeId(
$target[
"rep_obj_id"]);
 
 1271                if ($this->wsp_access_handler->checkAccess(
"visible", 
"", $node_id)) {
 
 1272                    $path = $this->wsp_tree->getPathFull($node_id);
 
 1274                        $item = array_pop(
$path);
 
 1275                        $parent = array_pop(
$path);
 
 1277                        if (!$parent[
"title"]) {
 
 1278                            $parent[
"title"] = $this->lng->txt(
"wsp_personal_workspace");
 
 1286                                $item[
"title"] .= 
" (" . $sub_title . 
")";
 
 1296                        $parent[
"title"] = $this->lng->txt(
"wsp_tab_shared") .
 
 1299                        $link = 
"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace&dsh=" .
 
 1304                    if ($this->export_html || $this->
print) {
 
 1305                        $target_tpl->setCurrentBlock(
"exp_target_object");
 
 1307                        $target_tpl->setCurrentBlock(
"target_object");
 
 1308                        $target_tpl->setVariable(
"LINK_TARGET", $link);
 
 1314                    $target_tpl->setVariable(
"TXT_CONTAINER", $parent[
"title"]);
 
 1316                    $target_tpl->setVariable(
"TXT_TARGET", $item[
"title"]);
 
 1318                    $target_tpl->parseCurrentBlock();
 
 1322        return $target_tpl->get();
 
 1335        $ilUser->setPref(
"notes_" . $suffix, 
"y");
 
 1337        $this->add_note_form = 
true;
 
 1369        if (
$_POST[
"note"] != 
"") {
 
 1371            $note->setObject($this->obj_type, $this->rep_obj_id, $this->obj_id, $this->news_id);
 
 1372            $note->setInRepository($this->repository_mode);
 
 1373            $note->setType(
$_GET[
"note_type"]);
 
 1374            $note->setAuthor(
$ilUser->getId());
 
 1375            $note->setText(ilUtil::stripslashes(
$_POST[
"note"]));
 
 1382            $ilCtrl->setParameter($this, 
"note_mess", 
"mod");
 
 1385        $ilCtrl->redirect($this, 
"showNotes", 
"notes_top", $this->ajax);
 
 1418            $ilCtrl->setParameter($this, 
"note_mess", 
"mod");
 
 1420        $ilCtrl->redirect($this, 
"showNotes", 
"notes_top", $this->ajax);
 
 1422        $ilCtrl->redirect($this, 
"showNotes", 
"notes_top", $this->ajax);
 
 1423        $this->note_mess = 
"frmfld";
 
 1424        $this->form->setValuesByPost();
 
 1425        $_GET[
"note_id"] = $note->getId();
 
 1426        $_GET[
"note_type"] = $note->getType();
 
 1435        $this->edit_note_form = 
true;
 
 1445        $this->delete_note = 
true;
 
 1446        $this->note_mess = 
"qdel";
 
 1458            $this->note_mess = 
"noc";
 
 1460            $this->delete_note = 
true;
 
 1461            $this->note_mess = 
"qdel";
 
 1493            $ilCtrl->setParameter($this, 
"note_mess", 
"ntsdel");
 
 1495            $ilCtrl->setParameter($this, 
"note_mess", 
"ntdel");
 
 1497        $ilCtrl->redirect($this, 
"showNotes", 
"notes_top", $this->ajax);
 
 1507        $this->export_html = 
true;
 
 1508        $this->multi_selection = 
false;
 
 1520        $this->
print = 
true;
 
 1521        $this->multi_selection = 
false;
 
 1537        $ilUser->writePref(
"notes_" . $suffix, 
"y");
 
 1552        $ilUser->writePref(
"notes_" . $suffix, 
"n");
 
 1564        $ilUser->writePref(
"notes_pub_all", 
"y");
 
 1576        $ilUser->writePref(
"notes_pub_all", 
"n");
 
 1588        if ($a_main_tpl != 
null) {
 
 1595        $lng->loadLanguageModule(
"notes");
 
 1597        include_once(
"./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
 
 1600        $lng->toJs(array(
"private_notes", 
"notes_public_comments"), 
$tpl);
 
 1602        include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
 
 1604        include_once(
"./Services/jQuery/classes/class.iljQueryUtil.php");
 
 1606        $tpl->addJavascript(
"./Services/Notes/js/ilNotes.js");
 
 1608        $tpl->addOnLoadCode(
"ilNotes.setAjaxUrl('" . $a_ajax_url . 
"');");
 
 1620        if ($a_update_code === 
null) {
 
 1621            $a_update_code = 
"null";
 
 1623            $a_update_code = 
"'" . $a_update_code . 
"'";
 
 1626        return "ilNotes.listNotes(event, '" . $a_hash . 
"', " . $a_update_code . 
");";
 
 1638        if ($a_update_code === 
null) {
 
 1639            $a_update_code = 
"null";
 
 1641            $a_update_code = 
"'" . $a_update_code . 
"'";
 
 1644        return "ilNotes.listComments(event, '" . $a_hash . 
"', " . $a_update_code . 
");";
 
 1656    protected static function buildAjaxHash($a_node_type, $a_node_id, $a_sub_id, $a_sub_type)
 
 1658        return $a_node_type . 
";" . $a_node_id . 
";" . $a_sub_id . 
";" . $a_sub_type;
 
 1664    public function renderLink($a_tpl, $a_var, $a_txt, $a_cmd, $a_anchor = 
"")
 
 1668        $low_var = strtolower($a_var);
 
 1669        $up_var = strtoupper($a_var);
 
 1672            $a_tpl->setVariable(
"LINK_" . $up_var, 
"#");
 
 1673            $oc = 
"onclick = \"ilNotes.cmdAjaxLink(event, '" .
 
 1674                $ilCtrl->getLinkTargetByClass(
"ilnotegui", $a_cmd, 
"", 
true) .
 
 1676            $a_tpl->setVariable(
"ON_CLICK_" . $up_var, $oc);
 
 1678            $a_tpl->setVariable(
 
 1680                $ilCtrl->getLinkTargetByClass(
"ilnotegui", $a_cmd, $a_anchor)
 
 1684        $a_tpl->setCurrentBlock($low_var);
 
 1685        $a_tpl->setVariable(
"TXT_" . $up_var, $a_txt);
 
 1686        $a_tpl->parseCurrentBlock();
 
 1696        $this->observer[] = $a_callback;
 
 1707        if (is_array($this->observer) && count($this->observer) > 0) {
 
 1708            foreach ($this->observer as $item) {
 
 1709                $param = $a_note->getObject();
 
 1710                $param[
"action"] = $a_action;
 
 1711                $param[
"note_id"] = $a_note->getId();
 
 1713                call_user_func_array($item, $param);
 
 1721        return $this->getNotesHtml();
 
 1727        return $this->getNotesHtml();
 
 1750        $f = $this->ui->factory();
 
 1751        $r = $this->ui->renderer();
 
 1755        $ctrl->setParameter($this, 
"news_id", $this->news_id);
 
 1769        $tpl = 
new ilTemplate(
"tpl.note_widget_header.html", 
true, 
true, 
"Services/Notes");
 
 1770        $widget_el_id = 
"notew_" . str_replace(
";", 
"_", $hash);
 
 1771        $ctrl->setParameter($this, 
"hash", $hash);
 
 1772        $update_url = 
$ctrl->getLinkTarget($this, 
"updateWidget", 
"", 
true, 
false);
 
 1775            $c = 
$f->counter()->status((
int) $cnt);
 
 1776            $comps[] = 
$f->glyph()->comment()->withCounter(
$c)->withAdditionalOnLoadCode(
function (
$id) use ($hash, $update_url, $widget_el_id) {
 
 1777                return "$(\"#$id\").click(function(event) { " . 
self::getListCommentsJSCall($hash, 
"ilNotes.updateWidget(\"" . $widget_el_id . 
"\",\"" . $update_url . 
"\");") . 
"});";
 
 1779            $comps[] = 
$f->divider()->vertical();
 
 1780            $tpl->setVariable(
"GLYPH", 
$r->render($comps));
 
 1781            $tpl->setVariable(
"TXT_LATEST", 
$lng->txt(
"notes_latest_comment"));
 
 1786            return "$(\"#$id\").click(function(event) { " . 
self::getListCommentsJSCall($hash, 
"ilNotes.updateWidget(\"" . $widget_el_id . 
"\",\"" . $update_url . 
"\");") . 
"});";
 
 1788        if (
$ctrl->isAsynch()) {
 
 1789            $tpl->setVariable(
"SHY_BUTTON", 
$r->renderAsync($b));
 
 1791            $tpl->setVariable(
"SHY_BUTTON", 
$r->render($b));
 
 1794        $this->widget_header = 
$tpl->get();
 
 1796        $this->hide_new_form = 
true;
 
 1797        $this->only_latest = 
true;
 
 1798        $this->no_actions = 
true;
 
 1800        $ctrl->setParameter($this, 
"news_id", 
$_GET[
"news_id"]);
 
An exception for terminatinating execution or to throw for unit testing.
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 _lookupTargetId($a_obj_id)
lookup target id
static _lookupTitle($a_obj_id)
Overwitten from base class.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
static useRelativeDates()
check if relative dates are used
static get($a_glyph, $a_text="")
Get glyph html.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
static initJS(ilTemplate $a_main_tpl=null)
Init javascript.
enableHiding($a_enable=true)
enable hiding
static buildAjaxHash($a_node_type, $a_node_id, $a_sub_id, $a_sub_type)
Combine properties to hash.
activateComments()
Activate Comments.
getSubObjectTitle($parent_obj_id, $sub_obj_id)
Get sub object title if available with callback.
confirmDelete()
cancel deletion of note
getOnlyNotesHTML()
Get only notes html.
__construct( $a_rep_obj_id="", $a_obj_id="", $a_obj_type="", $a_include_subobjects=false, $a_news_id=0)
constructor, specifies notes set
addNoteForm($a_init_form=true)
get notes list including add note area
enablePublicNotes($a_enable=true)
enable public notes
getPDNoteHTML($note_id)
Note display for personal desktop.
setDefaultCommand($a_val)
Set default command.
getCommentsWidget()
Get widget.
deactivateComments()
Deactivate Comments.
deleteNotes()
delete notes confirmation
getNoteListHTML($a_type=IL_NOTE_PRIVATE, $a_init_form=true)
get notes/comments list as html code
static getListCommentsJSCall($a_hash, $a_update_code=null)
Get list comments js call.
initNoteForm($a_mode="edit", $a_type, $a_note=null)
Init note form.
getOnlyCommentsHTML()
Get only comments html.
cancelDelete()
cancel deletion of note
editNoteForm($a_init_form=true)
get notes list including add note area
exportNotesHTML()
export selected notes to html
cancelAddNote()
cancel add note
getDefaultCommand()
Get default command.
enableAnchorJump($a_enable=true)
enable anchor for form jump
static initJavascript($a_ajax_url, $a_type=IL_NOTE_PRIVATE, ilTemplate $a_main_tpl=null)
Init javascript.
checkEdit($a_note)
Check edit.
notifyObserver($a_action, $a_note)
Notify observers on update/create.
enablePublicNotesDeletion($a_enable=true)
enable public notes
checkDeletion($a_note)
Check whether deletion is allowed.
static getListNotesJSCall($a_hash, $a_update_code=null)
Get list notes js call.
cancelUpdateNote()
cancel edit note
printNotes()
notes print view screen
setRepositoryMode($a_value)
Set repository mode.
enablePrivateNotes($a_enable=true)
enable private notes
addObserver($a_callback)
Add observer.
getNotesHTML($a_init_form=true)
deleteNote()
delete note confirmation
enableCommentsSettings($a_enable=true)
enable private notes
updateWidget()
Update widget.
executeCommand()
execute command
renderTargets($a_note)
show related objects as links
enableMultiSelection($a_enable=true)
enable multi selection (checkboxes and commands)
enableTargets($a_enable=true)
enable target objects
showAllPublicNotes()
show all public notes to user
showMyPublicNotes()
show only public notes of user
renderLink($a_tpl, $a_var, $a_txt, $a_cmd, $a_anchor="")
Render a link.
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_news_id=0)
Are comments activated for object?
static activateComments($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
Activate notes feature.
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 _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
static _lookupLogin($a_user_id)
lookup login
static _lookupOwnerName($a_owner_id)
lookup owner name for owner id
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _lookupOwner($a_id)
lookup object owner
static _lookupType($a_id, $a_reference=false)
lookup object type
static _lookupTitle($a_obj_id)
Lookup Title.
special template class to simplify handling of ITX/PEAR
This class represents a text area property in a property form.
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 appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
Access handler for personal workspace.
static getGotoLink($a_node_id, $a_obj_id, $a_additional=null)
Tree handler for personal workspace.
static initPanel($a_resize=false, ilTemplate $a_main_tpl=null)
Init yui panel.
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
if(!array_key_exists('StateId', $_REQUEST)) $id
foreach( $metaentries[ 'hosted'] as $index=> $entity) foreach($metaentries['remote'] as $key=> $set) $mtype
withAdditionalOnLoadCode(\Closure $binder)