/** * @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, ''); }
/** * @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>"; } }
/** * Get all item information (title, commands, description) in HTML * * @access public * @param int $a_ref_id item reference id * @param int $a_obj_id item object id * @param int $a_title item title * @param int $a_description item description * @param bool $a_use_asynch * @param bool $a_get_asynch_commands * @param string $a_asynch_url * @param bool $a_context workspace/tree context * @return string html code */ function getListItemHTML($a_ref_id, $a_obj_id, $a_title, $a_description, $a_use_asynch = false, $a_get_asynch_commands = false, $a_asynch_url = "", $a_context = self::CONTEXT_REPOSITORY) { global $ilAccess, $ilBench, $ilUser, $ilCtrl; // this variable stores wheter any admin commands // are included in the output $this->adm_commands_included = false; // only for permformance exploration $type = ilObject::_lookupType($a_obj_id); // initialization $ilBench->start("ilObjectListGUI", "1000_getListHTML_init{$type}"); $this->initItem($a_ref_id, $a_obj_id, $a_title, $a_description, $a_context); $ilBench->stop("ilObjectListGUI", "1000_getListHTML_init{$type}"); // prepare ajax calls include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php"; if ($a_context == self::CONTEXT_REPOSITORY) { $node_type = ilCommonActionDispatcherGUI::TYPE_REPOSITORY; } else { $node_type = ilCommonActionDispatcherGUI::TYPE_WORKSPACE; } $this->setAjaxHash(ilCommonActionDispatcherGUI::buildAjaxHash($node_type, $a_ref_id, $type, $a_obj_id)); if ($a_use_asynch && $a_get_asynch_commands) { return $this->insertCommands(true, true); } if ($this->rating_enabled) { if (ilRating::hasRatingInListGUI($this->obj_id, $this->type)) { $may_rate = $this->checkCommandAccess("read", "", $this->ref_id, $this->type); $rating = new ilRatingGUI(); $rating->setObject($this->obj_id, $this->type); /* $this->addCustomProperty( $this->lng->txt("rating_average_rating"), $rating->getListGUIProperty($this->ref_id, $may_rate, $this->ajax_hash, $this->parent_ref_id), false, true );*/ $this->addCustomProperty("", $rating->getListGUIProperty($this->ref_id, $may_rate, $this->ajax_hash, $this->parent_ref_id), false, true); } } // read from cache include_once "Services/Object/classes/class.ilListItemAccessCache.php"; $this->acache = new ilListItemAccessCache(); $cres = $this->acache->getEntry($ilUser->getId() . ":" . $a_ref_id); if ($this->acache->getLastAccessStatus() == "hit") { $this->access_cache = unserialize($cres); } else { // write to cache $this->storeAccessCache(); } // visible check if (!$this->checkCommandAccess("visible", "", $a_ref_id, "", $a_obj_id)) { $ilBench->stop("ilObjectListGUI", "2000_getListHTML_check_visible"); $this->resetCustomData(); return ""; } // BEGIN WEBDAV if ($type == 'file' and ilObjFileAccess::_isFileHidden($a_title)) { $this->resetCustomData(); return ""; } // END WEBDAV $this->tpl = new ilTemplate("tpl.container_list_item.html", true, true, "Services/Container", "DEFAULT", false, true); if ($this->getCommandsStatus() || $this->payment_enabled && IS_PAYMENT_ENABLED) { if (!$this->getSeparateCommands()) { $this->tpl->setVariable("COMMAND_SELECTION_LIST", $this->insertCommands($a_use_asynch, $a_get_asynch_commands, $a_asynch_url)); } } if ($this->getProgressInfoStatus()) { $this->insertProgressInfo(); } // insert title and describtion $this->insertTitle(); if (!$this->isMode(IL_LIST_AS_TRIGGER)) { if ($this->getDescriptionStatus()) { $this->insertDescription(); } } if ($this->getSearchFragmentStatus()) { $this->insertSearchFragment(); } if ($this->enabledRelevance()) { $this->insertRelevance(); } // properties $ilBench->start("ilObjectListGUI", "6000_insert_properties{$type}"); if ($this->getPropertiesStatus()) { $this->insertProperties(); } $ilBench->stop("ilObjectListGUI", "6000_insert_properties{$type}"); // notice properties $ilBench->start("ilObjectListGUI", "6500_insert_notice_properties{$type}"); if ($this->getNoticePropertiesStatus()) { $this->insertNoticeProperties(); } $ilBench->stop("ilObjectListGUI", "6500_insert_notice_properties{$type}"); // preconditions $ilBench->start("ilObjectListGUI", "7000_insert_preconditions"); if ($this->getPreconditionsStatus()) { $this->insertPreconditions(); } $ilBench->stop("ilObjectListGUI", "7000_insert_preconditions"); // path $ilBench->start("ilObjectListGUI", "8000_insert_path"); $this->insertPath(); $ilBench->stop("ilObjectListGUI", "8000_insert_path"); $ilBench->start("ilObjectListGUI", "8500_item_detail_links"); if ($this->getItemDetailLinkStatus()) { $this->insertItemDetailLinks(); } $ilBench->stop("ilObjectListGUI", "8500_item_detail_links"); // icons and checkboxes $this->insertIconsAndCheckboxes(); // input field for position $this->insertPositionField(); // subitems $this->insertSubItems(); // file upload if ($this->isFileUploadAllowed()) { $this->insertFileUpload(); } $this->resetCustomData(); $this->tpl->setVariable("DIV_CLASS", 'ilContainerListItemOuter'); $this->tpl->setVariable("DIV_ID", 'id = "' . $this->getUniqueItemId(true) . '"'); $this->tpl->setVariable("ADDITIONAL", $this->getAdditionalInformation()); // #11554 - make sure that internal ids are reset $this->ctrl->setParameter($this->getContainerObject(), "item_ref_id", ""); return $this->tpl->get(); }
/** * 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; }