Пример #1
0
 function display($tpl = null)
 {
     // get component params
     $this->params = JComponentHelper::getParams('com_costbenefitprojection');
     // get the application
     $this->app = JFactory::getApplication();
     // get the user object
     $this->user = JFactory::getUser();
     // get global action permissions
     $this->canDo = CostbenefitprojectionHelper::getActions('combinedresults');
     // Initialise variables.
     $this->items = $this->get('Items');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // check if the data was returned
     if ($this->items) {
         // combine the results
         $this->results = CostbenefitprojectionHelper::combine($this->items);
         // set the companies names
         $this->names = $this->results->companiesNames;
         $this->item = new stdClass();
         $this->item->currency_name = $this->results->currencyDetails->currency_name;
         // set the tab details
         $this->chart_tabs = $this->getChartTabs();
         $this->table_tabs = $this->getTableTabs();
     } else {
         // int all as false
         $this->results = false;
         // set the companies names
         $this->names = JText::_('COM_COSTBENEFITPROJECTION_NONE_LOADED');
         $this->item = new stdClass();
         $this->item->currency_name = '';
         // set the tab details
         $this->chart_tabs = false;
         $this->table_tabs = false;
     }
     // We don't need toolbar in the modal window.
     if ($this->getLayout() !== 'modal') {
         // add the tool bar
         $this->addToolBar();
     }
     // set the document
     $this->setDocument();
     parent::display($tpl);
 }
Пример #2
0
 function display($tpl = null)
 {
     // get combined params of both component and menu
     $this->app = JFactory::getApplication();
     $this->params = $this->app->getParams();
     $this->menu = $this->app->getMenu()->getActive();
     // get the user object
     $this->user = JFactory::getUser();
     // Initialise variables.
     $this->items = $this->get('Items');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // check if the data was returned
     if ($this->items) {
         // combine the results
         $this->results = CostbenefitprojectionHelper::combine($this->items);
         // set the companies names
         $this->names = $this->results->companiesNames;
         $this->item = new stdClass();
         $this->item->currency_name = $this->results->currencyDetails->currency_name;
     } else {
         // int all as false
         $this->results = false;
         // set the companies names
         $this->names = JText::_('COM_COSTBENEFITPROJECTION_NONE_LOADED');
         $this->item = new stdClass();
         $this->item->currency_name = '';
     }
     // Set the toolbar
     $this->addToolBar();
     // set the document
     $this->_prepareDocument();
     parent::display($tpl);
 }