Authored by tmq

参展商增加合作导航

... ... @@ -8,6 +8,8 @@ class Controller_Brand extends Controller_Abstract
public function indexAction()
{
$banners = Facade_Index::getIndex(1);
$this->_view['partnerList'] = Facade_Partner::getPartner();
$this->_view['partnerTypes'] = Facade_Partner::$types;
$this->_view['banners'] = $banners;
$this->_view['brandTotal'] = Facade_Brand::getBrandTotal(1);
}
... ...
... ... @@ -61,6 +61,111 @@
</div>
<div class="overlay"></div>
<?php if(count($this->view->partnerList)):?>
<!-- 合作商等信息滑动条 start -->
<div class="cooperation clearfix">
<div class="cooperation-slide-warp">
<div class="cooperation-slide-box">
<div class="slide-wrap clearfix">
<?php
$partnerGroups = array();
foreach($this->view->partnerList as $partner)
{
foreach($this->view->partnerTypes as $key => $type)
{
if($partner['type'] == $key)
{
$partnerGroups[$type][] = $partner;
}
}
}
$groupNum = 0;
$groupLen = 0;
$template = '';
$html = '';
foreach($partnerGroups as $type => $group)
{
foreach ($group as $key => $partner)
{
$pic = Lib_Images::getImageUrl($partner['pic'], 'source','fragmentimg');
$html.= <<<EOL
<li>
<a href="{$partner['url']}" title="{$partner['name']}" target="_blank">
<img src="{$pic}" alt="" style="width:70px;"/>
</a>
</li>
EOL;
$groupLen ++;
if($groupLen>= 6)
{
$templates[] ='<div class="{class}"><h2>'.$type.'</h2><ul class="clearfix">'.$html.'</ul></div>';
$html = '';
$groupLen = 0;
$groupNum = 0;
}
}
if(!empty($html))
{
$templates[] ='<div class="{class}"><h2>'.$type.'</h2><ul class="clearfix">'.$html.'</ul></div>';
$html = '';
}
$groupNum ++;
if($groupNum == 2 && !empty($html))
{
$templates[] ='<div class="{class}"><h2>'.$type.'</h2><ul class="clearfix">'.$html.'</ul></div>';
$html = '';
$groupNum = 0;
$groupLen = 0;
}
}
$pos = 0;
foreach($templates as $temp)
{
if($pos % 2 == 0)
{
$temp = str_replace('{class}','partner', $temp);
}
else
{
$temp = str_replace('{class}','media', $temp);
}
preg_match_all("/<li>/i", $temp, $liLen, PREG_SET_ORDER);
if(count($liLen) >= 6)
{
$temp = preg_replace('@<div class="(\w+)">(.+)<\/div>@isU', "\\2", $temp);
$template .='<div class="box clearfix">'.$temp.'</div>';
$pos = -1;
}
else
{
if($pos % 2 == 0)
{
$template .='<div class="box clearfix">';
}
$template .= $temp;
if(($pos+1) % 2 == 0)
{
$template .='</div>';
}
}
$pos++;
}
if($pos % 2 == 1)
{
$template .='</div>';
}
echo $template;
?>
</div>
</div>
<div class="cooperation-slide-control">
<a class="cooperation-slide-prev iconfont" href="javascript:void(0);">&#xe600;</a>
<a class="cooperation-slide-next iconfont" href="javascript:void(0);">&#xe602;</a>
</div>
</div>
</div>
<?php endif;?>
<!-- 合作商等信息滑动条 end -->
</div>
<?php $this->_endblock();?>
<?php $this->_block('js');?>
... ... @@ -68,8 +173,9 @@
seajs.use('yohood',function(yohood){
yohood.brand();
})
// seajs.use('yohood',function(yohood){
// yohood.index();
// })
seajs.use(['jquery', 'channel'], function($, channel) {
channel.common();
channel.index();
})
</script>
<?php $this->_endblock();?>
... ...