/** * Display the Hello World view * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ public function display($tpl = null) { // Get the Data $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->script = $this->get('Script'); // What Access Permissions does this user have? What can (s)he do? $this->canDo = HelloWorldHelper::getActions($this->item->id); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } // Set the toolbar $this->addToolBar(); // Display the template parent::display($tpl); // Set the document $this->setDocument(); }
protected function addToolBar() { JRequest::setVar('hidemainmenu', true); $isNew = $this->item->id == 0; $user = JFactory::getUser(); $userId = $user->id; $canDo = HelloWorldHelper::getActions($this->item->id); JToolBarHelper::title($isNew ? JText::_('COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW') : JText::_('COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT'), 'helloworld'); // Built the actions for new and existing records. if ($isNew) { // For new records, check the create permission. if ($canDo->get('core.create')) { JToolBarHelper::apply('helloworld.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('helloworld.save', 'JTOOLBAR_SAVE'); JToolBarHelper::custom('helloworld.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } JToolBarHelper::cancel('helloworld.cancel', 'JTOOLBAR_CANCEL'); } else { if ($canDo->get('core.edit')) { // We can save the new record JToolBarHelper::apply('helloworld.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('helloworld.save', 'JTOOLBAR_SAVE'); // We can save this record, but check the create permission to see if we can return to make a new one. if ($canDo->get('core.create')) { JToolBarHelper::custom('helloworld.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } if ($canDo->get('core.create')) { JToolBarHelper::custom('helloworld.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } JToolBarHelper::cancel('helloworld.cancel', 'JTOOLBAR_CLOSE'); } }
/** * Setting the toolbar */ protected function addToolBar() { $canDo = HelloWorldHelper::getActions(); JToolBarHelper::title(JText::_('COM_HELLOWORLD_MANAGER_HELLOWORLDS'), 'helloworld'); if ($canDo->get('core.create')) { JToolBarHelper::addNew('helloworld.add', 'JTOOLBAR_NEW'); } if ($canDo->get('core.edit')) { JToolBarHelper::editList('helloworld.edit', 'JTOOLBAR_EDIT'); } if ($canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'helloworld.delete', 'JTOOLBAR_DELETE'); } if ($canDo->get('core.admin')) { JToolBarHelper::divider(); JToolBarHelper::preferences('com_helloworld'); } }
/** * Display function */ public function display($tpl = null) { // Get data from the model $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->canDo = HelloWorldHelper::getActions(); // Check for error if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br/>', $errors)); return false; } // Set the tool bar $this->addToolbar($this->pagination->total); // Display the template parent::display($tpl); // Set the documents $this->setDocument(); }
/** * Отображает представление. * * @param string $tpl Имя файла шаблона. * * @return void * * @throws Exception */ public function display($tpl = null) { try { // Получаем данные из модели. $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->script = $this->get('Script'); // Получаем доступы пользователя. $this->canDo = HelloWorldHelper::getActions($this->item->catid, $this->item->id); // Устанавливаем панель инструментов. $this->addToolBar(); // Отображаем представление. parent::display($tpl); // Устанавливаем документ. $this->setDocument(); } catch (Exception $e) { throw new Exception($e->getMessage()); } }
/** * Отображаем список сообщений. * * @param string $tpl Имя файла шаблона. * * @return void * * @throws Exception */ public function display($tpl = null) { try { // Получаем данные из модели. $this->items = $this->get('Items'); // Получаем объект постраничной навигации. $this->pagination = $this->get('Pagination'); // Получаем объект состояния модели. $this->state = $this->get('State'); // Получаем доступы пользователя. $this->canDo = HelloWorldHelper::getActions($this->state->get('filter.category_id')); // Устанавливаем панель инструментов. $this->addToolBar(); // Отображаем представление. parent::display($tpl); } catch (Exception $e) { throw new Exception($e->getMessage()); } }
/** * Display the Hello World view * * @param string $tpl The name of the template file to parse; automatically searches through the template paths. * * @return void */ function display($tpl = null) { // Get application $app = JFactory::getApplication(); $context = "helloworld.list.admin.helloworld"; // Get data from the model $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->state = $this->get('State'); $this->filter_order = $app->getUserStateFromRequest($context.'filter_order', 'filter_order', 'greeting', 'cmd'); $this->filter_order_Dir = $app->getUserStateFromRequest($context.'filter_order_Dir', 'filter_order_Dir', 'asc', 'cmd'); $this->filterForm = $this->get('FilterForm'); $this->activeFilters = $this->get('ActiveFilters'); // What Access Permissions does this user have? What can (s)he do? $this->canDo = HelloWorldHelper::getActions(); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } // Set the submenu HelloWorldHelper::addSubmenu('helloworlds'); // Set the toolbar and number of found items $this->addToolBar(); // Display the template parent::display($tpl); // Set the document $this->setDocument(); }