/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new RegisteredProfiles();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['RegisteredProfiles'])) {
         $model->attributes = $_POST['RegisteredProfiles'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
Exemple #2
0
 public function actionRegisterProfile()
 {
     $model = new RegisteredProfiles('login');
     $sr_model = new ServicesRequested();
     // uncomment the following code to enable ajax-based validation
     /*
             if(isset($_POST['ajax']) && $_POST['ajax']==='registered-profiles-registerProfile-form')
             {
                 echo CActiveForm::validate(array($model, $sr_model));
                 Yii::app()->end();
             }
     */
     if (isset($_POST['RegisteredProfiles'])) {
         $model->attributes = $_POST['RegisteredProfiles'];
         if ($model->validate()) {
             if ($model->save()) {
                 $serviceId = $_POST['ServicesRequested']['serviceId'];
                 $sr_model->attributes = array('profileId' => $model->id, 'serviceId' => $serviceId, 'confirmed' => 0);
                 if ($sr_model->save()) {
                     $this->render('requestSubmitted', array('model' => $model));
                     return;
                 }
             }
         }
     }
     $this->render('index', array('model' => $model, 'sr_model' => $sr_model));
 }