Beispiel #1
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/api.php';
     $state = $this->get('State');
     $canDo = ApiHelper::getActions($state->get('filter.category_id'));
     if (JVERSION >= '3.0') {
         JToolBarHelper::title(JText::_('COM_API_TITLE_LOGS'), 'list');
     } else {
         JToolBarHelper::title(JText::_('COM_API_TITLE_LOGS'), 'logs.png');
     }
     if ($canDo->get('core.edit.state')) {
         // If this component does not use state then show a direct delete button as we can not trash
         JToolBarHelper::deleteList('', 'logs.delete', 'JTOOLBAR_DELETE');
     }
     // Show trash and delete for components that uses the state field
     if (isset($this->items[0]->state)) {
         if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
             JToolBarHelper::deleteList('', 'logs.delete', 'JTOOLBAR_EMPTY_TRASH');
             JToolBarHelper::divider();
         } elseif ($canDo->get('core.edit.state')) {
             JToolBarHelper::trash('logs.trash', 'JTOOLBAR_TRASH');
             JToolBarHelper::divider();
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_api');
     }
     if (JVERSION >= '3.0') {
         // Set sidebar action - New in 3.0
         JHtmlSidebar::setAction('index.php?option=com_api&view=logs');
     }
     $this->extra_sidebar = '';
 }
Beispiel #2
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/api.php';
     $state = $this->get('State');
     $canDo = ApiHelper::getActions($state->get('filter.category_id'));
     if (JVERSION >= '3.0') {
         JToolBarHelper::title(JText::_('COM_API_TITLE_KEYS'), 'key');
     } else {
         JToolBarHelper::title(JText::_('COM_API_TITLE_KEYS'), 'keys.png');
     }
     // Check if the form exists before showing the add/edit buttons
     $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/key';
     if (file_exists($formPath)) {
         if ($canDo->get('core.create')) {
             JToolBarHelper::addNew('key.add', 'JTOOLBAR_NEW');
         }
         if ($canDo->get('core.edit') && isset($this->items[0])) {
             JToolBarHelper::editList('key.edit', 'JTOOLBAR_EDIT');
         }
     }
     if ($canDo->get('core.edit.state')) {
         if (isset($this->items[0]->state)) {
             JToolBarHelper::divider();
             JToolBarHelper::custom('keys.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::custom('keys.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         }
     }
     // Show trash and delete for components that uses the state field
     if (isset($this->items[0]->state)) {
         if ($canDo->get('core.delete')) {
             JToolBarHelper::deleteList('', 'keys.delete', 'JTOOLBAR_DELETE');
             JToolBarHelper::divider();
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_api');
     }
     // Set sidebar action - New in 3.0
     if (version_compare(JVERSION, '3.0.0', 'ge')) {
         JHtmlSidebar::setAction('index.php?option=com_api&view=keys');
         $this->extra_sidebar = '';
     }
 }
Beispiel #3
0
 /**
  * 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;
     if ($isNew) {
         $viewTitle = JText::_('COM_API_ADD_KEY');
     } else {
         $viewTitle = JText::_('COM_API_EDIT_KEY');
     }
     if (JVERSION >= '3.0') {
         JToolBarHelper::title($viewTitle, 'pencil-2');
     } else {
         JToolBarHelper::title($viewTitle, 'key.png');
     }
     if (isset($this->item->checked_out)) {
         $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     } else {
         $checkedOut = false;
     }
     $canDo = ApiHelper::getActions();
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('key.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('key.save', 'JTOOLBAR_SAVE');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolBarHelper::custom('key.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('key.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('key.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('key.cancel', 'JTOOLBAR_CLOSE');
     }
 }