Exemplo n.º 1
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  */
 protected function addToolbar()
 {
     JRequest::setVar('hidemainmenu', true);
     $name = $this->getName();
     $doc = JFactory::getDocument();
     if (file_exists(JPATH_BASE . '/media/babioon/images/icon-48-babioon-' . $name . '.png')) {
         $doc->addStyleDeclaration('.icon-48-babioon-' . $name . ' {background-image: url(../media/babioon/images/icon-48-babioon-' . $name . '.png);}');
         $image = 'babioon-' . $name . '.png';
     } else {
         $doc->addStyleDeclaration('.icon-48-babioon {background-image: url(../media/babioon/images/icon-48-babioon.png);}');
         $image = '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 = BabioonAdHelper::getActions($name);
     $tag = 'COM_BABIOONAD_' . strtoupper($name);
     JToolBarHelper::title($isNew ? JText::_($tag . '_NEW') : JText::_($tag . '_EDIT'), $image);
     // If not checked out, can save the item.
     if (!$checkedOut && $canDo->get('core.edit')) {
         JToolBarHelper::apply($name . '.apply');
         JToolBarHelper::save($name . '.save');
     }
     JToolBarHelper::cancel($name . '.cancel', 'JTOOLBAR_CLOSE');
 }
Exemplo n.º 2
0
 /**
  * Add the page title and toolbar.
  *
  * @return void
  */
 protected function addToolbar()
 {
     $name = $this->getName();
     $tag = strtoupper($name);
     $singular = BabioonAdHelper::toSingular($name);
     $doc = JFactory::getDocument();
     if (file_exists(JPATH_BASE . '/media/babioon/images/icon-48-babioon-' . $name . '.png')) {
         $doc->addStyleDeclaration('.icon-48-babioon-' . $name . ' {background-image: url(../media/babioon/images/icon-48-babioon-' . $name . '.png);}');
         $image = 'babioon-' . $name . '.png';
     } else {
         $doc->addStyleDeclaration('.icon-48-babioon {background-image: url(../media/babioon/images/icon-48-babioon.png);}');
         $image = 'babioon.png';
     }
     $user = JFactory::getUser();
     $canDo = BabioonAdHelper::getActions($singular);
     JToolBarHelper::title(JText::_('COM_BABIOONAD_' . $tag), $image);
     // Use sigular
     JToolBarHelper::editList($singular . '.edit');
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::divider();
         JToolBarHelper::publish($name . '.publish', 'JTOOLBAR_PUBLISH', true);
         JToolBarHelper::unpublish($name . '.unpublish', 'JTOOLBAR_UNPUBLISH', true);
     }
     if ($canDo->get('core.edit.state')) {
         JToolBarHelper::checkin($name . '.checkin');
     }
     if ($canDo->get('core.delete')) {
         JToolBarHelper::divider();
         JToolBarHelper::deleteList('', $name . '.delete');
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::divider();
         JToolBarHelper::preferences('com_babioonad');
     }
 }
Exemplo n.º 3
0
 /**
  * Add the page title and toolbar.
  *
  * @return	void
  */
 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 = BabioonAdHelper::getActions();
     JToolBarHelper::title(JText::_('COM_BABIOONAD'), 'babioon.png');
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_babioonad');
     }
 }