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
/
www
/
.
/
www.i-plan.ru
/
components
/
com_workfilter
/
helpers
/
workfilter.php
/
/
<?php // No direct access defined( '_JEXEC' ) or die; /** * Component helper * @author kirdinyuri */ class WorkfilterHelper { /** * @var array $menuIds List Id depending of view component */ static $menuIds = array(); /** * Create sef links * @param $option string * @param $view string * @param $query string * @return string link * @throws Exception */ static function getRoute( $option, $view, $query = '' ) { if ( empty( self::$menuIds[$option . '.' . $view] ) ) { $items = JMenuSite::getInstance( 'site' )->getItems( 'component', $option ); foreach ( $items as $item ) { if ( isset( $item->query['view'] ) && $item->query['view'] === $view ) { self::$menuIds[$option . '.' . $view] = $item->id; } } } return JRoute::_( 'index.php?view=' . $view . $query . '&Itemid=' . self::$menuIds[$option . '.' . $view] ); } static function setDocument( $title = '', $basepath, $metadesc = '', $metakey = '' ) { $doc = JFactory::getDocument(); $doc->addScript( $basepath . '/components/com_workfilter/assets/scripts/workfilter.js' ); $doc->addStyleSheet( $basepath . '/components/com_workfilter/assets/styles/workfilter.css' ); $app = JFactory::getApplication(); if ( empty( $title ) ) { $title = $app->get( 'sitename' ); } elseif ( $app->get( 'sitename_pagetitles', 0 ) == 1 ) { $title = JText::sprintf( 'JPAGETITLE', $app->get( 'sitename' ), $title ); } elseif ( $app->get( 'sitename_pagetitles', 0 ) == 2 ) { $title = JText::sprintf( 'JPAGETITLE', $title, $app->get( 'sitename' ) ); } $doc->setTitle( $title ); if ( trim( $metadesc ) ) { $doc->setDescription( $metadesc ); } if ( trim( $metakey ) ) { $doc->setMetaData( 'keywords', $metakey ); } } static function getSubCat($cat,$level) { //$jinput = JFactory::getApplication()->input; $db = JFactory::getDbo(); $m=array(); jimport('imagecache.imagecache'); $ImageCache = new ImageCache(); //output cat if ($level==0) {$m[]="<div id=\"wf-cat\">";} else {$m[]="<div id=\"wf-subcat\">";} if ($cat==2376) {$name="Работы по отраслям";} else { $crnt = $db->setQuery('SELECT id,name FROM #__zoo_category where published=1 and id='.$cat)->loadObject(); $name=$crnt->name; } $level_separator=' style="margin-left:'.($level*10+5).'px;"'; $hlevel=$level+1; $m[]=" <a onClick=\" for (var i = 0; i < document.getElementById('wfcat').options.length; i++) { if (document.getElementById('wfcat').options[i].value == {$cat}) {document.getElementById('wfcat').options[i].selected = true;break;} } document.getElementById('wfcat').value={$cat}; for (var i = 0; i < document.getElementById('wftype').options.length; i++) { if (document.getElementById('wftype').options[i].value == 'all') {document.getElementById('wftype').options[i].selected = true;break;} } for (var i = 0; i < document.getElementById('wflang').options.length; i++) { if (document.getElementById('wflang').options[i].value == 'all') {document.getElementById('wflang').options[i].selected = true;break;} } for (var i = 0; i < document.getElementById('wfreg').options.length; i++) { if (document.getElementById('wfreg').options[i].value == '0') {document.getElementById('wfreg').options[i].selected = true;break;} } /*document.getElementById('wfname').value='';*/ document.getElementById('yearamountfrom').value='2009'; document.getElementById('yearamountto').value='2015'; document.getElementById('priceamountfrom').value='10000'; document.getElementById('priceamountto').value='60000'; document.forms['workfilter'].submit(); \" style=\"cursor:pointer\" > <div id=\"cat\"> <span{$level_separator}>{$name}</span> </div> </a>"; $m[]="</div>"; //get cat $mcatcount=0; $list = $db->setQuery('SELECT id,name FROM #__zoo_category where parent='.$cat.' and published=1 order by ordering')->loadObjectList(); foreach($list as $row) { $mcat=array(); $mcat=workfilterHelper::getSubCat($row->id,$level+1); $mcatcount=$mcatcount+count($mcat); if (count($mcat)>0) {$m = array_merge($m, $mcat);} } //materials $tmat=array(); $tmat=workfilterHelper::getMat($cat); //$m[]=$name.'---'.count($mcat).'---'.count($tmat); //output mat if (count($tmat)>0) { $m[]="<div class=\"wf-items\">"; $m[]="<ul>"; foreach($tmat as $item) { if ($item["image"]<>'') { $imagepath=$ImageCache->ImageCacheJPG($item["image"],"com_workfilter",80,113,70); } $mattype = $db->setQuery(" SELECT elements FROM #__zoo_item WHERE id={$item["id"]}")->loadArray(); $a=json_decode($$mattype['elements'],true); if ($a['755b5888-e07b-4af9-b0a9-b864291f1586']['option']['0']<>'mi'){$matitemid="109";}else {$matitemid="108";} $matlink="/index.php?option=com_zoo&item_id={$item["id"]}&Itemid=117&view=item"; $m[]=" <li> <a href=\"{$matlink}\"> <div class=\"wf-item\"> <table> <tr> <td> <img src=\"{$imagepath}\" style=\"margin-right: 15px; float:left; \" /> </td> <td> <ul> <li class=\"caption\">{$item["name"]}</li> <li><span class=\"created\"><strong>Дата создания: </strong>{$item["date"]}</span></li> <li><span class=\"price\"><strong>Цена: </strong>{$item["price"]} руб.</span></li> <li class=\"readmore\">Подробнее...</li> </ul> </td> </tr> </table> </div> </a> </li>"; } $m[]="<div class=\"clearfix\"></div>"; $m[]="</ul>"; $m[]="</div>"; } if ($mcatcount+count($tmat)==0) {$m=array();} return $m; } static function getMat($cat) { $jinput = JFactory::getApplication()->input; $date = getdate(); $wfyearfrom=preg_replace('/[^0-9]/', '',$jinput->get( 'wfyearfrom')); if ($wfyearfrom=='') {$wfyearfrom='2009';} $wfyearto=preg_replace('/[^0-9]/', '',$jinput->get( 'wfyearto', $date['year'])); if ($wfyearfrom=='') {$wfyearfrom=$date['year'];} $wfname=$_POST['wfname']; //if ($wfname){$sqlwfname=" and instr(upper(i.name), upper('{$wfname}'))<>0";}//точное совпадение if ($wfname){$sqlwfname=" and MATCH (i.name) AGAINST ('-\"Бизнес-план\" {$wfname}*' IN BOOLEAN MODE)";}//релевантное совпадение $wfpricefrom=preg_replace('/[^0-9]/', '',$jinput->get( 'wfpricefrom')); if ($wfpricefrom=='') {$wfpricefrom='10000';} $wfpriceto=preg_replace('/[^0-9]/', '',$jinput->get( 'wfpriceto')); if ($wfpriceto=='') {$wfpriceto='60000';} $wflang=$jinput->get( 'wflang', 'all' ); $wftype=$jinput->get( 'wftype', 'all' ); $wfreg=$jinput->get( 'wfreg', '0' ); $db = JFactory::getDbo(); $list = $db->setQuery(" SELECT i.id as id, i.name as name, i.elements as elements, DATE_FORMAT(created,'%d.%m.%y') as fdate FROM #__zoo_category_item ci, #__zoo_item i WHERE ci.item_id=i.id and ci.category_id={$cat} and i.state=1 and YEAR(`created`) >= {$wfyearfrom} and YEAR(`created`) <= {$wfyearto} {$sqlwfname} order by created desc ")->loadObjectList(); if (count($list)<>0) { foreach($list as $row) { $a=json_decode($row->elements,true); $flag=true; if ($a['aed9068f-8fd9-4c38-89d1-83187a602ac5']['0']['value'] < $wfpricefrom or $a['aed9068f-8fd9-4c38-89d1-83187a602ac5']['0']['value'] > $wfpriceto) {$flag=false;} if ($flag==true and $wflang=='ru' and $a['43191a2a-0fb3-4578-b7e0-dbf5e584873d']['option']['0']=='est'){$flag=false;} if ($flag==true and $wflang=='en' and $a['43191a2a-0fb3-4578-b7e0-dbf5e584873d']['option']['0']<>'est'){$flag=false;} if ($flag==true and $wftype=='bp' and $a['755b5888-e07b-4af9-b0a9-b864291f1586']['option']['0']<>'bp'){$flag=false;} if ($flag==true and $wftype=='mi' and $a['755b5888-e07b-4af9-b0a9-b864291f1586']['option']['0']<>'mi'){$flag=false;} if ($flag==true and $wfreg<>'0' and $wfreg<>'' and $a['e3ce3621-7e91-4e89-8884-73298523a076']['option']['0']<>$wfreg){$flag=false;} if ($flag) {$matlist[]=array( "id"=>$row->id, "name"=>$row->name, "image"=>$a['57172c66-27cb-442d-a964-19f64f744a3b']['file'], "date"=>$row->fdate, "price"=>$a['aed9068f-8fd9-4c38-89d1-83187a602ac5']['0']['value'] );} } } return $matlist; } static function getCat2lvl($mymenuitem) { $m=array(); $jinput = JFactory::getApplication()->input; $db = JFactory::getDbo(); $list = $db->setQuery(" SELECT id,name FROM #__zoo_category where parent=\"2376\" and published=1 order by ordering")->loadAssocList(); if ($list) { $cnt=(int)count($list)/2; $i=0; foreach($list as $row) { if ($i==0){$m[]="<table><tr><td>";} if ($i==$cnt){$m[]="</td><td>";} $m[]="<div class=\"fwmenu-cat\">"; $m[]="<div class=\"fwmenu-cat-caption\"><a onClick=\" for (var i = 0; i < document.getElementById('wfcat').options.length; i++) { if (document.getElementById('wfcat').options[i].value == {$row['id']}) {document.getElementById('wfcat').options[i].selected = true;break;} } document.getElementById('wfcat').value={$row['id']}; for (var i = 0; i < document.getElementById('wftype').options.length; i++) { if (document.getElementById('wftype').options[i].value == 'all') {document.getElementById('wftype').options[i].selected = true;break;} } for (var i = 0; i < document.getElementById('wflang').options.length; i++) { if (document.getElementById('wflang').options[i].value == 'all') {document.getElementById('wflang').options[i].selected = true;break;} } for (var i = 0; i < document.getElementById('wfreg').options.length; i++) { if (document.getElementById('wfreg').options[i].value == '0') {document.getElementById('wfreg').options[i].selected = true;break;} } /*document.getElementById('wfname').value='';*/ document.getElementById('yearamountfrom').value='2009'; document.getElementById('yearamountto').value='2015'; document.getElementById('priceamountfrom').value='10000'; document.getElementById('priceamountto').value='60000'; document.forms['workfilter'].submit(); \" style=\"cursor:pointer\" ><span>{$row['name']}</span></a></div>"; $subcat = $db->setQuery(" SELECT id,name FROM #__zoo_category where parent=\"{$row['id']}\" and published=1 order by ordering")->loadAssocList(); if ($subcat) { $m[]="<div class=\"fwmenu-subcat\">"; $m[]="<ul>"; foreach($subcat as $item) { $m[]="<li><a onClick=\" for (var i = 0; i < document.getElementById('wfcat').options.length; i++) { if (document.getElementById('wfcat').options[i].value == {$item['id']}) {document.getElementById('wfcat').options[i].selected = true;break;} } document.getElementById('wfcat').value={$item['id']}; for (var i = 0; i < document.getElementById('wftype').options.length; i++) { if (document.getElementById('wftype').options[i].value == 'all') {document.getElementById('wftype').options[i].selected = true;break;} } for (var i = 0; i < document.getElementById('wflang').options.length; i++) { if (document.getElementById('wflang').options[i].value == 'all') {document.getElementById('wflang').options[i].selected = true;break;} } for (var i = 0; i < document.getElementById('wfreg').options.length; i++) { if (document.getElementById('wfreg').options[i].value == '0') {document.getElementById('wfreg').options[i].selected = true;break;} } /*document.getElementById('wfname').value='';*/ document.getElementById('yearamountfrom').value='2009'; document.getElementById('yearamountto').value='2015'; document.getElementById('priceamountfrom').value='10000'; document.getElementById('priceamountto').value='60000'; document.forms['workfilter'].submit(); \" style=\"cursor:pointer\" ><span>{$item['name']}</span></a></li>"; } $m[]="</ul>"; $m[]="</div>"; } $m[]="</div>"; if ($i==count($list)-1){$m[]="</td></tr></table>";} $i++; } } return $m; } }
/var/www/iplanru/data/www/./www.i-plan.ru/components/com_workfilter/helpers/workfilter.php