Esempio n. 1
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/banners.php';
     $canDo = BannersHelper::getActions($this->state->get('filter.category_id'));
     $user = JFactory::getUser();
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     JToolbarHelper::title(JText::_('COM_BANNERS_MANAGER_BANNERS'), 'banners.png');
     if (count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0) {
         JToolbarHelper::addNew('banner.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('banner.edit');
     }
     if ($canDo->get('core.edit.state')) {
         if ($this->state->get('filter.state') != 2) {
             JToolbarHelper::publish('banners.publish', 'JTOOLBAR_PUBLISH', true);
             JToolbarHelper::unpublish('banners.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         }
         if ($this->state->get('filter.state') != -1) {
             if ($this->state->get('filter.state') != 2) {
                 JToolbarHelper::archiveList('banners.archive');
             } elseif ($this->state->get('filter.state') == 2) {
                 JToolbarHelper::unarchiveList('banners.publish');
             }
         }
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::checkin('banners.checkin');
     }
     if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'banners.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('banners.trash');
     }
     // Add a batch button
     if ($user->authorise('core.create', 'com_banners') && $user->authorise('core.edit', 'com_banners') && $user->authorise('core.edit.state', 'com_banners')) {
         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_banners');
     }
     JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS');
     JHtmlSidebar::setAction('index.php?option=com_banners&view=banners');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.state'), true));
     JHtmlSidebar::addFilter(JText::_('COM_BANNERS_SELECT_CLIENT'), 'filter_client_id', JHtml::_('select.options', BannersHelper::getClientOptions(), 'value', 'text', $this->state->get('filter.client_id')));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category_id', JHtml::_('select.options', JHtml::_('category.options', 'com_banners'), 'value', 'text', $this->state->get('filter.category_id')));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_LANGUAGE'), 'filter_language', JHtml::_('select.options', JHtml::_('contentlanguage.existing', true, true), 'value', 'text', $this->state->get('filter.language')));
 }
Esempio n. 2
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $state = $this->get('State');
     $canDo = JHelperContent::getActions('com_redirect');
     JToolbarHelper::title(JText::_('COM_REDIRECT_MANAGER_LINKS'), 'refresh redirect');
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('link.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('link.edit');
     }
     if ($canDo->get('core.edit.state')) {
         if ($state->get('filter.state') != 2) {
             JToolbarHelper::divider();
             JToolbarHelper::publish('links.publish', 'JTOOLBAR_ENABLE', true);
             JToolbarHelper::unpublish('links.unpublish', 'JTOOLBAR_DISABLE', true);
         }
         if ($state->get('filter.state') != -1) {
             JToolbarHelper::divider();
             if ($state->get('filter.state') != 2) {
                 JToolbarHelper::archiveList('links.archive');
             } elseif ($state->get('filter.state') == 2) {
                 JToolbarHelper::unarchiveList('links.publish', 'JTOOLBAR_UNARCHIVE');
             }
         }
     }
     if ($canDo->get('core.create')) {
         // Get the toolbar object instance
         $bar = JToolBar::getInstance('toolbar');
         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 ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'links.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolbarHelper::divider();
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('links.trash');
         JToolbarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolbarHelper::preferences('com_redirect');
         JToolbarHelper::divider();
     }
     JToolbarHelper::help('JHELP_COMPONENTS_REDIRECT_MANAGER');
     JHtmlSidebar::setAction('index.php?option=com_redirect&view=links');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', RedirectHelper::publishedOptions(), 'value', 'text', $this->state->get('filter.state'), true));
 }
Esempio n. 3
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     require_once JPATH_COMPONENT . '/helpers/banners.php';
     $canDo = JHelperContent::getActions('com_banners', 'category', $this->state->get('filter.category_id'));
     $user = JFactory::getUser();
     // Get the toolbar object instance
     $bar = JToolBar::getInstance('toolbar');
     JToolbarHelper::title(JText::_('COM_BANNERS_MANAGER_BANNERS'), 'bookmark banners');
     if (count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0) {
         JToolbarHelper::addNew('banner.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('banner.edit');
     }
     if ($canDo->get('core.edit.state')) {
         if ($this->state->get('filter.state') != 2) {
             JToolbarHelper::publish('banners.publish', 'JTOOLBAR_PUBLISH', true);
             JToolbarHelper::unpublish('banners.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         }
         if ($this->state->get('filter.state') != -1) {
             if ($this->state->get('filter.state') != 2) {
                 JToolbarHelper::archiveList('banners.archive');
             } elseif ($this->state->get('filter.state') == 2) {
                 JToolbarHelper::unarchiveList('banners.publish');
             }
         }
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::checkin('banners.checkin');
     }
     // Add a batch button
     if ($user->authorise('core.create', 'com_banners') && $user->authorise('core.edit', 'com_banners') && $user->authorise('core.edit.state', 'com_banners')) {
         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 ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'banners.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('banners.trash');
     }
     if ($user->authorise('core.admin', 'com_banners')) {
         JToolbarHelper::preferences('com_banners');
     }
     JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS');
 }
Esempio n. 4
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $state = $this->get('State');
     $canDo = JHelperContent::getActions('com_redirect');
     JToolbarHelper::title(JText::_('COM_REDIRECT_MANAGER_LINKS'), 'refresh redirect');
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('link.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('link.edit');
     }
     if ($canDo->get('core.edit.state')) {
         if ($state->get('filter.state') != 2) {
             JToolbarHelper::divider();
             JToolbarHelper::publish('links.publish', 'JTOOLBAR_ENABLE', true);
             JToolbarHelper::unpublish('links.unpublish', 'JTOOLBAR_DISABLE', true);
         }
         if ($state->get('filter.state') != -1) {
             JToolbarHelper::divider();
             if ($state->get('filter.state') != 2) {
                 JToolbarHelper::archiveList('links.archive');
             } elseif ($state->get('filter.state') == 2) {
                 JToolbarHelper::unarchiveList('links.publish', 'JTOOLBAR_UNARCHIVE');
             }
         }
     }
     if ($canDo->get('core.create')) {
         // Get the toolbar object instance
         $bar = JToolbar::getInstance('toolbar');
         $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 ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'links.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolbarHelper::divider();
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::custom('links.purge', 'purge', 'purge', 'COM_REDIRECT_TOOLBAR_PURGE', false);
         JToolbarHelper::trash('links.trash');
         JToolbarHelper::divider();
     }
     if ($canDo->get('core.admin') || $canDo->get('core.options')) {
         JToolbarHelper::preferences('com_redirect');
         JToolbarHelper::divider();
     }
     JToolbarHelper::help('JHELP_COMPONENTS_REDIRECT_MANAGER');
 }
Esempio n. 5
0
 /**
  * Add the page title and toolbar.
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     $state = $this->get('State');
     $canDo = RedirectHelper::getActions();
     JToolbarHelper::title(JText::_('COM_REDIRECT_MANAGER_LINKS'), 'redirect');
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('link.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('link.edit');
     }
     if ($canDo->get('core.edit.state')) {
         if ($state->get('filter.state') != 2) {
             JToolbarHelper::divider();
             JToolbarHelper::publish('links.publish', 'JTOOLBAR_ENABLE', true);
             JToolbarHelper::unpublish('links.unpublish', 'JTOOLBAR_DISABLE', true);
         }
         if ($state->get('filter.state') != -1) {
             JToolbarHelper::divider();
             if ($state->get('filter.state') != 2) {
                 JToolbarHelper::archiveList('links.archive');
             } elseif ($state->get('filter.state') == 2) {
                 JToolbarHelper::unarchiveList('links.publish', 'JTOOLBAR_UNARCHIVE');
             }
         }
     }
     if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'links.delete', 'JTOOLBAR_EMPTY_TRASH');
         JToolbarHelper::divider();
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('links.trash');
         JToolbarHelper::divider();
     }
     if ($canDo->get('core.admin')) {
         JToolbarHelper::preferences('com_redirect');
         JToolbarHelper::divider();
     }
     JToolbarHelper::help('JHELP_COMPONENTS_REDIRECT_MANAGER');
     JHtmlSidebar::setAction('index.php?option=com_redirect&view=links');
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', RedirectHelper::publishedOptions(), 'value', 'text', $this->state->get('filter.state'), true));
 }
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  */
 protected function addToolbar()
 {
     $canDo = PfmobileappwsHelper::getActions();
     $user = JFactory::getUser();
     JToolBarHelper::title(JText::_('Note'), 'generic.png');
     if ($canDo->get('core.create')) {
         JToolBarHelper::addNew('note.add');
     }
     if ($canDo->get('core.edit')) {
         JToolBarHelper::editList('note.edit');
     }
     if ($this->state->get('filter.state') != 2) {
         JToolbarHelper::publish('notes.publish', 'JTOOLBAR_PUBLISH', true);
         JToolbarHelper::unpublish('notes.unpublish', 'JTOOLBAR_UNPUBLISH', true);
     }
     if ($canDo->get('core.edit.state')) {
         if ($this->state->get('filter.state') != -1) {
             if ($this->state->get('filter.state') != 2) {
                 JToolbarHelper::archiveList('notes.archive');
             } elseif ($this->state->get('filter.state') == 2) {
                 JToolbarHelper::unarchiveList('notes.publish');
             }
         }
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::checkin('notes.checkin');
     }
     if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'notes.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('notes.trash');
     }
     JToolBarHelper::preferences('com_pfmobileappws', '550');
     if (!version_compare(JVERSION, '3', '<')) {
         JHtmlSidebar::setAction('index.php?option=com_pfmobileappws&view=notes');
     }
     if (!version_compare(JVERSION, '3', '<')) {
         JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.state'), true));
     }
 }
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since    1.6
  */
 protected function addToolbar()
 {
     /** @noinspection PhpIncludeInspection */
     require_once JPATH_COMPONENT . '/helpers/catalogue.php';
     /** @noinspection PhpUndefinedClassInspection */
     $canDo = CatalogueHelper::getActions();
     JToolbarHelper::title(JText::_('COM_CATALOGUE_MANAGER'), 'component.png');
     if ($canDo->get('core.create')) {
         JToolbarHelper::addNew('item.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('item.edit');
     }
     if ($canDo->get('core.edit.state')) {
         if ($this->state->get('filter.state') != 2) {
             JToolbarHelper::publish('item.publish', 'JTOOLBAR_PUBLISH', true);
             JToolbarHelper::unpublish('item.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         }
         if ($this->state->get('filter.state') != -1) {
             if ($this->state->get('filter.published') != 2) {
                 JToolbarHelper::archiveList('item.archive');
             } elseif ($this->state->get('filter.state') == 2) {
                 JToolbarHelper::unarchiveList('item.publish');
             }
         }
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::checkin('item.checkin');
     }
     if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('', 'catalogue.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('catalogue.trash');
     }
     if ($canDo->get('core.admin')) {
         JToolbarHelper::preferences('com_catalogue');
     }
 }
Esempio n. 8
0
 /**
  * Add the page title and toolbar.
  *
  */
 protected function addToolbar()
 {
     $user = JFactory::getUser();
     // Get the toolbar object instance
     $bar = JToolbar::getInstance('toolbar');
     JToolbarHelper::title(JText::_('COM_KNVBAPI2_COMPETITIES_LIST_HEADER'), 'stack competities');
     if ($this->can_do->get('core.create')) {
         JToolbarHelper::addNew('competitie.add', 'JTOOLBAR_NEW');
     }
     if ($this->can_do->get('core.edit') or $this->can_do->get('core.edit.own')) {
         JToolbarHelper::editList('competitie.edit', 'JTOOLBAR_EDIT');
     }
     if ($this->can_do->get('core.edit.state')) {
         if ($this->state->get('filter.state') != 2) {
             JToolbarHelper::custom('competities.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
             JToolbarHelper::custom('competities.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
         }
         if ($this->state->get('filter.state') != -1) {
             if ($this->state->get('filter.state') != 2) {
                 JToolbarHelper::archiveList('competities.archive', 'JTOOLBAR_ARCHIVE');
             } else {
                 if ($this->state->get('filter.state') == 2) {
                     JToolbarHelper::unarchiveList('competities.publish', 'JTOOLBAR_UNARCHIVE');
                 }
             }
         }
     }
     if ($this->can_do->get('core.edit.state')) {
         JToolbarHelper::custom('competities.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
     }
     // Add a batch button
     if ($user->authorise('core.create', 'com_knvbapi2') and $user->authorise('core.edit', 'com_knvbapi2') and $user->authorise('core.edit.state', 'com_knvbapi2')) {
         JHtml::_('bootstrap.modal', 'collapseModal');
         $title = JText::_('JTOOLBAR_BATCH');
         $dhtml = "<button data-toggle=\"modal\" data-target=\"#collapseModal\" class=\"btn btn-small\">\n\t\t\t\t\t\t<i class=\"icon-checkbox-partial\" title=\"{$title}\"></i>\n\t\t\t\t\t\t{$title}</button>";
         $bar->appendButton('Custom', $dhtml, 'batch');
     }
     if ($this->state->get('filter.state') == -2) {
         if ($this->can_do->get('core.delete')) {
             JToolbarHelper::deleteList('', 'competities.delete', 'JTOOLBAR_EMPTY_TRASH');
         }
     } else {
         if ($this->can_do->get('core.edit.state')) {
             JToolbarHelper::trash('competities.trash', 'JTOOLBAR_TRASH');
         }
     }
     if ($user->authorise('core.admin', 'com_knvbapi2') or $user->authorise('core.options', 'com_knvbapi2')) {
         JToolbarHelper::preferences('com_knvbapi2');
     }
 }
Esempio n. 9
0
 /**
  * Render a toolbar element.
  *
  * @param   string  $type        The element type.
  * @param   mixed   $value       The element value.
  * @param   array   $attributes  The element attributes.
  *
  * @return  void
  *
  * @throws  InvalidArgumentException
  */
 private function renderToolbarElement($type, $value = null, array $attributes = array())
 {
     switch ($type) {
         case 'title':
             $icon = isset($attributes['icon']) ? $attributes['icon'] : 'generic.png';
             JToolbarHelper::title($value, $icon);
             break;
         case 'divider':
             JToolbarHelper::divider();
             break;
         case 'custom':
             $task = isset($attributes['task']) ? $attributes['task'] : '';
             $icon = isset($attributes['icon']) ? $attributes['icon'] : '';
             $iconOver = isset($attributes['icon_over']) ? $attributes['icon_over'] : '';
             $alt = isset($attributes['alt']) ? $attributes['alt'] : '';
             $listSelect = isset($attributes['list_select']) ? FOFStringUtils::toBool($attributes['list_select']) : true;
             JToolbarHelper::custom($task, $icon, $iconOver, $alt, $listSelect);
             break;
         case 'preview':
             $url = isset($attributes['url']) ? $attributes['url'] : '';
             $update_editors = isset($attributes['update_editors']) ? FOFStringUtils::toBool($attributes['update_editors']) : false;
             JToolbarHelper::preview($url, $update_editors);
             break;
         case 'help':
             if (!isset($attributes['help'])) {
                 throw new InvalidArgumentException('The help attribute is missing in the help button type.');
             }
             $ref = $attributes['help'];
             $com = isset($attributes['com']) ? FOFStringUtils::toBool($attributes['com']) : false;
             $override = isset($attributes['override']) ? $attributes['override'] : null;
             $component = isset($attributes['component']) ? $attributes['component'] : null;
             JToolbarHelper::help($ref, $com, $override, $component);
             break;
         case 'back':
             $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_BACK';
             $href = isset($attributes['href']) ? $attributes['href'] : 'javascript:history.back();';
             JToolbarHelper::back($alt, $href);
             break;
         case 'media_manager':
             $directory = isset($attributes['directory']) ? $attributes['directory'] : '';
             $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_UPLOAD';
             JToolbarHelper::media_manager($directory, $alt);
             break;
         case 'assign':
             $task = isset($attributes['task']) ? $attributes['task'] : 'assign';
             $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_ASSIGN';
             JToolbarHelper::assign($task, $alt);
             break;
         case 'new':
             if ($this->perms->create) {
                 $task = isset($attributes['task']) ? $attributes['task'] : 'add';
                 $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_NEW';
                 $check = isset($attributes['check']) ? FOFStringUtils::toBool($attributes['check']) : false;
                 JToolbarHelper::addNew($task, $alt, $check);
             }
             break;
         case 'publish':
             if ($this->perms->editstate) {
                 $task = isset($attributes['task']) ? $attributes['task'] : 'publish';
                 $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_PUBLISH';
                 $check = isset($attributes['check']) ? FOFStringUtils::toBool($attributes['check']) : false;
                 JToolbarHelper::publish($task, $alt, $check);
             }
             break;
         case 'publishList':
             if ($this->perms->editstate) {
                 $task = isset($attributes['task']) ? $attributes['task'] : 'publish';
                 $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_PUBLISH';
                 JToolbarHelper::publishList($task, $alt);
             }
             break;
         case 'unpublish':
             if ($this->perms->editstate) {
                 $task = isset($attributes['task']) ? $attributes['task'] : 'unpublish';
                 $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_UNPUBLISH';
                 $check = isset($attributes['check']) ? FOFStringUtils::toBool($attributes['check']) : false;
                 JToolbarHelper::unpublish($task, $alt, $check);
             }
             break;
         case 'unpublishList':
             if ($this->perms->editstate) {
                 $task = isset($attributes['task']) ? $attributes['task'] : 'unpublish';
                 $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_UNPUBLISH';
                 JToolbarHelper::unpublishList($task, $alt);
             }
             break;
         case 'archiveList':
             if ($this->perms->editstate) {
                 $task = isset($attributes['task']) ? $attributes['task'] : 'archive';
                 $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_ARCHIVE';
                 JToolbarHelper::archiveList($task, $alt);
             }
             break;
         case 'unarchiveList':
             if ($this->perms->editstate) {
                 $task = isset($attributes['task']) ? $attributes['task'] : 'unarchive';
                 $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_UNARCHIVE';
                 JToolbarHelper::unarchiveList($task, $alt);
             }
             break;
         case 'editList':
             if ($this->perms->edit) {
                 $task = isset($attributes['task']) ? $attributes['task'] : 'edit';
                 $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_EDIT';
                 JToolbarHelper::editList($task, $alt);
             }
             break;
         case 'editHtml':
             $task = isset($attributes['task']) ? $attributes['task'] : 'edit_source';
             $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_EDIT_HTML';
             JToolbarHelper::editHtml($task, $alt);
             break;
         case 'editCss':
             $task = isset($attributes['task']) ? $attributes['task'] : 'edit_css';
             $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_EDIT_CSS';
             JToolbarHelper::editCss($task, $alt);
             break;
         case 'deleteList':
             if ($this->perms->delete) {
                 $msg = isset($attributes['msg']) ? $attributes['msg'] : '';
                 $task = isset($attributes['task']) ? $attributes['task'] : 'remove';
                 $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_DELETE';
                 JToolbarHelper::deleteList($msg, $task, $alt);
             }
             break;
         case 'trash':
             if ($this->perms->editstate) {
                 $task = isset($attributes['task']) ? $attributes['task'] : 'remove';
                 $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_TRASH';
                 $check = isset($attributes['check']) ? FOFStringUtils::toBool($attributes['check']) : true;
                 JToolbarHelper::trash($task, $alt, $check);
             }
             break;
         case 'apply':
             $task = isset($attributes['task']) ? $attributes['task'] : 'apply';
             $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_APPLY';
             JToolbarHelper::apply($task, $alt);
             break;
         case 'save':
             $task = isset($attributes['task']) ? $attributes['task'] : 'save';
             $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_SAVE';
             JToolbarHelper::save($task, $alt);
             break;
         case 'save2new':
             $task = isset($attributes['task']) ? $attributes['task'] : 'save2new';
             $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_SAVE_AND_NEW';
             JToolbarHelper::save2new($task, $alt);
             break;
         case 'save2copy':
             $task = isset($attributes['task']) ? $attributes['task'] : 'save2copy';
             $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_SAVE_AS_COPY';
             JToolbarHelper::save2copy($task, $alt);
             break;
         case 'checkin':
             $task = isset($attributes['task']) ? $attributes['task'] : 'checkin';
             $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_CHECKIN';
             $check = isset($attributes['check']) ? FOFStringUtils::toBool($attributes['check']) : true;
             JToolbarHelper::checkin($task, $alt, $check);
             break;
         case 'cancel':
             $task = isset($attributes['task']) ? $attributes['task'] : 'cancel';
             $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JTOOLBAR_CANCEL';
             JToolbarHelper::cancel($task, $alt);
             break;
         case 'preferences':
             if (!isset($attributes['component'])) {
                 throw new InvalidArgumentException('The component attribute is missing in the preferences button type.');
             }
             $component = $attributes['component'];
             $height = isset($attributes['height']) ? $attributes['height'] : '550';
             $width = isset($attributes['width']) ? $attributes['width'] : '875';
             $alt = isset($attributes['alt']) ? $attributes['alt'] : 'JToolbar_Options';
             $path = isset($attributes['path']) ? $attributes['path'] : '';
             JToolbarHelper::preferences($component, $height, $width, $alt, $path);
             break;
         default:
             throw new InvalidArgumentException(sprintf('Unknown button type %s', $type));
     }
 }
Esempio n. 10
0
 /**
  * Registers necessary buttons on the toolbar.
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function registerToolbar()
 {
     if ($this->getLayout() == 'templates') {
         JToolBarHelper::title(JText::_('COM_EASYBLOG_BLOGS_POST_TEMPLATES_TITLE'), 'blogs');
         JToolbarHelper::deleteList(JText::_('COM_EASYBLOG_CONFIRM_DELETE_POST_TEMPLATES'), 'blogs.deletePostTemplates');
         return;
     }
     if ($this->getLayout() == 'pending') {
         JToolBarHelper::title(JText::_('COM_EASYBLOG_BLOGS_ALL_BLOG_ENTRIES_TITLE'), 'blogs');
         JToolbarHelper::deleteList(JText::_('Are you sure you want to delete these pending posts?'), 'pending.remove');
         JToolbarHelper::publishList('blogs.publish', JText::_('COM_EASYBLOG_APPROVE'));
         JToolbarHelper::unpublishList('blogs.unpublish', JText::_('COM_EASYBLOG_REJECT'));
         return;
     }
     if ($this->getLayout() == 'drafts') {
         JToolBarHelper::title(JText::_('COM_EASYBLOG_BLOGS_DRAFT_BLOGS'), 'blogs');
         JToolbarHelper::deleteList(JText::_('COM_EASYBLOG_BLOGS_DRAFT_DELETE_DRAFTS_CONFIRMATION'), 'drafts.remove');
         return;
     }
     JToolBarHelper::title(JText::_('COM_EASYBLOG_BLOGS_ALL_BLOG_ENTRIES_TITLE'), 'blogs');
     JToolBarHelper::addNew('blogs.create');
     JToolBarHelper::divider();
     $state = $this->app->getUserStateFromRequest('com_easyblog.blogs.filter_state', 'filter_state', '*', 'word');
     if ($state != 'T') {
         JToolbarHelper::publishList('blogs.publish');
         JToolbarHelper::unpublishList('blogs.unpublish');
         JToolBarHelper::custom('blogs.feature', 'star', '', JText::_('COM_EASYBLOG_FEATURE_TOOLBAR'));
         JToolBarHelper::custom('blogs.unfeature', 'star-empty', '', JText::_('COM_EASYBLOG_UNFEATURE_TOOLBAR'));
         JToolbarHelper::archiveList('blogs.archive');
         JToolbarHelper::unarchiveList('blogs.unarchive');
         JToolbarHelper::custom('blogs.lock', 'lock', '', JText::_('COM_EASYBLOG_TOOLBAR_LOCK'));
         JToolbarHelper::custom('blogs.unlock', 'unlock', '', JText::_('COM_EASYBLOG_TOOLBAR_UNLOCK'));
         JToolBarHelper::custom('blogs.toggleFrontpage', 'featured.png', 'featured_f2.png', JText::_('COM_EASYBLOG_FRONTPAGE_TOOLBAR'), true);
         JToolBarHelper::divider();
     }
     // If this is on the trash view, we need to show empty trash icon
     if ($state == 'T') {
         JToolbarHelper::publishList('blogs.restore', JText::_('COM_EASYBLOG_RESTORE'));
         JToolbarHelper::deleteList(JText::_('COM_EASYBLOG_CONFIRM_DELETE'), 'blogs.remove');
     } else {
         JToolbarHelper::trash('blogs.trash');
         JToolBarHelper::custom('blogs.move', 'move', '', JText::_('COM_EASYBLOG_MOVE'));
         JToolBarHelper::custom('blogs.copy', 'copy', '', JText::_('COM_EASYBLOG_COPY'));
         JToolBarHelper::divider();
         JToolBarHelper::custom('blogs.changeAuthor', 'users', '', JText::_('COM_EASYBLOG_CHANGE_AUTHOR'));
     }
 }
Esempio n. 11
0
 /**
  * Add the page title and toolbar.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function addToolbar()
 {
     JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php');
     $canDo = JHelperContent::getActions('com_banners', 'category', $this->state->get('filter.category_id'));
     $user = JFactory::getUser();
     JToolbarHelper::title(JText::_('COM_BANNERS_MANAGER_BANNERS'), 'bookmark banners');
     if (count($user->getAuthorisedCategories('com_banners', 'core.create')) > 0) {
         JToolbarHelper::addNew('banner.add');
     }
     if ($canDo->get('core.edit')) {
         JToolbarHelper::editList('banner.edit');
     }
     if ($canDo->get('core.edit.state')) {
         if ($this->state->get('filter.published') != 2) {
             JToolbarHelper::publish('banners.publish', 'JTOOLBAR_PUBLISH', true);
             JToolbarHelper::unpublish('banners.unpublish', 'JTOOLBAR_UNPUBLISH', true);
         }
         if ($this->state->get('filter.published') != -1) {
             if ($this->state->get('filter.published') != 2) {
                 JToolbarHelper::archiveList('banners.archive');
             } elseif ($this->state->get('filter.published') == 2) {
                 JToolbarHelper::unarchiveList('banners.publish');
             }
         }
     }
     if ($canDo->get('core.edit.state')) {
         JToolbarHelper::checkin('banners.checkin');
     }
     // Add a batch button
     if ($user->authorise('core.create', 'com_banners') && $user->authorise('core.edit', 'com_banners') && $user->authorise('core.edit.state', 'com_banners')) {
         $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));
         JToolbar::getInstance('toolbar')->appendButton('Custom', $dhtml, 'batch');
     }
     if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) {
         JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'banners.delete', 'JTOOLBAR_EMPTY_TRASH');
     } elseif ($canDo->get('core.edit.state')) {
         JToolbarHelper::trash('banners.trash');
     }
     if ($user->authorise('core.admin', 'com_banners') || $user->authorise('core.options', 'com_banners')) {
         JToolbarHelper::preferences('com_banners');
     }
     JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_BANNERS');
 }