/** * Add the page title and toolbar. * * @return void * * @since 1.6 */ protected function addToolbar() { require_once JPATH_COMPONENT . '/helpers/hp_comment.php'; $canDo = Hp_CommentHelper::getActions($this->state->get('filter.category_id')); $user = JFactory::getUser(); JToolBarHelper::title(JText::_('HP Comments Manager'), 'comments.png'); if ($canDo->get('core.create')) { JToolBarHelper::addNew('comment.add'); } if ($canDo->get('core.edit')) { JToolBarHelper::editList('comment.edit'); } if ($canDo->get('core.edit.state')) { if ($this->state->get('filter.state') != 2) { JToolBarHelper::divider(); JToolBarHelper::publish('comments.publish', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::unpublish('comments.unpublish', 'JTOOLBAR_UNPUBLISH', true); } if ($this->state->get('filter.state') != -1) { JToolBarHelper::divider(); if ($this->state->get('filter.state') != 2) { JToolBarHelper::archiveList('comments.archive'); } elseif ($this->state->get('filter.state') == 2) { JToolBarHelper::unarchiveList('comments.publish'); } } } if ($canDo->get('core.edit.state')) { JToolBarHelper::checkin('comments.checkin'); } if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) { JToolBarHelper::deleteList('', 'comments.delete', 'JTOOLBAR_EMPTY_TRASH'); JToolBarHelper::divider(); } elseif ($canDo->get('core.edit.state')) { JToolBarHelper::trash('comments.trash'); JToolBarHelper::divider(); } if ($canDo->get('core.admin')) { JToolBarHelper::preferences('com_hp_comment'); } }
/** * 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 = Hp_CommentHelper::getActions(0, 0); JToolBarHelper::title($isNew ? JText::_('COM_BANNERS_MANAGER_BANNER_NEW') : JText::_('COM_BANNERS_MANAGER_BANNER_EDIT'), 'comments.png'); // If not checked out, can save the item. if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_hp_comment', 'core.create')) > 0)) { JToolBarHelper::apply('comment.apply'); JToolBarHelper::save('comment.save'); } if (empty($this->item->id)) { JToolBarHelper::cancel('comment.cancel'); } else { JToolBarHelper::cancel('comment.cancel', 'JTOOLBAR_CLOSE'); } }