示例#1
0
             break;
         default:
             $this->redirect(Yii::app()->createAbsoluteUrl('site/login'));
     }
 }
 /**
  * @throws CHttpException
  * <Jason>
  * <*****@*****.**>
  */
 public function actionRegister()
 {
     if (isset(Yii::app()->user->id)) {
         $this->redirect(Yii::app()->createAbsoluteUrl('/'));
     }
     $this->pageTitle = 'Register - ' . Yii::app()->params['title'];
     try {
         //$this->checkValidateIp();
         $model = new Users('register');
         $model->area_code_id = DEFAULT_AREA_CODE;
         // AJAX validation is needed
         if (isset($_POST['ajax']) && $_POST['ajax'] === 'member-form') {
             $model->attributes = $_POST['Users'];
             $this->ajaxValidateRegister($model);
         }
         // AJAX validation is needed
         if (MyFunctionCustom::saveUserRegister($model)) {
             Yii::app()->user->setFlash('success', "Register successful !");
             //              ANH DUNG CLOSE Feb 05, 2015  $this->redirect(Yii::app()->createAbsoluteUrl('page',array('slug'=>'thanks-you')));
             $link_thanks = Yii::app()->createAbsoluteUrl('page/index', array('slug' => Pages::getSlugById(PAGE_REGISTER_THANK_YOU)));
             $this->redirect($link_thanks);
     if (!Yii::app()->request->isPostRequest) {
         return;
     }
     $response['message'] = 'Remove failed. An error has occured.';
     $response['code'] = false;
     try {
         if (ProUserShortList::model()->deleteAll('user_id = ? AND listing_id = ?', array(Yii::app()->user->id, $_POST['listing_id']))) {
             $response['code'] = true;
             $response['message'] = 'Remove successful.';
         }
     } catch (Exception $e) {
         Yii::log("Exception " . print_r($e, true), 'error');
         $response['message'] .= YII_DEBUG ? ' ' . $e->getMessage() : null;
     }
     echo json_encode($response);
     die;
 }
 /**
  * <Jason>
  * <My profile of normal user>