예제 #1
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();
 }