コード例 #1
0
 public function actionShow($id, $mid)
 {
     $videos = new Videos();
     $video = $videos->findByPk($mid);
     $aroundInfo = $videos->getAroundInfo($mid);
     $myProfile = UserProfile::model()->getUserProfile(Yii::app()->user->id);
     $my_videos = array();
     if (Yii::app()->user->id == $id) {
         $myPage = true;
     } else {
         $mypage = false;
         $videos_on_my_page = Videos::model()->findAll(array('select' => 'file', 'condition' => 'user_id=:id', 'params' => array(':id' => Yii::app()->user->id)));
         foreach ($videos_on_my_page as $my_video) {
             $my_videos[] = $my_video['file'];
         }
     }
     $comments = Comments::model()->getLast('videos', $mid, 10);
     $comments = array_reverse($comments);
     $this->renderPartial('show_video', array('video' => $video, 'my_videos' => $my_videos, 'nav_link' => 'show', 'user_id' => $id, 'aroundInfo' => $aroundInfo, 'myProfile' => $myProfile, 'myPage' => $myPage, 'comments' => $comments, 'comments_tbl' => 'videos', 'comments_item_id' => $video->id));
 }