| 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/amisdesseniors-fr/nimes/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 RSFeedbackModelComments extends ListModel
{
/**
* Model context string.
*
* @var string
*/
protected $_context = 'com_rsfeedback.comments';
/**
* Get the master query for retrieving a list of categories subject to the model state.
*
* @return JDatabaseQuery
* @since 1.6
*/
protected function getListQuery() {
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select('*')
->from($db->qn('#__rsfeedback_comments', 'c'))
->where($db->qn('c.published').' = '.$db->q('1'))
->where($db->qn('c.feedback_id').' = '.$db->q($this->state->get('feedback_id', 0)))
->order($db->qn('c.id'));
return $query;
}
public function getItems($id = null) {
if (empty($id)) $id = Factory::getApplication()->input->get('id', 0, 'int');
$this->setState('feedback_id', $id);
$items = parent::getItems();
$tmp = array();
foreach ($items as $item) {
$item->date = RSFeedbackHelper::showDate($item->date);
$item->gravatar = md5(strtolower(trim($item->email)));
$item->comment = $item->text;
$tmp[] = $item;
}
return $tmp;
}
public function getTotalComments($id) {
static $totals = array();
$id = $id ? $id : Factory::getApplication()->input->get('id', 0, 'int');
if (!isset($totals[$id])) {
$this->setState('feedback_id', $id);
$db = Factory::getDbo();
$query = $db->getQuery(true);
$db->setQuery($this->getListQuery());
$db->execute();
$totals[$id] = $db->getNumRows();
}
return $totals[$id];
}
}