예제 #1
0
 /**
  * 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);
     $canDo = RentalHelper::getActions($this->state->get('filter.category_id'));
     JToolBarHelper::title($isNew ? JText::_('COM_RENTAL_MANAGER_APARTMENT_NEW') : JText::_('COM_RENTAL_MANAGER_APARTMENT_EDIT'), '#xs#.png');
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || count($user->getAuthorisedCategories('com_rental', 'core.create')) > 0)) {
         JToolBarHelper::apply('apartment.apply');
         JToolBarHelper::save('apartment.save');
         if ($canDo->get('core.create')) {
             JToolBarHelper::save2new('apartment.save2new');
         }
     }
     // If an existing item, can save to a copy.
     if (!$isNew && $canDo->get('core.create')) {
         JToolBarHelper::save2copy('apartment.save2copy');
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('apartment.cancel');
     } else {
         JToolBarHelper::cancel('apartment.cancel', 'JTOOLBAR_CLOSE');
     }
 }
예제 #2
0
 /**
  * Add the page title and toolbar.
  *
  * @since	1.6
  */
 protected function addToolbar()
 {
     $canDo = RentalHelper::getActions($this->state->get('filter.category_id'));
     $user = JFactory::getUser();
     JToolBarHelper::title(JText::_('COM_RENTAL_MANAGER_LOCATIONS'), 'location.png');
     if ($canDo->get('core.create') || count($user->getAuthorisedCategories('com_rental', 'core.create')) > 0) {
         JToolBarHelper::addNew('location.add');
     }
     if ($canDo->get('core.edit') || $canDo->get('core.edit.own')) {
         JToolBarHelper::editList('location.edit');
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::publish('locations.publish', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::unpublish('locations.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         JToolBarHelper::divider();
         JToolBarHelper::archiveList('locations.archive');
         JToolBarHelper::checkin('locations.checkin');
     }
     if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolBarHelper::deleteList('', 'locations.delete', 'JTOOLBAR_EMPTY_TRASH');
     } else {
         if ($canDo->get('core.edit.state')) {
             JToolBarHelper::trash('locations.trash');
         }
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::divider();
         JToolBarHelper::preferences('com_rental');
     }
 }