public function getThemesProtocol($rows) { $arrThems = array(); foreach ($rows as $row) { if (!array_key_exists($row['identity'], $arrThems)) { $theme = new ThemesProtocol(); $theme->setProtocol($row, REQUEST_CHANNEL_WIDGET); if (!isset($row['widgetid']) || !isset($row['cpid'])) { return false; } global $g_arr_host_config; $url = $g_arr_host_config['cdnhost'] . $row['turl']; $widgeturl = $this->_widget->getWidgetUrl($row['widgetid'], $row['cpid'], $url); $theme->setWidgetUrl($widgeturl); $arrThems = $arrThems + array($row['identity'] => $theme); } $prev = new PrevProtocol(); if ((int) $row['prev_type'] == 1) { $arrThems[$row['identity']]->setMainPrev($row); } $prev->setPrev($row); $arrThems[$row['identity']]->pushPrevImg($prev); } return $arrThems; }
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; }