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


PHP Video::count方法代码示例

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


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

示例1: actionIndex

 /**
  * 首页
  *
  */
 public function actionIndex()
 {
     $model = new Video();
     $criteria = new CDbCriteria();
     $condition = "type = " . $this->_type;
     $name = trim($this->_request->getParam('name'));
     $catalogId = intval($this->_request->getParam('catalogId'));
     $title && ($condition .= ' AND name LIKE \'%' . $name . '%\'');
     $catalogId && ($condition .= ' AND catalog_id= ' . $catalogId);
     $criteria->condition = $condition;
     $criteria->order = 't.id DESC';
     $criteria->with = array('catalog');
     $count = $model->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 10;
     //根据title,catelogId,titleAlias查询
     $pageParams = $this->buildCondition($_GET, array('name', 'catalogId'));
     $pages->params = is_array($pageParams) ? $pageParams : array();
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $result = $model->findAll($criteria);
     //推荐位
     $recom_list = RecommendPosition::model()->findAll('type=:type', array(':type' => $this->_type));
     $this->render('index', array('datalist' => $result, 'pagebar' => $pages, 'recom_list' => $recom_list));
 }
开发者ID:SallyU,项目名称:yiicms,代码行数:29,代码来源:VideoController.php

示例2: index

 public function index($request)
 {
     $data = [];
     $counts = [];
     $counts['videos'] = Video::count();
     $counts['users'] = User::count();
     $counts['channels'] = UserChannel::count();
     $counts['comments'] = Comment::count();
     $counts['total_views'] = Video::sumViews();
     $counts['channel_user_ratio'] = round($counts['channels'] / $counts['users'], 2);
     $counts['videos_that_has_comments'] = Statistic::countVideosHavingComments();
     $counts['channels_having_videos'] = Video::find_by_sql('SELECT count(DISTINCT poster_id) as count from `videos`')[0]->count;
     $counts['part_of_commented_videos'] = round($counts['videos_that_has_comments'] / $counts['videos'] * 100, 2);
     $counts['part_of_channels_having_videos'] = round($counts['channels_having_videos'] / $counts['channels'] * 100, 2);
     $counts['user_1_channel'] = Statistic::countUserHavingChannels('= 1');
     $counts['user_2_channel'] = Statistic::countUserHavingChannels('= 2');
     $counts['user_3_channel'] = Statistic::countUserHavingChannels('= 3');
     $counts['user_more3_channel'] = Statistic::countUserHavingChannels('> 3');
     $counts['user_1_channel_part'] = round($counts['user_1_channel'] / $counts['users'] * 100, 2);
     $counts['user_2_channel_part'] = round($counts['user_2_channel'] / $counts['users'] * 100, 2);
     $counts['user_3_channel_part'] = round($counts['user_3_channel'] / $counts['users'] * 100, 2);
     $counts['user_more3_channel_part'] = round($counts['user_more3_channel'] / $counts['users'] * 100, 2);
     $data['counts'] = $counts;
     return new ViewResponse('admin/statistic/index', $data);
 }
开发者ID:boulama,项目名称:DreamVids,代码行数:25,代码来源:statistic_controller.php

示例3: actionIndex

 /**
  * 首页
  */
 public function actionIndex()
 {
     $catalog_id = trim($this->_request->getParam('catalog_id'));
     $keyword = trim($this->_request->getParam('keyword'));
     $catalog = Catalog::model()->findByPk($catalog_id);
     //调取子孙分类和当前分类
     $catalog_ids = Catalog::get($catalog ? $catalog_id : 0, $this->_catalog);
     $children_ids = Helper::array_key_values($catalog_ids, 'id');
     $catalog_id ? $all_ids = array_merge($children_ids, (array) $catalog_id) : ($all_ids = $children_ids);
     $db_in_ids = implode(',', $all_ids);
     if (!$db_in_ids || $catalog_id && $catalog->type != $this->_type_ids['video']) {
         throw new CHttpException(404, Yii::t('common', 'The requested page does not exist.'));
     }
     //SEO
     $navs = array();
     if ($catalog) {
         $this->_seoTitle = $catalog->seo_title ? $catalog->seo_title : $catalog->catalog_name . ' - ' . $this->_setting['site_name'];
         $this->_seoKeywords = $catalog->seo_keywords;
         $this->_seoDescription = $catalog->seo_description;
         $navs[] = array('url' => $this->createUrl('video/index', array('catalog_id' => $catalog->id)), 'name' => $catalog->catalog_name);
     } else {
         $this->_seoTitle = Yii::t('common', 'VideoListTitle') . ' - ' . $this->_setting['site_name'];
         $this->_seoKeywords = Yii::t('common', 'VideoListKeywords');
         $this->_seoDescription = Yii::t('common', 'VideoListDescription', array('{site_name}' => $this->_setting['site_name']));
         $navs[] = array('url' => $this->_request->getUrl(), 'name' => $this->_seoTitle);
     }
     //查询条件
     $post = new Video();
     $criteria = new CDbCriteria();
     $condition = "t.status = 'Y'";
     $keyword && ($condition .= ' AND title LIKE \'%' . $keyword . '%\'');
     $db_in_ids && ($condition .= ' AND catalog_id IN (' . $db_in_ids . ')');
     $criteria->condition = $condition;
     $criteria->order = 'video_score DESC, view_count DESC, t.id DESC';
     $criteria->with = array('catalog');
     $criteria->select = "title, id, t.cover_image, t.video_score,  t.update_time,t.introduce, t.view_count";
     //分页
     $count = $post->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 20;
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $datalist = $post->findAll($criteria);
     //最近的视频
     $last_videos = Video::model()->findAll(array('condition' => 'catalog_id IN (' . $db_in_ids . ')', 'order' => 'id DESC', 'limit' => 10));
     //加载css,js
     Yii::app()->clientScript->registerCssFile($this->_stylePath . "/css/list.css");
     Yii::app()->clientScript->registerScriptFile($this->_static_public . "/js/jquery/jquery.js");
     $this->render('index', array('navs' => $navs, 'videos' => $datalist, 'pagebar' => $pages, 'last_videos' => $last_videos));
 }
开发者ID:redtreelchao,项目名称:wander-moon,代码行数:53,代码来源:VideoController.php

示例4: actionIndex

 /**
  * 首页
  *
  */
 public function actionIndex()
 {
     parent::_acl('video_index');
     $model = new Video();
     $criteria = new CDbCriteria();
     $criteria->order = 'id DESC';
     $count = $model->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 10;
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $result = $model->findAll($criteria);
     $this->render('index', array('datalist' => $result, 'pagebar' => $pages));
 }
开发者ID:zywh,项目名称:maplecity,代码行数:18,代码来源:VideoController.php

示例5: run

 public function run()
 {
     $model = new Video();
     //条件
     $criteria = new CDbCriteria();
     $title = trim(Yii::app()->request->getParam('title'));
     $catalogId = intval(Yii::app()->request->getParam('catalogId'));
     $criteria->addColumnCondition(array('type' => $this->controller->_type));
     $title && $criteria->addSearchCondition('title', $title);
     $catalogId && $criteria->addColumnCondition(array('catalog_id' => $catalogId));
     $criteria->order = 't.id DESC';
     $criteria->with = array('catalog');
     $count = $model->count($criteria);
     //分页
     $pages = new CPagination($count);
     $pages->pageSize = 10;
     $pages->applyLimit($criteria);
     $result = $model->findAll($criteria);
     $this->controller->render('index', array('model' => $model, 'datalist' => $result, 'pagebar' => $pages));
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:20,代码来源:IndexAction.php

示例6: getLinkData

 public static function getLinkData($link)
 {
     $r = new Video();
     $r->_link = $link;
     if (!filter_var($r->_link, FILTER_VALIDATE_URL)) {
         $r->_results = '';
         $r->_data = '';
         $r->_count = 0;
         return $r;
     }
     $link = urlencode($link);
     $link = 'http://www.getlinkinfo.com/info?link=' . $link;
     $r->_results = array();
     $html = file_get_html($link);
     $data = $html->find('dd');
     $videoid = '';
     $vidname = '';
     $viddesc = '';
     $length = '';
     foreach ($data as $key => $value) {
         switch ($key) {
             case 0:
                 $videoid = strip_tags('' . $value . '');
                 break;
             case 3:
                 $vidname = strip_tags('' . $value . '');
                 break;
             case 4:
                 $viddesc = strip_tags('' . $value . '');
                 break;
         }
     }
     array_push($r->_data, array('videoid' => $videoid, 'vidname' => $vidname, 'viddesc' => $viddesc));
     $r->_count = $r->count();
     return $r;
 }
开发者ID:russellmcowen,项目名称:mcowen_cms,代码行数:36,代码来源:Video.php

示例7: channelslist

 public function channelslist($request)
 {
     if (Session::isActive()) {
         if (count(Session::get()->getOwnedChannels()) > 1) {
             $data['user'] = Session::get();
             $data['currentPageTitle'] = 'Mon compte';
             $data['channel'] = Session::get()->getOwnedChannels();
             $data['videos_count'] = array();
             foreach ($data['channel'] as $chan) {
                 $data['videos_count'][$chan->id] = Video::count(array('conditions' => array('poster_id = ?', $chan->id)));
             }
             $data['current'] = 'videos';
             $response = new ViewResponse('account/channels_videos', $data);
             if (empty($data['channel'])) {
                 $response->addMessage(ViewMessage::error('Vous n\'avez aucune chaîne'));
             }
             return $response;
         } else {
             return new RedirectResponse(WEBROOT . 'account/videos/' . Session::get()->getMainChannel()->id);
         }
     } else {
         return new RedirectResponse(Utils::generateLoginURL());
     }
 }
开发者ID:boulama,项目名称:DreamVids,代码行数:24,代码来源:account_controller.php


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