public function actionAjaxGetChannels() { $pointId = Yii::app()->request->getPost('pointId'); $pointDateStr = date('Y-m-d'); $requestTime = date('H:i:s'); $pointDatetimeStr = $pointDateStr . " 23:59:59"; $pointDateTimestamp = strtotime($pointDateStr); $weekDay = strtolower(date('D', $pointDateTimestamp)); $Playlist = new Playlists(); $pointChannels = Channel::model()->findAll('id_point=:id_point AND window_id IS NOT NULL', array(':id_point' => $pointId)); $resp = array(); foreach ($pointChannels as $pointChannel) { $pointChannelId = $pointChannel->internalId; $windowId = $pointChannel->window_id; if (!is_null($windowId)) { $bg = $Playlist->GetBGContentArr($pointId, $pointChannelId, $pointDatetimeStr, $weekDay); $adv = $Playlist->GetAdvContentArr($pointId, $pointChannelId, $pointDatetimeStr, $weekDay); $blockStructedContent = $Playlist->BuildBlockStructedContent($bg, $adv); $straightTimeContent = $Playlist->ConverBlockStructedToStraightTimeContent($blockStructedContent); $straightTimeContentHisToSecs = $this->ConvertHisToSecsInStraightTime($straightTimeContent, $requestTime); $url = Yii::app()->request->getBaseUrl(true) . '/spool/points/' . $pointId . '/' . $pointChannelId; $straightTimeContentWithURLPath = $this->UpdateContentPathes($straightTimeContentHisToSecs, $url); $window = Window::model()->findByPK($windowId); $widgetToChannel = WidgetToChannel::model()->find("channel_id = :channel_id", array("channel_id" => $pointChannel->id)); $widget = ''; if (count($widgetToChannel) > 0) { $widgetModel = Widget::model()->findByPk($widgetToChannel['widget_id']); $widget = $widgetModel['content']; } $resp[] = array('width' => $window->width, 'height' => $window->height, 'top' => $window->top, 'left' => $window->left, 'content' => $straightTimeContentWithURLPath, 'widget' => $widget); } } echo json_encode($resp); exit; }