当前位置: 首页>>代码示例>>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;未经允许,请勿转载。