Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_weblinks
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 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 weblinks.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_weblinks
  17.  * @since       1.5
  18.  */
  19. {
  20.     protected $items;
  21.  
  22.     protected $pagination;
  23.  
  24.     protected $state;
  25.  
  26.     /**
  27.      * Display the view
  28.      *
  29.      * @return  void 
  30.      */
  31.     public function display($tpl null)
  32.     {
  33.         $this->state        = $this->get('State');
  34.         $this->items        = $this->get('Items');
  35.         $this->pagination    = $this->get('Pagination');
  36.  
  37.         WeblinksHelper::addSubmenu('weblinks');
  38.  
  39.         // Check for errors.
  40.         if (count($errors $this->get('Errors')))
  41.         {
  42.             JError::raiseError(500implode("\n"$errors));
  43.             return false;
  44.         }
  45.  
  46.         $this->addToolbar();
  47.         $this->sidebar JHtmlSidebar::render();
  48.         parent::display($tpl);
  49.     }
  50.  
  51.     /**
  52.      * Add the page title and toolbar.
  53.      *
  54.      * @since   1.6
  55.      */
  56.     protected function addToolbar()
  57.     {
  58.         require_once JPATH_COMPONENT '/helpers/weblinks.php';
  59.  
  60.         $state    $this->get('State');
  61.         $canDo    JHelperContent::getActions($state->get('filter.category_id')0'com_weblinks');
  62.         $user    JFactory::getUser();
  63.  
  64.         // Get the toolbar object instance
  65.         $bar JToolBar::getInstance('toolbar');
  66.  
  67.         JToolbarHelper::title(JText::_('COM_WEBLINKS_MANAGER_WEBLINKS')'link weblinks');
  68.         if (count($user->getAuthorisedCategories('com_weblinks''core.create')) 0)
  69.         {
  70.             JToolbarHelper::addNew('weblink.add');
  71.         }
  72.         if ($canDo->get('core.edit'))
  73.         {
  74.             JToolbarHelper::editList('weblink.edit');
  75.         }
  76.         if ($canDo->get('core.edit.state')) {
  77.  
  78.             JToolbarHelper::publish('weblinks.publish''JTOOLBAR_PUBLISH'true);
  79.             JToolbarHelper::unpublish('weblinks.unpublish''JTOOLBAR_UNPUBLISH'true);
  80.  
  81.             JToolbarHelper::archiveList('weblinks.archive');
  82.             JToolbarHelper::checkin('weblinks.checkin');
  83.         }
  84.         if ($state->get('filter.state'== -&& $canDo->get('core.delete'))
  85.         {
  86.             JToolbarHelper::deleteList('''weblinks.delete''JTOOLBAR_EMPTY_TRASH');
  87.         elseif ($canDo->get('core.edit.state'))
  88.         {
  89.             JToolbarHelper::trash('weblinks.trash');
  90.         }
  91.         // Add a batch button
  92.         if ($user->authorise('core.create''com_weblinks'&& $user->authorise('core.edit''com_weblinks'&& $user->authorise('core.edit.state''com_weblinks'))
  93.         {
  94.             JHtml::_('bootstrap.modal''collapseModal');
  95.             $title JText::_('JTOOLBAR_BATCH');
  96.  
  97.             // Instantiate a new JLayoutFile instance and render the batch button
  98.             $layout new JLayoutFile('joomla.toolbar.batch');
  99.  
  100.             $dhtml $layout->render(array('title' => $title));
  101.             $bar->appendButton('Custom'$dhtml'batch');
  102.         }
  103.         if ($canDo->get('core.admin'))
  104.         {
  105.             JToolbarHelper::preferences('com_weblinks');
  106.         }
  107.  
  108.         JToolbarHelper::help('JHELP_COMPONENTS_WEBLINKS_LINKS');
  109.  
  110.         JHtmlSidebar::setAction('index.php?option=com_weblinks&view=weblinks');
  111.  
  112.         JHtmlSidebar::addFilter(
  113.             JText::_('JOPTION_SELECT_PUBLISHED'),
  114.             'filter_state',
  115.             JHtml::_('select.options'JHtml::_('jgrid.publishedOptions')'value''text'$this->state->get('filter.state')true)
  116.         );
  117.  
  118.         JHtmlSidebar::addFilter(
  119.             JText::_('JOPTION_SELECT_CATEGORY'),
  120.             'filter_category_id',
  121.             JHtml::_('select.options'JHtml::_('category.options''com_weblinks')'value''text'$this->state->get('filter.category_id'))
  122.         );
  123.  
  124.         JHtmlSidebar::addFilter(
  125.             JText::_('JOPTION_SELECT_ACCESS'),
  126.             'filter_access',
  127.             JHtml::_('select.options'JHtml::_('access.assetgroups')'value''text'$this->state->get('filter.access'))
  128.         );
  129.  
  130.         JHtmlSidebar::addFilter(
  131.             JText::_('JOPTION_SELECT_LANGUAGE'),
  132.             'filter_language',
  133.             JHtml::_('select.options'JHtml::_('contentlanguage.existing'truetrue)'value''text'$this->state->get('filter.language'))
  134.         );
  135.  
  136.         JHtmlSidebar::addFilter(
  137.         JText::_('JOPTION_SELECT_TAG'),
  138.         'filter_tag',
  139.         JHtml::_('select.options'JHtml::_('tag.options'truetrue)'value''text'$this->state->get('filter.tag'))
  140.         );
  141.  
  142.     }
  143.  
  144.     /**
  145.      * Returns an array of fields the table can be sorted by
  146.      *
  147.      * @return  array  Array containing the field name to sort by as the key and display text as value
  148.      *
  149.      * @since   3.0
  150.      */
  151.     protected function getSortFields()
  152.     {
  153.         return array(
  154.             'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
  155.             'a.state' => JText::_('JSTATUS'),
  156.             'a.title' => JText::_('JGLOBAL_TITLE'),
  157.             'a.access' => JText::_('JGRID_HEADING_ACCESS'),
  158.             'a.hits' => JText::_('JGLOBAL_HITS'),
  159.             'a.language' => JText::_('JGRID_HEADING_LANGUAGE'),
  160.             'a.id' => JText::_('JGRID_HEADING_ID')
  161.         );
  162.     }
  163. }

Documentation generated on Tue, 19 Nov 2013 15:17:57 +0100 by phpDocumentor 1.4.3