Esempio n. 1
0
 /**
  *	Method to add a toolbar
  */
 protected function addToolbar()
 {
     $state = $this->get('State');
     $canDo = JDeveloperHelper::getActions();
     $user = JFactory::getUser();
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     JToolBarHelper::title(JText::_('COM_JDEVELOPER_FORMS_VIEW_FORMS_TITLE'));
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('form.add', 'JTOOLBAR_NEW');
     }
     if (($canDo->get('core.edit') || $canDo->get('core.edit.own')) && isset($this->items[0])) {
         JToolBarHelper::editList('form.edit', 'JTOOLBAR_EDIT');
     }
     if ($canDo->get('core.delete') && isset($this->items[0])) {
         JToolBarHelper::deleteList('', 'forms.delete', 'JTOOLBAR_DELETE');
     }
     // Add a batch button
     if (isset($this->items[0]) && $user->authorise('core.create', 'com_contacts') && $user->authorise('core.edit', 'com_contacts')) {
         JHtml::_('bootstrap.modal', 'collapseModal');
         $title = JText::_('JTOOLBAR_BATCH');
         // Instantiate a new JLayoutFile instance and render the batch button
         $layout = new JLayoutFile('joomla.toolbar.batch');
         $dhtml = $layout->render(array('title' => $title));
         $bar->appendButton('Custom', $dhtml, 'batch');
     }
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_jdeveloper');
     }
 }
Esempio n. 2
0
 protected function addToolbar()
 {
     $user = JFactory::getUser();
     $isNew = $this->item->id == 0;
     $canDo = JDeveloperHelper::getActions();
     JToolBarHelper::title(JText::_('COM_JDEVELOPER_FORMS_VIEW_FORM_TITLE'));
     if (isset($this->item->checked_out)) {
         $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
     } else {
         $checkedOut = false;
     }
     // If not checked out, can save the item.
     if (!$checkedOut && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
         JToolBarHelper::apply('form.apply', 'JTOOLBAR_APPLY');
         JToolBarHelper::save('form.save', 'JTOOLBAR_SAVE');
     }
     if (!$checkedOut && $canDo->get('core.create')) {
         JToolBarHelper::custom('form.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('form.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
     }
     if (empty($this->item->id)) {
         JToolBarHelper::cancel('form.cancel', 'JTOOLBAR_CANCEL');
     } else {
         JToolBarHelper::cancel('form.cancel', 'JTOOLBAR_CLOSE');
     }
 }
Esempio n. 3
0
 /**
  *	Method to add a toolbar
  */
 protected function addToolbar()
 {
     $state = $this->get('State');
     $canDo = JDeveloperHelper::getActions();
     $user = JFactory::getUser();
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     JToolBarHelper::title(JText::_('COM_JDEVELOPER_EXTENSIONS'));
     if ($canDo->get('core.admin')) {
         JToolBarHelper::preferences('com_jdeveloper');
     }
     if ($canDo->get('extensions.zip')) {
         JToolBarHelper::publish('extensions.zip', 'JTOOLBAR_CREATE_ZIP');
     }
     if ($canDo->get('extensions.deletezip')) {
         JToolBarHelper::unpublish('extensions.deletezip', 'JTOOLBAR_DELETE_ZIP');
     }
 }
Esempio n. 4
0
 /**
  * Checks whether a user can see this view.
  *
  * @param   string	$view	The view name.
  *
  * @return  boolean
  * @since   1.6
  */
 protected function canView($view)
 {
     $canDo = JDeveloperHelper::getActions();
     return $canDo->get('core.admin');
 }