Beispiel #1
0
 public function actionCreate()
 {
     $video = new Video();
     $video->loadDefaultValues();
     $video->videoId = '146751001';
     $video->mobileLink = "https://player.vimeo.com/external/146751001.mobile.mp4?s=0b43d0d45d443d1850e290c950ab621e977d5cb2&profile_id=116";
     $video->sdLink = "https://player.vimeo.com/external/146751001.sd.mp4?s=ae3d3e9818788730b24d5aafa31fd10d6cee87b0&profile_id=112";
     $video->hlsLink = "https://player.vimeo.com/external/146751001.m3u8?p=high,standard,mobile&s=5100ac376ddb43addfe9e185b93075eb83ffd519";
     $video->embed = "<iframe src=\"https://player.vimeo.com/video/146751001?title=0&byline=0&portrait=0&badge=0&autopause=0&player_id=0\" width=\"854\" height=\"480\" frameborder=\"0\" title=\"EVAW LoRes\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";
     $video->duration = 221;
     $video->poster = "https://i.vimeocdn.com/video/545226406_640x360.jpg?r=pad";
     $video->size = 10;
     $video->created_by = 7;
     $video->updated_by = 7;
     $video->save();
     $cb = new CodeBankCampaign();
     $cb->loadDefaultValues();
     $cb->name = 'Violence Against Women';
     $cb->modelClass = 'Video';
     $cb->objectId = $video->id;
     $cb->codeBank_code = 'EVAW';
     $cb->created_by = 7;
     $cb->updated_by = 7;
     $cb->save();
     echo "Done\n";
 }
 /**
  * Creates a new Video model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Video();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 /**
  * Creates a new Video model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Video();
     $categoryModel = new VideoCategory();
     $treeParents = TreeHelper::build($categoryModel->find()->addOrderBy('tree')->addOrderBy('lft')->all());
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['index']);
     } else {
         return $this->render('create', ['model' => $model, 'treeParents' => $treeParents]);
     }
 }
 public function actionAdd()
 {
     $data = Yii::$app->request->post();
     $y_id = $data['id'];
     //Поиск дубля
     $duble = Video::find()->where(['youtube_id' => $y_id])->one();
     if (!empty($duble)) {
         Yii::$app->session->setFlash('error', "Такое видео уже есть на сайте!");
         return $this->redirect('/video/index');
     }
     //vd($data);
     $_model = new Video();
     $_model->youtube_id = $data['id'];
     $_model->title = $data['title'];
     $_model->descr = $data['descr'];
     $_model->categoria = $data['categoria'];
     $_model->author_id = $data['author_id'];
     //$_model->validate();
     //vd($_model->getErrors());
     if ($_model->save() && $_model->validate()) {
         Yii::$app->session->setFlash('success', "Видео успешно добавленно!");
     } else {
         Yii::$app->session->setFlash('error', "Error! Ошибка");
     }
     return $this->redirect('/video/index');
 }
Beispiel #5
0
 public function actionConfirmed()
 {
     $codeBankCampaign = new CodeBankCampaign();
     $codeBankCampaign->loadDefaultValues();
     $video = new Video();
     $video->loadDefaultValues();
     $request = Yii::$app->request;
     if ($request->isPost) {
         $lib = new Vimeo(Yii::$app->params['vimeoClientId'], Yii::$app->params['vimeoSecret'], Yii::$app->params['vimeoAccessToken']);
         if ($codeBankCampaign->load($request->post()) && $video->load($request->post())) {
             $response = $lib->request('/me/videos/' . $video->videoId, [], 'GET');
             $video->duration = $response['body']['duration'];
             $video->embed = $response['body']['embed']['html'];
             $video->poster = $response['body']['pictures']['sizes'][3]['link'];
             $files = $response['body']['files'];
             foreach ($files as $key => $value) {
                 switch ($value['quality']) {
                     case 'mobile':
                         $video->mobileLink = $value['link'];
                         break;
                     case 'sd':
                         $video->sdLink = $value['link'];
                         break;
                     case 'hls':
                         $video->hlsLink = $value['link'];
                         break;
                 }
             }
             if (isset($codeBankCampaign->codeBank_code)) {
                 $video->confirmed = 1;
             }
             $video->save();
             $codeBankCampaign->objectId = $video->id;
             $codeBankCampaign->save();
             //                $view = $this->getView();
             //                $view->title = 'Step 3: Editing Video Information for Hyrizy Code ' . Html::tag('label',$codeBankCampaign->codeBank_code,['class'=>'label label-primary']);
             //                return $this->render('update',['model'=>$video]);
             return $this->redirect(['/campaign/view', 'id' => $codeBankCampaign->id]);
         }
     }
 }
 public function actionInterview()
 {
     $userdetails = \Yii::$app->user->identity;
     $model = InterviewVideo::find()->where(['user_id' => $userdetails->id])->one();
     //echo "<pre>";print_r($model->video);die;
     if (empty($model)) {
         $model = new InterviewVideo();
     }
     $video = new Video();
     $user = Userform::find()->where(['id' => $userdetails->id])->one();
     if (empty($user)) {
         $user = new Userform();
     }
     $userprofile = UserProfile::find()->where(['user_id' => $userdetails->id])->one();
     if (empty($userprofile)) {
         $userprofile = new UserProfile();
     }
     if (isset($_POST['Video'])) {
         $video->attributes = $_POST['Video'];
         $video->media_module_id = 5;
         // id 5 is interview video type in tlb_media_module table
         $model->user_id = $userdetails->id;
         if ($video->validate()) {
             $video->save();
             $model->video_id = $video->id;
             $model->save();
         }
     }
     return $this->render('interview', ['model' => $model, 'user' => $user, 'video' => $video, 'userprofile' => $userprofile]);
 }