/**
  * @description Get the ajax link for displaying the comments in the right panel (to be wrapped in an onclick attr)
  *
  * @param int $recordId Record-ID
  *
  * @return string
  */
 protected function getCommentsAjaxLink($recordId)
 {
     $ajax_hash = ilCommonActionDispatcherGUI::buildAjaxHash(1, $_GET['ref_id'], 'dcl', $this->parent_obj->obj_id, 'dcl', $recordId);
     return ilNoteGUI::getListCommentsJSCall($ajax_hash, '');
 }
 /**
  * Get header action
  * 
  * @return string
  */
 function getHeaderAction()
 {
     global $ilUser, $lng, $tpl;
     $htpl = new ilTemplate("tpl.header_action.html", true, true, "Services/Repository");
     $redraw_js = "il.Object.redrawActionHeader();";
     // tags
     if ($this->tags_enabled) {
         include_once "./Services/Tagging/classes/class.ilTagging.php";
         $tags = ilTagging::getTagsForUserAndObject($this->obj_id, ilObject::_lookupType($this->obj_id), 0, "", $ilUser->getId());
         if (count($tags) > 0) {
             include_once "./Services/Tagging/classes/class.ilTaggingGUI.php";
             $lng->loadLanguageModule("tagging");
             $this->addHeaderIcon("tags", ilUtil::getImagePath("icon_tag.svg"), $lng->txt("tagging_tags") . ": " . count($tags), ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js), count($tags));
         }
     }
     // notes and comments
     $comments_enabled = $this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, true, false);
     if ($this->notes_enabled || $comments_enabled) {
         include_once "./Services/Notes/classes/class.ilNote.php";
         include_once "./Services/Notes/classes/class.ilNoteGUI.php";
         $cnt = ilNote::_countNotesAndComments($this->obj_id, $this->sub_obj_id);
         if ($this->notes_enabled && $cnt[$this->obj_id][IL_NOTE_PRIVATE] > 0) {
             $this->addHeaderIcon("notes", ilUtil::getImagePath("note_unlabeled.svg"), $lng->txt("private_notes") . ": " . $cnt[$this->obj_id][IL_NOTE_PRIVATE], ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js), $cnt[$this->obj_id][IL_NOTE_PRIVATE]);
         }
         if ($comments_enabled && $cnt[$this->obj_id][IL_NOTE_PUBLIC] > 0) {
             $lng->loadLanguageModule("notes");
             $this->addHeaderIcon("comments", ilUtil::getImagePath("comment_unlabeled.svg"), $lng->txt("notes_public_comments") . ": " . $cnt[$this->obj_id][IL_NOTE_PUBLIC], ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js), $cnt[$this->obj_id][IL_NOTE_PUBLIC]);
         }
     }
     // rating
     if ($this->rating_enabled) {
         include_once "./Services/Rating/classes/class.ilRatingGUI.php";
         $rating_gui = new ilRatingGUI();
         $rating_gui->enableCategories($this->rating_categories_enabled);
         // never rate sub objects from header action!
         $rating_gui->setObject($this->obj_id, $this->type);
         if ($this->rating_text) {
             $rating_gui->setYourRatingText($this->rating_text);
         }
         $this->ctrl->setParameterByClass("ilRatingGUI", "cadh", $this->ajax_hash);
         $this->ctrl->setParameterByClass("ilRatingGUI", "rnsb", true);
         if ($this->rating_ctrl_path) {
             $rating_gui->setCtrlPath($this->rating_ctrl_path);
             $ajax_url = $this->ctrl->getLinkTargetByClass($this->rating_ctrl_path, "saveRating", "", true, false);
         } else {
             // ???
             $ajax_url = $this->ctrl->getLinkTargetByClass("ilRatingGUI", "saveRating", "", true, false);
         }
         $tpl->addOnLoadCode("il.Object.setRatingUrl('" . $ajax_url . "');");
         $this->addHeaderIconHTML("rating", $rating_gui->getHtml(true, $this->checkCommandAccess("read", "", $this->ref_id, $this->type), "il.Object.saveRating(%rating%);"));
     }
     if ($this->header_icons) {
         include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php";
         $chunks = array();
         foreach ($this->header_icons as $id => $attr) {
             $id = "headp_" . $id;
             if (is_array($attr)) {
                 if ($attr["onclick"]) {
                     $htpl->setCurrentBlock("onclick");
                     $htpl->setVariable("PROP_ONCLICK", $attr["onclick"]);
                     $htpl->parseCurrentBlock();
                 }
                 if ($attr["status_text"]) {
                     $htpl->setCurrentBlock("status");
                     $htpl->setVariable("PROP_TXT", $attr["status_text"]);
                     $htpl->parseCurrentBlock();
                 }
                 if (!$attr["href"]) {
                     $attr["href"] = "#";
                 }
                 $htpl->setCurrentBlock("prop");
                 $htpl->setVariable("PROP_ID", $id);
                 $htpl->setVariable("IMG", ilUtil::img($attr["img"]));
                 $htpl->setVariable("PROP_HREF", $attr["href"]);
                 $htpl->parseCurrentBlock();
                 if ($attr["tooltip"]) {
                     ilTooltipGUI::addTooltip($id, $attr["tooltip"]);
                 }
             } else {
                 $chunks[] = $attr;
             }
         }
         if (sizeof($chunks)) {
             $htpl->setVariable("PROP_CHUNKS", implode("   ", $chunks) . "   ");
         }
     }
     $htpl->setVariable("ACTION_DROP_DOWN", $this->insertCommands(false, false, "", true));
     return $htpl->get();
 }
 /**
  * Get header action
  * 
  * @return string
  */
 function getHeaderAction()
 {
     global $ilAccess, $ilBench, $ilUser, $ilCtrl, $lng;
     $htpl = new ilTemplate("tpl.header_action.html", true, true, "Services/Repository");
     $redraw_js = "il.Object.redrawActionHeader();";
     // tags
     if ($this->tags_enabled) {
         include_once "./Services/Tagging/classes/class.ilTagging.php";
         $tags = ilTagging::getTagsForUserAndObject($this->obj_id, ilObject::_lookupType($this->obj_id), 0, "", $ilUser->getId());
         if (count($tags) > 0) {
             include_once "./Services/Tagging/classes/class.ilTaggingGUI.php";
             $lng->loadLanguageModule("tagging");
             $this->addHeaderIcon("tags", ilUtil::getImagePath("icon_tags_s.png"), $lng->txt("tagging_tags") . ": " . count($tags), ilTaggingGUI::getListTagsJSCall($this->ajax_hash, $redraw_js), count($tags));
         }
     }
     // notes and comments
     $comments_enabled = $this->isCommentsActivated($this->type, $this->ref_id, $this->obj_id, true, false);
     if ($this->notes_enabled || $comments_enabled) {
         include_once "./Services/Notes/classes/class.ilNote.php";
         include_once "./Services/Notes/classes/class.ilNoteGUI.php";
         $cnt = ilNote::_countNotesAndComments($this->obj_id, $this->sub_obj_id);
         if ($this->notes_enabled && $cnt[$this->obj_id][IL_NOTE_PRIVATE] > 0) {
             $this->addHeaderIcon("notes", ilUtil::getImagePath("note_unlabeled.png"), $lng->txt("private_notes") . ": " . $cnt[$this->obj_id][IL_NOTE_PRIVATE], ilNoteGUI::getListNotesJSCall($this->ajax_hash, $redraw_js), $cnt[$this->obj_id][IL_NOTE_PRIVATE]);
         }
         if ($comments_enabled && $cnt[$this->obj_id][IL_NOTE_PUBLIC] > 0) {
             $lng->loadLanguageModule("notes");
             $this->addHeaderIcon("comments", ilUtil::getImagePath("comment_unlabeled.png"), $lng->txt("notes_public_comments") . ": " . $cnt[$this->obj_id][IL_NOTE_PUBLIC], ilNoteGUI::getListCommentsJSCall($this->ajax_hash, $redraw_js), $cnt[$this->obj_id][IL_NOTE_PUBLIC]);
         }
     }
     if ($this->header_icons) {
         include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php";
         $chunks = array();
         foreach ($this->header_icons as $id => $attr) {
             $id = "headp_" . $id;
             if (is_array($attr)) {
                 if ($attr["onclick"]) {
                     $htpl->setCurrentBlock("onclick");
                     $htpl->setVariable("PROP_ONCLICK", $attr["onclick"]);
                     $htpl->parseCurrentBlock();
                 }
                 if ($attr["status_text"]) {
                     $htpl->setCurrentBlock("status");
                     $htpl->setVariable("PROP_TXT", $attr["status_text"]);
                     $htpl->parseCurrentBlock();
                 }
                 if (!$attr["href"]) {
                     $attr["href"] = "#";
                 }
                 $htpl->setCurrentBlock("prop");
                 $htpl->setVariable("PROP_ID", $id);
                 $htpl->setVariable("IMG", ilUtil::img($attr["img"]));
                 $htpl->setVariable("PROP_HREF", $attr["href"]);
                 $htpl->parseCurrentBlock();
                 if ($attr["tooltip"]) {
                     ilTooltipGUI::addTooltip($id, $attr["tooltip"]);
                 }
             } else {
                 $chunks[] = $attr;
             }
         }
         if (sizeof($chunks)) {
             $htpl->setVariable("PROP_CHUNKS", implode("   ", $chunks) . "   ");
         }
     }
     $htpl->setVariable("ACTION_DROP_DOWN", $this->insertCommands(false, false, "", true));
     return $htpl->get();
 }
 /**
  * @param string $field_id
  * @param array  $options
  *
  * @return array|string
  */
 private function getStandardFieldHTML($field_id, array $options = array())
 {
     switch ($field_id) {
         case 'id':
             return $this->getId();
         case 'owner':
             return ilUserUtil::getNamePresentation($this->getOwner());
         case 'last_edit_by':
             return ilUserUtil::getNamePresentation($this->getLastEditBy());
         case 'last_update':
             return ilDatePresentation::formatDate(new ilDateTime($this->getLastUpdate(), IL_CAL_DATETIME));
         case 'create_date':
             return ilDatePresentation::formatDate(new ilDateTime($this->getCreateDate(), IL_CAL_DATETIME));
         case 'comments':
             $nComments = count($this->getComments());
             $ajax_hash = ilCommonActionDispatcherGUI::buildAjaxHash(1, $_GET['ref_id'], 'dcl', $this->table->getCollectionObject()->getId(), 'dcl', $this->getId());
             $ajax_link = ilNoteGUI::getListCommentsJSCall($ajax_hash, '');
             return "<a class='dcl_comment' href='#' onclick=\"return " . $ajax_link . "\">\n                        <img src='" . ilUtil::getImagePath("comment_unlabeled.svg") . "' alt='{$nComments} Comments'><span class='ilHActProp'>{$nComments}</span></a>";
     }
 }
示例#5
0
 /**
  * Builds JavaScript Call to open CommentLayer via html link
  *
  * @return string jsCall
  */
 private function commentJSCall()
 {
     include_once "./Services/Notes/classes/class.ilNoteGUI.php";
     include_once "./Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
     $refId = $this->getRefId();
     $objectId = ilObject2::_lookupObjectId($refId);
     $ajaxHash = ilCommonActionDispatcherGUI::buildAjaxHash(ilCommonActionDispatcherGUI::TYPE_REPOSITORY, $refId, "poll", $objectId);
     $comment = new ilNoteGUI();
     $jsCall = $comment->getListCommentsJSCall($ajaxHash, "ilPoll.redrawComments(" . $refId . ");");
     return $jsCall;
 }