當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserAccess::model方法代碼示例

本文整理匯總了PHP中UserAccess::model方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserAccess::model方法的具體用法?PHP UserAccess::model怎麽用?PHP UserAccess::model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserAccess的用法示例。


在下文中一共展示了UserAccess::model方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: search

 /**
  * Retrieves a list of models based on the current search/filter conditions.
  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
  */
 public function search($access = null)
 {
     // Warning: Please modify the following code to remove attributes that
     // should not be searched.
     $criteria = new CDbCriteria();
     if (!empty($access)) {
         $this->role_id = $access;
     }
     if (!empty($_GET['User']['contragent_id'])) {
         $arrID = array();
         if (is_array($_GET['User']['contragent_id'])) {
             $contragent_id = array();
             foreach ($_GET['User']['contragent_id'] as $value) {
                 $contragent_id[] = $value;
             }
             foreach (UserAccess::model()->findAll('type = 1 AND access_id in (' . implode(",", $contragent_id) . ')') as $data) {
                 $arrID[] = $data->user_id;
             }
         } else {
             foreach (UserAccess::model()->findAll('type = 1 AND access_id in (' . (int) $_GET['User']['contragent_id'] . ')') as $data) {
                 $arrID[] = $data->user_id;
             }
         }
         if (!empty($arrID)) {
             $criteria->condition = 'id in (' . implode(",", $arrID) . ')';
         }
     }
     //compare roles
     //$criteria->with = array('role');
     $criteria->together = true;
     $criteria->compare('id', $this->id, true);
     $criteria->compare('subscribe', $this->subscribe, true);
     $criteria->compare('role_id', $this->role_id, true);
     $criteria->compare('email', $this->email, true);
     $criteria->compare('username', $this->username, true);
     $criteria->compare('score', $this->score);
     $criteria->compare('birthday', strtotime($this['birthday']), true);
     $criteria->compare('created_at', $this->created_at, true);
     $criteria->compare('state', $this->state);
     $criteria->compare('email_group', $this->email_group, true);
     $criteria->compare('organization', $this->organization, true);
     $criteria->compare('ur_addres', $this->ur_addres, true);
     $criteria->compare('fiz_addres', $this->fiz_addres, true);
     $criteria->compare('inn', $this->inn, true);
     $criteria->compare('kpp', $this->kpp, true);
     $criteria->compare('okpo', $this->okpo, true);
     return $criteria;
 }
開發者ID:Diakonrus,項目名稱:fastweb-yii,代碼行數:52,代碼來源:User.php


注:本文中的UserAccess::model方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。