Example #1
0
 function renderVideoChannel($title, $channel, $cssID)
 {
     $chan = new VideoChannel($channel);
     if (!$chan->size() > 0) {
         return '';
     }
     print '<div id="' . $cssID . '" class="video-channel-container">';
     print '<div class="video-channel-title">' . $title . '</div>';
     print '<div class="video-channel-contents">';
     foreach ($chan->listing() as $video) {
         print '<div class="video-item-container">';
         print '<div class="video-item">';
         print '<img src="' . $video->getThumbURL() . '" class="video-thumb" width="220" title="' . $video->getTitle() . '" data-url="' . $video->getEmbedUrl() . '">';
         print '</div>';
         print '<div class="video-item-title">' . $video->getTitle() . '</div>';
         print '</div>';
     }
     print '<div class="clearfix"></div>';
     print '</div>';
     print '</div>';
 }
Example #2
0
 private function getChannel($youtubeUser, $channelName, $uri, $cover = '', $avatar = '')
 {
     $slug = Common::renderSlug($channelName);
     if (!($data = VideoChannel::find()->where('youtube_channel_id=:youtube_channel_id', [':youtube_channel_id' => $channelName])->one())) {
         $userId = isset(Yii::$app->user) ? Yii::$app->user->id : 1;
         $data = new VideoChannel();
         $data->attributes = ['title' => $channelName, 'slug' => Common::renderSlug($channelName), 'feature' => 0, 'popular' => 0, 'user_id' => 1, 'cover' => $cover, 'avatar' => $avatar, 'tags' => '', 'total_view' => 0, 'total_source' => 0, 'seo_title' => $channelName, 'seo_keyworks' => $channelName, 'seo_description' => $channelName, 'status' => Common::status_pending, 'description' => '', 'uri' => $uri, 'category_id' => 0, 'youtube_user' => $youtubeUser, 'youtube_channel_id' => $channelName];
         $data->save();
     }
     $data->id;
 }