%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.149 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/old/administrator/components/com_sppolls/models/ |
Upload File : |
<?php /** * @package Sppolls * * @copyright Copyright (C) 2010 - 2018 JoomShaper. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; class SppollsModelPolls extends JModelList { public function __construct(array $config = array()) { if (empty($config['filter_fields'])) { $config['filter_fields'] = [ 'id','a.id', 'title', 'a.title' ]; } parent::__construct($config); } protected function populateState($ordering = 'a.ordering', $direction = 'asc') { $app = JFactory::getApplication(); $context = $this->context; $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access'); $this->setState('filter.access', $access); $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); $this->setState('filter.published', $published); $language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', ''); $this->setState('filter.language', $language); parent::populateState($ordering, $direction); } protected function getStoreId($id = '') { $id .= ':' . $this->getState('filter.search'); $id .= ':' . $this->getState('filter.access'); $id .= ':' . $this->getState('filter.published'); $id .= ':' . $this->getState('filter.language'); return parent::getStoreId($id); } protected function getListQuery() { $app = JFactory::getApplication(); $state = $this->get('State'); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('a.*, l.title_native as lang'); $query->from($db->quoteName('#__sppolls_polls', 'a')); $query->join('LEFT' , $db->quoteName('#__languages', 'l') . " ON (" . $db->quoteName('a.language') . " = " . $db->quoteName('l.lang_code') . " )"); if ($search = $this->getState('filter.search')) { $keywords = explode(" ", trim($search)); $query->where($db->quoteName('a.title') . " REGEXP " . $db->quote(implode("|", $keywords))); } if ($status = $this->getState('filter.published')) { if ($status != '*') $query->where($db->quoteName('a.published') . " = " . $status); } else { $query->where($db->quoteName('a.published') . " IN (0,1)"); } if ($language = $this->getState('filter.language')) { $query->where($db->quoteName('a.language') . " = " . $db->quote($language)); } $orderCol = $this->getState('list.ordering','a.ordering'); $orderDirn = $this->getState('list.direction','desc'); $order = $db->escape($orderCol) . ' ' . $db->escape($orderDirn); $query->order($order); return $query; } public function formatPolls($polls) { $polls = json_decode($polls, true); $nop = count($polls); $votes = 0; foreach($polls as $poll) $votes += (int) $poll['votes']; $data = []; $data['count'] = $nop; $data['votes'] = $votes; return $data; } }