Exemplo n.º 1
0
 public function actionRegister()
 {
     $model = new ProAgent('register');
     //		$model = ProAgent::model()->findByPk(1254);	// test
     //		$model->scenario = 'register';
     if (isset($_POST['ProAgent'])) {
         $model->attributes = $_POST['ProAgent'];
         $model->uploadPhoto = CUploadedFile::getInstance($model, 'uploadPhoto');
         $model->uploadNricFront = CUploadedFile::getInstance($model, 'uploadNricFront');
         $model->uploadNricBack = CUploadedFile::getInstance($model, 'uploadNricBack');
         $model->uploadCertification = CUploadedFile::getInstance($model, 'uploadCertification');
         list($model->first_name, $model->last_name) = explode(' ', $model->name_for_slug);
         $model->status = STATUS_INACTIVE;
         $model->role_id = ROLE_AGENT;
         if ($model->save()) {
             $model->saveUploadFiles();
             SendEmail::agentRegistrationToAdmin($model);
             SendEmail::agentRegistrationToUser($model);
             $this->redirect(array('thankyou'));
         }
     }
     Yii::app()->theme = 'onehome';
     $this->layout = '/layouts/onehome/2-col-left';
     $this->render('register', array('model' => $model));
 }