function loadTemplateFile($filename, $removeUnknownVariables = true, $removeEmptyBlocks = true) { $this->mapCustomizing($filename); $return = parent::loadTemplateFile($filename, $removeUnknownVariables, $removeEmptyBlocks); $this->unmapCustomizing(); return $return; }
function _renderForm(&$page) { $pageName = $page->getAttribute('name'); $tabPreview = array_slice($page->controller->_tabs, -2, 1); // can use either HTML_Template_Sigma or HTML_Template_ITX $tpl = new HTML_Template_Sigma('.', 'cache/'); $tpl->loadTemplateFile('itdynamic.html'); // on preview tab, add progress bar javascript and stylesheet if ($pageName == $tabPreview[0][0]) { $pb = $page->controller->createProgressBar(); $tpl->setVariable(array('qf_style' => $pb->getStyle(), 'qf_script' => $pb->getScript())); $pbElement = $page->getElement('progressBar'); $pbElement->setText($pb->toHtml() . '<br /><br />'); } $renderer = new HTML_QuickForm_Renderer_ITDynamic($tpl); $renderer->setElementBlock(array('buttons' => 'qf_buttons')); $page->accept($renderer); $tpl->show(); }
<table{class}> <!-- BEGIN label_2 --><tr><th>{label_2}</th><!-- END label_2 --> <!-- BEGIN label_3 --><th> </th><th>{label_3}</th></tr><!-- END label_3 --> <tr> <td valign="top">{unselected}</td> <td align="center">{add}{remove}</td> <td valign="top">{selected}</td> </tr> </table> '; $ams->setElementTemplate($template); if (isset($_POST['fruit'])) { $form->setDefaults(array('fruit' => $_POST['fruit'])); } $form->addElement('submit', 'send', 'Send', array('class' => 'inputCommand')); $form->addRule('name', 'Your name is required', 'required'); $form->addGroupRule('fruit', 'At least one fruit is required', 'required', null, 1); $form->applyFilter('__ALL__', 'trim'); $form->applyFilter('__ALL__', 'strip_tags'); $valid = $form->validate(); $tpl = new HTML_Template_Sigma('.'); $tpl->loadTemplateFile('itdynamic.html'); $tpl->setVariable('ams_javascript', $ams->getElementJs(false)); $renderer = new HTML_QuickForm_Renderer_ITDynamic($tpl); $form->accept($renderer); if ($valid) { $clean = $form->getSubmitValues(); $msg = sprintf("<p>Welcome <b>%s</b> you've selected these fruits:<br />%s</p>", $clean['name'], implode(', ', $clean['fruit'])); $tpl->setVariable('message_form_validate', $msg); } $tpl->show();
/** * loadTemplateFile() * * @access public * @param string $sTemplateFile * @return void */ function loadTemplateFile($sTemplateFile) { $this->_bTemplateCacheExpire = parent::_isCached($sTemplateFile); parent::loadTemplateFile($sTemplateFile); }
/** * "Proxy" del metodo en sigma, solo agrega el nombre del actualmente procesado * por el tema de usar cache "full" * @see HTML_Template_Sigma::loadTemplateFile() */ function loadTemplateFile($filename, $removeUnknownVariables = true, $removeEmptyBlocks = true) { $this->_templateFileName = $filename; return parent::loadTemplateFile($filename, $removeUnknownVariables, $removeEmptyBlocks); }
private function getTreeCode() { if (count($this->arrMigrateLangIds) === 1) { return true; } $jsSimilarPages = array(); $this->similarPages = $this->findSimilarPages(); foreach ($this->similarPages as $nodeId => $arrPageIds) { $jsSimilarPages[$nodeId] = array_values($arrPageIds); foreach ($this->arrMigrateLangIds as $migrateLangId) { if (!isset($arrPageIds[$migrateLangId])) { $this->similarPages[$nodeId][$migrateLangId] = 0; } } ksort($this->similarPages[$nodeId]); } $objCx = \ContrexxJavascript::getInstance(); $objCx->setVariable('similarPages', json_encode($jsSimilarPages), 'update/contentMigration'); $objTemplate = new \HTML_Template_Sigma(UPDATE_TPL); $objTemplate->setErrorHandling(PEAR_ERROR_DIE); $objTemplate->loadTemplateFile('page_grouping.html'); $groupedBorderWidth = count($this->arrMigrateLangIds) * 325 - 48; $objTemplate->setGlobalVariable(array('USERNAME' => $_SESSION['contrexx_update']['username'], 'PASSWORD' => $_SESSION['contrexx_update']['password'], 'CMS_VERSION' => $_SESSION['contrexx_update']['version'], 'MIGRATE_LANG_IDS' => $this->migrateLangIds, 'LANGUAGE_WRAPPER_WIDTH' => 'width: ' . count($this->arrMigrateLangIds) * 330 . 'px;', 'GROUPED_SCROLL_WIDTH' => 'width: ' . count($this->arrMigrateLangIds) * 325 . 'px;', 'GROUPED_BORDER_WIDTH' => 'width: ' . $groupedBorderWidth . 'px;')); $cl = \Env::get('ClassLoader'); $cl->loadFile(ASCMS_CORE_PATH . '/Tree.class.php'); $cl->loadFile(UPDATE_CORE . '/UpdateTree.class.php'); $pageRepo = self::$em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page'); $nodeRepo = self::$em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Node'); foreach ($this->arrMigrateLangIds as $lang) { $objContentTree = new \UpdateContentTree($lang); foreach ($objContentTree->getTree() as $arrPage) { $pageId = $arrPage['catid']; $nodeId = $arrPage['node_id']; $langId = $arrPage['lang']; $level = $arrPage['level']; $title = $arrPage['catname']; $sort = $nodeRepo->find($nodeId)->getLft(); $grouped = $this->isGrouppedPage($this->similarPages, $pageId) ? 'grouped' : ''; $objTemplate->setVariable(array('TITLE' => $title, 'ID' => $pageId, 'NODE' => $nodeId, 'LANG' => strtoupper(\FWLanguage::getLanguageCodeById($langId)), 'LEVEL' => $level + 1, 'SORT' => $sort, 'GROUPED' => $grouped, 'MARGIN' => 'margin-left: ' . $level * 15 . 'px;')); $objTemplate->parse('page'); } $langFull = \FWLanguage::getLanguageParameter($lang, 'name'); $langShort = strtoupper(\FWLanguage::getLanguageParameter($lang, 'lang')); $objTemplate->setVariable(array('LANG_FULL' => $langFull, 'LANG_SHORT' => $langShort)); $objTemplate->parse('language'); } $groupedBorderWidth -= 2; foreach ($this->similarPages as $nodeId => $arrPageIds) { $node = $nodeRepo->find($nodeId); $margin = ($node->getLvl() - 1) * 15; $nodeWidth = $groupedBorderWidth - $margin; $width = ($groupedBorderWidth - 10) / count($this->arrMigrateLangIds); $index = 0; $last = count($arrPageIds) - 1; foreach ($arrPageIds as $pageLangId => $pageId) { if ($index === 0) { $pageWidth = $width - 24; } elseif ($index === $last) { $pageWidth = $width - $margin; } else { $pageWidth = $width; } $index++; $page = $pageRepo->find($pageId); if ($page) { $langCode = strtoupper(\FWLanguage::getLanguageCodeById($page->getLang())); $objTemplate->setVariable(array('CLASS' => '', 'DATA_ID' => 'data-id="' . $pageId . '"', 'DATA_LANG' => 'data-lang="' . $langCode . '"', 'TITLE' => $page->getTitle(), 'LANG' => $langCode, 'WIDTH' => 'width: ' . $pageWidth . 'px;')); } else { $langCode = strtoupper(\FWLanguage::getLanguageCodeById($pageLangId)); $objTemplate->setVariable(array('CLASS' => 'no-page', 'DATA_ID' => '', 'DATA_LANG' => '', 'TITLE' => 'Keine Seite', 'LANG' => $langCode, 'WIDTH' => 'width: ' . $pageWidth . 'px;')); } $objTemplate->parse('groupedPage'); } $objTemplate->setVariable(array('ID' => $nodeId, 'LEVEL' => $node->getLvl(), 'SORT' => $node->getLft(), 'STYLE' => 'width: ' . $nodeWidth . 'px; margin-left: ' . $margin . 'px;')); $objTemplate->parse('groupedNode'); } return $objTemplate->get(); }
$basePath = realpath(dirname(__FILE__)); if (!@(include_once $basePath . '/config/config.php')) { die('Unable to load file ' . $basePath . '/config/config.php'); } require_once $basePath . '/classloader.inc.php'; @header('content-type: text/html; charset=' . ($useUtf8 ? 'UTF-8' : 'ISO-8859-1')); if (!@(include_once ASCMS_LIBRARY_PATH . '/PEAR/HTML/Template/Sigma/Sigma.php')) { die('Unable to load file ' . ASCMS_LIBRARY_PATH . '/PEAR/HTML/Template/Sigma/Sigma.php'); } if (!@(include_once $basePath . '/common.class.php')) { die('Unable to load file ' . $basePath . '/common.class.php'); } if (!@(include_once $basePath . '/installer.class.php')) { die('Unable to load file ' . $basePath . '/installer.class.php'); } if (!@(include_once $basePath . '/../core/Env.class.php')) { die('Unable to load file ' . $basePath . '/../core/Env.class.php'); } $objCommon = new CommonFunctions(); $objInstaller = new Installer(); $objCommon->initLanguage(); $objTpl = new HTML_Template_Sigma($templatePath); $objTpl->setErrorHandling(PEAR_ERROR_DIE); $objTpl->loadTemplateFile('index.html'); $objTpl->setVariable('CHARSET', $useUtf8 ? 'UTF-8' : 'ISO-8859-1'); $objTpl->setVariable($_ARRLANG); $objInstaller->checkOptions(); $objInstaller->getNavigation(); $objInstaller->getPage(); $objInstaller->getContentNavigation(); $objTpl->show();
/** * Loads a template file based on $this->parseMode and $this->dirname * @param string $filename Template base filename * @return \HTML_Template_Sigma Requested template */ protected function getTemplateFile($filename) { $template = new \HTML_Template_Sigma($this->dirname . '/View/Template/Global'); $template->loadTemplateFile($filename . strtoupper($this->parseMode) . '.html'); return $template; }