Пример #1
0
	private function loadModel($id)
	{
		$model=Departure::model()->findByPk($id);
		if($model===null)
			throw new CHttpException(404,'The requested page does not exist.');
		return $model;
	}
Пример #2
0
	protected function getDepartureLocalByPk($pk)
	{
		$temp = Departure::model()->find(array(
				'select'=>'name',
				'condition'=>"$pk",
				));
		
		return $temp->name;
	}
Пример #3
0
	private function getDepartureList()
	{
		$tempArr = array();
		$arr =  Departure::model()->findAll(array(
				'select'=>'id,name',
				));
		foreach($arr as $ar){
			$id = $ar['id'];
			$tempArr[$id] = $ar['name'];
		}
		
		return $tempArr;
	}
Пример #4
0
	public function actionModify($id)
	{
		$model = $this->loadModel($id);
                
                $tips = TravelTips::model()->find(array(
				'condition'=>"tid=$id",
				));
		//查询旅游产品类型
		$typeModel = Traveltype::model()->findAll(array(
				'select'=>'id,name',
				));
		
		//查询出发地
		$departure = Departure::model()->findAll(array(
				'select'=>'id,name',
				));
		
		//查询目的地
		$dests = Destination::model()->findAll(array(
				'select'=>'id,name',
				));
		
		//附加项目模型
		$addModel = new TravelAdditional;
        if(isset($_POST['Travel']))
		{		
			$model->attributes = $_POST['Travel'];
            $model->to_addr = implode(';', $_POST['Travel']['to_addr']);
            $model->updatetime = time();
			if($model->save(false)){
                            Yii::app()->user->setFlash('success', "产品保存成功");
                            //echo $_POST['Travel']['to_addr'];
			}	
		}
		
		$this->render('edit',array(
				'model'=>$model,
                                'tips'=>$tips,
				'typeModel'=>$typeModel,
				'departure'=>$departure,
				'dests'=>$dests,
				'addModel'=>$addModel,
				));
	}