/** * Render widget object * * @param MenuWidget $widgetObj * @return string result of rendering process */ public static function render($widgetObj) { $tplEngine = $widgetObj->m_TemplateEngine; $tplFile = BizSystem::getTplFileWithPath($widgetObj->m_TemplateFile, $widgetObj->m_Package); if ($tplEngine == "Smarty" || $tplEngine == null) { return MenuRenderer::renderSmarty($widgetObj, $tplFile); } else { return MenuRenderer::renderPHP($widgetObj, $tplFile); } }
/** * Render form object * * @param EasyForm $formObj * @return string result of rendering process */ public static function render($formObj) { $tplEngine = $formObj->m_TemplateEngine; $tplFile = BizSystem::getTplFileWithPath($formObj->m_TemplateFile, $formObj->m_Package); //echo "template file at $tplFile"; exit; if (isset($formObj->m_jsClass)) { $subForms = $formObj->m_SubForms ? implode(";", $formObj->m_SubForms) : ""; $formScript = "\n<script>Openbiz.newFormObject('{$formObj->m_Name}','{$formObj->m_jsClass}','{$subForms}'); </script>\n"; } if ($tplEngine == "Smarty" || $tplEngine == null) { return FormRenderer::renderSmarty($formObj, $tplFile) . $formScript; } else { return FormRenderer::renderPHP($formObj, $tplFile) . $formScript; } }
public function CronJobEmail($recipientEmail, $job_name, $output) { //init email info $template = $this->m_Tempaltes["CronjobEmail"]["TEMPLATE"]; $subject = $this->m_Tempaltes["CronjobEmail"]["TITLE"]; $sender = $this->m_Tempaltes["CronjobEmail"]["EMAILACCOUNT"]; //prepare data $data["job_name"] = $job_name; $data["job_output"] = $output; //render the email tempalte $tplFile = BizSystem::getTplFileWithPath($template, "email"); $content = $this->renderEmail($data, $tplFile); //prepare recipient info $recipient['email'] = $recipientEmail; $recipient['name'] = $recipientEmail; //send it to the queue $result = $this->sendEmail($sender, $recipient, $subject, $content); return $result; }
/** * 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)); }
/** * 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 PHP template for form object * * @param EasyForm $formObj * @param string $tplFile * @return string result of rendering process */ protected static function renderPHP($formObj, $tplAttributes = array()) { $form = BizSystem::getZendTemplate(); $tplFile = BizSystem::getTplFileWithPath($formObj->m_TemplateFile, $formObj->m_Package); $form->addScriptPath(dirname($tplFile)); /*$formOutput = $formObj->outputAttrs(); foreach ($formOutput as $k=>$v) { $form->$k = $v; }*/ foreach ($tplAttributes as $key => $value) { if ($value == NULL) { $form->{$key} = ''; } else { $form->{$key} = $value; } } // render the formobj attributes //$form->form = $formOutput; return $form->render($formObj->m_TemplateFile); }
/** * Render PHP template for view object * * @param EasyForm $formObj * @param string $tplFile * @return string result of rendering process */ protected static function renderPHP($viewObj, $tplAttributes = array()) { $view = BizSystem::getZendTemplate(); $tplFile = BizSystem::getTplFileWithPath($viewObj->m_TemplateFile, $viewObj->m_Package); $view->addScriptPath(dirname($tplFile)); //Translate Array of template variables to Zend template object foreach ($tplAttributes as $key => $value) { if ($value == NULL) { $view->{$key} = ''; } else { $view->{$key} = $value; } } $tpl = $_REQUEST['partial'] ? $viewObj->m_TemplateFile : $viewObj->m_PageTemplate; if ($viewObj->m_ConsoleOutput) { echo $view->render($tpl); } else { return $view->render($tpl); } }
/** * 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(); }
/** * 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)); } }
/** * 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)); } }
/** * 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 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)); }