| [ Index ] |
PHP Cross Reference of Joomla 1.5.26 DE |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @version $Id: view.html.php 19343 2010-11-03 18:12:02Z ian $ 4 * @package Joomla 5 * @subpackage Config 6 * @copyright Copyright (C) 2005 - 2010 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 if (strpos($search, '"') !== false) { 44 $search = str_replace(array('=', '<'), '', $search); 45 } 46 $search = JString::strtolower($search); 47 48 $limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' ); 49 $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' ); 50 51 $where = ''; 52 if ($client == 'admin') { 53 $where[] = 'p.client_id = 1'; 54 $client_id = 1; 55 } else { 56 $where[] = 'p.client_id = 0'; 57 $client_id = 0; 58 } 59 60 // used by filter 61 if ( $filter_type != 1 ) { 62 $where[] = 'p.folder = '.$db->Quote($filter_type); 63 } 64 if ( $search ) { 65 $where[] = 'LOWER( p.name ) LIKE '.$db->Quote( '%'.$db->getEscaped( $search, true ).'%', false ); 66 } 67 if ( $filter_state ) { 68 if ( $filter_state == 'P' ) { 69 $where[] = 'p.published = 1'; 70 } else if ($filter_state == 'U' ) { 71 $where[] = 'p.published = 0'; 72 } 73 } 74 75 $where = ( count( $where ) ? ' WHERE ' . implode( ' AND ', $where ) : '' ); 76 77 // sanitize $filter_order 78 if (!in_array($filter_order, array('p.name', 'p.published', 'p.ordering', 'groupname', 'p.folder', 'p.element', 'p.id'))) { 79 $filter_order = 'p.folder'; 80 } 81 82 if (!in_array(strtoupper($filter_order_Dir), array('ASC', 'DESC'))) { 83 $filter_order_Dir = ''; 84 } 85 86 if ($filter_order == 'p.ordering') { 87 $orderby = ' ORDER BY p.folder, p.ordering '. $filter_order_Dir; 88 } else { 89 $orderby = ' ORDER BY '. $filter_order .' '. $filter_order_Dir .', p.ordering ASC'; 90 } 91 92 // get the total number of records 93 $query = 'SELECT COUNT(*)' 94 . ' FROM #__plugins AS p' 95 . $where 96 ; 97 $db->setQuery( $query ); 98 $total = $db->loadResult(); 99 100 jimport('joomla.html.pagination'); 101 $pagination = new JPagination( $total, $limitstart, $limit ); 102 103 $query = 'SELECT p.*, u.name AS editor, g.name AS groupname' 104 . ' FROM #__plugins AS p' 105 . ' LEFT JOIN #__users AS u ON u.id = p.checked_out' 106 . ' LEFT JOIN #__groups AS g ON g.id = p.access' 107 . $where 108 . ' GROUP BY p.id' 109 . $orderby 110 ; 111 $db->setQuery( $query, $pagination->limitstart, $pagination->limit ); 112 $rows = $db->loadObjectList(); 113 if ($db->getErrorNum()) { 114 echo $db->stderr(); 115 return false; 116 } 117 118 119 // get list of Positions for dropdown filter 120 $query = 'SELECT folder AS value, folder AS text' 121 . ' FROM #__plugins' 122 . ' WHERE client_id = '.(int) $client_id 123 . ' GROUP BY folder' 124 . ' ORDER BY folder' 125 ; 126 $types[] = JHTML::_('select.option', 1, '- '. JText::_( 'Select Type' ) .' -' ); 127 $db->setQuery( $query ); 128 $types = array_merge( $types, $db->loadObjectList() ); 129 $lists['type'] = JHTML::_('select.genericlist', $types, 'filter_type', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $filter_type ); 130 131 // state filter 132 $lists['state'] = JHTML::_('grid.state', $filter_state ); 133 134 135 // table ordering 136 $lists['order_Dir'] = $filter_order_Dir; 137 $lists['order'] = $filter_order; 138 139 // search filter 140 $lists['search']= $search; 141 142 $this->assign('client', $client); 143 144 $this->assignRef('user', JFactory::getUser()); 145 $this->assignRef('lists', $lists); 146 $this->assignRef('items', $rows); 147 $this->assignRef('pagination', $pagination); 148 149 parent::display($tpl); 150 } 151 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Mar 28 15:54:07 2012 | Cross-referenced by PHPXref 0.7.1 |