uawdijnntqw1x1x1
IP : 216.73.216.155
Hostname : vm5018.vps.agava.net
Kernel : Linux vm5018.vps.agava.net 3.10.0-1127.8.2.vz7.151.14 #1 SMP Tue Jun 9 12:58:54 MSK 2020 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
var
/
www
/
iplanru
/
data
/
.
/
mod-tmp
/
..
/
www
/
.
/
i-plan.ru
/
templates
/
..
/
modules
/
mod_wfitems
/
helper.php
/
/
<?php // No direct access defined( '_JEXEC' ) or die; /** * Class Module Helper * @author kirdinyuri */ class modWfitemsHelper { /** * getData method * @param $params * @return array */ static function getCat( $cat) { $m=array(); $db = JFactory::getDbo(); $list = $db->setQuery(" SELECT id,name FROM #__zoo_category where parent=\"{$cat}\" and published=1 order by ordering")->loadAssocList(); if (count($list)<>0) { foreach($list as $row) { $m[]=$row['id'] ; $m = array_merge($m, modWfitemsHelper::getCat($row['id'] )); } } return $m; } static function getItems($type,$count,$limit) { $db = JFactory::getDbo(); $jinput = JFactory::getApplication()->input; $category_id=preg_replace('/[^0-9]/', '',$jinput->get( 'category_id')); if ($category_id) { //child $sql_cat=' and (ci.category_id='.$category_id; $m = modWfitemsHelper::getCat($category_id); foreach($m as $item) { $sql_cat.=' or ci.category_id='.$item; } $sql_cat.=')'; if ($type=="МИ") {$sql_type=" and instr(i.elements,'\"mi\"')<>0";} if ($type=="БП") {$sql_type=" and instr(i.elements,'\"bp\"')<>0";} if ($count<>'') {$sql_count=" limit ".$count;} $item = $db->setQuery(" SELECT distinct i.id FROM jos_zoo_item i, jos_zoo_category_item ci WHERE i.id=ci.item_id and i.state=1 and type=\"product\"{$sql_type}{$sql_cat} order by created desc {$sql_count}")->loadAssocList(); if ($item) { $l=array(); foreach($item as $elem) { $l[]=$elem['id']; } $item=$l; } //parent if (count($item)<=$limit and $limit<>'') { $parent=$db->setQuery(" SELECT parent FROM #__zoo_category WHERE id=".$category_id)->loadAssoc(); $parent=$parent['parent']; if ($parent) { $sql_cat=' and (ci.category_id='.$parent; $m = modWfitemsHelper::getCat($parent); foreach($m as $i) { $sql_cat.=' or ci.category_id='.$i; } $sql_cat.=')'; if ($type=="МИ") {$sql_type=" and instr(i.elements,'\"mi\"')<>0";} if ($type=="БП") {$sql_type=" and instr(i.elements,'\"bp\"')<>0";} if ($count<>'') {$sql_count=" limit ".$count;} $item2 = $db->setQuery(" SELECT distinct i.id FROM jos_zoo_item i, jos_zoo_category_item ci WHERE i.id=ci.item_id and i.state=1 and type=\"product\"{$sql_type}{$sql_cat} order by created desc {$sql_count}")->loadAssocList(); if ($item2) { $l=array(); foreach($item2 as $elem) { $l[]=$elem['id']; } $item2=$l; } $item=array_merge($item,$item2); } } //grandfather /*if (count($item)<=$limit and $limit<>'') { $gfather=$db->setQuery(" SELECT parent FROM #__zoo_category WHERE id=".$parent)->loadAssoc(); $gfather=$gfather['parent']; if ($gfather) { $sql_cat=' and (ci.category_id='.$gfather; $m = modWfitemsHelper::getCat($gfather); foreach($m as $i) { $sql_cat.=' or ci.category_id='.$i; } $sql_cat.=')'; if ($type=="МИ") {$sql_type=" and instr(i.elements,'\"mi\"')<>0";} if ($type=="БП") {$sql_type=" and instr(i.elements,'\"bp\"')<>0";} if ($count<>'') {$sql_count=" limit ".$count;} $item3 = $db->setQuery(" SELECT distinct i.id FROM jos_zoo_item i, jos_zoo_category_item ci WHERE i.id=ci.item_id and i.state=1 and type=\"product\"{$sql_type}{$sql_cat} order by created desc {$sql_count}")->loadAssocList(); if ($item3) { $l=array(); foreach($item3 as $elem) { $l[]=$elem['id']; } $item3=$l; } $item=array_merge($item,$item3); } }*/ } if ($item) { $item=array_unique($item); if ($count<>'') { $item = array_slice($item, 0, $count); } $n[]="<div class=\"wf-items\">"; $n[]="<ul>"; $n=array_merge($n,modWfitemsHelper::renderItems($item)); $n[]="<div class=\"clearfix\"></div>"; $n[]="</ul>"; $n[]="</div>"; return implode("\r\n",$n); } } static function getRouter($type,$count,$limit) { if ($type=="МИ" || $type=="БП") { return modWfitemsHelper::getItems($type,$count,$limit); } else { $mi=modWfitemsHelper::getItems("МИ",$count,$limit); $bp=modWfitemsHelper::getItems("БП",$count,$limit); if ($mi=='') { return "<h3 class=\"uk-panel-title\">Бизнес-планы</h3>".$bp; } elseif ($bp=='') { return "<h3 class=\"uk-panel-title\">Маркетинговые исследования</h3>".$mi; } else { return " <table class=\"wf-table\"> <tr> <td> <h3 class=\"uk-panel-title\"> Маркетинговые исследования </h3> $mi </td> <td> <h3 class=\"uk-panel-title\"> Бизнес-планы </h3> $bp </td> </tr> </table>"; } } } static function renderItems($items) { jimport('imagecache.imagecache'); $ImageCache = new ImageCache(); $db = JFactory::getDbo(); foreach($items as $item) { $list = $db->setQuery(" SELECT * , DATE_FORMAT(created,'%d.%m.%y') as fdate FROM #__zoo_item WHERE type=\"product\" and id=".$item)->loadAssoc(); if (count($list['id'])<>0) { $a=json_decode($list['elements'],true); if ($a['57172c66-27cb-442d-a964-19f64f744a3b']['file']<>'') {$imagepath=$ImageCache->ImageCacheJPG($a['57172c66-27cb-442d-a964-19f64f744a3b']['file'],'mod_wfitems',80,113,70);} if (isset($a['43191a2a-0fb3-4578-b7e0-dbf5e584873d']['option']['0']) && $a['43191a2a-0fb3-4578-b7e0-dbf5e584873d']['option']['0']=="est") { $price=$a['dbf6c773-0a69-432c-a462-b56e620e2e5e']['0']['value']; } else { $price=$a['aed9068f-8fd9-4c38-89d1-83187a602ac5']['0']['value']; } //if ($type=="МИ"){$matitemid="109";}else {$matitemid="108";} $matlink="/index.php?option=com_zoo&item_id={$list["id"]}&Itemid=117&view=item"; $m[]=" <li> <div class=\"wf-item\"> <table> <tr> <td> <a href=\"{$matlink}\"><img src=\"{$imagepath}\" style=\"margin-right: 15px; float:left; \" /></a> </td> <td> <ul> <li class=\"caption\"><a href=\"{$matlink}\">{$list["name"]}</a></li> <li><span class=\"created\"><a href=\"{$matlink}\"><strong>Дата создания: </strong>{$list["fdate"]}</span></a></li> <li><span class=\"price\"><a href=\"{$matlink}\"><strong>Цена: </strong>{$price} руб.</span></a></li> <li class=\"readmore\"><a href=\"{$matlink}\">Подробнее...</a></li> </ul> </td> </tr> </table> </div> </li>"; } } return $m; } }
/var/www/iplanru/data/./mod-tmp/../www/./i-plan.ru/templates/../modules/mod_wfitems/helper.php