/**
  * 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 $id the ID of the model to be loaded
  * @return SegGuidesdata the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = SegGuidesdata::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Beispiel #2
0
	public function loadGuide()
	{
  		$gdata = SegGuidesdata::model()->findByPk(Yii::app()->user->gid);
		$gcontact= SegContacts::model()->findByPk(Yii::app()->user->cid);
		$city=  SegGuidesCities::model()->with('cities')->find("users_id=:user",array(':user'=>Yii::app()->user->id));
		$tel="";
		if(!($city==null)) $tel=$city->cities->localPhone;
//		if(!($city==null)) $tel=$city;
		if(($gdata===null)||($gcontact===null))
			throw new CHttpException(404,'The requested user data is missing.');
		return array('data'=>$gdata,'contact'=>$gcontact,'tel'=>$tel);
	}