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


PHP CActiveDataProvider::getPagination方法代码示例

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


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

示例1: actionIndex

 public function actionIndex()
 {
     $with = array('active_keywords');
     $whereType = "and t.type='" . Globals::TYPE_REGISTRATION . "' and active_keywords.type='" . Globals::TYPE_ACTIVE . "'";
     $this->layout = '//layouts/memberList';
     $dataProvider = new CActiveDataProvider('ActiveModel', array('criteria' => array('order' => 't.id DESC', 'with' => $with, 'condition' => "t.wechatId = {$this->wechatInfo->id} {$whereType}", 'together' => true), 'pagination' => array('pageSize' => Page::SIZE, 'pageVar' => 'page')));
     $this->render('index', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination(), 'wechatInfo' => $this->wechatInfo));
 }
开发者ID:00606,项目名称:wechat,代码行数:8,代码来源:RegistrationController.php

示例2: page

 /**
  * 手机客户端的分页,防止分页重复,与网页显示无关
  * @param  CActiveDataProvider $dataProvider
  *
  */
 public function page(CActiveDataProvider &$dataProvider, $more = true)
 {
     $total = $dataProvider->getTotalItemCount();
     $pageSzie = $dataProvider->getPagination()->getPageSize();
     $dataProvider->getPagination()->pageVar = 'page';
     $pageCount = ceil($total / $pageSzie);
     if ($dataProvider->getTotalItemCount() == 0) {
         $this->send(ERROR_EMPTY, 'data empty', $more);
     } else {
         if (isset($_GET['page'])) {
             if ($pageCount >= $_GET['page']) {
                 $this->send(0, $dataProvider->getData(), $more, array('page' => $pageCount));
             }
         } else {
             $this->send(ERROR_NONE, $dataProvider->getData(), $more, array('page' => $pageCount));
         }
     }
 }
开发者ID:tiger2soft,项目名称:travelman,代码行数:23,代码来源:Controller.php

示例3: actionUser

 public function actionUser()
 {
     $this->layout = '//layouts/list';
     $group = GroupModel::model()->findall();
     foreach ($group as $v) {
         $groupList[$v->group_id] = $v->name;
     }
     $dataProvider = new CActiveDataProvider('UserModel', array('criteria' => array('order' => 'uid desc'), 'pagination' => array('pageSize' => Page::SIZE)));
     $this->render('userList', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination(), 'group' => $groupList));
 }
开发者ID:00606,项目名称:wechat,代码行数:10,代码来源:GroupController.php

示例4: actionReplay

 public function actionReplay()
 {
     $this->layout = '/layouts/memberList';
     $type = Yii::app()->request->getParam('type');
     $type = $type ? $type : GiftModel::TYPE_KEYWORDS;
     switch ($type) {
         case GiftModel::TYPE_KEYWORDS:
             $with = array('open_keywords', 'open_openPlatForm');
             $whereType = " and t.type ='" . GiftModel::TYPE_KEYWORDS . "' and open_keywords.type='" . OpenReplayModel::OPEN_TYPE . "'";
             break;
         case GiftModel::TYPE_MENU:
             $with = array('open_menuaction', 'open_openPlatForm');
             $whereType = " and t.type ='" . GiftModel::TYPE_MENU . "'";
             break;
     }
     $dataProvider = new CActiveDataProvider('OpenReplayModel', array('criteria' => array('order' => 't.id DESC', 'with' => $with, 'condition' => "t.wechatId = {$this->wechatInfo->id} {$whereType}", 'together' => true), 'pagination' => array('pageSize' => Page::SIZE, 'pageVar' => 'page')));
     $this->render('replay', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination(), 'type' => $type, 'wechatInfo' => $this->wechatInfo));
 }
开发者ID:00606,项目名称:wechat,代码行数:18,代码来源:OpenController.php

示例5: registerClientScript

 public function registerClientScript()
 {
     $id = $this->getId();
     if ($this->ajaxUpdate === false) {
         $ajaxUpdate = false;
     } else {
         $ajaxUpdate = array_unique(preg_split('/\\s*,\\s*/', $this->ajaxUpdate . ',' . $id, -1, PREG_SPLIT_NO_EMPTY));
     }
     $options = array('ajaxUpdate' => $ajaxUpdate, 'pagerClass' => $this->pagerCssClass, 'updateSelector' => $this->updateSelector, 'loadingClass' => $this->loadingCssClass, 'checkbox' => $this->checkbox);
     if ($this->enablePagination) {
         $options['pageVar'] = $this->dataProvider->getPagination()->pageVar;
     }
     $options = CJavaScript::encode($options);
     $cs = Yii::app()->getClientScript();
     Yii::app()->bootstrap->registerAssetCss('jquery.kanbanview.css');
     Yii::app()->bootstrap->registerAssetJs('jquery.kanbanlistview.js');
     $cs->registerScript(__CLASS__ . $this->id, "jQuery('#{$id}').kanbanView({$options})");
 }
开发者ID:GsHatRed,项目名称:Yiitest,代码行数:18,代码来源:TbKanbanListView.php

示例6: actionIndex

 public function actionIndex()
 {
     $type = Yii::app()->request->getParam('type');
     $type = $type ? $type : Globals::TYPE_KEYWORDS;
     switch ($type) {
         case Globals::TYPE_KEYWORDS:
             $with = array('wheel_keywords');
             $whereType = "and t.type='" . Globals::TYPE_KEYWORDS . "'\n                and wheel_keywords.type='" . Globals::TYPE_WHEEL . "'";
             break;
         case Globals::TYPE_MENU:
             $with = array('wheel_menuaction');
             $whereType = "and t.type='" . Globals::TYPE_MENU . "'";
             break;
     }
     $this->layout = '//layouts/memberList';
     $dataProvider = new CActiveDataProvider('WheelModel', array('criteria' => array('order' => 't.id DESC', 'with' => $with, 'condition' => "t.wechatId = {$this->wechatInfo->id} {$whereType}", 'together' => true), 'pagination' => array('pageSize' => Page::SIZE, 'pageVar' => 'page')));
     $this->render('index', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination(), 'type' => $type, 'wechatInfo' => $this->wechatInfo));
 }
开发者ID:00606,项目名称:wechat,代码行数:18,代码来源:WheelController.php

示例7: inquirylistdata

 public static function inquirylistdata($app)
 {
     $data = $app['arrt'];
     $organID = Yii::app()->user->getOrganID();
     $criteria = new CDbCriteria();
     $criteria->addCondition('OrganID=' . $organID);
     if ($data['startdate']) {
         $criteria->addCondition('CreateTime>=' . strtotime($data['startdate']));
     }
     if ($data['enddate']) {
         $criteria->addCondition('CreateTime<' . strtotime("+1 day", strtotime($data['enddate'])));
     }
     if (!empty($data['status']) || $data['status'] == '0') {
         $criteria->addCondition('Status =' . $data['status']);
     }
     if ($data['inquirySn']) {
         $criteria->addSearchCondition('InquirySn', $data['inquirySn']);
     }
     $criteria->order = 'CreateTime desc';
     $dataProvider = new CActiveDataProvider('PapInquiry', array('criteria' => $criteria, 'pagination' => array('pageSize' => '10')));
     $pages = $dataProvider->getPagination();
     $result = array('pages' => $pages, 'dataProvider' => $dataProvider);
     return $result;
 }
开发者ID:zwq,项目名称:unpei,代码行数:24,代码来源:InquiryorderService.php

示例8: actionGlobalExport

 /**
  * An AJAX called method to export module data.
  *
  * This method actually prepares all the data via recursive AJAX requests
  * until all data has been exported. This exports each module into the CSV
  * by class, using pagination to cut down on request time.
  *
  * @param string $model The name of the current model being exported
  * @param int $page The page of data which the data provider's paginator is on
  */
 public function actionGlobalExport($model, $page)
 {
     if (class_exists($model)) {
         ini_set('memory_limit', -1);
         $file = $this->safePath();
         $fp = fopen($file, 'a+');
         $tempModel = X2Model::model($model);
         $meta = array_keys($tempModel->attributes);
         $meta[] = $model;
         if ($page == 0) {
             fputcsv($fp, $meta);
         }
         // If we're on the first page for this model, need to add metadata.
         $dp = new CActiveDataProvider($model, array('pagination' => array('pageSize' => 100)));
         $pg = $dp->getPagination();
         $pg->setCurrentPage($page);
         // These two lines will set the data provider
         $dp->setPagination($pg);
         // paginator to the requested page of data
         $records = $dp->getData();
         $pageCount = $dp->getPagination()->getPageCount();
         // Total number of pages
         foreach ($records as $record) {
             // Re-pack all unpacked attributes for writing to a file, so that
             // they can be interpolated as strings:
             foreach ($record->behaviors() as $name => $config) {
                 $behavior = $record->asa($name);
                 if ($behavior instanceof TransformedFieldStorageBehavior) {
                     $behavior->packAll();
                     $record->disableBehavior($name);
                 }
             }
             $tempAttributes = $tempModel->attributes;
             $tempAttributes = array_merge($tempAttributes, $record->attributes);
             if ($model == 'Profile') {
                 $tempAttributes['theme'] = json_encode($record->theme);
             }
             $tempAttributes[] = $model;
             fputcsv($fp, $tempAttributes);
             // Export the data to CSV
         }
         unset($tempModel, $dp);
         fclose($fp);
         if ($page + 1 < $pageCount) {
             echo $page + 1;
             // If there are still more pages to go, echo the next page number
         }
     }
 }
开发者ID:xl602,项目名称:X2CRM,代码行数:59,代码来源:AdminController.php

示例9: init

 public function init()
 {
     if (!isset($this->htmlOptions['class'])) {
         $this->htmlOptions['class'] = 'datatable-view';
     }
     parent::init();
     if ($this->selectableRows == 1) {
         $this->itemsCssClass .= ' singleSelect';
         $this->config['fnInitComplete'] = new CJavaScriptExpression("function() { \$(this).find('tr input:checked').each(function() { \$(this).closest('tr').addClass('selected'); }); }");
     } elseif ($this->selectableRows > 1) {
         $this->itemsCssClass .= ' multiSelect';
         $this->config['fnInitComplete'] = new CJavaScriptExpression("function() { \$(this).find('tr input:checked').each(function() { \$(this).closest('tr').addClass('selected'); }); }");
     }
     if ($this->dataProvider->pagination !== false && $this->enablePagination) {
         $this->config["paging"] = true;
         $this->config["pageLength"] = $this->dataProvider->getPagination()->pageSize;
     } else {
         $this->config["paging"] = false;
     }
     $this->config["language"]["info"] = Yii::t('app', "Showing entries {start} to {end} out of {total}", array('{start}' => '_START_', '{end}' => '_END_', '{total}' => '_TOTAL_'));
     $this->config["language"]["emptyTable"] = $this->emptyText;
     $this->config["language"]["infoEmpty"] = Yii::t('datatable', "Showing entries 0 to 0 out of 0");
     $this->config["language"]["infoFiltered"] = Yii::t('datatable', "- filtering from {max} record(s)", array('{max}' => '_MAX_'));
     $this->config["language"]['paginate']['next'] = Yii::t('datatable', 'Next');
     $this->config["language"]['paginate']['previous'] = Yii::t('datatable', 'Previous');
     $this->config["language"]['filter']['none'] = Yii::t('datatable', 'No filter');
     $this->config["ordering"] = $this->enableSorting;
     $this->config["searching"] = !is_null($this->filter);
     $this->config["dom"] = 'lrtip';
     if (!empty($this->pageSizeOptions)) {
         $this->config['lengthMenu'] = true;
         if (key($this->pageSizeOptions) == 0) {
             $this->config['lengthMenu'] = $this->pageSizeOptions;
             $oneDimension = true;
         } else {
             $oneDimension = false;
         }
         $this->config['lengthMenu'][0] = [];
         $this->config['lengthMenu'][1] = [];
         foreach ($this->pageSizeOptions as $key => $value) {
             if ($oneDimension) {
                 $this->config['lengthMenu'][0][] = $value;
             } else {
                 $this->config['lengthMenu'][0][] = $key;
             }
             if ($value == -1) {
                 $this->config['lengthMenu'][1][] = Yii::t('datatable', 'All');
             } else {
                 $this->config['lengthMenu'][1][] = $value;
             }
         }
     } else {
         $this->config['lengthChange'] = false;
     }
     if (isset($this->ajaxUrl)) {
         $this->config['ajax']['url'] = $this->ajaxUrl;
         //                $this->config['processing'] = true;
         $this->config['serverSide'] = true;
         $this->config['deferLoading'] = true;
     }
 }
开发者ID:sam-it,项目名称:yii1-datatables,代码行数:61,代码来源:DataTable.php

示例10: actionIndex

 /**
  * @param string $veranstaltungsreihe_id
  * @param string $veranstaltung_id
  * @param int|null $status
  */
 public function actionIndex($veranstaltungsreihe_id = "", $veranstaltung_id, $status = null)
 {
     $this->loadVeranstaltung($veranstaltungsreihe_id, $veranstaltung_id);
     if (!$this->veranstaltung->isAdminCurUser()) {
         $this->redirect($this->createUrl("/veranstaltung/login", array("back" => yii::app()->getRequest()->requestUri)));
     }
     /** @var Aenderungsantrag[] $aenderungsantraege */
     $aenderungsantraege = Aenderungsantrag::model()->findAll(array("with" => "antrag", "alias" => "a", "condition" => 'antrag.veranstaltung_id=' . IntVal($this->veranstaltung->id) . " AND a.status != " . IAntrag::$STATUS_GELOESCHT . " AND antrag.status != " . IAntrag::$STATUS_GELOESCHT));
     $stati = array();
     $gesamtzahl = 0;
     foreach ($aenderungsantraege as $ae) {
         if ($ae->status == IAntrag::$STATUS_GELOESCHT) {
             continue;
         }
         if (!isset($stati[$ae->status])) {
             $stati[$ae->status] = 0;
         }
         $stati[$ae->status]++;
         $gesamtzahl++;
     }
     if ($status !== null) {
         $aenderungsantraege = Aenderungsantrag::model()->findAll(array("with" => "antrag", "alias" => "a", "condition" => 'antrag.veranstaltung_id=' . IntVal($this->veranstaltung->id) . " AND a.status = " . IntVal($status) . " AND a.status != " . IAntrag::$STATUS_GELOESCHT . " AND antrag.status != " . IAntrag::$STATUS_GELOESCHT));
     }
     $dataProvider = new CActiveDataProvider('Aenderungsantrag', array("data" => $aenderungsantraege));
     $dataProvider->getPagination()->pageSize = 50;
     $this->render('index', array('dataProvider' => $dataProvider, 'anzahl_stati' => $stati, 'anzahl_gesamt' => $gesamtzahl, 'status_curr' => $status));
 }
开发者ID:andi98,项目名称:antragsgruen,代码行数:32,代码来源:AenderungsantraegeController.php

示例11: actionIndex

 public function actionIndex()
 {
     $this->layout = "//layouts/list";
     $dataProvider = new CActiveDataProvider('ActiveRecordLog', array('criteria' => array('order' => 'created_at desc'), 'pagination' => array('pageSize' => Page::SIZE)));
     $this->render('index', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination()));
 }
开发者ID:00606,项目名称:wechat,代码行数:6,代码来源:LogController.php

示例12: actionCreate1

 public function actionCreate1()
 {
     if (isset($_GET['id'])) {
         $dataset_id = $_GET['id'];
     } else {
         Yii::app()->user->setFlash('error', "Can't retrieve the files");
         $this->redirect("/user/view_profile");
     }
     $defaultFileSortColumn = 'dataset.name';
     $defaultFileSortOrder = CSort::SORT_DESC;
     if (isset($_GET['filesort'])) {
         // use new sort and save to cookie
         // check if desc or not
         $order = substr($_GET['filesort'], strlen($_GET['filesort']) - 5, 5);
         $columnName = $defaultFileSortColumn;
         if ($order == '.desc') {
             $columnName = substr($_GET['filesort'], 0, strlen($_GET['filesort']) - 5);
             $order = 1;
         } else {
             $columnName = $_GET['filesort'];
             $order = 0;
         }
         $defaultFileSortColumn = $columnName;
         $defaultFileSortOrder = $order;
         Yii::app()->request->cookies['file_sort_column'] = new CHttpCookie('file_sort_column', $columnName);
         Yii::app()->request->cookies['file_sort_order'] = new CHttpCookie('file_sort_order', $order);
     } else {
         // use old sort if exists
         if (isset(Yii::app()->request->cookies['file_sort_column'])) {
             $cookie = Yii::app()->request->cookies['file_sort_column']->value;
             $defaultFileSortColumn = $cookie;
         }
         if (isset(Yii::app()->request->cookies['file_sort_order'])) {
             $cookie = Yii::app()->request->cookies['file_sort_order']->value;
             $defaultFileSortOrder = $cookie;
         }
     }
     $fsort = new MySort();
     $fsort->attributes = array('*');
     $fsort->attributes[] = "dataset.identifier";
     $fsort->defaultOrder = array($defaultFileSortColumn => $defaultFileSortOrder);
     $fpagination = new CPagination();
     $fpagination->pageVar = 'files_page';
     $files = new CActiveDataProvider('File', array('criteria' => array('condition' => "dataset_id = " . $dataset_id, 'join' => 'JOIN dataset ON dataset.id = t.dataset_id', 'order' => 't.id'), 'sort' => $fsort, 'pagination' => $fpagination));
     $updateAll = 0;
     if (isset($_POST['File'])) {
         if (isset($_POST['files'])) {
             $updateAll = 1;
         }
         $count = count($_POST['File']);
         $page = $_POST['page'];
         $pageCount = $_POST['pageCount'];
         if ($page < $pageCount) {
             $page++;
             $files->getPagination()->setCurrentPage($page);
         }
         for ($i = 0; $i < $count; $i++) {
             if ($updateAll == 0 && !isset($_POST[$i])) {
                 continue;
             }
             $model = $this->loadModel($_POST['File'][$i]['id']);
             //            $model->dataset_id = $dataset_id;
             $model->attributes = $_POST['File'][$i];
             if ($model->date_stamp == "") {
                 $model->date_stamp = NULL;
             }
             if (!$model->save()) {
                 var_dump($_POST['File'][$i]);
             }
         }
         //determine if it want to submit
         //             if (isset($_POST['file'])) {
         //                 $this->redirect("/dataset/submit");
         //             }
     }
     $dataset = Dataset::model()->findByAttributes(array('id' => $dataset_id));
     $samples = $dataset->samples;
     $samples_data = array();
     //add none and All , Multiple
     $samples_data[''] = '';
     $samples_data['none'] = 'none';
     $samples_data['All'] = 'All';
     $samples_data['Multiple'] = 'Multiple';
     foreach ($samples as $sample) {
         $samples_data[$sample->name] = $sample->name;
     }
     $identifier = $dataset->identifier;
     $action = 'create1';
     $this->render($action, array('files' => $files, 'identifier' => $identifier, 'samples_data' => $samples_data, 'model' => $dataset));
 }
开发者ID:jessesiu,项目名称:GigaDBV3,代码行数:90,代码来源:AdminFileController.php

示例13: actionIndex

 public function actionIndex()
 {
     $this->layout = '//layouts/memberList';
     $dataProvider = new CActiveDataProvider('WechatModel', array('criteria' => array('order' => 'created_at desc', 'condition' => 'uid=' . Yii::app()->session['userInfo']['uid']), 'pagination' => array('pageSize' => Page::SIZE)));
     $this->render('index', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination()));
 }
开发者ID:00606,项目名称:wechat,代码行数:6,代码来源:WechatController.php

示例14: actionIndex

 public function actionIndex()
 {
     $dataProvider = new CActiveDataProvider('UserModel', array('criteria' => array('order' => 'uid desc'), 'pagination' => array('pageSize' => Page::SIZE)));
     $this->render('index', array('data' => $dataProvider->getData(), 'pages' => $dataProvider->getPagination()));
 }
开发者ID:00606,项目名称:wechat,代码行数:5,代码来源:UserController.php

示例15: actionTechnique

 /**
  * 技术服务点列表页面
  */
 public function actionTechnique()
 {
     $organID = Yii::app()->user->getOrganID();
     $criteria = new CDbCriteria();
     $criteria->condition = 'OrganID=' . $organID;
     $criteria->order = 'ID DESC';
     $dataProvider = new CActiveDataProvider('MakeTechnique', array('criteria' => $criteria, 'pagination' => array('pageSize' => '10')));
     $pages = $dataProvider->getPagination();
     $this->render('techque', array('pages' => $pages, 'dataProvider' => $dataProvider));
 }
开发者ID:zwq,项目名称:unpei,代码行数:13,代码来源:MakecompanyController.php


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