本文整理匯總了PHP中ilTemplate::parseCurrentBlock方法的典型用法代碼示例。如果您正苦於以下問題:PHP ilTemplate::parseCurrentBlock方法的具體用法?PHP ilTemplate::parseCurrentBlock怎麽用?PHP ilTemplate::parseCurrentBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ilTemplate
的用法示例。
在下文中一共展示了ilTemplate::parseCurrentBlock方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: render
/**
* @return string
*/
protected function render()
{
$tpl = new ilTemplate('./Customizing/global/plugins/Services/Repository/RepositoryObject/RoomSharing/templates/default/utils/tpl.hours_input.html', false, false);
// echo '<pre>' . print_r($this->getHours(), 1) . '</pre>';
// echo '<pre>' . print_r($this->getMinutes(), 1) . '</pre>';
$tpl->setVariable('POSTVAR', $this->getPostVar());
for ($x = 0; $x < 24; $x++) {
$tpl->setCurrentBlock('hour');
if ($x == $this->getHours()) {
$tpl->setVariable('SELECTED', "selected=selected");
}
$tpl->setVariable('VAL', $x);
$tpl->setVariable('DISPLAY', str_pad($x, 2, '0', STR_PAD_LEFT));
$tpl->parseCurrentBlock();
}
for ($x = 0; $x < 60; $x = $x + 5) {
$tpl->setCurrentBlock('minute');
if ($this->getMinutes() >= $x and $this->getMinutes() < $x + 5) {
$tpl->setVariable('SELECTED', "selected=selected");
}
$tpl->setVariable('VAL', $x);
$tpl->setVariable('DISPLAY', str_pad($x, 2, '0', STR_PAD_LEFT));
$tpl->parseCurrentBlock();
}
return $tpl->get();
}
示例2: generateDBUpdateForInstallation
public function generateDBUpdateForInstallation()
{
$tpl = new ilTemplate(dirname(__FILE__) . '/templates/dbupdate.txt', true, true);
$ar = $this->getAr();
$tpl->setVariable('TABLE_NAME', $ar->getConnectorContainerName());
$tpl->setVariable('TABLE_NAME2', $ar->getConnectorContainerName());
$tpl->setVariable('TABLE_NAME3', $ar->getConnectorContainerName());
$tpl->setVariable('STEP', $this->getStep());
$tpl->setVariable('PRIMARY', $this->getAr()->getArFieldList()->getPrimaryFieldName());
foreach ($this->getAr()->getArFieldList()->getFields() as $field) {
$tpl->touchBlock('field');
$tpl->setVariable('FIELD_NAME', $field->getName());
foreach ($field->getAttributesForConnector() as $name => $value) {
$tpl->setCurrentBlock('attribute');
$tpl->setVariable('NAME', arFieldList::mapKey($name));
$tpl->setVariable('VALUE', $value);
$tpl->parseCurrentBlock();
}
}
if ($this->getAr()->getArFieldList()->getPrimaryField()->getFieldType() == arField::FIELD_TYPE_INTEGER) {
$tpl->setCurrentBlock('attribute');
$tpl->setVariable('TABLE_NAME4', $ar->getConnectorContainerName());
$tpl->parseCurrentBlock();
}
header('Content-type: application/x-httpd-php');
header("Content-Disposition: attachment; filename=\"dbupdate.php\"");
echo $tpl->get();
exit;
}
示例3: getOverviewHeader
/**
* Get assignment header for overview
*/
function getOverviewHeader($a_data)
{
global $lng, $ilUser;
$lng->loadLanguageModule("exc");
$tpl = new ilTemplate("tpl.assignment_head.html", true, true, "Modules/Exercise");
if ($a_data["deadline"] > 0 && $a_data["deadline"] - time() <= 0) {
$tpl->setCurrentBlock("prop");
$tpl->setVariable("PROP", $lng->txt("exc_ended_on"));
$tpl->setVariable("PROP_VAL", ilDatePresentation::formatDate(new ilDateTime($a_data["deadline"], IL_CAL_UNIX)));
$tpl->parseCurrentBlock();
// #14077
if ($a_data["peer"] && $a_data["peer_dl"]) {
$tpl->setCurrentBlock("prop");
$tpl->setVariable("PROP", $lng->txt("exc_peer_review_deadline"));
$tpl->setVariable("PROP_VAL", ilDatePresentation::formatDate(new ilDateTime($a_data["peer_dl"], IL_CAL_UNIX)));
$tpl->parseCurrentBlock();
}
} else {
if ($a_data["start_time"] > 0 && time() - $a_data["start_time"] <= 0) {
$tpl->setCurrentBlock("prop");
$tpl->setVariable("PROP", $lng->txt("exc_starting_on"));
$tpl->setVariable("PROP_VAL", ilDatePresentation::formatDate(new ilDateTime($a_data["start_time"], IL_CAL_UNIX)));
$tpl->parseCurrentBlock();
} else {
$time_str = $this->getTimeString($a_data["deadline"]);
$tpl->setCurrentBlock("prop");
$tpl->setVariable("PROP", $lng->txt("exc_time_to_send"));
$tpl->setVariable("PROP_VAL", $time_str);
$tpl->parseCurrentBlock();
if ($a_data["deadline"] > 0) {
$tpl->setCurrentBlock("prop");
$tpl->setVariable("PROP", $lng->txt("exc_edit_until"));
$tpl->setVariable("PROP_VAL", ilDatePresentation::formatDate(new ilDateTime($a_data["deadline"], IL_CAL_UNIX)));
$tpl->parseCurrentBlock();
}
}
}
$mand = "";
if ($a_data["mandatory"]) {
$mand = " (" . $lng->txt("exc_mandatory") . ")";
}
$tpl->setVariable("TITLE", $a_data["title"] . $mand);
// status icon
$stat = ilExAssignment::lookupStatusOfUser($a_data["id"], $ilUser->getId());
switch ($stat) {
case "passed":
$pic = "scorm/passed.svg";
break;
case "failed":
$pic = "scorm/failed.svg";
break;
default:
$pic = "scorm/not_attempted.svg";
break;
}
$tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
$tpl->setVariable("ALT_STATUS", $lng->txt("exc_" . $stat));
return $tpl->get();
}
示例4: formatHeader
/**
* overwritten method from base class
* @access public
* @param integer obj_id
* @param integer array options
* @return string
*/
function formatHeader($a_obj_id, $a_option)
{
global $lng, $ilias;
$tpl = new ilTemplate("tpl.tree.html", true, true, "Services/UIComponent/Explorer");
$tpl->setCurrentBlock("text");
$tpl->setVariable("OBJ_TITLE", $lng->txt("repository"));
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("row");
$tpl->parseCurrentBlock();
$this->output[] = $tpl->get();
}
示例5: getOverviewHeader
/**
* Get assignment header for overview
*/
function getOverviewHeader($a_data)
{
global $lng, $ilUser;
$tpl = new ilTemplate("tpl.assignment_head.html", true, true, "Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus");
if ($a_data["deadline"] - time() <= 0) {
$tpl->setCurrentBlock("prop");
$tpl->setVariable("PROP", $lng->txt("rep_robj_xeph_ended_on"));
$tpl->setVariable("PROP_VAL", ilDatePresentation::formatDate(new ilDateTime($a_data["deadline"], IL_CAL_UNIX)));
$tpl->parseCurrentBlock();
} else {
if ($a_data["start_time"] > 0 && time() - $a_data["start_time"] <= 0) {
$tpl->setCurrentBlock("prop");
$tpl->setVariable("PROP", $lng->txt("rep_robj_xeph_starting_on"));
$tpl->setVariable("PROP_VAL", ilDatePresentation::formatDate(new ilDateTime($a_data["start_time"], IL_CAL_UNIX)));
$tpl->parseCurrentBlock();
} else {
$time_str = $this->getTimeString($a_data["deadline"]);
$tpl->setCurrentBlock("prop");
$tpl->setVariable("PROP", $lng->txt("rep_robj_xeph_time_to_send"));
$tpl->setVariable("PROP_VAL", $time_str);
$tpl->parseCurrentBlock();
$tpl->setCurrentBlock("prop");
$tpl->setVariable("PROP", $lng->txt("rep_robj_xeph_edit_until"));
$tpl->setVariable("PROP_VAL", ilDatePresentation::formatDate(new ilDateTime($a_data["deadline"], IL_CAL_UNIX)));
$tpl->parseCurrentBlock();
}
}
$mand = "";
if ($a_data["mandatory"]) {
$mand = " (" . $lng->txt("rep_robj_xeph_mandatory") . ")";
}
$tpl->setVariable("TITLE", $a_data["title"] . $mand);
// status icon
$stat = ilEphAssignment::lookupStatusOfUser($a_data["id"], $ilUser->getId());
switch ($stat) {
case "passed":
$pic = "scorm/passed.png";
break;
case "failed":
$pic = "scorm/failed.png";
break;
default:
$pic = "scorm/not_attempted.png";
break;
}
$tpl->setVariable("IMG_STATUS", ilUtil::getImagePath($pic));
$tpl->setVariable("ALT_STATUS", $lng->txt("rep_robj_xeph_" . $stat));
return $tpl->get();
}
示例6: insert
/**
* Insert property html
*
* @return int Size
*/
function insert(&$a_tpl)
{
global $lng;
$tpl = new ilTemplate("tpl.prop_randomtestroinput.html", true, true, "Modules/Test");
$i = 0;
foreach ($this->values as $value) {
if ($value['num_of_q'] > 0) {
$tpl->setCurrentBlock("num_of_q");
$tpl->setVariable("NUM_OF_Q", $value['num_of_q']);
$tpl->setVariable("TEXT_FROM", $lng->txt('questions_from'));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("row");
$class = $i % 2 == 0 ? "even" : "odd";
if ($i == 0) {
$class .= " first";
}
if ($i == count($this->values) - 1) {
$class .= " last";
}
$tpl->setVariable("ROW_CLASS", $class);
$tpl->setVariable("QPL_VALUE", ilUtil::prepareFormOutput($value['title']));
$tpl->setVariable("COUNT_VALUE", "(" . $value['count'] . " " . $lng->txt('assQuestions') . ")");
$tpl->parseCurrentBlock();
$i++;
}
$tpl->setVariable("ELEMENT_ID", $this->getPostVar());
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
}
示例7: outputAdjustQuestionForm
/**
* @param $form
*/
protected function outputAdjustQuestionForm($form)
{
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_questions.html", "Modules/Test");
$this->tpl->setCurrentBlock("adm_content");
$this->tpl->setVariable('QUESTIONBROWSER', $form->getHTML());
$this->tpl->parseCurrentBlock();
}
示例8: show
function show()
{
global $lng, $tree;
$tpl = new ilTemplate("tpl.container_link_help.html", true, true, "Services/Container");
$type_ordering = array("cat", "fold", "crs", "icrs", "icla", "grp", "chat", "frm", "lres", "glo", "webr", "file", "exc", "tst", "svy", "mep", "qpl", "spl");
$childs = $tree->getChilds($_GET["ref_id"]);
foreach ($childs as $child) {
if (in_array($child["type"], array("lm", "dbk", "sahs", "htlm"))) {
$cnt["lres"]++;
} else {
$cnt[$child["type"]]++;
}
}
$tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
$tpl->setVariable("TXT_HELP_HEADER", $lng->txt("help"));
foreach ($type_ordering as $type) {
$tpl->setCurrentBlock("row");
$tpl->setVariable("ROWCOL", "tblrow" . ($i++ % 2 + 1));
if ($type != "lres") {
$tpl->setVariable("TYPE", $lng->txt("objs_" . $type) . " (" . (int) $cnt[$type] . ")");
} else {
$tpl->setVariable("TYPE", $lng->txt("learning_resources") . " (" . (int) $cnt["lres"] . ")");
}
$tpl->setVariable("TXT_LINK", "[list-" . $type . "]");
$tpl->parseCurrentBlock();
}
$tpl->show();
exit;
}
示例9: insert
public function insert($a_tpl)
{
$tpl = new ilTemplate('tpl.mail_new_attachments.html', true, true, 'Services/Mail');
foreach ($this->items as $item) {
$tpl->setCurrentBlock('attachment_list_item');
$tpl->setVariable('ATTACHMENT_LABEL', $item);
$tpl->parseCurrentBlock();
}
$tpl->setVariable('ATTACHMENT_BUTTON_LABEL', $this->buttonLabel);
$a_tpl->setCurrentBlock("prop_generic");
$a_tpl->setVariable("PROP_GENERIC", $tpl->get());
$a_tpl->parseCurrentBlock();
}
示例10: fillTreeTemplate
public function fillTreeTemplate()
{
$emptyOnLoad = false;
$nodes_to_request = $_SESSION['frm'][(int) $this->topic->getId()]['openTreeNodes'];
if (!$_SESSION['frm'][(int) $this->topic->getId()]['openTreeNodes'] || count($_SESSION['frm'][(int) $this->topic->getId()]['openTreeNodes']) == 1 && $_SESSION['frm'][(int) $this->topic->getId()]['openTreeNodes'][0] == 0) {
$emptyOnLoad = true;
$nodes_to_request = array();
}
$objects = $this->topic->getNestedSetPostChildren(null, $nodes_to_request);
$counter = 0;
$onloadNodes = array();
$nodesFetchedWithChildren = array();
$frm = new ilForum();
$pageHits = $frm->getPageHits();
include_once 'Services/JSON/classes/class.ilJsonUtil.php';
foreach ($objects as $object) {
if ($object['pos_pk'] != $this->root_id && !in_array($object['parent_pos'], $onloadNodes)) {
continue;
}
if (in_array((int) $object['parent_pos'], $onloadNodes) && !in_array((int) $object['parent_pos'], $nodesFetchedWithChildren)) {
$nodesFetchedWithChildren[] = (int) $object['parent_pos'];
}
$html = self::getTreeNodeHtml($object, $this->gui, $pageHits);
$hasChildren = $object['children'] >= 1;
$node = new stdClass();
$node->html = $html;
if ($object['pos_pk'] == $this->root_id) {
$this->tpl->setVariable('FRM_TREE_ROOT_NODE_VARIABLE', 'frmNode' . $object['pos_pk']);
$this->tpl->setVariable('FRM_TREE_ROOT_NODE_LINK', ilJsonUtil::encode($node));
$this->tpl->setVariable('FRM_TREE_ROOT_NODE_HAS_CHILDREN', $hasChildren ? 'true' : 'false');
} else {
$this->tpl->setCurrentBlock('frm_nodes');
$this->tpl->setVariable('FRM_NODES_VARNAME', 'frmNode' . $object['pos_pk']);
$this->tpl->setVariable('FRM_NODES_PARENT_VARNAME', 'frmNode' . $object['parent_pos']);
$this->tpl->setVariable('FRM_NODES_LINK', ilJsonUtil::encode($node));
$this->tpl->setVariable('FRM_NODES_HAS_CHILDREN', $hasChildren ? 'true' : 'false');
$this->tpl->parseCurrentBlock();
}
$onloadNodes[] = (int) $object['pos_pk'];
++$counter;
}
$this->tpl->setVariable('THR_ONLOAD_NODES', ilJsonUtil::encode($onloadNodes));
$this->tpl->setVariable('THR_ONLOAD_NODES_FETCHED_WITH_CHILDREN', ilJsonUtil::encode($nodesFetchedWithChildren));
if ($emptyOnLoad) {
$this->tpl->setVariable('THR_OPEN_NODES', ilJsonUtil::encode($onloadNodes));
$_SESSION['frm'][(int) $this->topic->getId()]['openTreeNodes'] = array_unique(array_merge(array(0), $onloadNodes));
} else {
$this->tpl->setVariable('THR_OPEN_NODES', ilJsonUtil::encode($_SESSION['frm'][(int) $this->topic->getId()]['openTreeNodes']));
}
}
示例11: render
/**
* Overwritten method from ilNumberInputGUI. This method is primarily used
* to make use of a different template.
*
* @global type $lng
* @return type
*/
public function render()
{
global $lng;
// own template (the number is aligned left)
$tpl = new ilTemplate("tpl.room_prop_number.html", true, true, "Customizing/global/plugins/Services/Repository/RepositoryObject/RoomSharing");
if (strlen($this->getValue())) {
$tpl->setCurrentBlock("prop_number_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
$tpl->parseCurrentBlock();
}
$tpl->setCurrentBlock("prop_number");
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("ID", $this->getFieldId());
$tpl->setVariable("SIZE", $this->getSize());
$tpl->setVariable("MAXLENGTH", $this->getMaxLength());
if (strlen($this->getSuffix())) {
$tpl->setVariable("INPUT_SUFFIX", $this->getSuffix());
}
if ($this->getDisabled()) {
$tpl->setVariable("DISABLED", " disabled=\"disabled\"");
}
// constraints
if ($this->areDecimalsAllowed() && $this->getDecimals() > 0) {
$constraints = $lng->txt("form_format") . ": ###." . str_repeat("#", $this->getDecimals());
$delim = ", ";
}
if ($this->getMaxValue() !== false) {
$constraints .= $delim . $lng->txt("rep_robj_xrs_at_most") . ": " . ($this->maxvalueShouldBeLess() ? "< " : "") . $this->getMaxValue();
$delim = ", ";
}
// append the constraint-text at the end of the input, if given
if ($constraints !== "") {
$tpl->setVariable("TXT_NUMBER_CONSTRAINTS", $constraints);
}
$tpl->parseCurrentBlock();
return $tpl->get();
}
示例12: configure
/**
* Configure screen
*/
public function configure()
{
$form = new ilCertificateConfigFormGUI($this);
$form->fillForm();
$ftpl = new ilTemplate('tpl.config_form.html', true, true, $this->pl->getDirectory());
$ftpl->setVariable("FORM", $form->getHTML());
$ftpl->setVariable("TXT_USE_PLACEHOLDERS", $this->pl->txt('txt_use_placeholders'));
foreach (srCertificateStandardPlaceholders::getStandardPlaceholders() as $placeholder => $text) {
$ftpl->setCurrentBlock("placeholder");
$ftpl->setVariable("PLACEHOLDER", $placeholder);
$ftpl->setVariable("TXT_PLACEHOLDER", $text);
$ftpl->parseCurrentBlock();
}
$this->tpl->setContent($ftpl->get());
}
示例13: render
/**
* Render output
*/
function render()
{
global $lng;
$tpl = new ilTemplate("tpl.prop_captchainput.html", true, true, "Services/Captcha");
if (strlen($this->getValue())) {
$tpl->setCurrentBlock("prop_text_propval");
$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
$tpl->parseCurrentBlock();
}
include_once "./Services/Captcha/classes/class.ilSecurImageUtil.php";
$tpl->setVariable("IMAGE_SCRIPT", ilSecurImageUtil::getImageScript());
$tpl->setVariable("POST_VAR", $this->getPostVar());
$tpl->setVariable("TXT_CONSTR_PROP", $lng->txt("cont_constrain_proportions"));
// $GLOBALS["tpl"]->addJavascript("./Services/MediaObjects/js/ServiceMediaObjectPropWidthHeight.js");
return $tpl->get();
}
示例14: listSkillChanges
/**
* List skill changes
*/
function listSkillChanges()
{
global $tpl, $ilToolbar, $lng, $ilCtrl;
include_once "./Modules/Survey/classes/class.ilSurveySkillChangesTableGUI.php";
// $ilToolbar->addButton($lng->txt("survey_write_skills"),
// $ilCtrl->getLinkTarget($this, "writeSkills"));
$apps = $this->survey->getAppraiseesData();
$ctpl = new ilTemplate("tpl.svy_skill_list_changes.html", true, true, "Modules/Survey");
foreach ($apps as $app) {
$changes_table = new ilSurveySkillChangesTableGUI($this, "listSkillChanges", $this->survey, $app);
$ctpl->setCurrentBlock("appraisee");
$ctpl->setVariable("LASTNAME", $app["lastname"]);
$ctpl->setVariable("FIRSTNAME", $app["firstname"]);
$ctpl->setVariable("CHANGES_TABLE", $changes_table->getHTML());
$ctpl->parseCurrentBlock();
}
$tpl->setContent($ctpl->get());
}
示例15: insert
/**
* @param ilTemplate $tpl
*/
public function insert(ilTemplate $tpl)
{
/**
* @var $lng ilLanguage
*/
global $lng;
$local_tpl = new ilTemplate('tpl.prop_tos_signed_document.html', true, true, 'Services/TermsOfService');
require_once 'Services/UIComponent/Modal/classes/class.ilModalGUI.php';
$modal = ilModalGUI::getInstance();
$modal->setHeading($lng->txt('tos_agreement_document'));
$modal->setId('accepted_tos_' . $this->entity->getUserId());
$modal->setBody($this->entity->getText());
require_once 'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
$local_tpl->setVariable('MODAL_TRIGGER_HTML', ilGlyphGUI::get(ilGlyphGUI::SEARCH));
$local_tpl->setVariable('MODAL', $modal->getHTML());
$local_tpl->setVariable('MODAL_ID', 'accepted_tos_' . $this->entity->getUserId());
$tpl->setCurrentBlock('prop_generic');
$tpl->setVariable('PROP_GENERIC', $local_tpl->get());
$tpl->parseCurrentBlock();
}