Example #1
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     $canDo = je_faqHelper::getActions($this->state->get('filter.category_id'));
     JToolBarHelper::title($isNew ? JText::_('FAQs: Add new') : JText::_('FAQs: Edit'), 'faqs.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('faq.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('faq.save', 'JTOOLBAR_SAVE');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolBarHelper::custom('faq.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::custom('faq.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('faq.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('faq.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Example #2
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/je_faq.php';
     $canDo = je_faqHelper::getActions($this->state->get('filter.category_id'));
     JToolBarHelper::title(JText::_('Faqs Manager'), 'banners.png');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('faq.add', 'JTOOLBAR_NEW');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('faq.edit', 'JTOOLBAR_EDIT');
     }
     if ($canDo->get('core.edit.state')) {
         if ($this->state->get('filter.state') != 2) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('faqs.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('faqs.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         }
         if ($this->state->get('filter.state') != -1) {
             JToolBarHelper::divider();
             if ($this->state->get('filter.state') != 2) {
                 JToolBarHelper::archiveList('faqs.archive', 'JTOOLBAR_ARCHIVE');
             } else {
                 if ($this->state->get('filter.state') == 2) {
                     JToolBarHelper::unarchiveList('faqs.publish', 'JTOOLBAR_UNARCHIVE');
                 }
             }
         }
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::custom('faqs.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
     }
     if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'faqs.delete', 'JTOOLBAR_EMPTY_TRASH');
     } else {
         if ($canDo->get('core.edit.state')) {
             JToolBarHelper::trash('faqs.trash', 'JTOOLBAR_TRASH');
         }
     }
 }