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


PHP Type::count方法代码示例

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


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

示例1: listType

 public function listType()
 {
     if (!Request::ajax()) {
         return App::abort(404);
     }
     $start = Input::has('start') ? (int) Input::get('start') : 0;
     $length = Input::has('length') ? Input::get('length') : 10;
     $search = Input::has('search') ? Input::get('search') : [];
     $types = Type::select('types.id', 'types.image', 'types.name', 'types.description', 'types.order_no', 'parent.name as parent_name', 'types.active');
     if (!empty($search)) {
         foreach ($search as $key => $value) {
             if (empty($value)) {
                 continue;
             }
             if ($key == 'active') {
                 if ($value == 'yes') {
                     $value = 1;
                 } else {
                     $value = 0;
                 }
                 $types->where('types.' . $key, $value);
             } else {
                 if ($key == 'parent_id') {
                     $types->where('types.' . $key, (int) $value);
                 } else {
                     $value = ltrim(rtrim($value));
                     $types->where('types.' . $key, 'like', '%' . $value . '%');
                 }
             }
         }
     }
     $count = $types->count();
     $order = Input::has('order') ? Input::get('order') : [];
     if (!empty($order)) {
         $columns = Input::has('columns') ? Input::get('columns') : [];
         foreach ($order as $value) {
             $column = $value['column'];
             if (!isset($columns[$column]['name']) || empty($columns[$column]['name'])) {
                 continue;
             }
             $types->orderBy($columns[$column]['name'], $value['dir'] == 'asc' ? 'asc' : 'desc');
         }
     }
     if ($length > 0) {
         $types = $types->skip($start)->take($length);
     }
     $arrtypes = $types->leftJoin('types as parent', 'types.parent_id', '=', 'parent.id')->get()->toArray();
     $arrReturn = ['draw' => Input::has('draw') ? Input::get('draw') : 1, 'recordsTotal' => Type::count(), 'recordsFiltered' => $count, 'data' => []];
     if (!empty($arrtypes)) {
         foreach ($arrtypes as $type) {
             $type['parent_name'] = is_null($type['parent_name']) ? 'No Parent' : $type['parent_name'];
             $arrReturn['data'][] = [++$start, $type['id'], $type['name'], $type['description'], $type['image'], $type['order_no'], $type['parent_name'], $type['active']];
         }
     }
     return $arrReturn;
 }
开发者ID:nguyendaivu,项目名称:imagestock,代码行数:56,代码来源:TypesController.php

示例2: actionList

 public function actionList()
 {
     $page = isset($_GET['page']) ? intval($_GET['page']) : 1;
     $list = array();
     $criteria = new CDbCriteria(array('order' => 'id ASC'));
     $types = new Type();
     $count = $types->count($criteria);
     $pager = new CPagination($count);
     $pager->pageSize = Yii::app()->params['postsPerPage'];
     $pager->setCurrentPage($page - 1);
     $pager->applyLimit($criteria);
     $list = $types->findAll($criteria);
     $this->render('list', array('r' => Yii::app()->request->baseUrl . '/', 'pages' => $pager, 'list' => $list));
 }
开发者ID:humor-zo,项目名称:woc-yii,代码行数:14,代码来源:TypeController.php

示例3: getType

 public function getType()
 {
     return View::make('branch.type')->with('type', Type::paginate())->with('count', Type::count());
 }
开发者ID:huanghua581,项目名称:erp,代码行数:4,代码来源:BranchController.php


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