Source for file view.html.php

Documentation is available at view.html.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Administrator
  4.  * @subpackage  com_users
  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 users.
  14.  *
  15.  * @package     Joomla.Administrator
  16.  * @subpackage  com_users
  17.  * @since       1.6
  18.  */
  19. class UsersViewUsers extends JViewLegacy
  20. {
  21.     protected $items;
  22.  
  23.     protected $pagination;
  24.  
  25.     protected $state;
  26.  
  27.     /**
  28.      * Display the view
  29.      *
  30.      * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  31.      *
  32.      * @return  void 
  33.      */
  34.     public function display($tpl null)
  35.     {
  36.         $this->items        = $this->get('Items');
  37.         $this->pagination    = $this->get('Pagination');
  38.         $this->state        = $this->get('State');
  39.         $this->filterForm    $this->get('FilterForm');
  40.         $this->activeFilters $this->get('ActiveFilters');
  41.  
  42.         UsersHelper::addSubmenu('users');
  43.  
  44.         // Check for errors.
  45.         if (count($errors $this->get('Errors')))
  46.         {
  47.             JError::raiseError(500implode("\n"$errors));
  48.  
  49.             return false;
  50.         }
  51.  
  52.         // Include the component HTML helpers.
  53.         JHtml::addIncludePath(JPATH_COMPONENT '/helpers/html');
  54.  
  55.         $this->addToolbar();
  56.         $this->sidebar JHtmlSidebar::render();
  57.         parent::display($tpl);
  58.     }
  59.  
  60.     /**
  61.      * Add the page title and toolbar.
  62.      *
  63.      * @return  void 
  64.      *
  65.      * @since   1.6
  66.      */
  67.     protected function addToolbar()
  68.     {
  69.         $canDo    UsersHelper::getActions();
  70.         $user     JFactory::getUser();
  71.  
  72.         // Get the toolbar object instance
  73.         $bar JToolBar::getInstance('toolbar');
  74.  
  75.         JToolbarHelper::title(JText::_('COM_USERS_VIEW_USERS_TITLE')'users user');
  76.  
  77.         if ($canDo->get('core.create'))
  78.         {
  79.             JToolbarHelper::addNew('user.add');
  80.         }
  81.  
  82.         if ($canDo->get('core.edit'))
  83.         {
  84.             JToolbarHelper::editList('user.edit');
  85.         }
  86.  
  87.         if ($canDo->get('core.edit.state'))
  88.         {
  89.             JToolbarHelper::divider();
  90.             JToolbarHelper::publish('users.activate''COM_USERS_TOOLBAR_ACTIVATE'true);
  91.             JToolbarHelper::unpublish('users.block''COM_USERS_TOOLBAR_BLOCK'true);
  92.             JToolbarHelper::custom('users.unblock''unblock.png''unblock_f2.png''COM_USERS_TOOLBAR_UNBLOCK'true);
  93.             JToolbarHelper::divider();
  94.         }
  95.  
  96.         if ($canDo->get('core.delete'))
  97.         {
  98.             JToolbarHelper::deleteList('''users.delete');
  99.             JToolbarHelper::divider();
  100.         }
  101.  
  102.         // Add a batch button
  103.         if ($user->authorise('core.create''com_users'&& $user->authorise('core.edit''com_users'&& $user->authorise('core.edit.state''com_users'))
  104.         {
  105.             JHtml::_('bootstrap.modal''collapseModal');
  106.             $title JText::_('JTOOLBAR_BATCH');
  107.  
  108.             // Instantiate a new JLayoutFile instance and render the batch button
  109.             $layout new JLayoutFile('joomla.toolbar.batch');
  110.  
  111.             $dhtml $layout->render(array('title' => $title));
  112.             $bar->appendButton('Custom'$dhtml'batch');
  113.         }
  114.  
  115.         if ($canDo->get('core.admin'))
  116.         {
  117.             JToolbarHelper::preferences('com_users');
  118.             JToolbarHelper::divider();
  119.         }
  120.  
  121.         JToolbarHelper::help('JHELP_USERS_USER_MANAGER');
  122.     }
  123.  
  124.     /**
  125.      * Returns an array of fields the table can be sorted by
  126.      *
  127.      * @return  array  Array containing the field name to sort by as the key and display text as value
  128.      *
  129.      * @since   3.0
  130.      */
  131.     protected function getSortFields()
  132.     {
  133.         return array(
  134.                 'a.name' => JText::_('COM_USERS_HEADING_NAME'),
  135.                 'a.username' => JText::_('JGLOBAL_USERNAME'),
  136.                 'a.block' => JText::_('COM_USERS_HEADING_ENABLED'),
  137.                 'a.activation' => JText::_('COM_USERS_HEADING_ACTIVATED'),
  138.                 'a.email' => JText::_('JGLOBAL_EMAIL'),
  139.                 'a.lastvisitDate' => JText::_('COM_USERS_HEADING_LAST_VISIT_DATE'),
  140.                 'a.registerDate' => JText::_('COM_USERS_HEADING_REGISTRATION_DATE'),
  141.                 'a.id' => JText::_('JGRID_HEADING_ID')
  142.         );
  143.     }
  144. }

Documentation generated on Tue, 19 Nov 2013 15:18:05 +0100 by phpDocumentor 1.4.3