Пример #1
0
 public static function getPersonalVideos()
 {
     $objVideos = new Videos();
     $personal_videos = $objVideos->select('idVideo')->where('status', '=', 1)->orderBy('updated_at', 'desc')->limit(5)->get();
     $list_comment = $objVideos->select('idVideo')->orderBy('commentCount', 'desc')->limit(5)->get();
     $list_views = $objVideos->select('idVideo')->orderBy('viewCount', 'desc')->limit(5)->get();
     $list_id = array();
     $list_id_comment = array();
     $list_id_views = array();
     foreach ($personal_videos as $video) {
         array_push($list_id, $video->idVideo);
     }
     foreach ($list_comment as $video) {
         array_push($list_id_comment, $video->idVideo);
     }
     foreach ($list_views as $video) {
         array_push($list_id_views, $video->idVideo);
     }
     $list_personal_videos = Youtube::getVideoInfo($list_id);
     $list_comment_videos = Youtube::getVideoInfo($list_id_comment);
     $list_views_videos = Youtube::getVideoInfo($list_id_views);
     return array('recent_videos' => $list_personal_videos, 'comment_videos' => $list_comment_videos, 'views_videos' => $list_views_videos);
 }
Пример #2
0
 public function destroy()
 {
     $input = Input::all();
     foreach ($input['aids'] as $l) {
         $objVideo = new Videos();
         $video = $objVideo->where('_id', $l)->first();
         $video->delete();
     }
     Session::flash('message', trans('Delete'));
     return Response::json('1');
 }
 public function videoDetail($video_id, $pr)
 {
     $relatedVideos = Youtube::getRelatedVideos($video_id);
     $video_info = Youtube::getVideoInfo($video_id);
     $video_des = $video_info->snippet->description;
     $sender = array('video_id' => $video_id, 'video_des' => $video_des, 'relate_videos' => $relatedVideos, 'pr' => $pr);
     if ($pr) {
         $objFile = new Files();
         $objVideos = new Videos();
         $video = $objVideos->where('idVideo', $video_id)->first();
         $video = json_decode($video);
         $images = array();
         if ($video->description != '') {
             $sender['description'] = $video->description;
         }
         if (!empty($video->images)) {
             foreach ($video->images as $k => $img) {
                 $file = $objFile->where('_id', $img->id)->first();
                 $images[] = array('url' => $file->url, 'title' => $file->title, 'minutes' => $img->minutes, 'seconds' => $img->seconds, 'current' => $k, 'extern_url' => $img->extern_url);
             }
             $sender['images'] = $images;
         } else {
             $sender['images'] = array();
         }
     }
     //print_r($sender);die;
     return view('frontend::templates.video_detail', $sender);
 }