/** * Render smarty template for form object * * @param EasyForm $formObj * @param string $tplFile * @return string result of rendering process */ protected static function renderSmarty($formObj, $tplFile) { $smarty = BizSystem::getSmartyTemplate(); $smarty->assign("formname", $formObj->m_Name); $smarty->assign("module", $formObj->getModuleName($formObj->m_Name)); $smarty->assign("title", $formObj->m_Title); $smarty->assign("errors", $formObj->m_Errors); $smarty->assign("notices", $formObj->m_Notices); // if the $formobj form type is list render table, otherwise render record if ($formObj->m_FormType == 'LIST') { $recordSet = $formObj->fetchDataSet(); $smarty->assign("dataPanel", $formObj->m_DataPanel->renderTable($recordSet)); } else { $record = $formObj->fetchData(); $smarty->assign("dataPanel", $formObj->m_DataPanel->renderRecord($record)); } // render the formobj attributes $smarty->assign("form", $formObj->outputAttrs()); $smarty->assign("actionPanel", $formObj->m_ActionPanel->render()); $smarty->assign("navPanel", $formObj->m_NavPanel->render()); if (isset($formObj->m_SearchPanel)) { foreach ($formObj->m_SearchPanel as $elem) { if (!$elem->m_FieldName) { continue; } $search_record[$elem->m_FieldName] = BizSystem::clientProxy()->getFormInputs($elem->m_Name); } $smarty->assign("searchPanel", $formObj->m_SearchPanel->renderRecord($search_record)); } return $smarty->fetch($tplFile); }
/** * Render smarty template for view object * * @param EasyView $viewObj * @param string $tplFile * @return string result of rendering process */ protected static function renderSmarty($viewObj, $tplFile) { $smarty = BizSystem::getSmartyTemplate(); $newClntObjs = ''; // render the viewobj attributes $smarty->assign("view", $viewObj->outputAttrs()); $smarty->assign("module", $viewObj->getModuleName($viewObj->m_Name)); if ($viewObj->m_Tiles) { foreach ($viewObj->m_Tiles as $tname => $tile) { foreach ($tile as $formRef) { if ($formRef->m_Display == false) { continue; } $tiles[$tname][$formRef->m_Name] = BizSystem::getObject($formRef->m_Name)->render(); $tiletabs[$tname][$formRef->m_Name] = $formRef->m_Description; } } } else { foreach ($viewObj->m_FormRefs as $formRef) { if ($formRef->m_Display == false) { continue; } $forms[$formRef->m_Name] = BizSystem::getObject($formRef->m_Name)->render(); $formtabs[$formRef->m_Name] = $formRef->m_Description; } } // add clientProxy scripts $includedScripts = BizSystem::clientProxy()->getAppendedScripts(); $styles = BizSystem::clientProxy()->getAppendedStyles(); if ($viewObj->m_IsPopup && $bReRender == false) { $moveToCenter = "moveToCenter(self, " . $viewObj->m_Width . ", " . $viewObj->m_Height . ");"; $scripts = $includedScripts . "\n<script>\n" . $newClntObjs . $moveToCenter . "</script>\n"; } else { $scripts = $includedScripts . "\n<script>\n" . $newClntObjs . "</script>\n"; } if ($viewObj->m_Title) { $title = Expression::evaluateExpression($viewObj->m_Title, $viewObj); } else { $title = $viewObj->m_Description; } $smarty->assign("scripts", $scripts); $smarty->assign("style_sheets", $styles); $smarty->assign("title", $title); $smarty->assign("description", $viewObj->m_Description); $smarty->assign("keywords", $viewObj->m_Keywords); $smarty->assign("forms", $forms); $smarty->assign("formtabs", $formtabs); $smarty->assign("tiles", $tiles); $smarty->assign("tiletabs", $tiletabs); if ($viewObj->m_ConsoleOutput) { $smarty->display(BizSystem::getTplFileWithPath($viewObj->m_TemplateFile, $viewObj->m_Package)); } else { return $smarty->fetch(BizSystem::getTplFileWithPath($viewObj->m_TemplateFile, $viewObj->m_Package)); } }
/** * Render smarty template for widget object * * @param MenuWidget $widgetObj * @param string $tplFile * @return string result of rendering process */ protected static function renderSmarty($widgetObj, $tplFile) { $smarty = BizSystem::getSmartyTemplate(); $attrs = $widgetObj->outputAttrs(); $smarty->assign("widget", $attrs); // todo: no need $smarty->assign("form", $attrs); $smarty->assign("formname", $widgetObj->m_Name); $smarty->assign("module", $widgetObj->getModuleName($widgetObj->m_Name)); $smarty->assign("title", $widgetObj->m_Title); $smarty->assign("errors", $widgetObj->m_Errors); $smarty->assign("notices", $widgetObj->m_Notices); return $smarty->fetch($tplFile); }
/** * render the report output * * @param string $objName object name which is the bizform name * @return void */ public function render($objName) { // get the current UI bizobj $bizform = BizSystem::getObject($objName); // get the existing bizform object $bizobj = $bizform->getDataObj(); $h = opendir($this->m_targetReportPath); if (!$h) { echo "cannot read dir " . $this->m_targetReportPath; exit; } // create a tmp csv file for hold the data, then feed csv file to report engine $uid = $this->getUniqueString(); $tmpfname = $this->m_targetReportPath . $uid . ".csv"; //echo "csv file is at $tmpfname.<br>"; $fp = fopen($tmpfname, 'w'); $keyList = $bizform->m_RecordRow->GetSortControlKeys(); $fieldNames = array(); foreach ($keyList as $key) { $fieldNames[] = $bizform->GetControl($key)->m_BizFieldName; } fputcsv($fp, $fieldNames); $recList = $bizobj->directFetch(); foreach ($recList as $recArray) { unset($fieldValues); $fieldValues = array(); $line = ""; foreach ($keyList as $key) { $fieldValues[] = $recArray[$bizform->GetControl($key)->m_BizFieldName]; } fputcsv($fp, $fieldValues); } fclose($fp); $i = 0; foreach ($keyList as $key) { $rpt_fields[$i]["name"] = $bizform->GetControl($key)->m_BizFieldName; $rpt_fields[$i]["type"] = $bizobj->getField($rpt_fields[$i]["name"])->m_Type; $i++; } // dataobj.rptdesign.tpl // $rpt_data_dir, $rpt_title, $rpt_csv_file, $rpt_fields[](name,type) $smarty = BizSystem::getSmartyTemplate(); $smarty->assign("rpt_data_dir", $this->m_targetReportPath); $smarty->assign("rpt_title", $bizform->m_Title); $smarty->assign("rpt_csv_file", basename($tmpfname)); $smarty->assign("rpt_fields", $rpt_fields); $reportContent = $smarty->fetch($this->m_rptTemplate); $tmpRptDsgn = $this->m_targetReportPath . $uid . ".rptdesign"; //echo "temp rpt design file is at $tmpRptDsgn.<br>"; $fp = fopen($tmpRptDsgn, 'w'); fwrite($fp, $reportContent); fclose($fp); ob_clean(); $designFileName = $uid . ".rptdesign"; $content = "<div style='font-family:Arial; font-size:12px; background-color:#FCFCFC;'>"; $content .= "Reports can be viewed as "; $content .= "<li><a href='" . $this->m_birtViewer . "/run?__report=report\\{$designFileName}' target='__blank'>HTML report</a></li>"; $content .= "<li><a href='" . $this->m_birtViewer . "/run?__report=report\\{$designFileName}&__format=pdf' target='__blank'>PDF report</a></li>"; $content .= "<li><a href='" . $this->m_birtViewer . "/frameset?__report=report\\{$designFileName}' target='__blank'>Interactive report</a></li>"; $content .= "</div>"; echo $content; exit; }
/** * Render this view. This function is called by Render() or ReRender() * * @return mixed either print html content or return html content if called by Render(), or void if called by ReRender() */ protected function _render($bReRender = false, $smarty = false) { if ($smarty == false) { $smarty = BizSystem::getSmartyTemplate(); } global $g_BizSystem; if ($bReRender == false) { $this->setClientScripts(); } // todo: should enforce rendering parent form before rendering subforms, // because subform's dataobj is a objreference of the parent dataobj. foreach ($this->m_ChildFormList as $form => $formobj) { if ($bReRender) { if (BizSystem::clientProxy()->hasFormRerendered($form) == false) { $formobj->rerender(); } $sHTML = BizSystem::clientProxy()->GetFormOutput($form); } $sHTML = $formobj->render(); $htmlStyle = $this->_getHTMLStyle($formobj); //Modification: html attribute added to set the initial style for a form //Add: Next 5 lines was added for get the initial style from a form and after set it in bizview --jmmz $style = $formobj->m_Style ? Expression::evaluateExpression($formobj->m_Style, $formobj) : ''; $htmlStyle = ""; //jmmz if (!empty($style) && !is_null($style)) { //jmmz $htmlStyle = "style='{$style}'"; //jmmz } //jmmz //Modification: html attribute added to set the initial style for a form --jmmz $controls[] = "\n<div id='" . $formobj->m_Name . "_container' {$htmlStyle}>\n" . $sHTML . "\n</div>\n"; $forms[str_replace(".", "_", $formobj->m_Name)] = "\n<div id='" . $formobj->m_Name . "_container'>\n" . $sHTML . "\n</div>\n"; if (isset($formobj->m_jsClass)) { $newClntObjs .= "NewObject('" . $formobj->m_Name . "','" . $formobj->m_jsClass . "'); \n"; } //$newClntObjs .= "var fobj=GetObject('".$formobj->m_Name."');\n"; } // add clientProxy scripts if ($bReRender == false) { $includedScripts = BizSystem::clientProxy()->getAppendedScripts(); $styles = BizSystem::clientProxy()->getAppendedStyles(); } if ($this->m_IsPopup && $bReRender == false) { $moveToCenter = "moveToCenter(self, " . $this->m_Width . ", " . $this->m_Height . ");"; $scripts = $includedScripts . "\n<script>\n" . $newClntObjs . $moveToCenter . "</script>\n"; } else { $scripts = $includedScripts . "\n<script>\n" . $newClntObjs . "</script>\n"; } $smarty->assign("scripts", $scripts); $smarty->assign("style_sheets", $styles); $smarty->assign_by_ref("view_description", $this->m_Description); $smarty->assign_by_ref("controls", $controls); $smarty->assign_by_ref("forms", $forms); if ($this->m_ConsoleOutput) { $smarty->display(BizSystem::getTplFileWithPath($this->m_Template, $this->m_Package)); } else { return $smarty->fetch(BizSystem::getTplFileWithPath($this->m_Template, $this->m_Package)); } }
/** * Render smarty template for form object * * @param EasyForm $formObj * @param string $tplFile * @return string result of rendering process */ protected static function renderSmarty($formObj, $tplAttributes = array()) { $smarty = BizSystem::getSmartyTemplate(); $tplFile = BizSystem::getTplFileWithPath($formObj->m_TemplateFile, $formObj->m_Package); //Translate Array of template variables to Zend template object //print_r($tplAttributes); foreach ($tplAttributes as $key => $value) { $smarty->assign($key, $value); } return $smarty->fetch($tplFile); }
/** * Render smarty template for view object * * @param EasyView $viewObj * @param string $tplFile * @return string result of rendering process */ protected static function renderSmarty($viewObj, $tplAttributes = array()) { $smarty = BizSystem::getSmartyTemplate(); $viewOutput = $viewObj->outputAttrs(); foreach ($viewOutput as $k => $v) { $smarty->assign($k, $v); } // render the formobj attributes $smarty->assign("view", $viewOutput); //Translate Array of template variables to Zend template object foreach ($tplAttributes as $key => $value) { $smarty->assign($key, $value); } $tpl = $_REQUEST['partial'] ? $viewObj->m_TemplateFile : $viewObj->m_PageTemplate; if ($viewObj->m_ConsoleOutput) { $smarty->display(BizSystem::getTplFileWithPath($tpl, $viewObj->m_Package)); } else { return $smarty->fetch(BizSystem::getTplFileWithPath($tpl, $viewObj->m_Package)); } }
/** * Render html content of this form * * @return string - HTML text of this form's read mode */ protected function renderHTML() { // TODO: need to consider history into the searchrule //echo "History:"; //print_r($this->m_HistoryInfo); if ($this->_directParentId) { $this->setSearchRule("[PId] = '" . $this->_directParentId . "'"); } else { $root_searchRule = $this->getParameter("Root_SearchRule"); if (!$root_searchRule) { $this->setSearchRule("[PId] = '' or [PId] is NULL"); } else { $this->setSearchRule($root_searchRule); } } $this->m_ClearSearchRule = true; $dispmode = $this->GetDisplayMode(); $this->SetDisplayMode($dispmode->GetMode()); $smarty = BizSystem::getSmartyTemplate(); $smarty->assign_by_ref("name", $this->m_Name); $smarty->assign_by_ref("title", $this->m_Title); $smarty->assign_by_ref("toolbar", $this->m_ToolBar->render()); if ($dispmode->m_DataFormat == "array") { // if dataFormat is array, call array render function $smarty->assign_by_ref("fields", $this->renderArray()); } else { if ($dispmode->m_DataFormat == "table") { // if dataFormat is table, call table render function. $smarty->assign_by_ref("table", $this->renderTable()); } else { if ($dispmode->m_DataFormat == "block" && $dispmode->m_FormatStyle) { $smarty->assign_by_ref("block", $this->renderFormattedTable()); } } } $smarty->assign_by_ref("navbar", $this->m_NavBar->render()); if (count($this->_parents) == 0) { $rec = $this->getActiveRecord(); if ($rec) { $this->_parents = $this->_getAllLevelParents($rec); } else { $rec = $this->_getNodeRecord($this->_directParentId); $this->_parents = $this->_getAllLevelParents($rec, true); } } $objname = $this->m_Name; $prts_txt = ""; for ($i = count($this->_parents) - 1; $i >= 0; $i--) { $prtid = $this->_parents[$i]['Id']; $prtname = $this->_parents[$i]['Name']; if ($prts_txt == "") { $prts_txt .= "<a href=\"javascript:CallFunction('{$objname}.ListSiblings({$prtid}))')\">{$prtname}</a>"; } else { $prts_txt .= " > <a href=\"javascript:CallFunction('{$objname}.ListSiblings({$prtid}))')\">{$prtname}</a>"; } } $smarty->assign_by_ref("parents_links", $prts_txt); return $smarty->fetch(BizSystem::getTplFileWithPath($dispmode->m_TemplateFile, $this->m_Package)) . "\n" . $this->renderShortcutKeys() . "\n" . $this->renderContextMenu(); }
/** * Generate module information (mod.xml) * * @param string $table_name table name * @return string */ function generateMod($table_name) { echo "Start generate mod.xml." . PHP_EOL; $targetPath = $moduleDir = MODULE_PATH . "/" . getModuleName($this->module); if (!file_exists($targetPath)) { echo "Create directory {$targetPath}" . PHP_EOL; mkdir($targetPath, 0777, true); } $listview_uri = strtolower($table_name) . "_list"; $smarty = BizSystem::getSmartyTemplate(); $smarty->assign_by_ref("module_name", getModuleName($this->module)); $smarty->assign_by_ref("module", $this->module); $smarty->assign_by_ref("listview_uri", $listview_uri); $tpl_file = dirname(__FILE__) . '/' . META_TPL . self::MOD_TEMPLATE; $content = $smarty->fetch($tpl_file); // target file $targetFile = $targetPath . "/mod.xml"; file_put_contents($targetFile, $content); echo "\t" . str_replace(MODULE_PATH, "", $targetFile) . " is generated." . PHP_EOL; return $targetFile; }
/** * Render the wizard view * @return mixed either print html content, or return html content */ public function render($bReRender = false, $smarty = false) { if ($smarty == false) { $smarty = BizSystem::getSmartyTemplate(); } global $g_BizSystem; $this->setClientScripts(); // render progress bar // render only current wizard form, not all forms $formName = $this->GetCurWizardForm(); // ouput the form into the wizard container $sHTML = $this->renderWizardForm($formName, true); $controls[] = "<div id='" . $this->m_Name . "'>" . $sHTML . "</div>\n"; //added by Jixian , Render progress bar and step list bar $sProgressBar = $this->renderProgressBar($bReRender); $sStepListBar = $this->renderStepListBar($bReRender); //Add any required scripts that will be needed in future forms foreach ($this->m_MetaChildFormList as $form) { global $g_BizSystem; $formobj = BizSystem::getObject($form['FORM']); $formobj->SetFieldScripts(); } // add clientProxy scripts if ($bReRender == false) { $smarty->assign("scripts", BizSystem::clientProxy()->getAppendedScripts()); $smarty->assign("style_sheets", BizSystem::clientProxy()->getAppendedStyles()); } $smarty->assign_by_ref("view_description", $this->m_Description); $smarty->assign_by_ref("controls", $controls); //added by Jixian , Render progress bar and step list bar $smarty->assign_by_ref("progress_bar", $sProgressBar); $smarty->assign_by_ref("steplist_bar", $sStepListBar); if ($bReRender) { BizSystem::clientProxy()->redrawForm('steplist_bar', $sStepListBar); BizSystem::clientProxy()->redrawForm('progress_bar', $sProgressBar); } if ($this->m_ConsoleOutput) { $smarty->display(BizSystem::getTplFileWithPath($this->m_Template, $this->m_Package)); } else { return $smarty->fetch(BizSystem::getTplFileWithPath($this->m_Template, $this->m_Package)); } }
/** * BizForm::renderHTML() - render html content of this form * * @return string - HTML text of this form's read mode */ protected function renderHTML($smarty = false) { $dispmode = $this->GetDisplayMode(); $this->SetDisplayMode($dispmode->GetMode()); //Added to support Auto Scripts $this->setClientScripts(); if (!$smarty) { $smarty = BizSystem::getSmartyTemplate(); } //Rendering to support either normal Form on in a window/modal if ($this->_DetectModal($dispmode->m_Name) == TRUE or $this->_DetectWindow($dispmode->m_Name) == TRUE) { $pop_name = $this->m_Name . Popup_Suffix; $smarty->assign_by_ref("name", $pop_name); $temp_toolbar = $this->m_ToolBar->render(); $temp_navbar = $this->m_NavBar->render(); foreach ($temp_toolbar as $key => $val) { $pop_toolbar[$key] = str_replace($this->m_Name, $pop_name, $val); } foreach ($temp_navbar as $key => $val) { $pop_navbar[$key] = str_replace($this->m_Name, $pop_name, $val); } $smarty->assign_by_ref("toolbar", $pop_toolbar); $smarty->assign_by_ref("navbar", $pop_navbar); } else { $smarty->assign_by_ref("name", $this->m_Name); $smarty->assign_by_ref("navbar", $this->m_NavBar->render()); $smarty->assign_by_ref("toolbar", $this->m_ToolBar->render()); } $smarty->assign_by_ref("title", $this->m_Title); $smarty->assign_by_ref("description", $this->m_Description); //added by Jixian if ($dispmode->m_DataFormat == "array") { // if dataFormat is array, call array render function $smarty->assign_by_ref("fields", $this->renderArray()); } else { if ($dispmode->m_DataFormat == "table") { $smarty->assign_by_ref("table", $this->renderTable()); $smarty->assign_by_ref("formobj", $this); } else { if ($dispmode->m_DataFormat == "block" && $dispmode->m_FormatStyle) { $smarty->assign_by_ref("block", $this->renderFormattedTable()); } } } return $smarty->fetch(BizSystem::getTplFileWithPath($dispmode->m_TemplateFile, $this->m_Package)) . "\n" . $this->renderShortcutKeys() . "\n" . $this->renderContextMenu(); }
public function UpdateLangPack($lang, $recArr) { $this->m_RecordID = $lang; $locale = explode('_', $lang); $lang_code = strtolower($locale[0]); //clean up array foreach ($recArr as $key => $value) { $recArr[$key] = addslashes($recArr[$key]); $recArr[$key] = str_replace("\n", '\\n', $recArr[$key]); } //create lang.xml metainfo $smarty = BizSystem::getSmartyTemplate(); $smarty->assign("language", $this->Code2Language($lang_code)); $smarty->assign("lang_code", $lang); $smarty->assign("version", $recArr['version']); $smarty->assign("create_date", $recArr['creationDate']); $smarty->assign("author", $recArr['author']); $smarty->assign("author_email", $recArr['authorEmail']); $smarty->assign("author_url", $recArr['authorUrl']); $smarty->assign("description", $recArr['description']); $data = $smarty->fetch(BizSystem::getTplFileWithPath("lang.xml.tpl", $this->m_Package)); $lang_dir = APP_HOME . DIRECTORY_SEPARATOR . "languages" . DIRECTORY_SEPARATOR . $lang; $lang_file = $lang_dir . DIRECTORY_SEPARATOR . $lang . ".xml"; @unlink($lang_file); file_put_contents($lang_file, $data); //generate lang string files. return true; }
public function UpdateThemePack($theme, $recArr) { $this->m_RecordID = $theme; $locale = explode('_', $theme); $theme_code = strtolower($locale[0]); //clean up array foreach ($recArr as $key => $value) { $recArr[$key] = addslashes($recArr[$key]); $recArr[$key] = str_replace("\n", '\\n', $recArr[$key]); } //create theme.xml metainfo $smarty = BizSystem::getSmartyTemplate(); $smarty->assign("theme_name", $recArr['name']); $smarty->assign("preview", $recArr['preview']); $smarty->assign("icon", $recArr['icon']); $smarty->assign("version", $recArr['version']); $smarty->assign("create_date", $recArr['creationDate']); $smarty->assign("author", $recArr['author']); $smarty->assign("author_email", $recArr['authorEmail']); $smarty->assign("author_url", $recArr['authorUrl']); $smarty->assign("description", $recArr['description']); $data = $smarty->fetch(BizSystem::getTplFileWithPath("theme.xml.tpl", $this->m_Package)); $theme_dir = THEME_PATH . DIRECTORY_SEPARATOR . $theme; $theme_file = $theme_dir . DIRECTORY_SEPARATOR . "theme.xml"; @unlink($theme_file); file_put_contents($theme_file, $data); //generate theme string files. return true; }
/** * Render smarty template for widget object * * @param MenuWidget $widgetObj * @param string $tplFile * @return string result of rendering process */ protected static function renderSmarty($widgetObj, $tplFile) { $smarty = BizSystem::getSmartyTemplate(); $smarty->assign("widget", $widgetObj->outputAttrs()); return $smarty->fetch($tplFile); }
/** * Render the html tabs * @return string html content of the tabs */ public function render() { global $g_BizSystem; $curView = $g_BizSystem->getCurrentViewName(); $curViewobj = $curView ? BizSystem::getObject($curView) : null; $profile = $g_BizSystem->getUserProfile(); $svcobj = BizSystem::getService("accessService"); $role = isset($profile["ROLE"]) ? $profile["ROLE"] : null; // list all views and highlight the current view // pass $tabs(caption, url, target, icon, current) to template $smarty = BizSystem::getSmartyTemplate(); $tabs = array(); $i = 0; foreach ($this->m_TabViews as $tview) { // tab is renderd if no definition is found in accessservice.xml (default) if ($svcobj->allowViewAccess($tview->m_View, $role)) { $tabs[$i]['name'] = $tview->m_Name; //Name of each tab--jmmz $tabs[$i]['forms'] = $this->_renderJSCodeForForms($tview->m_Forms); //Configuration of the forms to hide or show--jmmz $tabs[$i]['caption'] = $tview->m_Caption; $tabs[$i]['url'] = $this->_renderURL($tview); //Call the method to render the url--jmmz //If I have forms to hide or show I add the event because I don't need an URL, I need an event if ((bool) $tview->hasForms()) { $tabs[$i]['event'] = $tabs[$i]['url']; //Assign The url rendered to the event on click $tabs[$i]['url'] = 'javascript:void(0)'; //If I put url in '' then the href want send me to another direction $this->setCurrentTabInSession($tview, $curViewobj, $curView); //I set the current tab wrote in session $hasForms = TRUE; } $tabs[$i]['target'] = $tview->m_Target; $tabs[$i]['icon'] = $tview->m_Icon; $tabs[$i]['current'] = $this->isCurrentTab($tview, $curViewobj, $curView); //I get the current tab. $i++; } } $this->setClientScripts($tabs, $hasForms); $smarty->assign_by_ref("tabs", $tabs); $smarty->assign_by_ref("tabs_Name", $this->m_Name); return $smarty->fetch(BizSystem::getTplFileWithPath($this->m_TemplateFile, $this->m_Package)); }
function modifyMod($table_name) { if (CLI) { echo "Start modify mod.xml." . PHP_EOL; } $module_name = getModuleName($this->module); $targetFile = $moduleDir = MODULE_PATH . "/" . getModuleName($this->module) . "/mod.xml"; $content = file_get_contents($targetFile); $smarty = BizSystem::getSmartyTemplate(); $listview_uri = strtolower(str_replace(" ", "_", $this->opts[2])) . "_list"; //$listview_uri = strtolower(getSubModuleName($this->module)) . "_list"; //$listview_uri = strtolower($this->opts[1]) . "_list"; $module = $this->module; //.".".$this->opts[1]; $comp = $this->opts[2]; $smarty->assign_by_ref("module_name", $module_name); $smarty->assign_by_ref("module", $module); $smarty->assign_by_ref("comp", $comp); $smarty->assign_by_ref("listview_uri", $listview_uri); $smarty->assign_by_ref("acl", $this->opts['acl']); $smarty->assign_by_ref("dashboard_enable", $this->dashboard_enable); //generate ACL sections $tpl_file = dirname(__FILE__) . '/' . META_TPL . self::MOD_RESOURCE; $str = $smarty->fetch($tpl_file); //test if New ACL sections is exists $pattern = "/\\<Resource Name=\"" . $this->opts['acl'][resource] . "\"\\>/si"; if (!preg_match($pattern, $content)) { //do append new sections $content = preg_replace("/(<\\/ACL\\>)/si", $str . "\n</ACL>", $content); } //generate MenuItems sections $tpl_file = dirname(__FILE__) . '/' . META_TPL . self::MOD_ITEMMENU; $str = $smarty->fetch($tpl_file); //test if New MenuItems is exists $pattern = "/\\<MenuItem Name=\"" . ucwords($module) . "\"\\>/si"; if (!preg_match($pattern, $content)) { //do append new sections $content = preg_replace("/\\<\\/MenuItem\\>\\s*?\\<\\/Menu\\>/si", $str . "\n</MenuItem>\n\t</Menu>", $content); } //save files file_put_contents($targetFile, $content); if (CLI) { echo "\t" . str_replace(MODULE_PATH, "", $targetFile) . " is modified." . PHP_EOL; } return $targetFile; }
protected function renderEmail($content, $tplFile) { $smarty = BizSystem::getSmartyTemplate(); foreach ($content as $key => $value) { $smarty->assign($key, $value); } return $smarty->fetch($tplFile); }
/** * Render html content of this form * * @return string - HTML text of this form's read mode */ protected function renderHTML() { $dispmode = $this->GetDisplayMode(); $this->SetDisplayMode($dispmode->GetMode()); $smarty = BizSystem::getSmartyTemplate(); $smarty->assign_by_ref("name", $this->m_Name); $smarty->assign_by_ref("title", $this->m_Title); $smarty->assign_by_ref("toolbar", $this->m_ToolBar->render()); //print_r ($this->m_SearchBox->render()); if ($dispmode->m_DataFormat == "array") { // if dataFormat is array, call array render function $smarty->assign_by_ref("fields", $this->renderArray()); } else { if ($dispmode->m_DataFormat == "table") { $smarty->assign_by_ref("table", $this->renderTable()); $smarty->assign_by_ref("formobj", $this); } } $smarty->assign_by_ref("navbar", $this->m_NavBar->render()); return $smarty->fetch(BizSystem::getTplFileWithPath($dispmode->m_TemplateFile, $this->m_Package)); }