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


PHP User::readFilter方法代码示例

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


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

示例1: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = User::readFilter(Contact_group::find());
     //$query = Yii::$app->user->identity->readFilter(Contact_group::find());
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->nome]);
     return $dataProvider;
 }
开发者ID:antonio74,项目名称:daduu42,代码行数:19,代码来源:Contact_groupSearch.php

示例2: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = User::readFilter(Contact::find()->joinWith('contact_groups'));
     //$query = Yii::$app->user->identity->readFilter(Contact::find()->joinWith('contact_groups'));
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'firstname', $this->firstname])->andFilterWhere(['like', 'lastname', $this->lastname])->andFilterWhere(['like', 'mobile', $this->mobile])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'company', $this->company])->andFilterWhere(['like', 'phone_prefix', $this->phone_prefix])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'mobile_prefix', $this->mobile_prefix])->andFilterWhere(['like', 'general_prefix', $this->general_prefix])->andFilterWhere(['like', 'general', $this->general])->andFilterWhere(['=', 'contact_category_id', $this->contact_category_id]);
     return $dataProvider;
 }
开发者ID:antonio74,项目名称:daduu42,代码行数:19,代码来源:ContactSearch.php

示例3: search

 /**
  * Creates data provider instance with search query applied 
  * and join with category and gruppo tables
  *  
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $expandCategoria = false;
     $expandGruppo = false;
     $query = User::readFilter(Contact::find()->joinWith('contact_groups'));
     // Join per poter filtrare anche attraverso categoria e gruppo
     if (isset($params['expand'])) {
         $expand = array_map('trim', explode(",", $params['expand']));
         foreach ($expand as $value) {
             if ($value == 'contact_category') {
                 $query->joinWith('contact_category');
                 $expandCategoria = true;
             } elseif ($value == 'contact_groups') {
                 $query->joinWith('contact_groups');
                 $expandGruppo = true;
             }
         }
     }
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'lastname', $this->lastname])->andFilterWhere(['like', 'firstname', $this->firstname])->andFilterWhere(['like', 'mobile', $this->mobile])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['=', 'contact_category_id', $this->contact_category_id]);
     // Filtro e ordinamento per categoria e gruppo solo se settato anche il rispettivo valore del parametro expand
     $dataProvider->sort->enableMultiSort = true;
     if (isset($expand)) {
         foreach ($expand as $value) {
             if ($value == 'contact_category') {
                 $query->andFilterWhere(['like', 'contact_category.name', $this->category]);
                 $dataProvider->sort->attributes['category'] = ['asc' => ['contact_category.name' => SORT_ASC], 'desc' => ['contact_category.name' => SORT_DESC]];
             } elseif ($value == 'contact_groups') {
                 $query->andFilterWhere(['like', 'contact_group.name', $this->group]);
                 $dataProvider->sort->attributes['group'] = ['asc' => ['contact_group.name' => SORT_ASC], 'desc' => ['contact_group.name' => SORT_DESC]];
             }
         }
     }
     // Ordinamento con parametro in formato json e controllo sintassi. I parametri non validi vengono ignorati
     /*if(isset($params['sort']) && $params['sort']!=null){
           $sort=$params['sort'];
           $i=0;
           $order='';
           foreach ($sort as $attribute => $orderType) {
               if(($attribute=='categoria' && $expandCategoria==true) || ($attribute=='gruppo' && $expandGruppo==true)){
                   $order=$order . $attribute . '.nome ' . $orderType;
               }
               elseif(in_array($attribute, $this->activeAttributes(), true)==true)
                   $order=$order . $attribute . ' ' . $orderType;
               $i=$i+1;
               if($i<count($sort))
                   $order=$order . ', ';
           }
           //$order="agaga" . implode(', ', Newrubrica::fields());
           $query->orderBy($order);
       }*/
     /*$s=Yii::$app->session;
             //$s->open();
             //$s->set('tenant','1');        
             $t=$s->get('tenant');
             $order="agaga" . implode(', ', $expand);
             $query->orderBy("agaga");
             $dataProvider=parent::search($params);
             $query=$dataProvider->query;
             //$query->andFilterWhere(['like', 'firstname', 'ant']);
             return $dataProvider;
     
             */
     return $dataProvider;
 }
开发者ID:antonio74,项目名称:daduu42,代码行数:77,代码来源:ContactSearchStable.php


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