Beispiel #1
0
 /**
  * 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 = TemplateHelper::getZendTemplate();
     $tplFile = TemplateHelper::getTplFileWithPath($formObj->templateFile, $formObj->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->templateFile);
 }
Beispiel #2
0
 /**
  * Render the html tabs
  *
  * @global BizSystem $g_BizSystem
  * @return string html content of the tabs
  */
 public function render()
 {
     $curView = Openbizx::$app->getCurrentViewName();
     $curViewobj = $curView ? Openbizx::getObject($curView) : null;
     $profile = Openbizx::$app->getUserProfile();
     $svcobj = Openbizx::getService(ACCESS_SERVICE);
     $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 = TemplateHelper::getSmartyTemplate();
     $tabs = array();
     $i = 0;
     $hasForms = false;
     foreach ($this->tabViews as $tview) {
         // tab is renderd if  no definition  is found in accessservice.xml (default)
         if ($svcobj->allowViewAccess($tview->view, $role)) {
             $tabs[$i]['name'] = $tview->objectName;
             //Name of each tab--jmmz
             $tabs[$i]['forms'] = $this->_renderJSCodeForForms($tview->forms);
             //Configuration of the forms to hide or show--jmmz
             $tabs[$i]['caption'] = $tview->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->target;
             $tabs[$i]['icon'] = $tview->icon;
             $tabs[$i]['current'] = $this->isCurrentTab($tview, $curViewobj, $curView);
             //I get the current tab.
             $i++;
         }
     }
     $this->setClientScripts($tabs, $hasForms);
     $smarty->assign("tabs", $tabs);
     $smarty->assign("tabs_Name", $this->objectName);
     return $smarty->fetch(TemplateHelper::getTplFileWithPath($this->templateFile, $this->package));
 }
Beispiel #3
0
 /**
  * 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 = TemplateHelper::getZendTemplate();
     $tplFile = TemplateHelper::getTplFileWithPath($viewObj->templateFile, $viewObj->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;
         }
     }
     if ($viewObj->consoleOutput) {
         echo $view->render($viewObj->templateFile);
     } else {
         return $view->render($viewObj->templateFile);
     }
 }