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


PHP Network::model方法代碼示例

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


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

示例1: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the primary key value. Defaults to null, meaning using the 'id' GET variable
  */
 public function loadModel()
 {
     if ($this->_nw === null) {
         if ($id !== isset($_GET['id'])) {
             $this->_nw = Network::model()->findByPk($_GET['id']);
         }
         if ($this->_nw === null || $this->_nw->userId != Yii::app()->user->id) {
             throw new CHttpException(404, 'The requested network does not exist.');
         }
     }
     return $this->_nw;
 }
開發者ID:hit-shappens,項目名稱:testapp,代碼行數:17,代碼來源:NetworkController.php

示例2: authenticate

 public function authenticate($uloginModel = null)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = 'identity=:identity AND network=:network';
     $criteria->params = array(':identity' => $uloginModel->identity, ':network' => $uloginModel->network);
     $userNetwork = Network::model()->find($criteria);
     if (null !== $userNetwork) {
         $user = $userNetwork->user;
         $this->id = $user->id;
         $this->name = $user->email;
     } else {
         $user = new User();
         $user->email = $uloginModel->email;
         $user->firstName = $uloginModel->first_name;
         $user->lastName = $uloginModel->last_name;
         $user->sex = $uloginModel->sex;
         $user->phone = $uloginModel->phone;
         $user->bDate = $this->convertDate($uloginModel->bdate);
         $user->city = $uloginModel->city;
         $user->country = $uloginModel->country;
         $user->ava = $uloginModel->photo;
         $user->ava_full = $uloginModel->photo_big;
         $user->activated = true;
         if (!$user->save()) {
             return false;
         }
         $nw = new Network();
         $nw->identity = $uloginModel->identity;
         $nw->network = $uloginModel->network;
         $nw->userId = $user->id;
         $nw->save();
         $this->id = $user->id;
         $this->name = $user->username;
     }
     $this->isAuthenticated = true;
     return true;
 }
開發者ID:hit-shappens,項目名稱:testapp,代碼行數:37,代碼來源:UloginUserIdentity.php


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