/** * Add the page title and toolbar. * * @since 1.6 */ protected function addToolbar() { JRequest::setVar('hidemainmenu', true); $user = JFactory::getUser(); $userId = $user->get('id'); $isNew = $this->item->id == 0; $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId); // Since we don't track these assets at the item level, use the category id. $canDo = WeddingHelper::getActions($this->item->catid, 0); JToolBarHelper::title($isNew ? JText::_('App Manager: New') : JText::_('App Manager: Edit'), 'banners.png'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0)) { JToolBarHelper::apply('banner.apply'); JToolBarHelper::save('banner.save'); if ($canDo->get('core.create')) { JToolBarHelper::save2new('banner.save2new'); } } // If an existing item, can save to a copy. if (!$isNew && $canDo->get('core.create')) { JToolBarHelper::save2copy('banner.save2copy'); } if (empty($this->item->id)) { JToolBarHelper::cancel('banner.cancel'); } else { JToolBarHelper::cancel('banner.cancel', 'JTOOLBAR_CLOSE'); } JToolBarHelper::divider(); JToolBarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS_EDIT'); }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/wedding.php'; $canDo = WeddingHelper::getActions($this->state->get('filter.category_id')); $user = JFactory::getUser(); JToolBarHelper::title(JText::_('COM_WEDDING_MANAGER_STORIES'), 'stories.png'); if ($canDo->get('core.edit.state')) { if ($this->state->get('filter.state') != 2) { // JToolBarHelper::divider(); JToolBarHelper::publish('stories.publish', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::unpublish('stories.unpublish', 'JTOOLBAR_UNPUBLISH', true); } if ($this->state->get('filter.state') != -1) { JToolBarHelper::divider(); if ($this->state->get('filter.state') != 2) { JToolBarHelper::archiveList('stories.archive'); } elseif ($this->state->get('filter.state') == 2) { JToolBarHelper::unarchiveList('stories.publish'); } } } if ($canDo->get('core.edit.state')) { JToolBarHelper::checkin('stories.checkin'); } if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'stories.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } elseif ($canDo->get('core.edit.state')) { JToolBarHelper::trash('stories.trash'); JToolBarHelper::divider(); } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_wedding'); } }
/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/wedding.php'; $canDo = WeddingHelper::getActions($this->state->get('filter.category_id')); $user = JFactory::getUser(); JToolBarHelper::title(JText::_('COM_BANNERS_MANAGER_BANNERS'), 'banners.png'); if (count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0) { JToolBarHelper::addNew('banner.add'); } if ($canDo->get('core.edit')) { JToolBarHelper::editList('banner.edit'); } if ($canDo->get('core.edit.state')) { if ($this->state->get('filter.state') != 2) { JToolBarHelper::divider(); JToolBarHelper::publish('banners.publish', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::unpublish('banners.unpublish', 'JTOOLBAR_UNPUBLISH', true); } if ($this->state->get('filter.state') != -1) { JToolBarHelper::divider(); if ($this->state->get('filter.state') != 2) { JToolBarHelper::archiveList('banners.archive'); } elseif ($this->state->get('filter.state') == 2) { JToolBarHelper::unarchiveList('banners.publish'); } } } if ($canDo->get('core.edit.state')) { JToolBarHelper::checkin('banners.checkin'); } if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'banners.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } elseif ($canDo->get('core.edit.state')) { JToolBarHelper::trash('banners.trash'); JToolBarHelper::divider(); } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_banners'); JToolBarHelper::divider(); } JToolBarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS'); }