/**
  * action de création d'un questionnaire.
  * Permet de saisir les éléments de base
  */
 public function actionCreate()
 {
     $model = new Questionnaire();
     $validate = false;
     if (isset($_POST['Questionnaire'])) {
         $model->attributes = $_POST['Questionnaire'];
         $model->creator = ucfirst(Yii::app()->user->getPrenom()) . " " . strtoupper(Yii::app()->user->getNom());
         $model->addQuestionGroup("firstgroup", "Questionnaire principal");
         $countIdForm = $model->getFormsById($model->id);
         $countNameForm = $model->getFormsByName($model->name);
         if (count($countIdForm) > 0) {
             Yii::app()->user->setFlash('error', Yii::t('common', 'idFormExist'));
         } elseif (count($countNameForm) > 0) {
             Yii::app()->user->setFlash('error', Yii::t('common', 'nameFormExist'));
         } else {
             $validate = true;
         }
         if ($validate) {
             if ($model->save()) {
                 Yii::app()->user->setFlash('success', Yii::t('common', 'formSaved'));
                 $this->redirect($this->createUrl('update', array('id' => $model->_id)));
             } else {
                 Yii::app()->user->setFlash('error', Yii::t('common', 'missingFields'));
             }
         }
     }
     $this->render('create', array('model' => $model));
 }