[ Indice ]

Riferimento incrociato di Joomla! 1.5.14 - VM 1.1.4

Servizio fornito da VMItalia
Classe:   Funzione:   Variabile:   Costante:  
Storico Ricerche +

titolo

Corpo

[chiudi]

/administrator/components/com_plugins/views/plugins/ -> view.html.php (sorgente)

   1  <?php
   2  /**
   3  * @version        $Id: view.html.php 11655 2009-03-08 20:04:17Z willebil $
   4  * @package        Joomla
   5  * @subpackage    Config
   6  * @copyright    Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
   7  * @license        GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // no direct access
  16  defined( '_JEXEC' ) or die( 'Restricted access' );
  17  
  18  jimport( 'joomla.application.component.view');
  19  
  20  /**
  21   * HTML View class for the Plugins component
  22   *
  23   * @static
  24   * @package        Joomla
  25   * @subpackage    Plugins
  26   * @since 1.0
  27   */
  28  class PluginsViewPlugins extends JView
  29  {
  30  	function display( $tpl = null )
  31      {
  32          global $mainframe, $option;
  33  
  34          $db =& JFactory::getDBO();
  35  
  36          $client = JRequest::getWord( 'filter_client', 'site' );
  37  
  38          $filter_order        = $mainframe->getUserStateFromRequest( "$option.$client.filter_order",        'filter_order',        'p.folder',    'cmd' );
  39          $filter_order_Dir    = $mainframe->getUserStateFromRequest( "$option.$client.filter_order_Dir",    'filter_order_Dir',    '',            'word' );
  40          $filter_state        = $mainframe->getUserStateFromRequest( "$option.$client.filter_state",        'filter_state',        '',            'word' );
  41          $filter_type        = $mainframe->getUserStateFromRequest( "$option.$client.filter_type",         'filter_type',        1,            'cmd' );
  42          $search                = $mainframe->getUserStateFromRequest( "$option.$client.search",            'search',            '',            'string' );
  43          $search                = JString::strtolower( $search );
  44  
  45          $limit        = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
  46          $limitstart    = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' );
  47  
  48          $where = '';
  49          if ($client == 'admin') {
  50              $where[] = 'p.client_id = 1';
  51              $client_id = 1;
  52          } else {
  53              $where[] = 'p.client_id = 0';
  54              $client_id = 0;
  55          }
  56  
  57          // used by filter
  58          if ( $filter_type != 1 ) {
  59              $where[] = 'p.folder = '.$db->Quote($filter_type);
  60          }
  61          if ( $search ) {
  62              $where[] = 'LOWER( p.name ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false );
  63          }
  64          if ( $filter_state ) {
  65              if ( $filter_state == 'P' ) {
  66                  $where[] = 'p.published = 1';
  67              } else if ($filter_state == 'U' ) {
  68                  $where[] = 'p.published = 0';
  69              }
  70          }
  71  
  72          $where         = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' );
  73          if ($filter_order == 'p.ordering') {
  74              $orderby = ' ORDER BY p.folder, p.ordering '. $filter_order_Dir;
  75          } else {
  76              $orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', p.ordering ASC';
  77          }
  78  
  79  
  80          // get the total number of records
  81          $query = 'SELECT COUNT(*)'
  82              . ' FROM #__plugins AS p'
  83              . $where
  84              ;
  85          $db->setQuery( $query );
  86          $total = $db->loadResult();
  87  
  88          jimport('joomla.html.pagination');
  89          $pagination = new JPagination( $total, $limitstart, $limit );
  90  
  91          $query = 'SELECT p.*, u.name AS editor, g.name AS groupname'
  92              . ' FROM #__plugins AS p'
  93              . ' LEFT JOIN #__users AS u ON u.id = p.checked_out'
  94              . ' LEFT JOIN #__groups AS g ON g.id = p.access'
  95              . $where
  96              . ' GROUP BY p.id'
  97              . $orderby
  98              ;
  99          $db->setQuery( $query, $pagination->limitstart, $pagination->limit );
 100          $rows = $db->loadObjectList();
 101          if ($db->getErrorNum()) {
 102              echo $db->stderr();
 103              return false;
 104          }
 105  
 106  
 107          // get list of Positions for dropdown filter
 108          $query = 'SELECT folder AS value, folder AS text'
 109              . ' FROM #__plugins'
 110              . ' WHERE client_id = '.(int) $client_id
 111              . ' GROUP BY folder'
 112              . ' ORDER BY folder'
 113              ;
 114          $types[] = JHTML::_('select.option',  1, '- '. JText::_( 'Select Type' ) .' -' );
 115          $db->setQuery( $query );
 116          $types             = array_merge( $types, $db->loadObjectList() );
 117          $lists['type']    = JHTML::_('select.genericlist',   $types, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $filter_type );
 118  
 119          // state filter
 120          $lists['state']    = JHTML::_('grid.state',  $filter_state );
 121  
 122  
 123          // table ordering
 124          $lists['order_Dir']    = $filter_order_Dir;
 125          $lists['order']        = $filter_order;
 126  
 127          // search filter
 128          $lists['search']= $search;
 129  
 130          $this->assign('client',        $client);
 131  
 132          $this->assignRef('user',        JFactory::getUser());
 133          $this->assignRef('lists',        $lists);
 134          $this->assignRef('items',        $rows);
 135          $this->assignRef('pagination',    $pagination);
 136  
 137          parent::display($tpl);
 138      }
 139  }


Generato il: Mon Oct 19 20:29:27 2009 Generato con PHPXref 0.7