/** * cria template para a propria classe usar * @access private * @return patTemplate */ function &_createTemplate() { global $option, $mosConfig_absolute_path; if (defined('_VALID_MOS')) { require_once $mosConfig_absolute_path . '/includes/patTemplate/patTemplate.php'; $tmpl =& patFactory::createTemplate(); $tmpl->setRoot(dirname(__FILE__) . '/templates'); } else { require_once $this->classSelfPath . '/classes/pat/patErrorManager.php'; require_once $this->classSelfPath . '/classes/pat/patTemplate.php'; $tmpl = new patTemplate(); $tmpl->setNamespace("mos"); } $this->_objTmpl = $tmpl; return $tmpl; }
/** * @param array An array of additional files to include from the root folder * @return object */ function &createTemplate($files = null) { global $mainframe; $tmpl = new patTemplate(); // patTemplate if ($GLOBALS['mosConfig_caching']) { $tmpl->useTemplateCache('File', array('cacheFolder' => $GLOBALS['mosConfig_cachepath'], 'lifetime' => 20)); } $tmpl->setNamespace('mos'); // load the wrapper and common templates $tmpl->setRoot(dirname(__FILE__) . '/tmpl'); $tmpl->readTemplatesFromFile('page.html'); $tmpl->applyInputFilter('ShortModifiers'); if (is_array($files)) { foreach ($files as $file) { $tmpl->readTemplatesFromInput($file); } } //echo $this->basePath() . '/components/' . $option . '/tmpl'; $tmpl->addGlobalVar('option', $GLOBALS['option']); $tmpl->addGlobalVar('self', $_SERVER['PHP_SELF']); $tmpl->addGlobalVar('itemid', $GLOBALS['Itemid']); $tmpl->addGlobalVar('siteurl', $GLOBALS['mosConfig_live_site']); $tmpl->addGlobalVar('adminurl', $GLOBALS['mosConfig_live_site'] . '/administrator'); $tmpl->addGlobalVar('templateurl', $GLOBALS['mosConfig_live_site'] . '/templates/' . $mainframe->getTemplate()); $tmpl->addGlobalVar('admintemplateurl', $GLOBALS['mosConfig_live_site'] . '/administrator/templates/' . $mainframe->getTemplate()); $tmpl->addGlobalVar('sitename', $GLOBALS['mosConfig_sitename']); $tmpl->addGlobalVar('treecss', 'dtree.css'); $tmpl->addGlobalVar('treeimgfolder', 'img'); $iso = split('=', _ISO); $tmpl->addGlobalVar('page_encoding', $iso[1]); $tmpl->addGlobalVar('version_copyright', $GLOBALS['_VERSION']->COPYRIGHT); $tmpl->addGlobalVar('version_url', $GLOBALS['_VERSION']->URL); $tmpl->addVar('form', 'formAction', $_SERVER['PHP_SELF']); $tmpl->addVar('form', 'formName', 'adminForm'); // tabs $turl = $GLOBALS['mosConfig_live_site'] . '/includes/js/tabs/'; $tmpl->addVar('includeTabs', 'taburl', $turl); return $tmpl; }
function buildCFGFile($cacic_config) { $oTmpl = new patTemplate(); $oTmpl->setNamespace('cacicInstall'); $oTmpl->setRoot('templates'); $oTmpl->readTemplatesFromInput('install_navbar.tmpl'); $oTmpl->addVar('tmplCFGFile', 'cacic_path', addslashes(CACIC_PATH)); $oTmpl->addVar('tmplCFGFile', 'CACIC_URL', CACIC_URL); $oTmpl->addVar('tmplCFGFile', 'DB_SERVER', $cacic_config['db_host']); $oTmpl->addVar('tmplCFGFile', 'DB_PORT', $cacic_config['db_port']); $oTmpl->addVar('tmplCFGFile', 'DB_NAME', $cacic_config['db_name']); $oTmpl->addVar('tmplCFGFile', 'DB_USER', $cacic_config['db_user']); $oTmpl->addVar('tmplCFGFile', 'DB_USER_PASS', $cacic_config['db_pass']); $oTmpl->addVar('tmplCFGFile', 'CACIC_KEY', CACIC_KEY); $oTmpl->addVar('tmplCFGFile', 'CACIC_IV', CACIC_IV); $oTmpl->addVar('tmplCFGFile', 'CACIC_LANGUAGE', $_SESSION['cacic_language']); $oTmpl->addVar('tmplCFGFileCab', 'show_path', CACIC_PATH); $oTmpl->addVar('tmplCFGFileCab', 'cacic_ds', CACIC_DS); $oTmpl->displayParsedTemplate('tmplCFGFile'); }