File manager - Edit - /home/verseaumee/ptitsanes/administrator/components/com_solidres/models/countries.php
Back
<?php /** ------------------------------------------------------------------------ SOLIDRES - Accommodation booking extension for Joomla ------------------------------------------------------------------------ * @author Solidres Team <contact@solidres.com> * @website https://www.solidres.com * @copyright Copyright (C) 2013 - 2019 Solidres. All Rights Reserved. * @license GNU General Public License version 3, or later ------------------------------------------------------------------------ */ defined('_JEXEC') or die; /** * Countries model * * @package Solidres * @subpackage Country * @since 0.1.0 */ class SolidresModelCountries extends JModelList { /** * Constructor. * * @param array An optional associative array of configuration settings. * * @see JController * @since 1.6 */ public function __construct($config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = array( 'id', 'r.id', 'name', 'r.name', 'code_2', 'r.code_2', 'code_3', 'r.code_3', 'state', 'r.state', 'checked_out', 'r.checked_out', 'checked_out_time', 'r.checked_out_time', 'created_by', 'r.created_by', 'created_date', 'r.created_date', 'modified_by', 'r.modified_by', 'modified_date', 'r.modified_date', 'state' ); } parent::__construct($config); } /** * Method to auto-populate the model state. * * This method should only be called once per instantiation and is designed * to be called on the first call to the getState() method unless the model * configuration flag to ignore the request is set. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @since 11.1 */ protected function populateState($ordering = 'r.name', $direction = 'asc') { // Initialise variables. $app = JFactory::getApplication('administrator'); // Load the filter state. $search = $app->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $published = $app->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string'); $this->setState('filter.state', $published); // Load the parameters. $params = JComponentHelper::getParams('com_solidres'); $this->setState('params', $params); // List state information. parent::populateState($ordering, $direction); } /** * Build an SQL query to load the list data. * * @return JDatabaseQuery * @since 1.6 */ protected function getListQuery() { // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); // Select the required fields from the table. $query->select( $this->getState( 'list.select', 'r.*' ) ); $query->from($db->quoteName('#__sr_countries') . ' AS r'); // Filter by published state $published = $this->getState('filter.state'); if (is_numeric($published)) { $query->where('r.state = ' . (int) $published); } else if ($published === '') { $query->where('(r.state IN (0, 1))'); } // Filter by search in title $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('r.id = ' . (int) substr($search, 3)); } else { $search = $db->Quote('%' . $db->escape($search, true) . '%'); $query->where('r.name LIKE ' . $search); } } // Add the list ordering clause. $orderCol = $this->state->get('list.ordering', 'r.name'); $orderDirn = $this->state->get('list.direction', 'ASC'); $query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn)); return $query; } }
| ver. 1.4 |
Github
|
.
| PHP 8.5.7 | Generation time: 0 |
proxy
|
phpinfo
|
Settings