本文整理汇总了PHP中ilUtil::shortenText方法的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil::shortenText方法的具体用法?PHP ilUtil::shortenText怎么用?PHP ilUtil::shortenText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilUtil
的用法示例。
在下文中一共展示了ilUtil::shortenText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listTemplates
/**
* List templates
*/
function listTemplates()
{
// list pages
include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
$pages = ilWikiPage::getAllPages($this->wiki->getId());
$options = array("" => $this->lng->txt("please_select"));
foreach ($pages as $p) {
//if (!in_array($p["id"], $ipages_ids))
//{
$options[$p["id"]] = ilUtil::shortenText($p["title"], 60, true);
//}
}
$this->toolbar->setFormAction($this->ctrl->getFormAction($this));
$this->toolbar->setOpenFormTag(true);
$this->toolbar->setCloseFormTag(false);
if (count($options) > 0) {
include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
$si = new ilSelectInputGUI($this->lng->txt("wiki_pages"), "templ_page_id");
$si->setOptions($options);
$this->toolbar->addInputItem($si);
$this->toolbar->addFormButton($this->lng->txt("wiki_add_template"), "add");
$this->toolbar->addSeparator();
}
// empty page as template?
include_once "./Services/Form/classes/class.ilCheckboxInputGUI.php";
$cb = new ilCheckboxInputGUI($this->lng->txt("wiki_empty_page_template"), "empty_page_templ");
$cb->setChecked($this->wiki->getEmptyPageTemplate());
$this->toolbar->addInputItem($cb, true);
$this->toolbar->addFormButton($this->lng->txt("save"), "saveTemplateSettings");
include_once "./Modules/Wiki/classes/class.ilWikiPageTemplatesTableGUI.php";
$tab = new ilWikiPageTemplatesTableGUI($this, "listTemplates", $this->wiki->getId());
$tab->setOpenFormTag(false);
$tab->setCloseFormTag(true);
$this->tpl->setContent($tab->getHTML());
}
示例2: fillRow
/**
* Fill table row
*/
protected function fillRow($d)
{
global $lng, $ilCtrl;
$this->tpl->setVariable("ID", $d["id"]);
if ($d["deadline"] > 0) {
$this->tpl->setVariable("TXT_DEADLINE", ilDatePresentation::formatDate(new ilDateTime($d["deadline"], IL_CAL_UNIX)));
}
if ($d["start_time"] > 0) {
$this->tpl->setVariable("TXT_START_TIME", ilDatePresentation::formatDate(new ilDateTime($d["start_time"], IL_CAL_UNIX)));
}
$this->tpl->setVariable("TXT_INSTRUCTIONS", ilUtil::shortenText($d["instruction"], 200, true));
if ($d["mandatory"]) {
$this->tpl->setVariable("TXT_MANDATORY", $lng->txt("yes"));
} else {
$this->tpl->setVariable("TXT_MANDATORY", $lng->txt("no"));
}
if ($d["peer"]) {
$this->tpl->setVariable("TXT_PEER", $lng->txt("yes") . " (" . $d["peer_min"] . ")");
} else {
$this->tpl->setVariable("TXT_PEER", $lng->txt("no"));
}
$this->tpl->setVariable("TXT_TITLE", $d["title"]);
$this->tpl->setVariable("TXT_TYPE", $d["type"]);
$this->tpl->setVariable("ORDER_VAL", $d["order_val"]);
$this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
$ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]);
$this->tpl->setVariable("CMD_EDIT", $ilCtrl->getLinkTarget($this->parent_obj, "editAssignment"));
}
示例3: fillRow
/**
* Standard Version of Fill Row. Most likely to
* be overwritten by derived class.
*/
protected function fillRow($a_set)
{
global $lng, $ilCtrl, $ilAccess;
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
// user
if ($a_set["user_id"] > 0) {
$this->tpl->setCurrentBlock("user_info");
$user_obj = new ilObjUser($a_set["user_id"]);
$this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin());
$this->tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
$this->tpl->parseCurrentBlock();
}
// access
if ($enable_internal_rss) {
$this->tpl->setCurrentBlock("access");
$this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
if ($a_set["visibility"] == NEWS_PUBLIC || $a_set["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $a_set["context_obj_id"])) {
$this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
} else {
$this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
}
$this->tpl->parseCurrentBlock();
}
// last update
if ($a_set["creation_date"] != $a_set["update_date"]) {
$this->tpl->setCurrentBlock("ni_update");
$this->tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
$this->tpl->setVariable("VAL_LAST_UPDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["update_date"], IL_CAL_DATETIME)));
$this->tpl->parseCurrentBlock();
}
// creation date
$this->tpl->setVariable("VAL_CREATION_DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["creation_date"], IL_CAL_DATETIME)));
$this->tpl->setVariable("TXT_CREATED", $lng->txt("created"));
// title
$this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
// content
if ($a_set["content"] != "") {
$this->tpl->setCurrentBlock("content");
$this->tpl->setVariable("VAL_CONTENT", ilUtil::shortenText($a_set["content"], 80, true, true), true);
$this->tpl->parseCurrentBlock();
}
$perm_ref_id = $this->perm_ref_id > 0 ? $this->perm_ref_id : $a_set["ref_id"];
if ($ilAccess->checkAccess("write", "", $perm_ref_id)) {
$this->tpl->setCurrentBlock("edit");
$this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
$ilCtrl->setParameterByClass("ilnewsitemgui", "news_item_id", $a_set["id"]);
$this->tpl->setVariable("CMD_EDIT", $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "editNewsItem"));
$this->tpl->parseCurrentBlock();
}
// context
$this->tpl->setVariable("CONTEXT", $lng->txt("obj_" . $a_set["context_obj_type"]) . ":<br />" . ilObject::_lookupTitle($a_set["context_obj_id"]));
$this->tpl->setVariable("VAL_ID", $a_set["id"]);
}
示例4: getDescription
/**
* overwritten from base class
*/
function getDescription()
{
global $ilSetting;
if (ilObjLinkResourceAccess::_checkDirectLink($this->obj_id)) {
$this->__readLink();
$desc = $this->link_data['description'];
// #10682
if ($ilSetting->get("rep_shorten_description")) {
$desc = ilUtil::shortenText($desc, $ilSetting->get("rep_shorten_description_length"), true);
}
return $desc;
}
return parent::getDescription();
}
示例5: formatHeader
/**
* overwritten method from base class
* @access public
* @param integer obj_id
* @param integer array options
* @return string
*/
function formatHeader(&$tpl, $a_obj_id, $a_option)
{
global $lng, $ilias, $ilCtrl;
$tpl->setCurrentBlock("icon");
$tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath("icon_sahs_s.png"));
$tpl->setVariable("TXT_ALT_IMG", $this->slm_obj->getTitle());
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("link");
$tpl->setVariable("TITLE", ilUtil::shortenText($this->slm_obj->getTitle() . "", $this->textwidth, true));
$tpl->setVariable("LINK_TARGET", $ilCtrl->getLinkTargetByClass("ilobjscorm2004learningmodulegui", "showOrganization"));
$tpl->setVariable("TARGET", " target=\"" . $this->frame_target . "\"");
$tpl->parseCurrentBlock();
$tpl->touchBlock("element");
}
示例6: formatHeader
/**
* overwritten method from base class
* @access public
* @param integer obj_id
* @param integer array options
* @return string
*/
function formatHeader(&$tpl, $a_obj_id, $a_option)
{
global $lng, $ilias;
$tpl->setCurrentBlock("icon");
$tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath("icon_lm_s.png", false, "output", $this->offlineMode()));
$tpl->setVariable("TXT_ALT_IMG", $lng->txt("obj_" . $this->lm_obj->getType()));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("link");
$tpl->setVariable("TITLE", ilUtil::shortenText($this->lm_obj->getTitle(), $this->textwidth, true));
$tpl->setVariable("LINK_TARGET", $this->buildLinkTarget("", ""));
$tpl->setVariable("TARGET", " target=\"" . $this->frame_target . "\"");
$tpl->parseCurrentBlock();
$tpl->touchBlock("element");
}
示例7: parseGlobalOptions
public function parseGlobalOptions(stdClass $a_options, ilChart $a_chart)
{
$spider = new stdClass();
$spider->active = true;
$spider->highlight = new stdClass();
$spider->highlight->mode = "line";
$spider->legs = new stdClass();
$spider->legs->fillStyle = ilChart::renderColor("#000", "0.7");
switch (count($a_chart->getLegLabels())) {
case 4:
case 6:
$spider->legs->legStartAngle = 10;
break;
default:
$spider->legs->legStartAngle = 0;
break;
}
$spider->legs->data = array();
$max_str_len = 0;
foreach ($a_chart->getLegLabels() as $l) {
$l = ilUtil::shortenText($l, 80, true);
$label = new stdClass();
$label->label = $l;
$spider->legs->data[] = $label;
$max_str_len = max($max_str_len, strlen($l));
}
// depending on caption length
if ($max_str_len > 60) {
$font_size = 10;
} else {
if ($max_str_len > 30) {
$font_size = 12;
} else {
$font_size = 15;
}
}
$spider->legs->font = $font_size . "px Arial";
$spider->spiderSize = 0.7;
$spider->lineWidth = 1;
$spider->pointSize = 0;
$spider->connection = new StdClass();
$spider->connection->width = 2;
$spider->legMin = 1.0E-7;
$spider->legMax = $a_chart->getYAxisMax();
$a_options->series->spider = $spider;
}
示例8: formatHeader
/**
* overwritten method from base class
* @access public
* @param integer obj_id
* @param integer array options
* @return string
*/
function formatHeader(&$tpl, $a_obj_id, $a_option)
{
global $lng, $ilias;
//$tpl = new ilTemplate("tpl.tree.html", true, true, "Services/UIComponent/Explorer");
$tpl->setCurrentBlock("icon");
$tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath("icon_mep_s.png"));
$tpl->setVariable("TXT_ALT_IMG", ilUtil::shortenText($this->media_pool->getTitle(), $this->textwidth, true));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("link");
$tpl->setVariable("TITLE", ilUtil::shortenText($this->media_pool->getTitle(), $this->textwidth, true));
$tpl->setVariable("LINK_TARGET", $this->target);
$tpl->setVariable("TARGET", " target=\"" . $this->frame_target . "\"");
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("element");
$tpl->parseCurrentBlock();
//$this->output[] = $tpl->get();
}
示例9: fillRow
/**
* fill row
* @global type $ilObjDataCache
* @global ilRbacReview $rbacreview
* @param array $a_set
*/
function fillRow($a_set)
{
global $ilObjDataCache, $rbacreview;
$title = $ilObjDataCache->lookupTitle($rbacreview->getObjectOfRole($a_set["role"]));
$this->tpl->setVariable("VAL_ID", $a_set['mapping_id']);
$this->tpl->setVariable("VAL_TITLE", ilUtil::shortenText($title, 30, true));
$this->tpl->setVariable("VAL_ROLE", $a_set["role_name"]);
$this->tpl->setVariable("VAL_GROUP", $a_set["dn"]);
$this->tpl->setVariable("VAL_URL", $a_set["url"]);
$this->tpl->setVariable("VAL_MEMBER", $a_set["member_attribute"]);
$this->tpl->setVariable("VAL_INFO", ilUtil::prepareFormOutput($a_set['info']));
$this->ctrl->setParameter($this->getParentObject(), 'mapping_id', $a_set['mapping_id']);
$this->tpl->setVariable("EDIT_URL", $this->ctrl->getLinkTarget($this->getParentObject(), 'addRoleMapping'));
$this->tpl->setVariable("EDIT_TXT", $this->lng->txt('copy'));
$this->ctrl->setParameter($this->getParentObject(), 'mapping_id', $a_set['mapping_id']);
$this->tpl->setVariable("COPY_URL", $this->ctrl->getLinkTarget($this->getParentObject(), 'editRoleMapping'));
$this->tpl->setVariable("COPY_TXT", $this->lng->txt('edit'));
}
示例10: formatHeader
/**
* overwritten method from base class
* @access public
* @param integer obj_id
* @param integer array options
* @return string
*/
function formatHeader(&$tpl, $a_obj_id, $a_option)
{
global $lng, $ilias;
$tpl->setCurrentBlock("icon");
$tpl->setVariable("ICON_IMAGE", ilUtil::getImagePath("icon_lm_s.png"));
$tpl->setVariable("TXT_ALT_IMG", $lng->txt("obj_" . $this->lm_obj->getType()));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("link");
$tpl->setVariable("TITLE", ilUtil::shortenText($this->lm_obj->getTitle(), $this->textwidth, true));
if ($this->lm_obj->getType() == "lm") {
$this->ctrl->setParameterByClass("ilObjLearningModuleGUI", "obj_id", "");
$link = $this->ctrl->getLinkTargetByClass("ilObjLearningModuleGUI", "chapters");
} else {
$this->ctrl->setParameterByClass("ilObjDlBookGUI", "obj_id", "");
$link = $this->ctrl->getLinkTargetByClass("ilObjDlBookGUI", "chapters");
}
$tpl->setVariable("LINK_TARGET", $link);
$tpl->setVariable("TARGET", " target=\"" . $this->frame_target . "\"");
$tpl->parseCurrentBlock();
//$tpl->setCurrentBlock("row");
//$tpl->parseCurrentBlock();
$tpl->touchBlock("element");
}
示例11: _getHeaderTitleDescription
function _getHeaderTitleDescription()
{
global $ilDB;
$id = ilObjSystemFolder::_getId();
$q = "SELECT title,description FROM object_translation " . "WHERE obj_id = " . $ilDB->quote($id, 'integer') . " " . "AND lang_default = 1";
$r = $this->ilias->db->query($q);
$row = $r->fetchRow(DB_FETCHMODE_OBJECT);
$description = $row->description;
$q = "SELECT title,description FROM object_translation " . "WHERE obj_id = " . $ilDB->quote($id, 'integer') . " " . "AND lang_code = " . $ilDB->quote($this->ilias->account->getPref("language"), 'text') . " " . "AND NOT lang_default = 1";
$r = $this->ilias->db->query($q);
$row = $r->fetchRow(DB_FETCHMODE_OBJECT);
if ($row) {
$description = ilUtil::shortenText($row->description, MAXLENGTH_OBJ_DESC, true);
}
return $description;
}
示例12: ilLMNavigation
//.........这里部分代码省略.........
$c_id = $_GET["obj_id"];
} else {
$c_id = $page_id;
}
while (!$found) {
$pre_node = $this->lm_tree->fetchPredecessorNode($c_id, "pg");
$c_id = $pre_node["obj_id"];
$active = ilLMPage::_lookupActive($c_id, $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation"));
if ($pre_node["obj_id"] > 0 && ($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && ($this->lm->getPublicAccessMode() == "selected" && !ilLMObject::_isPagePublic($pre_node["obj_id"]))) {
$found = false;
} else {
if ($pre_node["obj_id"] > 0 && !$active) {
// look, whether activation data should be shown
$act_data = ilLMPage::_lookupActivationData((int) $pre_node["obj_id"], $this->lm->getType());
if ($act_data["show_activation_info"] && ilUtil::now() < $act_data["activation_start"]) {
$found = true;
} else {
$found = false;
}
} else {
$found = true;
}
}
}
$pre_str = $pre_node !== false ? $pre_node["obj_id"] . "_" . $pre_node["type"] . " -> " : "";
// determine target frame
$framestr = !empty($_GET["frame"]) ? "frame=" . $_GET["frame"] . "&" : "";
// Determine whether the view of a learning resource should
// be shown in the frameset of ilias, or in a separate window.
$showViewInFrameset = true;
if ($pre_node != "") {
// get presentation title
$prev_title = ilLMPageObject::_getPresentationTitle($pre_node["obj_id"], $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), false, 0, $this->lang);
$prev_title = ilUtil::shortenText($prev_title, 50, true);
$prev_img = ilUtil::getImagePath("nav_arr_L.png", false, "output", $this->offlineMode());
if (!$this->lm->cleanFrames()) {
$prev_href = $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"], $_GET["frame"]);
$prev_target = "";
} else {
if ($showViewInFrameset && !$this->offlineMode()) {
$prev_href = $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"]);
$prev_target = 'target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" ';
} else {
$prev_href = $this->getLink($this->lm->getRefId(), "layout", $pre_node["obj_id"]);
$prev_target = 'target="_top" ';
}
}
if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && ($this->lm->getPublicAccessMode() == 'selected' && !ilLMObject::_isPagePublic($pre_node["obj_id"]))) {
$output = $this->lng->txt("msg_page_not_public");
}
$this->tpl->setCurrentBlock("ilLMNavigation_Prev");
$this->tpl->setVariable("IMG_PREV", $prev_img);
$this->tpl->setVariable("HREF_PREV", $prev_href);
$this->tpl->setVariable("FRAME_PREV", $prev_target);
$this->tpl->setVariable("TXT_PREV", $prev_title);
$this->tpl->setVariable("ALT_PREV", $this->lng->txt("previous"));
$this->tpl->setVariable("SPACER_PREV", $this->offlineMode() ? "images/spacer.png" : ilUtil::getImagePath("spacer.png"));
$this->tpl->setVariable("PREV_ACC_KEY", ilAccessKeyGUI::getAttribute(ilAccessKey::PREVIOUS));
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("ilLMNavigation_Prev2");
$this->tpl->setVariable("IMG_PREV2", $prev_img);
$this->tpl->setVariable("HREF_PREV2", $prev_href);
$this->tpl->setVariable("FRAME_PREV2", $prev_target);
$this->tpl->setVariable("TXT_PREV2", $prev_title);
$this->tpl->setVariable("ALT_PREV2", $this->lng->txt("previous"));
$this->tpl->setVariable("SPACER_PREV2", $this->offlineMode() ? "images/spacer.png" : ilUtil::getImagePath("spacer.png"));
示例13: _writeDescription
/**
* write description to db (static)
*
* @param int $a_obj_id object id
* @param string $a_desc description
* @access public
*/
function _writeDescription($a_obj_id, $a_desc)
{
global $ilDB, $objDefinition;
$desc = ilUtil::shortenText($a_desc, MAXLENGTH_OBJ_DESC, true);
$q = "UPDATE object_data " . "SET " . "description = " . $ilDB->quote($desc, "text") . "," . "last_update = " . $ilDB->now() . " " . "WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer");
$ilDB->manipulate($q);
if ($objDefinition->isRBACObject($this->getType())) {
// Update long description
$res = $ilDB->query("SELECT * FROM object_description WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer'));
if ($res->numRows()) {
$values = array('description' => array('clob', $this->getLongDescription()));
$ilDB->update('object_description', $values, array('obj_id' => array('integer', $this->getId())));
} else {
$values = array('description' => array('clob', $this->getLongDescription()), 'obj_id' => array('integer', $this->getId()));
$ilDB->insert('object_description', $values);
}
}
}
示例14: fillRow
/**
* Fill table row
*/
protected function fillRow($term)
{
global $lng, $ilCtrl;
include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
$defs = ilGlossaryDefinition::getDefinitionList($term["id"]);
$ilCtrl->setParameterByClass("ilobjglossarygui", "term_id", $term["id"]);
$ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]);
$ilCtrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term["id"]);
// actions drop down
if ($this->glossary->getId() == $term["glo_id"]) {
$list = new ilAdvancedSelectionListGUI();
$list->addItem($lng->txt("cont_edit_term"), "", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "editTerm"));
if (count($defs) > 1) {
$list->addItem($lng->txt("cont_edit_definitions"), "", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listDefinitions"));
} else {
if (count($defs) == 1) {
$ilCtrl->setParameterByClass("ilglossarydefpagegui", "def", $defs[0]["id"]);
$list->addItem($lng->txt("cont_edit_definition"), "", $ilCtrl->getLinkTargetByClass(array("ilglossarytermgui", "iltermdefinitioneditorgui", "ilglossarydefpagegui"), "edit"));
}
}
$list->addItem($lng->txt("cont_add_definition"), "", $ilCtrl->getLinkTargetByClass("ilobjglossarygui", "addDefinition"));
$ilCtrl->setParameterByClass("ilglossarydefpagegui", "def", "");
$list->setId("act_term_" . $term["id"]);
$list->setListTitle($lng->txt("actions"));
$this->tpl->setVariable("ACTIONS", $list->getHTML());
}
for ($j = 0; $j < count($defs); $j++) {
$def = $defs[$j];
/*if ($this->glossary->getId() == $term["glo_id"])
{
// up
if ($j > 0)
{
$this->tpl->setCurrentBlock("move_up");
$this->tpl->setVariable("TXT_UP", $lng->txt("up"));
$ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]);
$ilCtrl->setParameter($this->parent_obj, "def", $def["id"]);
$this->tpl->setVariable("LINK_UP",
$ilCtrl->getLinkTarget($this->parent_obj, "moveDefinitionUp"));
$this->tpl->parseCurrentBlock();
}
// down
if ($j+1 < count($defs))
{
$this->tpl->setCurrentBlock("move_down");
$this->tpl->setVariable("TXT_DOWN", $lng->txt("down"));
$ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]);
$ilCtrl->setParameter($this->parent_obj, "def", $def["id"]);
$this->tpl->setVariable("LINK_DOWN",
$ilCtrl->getLinkTarget($this->parent_obj, "moveDefinitionDown"));
$this->tpl->parseCurrentBlock();
}
// delete
$this->tpl->setCurrentBlock("delete");
$ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]);
$ilCtrl->setParameter($this->parent_obj, "def", $def["id"]);
$this->tpl->setVariable("LINK_DELETE",
$ilCtrl->getLinkTarget($this->parent_obj, "confirmDefinitionDeletion"));
$this->tpl->setVariable("TXT_DELETE", $lng->txt("delete"));
$this->tpl->parseCurrentBlock();
// edit
$this->tpl->setCurrentBlock("edit");
$ilCtrl->setParameterByClass("ilglossarydefpagegui", "term_id", $term["id"]);
$ilCtrl->setParameterByClass("ilglossarydefpagegui", "def", $def["id"]);
$this->tpl->setVariable("LINK_EDIT",
$ilCtrl->getLinkTargetByClass(array("ilglossarytermgui",
"iltermdefinitioneditorgui",
"ilglossarydefpagegui"), "edit"));
$this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
$this->tpl->parseCurrentBlock();
}*/
// text
$this->tpl->setCurrentBlock("definition");
$short_str = $def["short_text"];
// replace tex
// if a tex end tag is missing a tex end tag
$ltexs = strrpos($short_str, "[tex]");
$ltexe = strrpos($short_str, "[/tex]");
if ($ltexs > $ltexe) {
$page = new ilGlossaryDefPage($def["id"]);
$page->buildDom();
$short_str = $page->getFirstParagraphText();
$short_str = strip_tags($short_str, "<br>");
$ltexe = strpos($short_str, "[/tex]", $ltexs);
$short_str = ilUtil::shortenText($short_str, $ltexe + 6, true);
}
$short_str = ilUtil::insertLatexImages($short_str);
$short_str = ilPCParagraph::xml2output($short_str);
$this->tpl->setVariable("DEF_SHORT", $short_str);
$this->tpl->parseCurrentBlock();
$this->tpl->setCurrentBlock("definition_row");
$this->tpl->parseCurrentBlock();
}
$this->tpl->setCurrentBlock("check_col");
//.........这里部分代码省略.........
示例15: renderEntry
/**
* Render main menu entry
*
* @param
* @return
*/
function renderEntry($a_tpl, $a_id, $a_txt, $a_script, $a_target = "_top")
{
global $lng, $ilNavigationHistory, $ilSetting, $rbacsystem, $ilCtrl;
$id = strtolower($a_id);
$id_up = strtoupper($a_id);
$a_tpl->setCurrentBlock("entry_" . $id);
include_once "./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php";
// repository
if ($a_id == "repository") {
$gl = new ilGroupedListGUI();
$gl->setAsDropDown(true);
include_once "./Services/Link/classes/class.ilLink.php";
$icon = ilUtil::img(ilObject::_getIcon(ilObject::_lookupObjId(1), "tiny"));
$gl->addEntry($icon . " " . $a_txt . " - " . $lng->txt("rep_main_page"), ilLink::_getStaticLink(1, 'root', true), "_top");
$items = $ilNavigationHistory->getItems();
reset($items);
$cnt = 0;
$first = true;
foreach ($items as $k => $item) {
if ($cnt >= 10) {
break;
}
if (!isset($item["ref_id"]) || !isset($_GET["ref_id"]) || ($item["ref_id"] != $_GET["ref_id"] || !$first)) {
if ($cnt == 0) {
$gl->addGroupHeader($lng->txt("last_visited"), "ilLVNavEnt");
}
$obj_id = ilObject::_lookupObjId($item["ref_id"]);
$cnt++;
$icon = ilUtil::img(ilObject::_getIcon($obj_id, "tiny"));
$ititle = ilUtil::shortenText(strip_tags($item["title"]), 50, true);
// #11023
$gl->addEntry($icon . " " . $ititle, $item["link"], "_top", "", "ilLVNavEnt");
}
$first = false;
}
if ($cnt > 0) {
$gl->addEntry("» " . $lng->txt("remove_entries"), "#", "", "return il.MainMenu.removeLastVisitedItems('" . $ilCtrl->getLinkTargetByClass("ilnavigationhistorygui", "removeEntries", "", true) . "');", "ilLVNavEnt");
}
$a_tpl->setVariable("REP_EN_OV", $gl->getHTML());
}
// desktop
if ($a_id == "desktop") {
$gl = new ilGroupedListGUI();
$gl->setAsDropDown(true);
// overview
$gl->addEntry($lng->txt("overview"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSelectedItems", "_top", "", "", "mm_pd_sel_items", ilHelp::getMainMenuTooltip("mm_pd_sel_items"), "left center", "right center", false);
// my groups and courses, if both is available
if ($ilSetting->get('disable_my_offers') == 0 && $ilSetting->get('disable_my_memberships') == 0) {
$gl->addEntry($lng->txt("my_courses_groups"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToMemberships", "_top", "", "", "mm_pd_crs_grp", ilHelp::getMainMenuTooltip("mm_pd_crs_grp"), "left center", "right center", false);
}
// bookmarks
if (!$this->ilias->getSetting("disable_bookmarks")) {
$gl->addEntry($lng->txt("bookmarks"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToBookmarks", "_top", "", "", "mm_pd_bookm", ilHelp::getMainMenuTooltip("mm_pd_bookm"), "left center", "right center", false);
}
// private notes
if (!$this->ilias->getSetting("disable_notes")) {
$gl->addEntry($lng->txt("notes_and_comments"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNotes", "_top", "", "", "mm_pd_notes", ilHelp::getMainMenuTooltip("mm_pd_notes"), "left center", "right center", false);
}
// news
if ($ilSetting->get("block_activated_news")) {
$gl->addEntry($lng->txt("news"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToNews", "_top", "", "", "mm_pd_news", ilHelp::getMainMenuTooltip("mm_pd_news"), "left center", "right center", false);
}
// overview is always active
$gl->addSeparator();
$separator = false;
if (!$ilSetting->get("disable_personal_workspace")) {
// workspace
$gl->addEntry($lng->txt("personal_workspace"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToWorkspace", "_top", "", "", "mm_pd_wsp", ilHelp::getMainMenuTooltip("mm_pd_wsp"), "left center", "right center", false);
$separator = true;
}
// portfolio
if ($ilSetting->get('user_portfolios')) {
$gl->addEntry($lng->txt("portfolio"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio", "_top", "", "", "mm_pd_port", ilHelp::getMainMenuTooltip("mm_pd_port"), "left center", "right center", false);
$separator = true;
}
// skills
$skmg_set = new ilSetting("skmg");
if ($skmg_set->get("enable_skmg")) {
$gl->addEntry($lng->txt("skills"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSkills", "_top", "", "", "mm_pd_skill", ilHelp::getMainMenuTooltip("mm_pd_skill"), "left center", "right center", false);
$separator = true;
}
// Learning Progress
include_once "Services/Tracking/classes/class.ilObjUserTracking.php";
if (ilObjUserTracking::_enabledLearningProgress() && (ilObjUserTracking::_hasLearningProgressOtherUsers() || ilObjUserTracking::_hasLearningProgressLearner())) {
//$ilTabs->addTarget("learning_progress", $this->ctrl->getLinkTargetByClass("ilLearningProgressGUI"));
$gl->addEntry($lng->txt("learning_progress"), "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToLP", "_top", "", "", "mm_pd_lp", ilHelp::getMainMenuTooltip("mm_pd_lp"), "left center", "right center", false);
$separator = true;
}
if ($separator) {
$gl->addSeparator();
}
$separator = false;
// calendar
include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
//.........这里部分代码省略.........