function view()
 {
     global $ilUser, $lng;
     //$this->tpl->addBlockFile("ADM_CONTENT", "objects", "tpl.table.html")
     include_once "Services/Notes/classes/class.ilNoteGUI.php";
     // output related item selection (if more than one)
     include_once "Services/Notes/classes/class.ilNote.php";
     $rel_objs = ilNote::_getRelatedObjectsOfUser($this->getMode());
     //var_dump($rel_objs);
     // prepend personal dektop, if first object
     //		if ($rel_objs[0]["rep_obj_id"] > 0 && $this->getMode() == ilPDNotesGUI::PRIVATE_NOTES)
     if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
         $rel_objs = array_merge(array(0), $rel_objs);
     }
     // #9410
     if (!$rel_objs && $this->getMode() == ilPDNotesGUI::PUBLIC_COMMENTS) {
         $lng->loadLanguageModule("notes");
         ilUtil::sendInfo($lng->txt("msg_no_search_result"));
         return;
     }
     $first = true;
     foreach ($rel_objs as $r) {
         if ($first) {
             $this->current_rel_obj = $r["rep_obj_id"];
         }
         if ($r["rep_obj_id"] == $ilUser->getPref("pd_notes_rel_obj" . $this->getMode())) {
             $this->current_rel_obj = $r["rep_obj_id"];
         }
         $first = false;
     }
     if ($this->current_rel_obj > 0) {
         $notes_gui = new ilNoteGUI($this->current_rel_obj, 0, ilObject::_lookupType($this->current_rel_obj), true);
     } else {
         $notes_gui = new ilNoteGUI(0, $ilUser->getId(), "pd");
     }
     if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
         $notes_gui->enablePrivateNotes(true);
         $notes_gui->enablePublicNotes(false);
     } else {
         $notes_gui->enablePrivateNotes(false);
         $notes_gui->enablePublicNotes(true);
     }
     $notes_gui->enableHiding(false);
     $notes_gui->enableTargets(true);
     $notes_gui->enableMultiSelection(true);
     $notes_gui->enableAnchorJump(false);
     $next_class = $this->ctrl->getNextClass($this);
     if ($next_class == "ilnotegui") {
         $html = $this->ctrl->forwardCommand($notes_gui);
     } else {
         $html = $notes_gui->getNotesHTML();
     }
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.pd_notes.html", "Services/Notes");
     if (count($rel_objs) > 1 || $rel_objs[0]["rep_obj_id"] > 0) {
         foreach ($rel_objs as $obj) {
             $this->tpl->setCurrentBlock("related_option");
             $this->tpl->setVariable("VAL_RELATED", $obj["rep_obj_id"]);
             //echo "-".$obj["rep_obj_id"]."-".$obj["obj_type"]."-";
             if ($obj["rep_obj_id"] > 0) {
                 $type = ilObject::_lookupType($obj["rep_obj_id"]);
                 $type_str = in_array($type, array("lm", "htlm", "sahs", "dbk")) ? $lng->txt("learning_resource") : $lng->txt("obj_" . $type);
                 $this->tpl->setVariable("TXT_RELATED", $type_str . ": " . ilObject::_lookupTitle($obj["rep_obj_id"]));
             } else {
                 $this->tpl->setVariable("TXT_RELATED", $lng->txt("personal_desktop"));
             }
             if ($obj["rep_obj_id"] == $this->current_rel_obj) {
                 $this->tpl->setVariable("SEL", 'selected="selected"');
             }
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("related_selection");
         $this->tpl->setVariable("TXT_CHANGE", $lng->txt("change"));
         $this->tpl->setVariable("TXT_RELATED_TO", $lng->txt("related_to"));
         $this->tpl->setVariable("TXT_FILTER", $lng->txt("filter"));
         $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setCurrentBlock("adm_content");
     // output notes
     $this->tpl->setVariable("NOTES", $html);
     $this->tpl->parseCurrentBlock();
 }
 function view()
 {
     global $ilUser, $lng, $ilSetting, $ilAccess, $ilToolbar;
     //$this->tpl->addBlockFile("ADM_CONTENT", "objects", "tpl.table.html")
     include_once "Services/Notes/classes/class.ilNoteGUI.php";
     // output related item selection (if more than one)
     include_once "Services/Notes/classes/class.ilNote.php";
     $rel_objs = ilNote::_getRelatedObjectsOfUser($this->getMode());
     //var_dump($rel_objs);
     // prepend personal dektop, if first object
     //		if ($rel_objs[0]["rep_obj_id"] > 0 && $this->getMode() == ilPDNotesGUI::PRIVATE_NOTES)
     if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
         $rel_objs = array_merge(array(0), $rel_objs);
     }
     // #9410
     if (!$rel_objs && $this->getMode() == ilPDNotesGUI::PUBLIC_COMMENTS) {
         $lng->loadLanguageModule("notes");
         ilUtil::sendInfo($lng->txt("msg_no_search_result"));
         return;
     }
     $first = true;
     foreach ($rel_objs as $r) {
         if ($first) {
             $this->current_rel_obj = $r["rep_obj_id"];
             $current_ref_ids = $r["ref_ids"];
         }
         if ($r["rep_obj_id"] == $ilUser->getPref("pd_notes_rel_obj" . $this->getMode())) {
             $this->current_rel_obj = $r["rep_obj_id"];
             $current_ref_ids = $r["ref_ids"];
         }
         $first = false;
     }
     if ($this->current_rel_obj > 0) {
         $notes_gui = new ilNoteGUI($this->current_rel_obj, 0, ilObject::_lookupType($this->current_rel_obj), true);
     } else {
         $notes_gui = new ilNoteGUI(0, $ilUser->getId(), "pd");
     }
     if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
         $notes_gui->enablePrivateNotes(true);
         $notes_gui->enablePublicNotes(false);
     } else {
         $notes_gui->enablePrivateNotes(false);
         $notes_gui->enablePublicNotes(true);
         // #13707
         if ($this->current_rel_obj > 0 && sizeof($current_ref_ids) && $ilSetting->get("comments_del_tutor", 1)) {
             foreach ($current_ref_ids as $ref_id) {
                 if ($ilAccess->checkAccess("write", "", $ref_id)) {
                     $notes_gui->enablePublicNotesDeletion(true);
                     break;
                 }
             }
         }
     }
     $notes_gui->enableHiding(false);
     $notes_gui->enableTargets(true);
     $notes_gui->enableMultiSelection(true);
     $notes_gui->enableAnchorJump(false);
     $next_class = $this->ctrl->getNextClass($this);
     if ($next_class == "ilnotegui") {
         $html = $this->ctrl->forwardCommand($notes_gui);
     } else {
         if ($this->getMode() == ilPDNotesGUI::PRIVATE_NOTES) {
             $html = $notes_gui->getOnlyNotesHTML();
         } else {
             $html = $notes_gui->getOnlyCommentsHTML();
         }
     }
     if (count($rel_objs) > 1 || $rel_objs[0]["rep_obj_id"] > 0) {
         $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
         foreach ($rel_objs as $obj) {
             if ($obj["rep_obj_id"] > 0) {
                 $type = ilObject::_lookupType($obj["rep_obj_id"]);
                 $type_str = in_array($type, array("lm", "htlm", "sahs", "dbk")) ? $lng->txt("learning_resource") : $lng->txt("obj_" . $type);
                 $caption = $type_str . ": " . ilObject::_lookupTitle($obj["rep_obj_id"]);
             } else {
                 $caption = $lng->txt("personal_desktop");
             }
             $options[$obj["rep_obj_id"]] = $caption;
         }
         include_once "Services/Form/classes/class.ilSelectInputGUI.php";
         $rel = new ilSelectInputGUI($lng->txt("related_to"), "rel_obj");
         $rel->setOptions($options);
         $rel->setValue($this->current_rel_obj);
         $ilToolbar->addInputItem($rel);
         $ilToolbar->addFormButton($lng->txt("change"), "changeRelatedObject");
     }
     $this->tpl->setContent($html);
 }