Example #1
0
 public function getBannerProtocol($rows, $nType = 0)
 {
     $arrBanner = array();
     $coolxius = array();
     $strBannerId = '';
     foreach ($rows as $row) {
         $strBannerId = $row['bannerid'];
         if (!array_key_exists($row['bannerid'], $arrBanner)) {
             $banner = new BannerProtocol();
             $banner->setBanner($row['bannerurl'], $row['bannername']);
             $arrBanner = $arrBanner + array($strBannerId => $banner);
         }
         $strThemeId = $row['identity'];
         if (!array_key_exists($row['identity'], $arrBanner[$strBannerId]->bannerRes)) {
             $theme = new ThemesProtocol();
             $theme->setVercode($this->_nVercode);
             $theme->setKernelCode($this->_nKernel);
             $theme->setProtocol($row, $this->_nChannel);
             $arrBanner[$strBannerId]->setBannerRes($strThemeId, $theme);
         }
         $prev = new PrevProtocol();
         if ((int) $row['prev_type'] == 1) {
             $arrBanner[$strBannerId]->bannerRes[$strThemeId]->setMainPrev($row);
         }
         $prev->setPrev($row);
         $arrBanner[$strBannerId]->bannerRes[$strThemeId]->pushPrevImg($prev);
     }
     $arr_coolxius = array();
     foreach ($arrBanner as $key => $temBanner) {
         $temBanner = $temBanner->getProtocol($this->strType);
         array_push($arr_coolxius, $temBanner);
     }
     return $arr_coolxius;
 }