public function run() { $friendrequests = UserFriendRequests::model()->getFriendsRequests($this->user_id); $friendrequests_count = UserFriendRequests::model()->getFriendsRequestsCount($this->user_id); $my_u_id = Yii::app()->user->id; $u_id = $this->user_id; if ($friendrequests_count != null && $friendrequests_count > count($friendrequests_count) && $u_id == $my_u_id) { $this->render('userfriendrequests', array('friendrequests' => $friendrequests, 'friendrequests_count' => $friendrequests_count)); } }
/** * 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 ID of the model to be loaded */ public function loadModel($id) { $model = UserFriendRequests::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }