Authored by tmq

参展商增加合作导航

@@ -8,6 +8,8 @@ class Controller_Brand extends Controller_Abstract @@ -8,6 +8,8 @@ class Controller_Brand extends Controller_Abstract
8 public function indexAction() 8 public function indexAction()
9 { 9 {
10 $banners = Facade_Index::getIndex(1); 10 $banners = Facade_Index::getIndex(1);
  11 + $this->_view['partnerList'] = Facade_Partner::getPartner();
  12 + $this->_view['partnerTypes'] = Facade_Partner::$types;
11 $this->_view['banners'] = $banners; 13 $this->_view['banners'] = $banners;
12 $this->_view['brandTotal'] = Facade_Brand::getBrandTotal(1); 14 $this->_view['brandTotal'] = Facade_Brand::getBrandTotal(1);
13 } 15 }
@@ -61,6 +61,111 @@ @@ -61,6 +61,111 @@
61 61
62 </div> 62 </div>
63 <div class="overlay"></div> 63 <div class="overlay"></div>
  64 + <?php if(count($this->view->partnerList)):?>
  65 + <!-- 合作商等信息滑动条 start -->
  66 + <div class="cooperation clearfix">
  67 + <div class="cooperation-slide-warp">
  68 + <div class="cooperation-slide-box">
  69 + <div class="slide-wrap clearfix">
  70 + <?php
  71 + $partnerGroups = array();
  72 + foreach($this->view->partnerList as $partner)
  73 + {
  74 + foreach($this->view->partnerTypes as $key => $type)
  75 + {
  76 + if($partner['type'] == $key)
  77 + {
  78 + $partnerGroups[$type][] = $partner;
  79 + }
  80 + }
  81 + }
  82 + $groupNum = 0;
  83 + $groupLen = 0;
  84 + $template = '';
  85 + $html = '';
  86 + foreach($partnerGroups as $type => $group)
  87 + {
  88 + foreach ($group as $key => $partner)
  89 + {
  90 + $pic = Lib_Images::getImageUrl($partner['pic'], 'source','fragmentimg');
  91 + $html.= <<<EOL
  92 + <li>
  93 + <a href="{$partner['url']}" title="{$partner['name']}" target="_blank">
  94 + <img src="{$pic}" alt="" style="width:70px;"/>
  95 + </a>
  96 + </li>
  97 +EOL;
  98 + $groupLen ++;
  99 + if($groupLen>= 6)
  100 + {
  101 + $templates[] ='<div class="{class}"><h2>'.$type.'</h2><ul class="clearfix">'.$html.'</ul></div>';
  102 + $html = '';
  103 + $groupLen = 0;
  104 + $groupNum = 0;
  105 + }
  106 + }
  107 + if(!empty($html))
  108 + {
  109 + $templates[] ='<div class="{class}"><h2>'.$type.'</h2><ul class="clearfix">'.$html.'</ul></div>';
  110 + $html = '';
  111 + }
  112 + $groupNum ++;
  113 + if($groupNum == 2 && !empty($html))
  114 + {
  115 + $templates[] ='<div class="{class}"><h2>'.$type.'</h2><ul class="clearfix">'.$html.'</ul></div>';
  116 + $html = '';
  117 + $groupNum = 0;
  118 + $groupLen = 0;
  119 + }
  120 + }
  121 + $pos = 0;
  122 + foreach($templates as $temp)
  123 + {
  124 + if($pos % 2 == 0)
  125 + {
  126 + $temp = str_replace('{class}','partner', $temp);
  127 + }
  128 + else
  129 + {
  130 + $temp = str_replace('{class}','media', $temp);
  131 + }
  132 + preg_match_all("/<li>/i", $temp, $liLen, PREG_SET_ORDER);
  133 + if(count($liLen) >= 6)
  134 + {
  135 + $temp = preg_replace('@<div class="(\w+)">(.+)<\/div>@isU', "\\2", $temp);
  136 + $template .='<div class="box clearfix">'.$temp.'</div>';
  137 + $pos = -1;
  138 + }
  139 + else
  140 + {
  141 + if($pos % 2 == 0)
  142 + {
  143 + $template .='<div class="box clearfix">';
  144 + }
  145 + $template .= $temp;
  146 + if(($pos+1) % 2 == 0)
  147 + {
  148 + $template .='</div>';
  149 + }
  150 + }
  151 + $pos++;
  152 + }
  153 + if($pos % 2 == 1)
  154 + {
  155 + $template .='</div>';
  156 + }
  157 + echo $template;
  158 + ?>
  159 + </div>
  160 + </div>
  161 + <div class="cooperation-slide-control">
  162 + <a class="cooperation-slide-prev iconfont" href="javascript:void(0);">&#xe600;</a>
  163 + <a class="cooperation-slide-next iconfont" href="javascript:void(0);">&#xe602;</a>
  164 + </div>
  165 + </div>
  166 + </div>
  167 + <?php endif;?>
  168 + <!-- 合作商等信息滑动条 end -->
64 </div> 169 </div>
65 <?php $this->_endblock();?> 170 <?php $this->_endblock();?>
66 <?php $this->_block('js');?> 171 <?php $this->_block('js');?>
@@ -68,8 +173,9 @@ @@ -68,8 +173,9 @@
68 seajs.use('yohood',function(yohood){ 173 seajs.use('yohood',function(yohood){
69 yohood.brand(); 174 yohood.brand();
70 }) 175 })
71 -// seajs.use('yohood',function(yohood){  
72 -// yohood.index();  
73 -// }) 176 + seajs.use(['jquery', 'channel'], function($, channel) {
  177 + channel.common();
  178 + channel.index();
  179 + })
74 </script> 180 </script>
75 <?php $this->_endblock();?> 181 <?php $this->_endblock();?>