Joomla! PHP Cross Reference Web Portals

Source: /administrator/components/com_redirect/views/links/view.html.php - 106 lines - 2824 bytes - Summary - Text - Print

   1  <?php
   2  /**
   3   * @package     Joomla.Administrator
   4   * @subpackage  com_redirect
   5   *
   6   * @copyright   Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   7   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  defined('_JEXEC') or die;
  11  
  12  /**
  13   * View class for a list of redirection links.
  14   *
  15   * @package     Joomla.Administrator
  16   * @subpackage  com_redirect
  17   * @since       1.6
  18   */
  19  class RedirectViewLinks extends JViewLegacy
  20  {
  21      protected $enabled;
  22  
  23      protected $items;
  24  
  25      protected $pagination;
  26  
  27      protected $state;
  28  
  29      /**
  30       * Display the view
  31       *
  32       * @since    1.6
  33       */
  34  	public function display($tpl = null)
  35      {
  36          $this->enabled        = RedirectHelper::isEnabled();
  37          $this->items        = $this->get('Items');
  38          $this->pagination    = $this->get('Pagination');
  39          $this->state        = $this->get('State');
  40  
  41          // Check for errors.
  42          if (count($errors = $this->get('Errors'))) {
  43              JError::raiseError(500, implode("\n", $errors));
  44              return false;
  45          }
  46  
  47          $this->addToolbar();
  48          $this->sidebar = JHtmlSidebar::render();
  49          parent::display($tpl);
  50      }
  51  
  52      /**
  53       * Add the page title and toolbar.
  54       *
  55       * @since    1.6
  56       */
  57  	protected function addToolbar()
  58      {
  59          $state    = $this->get('State');
  60          $canDo    = RedirectHelper::getActions();
  61  
  62          JToolbarHelper::title(JText::_('COM_REDIRECT_MANAGER_LINKS'), 'redirect');
  63          if ($canDo->get('core.create')) {
  64              JToolbarHelper::addNew('link.add');
  65          }
  66          if ($canDo->get('core.edit')) {
  67              JToolbarHelper::editList('link.edit');
  68          }
  69          if ($canDo->get('core.edit.state')) {
  70              if ($state->get('filter.state') != 2){
  71                  JToolbarHelper::divider();
  72                  JToolbarHelper::publish('links.publish', 'JTOOLBAR_ENABLE', true);
  73                  JToolbarHelper::unpublish('links.unpublish', 'JTOOLBAR_DISABLE', true);
  74              }
  75              if ($state->get('filter.state') != -1 ) {
  76                  JToolbarHelper::divider();
  77                  if ($state->get('filter.state') != 2) {
  78                      JToolbarHelper::archiveList('links.archive');
  79                  }
  80                  elseif ($state->get('filter.state') == 2) {
  81                      JToolbarHelper::unarchiveList('links.publish', 'JTOOLBAR_UNARCHIVE');
  82                  }
  83              }
  84          }
  85          if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
  86              JToolbarHelper::deleteList('', 'links.delete', 'JTOOLBAR_EMPTY_TRASH');
  87              JToolbarHelper::divider();
  88          } elseif ($canDo->get('core.edit.state')) {
  89              JToolbarHelper::trash('links.trash');
  90              JToolbarHelper::divider();
  91          }
  92          if ($canDo->get('core.admin')) {
  93              JToolbarHelper::preferences('com_redirect');
  94              JToolbarHelper::divider();
  95          }
  96          JToolbarHelper::help('JHELP_COMPONENTS_REDIRECT_MANAGER');
  97  
  98          JHtmlSidebar::setAction('index.php?option=com_redirect&view=links');
  99  
 100          JHtmlSidebar::addFilter(
 101              JText::_('JOPTION_SELECT_PUBLISHED'),
 102              'filter_state',
 103              JHtml::_('select.options', RedirectHelper::publishedOptions(), 'value', 'text', $this->state->get('filter.state'), true)
 104          );
 105      }
 106  }

title

Description

title

Description

title

Description

title

title

Body