/**
  * Constructor
  *
  * @access	public
  */
 function ilPDNotesGUI()
 {
     global $ilias, $tpl, $lng, $ilCtrl, $ilUser, $ilTabs, $ilHelp;
     $ilHelp->setScreenIdComponent("note");
     // initiate variables
     $this->ilias =& $ilias;
     $this->tpl =& $tpl;
     $this->lng =& $lng;
     $this->ctrl =& $ilCtrl;
     // link from ilPDNotesBlockGUI
     if ($_GET["rel_obj"]) {
         $mode = $_GET["note_type"] == IL_NOTE_PRIVATE ? self::PRIVATE_NOTES : self::PUBLIC_COMMENTS;
         $ilUser->writePref("pd_notes_mode", $mode);
         $ilUser->writePref("pd_notes_rel_obj" . $mode, $_GET["rel_obj"]);
     } else {
         if ($_REQUEST["note_id"]) {
             $note = new ilNote($_REQUEST["note_id"]);
             $mode = $note->getType() == IL_NOTE_PRIVATE ? self::PRIVATE_NOTES : self::PUBLIC_COMMENTS;
             $obj = $note->getObject();
             $ilUser->writePref("pd_notes_mode", $mode);
             $ilUser->writePref("pd_notes_rel_obj" . $mode, $obj["rep_obj_id"]);
         }
     }
 }
示例#2
0
 /**
  * Note display for personal desktop
  */
 function getPDNoteHTML($note_id)
 {
     global $lng, $ilCtrl, $ilUser;
     $tpl = new ilTemplate("tpl.pd_note.html", true, true, "Services/Notes");
     $note = new ilNote($note_id);
     $target = $note->getObject();
     if ($note->getAuthor() != $ilUser->getId()) {
         return;
     }
     $tpl->setCurrentBlock("edit_note");
     $ilCtrl->setParameterByClass("ilnotegui", "rel_obj", $target["rep_obj_id"]);
     $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note_id);
     $ilCtrl->setParameterByClass("ilnotegui", "note_type", $note->getType());
     $tpl->setVariable("LINK_EDIT_NOTE", $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilpdnotesgui", "ilnotegui"), "editNoteForm"));
     $tpl->setVariable("TXT_EDIT_NOTE", $lng->txt("edit"));
     $tpl->parseCurrentBlock();
     $ilCtrl->clearParametersByClass("ilnotegui");
     $tpl->setCurrentBlock("note_img");
     $tpl->setVariable("IMG_NOTE", $this->note_img[$note->getLabel()]["img"]);
     $tpl->setVariable("ALT_NOTE", $this->note_img[$note->getLabel()]["alt"]);
     $tpl->parseCurrentBlock();
     // last edited
     if ($note->getUpdateDate() != null) {
         $tpl->setVariable("TXT_LAST_EDIT", $lng->txt("last_edited_on"));
         $tpl->setVariable("DATE_LAST_EDIT", ilDatePresentation::formatDate(new ilDate($note->getUpdateDate(), IL_CAL_DATETIME)));
     } else {
         //$tpl->setVariable("TXT_CREATED", $lng->txt("create_date"));
         $tpl->setVariable("VAL_DATE", ilDatePresentation::formatDate(new ilDate($note->getCreationDate(), IL_CAL_DATETIME)));
     }
     $tpl->setVariable("VAL_SUBJECT", $note->getSubject());
     $text = trim($note->getText()) != "" ? nl2br($note->getText()) : "<p class='subtitle'>" . $lng->txt("note_content_removed") . "</p>";
     $tpl->setVariable("NOTE_TEXT", $text);
     $this->showTargets($tpl, $target["rep_obj_id"], $note_id, $target["obj_type"], $target["obj_id"]);
     return $tpl->get();
 }