/** * Setting the toolbar */ protected function addToolBar() { JRequest::setVar('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->id; $isNew = $this->item->id == 0; $canDo = FandbHelper::getActions($this->item->id); JToolBarHelper::title($isNew ? JText::_('Fand :: New') : JText::_('Fand :: Edit'), 'fand'); // Built the actions for new and existing records. if ($isNew) { // For new records, check the create permission. if ($canDo->get('core.create')) { JToolBarHelper::apply('fand.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('fand.save', 'JTOOLBAR_SAVE'); JToolBarHelper::custom('fand.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } JToolBarHelper::cancel('fand.cancel', 'JTOOLBAR_CANCEL'); } else { if ($canDo->get('core.edit')) { // We can save the new record JToolBarHelper::apply('fand.apply', 'JTOOLBAR_APPLY'); JToolBarHelper::save('fand.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('fand.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); } } if ($canDo->get('core.create')) { JToolBarHelper::custom('fand.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); } JToolBarHelper::cancel('fand.cancel', 'JTOOLBAR_CLOSE'); } }
/** * display task * * @return void */ function display($cachable = false, $urlparams = false) { // set default view if not set JRequest::setVar('view', JRequest::getCmd('view', 'Fandb')); // call parent behavior parent::display($cachable); // set view $view = strtolower(JRequest::getVar('view')); // Set the submenu FandbHelper::addSubmenu($view); }
/** * Setting the toolbar */ protected function addToolBar() { $canDo = FandbHelper::getActions(); JToolBarHelper::title(JText::_('Fandb Manager'), 'fandb'); if ($canDo->get('core.create')) { JToolBarHelper::addNew('fand.add', 'JTOOLBAR_NEW'); } if ($canDo->get('core.edit')) { JToolBarHelper::editList('fand.edit', 'JTOOLBAR_EDIT'); } if ($canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'fandb.delete', 'JTOOLBAR_DELETE'); } if ($canDo->get('core.admin')) { JToolBarHelper::divider(); JToolBarHelper::preferences('com_fandb'); } }