コード例 #1
0
ファイル: home_controller.php プロジェクト: boulama/DreamVids
 public function index($request)
 {
     $data = array();
     $data['currentPageTitle'] = 'Accueil';
     $data['discoverVids'] = Video::getDiscoverVideos(2);
     $data['bestVids'] = Video::getBestVideos(6);
     if (Session::isActive()) {
         $channel = Session::get()->getMainChannel();
         $data['subscriptions'] = Session::get()->getSubscribedChannels();
         if ($data['subscriptions'] instanceof UserChannel) {
             $data['subscriptions'] = [$data['subscriptions']];
         }
         $data['subscriptions_vids'] = Video::getSubscriptionsVideos(Session::get()->id, 20);
         $data['channelId'] = $channel->id;
         $data['channelName'] = $channel->name;
         $data['avatar'] = $channel->getAvatar();
         $data['background'] = $channel->getBackground();
         return new ViewResponse('home/logged', $data);
     } else {
         $data['best_chans'] = UserChannel::getBestChannels();
         $data['news_vids'] = Video::getLastVideos();
         return new ViewResponse('home/guest', $data);
     }
 }