/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $this->layout = '//layouts/blank';
     $model = new Channel();
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['Channel'])) {
         $model->attributes = $_POST['Channel'];
         if ($model->save()) {
             echo UtilHelper::formatRightAnswer('频道创建成功');
             die;
             //				$this->redirect(array('view','id'=>$model->id));
         } else {
             echo CHtml::errorSummary($model);
             die;
         }
     }
     $this->render('create', array('model' => $model));
 }
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionProfile()
 {
     $this->layout = '//layouts/profile';
     $id = isset($_GET['uid']) ? $_GET['uid'] : Yii::app()->user->id;
     $model = self::loadProfileModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Profile'])) {
         $model->attributes = $_POST['Profile'];
         //			if($model->save())
         //				$this->redirect(array('view','id'=>$model->id));
         if ($model->save()) {
             echo UtilHelper::formatRightAnswer('个人信息修改成功');
             die;
             //				$this->redirect(array('view','id'=>$model->id));
         } else {
             echo CHtml::errorSummary($model);
             die;
         }
     }
     $this->render('view', array('model' => $model));
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $this->layout = '//layouts/blank';
     $model = new Region();
     //		UtilHelper::dump($_REQUEST);
     // Uncomment the following line if AJAX validation is needed
     //		$this->performAjaxValidation($model);
     if (isset($_POST['Region'])) {
         $model->attributes = $_POST['Region'];
         if (isset($_POST['Region']['manicipal']) && !isset($_POST['Region']['county'])) {
             $model->pid = $_POST['Region']['manicipal'];
         } elseif (isset($_POST['Region']['manicipal']) && isset($_POST['Region']['county']) && $_POST['Region']['areatype'] == Region::COUNTY) {
             $model->pid = $_POST['Region']['manicipal'];
         } elseif (isset($_POST['Region']['manicipal']) && isset($_POST['Region']['county']) && $_POST['Region']['areatype'] == Region::VILLAGE) {
             $model->pid = $_POST['Region']['county'];
         }
         //			UtilHelper::dump($model->attributes);
         //
         //			Yii::app()->end();
         if ($model->save()) {
             echo UtilHelper::formatRightAnswer('地区创建成功');
             die;
             //				$this->redirect(array('view','id'=>$model->id));
         } else {
             echo CHtml::errorSummary($model);
             die;
         }
         //			if($model->save())
         //				$this->redirect(array('info','id'=>$model->id));
     }
     $this->render('create', array('model' => $model));
 }