示例#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 = 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;
 }
示例#2
0
 /**
  * Gather all template variables needed. Should play well with Smarty or \Zend templates
  *
  * @param WebPage $viewObj
  * @return array associative array holding all needed VIEW based template variables
  */
 public static function buildTemplateAttributes($viewObj)
 {
     // Assocative Array to hold all Template Values
     // Fill with default viewobj attributes
     //$tplAttributes = $viewObj->outputAttrs();
     //Not sure what this is doing...
     $newClntObjs = '';
     //Fill other direct view variables
     $tplAttributes["module"] = $viewObj->getModuleName($viewObj->objectName);
     $tplAttributes["description"] = $viewObj->objectDescription;
     $tplAttributes["keywords"] = $viewObj->keywords;
     if (isset($viewObj->tiles)) {
         foreach ($viewObj->tiles as $tname => $tile) {
             foreach ($tile as $formRef) {
                 if ($formRef->display == false) {
                     continue;
                 }
                 $tiles[$tname][$formRef->objectName] = Openbiz::getObject($formRef->objectName)->render();
                 $tiletabs[$tname][$formRef->objectName] = $formRef->objectDescription;
             }
         }
     } else {
         foreach ($viewObj->formRefs as $formRef) {
             if ($formRef->display == false) {
                 continue;
             }
             $forms[$formRef->objectName] = Openbiz::getObject($formRef->objectName)->render();
             $formtabs[$formRef->objectName] = $formRef->objectDescription;
         }
     }
     if (count($viewObj->widgets)) {
         foreach ($viewObj->widgets as $formRef) {
             if ($formRef->display == false) {
                 continue;
             }
             $widgets[$formRef->objectName] = Openbiz::getObject($formRef->objectName)->render();
         }
     }
     //Fill Loop related data
     $tplAttributes["forms"] = $forms;
     $tplAttributes["widgets"] = $widgets;
     $tplAttributes["formtabs"] = $formtabs;
     $tplAttributes["tiles"] = $tiles;
     $tplAttributes["tiletabs"] = $tiletabs;
     // add clientProxy scripts
     $includedScripts = Openbiz::$app->getClientProxy()->getAppendedScripts();
     $tplAttributes["style_sheets"] = Openbiz::$app->getClientProxy()->getAppendedStyles();
     if ($viewObj->isPopup && $bReRender == false) {
         $moveToCenter = "moveToCenter(self, " . $viewObj->width . ", " . $viewObj->height . ");";
         $tplAttributes["scripts"] = $includedScripts . "\n<script>\n" . $newClntObjs . $moveToCenter . "</script>\n";
     } else {
         $tplAttributes["scripts"] = $includedScripts . "\n<script>\n" . $newClntObjs . "</script>\n";
     }
     if ($viewObj->title) {
         $tplAttributes["title"] = Expression::evaluateExpression($viewObj->title, $viewObj);
     } else {
         $tplAttributes["title"] = $viewObj->objectDescription;
     }
     if (OPENBIZ_DEFAULT_SYSTEM_NAME) {
         $tplAttributes["title"] = $tplAttributes["title"] . ' - ' . OPENBIZ_DEFAULT_SYSTEM_NAME;
     }
     return $tplAttributes;
 }