当前位置: 首页>>代码示例>>PHP>>正文


PHP ilUtil::insertLatexImages方法代码示例

本文整理汇总了PHP中ilUtil::insertLatexImages方法的典型用法代码示例。如果您正苦于以下问题:PHP ilUtil::insertLatexImages方法的具体用法?PHP ilUtil::insertLatexImages怎么用?PHP ilUtil::insertLatexImages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilUtil的用法示例。


在下文中一共展示了ilUtil::insertLatexImages方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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");
//.........这里部分代码省略.........
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.ilTermListTableGUI.php

示例2: prepareTextareaOutput

 /**
  * Prepares a string for a text area output where latex code may be in it
  * If the text is HTML-free, CHR(13) will be converted to a line break
  *
  * @param string $txt_output String which should be prepared for output
  * @access public
  * 
  */
 public static function prepareTextareaOutput($txt_output, $prepare_for_latex_output = FALSE)
 {
     $result = $txt_output;
     $is_html = self::isHTML($result);
     if ($prepare_for_latex_output) {
         $result = ilUtil::insertLatexImages($result, "\\<span class\\=\"latex\">", "\\<\\/span>");
         $result = ilUtil::insertLatexImages($result, "\\[tex\\]", "\\[\\/tex\\]");
     }
     // removed: did not work with magic_quotes_gpc = On
     if (!$is_html) {
         // if the string does not contain HTML code, replace the newlines with HTML line breaks
         $result = preg_replace("/[\n]/", "<br />", $result);
     } else {
         // patch for problems with the <pre> tags in tinyMCE
         if (preg_match_all("/(\\<pre>.*?\\<\\/pre>)/ims", $result, $matches)) {
             foreach ($matches[0] as $found) {
                 $replacement = "";
                 if (strpos("\n", $found) === FALSE) {
                     $replacement = "\n";
                 }
                 $removed = preg_replace("/\\<br\\s*?\\/>/ims", $replacement, $found);
                 $result = str_replace($found, $removed, $result);
             }
         }
     }
     if ($prepare_for_latex_output) {
         // replace special characters to prevent problems with the ILIAS template system
         // eg. if someone uses {1} as an answer, nothing will be shown without the replacement
         $result = str_replace("{", "&#123;", $result);
         $result = str_replace("}", "&#125;", $result);
         $result = str_replace("\\", "&#92;", $result);
     }
     return $result;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:42,代码来源:class.ilUtil.php

示例3: showPage


//.........这里部分代码省略.........
     // ensure no cache hit, if included files/media objects have been changed
     $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements();
     // run xslt
     $md5 = md5(serialize($params) . $link_xml . $template_xml);
     //$a = microtime();
     // check cache (same parameters, non-edit mode and rendered time
     // > last change
     if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") && !$this->getCompareMode() && !$this->getAbstractOnly() && $md5 == $this->obj->getRenderMd5() && $this->obj->getLastChange() < $this->obj->getRenderedTime() && $this->obj->getRenderedTime() != "" && $this->obj->old_nr == 0) {
         // cache hit
         $output = $this->obj->getRenderedContent();
     } else {
         $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
         $args = array('/_xml' => $content, '/_xsl' => $xsl);
         $xh = xslt_create();
         //		echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
         //		echo "mode:".$this->getOutputMode().":<br>";
         $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
         if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview") && !$this->getAbstractOnly() && $this->obj->old_nr == 0) {
             //echo "writerenderedcontent";
             $this->obj->writeRenderedContent($output, $md5);
         }
         //echo xslt_error($xh);
         xslt_free($xh);
     }
     //$b = microtime();
     //echo "$a - $b";
     //echo "<pre>".htmlentities($output)."</pre>";
     // unmask user html
     if (($this->getOutputMode() != "edit" || $ilUser->getPref("ilPageEditor_HTMLMode") != "disable") && !$this->getPageConfig()->getPreventHTMLUnmasking()) {
         $output = str_replace("&lt;", "<", $output);
         $output = str_replace("&gt;", ">", $output);
     }
     $output = str_replace("&amp;", "&", $output);
     $output = ilUtil::insertLatexImages($output);
     // insert page snippets
     $output = $this->insertContentIncludes($output);
     // insert resource blocks
     $output = $this->insertResources($output);
     // insert page toc
     if ($this->getPageConfig()->getEnablePageToc()) {
         $output = $this->insertPageToc($output);
     }
     // insert advanced output trigger
     $output = $this->insertAdvTrigger($output);
     // workaround for preventing template engine
     // from hiding paragraph text that is enclosed
     // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
     $output = $this->replaceCurlyBrackets($output);
     // remove all newlines (important for code / pre output)
     $output = str_replace("\n", "", $output);
     //echo htmlentities($output);
     $output = $this->postOutputProcessing($output);
     //echo htmlentities($output);
     if ($this->getOutputMode() == "edit" && !$this->getPageObject()->getActive($this->getPageConfig()->getEnableScheduledActivation())) {
         $output = '<div class="il_editarea_disabled">' . $output . '</div>';
     }
     // for all page components...
     include_once "./Services/COPage/classes/class.ilCOPagePCDef.php";
     $defs = ilCOPagePCDef::getPCDefinitions();
     foreach ($defs as $def) {
         ilCOPagePCDef::requirePCClassByName($def["name"]);
         $pc_class = $def["pc_class"];
         $pc_obj = new $pc_class($this->getPageObject());
         // post xsl page content modification by pc elements
         $output = $pc_obj->modifyPageContentPostXsl($output, $this->getOutputMode());
         // javascript files
开发者ID:bheyser,项目名称:qplskl,代码行数:67,代码来源:class.ilPageObjectGUI.php

示例4: fillRow

 /**
  * Fill table row
  */
 protected function fillRow($term)
 {
     global $lng, $ilCtrl;
     $defs = ilGlossaryDefinition::getDefinitionList($term["id"]);
     $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]);
     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("ilpageobjectgui", "term_id", $term["id"]);
             $ilCtrl->setParameterByClass("ilpageobjectgui", "def", $def["id"]);
             $this->tpl->setVariable("LINK_EDIT", $ilCtrl->getLinkTargetByClass(array("ilglossarytermgui", "iltermdefinitioneditorgui", "ilpageobjectgui"), "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 ilPageObject("gdf", $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");
     $this->tpl->setVariable("CHECKBOX_ID", $term["id"]);
     $this->tpl->parseCurrentBlock();
     // edit term link
     $this->tpl->setCurrentBlock("edit_term");
     $this->tpl->setVariable("TEXT_TERM", $term["term"]);
     $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]);
     if ($this->glossary->getId() == $term["glo_id"]) {
         $this->tpl->setVariable("LINK_EDIT_TERM", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "editTerm"));
         $this->tpl->setVariable("TXT_EDIT_TERM", $lng->txt("edit"));
     }
     $this->tpl->parseCurrentBlock();
     // usage
     $nr_usage = ilGlossaryTerm::getNumberOfUsages($term["id"]);
     if ($nr_usage > 0 && $this->glossary->getId() == $term["glo_id"]) {
         $this->tpl->setCurrentBlock("link_usage");
         $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]);
         $this->tpl->setVariable("LUSAGE", ilGlossaryTerm::getNumberOfUsages($term["id"]));
         $this->tpl->setVariable("LINK_USAGE", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listUsages"));
         $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", "");
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setCurrentBlock("usage");
         $this->tpl->setVariable("USAGE", ilGlossaryTerm::getNumberOfUsages($term["id"]));
         $this->tpl->parseCurrentBlock();
     }
     // glossary title
     if (in_array($this->glossary->getVirtualMode(), array("level", "subtree"))) {
         $this->tpl->setCurrentBlock("glossary");
         $this->tpl->setVariable("GLO_TITLE", ilObject::_lookupTitle($term["glo_id"]));
         $this->tpl->parseCurrentBlock();
     }
     // output term and language
     $this->tpl->setVariable("TEXT_LANGUAGE", $lng->txt("meta_l_" . $term["language"]));
//.........这里部分代码省略.........
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:class.ilTermListTableGUI.php

示例5: fillRow

 /**
  * Fill table row
  */
 protected function fillRow($term)
 {
     global $lng, $ilCtrl;
     $defs = ilGlossaryDefinition::getDefinitionList($term["id"]);
     $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]);
     if ($this->glossary->getPresentationMode() == "full_def") {
         $this->tpl->setCurrentBlock("fd_td");
         $this->tpl->setVariable("FULL_DEF", $this->parent_obj->listDefinitions($_GET["ref_id"], $term["id"], true));
         $this->tpl->parseCurrentBlock();
     } else {
         for ($j = 0; $j < count($defs); $j++) {
             $def = $defs[$j];
             if (count($defs) > 1) {
                 $this->tpl->setCurrentBlock("definition");
                 $this->tpl->setVariable("DEF_TEXT", $lng->txt("cont_definition") . " " . ($j + 1));
                 $this->tpl->parseCurrentBlock();
             }
             // check dirty short texts
             $this->tpl->setCurrentBlock("definition");
             if ($def["short_text_dirty"]) {
                 $def = new ilGlossaryDefinition($def["id"]);
                 $def->updateShortText();
                 $short_str = $def->getShortText();
             } else {
                 $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);
             }
             if (!$this->offline) {
                 $short_str = ilUtil::insertLatexImages($short_str);
             } else {
                 $short_str = ilUtil::buildLatexImages($short_str, $this->parent_obj->getOfflineDirectory());
             }
             $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->touchBlock("def_td");
         // display additional column 'glossary' for meta glossaries
         if ($this->glossary->isVirtual()) {
             $this->tpl->setCurrentBlock("glossary_row");
             $glo_title = ilObject::_lookupTitle($term["glo_id"]);
             $this->tpl->setVariable("GLO_TITLE", $glo_title);
             $this->tpl->parseCurrentBlock();
         }
     }
     $ilCtrl->clearParameters($this->parent_obj);
     // advanced metadata
     foreach ($this->adv_cols_order as $c) {
         if ($c["id"] == 0) {
             $this->tpl->setCurrentBlock("link_start");
             if (!$this->offline) {
                 if (!empty($filter)) {
                     $ilCtrl->setParameter($this->parent_obj, "term", $filter);
                     $ilCtrl->setParameter($this->parent_obj, "oldoffset", $_GET["oldoffset"]);
                 }
                 $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]);
                 $ilCtrl->setParameter($this->parent_obj, "offset", $_GET["offset"]);
                 $this->tpl->setVariable("LINK_VIEW_TERM", $ilCtrl->getLinkTarget($this->parent_obj, "listDefinitions"));
                 $ilCtrl->clearParameters($this->parent_obj);
             } else {
                 $this->tpl->setVariable("LINK_VIEW_TERM", "term_" . $term["id"] . ".html");
             }
             $this->tpl->parseCurrentBlock();
             $this->tpl->setCurrentBlock("link_end");
             $this->tpl->setVariable("ANCHOR_TERM", "term_" . $term["id"]);
             $this->tpl->parseCurrentBlock();
             $this->tpl->setCurrentBlock("td");
             $this->tpl->setVariable("TEXT", $term["term"]);
             $this->tpl->parseCurrentBlock();
         } else {
             $id = $c["id"];
             $f = $this->adv_fields[$c["id"]];
             $this->tpl->setCurrentBlock("td");
             switch ($f["type"]) {
                 case ilAdvancedMDFieldDefinition::TYPE_DATETIME:
                     $val = $term["md_" . $id] > 0 ? ilDatePresentation::formatDate(new ilDateTime($term["md_" . $id], IL_CAL_UNIX)) : " ";
                     break;
                 case ilAdvancedMDFieldDefinition::TYPE_DATE:
                     $val = $term["md_" . $id] > 0 ? ilDatePresentation::formatDate(new ilDate($term["md_" . $id], IL_CAL_UNIX)) : " ";
                     break;
                 default:
                     $val = $term["md_" . $id] != "" ? $term["md_" . $id] : " ";
                     break;
             }
//.........这里部分代码省略.........
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:101,代码来源:class.ilPresentationListTableGUI.php

示例6: formatSAQuestion

 /**
  * Format self assessment question
  *
  * @param
  * @return
  */
 function formatSAQuestion($a_q)
 {
     include_once "./Services/RTE/classes/class.ilRTE.php";
     $a_q = nl2br((string) ilRTE::_replaceMediaObjectImageSrc($this->getQuestion(), 0));
     $a_q = str_replace("</li><br />", "</li>", $a_q);
     $a_q = str_replace("</li><br>", "</li>", $a_q);
     $a_q = ilUtil::insertLatexImages($a_q);
     return $a_q;
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:15,代码来源:class.assQuestion.php

示例7: fillRow

 /**
  * Fill table row
  */
 protected function fillRow($term)
 {
     global $lng, $ilCtrl;
     $defs = ilGlossaryDefinition::getDefinitionList($term["id"]);
     $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]);
     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");
     $this->tpl->setVariable("CHECKBOX_ID", $term["id"]);
     $this->tpl->parseCurrentBlock();
     // edit term link
     $this->tpl->setCurrentBlock("edit_term");
     $this->tpl->setVariable("TEXT_TERM", $term["term"]);
     $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]);
     if ($this->glossary->getId() == $term["glo_id"]) {
         $this->tpl->setVariable("LINK_EDIT_TERM", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "editTerm"));
         $this->tpl->setVariable("TXT_EDIT_TERM", $lng->txt("edit"));
     }
     $this->tpl->parseCurrentBlock();
     // usage
     if (in_array("usage", $this->getSelectedColumns())) {
         $nr_usage = ilGlossaryTerm::getNumberOfUsages($term["id"]);
         if ($nr_usage > 0 && $this->glossary->getId() == $term["glo_id"]) {
             $this->tpl->setCurrentBlock("link_usage");
             $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", $term["id"]);
             $this->tpl->setVariable("LUSAGE", ilGlossaryTerm::getNumberOfUsages($term["id"]));
             $this->tpl->setVariable("LINK_USAGE", $ilCtrl->getLinkTargetByClass("ilglossarytermgui", "listUsages"));
             $ilCtrl->setParameterByClass("ilglossarytermgui", "term_id", "");
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->setCurrentBlock("usage");
             $this->tpl->setVariable("USAGE", ilGlossaryTerm::getNumberOfUsages($term["id"]));
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("td_usage");
         $this->tpl->parseCurrentBlock();
     }
     // glossary title
     if (in_array($this->glossary->getVirtualMode(), array("level", "subtree"))) {
         $this->tpl->setCurrentBlock("glossary");
         $this->tpl->setVariable("GLO_TITLE", ilObject::_lookupTitle($term["glo_id"]));
//.........这里部分代码省略.........
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:101,代码来源:class.ilTermListTableGUI.php

示例8: prepareText

 /**
  * prepares given string
  * @access	public
  * @param	string	
  * @param	integer
  * @return	string
  */
 public function prepareText($text, $edit = 0, $quote_user = '', $type = '')
 {
     global $lng;
     if ($type == 'export') {
         $this->replQuote1 = "<blockquote class=\"quote\"><hr size=\"1\" color=\"#000000\">";
         $this->replQuote2 = "<hr size=\"1\" color=\"#000000\"/></blockquote>";
     }
     if ($edit == 1) {
         // add login name of quoted users
         $lname = $quote_user != "" ? '="' . $quote_user . '"' : "";
         $text = "[quote{$lname}]" . $text . "[/quote]";
     } else {
         // check for quotation
         $startZ = substr_count($text, "[quote");
         // also count [quote="..."]
         $endZ = substr_count($text, "[/quote]");
         if ($startZ > 0 || $endZ > 0) {
             // add missing opening and closing tags
             if ($startZ > $endZ) {
                 $diff = $startZ - $endZ;
                 for ($i = 0; $i < $diff; $i++) {
                     if ($type == 'export') {
                         $text .= $this->txtQuote2;
                     } else {
                         $text .= "[/quote]";
                     }
                 }
             } elseif ($startZ < $endZ) {
                 $diff = $endZ - $startZ;
                 for ($i = 0; $i < $diff; $i++) {
                     if ($type == 'export') {
                         $text = $this->txtQuote1 . $text;
                     } else {
                         $text = "[quote]" . $text;
                     }
                 }
             }
             if ($edit == 0) {
                 $ws = "[ \t\r\f\v\n]*";
                 $text = eregi_replace("\\[(quote{$ws}={$ws}\"([^\"]*)\"{$ws})\\]", $this->replQuote1 . '<div class="ilForumQuoteHead">' . $lng->txt("quote") . " (\\2)" . '</div>', $text);
                 $text = str_replace("[quote]", $this->replQuote1 . '<div class="ilForumQuoteHead">' . $lng->txt("quote") . '</div>', $text);
                 $text = str_replace("[/quote]", $this->replQuote2, $text);
             }
         }
     }
     if ($type != 'export') {
         if ($edit == 0) {
             $text = ilUtil::insertLatexImages($text, "\\<span class\\=\"latex\">", "\\<\\/span>");
             $text = ilUtil::insertLatexImages($text, "\\[tex\\]", "\\[\\/tex\\]");
         }
         // workaround for preventing template engine
         // from hiding text that is enclosed
         // in curly brackets (e.g. "{a}")
         $text = str_replace("{", "&#123;", $text);
         $text = str_replace("}", "&#125;", $text);
     }
     return $text;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:65,代码来源:class.ilForum.php

示例9: formatSAQuestion

 /**
  * Format self assessment question
  *
  * @param
  * @return
  */
 function formatSAQuestion($a_q)
 {
     include_once "./Services/RTE/classes/class.ilRTE.php";
     $a_q = nl2br((string) ilRTE::_replaceMediaObjectImageSrc($a_q, 0));
     $a_q = str_replace("</li><br />", "</li>", $a_q);
     $a_q = str_replace("</li><br>", "</li>", $a_q);
     $a_q = ilUtil::insertLatexImages($a_q, "\\[tex\\]", "\\[\\/tex\\]");
     $a_q = ilUtil::insertLatexImages($a_q, "\\<span class\\=\"latex\">", "\\<\\/span>");
     $a_q = str_replace('{', '&#123;', $a_q);
     $a_q = str_replace('}', '&#125;', $a_q);
     return $a_q;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:18,代码来源:class.assQuestion.php

示例10: fillRow

 /**
  * Fill table row
  */
 protected function fillRow($term)
 {
     global $lng, $ilCtrl;
     $defs = ilGlossaryDefinition::getDefinitionList($term["id"]);
     $ilCtrl->setParameter($this->parent_obj, "term_id", $term["id"]);
     if ($this->glossary->getPresentationMode() == "full_def") {
         $this->tpl->setVariable("FULL_DEF", $this->parent_obj->listDefinitions($_GET["ref_id"], $term["id"], true));
     } else {
         for ($j = 0; $j < count($defs); $j++) {
             $def = $defs[$j];
             if (count($defs) > 1) {
                 $this->tpl->setCurrentBlock("definition");
                 $this->tpl->setVariable("DEF_TEXT", $lng->txt("cont_definition") . " " . ($j + 1));
                 $this->tpl->parseCurrentBlock();
             }
             // check dirty short texts
             $this->tpl->setCurrentBlock("definition");
             if ($def["short_text_dirty"]) {
                 $def = new ilGlossaryDefinition($def["id"]);
                 $def->updateShortText();
                 $short_str = $def->getShortText();
             } else {
                 $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 ilPageObject("gdf", $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);
             }
             if (!$this->offline) {
                 $short_str = ilUtil::insertLatexImages($short_str);
             } else {
                 $short_str = ilUtil::buildLatexImages($short_str, $this->parent_obj->getOfflineDirectory());
             }
             $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->touchBlock("def_td");
         // display additional column 'glossary' for meta glossaries
         if ($this->glossary->isVirtual()) {
             $this->tpl->setCurrentBlock("glossary_row");
             $glo_title = ilObject::_lookupTitle($term["glo_id"]);
             $this->tpl->setVariable("GLO_TITLE", $glo_title);
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("view_term");
         $this->tpl->setVariable("TEXT_TERM", $term["term"]);
         if (!$this->offline) {
             if (!empty($filter)) {
                 $ilCtrl->setParameter($this, "term", $filter);
                 $ilCtrl->setParameter($this, "oldoffset", $_GET["oldoffset"]);
             }
             $ilCtrl->setParameter($this, "term_id", $term["id"]);
             $ilCtrl->setParameter($this, "offset", $_GET["offset"]);
             $this->tpl->setVariable("LINK_VIEW_TERM", $ilCtrl->getLinkTarget($this->parent_obj, "listDefinitions"));
             $ilCtrl->clearParameters($this);
         } else {
             $this->tpl->setVariable("LINK_VIEW_TERM", "term_" . $term["id"] . ".html");
         }
         $this->tpl->setVariable("ANCHOR_TERM", "term_" . $term["id"]);
         $this->tpl->parseCurrentBlock();
     }
     $ilCtrl->clearParameters($this->parent_obj);
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:77,代码来源:class.ilPresentationListTableGUI.php


注:本文中的ilUtil::insertLatexImages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。