当前位置: 首页>>代码示例>>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;未经允许,请勿转载。