0byt3m1n1-V2
Path:
/
home
/
a
/
c
/
a
/
academiac
/
www
/
[
Home
]
File: filters.php.tar
home/academiac/www/administrator/components/com_finder/controllers/filters.php 0000644 00000002004 15145312614 0024106 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_finder * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; jimport('joomla.application.component.controlleradmin'); /** * Filters controller class for Finder. * * @package Joomla.Administrator * @subpackage com_finder * @since 2.5 */ class FinderControllerFilters extends JControllerAdmin { /** * Method to get a model object, loading it if required. * * @param string $name The model name. Optional. * @param string $prefix The class prefix. Optional. * @param array $config Configuration array for model. Optional. * * @return object The model. * * @since 2.5 */ public function getModel($name = 'Filter', $prefix = 'FinderModel', $config = array('ignore_request' => true)) { $model = parent::getModel($name, $prefix, $config); return $model; } } home/academiac/www/administrator/components/com_finder/models/filters.php 0000644 00000007337 15145323311 0023035 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_finder * * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('_JEXEC') or die; jimport('joomla.application.component.modellist'); /** * Filters model class for Finder. * * @package Joomla.Administrator * @subpackage com_finder * @since 2.5 */ class FinderModelFilters extends JModelList { /** * Constructor. * * @param array $config An associative array of configuration settings. [optional] * * @since 2.5 * @see JController */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'filter_id', 'a.filter_id', 'title', 'a.title', 'state', 'a.state', 'created_by_alias', 'a.created_by_alias', 'created', 'a.created', 'map_count', 'a.map_count' ); } parent::__construct($config); } /** * Build an SQL query to load the list data. * * @return JDatabaseQuery A JDatabaseQuery object * * @since 2.5 */ protected function getListQuery() { $db = $this->getDbo(); $query = $db->getQuery(true); // Select all fields from the table. $query->select('a.*'); $query->from($db->quoteName('#__finder_filters') . ' AS a'); // Join over the users for the checked out user. $query->select('uc.name AS editor'); $query->join('LEFT', $db->quoteName('#__users') . ' AS uc ON uc.id=a.checked_out'); // Join over the users for the author. $query->select('ua.name AS user_name'); $query->join('LEFT', $db->quoteName('#__users') . ' AS ua ON ua.id = a.created_by'); // Check for a search filter. if ($this->getState('filter.search')) { $query->where('( ' . $db->quoteName('a.title') . ' LIKE \'%' . $db->escape($this->getState('filter.search')) . '%\' )'); } // If the model is set to check item state, add to the query. if (is_numeric($this->getState('filter.state'))) { $query->where($db->quoteName('a.state') . ' = ' . (int) $this->getState('filter.state')); } // Add the list ordering clause. $query->order($db->escape($this->getState('list.ordering') . ' ' . $db->escape($this->getState('list.direction')))); return $query; } /** * Method to get a store id based on model configuration state. * * This is necessary because the model is used by the component and * different modules that might need different sets of data or different * ordering requirements. * * @param string $id A prefix for the store id. [optional] * * @return string A store id. * * @since 2.5 */ protected function getStoreId($id = '') { // Compile the store id. $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.state'); return parent::getStoreId($id); } /** * Method to auto-populate the model state. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. [optional] * @param string $direction An optional direction. [optional] * * @return void * * @since 2.5 */ protected function populateState($ordering = null, $direction = null) { // Load the filter state. $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $state = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string'); $this->setState('filter.state', $state); // Load the parameters. $params = JComponentHelper::getParams('com_finder'); $this->setState('params', $params); // List state information. parent::populateState('a.title', 'asc'); } } home/academiac/www/administrator/components/com_config/models/fields/filters.php 0000644 00000011144 15146625213 0024277 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('JPATH_BASE') or die; /** * Text Filters form field. * * @package Joomla.Administrator * @subpackage com_config * @since 1.6 */ class JFormFieldFilters extends JFormField { /** * The form field type. * * @var string * @since 1.6 */ public $type = 'Filters'; /** * Method to get the field input markup. * * TODO: Add access check. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { // Get the available user groups. $groups = $this->getUserGroups(); // Build the form control. $html = array(); // Open the table. $html[] = '<table id="filter-config">'; // The table heading. $html[] = ' <thead>'; $html[] = ' <tr>'; $html[] = ' <th>'; $html[] = ' <span class="acl-action">'.JText::_('JGLOBAL_FILTER_GROUPS_LABEL').'</span>'; $html[] = ' </th>'; $html[] = ' <th>'; $html[] = ' <span class="acl-action" title="'.JText::_('JGLOBAL_FILTER_TYPE_LABEL').'">'.JText::_('JGLOBAL_FILTER_TYPE_LABEL').'</span>'; $html[] = ' </th>'; $html[] = ' <th>'; $html[] = ' <span class="acl-action" title="'.JText::_('JGLOBAL_FILTER_TAGS_LABEL').'">'.JText::_('JGLOBAL_FILTER_TAGS_LABEL').'</span>'; $html[] = ' </th>'; $html[] = ' <th>'; $html[] = ' <span class="acl-action" title="'.JText::_('JGLOBAL_FILTER_ATTRIBUTES_LABEL').'">'.JText::_('JGLOBAL_FILTER_ATTRIBUTES_LABEL').'</span>'; $html[] = ' </th>'; $html[] = ' </tr>'; $html[] = ' </thead>'; // The table body. $html[] = ' <tbody>'; foreach ($groups as $group) { if (!isset($this->value[$group->value])) { $this->value[$group->value] = array('filter_type' => 'BL', 'filter_tags' => '', 'filter_attributes' => ''); } $group_filter = $this->value[$group->value]; $html[] = ' <tr>'; $html[] = ' <th class="acl-groups left">'; $html[] = ' '.str_repeat('<span class="gi">|—</span>', $group->level).$group->text; $html[] = ' </th>'; $html[] = ' <td>'; $html[] = ' <select name="'.$this->name.'['.$group->value.'][filter_type]" id="'.$this->id.$group->value.'_filter_type" class="hasTip" title="'.JText::_('JGLOBAL_FILTER_TYPE_LABEL').'::'.JText::_('JGLOBAL_FILTER_TYPE_DESC').'">'; $html[] = ' <option value="BL"'.($group_filter['filter_type'] == 'BL' ? ' selected="selected"' : '').'>'.JText::_('COM_CONFIG_FIELD_FILTERS_DEFAULT_BLACK_LIST').'</option>'; $html[] = ' <option value="CBL"'.($group_filter['filter_type'] == 'CBL' ? ' selected="selected"' : '').'>'.JText::_('COM_CONFIG_FIELD_FILTERS_CUSTOM_BLACK_LIST').'</option>'; $html[] = ' <option value="WL"'.($group_filter['filter_type'] == 'WL' ? ' selected="selected"' : '').'>'.JText::_('COM_CONFIG_FIELD_FILTERS_WHITE_LIST').'</option>'; $html[] = ' <option value="NH"'.($group_filter['filter_type'] == 'NH' ? ' selected="selected"' : '').'>'.JText::_('COM_CONFIG_FIELD_FILTERS_NO_HTML').'</option>'; $html[] = ' <option value="NONE"'.($group_filter['filter_type'] == 'NONE' ? ' selected="selected"' : '').'>'.JText::_('COM_CONFIG_FIELD_FILTERS_NO_FILTER').'</option>'; $html[] = ' </select>'; $html[] = ' </td>'; $html[] = ' <td>'; $html[] = ' <input name="'.$this->name.'['.$group->value.'][filter_tags]" id="'.$this->id.$group->value.'_filter_tags" title="'.JText::_('JGLOBAL_FILTER_TAGS_LABEL').'" value="'.$group_filter['filter_tags'].'"/>'; $html[] = ' </td>'; $html[] = ' <td>'; $html[] = ' <input name="'.$this->name.'['.$group->value.'][filter_attributes]" id="'.$this->id.$group->value.'_filter_attributes" title="'.JText::_('JGLOBAL_FILTER_ATTRIBUTES_LABEL').'" value="'.$group_filter['filter_attributes'].'"/>'; $html[] = ' </td>'; $html[] = ' </tr>'; } $html[] = ' </tbody>'; // Close the table. $html[] = '</table>'; return implode("\n", $html); } /** * A helper to get the list of user groups. * * @return array * @since 1.6 */ protected function getUserGroups() { // Get a database object. $db = JFactory::getDBO(); // Get the user groups from the database. $query = $db->getQuery(true); $query->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level'); $query->from('#__usergroups AS a'); $query->join('LEFT', '#__usergroups AS b on a.lft > b.lft AND a.rgt < b.rgt'); $query->group('a.id, a.title, a.lft'); $query->order('a.lft ASC'); $db->setQuery($query); $options = $db->loadObjectList(); return $options; } }
©
2018.