コード例 #1
0
ファイル: VideoController.php プロジェクト: abutouq/video
 /**
  * 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->created_by = Yii::$app->user->id;
         $model->video_lang = $model->video_lang ? 'AR' : 'EN';
         $model->search = $model->video_code . $model->video_url . $model->title_ar . $model->title_en . $model->description_ar . $model->description_en;
         /*$googleshorter = new GoogleUrlShortener();
           $shorturl = $googleshorter->shorten($model->video_url);*/
         if ($model->save()) {
             $tags = Yii::$app->request->post('Video')['tags'];
             foreach ($tags as &$arr) {
                 $tagvid = new VideoTag();
                 $tagvid->created_by = Yii::$app->user->id;
                 $tagvid->tag_id = $arr;
                 $tagvid->video_id = $model->id;
                 $tagvid->save();
             }
         } else {
             return $this->render('create', ['model' => $model]);
         }
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #2
0
 /**
  * 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]);
     }
 }
コード例 #3
0
ファイル: VideoController.php プロジェクト: comaw/hashtag
 /**
  * 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->url = UrlHelp::translateUrl($model->name);
         if ($model->validate()) {
             $model->save();
             return $this->redirect(['view', 'id' => $model->id]);
         }
     }
     return $this->render('create', ['model' => $model]);
 }
コード例 #4
0
ファイル: VideoController.php プロジェクト: santonil2003/yii
 /**
  * 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()) {
         $model->imageFile = UploadedFile::getInstance($model, 'path');
         $path = $model->upload();
         if ($path) {
             $model->path = $path;
         }
         $model->save();
         return $this->redirect(['view', 'id' => $model->id, 'course_id' => $model->course_id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #5
0
ファイル: VideoController.php プロジェクト: Romario25/porka
 /**
  * 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->videoFile = UploadedFile::getInstances($model, 'videoFile');
         $model->screenFiles = UploadedFile::getInstances($model, 'screenFiles');
         $model->screenShotVideo = UploadedFile::getInstance($model, 'screenShotVideo');
         if ($model->save()) {
             return $this->redirect(['index']);
         } else {
             return $this->render('create', ['model' => $model]);
         }
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #6
0
 /**
  * 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();
     $data = Yii::$app->request->post();
     $ret = $model->load($data);
     $model->imageFile = UploadedFile::getInstance($model, 'imageFile');
     if ($ret && $model->upload() && $model->save()) {
         if (isset($data['Video']['categoryID'])) {
             foreach ($data['Video']['categoryID'] as $val) {
                 $relation = new CategoryRelationship();
                 $relation->media = $model->ID;
                 $relation->category = $val;
                 $relation->type = 1;
                 $relation->save();
             }
         }
         return $this->redirect(['view', 'id' => $model->ID]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }