[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_content 6 * 7 * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Content\Administrator\Model; 12 13 // phpcs:disable PSR1.Files.SideEffects 14 \defined('_JEXEC') or die; 15 // phpcs:enable PSR1.Files.SideEffects 16 17 /** 18 * Methods supporting a list of featured article records. 19 * 20 * @since 1.6 21 */ 22 class FeaturedModel extends ArticlesModel 23 { 24 /** 25 * Constructor. 26 * 27 * @param array $config An optional associative array of configuration settings. 28 * 29 * @see \Joomla\CMS\MVC\Controller\BaseController 30 * @since 1.6 31 */ 32 public function __construct($config = array()) 33 { 34 if (empty($config['filter_fields'])) { 35 $config['filter_fields'] = array( 36 'id', 'a.id', 37 'title', 'a.title', 38 'alias', 'a.alias', 39 'checked_out', 'a.checked_out', 40 'checked_out_time', 'a.checked_out_time', 41 'catid', 'a.catid', 'category_title', 42 'state', 'a.state', 43 'access', 'a.access', 'access_level', 44 'created', 'a.created', 45 'created_by', 'a.created_by', 46 'created_by_alias', 'a.created_by_alias', 47 'ordering', 'a.ordering', 48 'featured_up', 'fp.featured_up', 49 'featured_down', 'fp.featured_down', 50 'language', 'a.language', 51 'hits', 'a.hits', 52 'publish_up', 'a.publish_up', 53 'publish_down', 'a.publish_down', 54 'fp.ordering', 55 'published', 'a.published', 56 'author_id', 57 'category_id', 58 'level', 59 'tag', 60 'rating_count', 'rating', 61 'ws.title', 62 ); 63 } 64 65 parent::__construct($config); 66 } 67 68 /** 69 * Method to auto-populate the model state. 70 * 71 * Note. Calling getState in this method will result in recursion. 72 * 73 * @param string $ordering An optional ordering field. 74 * @param string $direction An optional direction (asc|desc). 75 * 76 * @return void 77 * 78 * @since 3.5 79 */ 80 protected function populateState($ordering = 'a.title', $direction = 'asc') 81 { 82 parent::populateState($ordering, $direction); 83 84 // Filter by featured articles. 85 $this->setState('filter.featured', 1); 86 } 87 88 /** 89 * Build an SQL query to load the list data. 90 * 91 * @return \Joomla\Database\DatabaseQuery 92 * 93 * @since 4.0.0 94 */ 95 protected function getListQuery() 96 { 97 $query = parent::getListQuery(); 98 99 $query->select($this->getDatabase()->quoteName('fp.ordering')); 100 101 return $query; 102 } 103 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |