Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_banners
  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 clients.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_banners
  17.  * @since       1.6
  18.  */
  19. {
  20.     protected $items;
  21.  
  22.     protected $pagination;
  23.  
  24.     protected $state;
  25.  
  26.     /**
  27.      * Display the view
  28.      *
  29.      * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  30.      *
  31.      * @return  void 
  32.      */
  33.     public function display($tpl null)
  34.     {
  35.         $this->items         = $this->get('Items');
  36.         $this->pagination    = $this->get('Pagination');
  37.         $this->state         = $this->get('State');
  38.         $this->filterForm    $this->get('FilterForm');
  39.         $this->activeFilters $this->get('ActiveFilters');
  40.  
  41.         // Check for errors.
  42.         if (count($errors $this->get('Errors')))
  43.         {
  44.             JError::raiseError(500implode("\n"$errors));
  45.  
  46.             return false;
  47.         }
  48.  
  49.         BannersHelper::addSubmenu('clients');
  50.  
  51.         $this->addToolbar();
  52.         $this->sidebar JHtmlSidebar::render();
  53.         parent::display($tpl);
  54.     }
  55.  
  56.     /**
  57.      * Add the page title and toolbar.
  58.      *
  59.      * @return  void 
  60.      *
  61.      * @since   1.6
  62.      */
  63.     protected function addToolbar()
  64.     {
  65.         require_once JPATH_COMPONENT '/helpers/banners.php';
  66.  
  67.         $canDo    JHelperContent::getActions(00'com_banners');
  68.  
  69.         JToolbarHelper::title(JText::_('COM_BANNERS_MANAGER_CLIENTS')'banners-clients.png');
  70.  
  71.         if ($canDo->get('core.create'))
  72.         {
  73.             JToolbarHelper::addNew('client.add');
  74.         }
  75.  
  76.         if ($canDo->get('core.edit'))
  77.         {
  78.             JToolbarHelper::editList('client.edit');
  79.         }
  80.  
  81.         if ($canDo->get('core.edit.state'))
  82.         {
  83.             JToolbarHelper::publish('clients.publish''JTOOLBAR_PUBLISH'true);
  84.             JToolbarHelper::unpublish('clients.unpublish''JTOOLBAR_UNPUBLISH'true);
  85.             JToolbarHelper::archiveList('clients.archive');
  86.             JToolbarHelper::checkin('clients.checkin');
  87.         }
  88.  
  89.         if ($this->state->get('filter.state'== -&& $canDo->get('core.delete'))
  90.         {
  91.             JToolbarHelper::deleteList('''clients.delete''JTOOLBAR_EMPTY_TRASH');
  92.         }
  93.         elseif ($canDo->get('core.edit.state'))
  94.         {
  95.             JToolbarHelper::trash('clients.trash');
  96.         }
  97.  
  98.         if ($canDo->get('core.admin'))
  99.         {
  100.             JToolbarHelper::preferences('com_banners');
  101.         }
  102.  
  103.         JToolbarHelper::help('JHELP_COMPONENTS_BANNERS_CLIENTS');
  104.     }
  105.  
  106.     /**
  107.      * Returns an array of fields the table can be sorted by
  108.      *
  109.      * @return  array  Array containing the field name to sort by as the key and display text as value
  110.      *
  111.      * @since   3.0
  112.      */
  113.     protected function getSortFields()
  114.     {
  115.         return array(
  116.             'a.status' => JText::_('JSTATUS'),
  117.             'a.name' => JText::_('COM_BANNERS_HEADING_CLIENT'),
  118.             'contact' => JText::_('COM_BANNERS_HEADING_CONTACT'),
  119.             'client_name' => JText::_('COM_BANNERS_HEADING_CLIENT'),
  120.             'nbanners' => JText::_('COM_BANNERS_HEADING_ACTIVE'),
  121.             'a.id' => JText::_('JGRID_HEADING_ID')
  122.         );
  123.     }
  124. }

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