当前位置: 首页>>代码示例>>PHP>>正文


PHP Video::model方法代码示例

本文整理汇总了PHP中Video::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Video::model方法的具体用法?PHP Video::model怎么用?PHP Video::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Video的用法示例。


在下文中一共展示了Video::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     $tags = Tag::model()->findAll();
     if ($tags) {
         foreach ($tags as $tag) {
             $post = Post::model()->findAll("FIND_IN_SET(:tag, tags)", array(':tag' => $tag->tag_name));
             $image = Image::model()->findAll("FIND_IN_SET(:tag, tags)", array(':tag' => $tag->tag_name));
             $soft = Soft::model()->findAll("FIND_IN_SET(:tag, seo_keywords)", array(':tag' => $tag->tag_name));
             $video = Video::model()->findAll("FIND_IN_SET(:tag, seo_keywords)", array(':tag' => $tag->tag_name));
             if (!$post && !$image && !$soft && !$video) {
                 $tag->delete();
             } else {
                 $tag->data_count = count($post) + count($image) + count($soft);
                 $tag->save();
             }
         }
     }
     $tagdatas = TagData::model()->findAll();
     if ($tagdatas) {
         foreach ($tagdatas as $value) {
             $modelType = ModelType::model()->findByPk($value->type);
             $model = $modelType->model;
             $data = $model::model()->findByPk($value->content_id);
             if (!$data) {
                 $value->delete();
             }
         }
     }
     $this->controller->message('success', Yii::t('admin', 'Reset Tags Success'), $this->controller->createUrl('index'));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:30,代码来源:ResetAction.php

示例2: actionVideo

 public function actionVideo()
 {
     $criteria = new CDbCriteria();
     $criteria->limit = 25;
     $model = Video::model()->is_publish()->findAll($criteria);
     $this->setRss($model, 'video', 'Video', 'Rss Feed Video', $this->createUrl('video'));
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:7,代码来源:RssController.php

示例3: run

 public function run()
 {
     //限制下载频率
     $cookie = Yii::app()->request->getCookies();
     $id = Yii::app()->request->getParam('id');
     $cookie_key = 'DL' . $id . 'TIMES';
     if (isset($cookie[$cookie_key]) && $cookie[$cookie_key]->value) {
         throw new CHttpException(404, Yii::t('common', 'Access frequency too fast'));
     }
     $video = Video::model()->findByPk($id);
     if ($video) {
         $file = Helper::convertChineseName(ROOT_PATH . '/' . $video->video_file);
         if ($video->video_file && file_exists($file)) {
             $filename = pathinfo($file, PATHINFO_BASENAME);
             //更新下载次数
             $video->updateCounters(array('down_count' => 1), 'id=:id', array('id' => $id));
             //存储下载cookie次数
             unset($cookie[$cookie_key]);
             $down = 1;
             $cookie = new CHttpCookie($cookie_key, $down);
             $cookie->expire = time() + 20;
             //20秒之后可以再次下载
             Yii::app()->request->cookies[$cookie_key] = $cookie;
             //开始下载
             Yii::app()->request->sendFile($filename, file_get_contents($file));
             exit;
         } else {
             throw new CHttpException(404, Yii::t('common', 'Source Is Not Found'));
         }
     } else {
         throw new CHttpException(404, Yii::t('common', 'Source Is Not Found'));
     }
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:33,代码来源:DownloadAction.php

示例4: run

 public function run()
 {
     //SEO
     $this->controller->_seoTitle = $this->controller->_setting['seo_title'];
     $this->controller->_seoKeywords = $this->controller->_setting['seo_keywords'];
     $this->controller->_seoDescription = $this->controller->_setting['seo_description'];
     //头部banner
     $index_top_banner = Ad::model()->getAdOne(4);
     //中部banner
     $index_mid_banner = Ad::model()->getAdOne(3);
     //底部banner
     $index_bottom_banner = Ad::model()->getAdOne(5);
     //最新资讯
     $news_new = Post::model()->getList(array('limit' => 20));
     //热门资讯
     $news_hot = Post::model()->getList(array('order' => 't.view_count DESC, t.id DESC', 'limit' => 20));
     //最新图集
     $image_new = Image::model()->getList(array('limit' => 10));
     //热门图集
     $image_hot = Image::model()->getList(array('limit' => 10, 'order' => 'view_count DESC, t.id DESC'));
     //最新软件
     $soft_new = Soft::model()->getList(array('limit' => 20));
     //热门软件
     $soft_hot = Soft::model()->getList(array('limit' => 10, 'order' => 'down_count DESC, t.id DESC'));
     //最新视频
     $video_new = Video::model()->findAll("status=:status AND catalog_id = 13 ORDER BY id DESC Limit 20", array(':status' => 'Y'));
     //热门视频
     $video_hot = Video::model()->findAll("status=:status AND catalog_id = 13 ORDER BY view_count DESC, video_score DESC, id DESC Limit 20", array(':status' => 'Y'));
     //友情链接
     $link_logos = Link::model()->findAll("logo !='' AND status='Y'", array('order' => 'sortorder ASC, id DESC'));
     $link_texts = Link::model()->findAll("logo ='' AND status='Y'", array('order' => 'sortorder ASC, id DESC'));
     $this->controller->render('index', array('index_top_banner' => $index_top_banner, 'index_mid_banner' => $index_mid_banner, 'index_bottom_banner' => $index_bottom_banner, 'link_logos' => $link_logos, 'link_texts' => $link_texts, 'news_new' => $news_new, 'news_hot' => $news_hot, 'image_new' => $image_new, 'image_hot' => $image_hot, 'soft_new' => $soft_new, 'soft_hot' => $soft_hot, 'video_new' => $video_new, 'video_hot' => $video_hot));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:33,代码来源:IndexAction.php

示例5: run

 public function run()
 {
     $ids = Yii::app()->request->getParam('id');
     $command = Yii::app()->request->getParam('command');
     empty($ids) && $this->controller->message('error', Yii::t('admin', 'No Select'));
     if (!is_array($ids)) {
         $ids = array($ids);
     }
     $criteria = new CDbCriteria();
     $criteria->addInCondition('id', $ids);
     switch ($command) {
         case 'delete':
             //删除
             foreach ((array) $ids as $id) {
                 $videoModel = Video::model()->findByPk($id);
                 if ($videoModel) {
                     Uploader::deleteFile(ROOT_PATH . $videoModel->cover_image);
                 }
             }
             Video::model()->deleteAll($criteria);
             break;
         case 'show':
             //显示
             Video::model()->updateAll(['status' => 'Y'], $criteria);
             break;
         case 'hidden':
             //隐藏
             Video::model()->updateAll(['status' => 'N'], $criteria);
             break;
         default:
             $this->controller->message('error', Yii::t('admin', 'Error Operation'));
     }
     $this->controller->message('success', Yii::t('admin', 'Batch Operate Success'));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:34,代码来源:BatchAction.php

示例6: loadPost

 private function loadPost($id, $slug)
 {
     $model = Video::model()->is_publish()->findByAttributes(array('ID' => (int) $id, 'post_link' => $slug));
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:8,代码来源:VideoController.php

示例7: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Video the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Video::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:Vladimirtishenko,项目名称:sn,代码行数:15,代码来源:VideoController.php

示例8: run

 public function run()
 {
     $criteria = new CdbCriteria();
     $criteria->limit = $this->data('limit');
     $criteria->offset = $this->data('offset');
     $criteria->order = "ID DESC";
     $model = Video::model()->is_publish()->findAll($criteria);
     $this->layout($model);
 }
开发者ID:beckblurry,项目名称:Yii1-Base-Core-V.Alpha.1,代码行数:9,代码来源:widget_video.php

示例9: actionPlay

 public function actionPlay($id)
 {
     $this->layout = '//layouts/header_default';
     $video = Video::model()->findByPk($id);
     if (count($video)) {
         $this->render('play', array('url' => $video->path));
     } else {
         echo "Video not found!";
     }
 }
开发者ID:snipesn,项目名称:UkrYama-2,代码行数:10,代码来源:VideoController.php

示例10: loadModel

 /**
  * 判断数据是否存在
  * 
  * return \$this->model
  */
 public function loadModel()
 {
     if ($this->model === null) {
         if (isset($_GET['id'])) {
             $this->model = Video::model()->findbyPk($_GET['id']);
         }
         if ($this->model === null) {
             throw new CHttpException(404, Yii::t('common', 'The requested page does not exist.'));
         }
     }
     return $this->model;
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:17,代码来源:VideoController.php

示例11: run

 public function run()
 {
     $catalog_id = trim(Yii::app()->request->getParam('catalog_id'));
     $order = trim(Yii::app()->request->getParam('order'));
     if (!$order) {
         $order = 'id';
     }
     switch ($order) {
         case 'id':
             $order_by = 't.id DESC';
             break;
         case 'view_count':
             $order_by = 'view_count DESC';
             break;
         default:
             $order = 'id';
             $order_by = 't.id DESC';
             break;
     }
     //SEO
     $navs = array();
     $search_cats = '所有';
     if ($catalog_id) {
         $condition = ' AND catalog_id = ' . $catalog_id;
         $catalog = Catalog::model()->findByPk($catalog_id);
         if ($catalog) {
             $this->controller->_seoTitle = $catalog->seo_title ? $catalog->seo_title : $catalog->catalog_name . ' - ' . $this->controller->_setting['site_name'];
             $this->controller->_seoKeywords = $catalog->seo_keywords;
             $this->controller->_seoDescription = $catalog->seo_description;
             $navs[] = array('url' => $this->controller->createUrl('video/index', array('catalog_id' => $catalog->id)), 'name' => $catalog->catalog_name);
             //已搜索的分类
             $cat_parents = Catalog::getParantsCatalog($catalog_id);
             $search_cats = $cat_parents ? implode('>', $cat_parents) . '>' . $catalog->catalog_name : $catalog->catalog_name;
         }
     } else {
         $condition = '';
         $catalog = array();
         $seo = ModelType::getSEO('post');
         $this->controller->_seoTitle = $seo['seo_title'] . ' - ' . $this->controller->_setting['site_name'];
         $this->controller->_seoKeywords = $seo['seo_keywords'];
         $this->controller->_seoDescription = $seo['seo_description'];
         $navs[] = array('url' => Yii::app()->request->getUrl(), 'name' => $this->controller->_seoTitle);
     }
     //获取所有符合条件的视频
     $pages = array();
     $datalist = Video::model()->getList(array('condition' => $condition, 'limit' => 15, 'order' => $order_by, 'page' => true), $pages);
     //该栏目下最新的视频
     $last_videos = Video::model()->getList(array('condition' => $condition, 'limit' => 10));
     $this->controller->render('index', array('navs' => $navs, 'catalog' => $catalog, 'videos' => $datalist, 'pagebar' => $pages, 'last_videos' => $last_videos, 'order' => $order, 'search_cats' => $search_cats));
 }
开发者ID:manjingzi,项目名称:yiifcms,代码行数:50,代码来源:IndexAction.php

示例12: run

 public function run($id)
 {
     if (app()->request->isPostRequest) {
         // we only allow deletion via POST request
         $this->controller->getModel(null)->findByPk($id)->delete();
         if ($this->controller->getId() == 'user') {
             Video::model()->deleteAll("user_id = :p", array(":p" => $id));
         }
         // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
         if (!isset($_GET['ajax'])) {
             $this->controller->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));
         } else {
             app()->end();
         }
     }
 }
开发者ID:rajveer4155,项目名称:vidmgr,代码行数:16,代码来源:DeleteAction.php

示例13: actionView

 public function actionView()
 {
     if (isset($_GET['id'])) {
         $video = Video::model()->findByPk($_GET['id']);
         //var_dump($video->user_id);die;
         $video->view += 1;
         $video->update(array('view'));
         //$video->user = XfUser::model()->find("user_id=".$video->user_id);
         $comment = $this->newComment($video);
         $cs = Yii::app()->getClientScript();
         $js = $this->generateJs();
         $cs->registerScript('sharebox', $js, CClientScript::POS_READY);
         /*$xf = new XfAuthentication();
           $user = $xf->getUser();
           var_dump($user);*/
         $this->render('view', array('video' => $video, 'comment' => $comment));
     } else {
         $this->redirect($this->createUrl('index'));
     }
 }
开发者ID:ngdvan,项目名称:lntguitar,代码行数:20,代码来源:VideoController.php

示例14: run

 public function run()
 {
     $id = Yii::app()->request->getParam('id');
     $post = Video::model()->findByPk(intval($id));
     if (false == $post || $post->status == 'N') {
         throw new CHttpException(404, Yii::t('common', 'The requested page does not exist.'));
     }
     //更新浏览次数
     $post->updateCounters(array('view_count' => 1), 'id=:id', array('id' => $id));
     //seo信息
     $this->controller->_seoTitle = empty($post->seo_title) ? $post->title . ' - ' . $this->controller->_setting['site_name'] : $post->seo_title;
     $this->controller->_seoKeywords = empty($post->seo_keywords) ? $post->tags : $post->seo_keywords;
     $this->controller->_seoDescription = empty($post->seo_description) ? $this->controller->_seoDescription : $post->seo_description;
     //最近的视频
     $last_videos = Video::model()->findAll(array('condition' => 'catalog_id = ' . $post->catalog_id, 'order' => 'id DESC', 'limit' => 10));
     //nav
     $navs = array();
     $navs[] = array('url' => $this->controller->createUrl('video/view', array('id' => $id)), 'name' => $post->title);
     $tplVar = array('video' => $post, 'navs' => $navs, 'last_videos' => $last_videos);
     $this->controller->render('view', $tplVar);
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:21,代码来源:ViewAction.php

示例15: run

 public function run()
 {
     $g = Yii::app()->request->getParam('g');
     //1获取 0评分
     $id = Yii::app()->request->getParam('id');
     $s = Yii::app()->request->getParam('s');
     //等级0-5
     $res = Video::model()->findByPk($id);
     //t 总人数 s 从低分人数到高分人数分布
     if ($g == 1) {
         if ($res->voted) {
             exit($res->voted);
         } else {
             exit('{"t":0,"s":[0,0,0,0,0]}');
         }
     } else {
         if ($res->voted) {
             $arr_res = CJSON::decode($res->voted);
         } else {
             $arr_res = array('t' => 0, 's' => array(0, 0, 0, 0, 0));
         }
         $arr_res['t'] = $arr_res['t'] + 1;
         $arr_res['s'][$s - 1] = $arr_res['s'][$s - 1] + 1;
         //计算得分
         $avg_1 = $arr_res['t'] > 0 ? round(($arr_res['s'][0] + 2 * $arr_res['s'][1] + 3 * $arr_res['s'][2] + 4 * $arr_res['s'][3] + 5 * $arr_res['s'][4]) / $arr_res['t'] * 2, 1) : '0.0';
         $avg_2 = substr($avg_1, 0, 3);
         //取前三位
         $avg = trim($avg_2, '.');
         //去除多余的前后.
         $data = CJSON::encode($arr_res);
         $res->voted = $data;
         $res->video_score = $avg;
         $res->save();
         exit('1');
     }
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:36,代码来源:ScoreAction.php


注:本文中的Video::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。