示例#1
0
 /**
  * Gather all template variables needed. Should play well with Smarty or \Zend templates
  *
  * @param WebPage $formObj
  * @return array associative array holding all needed VIEW based template variables
  */
 public static function buildTemplateAttributes($formObj)
 {
     // Assocative Array to hold all Template Values
     // Fill with default viewobj attributes
     $tplAttributes = array();
     $tplAttributes['title'] = $formObj->title;
     $tplAttributes['errors'] = $formObj->errors;
     $tplAttributes['notices'] = $formObj->notices;
     $tplAttributes['formname'] = $formObj->objectName;
     $tplAttributes['module'] = $formObj->getModuleName($formObj->objectName);
     // if the $formobj form type is list render table, otherwise render record
     if (strtoupper($formObj->formType) == 'LIST') {
         $recordSet = $formObj->fetchDataSet();
         $tplAttributes['dataPanel'] = $formObj->dataPanel->renderTable($recordSet);
     } else {
         $record = $formObj->fetchData();
         $tplAttributes['dataPanel'] = $formObj->dataPanel->renderRecord($record);
     }
     if (isset($formObj->searchPanel)) {
         $search_record = $formObj->searchPanelValues;
         foreach ($formObj->searchPanel as $elem) {
             if (!$elem->fieldName) {
                 continue;
             }
             $post_value = Openbizx::$app->getClientProxy()->getFormInputs($elem->objectName);
             if ($post_value) {
                 $search_record[$elem->fieldName] = $post_value;
             }
         }
         $tplAttributes['searchPanel'] = $formObj->searchPanel->renderRecord($search_record);
     } else {
         $tplAttributes['searchPanel'] = $formObj->searchPanel->render();
     }
     $tplAttributes['actionPanel'] = $formObj->actionPanel->render();
     $tplAttributes['navPanel'] = $formObj->navPanel->render();
     if (isset($formObj->wizardPanel)) {
         $tplAttributes['wizardPanel'] = $formObj->wizardPanel->render();
     }
     $tplAttributes['form'] = $formObj->outputAttrs();
     return $tplAttributes;
 }
示例#2
0
 /**
  * Ask if the $this tab object is the current tab
  *
  * @param TabView $tabView
  * @param WebPage $curViewObj current View Object
  * @param string $curViewName name of the current view
  * @return boolean TRUE if on the current tab, otherwise FALSE
  */
 public function isCurrentTab($tabView, $curViewObj, $curViewName)
 {
     //--jmmz
     $currentTab = false;
     //this variable save 'true' if is the current tab and 'false' in otherwise --jmmz
     if ($this->currentTab) {
         $currentTab = $this->currentTab == $tabView->objectName || $this->currentTab == $tabView->tab ? TRUE : FALSE;
     } elseif ($tabView->viewSet) {
         if ($curViewObj) {
             // check if current view's viewset == tview->viewSet
             $currentTab = $curViewObj->getViewSet() == $tabView->viewSet ? true : false;
         }
     } else {
         $currentTab = $curViewName == $tabView->view || $curViewObj->tab == $tabView->objectName ? true : false;
     }
     return $currentTab;
 }
示例#3
0
 /**
  * Get output attributs
  *
  * @return array
  * @todo need to raname to getOutputAttributs() or getAttributes
  */
 public function outputAttrs()
 {
     $out = parent::outputAttrs();
     $out['step'] = $this->currentStep;
     $out['forms'] = $this->formRefs;
     return $out;
 }
示例#4
0
 /**
  * Render smarty template for view object
  *
  * @param WebPage $webpage
  * @param string $tplFile
  * @return string result of rendering process
  */
 protected static function renderSmarty($webpage, $tplAttributes = array())
 {
     $smarty = TemplateHelper::getSmartyTemplate();
     $viewOutput = $webpage->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);
     }
     self::registerSmartyPlugin($smarty);
     //if ($webpage->consoleOutput) {
     $smarty->display(TemplateHelper::getTplFileWithPath($webpage->templateFile, $webpage->package));
     //} else {
     //    return $smarty->fetch(TemplateHelper::getTplFileWithPath($webpage->templateFile, $webpage->package));
     //}
 }
示例#5
0
 /**
  * Initialize DynaView with xml array
  *
  * @param array $xmlArr
  * @return void
  */
 public function __construct(&$xmlArr)
 {
     parent::__construct($xmlArr);
     $this->processURL();
 }