public function actionGetFriendType() { $criteria = new CDbCriteria(); $criteria->condition = "uid=:uid OR uid = 0"; $criteria->params = array(':uid' => Yii::app()->user->id); $models = FriendGroup::model()->findAll($criteria); echo '(' . CJSON::encode($models) . ')'; }
/** * 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 loadFriendGroup($id = null) { if ($this->_model === null) { if ($id !== null || isset($_GET['id'])) { $this->_model = FriendGroup::model()->findbyPk($id !== null ? $id : $_GET['id']); } if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } } return $this->_model; }