示例#1
0
 public function outputAttrs()
 {
     $out = parent::outputAttrs();
     $out['columns'] = $this->columns;
     //print_r($out['columns']);
     return $out;
 }
示例#2
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 = Openbiz::$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;
 }
示例#3
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);
     }
     //echo __METHOD__ . __LINE__. ' - ' . $webpage->templateFile . '<br />';
     //echo __METHOD__ . __LINE__. ' - ' . TemplateHelper::getTplFileWithPath($webpage->templateFile, $webpage->package) . '<br />';
     //if ($viewObj->consoleOutput) {
     $smarty->display(TemplateHelper::getTplFileWithPath($webpage->templateFile, $webpage->package));
     //} else {
     //    return $smarty->fetch(TemplateHelper::getTplFileWithPath($viewObj->templateFile, $viewObj->package));
     //}
 }
 /**
  * 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;
 }