| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/dansnotreville-fr/nice/components/com_rsfeedback/models/ |
Upload File : |
<?php
/**
* @package RSFeedback!
* @copyright (C) 2010-2018 www.rsjoomla.com
* @license GPL, http://www.gnu.org/licenses/gpl.html
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\CMS\Factory;
class RSFeedbackModelCategories extends ListModel
{
protected $_context = 'com_rsfeedback.categories';
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState($ordering = 'c.ordering', $direction = 'ASC') {
$this->setState('params', Factory::getApplication()->getParams());
}
/**
* Get the master query for retrieving a list of categories subject to the model state.
*
* @return JDatabaseQuery
* @since 1.6
*/
protected function getListQuery() {
// Create a new query object.
$db = Factory::getDbo();
$query = $db->getQuery(true);
$params = $this->getState('params');
$columns= array();
$columns[] = $db->qn('c.id');
$columns[] = $db->qn('c.name');
$columns[] = $db->qn('c.description');
$columns[] = $db->qn('c.max_votes_allowed');
$columns[] = $db->qn('c.anonymous_voting');
$columns[] = $db->qn('c.anonymous_feedbacks');
$columns[] = 'COUNT('. $db->qn('f.cat_id').') AS nr_feedbacks';
$query->select($columns)
->from($db->qn('#__rsfeedback_categories', 'c'))
->join('left', $db->qn('#__rsfeedback_feedbacks', 'f').' ON '.$db->qn('f.cat_id').' = '.$db->qn('c.id').' AND '.$db->qn('f.published').' = 1')
->where($db->qn('c.published').' = '.$db->q('1'))
->group($db->qn('c.id'));
if ($params->get('show_empty_categories', 0) == 0)
$query->having($db->qn('nr_feedbacks').' > 0');
$query->order($this->getState('list.ordering', 'c.ordering').' '.$this->getState('list.direction', 'ASC'));
return $query;
}
}