| Current Path : /var/www/iplanru/data/www/i-plan.ru/media/zoo/applications/product/templates/work/ |
| Current File : /var/www/iplanru/data/www/i-plan.ru/media/zoo/applications/product/templates/work/_items.php.bak |
<?php
/**
* @package com_zoo
* @author YOOtheme http://www.yootheme.com
* @copyright Copyright (C) YOOtheme GmbH
* @license http://www.gnu.org/licenses/gpl.html GNU/GPL
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
$user = &JFactory::getUser();
$sw=true; //переключатель. false-старое представление true- новое
function yucattable(){
$db =&JFactory::getDBO();
//if ($_GET[Itemid]=="108") {$cat=1; $f='bp';}
//if ($_GET[Itemid]=="109") {$cat=2; $f='mi';}
$jinput = JFactory::getApplication()->input;
$Itemid=$jinput->getInt( 'Itemid', 0 );
$category_id=$jinput->getInt( 'category_id', 0 );
$lang=JFactory::getLanguage();
$lang=$lang->getTag();
$lang = substr($lang,0,2);
if ($lang<>'ru'){$langtourl="&lang={$lang}";}
if ($lang=='ru')
{
if ($Itemid=="108") {$cat=1; $f='bp';}
if ($Itemid=="109") {$cat=2; $f='mi';}
}
if ($lang=='en')
{
if ($Itemid=="261") {$cat=2186; $f='bp';}
if ($Itemid=="210") {$cat=2225; $f='mi';}
}
$s[]='';
if (!empty($cat)){
if ($lang=="ru") $s[]=' <div class="yu-cat-description">Выберите интересующую Вас отрасль</div>';
if ($lang=="en") $s[]=' <div class="yu-cat-description">Select your industry</div>';
$db->setQuery('SELECT * FROM jos_zoo_category where parent='.$cat, 0, $count);
$rows = $db->loadObjectList();
if (count($rows)<>0)
foreach ($rows as $row){
$s[]='<td width=25%>';
$db->setQuery('SELECT * FROM jos_zoo_category where parent='.$row->id, 0, $count);
$rows2 = $db->loadObjectList();
if (count($rows2)<>0)
foreach ($rows2 as $row2){
$class="yu-link";
if ($_GET[category_id]==$row2->id) $class.=" active";
$s[]="<div><a class=\"{$class}\" href=\"".JRoute::_("/index.php?option=com_zoo&view=category&category_id={$row2->id}&Itemid={$Itemid}{$langtourl}")."\">";
$s[]="<span>{$row2->name}</span>";
$s[]="</a></div>";
}
$s[]='</td>';
}
}
//if (count($s)) $s=implode("\r",$s);
return implode("\r",$s);
}
function yucatbtm(){
$db =&JFactory::getDBO();
$jinput = JFactory::getApplication()->input;
$Itemid=$jinput->getInt( 'Itemid', 0 );
$category_id=$jinput->getInt( 'category_id', 0 );
$lang=JFactory::getLanguage();
$lang=$lang->getTag();
$lang = substr($lang,0,2);
if ($lang<>'ru'){$langtourl="&lang={$lang}";}
if ($lang=='ru')
{
if ($Itemid=="108") {$cat=1; $f='bp';}
if ($Itemid=="109") {$cat=2; $f='mi';}
}
if ($lang=='en')
{
if ($Itemid=="261") {$cat=2186; $f='bp';}
if ($Itemid=="210") {$cat=2225; $f='mi';}
}
//echo "---".$cat;
$s[]='';
if (!empty($cat))
{
if ($lang=="ru") $s[]=' <div class="yu2-cat-description">Выберите интересующую Вас отрасль</div>';
if ($lang=="en") $s[]=' <div class="yu2-cat-description">Select your industry</div>';
$s[]=' <div class="yu2-cat-btm">';
$db->setQuery('SELECT * FROM jos_zoo_category where parent='.$cat, 0, $count);
$rows = $db->loadObjectList();
if (count($rows)<>0)
foreach ($rows as $row){
$db->setQuery('SELECT * FROM jos_zoo_category where parent='.$row->id, 0, $count);
$rows2 = $db->loadObjectList();
if (count($rows2)<>0)
foreach ($rows2 as $row2){
$class="yu2-link";
if ($category_id==$row2->id) $class.=" active";
$s[]="<a class=\"{$class}\" href=\"".JRoute::_("/index.php?option=com_zoo&view=category&category_id={$row2->id}&Itemid={$Itemid}{$langtourl}")."\"><div class=\"yu2-btm\">";
$a=json_decode($row2->params, TRUE);
$imgpath=$a['content.teaser_image'];
if (!$imgpath) $imgpath="/images/icons/otrasli/restoran.jpg";
$s[]="<div class=\"yu2-icon\"><img src=\"{$imgpath}\" /></div>";
$s[]="<div class=\"yu2-name\"><span>{$row2->name}</span></div>";
$s[]="</div></a>";
}
}
if ($Itemid=="108")
{
$list = $db->setQuery( 'SELECT count(`category_id`) as cnt FROM `jos_zoo_category_item` where `category_id`=2151' )->loadAssoc();
if ($list[cnt]<>'') $cnt='Все бизнес-планы ('.$list[cnt].')';
$list = $db->setQuery( 'SELECT count(i.id) as cnt
FROM `jos_zoo_category_item` ci, jos_zoo_item i
where `category_id`=2151
and ci.item_id=i.id
and i.created>DATE_ADD(now(), INTERVAL -90 DAY);' )->loadAssoc();
if ($list[cnt]<>'') $cnt2='<hr>Новые бизнес-планы ('.$list[cnt].')';
$s[]='<a class="'.$class.'" href="'.JRoute::_("index.php?option=com_zoo&view=category&layout=category&Itemid=150&category_id=2151").'"><div class="yu2-btm-last"><span id="sp1">'.$cnt.'</span><span id="sp2">'.$cnt2.'<span></div></a>';
}
if ($Itemid=="109")
{
$list = $db->setQuery( 'SELECT count(`category_id`) as cnt FROM `jos_zoo_category_item` where `category_id`=2152' )->loadAssoc();
if ($list[cnt]<>'') $cnt='Все исследования ('.$list[cnt].')';
$list = $db->setQuery( 'SELECT count(i.id) as cnt
FROM `jos_zoo_category_item` ci, jos_zoo_item i
where `category_id`=2152
and ci.item_id=i.id
and i.created>DATE_ADD(now(), INTERVAL -90 DAY);' )->loadAssoc();
if ($list[cnt]<>'') $cnt2='<hr>Новые исследования ('.$list[cnt].')';
$s[]='<a class="'.$class.'" href="'.JRoute::_("index.php?option=com_zoo&view=category&layout=category&Itemid=151&category_id=2152").'"><div class="yu2-btm-last"><span id="sp1">'.$cnt.'</span><span id="sp2">'.$cnt2.'<span></div></a>';
}
if ($Itemid=="261")
{
$list = $db->setQuery( 'SELECT count(`category_id`) as cnt FROM `jos_zoo_category_item` where `category_id`=2224' )->loadAssoc();
if ($list[cnt]<>'') $cnt='All business plans ('.$list[cnt].')';
$list = $db->setQuery( 'SELECT count(i.id) as cnt
FROM `jos_zoo_category_item` ci, jos_zoo_item i
where `category_id`=2224
and ci.item_id=i.id
and i.created>DATE_ADD(now(), INTERVAL -90 DAY);' )->loadAssoc();
if ($list[cnt]<>'') $cnt2='<hr>New business plans ('.$list[cnt].')';
$s[]='<a class="'.$class.'" href="'.JRoute::_("index.php?option=com_zoo&view=category&layout=category&Itemid=248&category_id=2224{$langtourl}").'"><div class="yu2-btm-last"><span id="sp1">'.$cnt.'</span><span id="sp2">'.$cnt2.'<span></div></a>';
}
if ($Itemid=="210")
{
$list = $db->setQuery( 'SELECT count(`category_id`) as cnt FROM `jos_zoo_category_item` where `category_id`=2263' )->loadAssoc();
if ($list[cnt]<>'') $cnt='All marketing researches ('.$list[cnt].')';
$list = $db->setQuery( 'SELECT count(i.id) as cnt
FROM `jos_zoo_category_item` ci, jos_zoo_item i
where `category_id`=2263
and ci.item_id=i.id
and i.created>DATE_ADD(now(), INTERVAL -90 DAY);' )->loadAssoc();
if ($list[cnt]<>'') $cnt2='<hr>New marketing researches ('.$list[cnt].')';
$s[]='<a class="'.$class.'" href="'.JRoute::_("index.php?option=com_zoo&view=category&layout=category&Itemid=249&category_id=2263{$langtourl}").'"><div class="yu2-btm-last"><span id="sp1">'.$cnt.'</span><span id="sp2">'.$cnt2.'<span></div></a>';
}
$s[]=' </div>';
}
//if (count($s)) $s=implode("\r",$s);
return implode("\r",$s);
}
function yuzooGetValue($sql)
{
$db =&JFactory::getDBO();
$count='';
$ret='';
$field="val";
$db->setQuery($sql, 0, $count);
$rows = $db->loadObjectList();
if (count($rows)<>0)
foreach ($rows as $row)
{$ret=$row->$field;};
return $ret;
}
?>
<?php if (!$sw) : ?>
<div class="yu-category">
<div class="yu-cat-table">
<table width=100%>
<tr valign="top">
<?php echo yucattable(); ?>
</tr>
</table>
</div>
<?php if ($_GET[Itemid]=="108") : ?>
<div style="text-align: right;"><a style="color:red;" href="<?php echo JRoute::_("index.php?option=com_zoo&view=category&layout=category&Itemid=150&category_id=2151"); ?>"><b>Все бизнес-планы</b></a></div>
<?php endif; ?>
<?php if ($_GET[Itemid]=="109") : ?>
<div style="text-align: right;"><a style="color:red;" href="<?php echo JRoute::_("index.php?option=com_zoo&view=category&layout=category&Itemid=151&category_id=2152"); ?>"><b>Все исследования</b></a></div>
<?php endif; ?>
<div class="yu-cat-title">
<?php echo yuzooGetValue('SELECT name as val FROM jos_zoo_category where id='.$_GET[category_id]); ?>
</div>
</div>
<?php endif; ?>
<?php if ($sw) : ?>
<div class="yu2-category">
<div class="yu2-cat-btm">
<?php echo yucatbtm(); ?>
</div>
</div>
<?php endif; ?>
<div class="items <?php if ($itemstitle) echo 'has-box-title'; ?>">
<?php if ($itemstitle) : ?>
<h1 class="box-title"><span><span><?php echo $itemstitle; ?></span></span></h1>
<?php endif; ?>
<div class="box-t1">
<div class="box-t2">
<div class="box-t3"></div>
</div>
</div>
<div class="box-1">
<?php
// init vars
$i = 0;
$columns = $this->params->get('template.items_cols', 2);
reset($this->items);
// render rows
while ((list($key, $item) = each($this->items)) || ($i % $columns != 0)) {
if ($i % $columns == 0) echo ($i > 0 ? '</div><div class="row">' : '<div class="row first-row">');
$first = ($i % $columns == 0) ? ' first-item' : null;
echo '<div class="width'.intval(100 / $columns).$first.'">'.$this->partial('item', compact('item')).'</div>';
$i++;
}
if (!empty($this->items)) {
echo '</div>';
}
?>
<?php echo $this->partial('pagination'); ?>
</div>
<div class="box-b1">
<div class="box-b2">
<div class="box-b3"></div>
</div>
</div>
</div>
<?php if (!$sw) : ?>
<div class="yu-category">
<div class="yu-cat-table">
<table width=100%>
<tr valign="top">
<?php echo yucattable(); ?>
</tr>
</table>
</div>
</div>
<?php endif; ?>