Exemplo n.º 1
0
 /**
  * Add the page title and toolbar.
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     $doc = JFactory::getDocument();
     $doc->addStyleDeclaration('.icon-48-babioon {background-image: url(../media/babioon/images/icon-48-babioon.png);}');
     $user = JFactory::getUser();
     $userId = $user->get('id');
     $isNew = $this->item->id == 0;
     $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $userId);
     $canDo = BabioonDownloadHelpers::getActions();
     JToolBarHelper::title($isNew ? JText::_('COM_BABIOONDOWNLOAD_DOWNLOAD_NEW') : JText::_('COM_BABIOONDOWNLOAD_DOWNLOAD_EDIT'), 'babioon.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_babioondownload', 'core.create')) > 0)) {
         JToolBarHelper::apply('download.apply');
         JToolBarHelper::save('download.save');
         if ($canDo->get('core.create')) {
             JToolBarHelper::save2new('download.save2new');
         }
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::save2copy('download.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('download.cancel');
     } else {
         JToolBarHelper::cancel('download.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Exemplo n.º 2
0
 /**
  * Add the page title and toolbar.
  */
 protected function addToolbar()
 {
     $doc = JFactory::getDocument();
     $doc->addStyleDeclaration('.icon-48-babioon {background-image: url(../media/babioon/images/icon-48-babioon.png);}');
     $user = JFactory::getUser();
     $canDo = BabioonDownloadHelpers::getActions();
     JToolBarHelper::title(JText::_('COM_BABIOONDOWNLOAD_DOWNLOADS'), 'babioon.png');
     JToolBarHelper::addNew('download.add');
     JToolBarHelper::editList('download.edit');
     if ($canDo->get('core.edit.state')) {
         if ($this->state->get('filter.state') != 2) {
             JToolBarHelper::divider();
             JToolBarHelper::publish('download.publish', 'JTOOLBAR_PUBLISH', true);
             JToolBarHelper::unpublish('download.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         }
         if ($this->state->get('filter.state') != -1) {
             JToolBarHelper::divider();
             if ($this->state->get('filter.state') != 2) {
                 JToolBarHelper::archiveList('download.archive');
             } elseif ($this->state->get('filter.state') == 2) {
                 JToolBarHelper::unarchiveList('download.publish');
             }
         }
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::checkin('download.checkin');
     }
     if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'download.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolBarHelper::divider();
     } elseif ($canDo->get('core.edit.state')) {
         JToolBarHelper::trash('download.trash');
         JToolBarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_babioondownload');
     }
 }