Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 public function getDetailProtocol($rows)
 {
     try {
         $theme = null;
         $arrPrev = array();
         foreach ($rows as $row) {
             if (!$theme) {
                 $theme = new ThemesDetailsProtocol();
                 $theme->setVercode($this->_nVercode);
                 $theme->setKernelCode($this->_nKernel);
                 $theme->setProtocol($row, $this->_nChannel);
             }
             $prev = new PrevProtocol();
             $prev->setPrev($row);
             if ((int) $row['prev_type'] == 1) {
                 $strMainUrl = $prev->getMainPrev($row);
             }
             array_push($arrPrev, $prev);
         }
         $nImgNum = count($arrPrev);
         if ($theme) {
             $theme->setPrevImgs($nImgNum, $strMainUrl, $arrPrev);
         }
         return $theme;
     } catch (Exception $e) {
         Log::write("Theme::getThemeDetail() exception " . $e->getMessage(), "log");
         return false;
     }
     return false;
 }