當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Video::save方法代碼示例

本文整理匯總了PHP中Video::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP Video::save方法的具體用法?PHP Video::save怎麽用?PHP Video::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Video的用法示例。


在下文中一共展示了Video::save方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: run

 public function run()
 {
     $model = new Video();
     if (isset($_POST['Video'])) {
         $model->attributes = $_POST['Video'];
         //封麵、文件
         $model->cover_image = isset($_POST['cover_image']) ? $_POST['cover_image'] : '';
         $model->video_file = isset($_POST['video_file']) ? $_POST['video_file'] : '';
         //標簽   (前5個標簽有效)
         $tags = trim($_POST['Video']['tags']);
         $unique_tags = array_unique(explode(',', str_replace(array(' ', ','), array('', ','), $tags)));
         $explodeTags = array_slice($unique_tags, 0, 5);
         $model->tags = implode(',', $explodeTags);
         $model->create_time = time();
         $model->update_time = $model->create_time;
         if ($model->save()) {
             $this->controller->message('success', Yii::t('admin', 'Add Success'), $this->controller->createUrl('index'));
         }
     }
     //判斷有無欄目
     $article_cat = Catalog::model()->find('type=:type', array(':type' => $this->controller->_type));
     if (!$article_cat) {
         $this->controller->message('error', Yii::t('admin', 'No Catalog'), $this->controller->createUrl('index'));
     }
     $this->controller->render('create', array('model' => $model));
 }
開發者ID:jerrylsxu,項目名稱:yiifcms,代碼行數:26,代碼來源:CreateAction.php

示例2: actionAjaxCreate

 /**
  * With Ajax Creates a new model.
  */
 public function actionAjaxCreate()
 {
     $model = new Video();
     $isSuccess = false;
     if (isset($_POST['Video'])) {
         $model->attributes = $_POST['Video'];
         $isSuccess = $model->save();
     }
     echo json_encode(array('isSuccess' => $isSuccess));
 }
開發者ID:liuwanwei,項目名稱:bdmedia,代碼行數:13,代碼來源:VideoController.php

示例3: actionCreate

 /**
  * 錄入
  *
  */
 public function actionCreate()
 {
     parent::_acl('video_create');
     $model = new Video();
     if (isset($_POST['Video'])) {
         $model->attributes = $_POST['Video'];
         if ($model->save()) {
             AdminLogger::_create(array('catalog' => 'create', 'intro' => '錄入視頻,ID:' . $model->id));
             $this->redirect(array('index'));
         }
     }
     $this->render('create', array('model' => $model));
 }
開發者ID:zywh,項目名稱:maplecity,代碼行數:17,代碼來源:VideoController.php

示例4: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Video();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Video'])) {
         $model->attributes = $_POST['Video'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->video_id));
         }
     }
     $this->render('create', array('model' => $model));
 }
開發者ID:lhfcainiao,項目名稱:basic,代碼行數:17,代碼來源:videoController.php

示例5: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Video();
     if (isset($_POST['Video'])) {
         $model->attributes = $_POST['Video'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', Yii::t('main', 'Данные успешно сохранены!'));
             $this->redirect(array('update', 'id' => $model->id));
         } else {
             Yii::app()->user->setFlash('error', Yii::t('main', 'Ошибка сохранения данных!'));
         }
     }
     $this->render('create', array('model' => $model));
 }
開發者ID:Vladimirtishenko,項目名稱:sn,代碼行數:18,代碼來源:VideoController.php

示例6: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Video();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Video'])) {
         $model->attributes = $_POST['Video'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', Yii::t('main', 'Данные успешно сохранены!'));
             sleep(2);
             $this->redirect(array('index'));
         } else {
             Yii::app()->user->setFlash('error', Yii::t('main', 'Ошибка!'));
         }
     }
     $this->render('create', array('model' => $model));
 }
開發者ID:Vladimirtishenko,項目名稱:val.ua,代碼行數:21,代碼來源:VideoController.php

示例7: actionCrear

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCrear($id)
 {
     $video = new Video();
     if (isset($_POST['Video'])) {
         $video->attributes = $_POST['Video'];
         if ($video->save()) {
             Yii::app()->user->setFlash('success', 'Video ' . $video->nombre . ' guardado con éxito');
             $this->redirect(array('albumvideo/view', 'id' => $video->album_video_id));
         }
     }
     //if(isset($_POST['NovedadesForm']))
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $album_video = $id ? AlbumVideo::model()->findByPk($id) : 0;
     $video->album_video_id = $album_video;
     $this->render('crear', array('model' => $video));
 }
開發者ID:Telemedellin,項目名稱:tm,代碼行數:21,代碼來源:VideosController.php

示例8: __construct

 public function __construct()
 {
     $editor = getInput("editor_id");
     // Check if General album exists
     $album = getEntity(array("type" => "Videoalbum", "metadata_name_value_pairs" => array(array("name" => "owner_guid", "value" => getLoggedInUserGuid()), array("name" => "title", "value" => "General"))));
     $logged_in_user = getLoggedInUser();
     $logged_in_user_guid = $logged_in_user->guid;
     $title = getInput("title");
     $description = getInput("description");
     if (!file_exists($_FILES['video_file']['tmp_name']) || !is_uploaded_file($_FILES['video_file']['tmp_name'])) {
         $video_type = "youtube";
     } else {
         $video_type = "upload";
     }
     $video = new Video();
     $video->video_type = $video_type;
     $video->title = $title;
     $video->description = $description;
     $video->owner_guid = getLoggedInUserGuid();
     $video->access_id = getInput("access_id");
     $video->save();
     if ($video_type == "youtube") {
         $video->url = getInput("url");
     } else {
         $guid = VideosPlugin::processUploadedVideo("video_file", $video);
         $video->video_guid = $guid;
         $video->save();
         $video->createAvatar();
     }
     $video->save();
     new Activity(getLoggedInUserGuid(), "activity:video:add", array(getLoggedInUser()->getURL(), getLoggedInUser()->full_name, $video->getURL(), $video->title, $video->getURL(), $video->icon(LARGE, "img-responsive")));
     new SystemMessage("Your video has been uploaded.");
     if (!$album) {
         $album = new Videoalbum();
         $album->title = "General";
         $album->owner_guid = getLoggedInUserGuid();
         $album->save();
     }
     $video->container_guid = $album->guid;
     $video->save();
     forward(false, array("insertvideo" => $video->guid, "editor" => $editor));
 }
開發者ID:socialapparatus,項目名稱:socialapparatus,代碼行數:42,代碼來源:UploadVideoActionHandler.php

示例9: createAction

 public function createAction()
 {
     $this->view->Title = "Manage Video";
     $this->view->headTitle($this->view->Title);
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest()->getParams();
         $error = $this->_checkForm($request);
         if (count($error) == 0) {
             $Video = new Video();
             $Video->merge($request);
             $Video->save();
             $this->Member->log('Video:' . $Video->name . '(' . $Video->id . ')', 'Tạo mới');
             My_Plugin_Libs::setSplash('Video: <b>' . $Video->name . '</b> đã tạo thành công. ');
             $this->_redirect($this->_helper->url('index', 'video', 'admin'));
         }
         if (count($error)) {
             $this->view->error = $error;
         }
     }
 }
開發者ID:hoaitn,項目名稱:base-zend,代碼行數:20,代碼來源:VideoController.php

示例10: unlinkFromVideo

 /**
  * Unlink files from video
  */
 public function unlinkFromVideo()
 {
     $post = $this->input->post();
     if (!empty($post['video_id'])) {
         $video = new Video($post['video_id']);
         if (!empty($post['video_file_id'])) {
             $video->video_file_id = null;
             $video->save();
             $result['video_file_id'] = $post['video_file_id'];
         }
         if (!empty($post['file'])) {
             $file = new File($post['file'][0]);
             if ($file->exists()) {
                 $video->delete($file);
                 $result['file'] = $post['file'];
             }
         }
         $result['success'] = true;
         echo json_encode($result);
     }
 }
開發者ID:andrewkrug,項目名稱:repucaution,代碼行數:24,代碼來源:upload.php

示例11: store

 /**
  * Store a newly created resource in storage.
  * POST /videos
  *
  * @return Response
  */
 public function store()
 {
     $post = new Video();
     $post->title = Input::get('title');
     if (Input::hasFile('photo')) {
         $photo = Input::file('photo');
         $filename = time() . '-' . $photo->getClientOriginalName();
         $destination = public_path() . '/uploads/' . $filename;
         if (!File::exists($destination)) {
             try {
                 $photo_path = $photo->move(public_path() . '/uploads/', $filename);
                 $post->url = $filename;
             } catch (Fileexception $e) {
                 return 'Sorry, Could not upload the file! Please, try again later!!';
             }
         } else {
             return 'This File already exist!! Please, upload another file!!!';
         }
     }
     $post->save();
     return Redirect::to('videos')->with('message', 'Photo uploaded Successfully');
 }
開發者ID:shankargiri,項目名稱:taylor_latest,代碼行數:28,代碼來源:VideosController.php

示例12: store

 public function store()
 {
     $rules = ['name' => 'required', 'url' => 'required', 'duration' => 'required|numeric'];
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     } else {
         if (Input::has('video_id')) {
             $id = Input::get('video_id');
             $video = VideoModel::find($id);
         } else {
             $video = new VideoModel();
         }
         $video->company_id = Session::get('company_id');
         $video->name = Input::get('name');
         $video->url = Input::get('url');
         $video->duration = Input::get('duration');
         $video->save();
         $alert['msg'] = 'Video has been saved successfully';
         $alert['type'] = 'success';
         return Redirect::route('company.video')->with('alert', $alert);
     }
 }
開發者ID:victory21th,項目名稱:QM-Laravel,代碼行數:23,代碼來源:VideoController.php

示例13: Video

include_once './includes/bootstrap.php';
try {
    $video = new Video($example_video_path);
    $process = $video->getProcess();
    $video->extractSegment(new Timecode(10), new Timecode(20));
    $multi_output = new MultiOutput();
    $ogg_output = './output/big_buck_bunny.multi1.ogg';
    $format = Format::getFormatFor($ogg_output, null, 'VideoFormat');
    $format->setVideoDimensions(VideoFormat::DIMENSION_SQCIF);
    $multi_output->addOutput($ogg_output, $format);
    $threegp_output = './output/big_buck_bunny.multi2.3gp';
    $format = Format::getFormatFor($threegp_output, null, 'VideoFormat');
    $format->setVideoDimensions(VideoFormat::DIMENSION_XGA);
    $multi_output->addOutput($threegp_output, $format);
    $process = $video->save($multi_output, null, Media::OVERWRITE_EXISTING);
    echo '<h1>Executed Command</h1>';
    Trace::vars($process->getExecutedCommand());
    echo '<h1>Executed Command RAW</h1>';
    Trace::vars($process->getExecutedCommand(true));
    echo '<hr /><h1>FFmpeg Process Messages</h1>';
    Trace::vars($process->getMessages());
    echo '<hr /><h1>Buffer Output</h1>';
    Trace::vars($process->getBuffer(true));
    echo '<hr /><h1>Resulting Output</h1>';
    $output = $process->getOutput();
    $output = array_values($output);
    $paths = array();
    foreach ($output as $obj) {
        array_push($paths, $obj->getMediaPath());
    }
開發者ID:kunitwru,項目名稱:phpvideotoolkit-v2,代碼行數:30,代碼來源:convert-to-multiple-outputs.php

示例14: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($idLesson)
 {
     $this->layout = 'site';
     $model = new Video();
     $model->id_lesson = (int) $idLesson;
     $arrayModels = array();
     if (isset($_POST['Video'])) {
         $model->attributes = $_POST['Video'];
         $lesson = Lesson::model()->findByPk($idLesson);
         if (Yii::app()->user->checkAccess('adminOwnLesson', array('lesson' => $lesson))) {
             $model->is_active = $lesson->is_active;
         }
         $model->id_lesson = $idLesson;
         $model->path_video_thumbnail = Yii::app()->params['defaultLessonThumbnail'];
         if ($model->save()) {
             if (!Yii::app()->user->checkAccess('adminLesson')) {
                 $model->is_active = 0;
                 $adminUserIds = Yii::app()->db->createCommand()->select('userid')->from('authassignment')->where('itemname=:itemname', array(':itemname' => 'admin'))->queryColumn();
                 foreach ($adminUserIds as $id) {
                     $message = new Message();
                     $message->id_from = Yii::app()->user->getId();
                     $message->id_user = $id;
                     $message->subject = 'A new video is created';
                     $message->message = "User " . CHtml::link($this->viewer->username, $this->viewer->href) . " have just created the lesson " . CHtml::link($model->name, $model->href);
                     $message->save();
                 }
             }
             $this->redirect(array('view', 'id' => $model->id));
         }
         //            $model->file = $file = CUploadedFile::getInstance($model, 'file');
         //            if ($model->validate(array('file'))) {
         //                $fileName = Yii::app()->params['video'] . '/' . $file->getName();
         //                if (file_exists($fileName)) {
         //                    $fileName = Yii::app()->params['lessonThumbnails'] . '/' . time() . '_' . $file->getName();
         //                }
         //                if ($file->saveAs(strtolower($fileName))) {
         ////                    $videoHelper = new CVideo();
         ////                    $videoThumbnailName = $videoHelper->create_thumbnail($fileName,
         ////                            Yii::app()->params['videoWidth'],
         ////                            Yii::app()->params['videoHeight'],
         ////                            Yii::app()->params['videoThumbnail']
         ////                    );
         ////                    $convertVideoFileName = $videoHelper->convertVideo($fileName);
         ////
         ////                    $model->path = $convertVideoFileName;
         ////                    $model->path_video_thumbnail = $videoThumbnailName;
         //
         //                    $model->path = $fileName;
         //                    $model->path_video_thumbnail = Yii::app()->params['defaultLessonThumbnail'];
         //
         //                    if ($model->save()) {
         //                        $this->redirect(array('view', 'id' => $model->getPrimaryKey()));
         //                    }
         //                }
         //            }
     }
     if (Yii::app()->user->checkAccess('adminVideo')) {
         $model->is_active = 1;
     }
     $this->render('create', array('model' => $model));
 }
開發者ID:laiello,項目名稱:flexiblearning,代碼行數:65,代碼來源:VideoController.php

示例15: actionCreate

 /**
  * 新增數據
  *
  */
 public function actionCreate()
 {
     $model = new Video();
     if (isset($_POST['Video'])) {
         $model->attributes = $_POST['Video'];
         //軟件文件
         $fileids = is_array($_POST['fileid']) ? implode(',', $_POST['fileid']) : '';
         $model->fileid = $fileids;
         if ($_FILES['attach']['error'] == UPLOAD_ERR_OK) {
             //封麵圖片
             $upload = new Uploader();
             $upload->uploadFile($_FILES['attach']);
             if ($upload->_error) {
                 $upload->deleteFile($upload->_file_name);
                 $this->message('error', Yii::t('admin', $upload->_error));
                 return;
             }
             $model->cover_image = $upload->_file_name;
         } else {
             //未改變前的封麵圖片
             $model->cover_image = $_POST['old_cover'];
         }
         $model->create_time = time();
         $model->update_time = $model->create_time;
         if ($model->save()) {
             $this->message('success', Yii::t('admin', 'Add Success'), $this->createUrl('index'));
         }
     }
     //判斷有無視頻欄目
     $video_cat = Catalog::model()->find('type=:type', array(':type' => $this->_type));
     if (!$video_cat) {
         $this->message('error', Yii::t('admin', 'No Catalog'), $this->createUrl('index'));
     }
     $this->render('update', array('model' => $model));
 }
開發者ID:SallyU,項目名稱:yiicms,代碼行數:39,代碼來源:VideoController.php


注:本文中的Video::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。