';
if ($lang=="ru") $ret[]="
Анонсы готовых бизнес-планов
и маркетинговых исследований за 2014 г.
";
if ($lang=="en") $ret[]="
Announcements of ready business plans
and marketing research for 2014
";
$sql="SELECT id, name, DATE_FORMAT(created,\"%d.%m.%y\") as crdate, elements
FROM jos_zoo_item
where type=\"{$zoo_type}\" and state=1 AND YEAR(`created`) = YEAR(NOW()) {$sql_lang}
order by created desc
limit {$zoo_count}";
$db= &JFactory::getDBO();
$count='';
$db->setQuery($sql, 0, $count);
$rows = $db->loadObjectList();
if (count($rows)<>0)
{
foreach ($rows as $row)
{
$a=json_decode($row->elements,true);
$imgpath=$a['57172c66-27cb-442d-a964-19f64f744a3b']['file'];
$ret[]="
";
}
}
if ($lang=="ru") $ret[]="
Анонсы готовых бизнес-планов
и маркетинговых исследований за 2010-2013 гг.
";
if ($lang=="en") $ret[]="
Announcements of ready business plans
and marketing research for 2010-2013
";
$sql="SELECT id, name, DATE_FORMAT(created,\"%d.%m.%y\") as crdate
FROM jos_zoo_item
where type=\"{$zoo_type}\" and state=1 AND YEAR(`created`) <> YEAR(NOW()) {$sql_lang}
order by created desc
limit {$zoo_count}";
$db= &JFactory::getDBO();
$count='';
$db->setQuery($sql, 0, $count);
$rows = $db->loadObjectList();
if (count($rows)<>0)
{
foreach ($rows as $row)
{
$ret[]="
";
}
}
$ret[]='
';
}
return implode("\r\n",$ret);
}
static function getData( $params )
{
$db = JFactory::getDbo();
$m=array();
$matid=0;
$option='';
$view='';
$Itemid=0;
//проверка текущего урл
$burl = $_SERVER['REQUEST_URI'];
$turl = $_SERVER['REDIRECT_URL'];
$jinput = JFactory::getApplication()->input;
$matid=$jinput->get( 'item_id', 0, 'INT' );
$option=$jinput->get( 'option', '');
$view=$jinput->get( 'view', '');
$Itemid=$jinput->get( 'Itemid', 0,'INT' );
$cat=$jinput->get( 'category_id', 0,'INT');
if ($turl=="/bp.php" and $cat==0 and $matid==0){$cat='21';}
if ($turl=="/mi.php" and $cat==0 and $matid==0){$cat='121';}
if (($turl=="/bp.php" or $turl=="/mi.php") and $cat<>0 and $matid==0)
{
$list = $db->setQuery(" SELECT i.id as id
FROM #__zoo_category_item ci, #__zoo_item i
where i.type=\"product\"
and ci.category_id={$cat}
and ci.item_id=i.id
and i.state=1
and created>DATE_ADD(now(), INTERVAL -1 YEAR)
order by RAND()
limit 4")->loadObjectList();
foreach($list as $row)
{
$m[]=$row->id;
}
}
if (($turl=="/bp.php" or $turl=="/mi.php") and $matid<>0)
{
$list = $db->setQuery('SELECT elements FROM #__zoo_item where state=1 and id='.$matid)->loadAssoc();
$a=json_decode($list['elements'],true);
//fin model
if ($a['6e6bfd81-74f2-434c-8306-b80e2287bf44']['item']['0']<>'')
{
$m[]=$a['6e6bfd81-74f2-434c-8306-b80e2287bf44']['item']['0'];
}
//samaya svejaya
if (count($a['7b18a4ef-f209-4c68-a854-03c04184955d']['item'])<>0)
{
$sql='SELECT id FROM #__zoo_item where type="product" and state=1 and (';
foreach ( $a['7b18a4ef-f209-4c68-a854-03c04184955d']['item'] as $item)
{
$sqlid[]='id='.$item;
}
$sql.=implode(" or ", $sqlid);
$sql.=') order by id desc';
$list = $db->setQuery($sql)->loadAssoc();
$m[]=$list['id'];
unset($sql,$sqlid);
}
//4 work
$br='';
$list = $db->setQuery("SELECT c.name as name, c.id as id
FROM #__zoo_category_item ci, #__zoo_category c
where ci.category_id=c.id and ci.item_id={$matid}")->loadObjectList();
foreach($list as $row)
{
if ($br=='')
{
if ($row->name<>"Все маркетинговые исследования" &&
$row->name<>"Все бизнес-планы" &&
$row->name<>"Бизнес-планы" &&
$row->name<>"Маркетинговые исследования" )
{
$br=$row->id;
}
}
}
if (isset($m[0])){$wh1=" and i.id<>".$m[0];}
if (isset($m[1])){$wh2=" and i.id<>".$m[1];}
$list = $db->setQuery(" SELECT i.id as id
FROM #__zoo_category_item ci, #__zoo_item i
where i.type=\"product\"
and ci.category_id={$br}
and ci.item_id=i.id
and i.state=1
and created>DATE_ADD(now(), INTERVAL -1 YEAR)
and i.id<>{$matid}
{$wh1}{$wh2}
order by RAND()
limit 4")->loadObjectList();
foreach($list as $row)
{
$m[]=$row->id;
}
}
if (count($m)==0)
{
$list = $db->setQuery(" SELECT i.id as id
FROM #__zoo_category_item ci, #__zoo_item i
where i.type=\"product\"
and ci.category_id={$cat}
and ci.item_id=i.id
and i.state=1
{$wh1}{$wh2}
order by RAND()
limit 4")->loadObjectList();
foreach($list as $row)
{
$m[]=$row->id;
}
}
if (count($m)==0)
{
$list = $db->setQuery(" SELECT i.id as id
FROM #__zoo_category_item ci, #__zoo_item i
where i.type=\"product\"
and i.created>DATE_ADD(now(), INTERVAL -1 YEAR)
and ci.item_id=i.id
and i.state=1
{$wh1}{$wh2}
order by RAND()
limit 4")->loadObjectList();
foreach($list as $row)
{
$m[]=$row->id;
}
}
//formiruem raboty
if (count($m)<>0)
{
foreach($m as $item)
{
$list = $db->setQuery('SELECT c.params val FROM #__zoo_category_item ci, #__zoo_category c
where ci.category_id=c.id and ci.item_id='.$item)->loadObjectList();
$f='';
foreach($list as $row)
{
if ($f=='')
{
$a=json_decode($row->val,true);
if ($a['metadata.title']=="Бизнес-планы") {$f='108';}
if ($a['metadata.title']=="Маркетинговые исследования") {$f='109';}
}
}
$list = $db->setQuery('SELECT *, DATE_FORMAT(created,"%m.%d.%y") as created2 FROM #__zoo_item where state=1 and id='.$item)->loadAssoc();
$a=json_decode($list['elements'],true);
$n[]='