/** * 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); }