| Current Path : /var/www/iplanru/data/www/iplan.5018.vps.agava.net/modules/mod_top10/ |
| Current File : /var/www/iplanru/data/www/iplan.5018.vps.agava.net/modules/mod_top10/helper.php |
<?php
// No direct access
defined( '_JEXEC' ) or die;
/**
* Class Module Helper
* @author kirdinyuri
*/
class modTop10Helper
{
/**
* getData method
* @param $params
* @return array
*/
static function getData( $params )
{
$lang=JFactory::getLanguage();
$lang=$lang->getTag();
$lang = substr($lang,0,2);
$sql_lang='';
if ($lang<>"ru")
{
$sql_lang=" and instr(elements,'\"0\": \"est\"')<>0 ";
}
$db = JFactory::getDbo();
$list = $db->setQuery( 'SELECT id,name,created,modified,hits FROM #__zoo_item
where application_id=1 and
type="product" and
modified >= DATE_SUB(CURRENT_DATE, INTERVAL '.$params->get('period').' DAY) '.$sql_lang.'
ORDER by hits desc', 0, $params->get('count') )->loadObjectList();
return $list;
}
static function getMethod( $id )
{
$db = JFactory::getDbo();
$list = $db->setQuery('SELECT c.params val FROM jos_zoo_category_item ci, jos_zoo_category c
where ci.category_id=c.id and ci.item_id='.$id)->loadObjectList();
foreach($list as $row)
{
if ($f<>'') break;
$a=json_decode($row->val,true);
if ($a['metadata.title']=="Бизнес-планы") {$f='bp';}
if ($a['metadata.title']=="Маркетинговые исследования") {$f='mi';}
}
return $f;
}
}