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


PHP CActiveDataProvider::setTotalItemCount方法代码示例

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


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

示例1: actionIndex


//.........这里部分代码省略.........
                     echo $data->isCopyEntrantDoc ? "так" : "ні";
                 });
                 $field_num_index = $to_select ? $field_num_indexes[$i] : 0;
                 $this->ProcessFieldCheckboxOnly($with_rel, $rels, $sel, $widget_columns, $widget_column, $field_num_index, $condition_type, $condition_value, $criteria);
                 ////////////////////////////////////////////
                 break;
             case 28:
                 $rels = array(array('name' => 'entrantdoc', 'select' => true), array('name' => 'entrantdoc.docaward', 'select' => true));
                 $sel = array('to_select' => $to_select, 'db_field_id' => 'entrantdoc.PersonDocumentsAwardsTypesID', 'db_field' => 'docaward.PersonDocumentsAwardsTypesName');
                 $widget_column = array('name' => 'docaward.PersonDocumentsAwardsTypesName', 'header' => $header, 'value' => function ($data) {
                     if (!empty($data->entrantdoc)) {
                         if (!empty($data->entrantdoc->docaward)) {
                             echo $data->entrantdoc->docaward->PersonDocumentsAwardsTypesName;
                         }
                     }
                 });
                 $field_num_index = $to_select ? $field_num_indexes[$i] : 0;
                 $this->ProcessFieldTextAlternative($with_rel, $rels, $select, $sel, $widget_columns, $widget_column, $field_num_index, $condition_type, $condition_value, $alternative_condition_value, $criteria);
                 ////////////////////////////////////////////
                 break;
             case 29:
                 $rels = array();
                 $sel = array('to_select' => $to_select, 'sql_as' => 'ReqCase', 'sql_expr' => "LPAD(t.RequestNumber,5,'0')");
                 $widget_column = array('name' => 'ReqCase', 'header' => $header, 'value' => function ($data) {
                     echo $data->ReqCase;
                 });
                 $field_num_index = $to_select ? $field_num_indexes[$i] : 0;
                 $this->ProcessFieldTextOnly($with_rel, $rels, $select, $sel, $widget_columns, $widget_column, $field_num_index, $condition_type, $condition_value, $criteria);
                 ////////////////////////////////////////////
                 break;
             case 30:
                 $rels = array(array('name' => 'xlang', 'select' => true));
                 $sel = array('to_select' => $to_select, 'db_field_id' => 'LanguageExID', 'db_field' => 'xlang.LanguageExName');
                 $widget_column = array('name' => 'xlang.LanguageExName', 'header' => $header, 'value' => function ($data) {
                     if (!empty($data->person->language)) {
                         echo $data->xlang->LanguageExName;
                     }
                 });
                 $field_num_index = $to_select ? $field_num_indexes[$i] : 0;
                 $this->ProcessFieldTextAlternative($with_rel, $rels, $select, $sel, $widget_columns, $widget_column, $field_num_index, $condition_type, $condition_value, $alternative_condition_value, $criteria);
                 ////////////////////////////////////////////
                 break;
             case 31:
                 $group = 't.idPersonSpeciality';
                 $rels = array(array('name' => 'entrantdoc', 'select' => true), array('name' => 'entrantdoc.docbasespec', 'select' => true));
                 $sel = array('to_select' => $to_select, 'db_field_id' => 'entrantdoc.PersonBaseSpecealityID', 'db_field' => 'docbasespec.PersonBaseSpecialityName');
                 $widget_column = array('name' => 'docbasespec.PersonBaseSpecialityName', 'header' => $header, 'value' => function ($data) {
                     if (!empty($data->entrantdoc)) {
                         if (!empty($data->entrantdoc->docbasespec)) {
                             echo $data->entrantdoc->docbasespec->PersonBaseSpecialityClasifierCode . ' ' . $data->entrantdoc->docbasespec->PersonBaseSpecialityName;
                         }
                     }
                 });
                 $field_num_index = $to_select ? $field_num_indexes[$i] : 0;
                 $this->ProcessFieldTextAlternative($with_rel, $rels, $select, $sel, $widget_columns, $widget_column, $field_num_index, $condition_type, $condition_value, $alternative_condition_value, $criteria);
                 ////////////////////////////////////////////
                 break;
             case 32:
                 $group = 't.idPersonSpeciality';
                 $rels = array();
                 $sel = array('to_select' => $to_select, 'db_field' => 't.CoursedpBall');
                 $widget_column = array('name' => 't.CoursedpBall', 'header' => $header, 'value' => function ($data) {
                     echo $data->CoursedpBall;
                 });
                 $field_num_index = $to_select ? $field_num_indexes[$i] : 0;
                 $this->ProcessFieldTextOnly($with_rel, $rels, $select, $sel, $widget_columns, $widget_column, $field_num_index, $condition_type, $condition_value, $criteria);
                 ////////////////////////////////////////////
                 break;
             case 33:
                 $group = 't.idPersonSpeciality';
                 $rels = array();
                 $sel = array('to_select' => $to_select, 'db_field' => 't.priority');
                 $widget_column = array('name' => 't.priority', 'header' => $header, 'value' => function ($data) {
                     echo $data->priority;
                 });
                 $field_num_index = $to_select ? $field_num_indexes[$i] : 0;
                 $this->ProcessFieldTextOnly($with_rel, $rels, $select, $sel, $widget_columns, $widget_column, $field_num_index, $condition_type, $condition_value, $criteria);
                 ////////////////////////////////////////////
                 break;
         }
     }
     $criteria->select = $select;
     $criteria->with = $with_rel;
     $criteria->group = $group;
     $criteria->together = true;
     $model = new Personspeciality();
     //$criteria->addCondition('KOA=123');
     $dataProvider = new CActiveDataProvider($model, array('criteria' => $criteria, 'sort' => array('defaultOrder' => array('idPersonSpeciality' => CSort::SORT_ASC), 'attributes' => array('NAME' => array('asc' => 'NAME', 'desc' => 'NAME DESC'), 'DIRECTION' => array('asc' => 'sepciality.SpecialityName ASC,sepciality.SpecialityDirectionName ASC,sepciality.SpecialityClasifierCode ASC', 'desc' => 'sepciality.SpecialityName DESC,sepciality.SpecialityDirectionName DESC,sepciality.SpecialityClasifierCode DESC'), 'KOATUU' => array('asc' => 'KOATUU', 'desc' => 'KOATUU DESC'), 'ZNO' => array('asc' => 'ZNO', 'desc' => 'ZNO DESC'), 'BENEFITS' => array('asc' => 'BENEFITS', 'desc' => 'BENEFITS DESC'), 'DOCS' => array('asc' => 'DOCS', 'desc' => 'DOCS DESC'), 'PersonCase' => array('asc' => 'PersonCase', 'desc' => 'PersonCase DESC'), 'status.PersonRequestStatusTypeName' => array('asc' => 'status.PersonRequestStatusTypeName', 'desc' => 'status.PersonRequestStatusTypeName DESC'), 'facultet.FacultetFullName' => array('asc' => 'facultet.FacultetFullName', 'desc' => 'facultet.FacultetFullName DESC'), 'language.LanguagesName' => array('asc' => 'language.LanguagesName', 'desc' => 'language.LanguagesName DESC'), 'person.BirthPlace' => array('asc' => 'person.BirthPlace', 'desc' => 'person.BirthPlace DESC'), 'person.Birthday' => array('asc' => 'person.Birthday', 'desc' => 'person.Birthday DESC'), 'school.SchoolName' => array('asc' => 'school.SchoolName', 'desc' => 'school.SchoolName DESC'), 't.CreateDate' => array('asc' => 't.CreateDate', 'desc' => 't.CreateDate DESC'), 't.priority' => array('asc' => 't.priority', 'desc' => 't.priority DESC'), 't.CoursedpBall' => array('asc' => 't.CoursedpBall', 'desc' => 't.CoursedpBall DESC'), '*')), 'pagination' => array('pageSize' => $reqExcel ? 15000 : 150)));
     $dataProvider->setTotalItemCount(count($model->findAll($criteria)));
     $this->layout = $reqExcel ? '//layouts/clear' : '//layouts/main_noblock';
     $direct_widget_columns = array();
     for ($i = 0; $i < count($field_nums); $i++) {
         foreach ($widget_columns as $key => $value) {
             if ($key == $i) {
                 $direct_widget_columns[] = $value;
             }
         }
     }
     $this->render($reqExcel ? '/statistic/rept_excel' : '/statistic/rept', array('data' => $dataProvider, 'columns' => $direct_widget_columns));
 }
开发者ID:upmunspel,项目名称:abiturient,代码行数:101,代码来源:ReptController.php

示例2: student_details_fees

 public function student_details_fees($id)
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     /************************************Ravi B************************************************/
     $student_trans = StudentTransaction::model()->findByPk($id);
     $fees_master = FeesMaster::model()->findByAttributes(array('fees_academic_term_name_id' => $student_trans->student_academic_term_name_id, 'fees_quota_id' => $student_trans->student_transaction_quota_id, 'fees_branch_id' => $student_trans->student_transaction_branch_id));
     $criteria->condition = 'student_fees_master_student_transaction_id = :student_id AND fees_master_table_id=:fees_master';
     $criteria->params = array(':student_id' => $id, ':fees_master' => $fees_master->fees_master_id);
     /******************************************************************************************/
     $dp = new CActiveDataProvider($this, array('criteria' => $criteria));
     $dp->setTotalItemCount(count($this->findAll($criteria)));
     return $dp;
 }
开发者ID:sharmarakesh,项目名称:edusec-college-management-system,代码行数:15,代码来源:StudentFeesMaster.php

示例3: search

 public function search()
 {
     $pageSize = Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']);
     $sort = new CSort();
     $sort->attributes = array('survey_id' => array('asc' => 't.sid asc', 'desc' => 't.sid desc'), 'title' => array('asc' => 'correct_relation_defaultlanguage.surveyls_title asc', 'desc' => 'correct_relation_defaultlanguage.surveyls_title desc'), 'creation_date' => array('asc' => 't.datecreated asc', 'desc' => 't.datecreated desc'), 'owner' => array('asc' => 'owner.users_name asc', 'desc' => 'owner.users_name desc'), 'anonymized_responses' => array('asc' => 't.anonymized asc', 'desc' => 't.anonymized desc'), 'running' => array('asc' => 't.active asc, t.expires asc', 'desc' => 't.active desc, t.expires desc'));
     $sort->defaultOrder = array('creation_date' => CSort::SORT_DESC);
     $criteria = new LSDbCriteria();
     $aWithRelations = array('correct_relation_defaultlanguage');
     // Search filter
     $sid_reference = Yii::app()->db->getDriverName() == 'pgsql' ? ' t.sid::varchar' : 't.sid';
     $aWithRelations[] = 'owner';
     $criteria->compare($sid_reference, $this->searched_value, true);
     $criteria->compare('t.admin', $this->searched_value, true, 'OR');
     $criteria->compare('owner.users_name', $this->searched_value, true, 'OR');
     $criteria->compare('correct_relation_defaultlanguage.surveyls_title', $this->searched_value, true, 'OR');
     // Active filter
     if (isset($this->active)) {
         if ($this->active == 'N' || $this->active == "Y") {
             $criteria->compare("t.active", $this->active, false);
         } else {
             // Time adjust
             $sNow = date("Y-m-d H:i:s", strtotime(Yii::app()->getConfig('timeadjust'), strtotime(date("Y-m-d H:i:s"))));
             if ($this->active == "E") {
                 $criteria->compare("t.active", 'Y');
                 $criteria->addCondition("t.expires <'{$sNow}'");
             }
             if ($this->active == "S") {
                 $criteria->compare("t.active", 'Y');
                 $criteria->addCondition("t.startdate >'{$sNow}'");
             }
             if ($this->active == "R") {
                 $now = new CDbExpression("NOW()");
                 $criteria->compare("t.active", 'Y');
                 $subCriteria1 = new CDbCriteria();
                 $subCriteria2 = new CDbCriteria();
                 $subCriteria1->addCondition($now . ' > t.startdate', 'OR');
                 $subCriteria2->addCondition($now . ' < t.expires', 'OR');
                 $subCriteria1->addCondition('t.expires IS NULL', "OR");
                 $subCriteria2->addCondition('t.startdate IS NULL', "OR");
                 $criteria->mergeWith($subCriteria1);
                 $criteria->mergeWith($subCriteria2);
             }
         }
     }
     $criteria->with = $aWithRelations;
     // Permission
     // Note: reflect Permission::hasPermission
     if (!Permission::model()->hasGlobalPermission("surveys", 'read')) {
         $criteriaPerm = new CDbCriteria();
         // Multiple ON conditions with string values such as 'survey'
         $criteriaPerm->mergeWith(array('join' => "LEFT JOIN {{permissions}} AS permissions ON (permissions.entity_id = t.sid AND permissions.permission='survey' AND permissions.entity='survey' AND permissions.uid='" . Yii::app()->user->id . "') "));
         $criteriaPerm->compare('t.owner_id', Yii::app()->user->id, false);
         $criteriaPerm->compare('permissions.read_p', '1', false, 'OR');
         $criteria->mergeWith($criteriaPerm, 'AND');
     }
     // $criteria->addCondition("t.blabla == 'blub'");
     $dataProvider = new CActiveDataProvider('Survey', array('sort' => $sort, 'criteria' => $criteria, 'pagination' => array('pageSize' => $pageSize)));
     $dataProvider->setTotalItemCount($this->count($criteria));
     return $dataProvider;
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:60,代码来源:Survey.php


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