Exemplo n.º 1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionValidate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     $model->inactif = 0;
     if ($model->update()) {
         CommonMailer::sendUserRegisterConfirmationMail($model);
         Yii::app()->user->setFlash('success', 'L\'utilisateur n°' . $model->_id . ' (' . $model->prenom . ' ' . $model->nom . ') a bien été validé.');
     } else {
         Yii::app()->user->setFlash('error', 'L\'utilisateur n°' . $model->_id . ' (' . $model->prenom . ' ' . $model->nom . ') n\'a pas pu être validé. Consultez les logs pour plus de détails.');
     }
     $this->redirect(array('admin'));
 }
Exemplo n.º 2
0
 /**
  * action to confirm new profil on mail validation.
  */
 public function actionConfirmUser()
 {
     if (isset($_GET['arg1']) && isset($_GET['arg2'])) {
         $model = User::model()->findByPk(new MongoId($_GET['arg1']));
         if ($model != null) {
             if (!in_array($_GET['arg2'], $model->profil)) {
                 if (!in_array(" ", $model->profil)) {
                     array_push($model->profil, $_GET['arg2']);
                 } else {
                     $model->profil = (array) $_GET['arg2'];
                 }
                 if (isset($_GET['arg2']) && isset($_GET['arg3'])) {
                     if ($_GET['arg2'] == "neuropathologiste") {
                         $model->centre = $_GET['arg3'];
                     }
                 }
                 if ($model->save()) {
                     CommonMailer::sendUserRegisterConfirmationMail($model, NULL);
                     Yii::app()->user->setState('profil', $model->profil);
                     Yii::app()->user->setFlash('success', Yii::t('common', 'profile1') . $_GET['arg2'] . Yii::t('common', 'profile2'));
                 }
             } else {
                 Yii::app()->user->setFlash('error', Yii::t('common', 'profile1') . $_GET['arg2'] . Yii::t('common', 'profile3'));
             }
         } else {
             Yii::app()->user->setFlash('error', Yii::t('common', 'userNotExist'));
         }
     } else {
         Yii::app()->user->setFlash('error', Yii::t('common', 'unvalidLink'));
     }
     $this->redirect(array('site/login'));
 }
Exemplo n.º 3
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionValidate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     $model->statut = "actif";
     if ($model->update()) {
         CommonMailer::sendUserRegisterConfirmationMail($model);
         Yii::app()->user->setFlash('success', Yii::t('common', 'userProfile1bis') . $model->_id . ' (' . $model->prenom . ' ' . $model->nom . ')' . Yii::t('common', 'userProfile5'));
     } else {
         Yii::app()->user->setFlash('error', Yii::t('common', 'userProfile1bis') . $model->_id . ' (' . $model->prenom . ' ' . $model->nom . ')' . Yii::t('common', 'userProfile6'));
     }
     $this->redirect(array('admin'));
 }