form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); $this->canDo = JHelperContent::getActions('com_modules', 'module', $this->item->id); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->addToolbar(); parent::display($tpl); } /** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { JFactory::getApplication()->input->set('hidemainmenu', true); $user = JFactory::getUser(); $isNew = ($this->item->id == 0); $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); $canDo = $this->canDo; JToolbarHelper::title(JText::sprintf('COM_MODULES_MANAGER_MODULE', JText::_($this->item->module)), 'cube module'); // For new records, check the create permission. if ($isNew && $canDo->get('core.create')) { JToolbarHelper::apply('module.apply'); JToolbarHelper::save('module.save'); JToolbarHelper::save2new('module.save2new'); JToolbarHelper::cancel('module.cancel'); } else { // Can't save the record if it's checked out. if (!$checkedOut) { // Since it's an existing record, check the edit permission. if ($canDo->get('core.edit')) { JToolbarHelper::apply('module.apply'); JToolbarHelper::save('module.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::save2new('module.save2new'); } } } // If checked out, we can still save if ($canDo->get('core.create')) { JToolbarHelper::save2copy('module.save2copy'); } JToolbarHelper::cancel('module.cancel', 'JTOOLBAR_CLOSE'); } // Get the help information for the menu item. $lang = JFactory::getLanguage(); $help = $this->get('Help'); if ($lang->hasKey($help->url)) { $debug = $lang->setDebug(false); $url = JText::_($help->url); $lang->setDebug($debug); } else { $url = null; } JToolbarHelper::help($help->key, false, $url); } }