/**
  * @return Questionnaire
  */
 public static function get_all_questionnaires()
 {
     $questionnaires = new Questionnaire();
     $questionnaires->include_related_count('questionnaire_answer');
     $questionnaires->get_iterated();
     return $questionnaires;
 }
 /**
  * Mise  àjour d une fiche
  * @param $id the ID of the model to be displayed
  */
 public function actionUpdate($id)
 {
     $model = Questionnaire::model()->findByPk(new MongoID($id));
     $questionForm = new QuestionForm();
     $questionGroup = new QuestionGroup();
     // collect user input data
     if (isset($_POST['QuestionForm'])) {
         $questionForm->attributes = $_POST['QuestionForm'];
         //traitement ajout de question
         if ($questionForm->validate()) {
             $model = $this->saveQuestionnaireNewQuestion($model, $questionForm);
         }
     }
     if (isset($_POST['QuestionGroup'])) {
         $questionGroup->attributes = $_POST['QuestionGroup'];
         //copie du titre sur l option fr
         $questionGroup->title_fr = $questionGroup->title;
         if ($questionGroup->validate()) {
             $model = $this->saveQuestionnaireNewGroup($model, $questionGroup);
         }
     }
     //set du model sur la questionForm pour generer l arborescende de position de question
     $questionForm->questionnaire = $model;
     $this->render('update', array('model' => $model, 'questionForm' => $questionForm, 'questionGroup' => $questionGroup));
 }
 /**
  * testing method return array type
  */
 public function testTypeFunction()
 {
     $model = new QuestionBlocForm();
     $criteria = new EMongoCriteria();
     $criteria->id = "demenceform";
     $questionnaire = Questionnaire::model()->find($criteria);
     $this->assertInternalType('array', $model->rules());
     $this->assertInternalType('array', $model->attributeLabels());
     $this->assertFalse($model->validatewithId($questionnaire));
 }
 public function run()
 {
     DB::table('Players')->delete();
     DB::table('Questions')->delete();
     DB::table('Questionnaires')->delete();
     DB::table('Answers')->delete();
     DB::table('Level')->delete();
     $eingang = Questionnaire::create(array('name' => 'eingang'));
     $mittel = Questionnaire::create(array('name' => 'mittel'));
     $end = Questionnaire::create(array('name' => 'end'));
     $test = Questionnaire::create(array('name' => 'test'));
     $level = Level::create(array('score' => 1, 'mistakes' => 10, 'hits' => 2, 'info' => 'info'));
     $test1 = Question::create(array('question' => '1', 'questionnaire_id' => $test->id));
     $test2 = Question::create(array('question' => '2', 'questionnaire_id' => $test->id));
     $test3 = Question::create(array('question' => '3', 'questionnaire_id' => $test->id));
     $test4 = Question::create(array('question' => '4', 'questionnaire_id' => $test->id));
     $eingang1 = Question::create(array('question' => 'Ich spiele häufig Computerspiele', 'questionnaire_id' => $eingang->id));
     $eingang1 = Question::create(array('question' => 'Ich kenne die Gestaltgesetze', 'questionnaire_id' => $eingang->id));
     $frage1 = Question::create(array('question' => 'Das Spiel hat mir Spass gemacht', 'questionnaire_id' => $end->id));
     $fam1 = Question::create(array('question' => 'Ich mag solche Rätsel und Knobeleien', 'questionnaire_id' => $end->id));
     $fam15 = Question::create(array('question' => 'Ich glaube, der Schwierigkeit dieses Spiels gewachsen zu sein', 'questionnaire_id' => $end->id));
     $fam16 = Question::create(array('question' => 'Wahrscheinlich werde ich das Spiel nicht schaffen.', 'questionnaire_id' => $end->id));
     $fam1 = Question::create(array('question' => 'Bei dem Spiel mag ich die Rolle des Wissenschaftlers, der Zusammenhänge entdeckt.', 'questionnaire_id' => $end->id));
     $fam2 = Question::create(array('question' => 'Das Spiel ist eine richtige Herausforderung für mich.', 'questionnaire_id' => $end->id));
     $fam3 = Question::create(array('question' => 'Nach dem Lesen der Instruktion erscheint mir das Spiel sehr interessant.', 'questionnaire_id' => $end->id));
     $fam4 = Question::create(array('question' => 'Ich bin sehr gespannt darauf, wie gut ich hier abschneiden werde.', 'questionnaire_id' => $end->id));
     $fam5 = Question::create(array('question' => 'Ich fürchte mich ein wenig davor, dass ich mich hier blamieren könnte', 'questionnaire_id' => $end->id));
     $fam6 = Question::create(array('question' => 'Ich bin fest entschlossen, mich bei diesem Spiel voll anzustrengen.', 'questionnaire_id' => $end->id));
     $fam7 = Question::create(array('question' => 'Bei Spielen wie diesem brauche ich keine Belohnung, sie machen mir auch so viel Spaß. ', 'questionnaire_id' => $end->id));
     $fam8 = Question::create(array('question' => 'Es ist mir etwas peinlich, hier zu versagen.', 'questionnaire_id' => $end->id));
     $fam9 = Question::create(array('question' => 'Ich glaube, dass kann jeder schaffen', 'questionnaire_id' => $end->id));
     $fam10 = Question::create(array('question' => 'Ich glaube, ich schaffe dieses Spiel nicht', 'questionnaire_id' => $end->id));
     $fam11 = Question::create(array('question' => 'Wenn ich das Spiel schaffe, werde ich schon ein wenig stolz auf meine Tüchtigkeit sein.', 'questionnaire_id' => $end->id));
     $fam12 = Question::create(array('question' => 'Wenn ich an das Spiel denke, bin ich etwas beunruhigt.', 'questionnaire_id' => $end->id));
     $fam13 = Question::create(array('question' => 'Eine solches Spiel würde ich auch in meiner Freizeit spielen.', 'questionnaire_id' => $end->id));
     $fam14 = Question::create(array('question' => 'Die konkreten Leistungsanforderungen hier lähmen mich.', 'questionnaire_id' => $end->id));
     $frage1 = Question::create(array('question' => 'Das Spiel hat mir Spass gemacht', 'questionnaire_id' => $mittel->id));
     $fammid1 = Question::create(array('question' => 'Ich mag solche Rätsel und Knobeleien', 'questionnaire_id' => $mittel->id));
     $fammid15 = Question::create(array('question' => 'Ich glaube, der Schwierigkeit dieses Spiels gewachsen zu sein', 'questionnaire_id' => $mittel->id));
     $fammid16 = Question::create(array('question' => 'Wahrscheinlich werde ich das Spiel nicht schaffen.', 'questionnaire_id' => $mittel->id));
     $fammid1 = Question::create(array('question' => 'Bei dem Spiel mag ich die Rolle des Wissenschaftlers, der Zusammenhänge entdeckt.', 'questionnaire_id' => $mittel->id));
     $fammid2 = Question::create(array('question' => 'Das Spiel ist eine richtige Herausforderung für mich.', 'questionnaire_id' => $mittel->id));
     $fammid3 = Question::create(array('question' => 'Nach dem Lesen der Instruktion erscheint mir das Spiel sehr interessant.', 'questionnaire_id' => $mittel->id));
     $fammid4 = Question::create(array('question' => 'Ich bin sehr gespannt darauf, wie gut ich hier abschneiden werde.', 'questionnaire_id' => $mittel->id));
     $fammid5 = Question::create(array('question' => 'Ich fürchte mich ein wenig davor, dass ich mich hier blamieren könnte', 'questionnaire_id' => $mittel->id));
     $fammid6 = Question::create(array('question' => 'Ich bin fest entschlossen, mich bei diesem Spiel voll anzustrengen.', 'questionnaire_id' => $mittel->id));
     $fammid7 = Question::create(array('question' => 'Bei Spielen wie diesem brauche ich keine Belohnung, sie machen mir auch so viel Spaß. ', 'questionnaire_id' => $mittel->id));
     $fammid8 = Question::create(array('question' => 'Es ist mir etwas peinlich, hier zu versagen.', 'questionnaire_id' => $mittel->id));
     $fammid9 = Question::create(array('question' => 'Ich glaube, dass kann jeder schaffen', 'questionnaire_id' => $mittel->id));
     $fammid10 = Question::create(array('question' => 'Ich glaube, ich schaffe dieses Spiel nicht', 'questionnaire_id' => $mittel->id));
     $fammid11 = Question::create(array('question' => 'Wenn ich das Spiel schaffe, werde ich schon ein wenig stolz auf meine Tüchtigkeit sein.', 'questionnaire_id' => $mittel->id));
     $fammid12 = Question::create(array('question' => 'Wenn ich an das Spiel denke, bin ich etwas beunruhigt.', 'questionnaire_id' => $mittel->id));
     $fammid13 = Question::create(array('question' => 'Eine solches Spiel würde ich auch in meiner Freizeit spielen.', 'questionnaire_id' => $mittel->id));
     $fammid14 = Question::create(array('question' => 'Die konkreten Leistungsanforderungen hier lähmen mich.', 'questionnaire_id' => $mittel->id));
 }
 public function run()
 {
     DB::table('Players')->delete();
     DB::table('Questions')->delete();
     DB::table('Questionnaires')->delete();
     DB::table('Answers')->delete();
     $kim = Questionnaire::create(array('name' => 'kim'));
     $frage1 = Question::create(array('question' => 'Das Spiel hat mir Spass gemacht', 'questionnaire_id' => $kim->id));
     $playerJustus = Player::create(array('gender' => 'm', 'age' => '21', 'computer' => '4', 'game' => '3', 'questionnaire_id' => $kim->id));
     $Testfrage = Answer::create(array('answer' => 'Test', 'player_id' => $playerJustus->id, 'question_id' => $frage1->id));
 }
 /**
  * Store a newly created resource in storage.
  *
  * Interviews are submitted as sets of tags and responses to questionnaires.
  *
  * @return Response
  */
 public function store()
 {
     $v = Validator::make(Request::all(), ['type' => 'required|string', 'questionSet' => 'required|string', 'recordedAt' => 'required', 'questions' => 'array', 'taggable' => 'array', 'location' => 'required|string', 'area' => 'required|string', 'houseno' => 'string']);
     if ($v->fails()) {
         return Response::json(['errors' => $v->errors()], 400);
     }
     $Date = Carbon::createFromTimeStamp(Input::get('recordedAt'));
     $interview = Interview::firstOrNew(['date' => $Date, 'interviewer_id' => Auth::user()->id]);
     $Questionnaire = Questionnaire::where('name', '=', Input::get('questionSet'))->first();
     // important to fail here, you shouldn't be able to submit an interview for a questionnaire that doesn't exist
     if (!$Questionnaire) {
         return Response::json(['message' => 'questionnaire "' . Input::get('questionSet') . '" does not exist'], 400);
     }
     $interview->questionnaire_id = $Questionnaire->id;
     $interview->type = Input::get('type');
     // similarly, area has to exist already
     $area = Area::where(['name' => Input::get('area')])->first();
     if (!$area) {
         return Response::json(['message' => 'area "' . Input::get('area') . '" does not exist'], 400);
     }
     // although we can allow for dynamically adding new locations as they come in.
     $location = Location::firstOrCreate(['name' => Input::get('location'), 'area_id' => $area->id]);
     $interview->location_id = $location->id;
     if (Input::has('houseno')) {
         $interview->house_number = Input::get('houseno');
     }
     $interview->save();
     if (Input::has('questions') && $interview->type === 'interview') {
         foreach (Input::get('questions') as $response) {
             InterviewResponse::create(['question' => $response['question'], 'answer' => $response['answer'], 'interview_id' => $interview->id]);
         }
     }
     if (Input::has('taggable') && $interview->type === 'interview') {
         foreach (Input::get('taggable') as $list) {
             if (isset($list['id'])) {
                 $this->saveTagsToQuestionnaire($list);
             }
             $TagList = new TagList();
             $TagList->name = $list['name'];
             $interview->tagLists()->save($TagList);
             foreach ($list['tagged'] as $tag) {
                 $TagList->tags()->save(Tag::create(['name' => $tag, 'tag_list_id' => $TagList->id]));
             }
         }
     }
     $interview->push();
     return Response::json(Interview::with('responses')->find($interview->id), 200);
 }
 /**
  * PUT request, we're using it here to mean 'replace the record with'
  */
 public function update($id)
 {
     $v = Validator::make(Input::all(), ['name' => 'required|string', 'questions' => 'array', 'taggable' => 'array']);
     if ($v->fails()) {
         return Response::json($v->errors(), 400);
     }
     $questionnaire = Questionnaire::find($id);
     if (is_null($questionnaire)) {
         return Response::json(['error' => 'no such questionnaire found'], 404);
     }
     $questionIds = $questionnaire->questions->lists('id');
     Question::destroy($questionIds);
     if (Input::has('questions')) {
         foreach (Input::get('questions') as $question) {
             Question::create(['question' => $question, 'questionnaire_id' => $questionnaire->id]);
         }
     }
     $tagListIds = $questionnaire->tagLists->lists('id');
     $questionnaire->tagLists()->detach($tagListIds);
     if (Input::has('taggable')) {
         foreach (Input::get('taggable') as $tagList) {
             $T = TagList::firstOrNew(['name' => $tagList['name']]);
             $questionnaire->tagLists()->save($T);
             if (!$T->exists) {
                 // it's a new one!
                 $T->save();
             }
         }
     }
     $questionnaire->name = Input::get('name');
     $questionnaire->touch();
     $questionnaire->push();
     // if these are modified they won't be shown...
     $questionnaire->load('tagLists', 'tagLists.tags', 'questions');
     return Response::json($this->reformatTagsAndQuestions($questionnaire), 200);
 }
Example #8
0
 /**
  * @return Questionnaire
  */
 protected function get_questionnaires()
 {
     $person = new Person();
     $person->get_by_id(auth_get_id());
     $questionnaire_answers = new Questionnaire_answer();
     $questionnaire_answers->select_func('MAX', '@answer_number', 'max_answer');
     $questionnaire_answers->group_by('person_id');
     $questionnaire_answers->where_related($person);
     $questionnaire_answers->where_related_questionnaire('id', '${parent}.id');
     $questonnaires = new Questionnaire();
     $questonnaires->select('*');
     $questonnaires->select_subquery($questionnaire_answers, 'max_answer_number');
     $questonnaires->where('published', 1);
     $questonnaires->get_iterated();
     return $questonnaires;
 }
Example #9
0
 public function init()
 {
     parent::init();
     $app = Yii::app();
     if (isset($_GET['lang'])) {
         $app->language = $_GET['lang'];
         $app->session['_lang'] = $app->language;
     } elseif (isset($app->session['_lang'])) {
         $app->language = $app->session['_lang'];
     }
     if (isset($_GET['id']) && Yii::app()->controller->id == "questionnaire") {
         $criteria = new EMongoCriteria();
         $ficheQuestion = Questionnaire::model()->findByPk(new MongoId($_GET['id']));
         $_SESSION['idQuestion'] = $ficheQuestion;
         if (isset($_SESSION['activeProfil'])) {
             if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "questionnaire/update") {
                 if ($_SESSION['idQuestion']->type == "clinique") {
                     if (!Yii::app()->user->isAuthorizedCreate($_SESSION['activeProfil'], "clinique")) {
                         Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowCreateClinicalPatientForm'));
                         $this->redirect(array('answer/affichepatient'));
                     }
                 }
                 if ($_SESSION['idQuestion']->type == "genetique") {
                     if (!Yii::app()->user->isAuthorizedCreate($_SESSION['activeProfil'], "genetique")) {
                         Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowCreateGeneticPatientForm'));
                         $this->redirect(array('answer/affichepatient'));
                     }
                 }
                 if ($_SESSION['idQuestion']->type == "neuropathologique") {
                     if (!Yii::app()->user->isAuthorizedCreate($_SESSION['activeProfil'], "neuropathologique")) {
                         Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowCreateNeuropathologicalPatientForm'));
                         $this->redirect(array('answer/affichepatient'));
                     }
                 }
             }
         }
     }
     if (isset($_GET['id']) && Yii::app()->controller->id == "answer") {
         $criteria = new EMongoCriteria();
         $fiche = Answer::model()->findByPk(new MongoId($_GET['id']));
         $_SESSION['id'] = $fiche;
         if (isset($_SESSION['activeProfil'])) {
             if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/view" || Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/update") {
                 if ($_SESSION['id']->type == "clinique") {
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/view") {
                         if (!Yii::app()->user->isAuthorizedView($_SESSION['activeProfil'], "clinique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowViewClinicalPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         } elseif ($_SESSION['activeProfil'] == "clinicien" && Yii::app()->user->id != $_SESSION['id']->login) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowViewSelfClinicalPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         }
                     }
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/update") {
                         if (!Yii::app()->user->isAuthorizedUpdate($_SESSION['activeProfil'], "clinique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowUpdateClinicalPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         }
                     }
                 }
                 if ($_SESSION['id']->type == "neuropathologique") {
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/view") {
                         if (!Yii::app()->user->isAuthorizedView($_SESSION['activeProfil'], "neuropathologique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowViewNeuropathologicalPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         }
                     }
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/update") {
                         if (!Yii::app()->user->isAuthorizedUpdate($_SESSION['activeProfil'], "neuropathologique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowUpdateNeuropathologicalPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         }
                     }
                 }
                 if ($_SESSION['id']->type == "genetique") {
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/view") {
                         if (!Yii::app()->user->isAuthorizedView($_SESSION['activeProfil'], "genetique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowViewGeneticPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         }
                     }
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/update") {
                         if (!Yii::app()->user->isAuthorizedUpdate($_SESSION['activeProfil'], "genetique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowUpdateGeneticPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         }
                     }
                 }
             }
         }
     }
     if (isset($_POST['activeProfil'])) {
         if ($_POST['activeProfil'] === "newProfil") {
             $this->redirect('index.php?r=site/updatesubscribe');
         } else {
             $app->user->setState('activeProfil', $_POST['activeProfil']);
             $_SESSION['activeProfil'] = $_POST['activeProfil'];
             if (Yii::app()->controller->id == "rechercheFiche" && Yii::app()->user->getActiveProfil() == "clinicien") {
                 Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowSearchPatientForm'));
                 $this->redirect('index.php?r=site/index');
             }
             if (Yii::app()->controller->id == "user" || Yii::app()->controller->id == "formulaire" || Yii::app()->controller->id == "fiche" || Yii::app()->controller->id == "questionBloc" || Yii::app()->controller->id == "administration" || Yii::app()->controller->id == "auditTrail" || Yii::app()->urlManager->parseUrl(Yii::app()->request) == "admin/admin") {
                 if (Yii::app()->user->getActiveProfil() != "administrateur") {
                     Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowManagement'));
                     $this->redirect('index.php?r=site/index');
                 }
             }
             if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/view" || Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/update") {
                 if ($_SESSION['id']->type == "clinique") {
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/view") {
                         if (!Yii::app()->user->isAuthorizedView($_SESSION['activeProfil'], "clinique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowViewClinicalPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         } elseif ($_SESSION['activeProfil'] == "clinicien" && Yii::app()->user->id != $_SESSION['id']->login) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowViewSelfClinicalPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         }
                         $this->redirect('index.php?r=answer/view&id=' . $_SESSION['id']->_id);
                     }
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/update") {
                         if (!Yii::app()->user->isAuthorizedUpdate($_SESSION['activeProfil'], "clinique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowUpdateClinicalPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         } else {
                             $this->redirect('index.php?r=answer/update&id=' . $_SESSION['id']->_id);
                         }
                     }
                 }
                 if ($_SESSION['id']->type == "neuropathologique") {
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/view") {
                         if (!Yii::app()->user->isAuthorizedView($_SESSION['activeProfil'], "neuropathologique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowViewNeuropathologicalPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         } else {
                             $this->redirect('index.php?r=answer/view&id=' . $_SESSION['id']->_id);
                         }
                     }
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/update") {
                         if (!Yii::app()->user->isAuthorizedUpdate($_SESSION['activeProfil'], "neuropathologique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowUpdateNeuropathologicalPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         } else {
                             $this->redirect('index.php?r=answer/update&id=' . $_SESSION['id']->_id);
                         }
                     }
                 }
                 if ($_SESSION['id']->type == "genetique") {
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/view") {
                         if (!Yii::app()->user->isAuthorizedView($_SESSION['activeProfil'], "genetique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowViewGeneticPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         } else {
                             $this->redirect('index.php?r=answer/view&id=' . $_SESSION['id']->_id);
                         }
                     }
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "answer/update") {
                         if (!Yii::app()->user->isAuthorizedUpdate($_SESSION['activeProfil'], "genetique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowUpdateGeneticPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         } else {
                             $this->redirect('index.php?r=answer/update&id=' . $_SESSION['id']->_id);
                         }
                     }
                 }
             }
             if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "questionnaire/update") {
                 if ($_SESSION['idQuestion']->type == "clinique") {
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "questionnaire/update") {
                         if (!Yii::app()->user->isAuthorizedCreate($_SESSION['activeProfil'], "clinique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowCreateClinicalPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         } else {
                             $this->redirect('index.php?r=questionnaire/update&id=' . $_SESSION['idQuestion']->_id);
                         }
                     }
                 }
                 if ($_SESSION['idQuestion']->type == "neuropathologique") {
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "questionnaire/update") {
                         if (!Yii::app()->user->isAuthorizedCreate($_SESSION['activeProfil'], "neuropathologique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowCreateNeuropathologicalPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         } else {
                             $this->redirect('index.php?r=questionnaire/update&id=' . $_SESSION['idQuestion']->_id);
                         }
                     }
                 }
                 if ($_SESSION['idQuestion']->type == "genetique") {
                     if (Yii::app()->urlManager->parseUrl(Yii::app()->request) == "questionnaire/update") {
                         if (!Yii::app()->user->isAuthorizedCreate($_SESSION['activeProfil'], "genetique")) {
                             Yii::app()->user->setFlash(TbAlert::TYPE_ERROR, Yii::t('common', 'notAllowCreateGeneticPatientForm'));
                             $this->redirect(array('answer/affichepatient'));
                         } else {
                             $this->redirect('index.php?r=questionnaire/update&id=' . $_SESSION['idQuestion']->_id);
                         }
                     }
                 }
             }
         }
     }
 }
Example #10
0
 public function careerPortalQuestionnairePreview()
 {
     if ($this->_realAccessLevel < ACCESS_LEVEL_DEMO) {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this);
     }
     if (!isset($_GET['questionnaireID'])) {
         CommonErrors::fatal(COMMONERROR_BADINDEX);
     }
     $questionnaireID = intval($_GET['questionnaireID']);
     $questionnaire = new Questionnaire($this->_siteID);
     $data = $questionnaire->get($questionnaireID);
     if (empty($data)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX);
     }
     $questions = $questionnaire->getQuestions($questionnaireID);
     $this->_template->assign('active', $this);
     $this->_template->assign('subActive', 'Administration');
     $this->_template->assign('isModal', false);
     $this->_template->assign('questionnaireID', $questionnaireID);
     $this->_template->assign('data', $data);
     $this->_template->assign('questions', $questions);
     $this->_template->display('./modules/settings/CareerPortalQuestionnaireShow.tpl');
 }
Example #11
0
 /**
  * Creates Indicate2 questionnaire and returns Indicate2 questionnaire ID
  *
  * @param int 	$questionnaireId 	Questionnaire ID (from Tuevalon2) 
  * @param array 	$teacherArray		Array of teacher ID's (intern)
  * @param string	$title				Title of Indicate2 questionnaire
  * @param int	$blockId			ID of block
  *
  * @return int Indicate2 questionnaire ID
  * 
  * @throws Indicate2_Exception
  */
 public function createIndicate2Questionnaire($questionnaireId, $teacherArray, $title, $blockId)
 {
     try {
         if (empty($this->_client)) {
             $this->connect();
         }
         $questionnairePrefix = getQuestionnairePrefix();
         $questionnaireModel = new Questionnaire();
         if (!($questionnaireData = $questionnaireModel->getData($questionnaireId))) {
             throw new Indicate2_Exception('Keine Daten für Fragebogen vorhanden');
         }
         // create request
         $createQuestionnaireRequest = array('CreateQuestionnaireRequest' => array('Questionnaire' => array('Name' => $title, 'QuestionnaireQuestionContexts' => array('QuestionnaireQuestionContext' => $this->createQuestionnaireQuestionContexts($questionnaireId, $teacherArray, $blockId)))));
         //Zend_Debug::dump($createQuestionnaireRequest);exit();
         // call create public function
         $response = $this->_client->__soapCall('CreateQuestionnaire', $createQuestionnaireRequest);
         return $response->QuestionnaireId;
     } catch (Exception $e) {
         throw new Indicate2_Exception($e->getMessage());
     }
 }
Example #12
0
<?php

if (!empty($_POST)) {
    $question = new Questionnaire();
    $question->insert($_POST);
    if ($result) {
        switch ($result) {
            case 'ERROR_IP':
                $message = "\n\t\t\t\t\t<div class=\"alert alert-danger\">\n\t\t     \t\t\tVotre IP existe déjà.\n\t\t    \t\t</div>";
                break;
            case 'GOOD':
                $message = "\n\t\t\t\t\t<div class=\"alert alert-success\">\n\t\t     \t\t\tVotre réponse vient d'être ajouté dans notre base de donnée ! Merci beaucoup.\n\t\t    \t\t</div>";
        }
    }
}
?>
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
	<h1>Dieudonné</h1>
	<p>Dieudonné M'bala M'bala, dit Dieudonné, est un humoriste, acteur et militant politique français né le 11 février 1966 à Fontenay-aux-Roses.</p>
	<p><a href="http://fr.wikipedia.org/wiki/Dieudonn%C3%A9" class="btn btn-primary btn-lg" role="button">Wikipédia &raquo;</a></p>
</div>

<div class="panel panel-danger">
  <div class="panel-heading">
    <h3 class="panel-title">Erreurs</h3>
  </div>
  <div class="panel-body">
  </div>
</div>
Example #13
0
//============================================================================================
// Session, configuration file, localization constructor
//============================================================================================
require '../includes/php/bootstrap.php';
$SESSION = new \Zend_Session_Namespace('internal', true);
if (!isset($SESSION->lang)) {
    $SESSION->lang = DEFAULT_LANGUAGE;
}
\Locale::setDefault($SESSION->lang);
$l10n->setLanguage($SESSION->lang);
//============================================================================================
// Model
//============================================================================================
$profile = new Profile($dbo);
$question = new Questionnaire($dbo);
if (isset($_GET['student_num']) && ctype_digit($_GET['student_num'])) {
    $studentProfile = $profile->getProfile($_GET['student_num']);
}
//============================================================================================
// Load the content
//============================================================================================
if (!isset($_GET['page'])) {
    $render = true;
    $thisPage = 'question';
    if (!empty($studentProfile)) {
        $data = $question->listQuestionnaire($_GET['student_num']);
        $l10n->addResource(__DIR__ . '/l10n/questionnaire.json');
        $viewFile = 'views/questionnaire.php';
    }
} elseif ($_GET['page'] === "view-answers") {
?>

<?php 
if (Yii::app()->user->getState('activeProfil') != "chercheur" && Yii::app()->user->getState('activeProfil') != "administrateur") {
    $form = $this->beginWidget('CActiveForm', array('action' => Yii::app()->createUrl('questionnaire/index'), 'enableAjaxValidation' => false));
    ?>

    <div class="row" id="liste_fiche">
        <div class="span3">
            <p><?php 
    echo Yii::t('common', 'insertPatientForm');
    ?>
 : </p>
        </div>
        <div class="span3" style="margin:-5px;">
            <?php 
    echo CHtml::dropDownList('form', '', Questionnaire::model()->getFiche(Yii::app()->user->getActiveProfil(), $neuropath, $genetique), array('prompt' => '---' . Yii::t('common', 'choosePatientForm') . '---'));
    ?>
        </div>

        <div class="span3" style="margin:-5px;">
            <?php 
    echo CHtml::submitButton(Yii::t('common', 'insert'), array('class' => 'btn btn-default'));
    ?>
        </div>
        <?php 
    $this->endWidget();
    ?>
    </div>
    <?php 
}
Example #15
0
?>

    <p class="note"><?php 
echo Yii::t('common', 'requiredField');
?>
</p>

    <?php 
echo $form->errorSummary($model, null, null, array('class' => 'alert alert-error'));
?>
    <div class="row">
        <?php 
echo $form->labelEx($model, 'type');
?>
        <?php 
echo $form->dropDownList($model, 'type', Questionnaire::model()->getArrayTypeSorted(), array('prompt' => '---' . Yii::t('common', 'formType') . '---'));
?>
        <?php 
echo $form->error($model, 'type');
?>
    </div>
    <div class="row">
        <p><?php 
echo Yii::t('common', 'uniqueIdForm');
?>
</p>
        <?php 
echo $form->labelEx($model, 'id');
?>
        <?php 
echo $form->textField($model, 'id', array('size' => 5, 'maxlength' => 45));
 function up()
 {
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `questionnaires` (\n                `questionnaire_id` varchar(32) NOT NULL,\n                `title` varchar(128)  NOT NULL,\n                `description` text NULL,\n                `user_id` varchar(32)  NOT NULL,\n                `startdate` BIGINT(20) NULL,\n                `stopdate` BIGINT(20) NULL,\n                `visible` TINYINT(1) DEFAULT '0' NOT NULL,\n                `anonymous` TINYINT(1) DEFAULT '0' NOT NULL,\n                `resultvisibility` ENUM('always', 'never', 'afterending') DEFAULT 'always' NOT NULL,\n                `editanswers` TINYINT(1) DEFAULT '1' NOT NULL,\n                `chdate` bigint(20) NOT NULL,\n                `mkdate` bigint(20) NOT NULL,\n                PRIMARY KEY (`questionnaire_id`),\n                KEY `user_id` (`user_id`)\n            )\n        ");
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `questionnaire_questions` (\n                `question_id` varchar(32) NOT NULL,\n                `questionnaire_id` varchar(32) NOT NULL,\n                `questiontype` varchar(64) NOT NULL,\n                `questiondata` text NOT NULL,\n                `position` INT NOT NULL,\n                `chdate` bigint(20) NOT NULL,\n                `mkdate` bigint(20) NOT NULL,\n                PRIMARY KEY (`question_id`),\n                KEY `questionnaire_id` (`questionnaire_id`)\n            )\n        ");
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `questionnaire_assignments` (\n                `assignment_id` varchar(32) NOT NULL,\n                `questionnaire_id` varchar(32) NOT NULL,\n                `range_id` varchar(32) NOT NULL,\n                `range_type` varchar(64) NOT NULL,\n                `user_id` varchar(32) NOT NULL,\n                `chdate` bigint(20) NOT NULL,\n                `mkdate` int(11) NOT NULL,\n                PRIMARY KEY (`assignment_id`),\n                KEY `questionnaire_id` (`questionnaire_id`),\n                KEY `range_id_range_type` (`range_id`,`range_type`),\n                KEY `user_id` (`user_id`)\n            )\n        ");
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `questionnaire_answers` (\n                `answer_id` varchar(32) NOT NULL,\n                `question_id` varchar(32)  NOT NULL,\n                `user_id` varchar(32) NULL,\n                `answerdata` text NOT NULL,\n                `chdate` bigint(20) NOT NULL,\n                `mkdate` bigint(20) NOT NULL,\n                PRIMARY KEY (`answer_id`),\n                KEY `question_id` (`question_id`),\n                KEY `user_id` (`user_id`)\n            )\n        ");
     DBManager::get()->exec("\n            CREATE TABLE IF NOT EXISTS `questionnaire_anonymous_answers` (\n                `anonymous_answer_id` varchar(32) NOT NULL,\n                `questionnaire_id` varchar(32) NOT NULL,\n                `user_id` varchar(32) NOT NULL,\n                `chdate` bigint(20) NOT NULL,\n                `mkdate` int(11) NOT NULL,\n                PRIMARY KEY (`anonymous_answer_id`),\n                KEY `questionnaire_id` (`questionnaire_id`),\n                UNIQUE KEY `questionnaire_id_user_id` (`questionnaire_id`,`user_id`),\n                KEY `user_id` (`user_id`)\n            )\n        ");
     //now import old data into new tables:
     $resultvisibility_mapping = array('ever' => 'always', 'delivery' => 'always', 'end' => 'afterending', 'never' => 'never');
     $all_votes = DBManager::get()->prepare("\n            SELECT * FROM vote\n        ");
     $all_votes->execute();
     while ($vote = $all_votes->fetch(PDO::FETCH_ASSOC)) {
         //Fragebogen erstellen
         $questionnaire = new Questionnaire($vote['vote_id']);
         $questionnaire['title'] = $vote['title'];
         $questionnaire->setId($vote['vote_id']);
         $questionnaire['user_id'] = $vote['author_id'];
         $questionnaire['startdate'] = $vote['startdate'];
         $questionnaire['stopdate'] = $vote['stopdate'] ?: (in_array($vote['state'], array("stopvis", "stopinvis")) ? time() : null);
         $questionnaire['visible'] = in_array($vote['state'], array("active", "stopvis")) ? 1 : 0;
         // stopvis new active stopinvis
         $questionnaire['anonymous'] = $vote['anonymous'];
         $questionnaire['resultvisibility'] = $resultvisibility_mapping[$vote['resultvisibility']];
         $questionnaire['editanswers'] = $vote['changeable'];
         $questionnaire['chdate'] = $vote['chdate'];
         $questionnaire['mkdate'] = $vote['mkdate'];
         $questionnaire->store();
         //Tests und Umfragen anlegen
         if ($vote['type'] === "vote") {
             $question = new Vote();
             $question['questiontype'] = "Vote";
         } else {
             $question = new Test();
             $question['questiontype'] = "Test";
         }
         $questiondata = array();
         $question['questionnaire_id'] = $questionnaire->getId();
         $question['chdate'] = $vote['chdate'];
         $question['mkdate'] = $vote['mkdate'];
         $questiondata['multiplechoice'] = $vote['multiplechoice'];
         $questiondata['question'] = $vote['question'];
         $question['position'] = 1;
         //Antwortmöglichkeiten vorsehen:
         $options_statement = DBManager::get()->prepare("\n                SELECT *\n                FROM voteanswers\n                WHERE vote_id = ?\n                ORDER BY position ASC\n            ");
         $options_statement->execute(array($vote['vote_id']));
         $options = $options_statement->fetchAll(PDO::FETCH_ASSOC);
         $mapping = array();
         $counter = array();
         foreach ($options as $key => $option) {
             $questiondata['options'][] = $option['answer'];
             $mapping[$option['answer_id']] = $key + 1;
             $counter[$option['answer_id']] = $option['counter'];
             if ($vote['type'] === "test" && $option['correct']) {
                 $questiondata['correctanswer'][] = $key + 1;
             }
         }
         $question['questiondata'] = $questiondata;
         $question->store();
         //Bestehende Antworten migrieren
         if ($questionnaire['anonymous']) {
             foreach ($counter as $answer_id => $count) {
                 for ($i = 0; $i < $count; $i++) {
                     $answer = new QuestionnaireAnswer();
                     $answer['user_id'] = null;
                     $answer['chdate'] = 1;
                     //damit man nicht aus dem chdate auf die user_id schließen kann
                     $answer['mkdate'] = 1;
                     //mkdate genauso
                     $answer['question_id'] = $question->getId();
                     $answerdata = array();
                     $answers = array($answer_id);
                     foreach ($answers as $key => $answer_data) {
                         $answers[$key] = $mapping[$answer_data];
                     }
                     sort($answers);
                     $answerdata['answers'] = $answers;
                     if (!$questiondata['multiplechoice']) {
                         $answerdata['answers'] = $answerdata['answers'][0];
                     }
                     $answer['answerdata'] = $answerdata;
                     $answer->store();
                 }
             }
             $statement = DBManager::get()->prepare("\n                    SELECT *\n                    FROM vote_user\n                    WHERE vote_id = :vote_id\n                ");
             $statement->execute(array('vote_id' => $vote['vote_id']));
             foreach ($statement->fetchAll(PDO::FETCH_ASSOC) as $anonymous_vote) {
                 $anonymous_answer = new QuestionnaireAnonymousAnswer();
                 $anonymous_answer['questionnaire_id'] = $questionnaire->getId();
                 $anonymous_answer['user_id'] = $anonymous_vote['user_id'];
                 $anonymous_answer['chdate'] = $anonymous_vote['votedate'];
                 $anonymous_answer['mkdate'] = $anonymous_vote['votedate'];
                 $anonymous_answer->store();
             }
         } else {
             $statement = DBManager::get()->prepare("\n                    SELECT GROUP_CONCAT(answer_id SEPARATOR ' ') AS answers, user_id, MAX(votedate) AS votedate\n                    FROM voteanswers_user\n                    WHERE answer_id IN (?)\n                    GROUP BY user_id\n                ");
             $statement->execute(array(array_keys($mapping)));
             foreach ($statement->fetchAll(PDO::FETCH_ASSOC) as $answer_data) {
                 $answer = new QuestionnaireAnswer();
                 $answer['user_id'] = $answer_data['user_id'];
                 $answer['chdate'] = $answer_data['votedate'];
                 $answer['mkdate'] = $answer_data['votedate'];
                 $answer['question_id'] = $question->getId();
                 $answerdata = array();
                 $answers = explode(" ", $answer_data['answers']);
                 foreach ($answers as $key => $answer_data) {
                     $answers[$key] = $mapping[$answer_data];
                 }
                 sort($answers);
                 $answerdata['answers'] = $answers;
                 if (!$questiondata['multiplechoice']) {
                     $answerdata['answers'] = $answerdata['answers'][0];
                 }
                 $answer['answerdata'] = $answerdata;
                 $answer->store();
             }
         }
         //Und noch einhängen das ganze:
         $binding = new QuestionnaireAssignment();
         $binding['questionnaire_id'] = $questionnaire->getId();
         $binding['range_id'] = $vote['range_id'] !== "studip" ? $vote['range_id'] : "start";
         $binding['range_type'] = $vote['range_id'] === "studip" ? "static" : ($vote['range_id'] === $vote['author_id'] ? "user" : (Institute::find($vote['range_id']) ? "institute" : "course"));
         $binding['user_id'] = $vote['author_id'];
         $binding['chdate'] = $questionnaire['chdate'];
         $binding['mkdate'] = $questionnaire['mkdate'];
         $binding->store();
     }
     //and finally clean up:
     //DBManager::get()->exec("DROP TABLE IF EXISTS `vote`");
     //DBManager::get()->exec("DROP TABLE IF EXISTS `voteanswers`");
     //DBManager::get()->exec("DROP TABLE IF EXISTS `voteanswers_user`");
     //DBManager::get()->exec("DROP TABLE IF EXISTS `vote_user`");
 }
Example #17
0
 public function widget_action($range_id, $range_type = "course")
 {
     if (get_class($this->parent_controller) === __CLASS__) {
         throw new RuntimeException('widget_action must be relayed');
     }
     $this->range_id = $range_id;
     $this->range_type = $range_type;
     if (in_array($this->range_id, array("public", "start"))) {
         $this->range_type = "static";
     }
     $statement = DBManager::get()->prepare("\n            SELECT questionnaires.*\n            FROM questionnaires\n                INNER JOIN questionnaire_assignments ON (questionnaires.questionnaire_id = questionnaire_assignments.questionnaire_id)\n            WHERE questionnaire_assignments.range_id = :range_id\n                AND questionnaire_assignments.range_type = :range_type\n                " . (Request::get("questionnaire_showall") ? "AND startdate <= UNIX_TIMESTAMP()" : "AND visible = 1") . "\n            ORDER BY questionnaires.mkdate DESC\n        ");
     $statement->execute(array('range_id' => $this->range_id, 'range_type' => $this->range_type));
     $this->questionnaires = array();
     foreach ($statement->fetchAll(PDO::FETCH_ASSOC) as $questionnaire_data) {
         $this->questionnaires[] = Questionnaire::buildExisting($questionnaire_data);
     }
     foreach ($this->questionnaires as $questionnaire) {
         if (!$questionnaire['visible'] && $questionnaire['startdate'] && $questionnaire['startdate'] <= time()) {
             $questionnaire->start();
         }
         if ($questionnaire['visible'] && $questionnaire['stopdate'] && $questionnaire['stopdate'] <= time()) {
             $questionnaire->stop();
         }
     }
 }
Example #18
0
namespace Ventus\Survey;

//============================================================================================
// Session, configuration file, localization constructor
//============================================================================================
require '../includes/php/bootstrap.php';
$SESSION = new \Zend_Session_Namespace('survey', true);
if (\Ventus\Utilities\I18n\Translate::isAllowedLanguage($SESSION->corr_lang)) {
    $l10n->setLanguage($SESSION->corr_lang);
    \Locale::setDefault($SESSION->corr_lang);
}
//============================================================================================
// Model and Header and L10N Includes, Authentication
//============================================================================================
$model = new Questionnaire($dbo);
require FS_INCLUDES . '/l10n/header-external.php';
//============================================================================================
// Load the content
//============================================================================================
if (!isset($_GET['user']) || !$model->checkUserExists($_GET['user'])) {
    $l10n->addResource(__DIR__ . '/l10n/error.json');
    require_once FS_PHP . '/header-external.php';
    require_once 'views/error.php';
    require_once FS_PHP . '/footer-external.php';
} else {
    $user = $_GET['user'];
    $student = $model->fetchStudentByHashCode($user);
    $session = \Ventus\Utilities\Functions::fetchSemester($student['0']['survey_sent_on']);
    if ($model->checkSessionExpire($student['0']['survey_sent_on'])) {
        if ($model->checkOtherSurvey($_GET['user'])) {
 public function _validate_configuration($string)
 {
     $error = '';
     if (!Questionnaire::is_configuration_valid($string, $error)) {
         $this->form_validation->set_message('_validate_configuration', $error);
         return false;
     }
     return true;
 }
Example #20
0
 private function addCandidateModal($contents = '', $fields = array())
 {
     /* Bail out if we don't have a valid job order ID. */
     if (!$this->isRequiredIDValid('jobOrderID', $_GET)) {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid job order ID.');
     }
     $jobOrderID = $_GET['jobOrderID'];
     $candidates = new Candidates($this->_siteID);
     /* Get possible sources. */
     $sourcesRS = $candidates->getPossibleSources();
     $sourcesString = ListEditor::getStringFromList($sourcesRS, 'name');
     /* Get extra fields. */
     $extraFieldRS = $candidates->extraFields->getValuesForAdd();
     $associatedAttachment = 0;
     $associatedAttachmentRS = array();
     $EEOSettings = new EEOSettings($this->_siteID);
     $EEOSettingsRS = $EEOSettings->getAll();
     if (is_array($parsingStatus = LicenseUtility::getParsingStatus()) && isset($parsingStatus['parseLimit'])) {
         $parsingStatus['parseLimit'] = $parsingStatus['parseLimit'] - 1;
     }
     $careerPortalSettings = new CareerPortalSettings($this->_siteID);
     $careerPortalSettingsRS = $careerPortalSettings->getAll();
     $careerPortalEnabled = intval($careerPortalSettingsRS['enabled']) ? true : false;
     /* Get questionnaires to attach (if public) */
     $questionnaire = new Questionnaire($this->_siteID);
     $questionnaires = $questionnaire->getAll(false);
     $this->_template->assign('careerPortalEnabled', $careerPortalEnabled);
     $this->_template->assign('questionnaires', $questionnaires);
     $this->_template->assign('contents', $contents);
     $this->_template->assign('isParsingEnabled', $tmp = LicenseUtility::isParsingEnabled());
     $this->_template->assign('parsingStatus', $parsingStatus);
     $this->_template->assign('extraFieldRS', $extraFieldRS);
     $this->_template->assign('sourcesRS', $sourcesRS);
     $this->_template->assign('isModal', true);
     $this->_template->assign('jobOrderID', $jobOrderID);
     $this->_template->assign('sourcesString', $sourcesString);
     $this->_template->assign('preassignedFields', $fields);
     $this->_template->assign('associatedAttachment', $associatedAttachment);
     $this->_template->assign('associatedAttachmentRS', $associatedAttachmentRS);
     $this->_template->assign('associatedTextResume', false);
     $this->_template->assign('associatedFileResume', false);
     $this->_template->assign('EEOSettingsRS', $EEOSettingsRS);
     if (!eval(Hooks::get('JO_ADD_CANDIDATE_MODAL'))) {
         return;
     }
     /* REMEMBER TO ALSO UPDATE CandidatesUI::add() IF APPLICABLE. */
     $this->_template->display('./modules/candidates/Add.tpl');
 }
Example #21
0
<?php

$this->load->view('admin/includes/header');
?>
<form id="frm_display_data" name="frm_display_data" action="<?php 
echo base_url() . $this->lang->lang() . '/' . ADMIN;
?>
/questionnaire/delete_all" method="post">

<div class="form-actions">

<?php 
$this_object = new Questionnaire();
if ($this_object->user_screen_privielge_allowed($this_object->screen_id, $this_object->privielge_delete)) {
    ?>
<a class='btn btn-danger'  href="javascript: submitform()" class="bt_red" onclick="return delete_all_confirm('<?php 
    echo $this->lang->lang();
    ?>
');">
<i class='icon-trash icon-white'></i> 
<?php 
    echo $this->lang->line('btn_delete_all');
    ?>
</a>                          
<?php 
}
if ($this_object->user_screen_privielge_allowed($this_object->screen_id, $this_object->privielge_add)) {
    ?>
<a class='btn btn-info' href="<?php 
    echo base_url() . $this->lang->lang() . '/' . ADMIN;
    ?>
Example #22
0
    public function onApplyToJobOrder($siteID, $candidateID = false)
    {
        $jobOrders = new JobOrders($siteID);
        $careerPortalSettings = new CareerPortalSettings($siteID);

        if (!$this->isRequiredIDValid('ID', $_POST))
        {
            CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid job order ID.');
            return;
        }

        $jobOrderID = $_POST['ID'];

        $jobOrderData = $jobOrders->get($jobOrderID);
        if (!isset($jobOrderData['public']) || $jobOrderData['public'] == 0)
        {
            CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified job order could not be found.');
            return;
        }

        $lastName       = $this->getTrimmedInput('lastName', $_POST);
        $middleName     = $this->getTrimmedInput('middleName', $_POST);
        $firstName      = $this->getTrimmedInput('firstName', $_POST);
        $email          = $this->getTrimmedInput('email', $_POST);
        $email2         = $this->getTrimmedInput('email2', $_POST);
        $address        = $this->getTrimmedInput('address', $_POST);
        $city           = $this->getTrimmedInput('city', $_POST);
        $state          = $this->getTrimmedInput('state', $_POST);
        $zip            = $this->getTrimmedInput('zip', $_POST);
        $source         = $this->getTrimmedInput('source', $_POST);
        $phone          = $this->getTrimmedInput('phone', $_POST);
        $phoneHome      = $this->getTrimmedInput('phoneHome', $_POST);
        $phoneCell      = $this->getTrimmedInput('phoneCell', $_POST);
        $bestTimeToCall = $this->getTrimmedInput('bestTimeToCall', $_POST);
        $keySkills      = $this->getTrimmedInput('keySkills', $_POST);
        $extraNotes     = $this->getTrimmedInput('extraNotes', $_POST);
        $employer       = $this->getTrimmedInput('employer', $_POST);

        $gender         = $this->getTrimmedInput('eeogender', $_POST);
        $race           = $this->getTrimmedInput('eeorace', $_POST);
        $veteran        = $this->getTrimmedInput('eeoveteran', $_POST);
        $disability     = $this->getTrimmedInput('eeodisability', $_POST);

        if (empty($firstName))
        {
            CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'First Name is a required field - please have your administrator edit your templates to include the first name field.');
        }

        if (empty($lastName))
        {
            CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'Last Name is a required field - please have your administrator edit your templates to include the last name field.');
        }

        if (empty($email))
        {
            CommonErrors::fatal(COMMONERROR_MISSINGFIELDS, $this, 'E-Mail address is a required field - please have your administrator edit your templates to include the email field.');
        }

        if (empty($source))
        {
            $source = 'Online Careers Website';
        }

        $users = new Users(CATS_ADMIN_SITE);
        $automatedUser = $users->getAutomatedUser();

        /* Find if another user with same e-mail exists. If so, update the user
         * to contain the new information.
         */
        $candidates = new Candidates($siteID);

        /**
         * Save basic information in a cookie in case the site is using registration to
         * process repeated postings, etc.
         */
        $fields = array('firstName', 'lastName', 'email', 'address', 'city', 'state', 'zip', 'phone',
            'phoneHome', 'phoneCell'
        );
        $storedVal = '';
        foreach ($fields as $field)
        {
            eval('$tmp = sprintf(\'"%s"="%s"\', $field, urlencode($' . $field . '));');
            $storedVal .= $tmp;
        }
        // Store their information for an hour only (about 1 session), if they return they can log in again and
        // specify "remember me" which stores it for 2 weeks.
        @setcookie($this->getCareerPortalCookieName($siteID), $storedVal, time()+60*60);

        if ($candidateID !== false)
        {
            $candidate = $candidates->get($candidateID);

            // Candidate exists and registered. Update their profile with new values (if provided)
            $candidates->update(
                $candidateID, $candidate['isActive'] ? true : false, $firstName, $middleName,
                $lastName, $email, $email2, $phoneHome, $phoneCell, $phone, $address, $city,
                $state, $zip, $source, $keySkills, '', $employer, '', '', '', $candidate['notes'],
                '', $bestTimeToCall, $automatedUser['userID'], $automatedUser['userID'], $gender,
                $race, $veteran, $disability
            );

            /* Update extra feilds */
            $candidates->extraFields->setValuesOnEdit($candidateID);
        }
        else
        {
            // Lookup the candidate by e-mail, use that candidate instead if found (but don't update profile)
            $candidateID = $candidates->getIDByEmail($email);
        }

        if ($candidateID === false || $candidateID < 0)
        {
            /* New candidate. */
            $candidateID = $candidates->add(
                $firstName,
                $middleName,
                $lastName,
                $email,
                $email2,
                $phoneHome,
                $phoneCell,
                $phone,
                $address,
                $city,
                $state,
                $zip,
                $source,
                $keySkills,
                '',
                $employer,
                '',
                '',
                '',
                'Candidate submitted these notes with first application: '
                . "\n\n" . $extraNotes,
                '',
                $bestTimeToCall,
                $automatedUser['userID'],
                $automatedUser['userID'],
                $gender,
                $race,
                $veteran,
                $disability
            );

            /* Update extra fields. */
            $candidates->extraFields->setValuesOnEdit($candidateID);
        }

        // If the candidate was added and a questionnaire exists for the job order
        if ($candidateID > 0 && ($questionnaireID = $jobOrderData['questionnaireID']))
        {
            $questionnaireLib = new Questionnaire($siteID);
            // Perform any actions specified by the questionnaire
            $questionnaireLib->doActions($questionnaireID, $candidateID, $_POST);
        }

        $fileUploaded = false;

        /* Upload resume (no questionnaire) */
        if (isset($_FILES['file']) && !empty($_FILES['file']['name']))
        {
            $attachmentCreator = new AttachmentCreator($siteID);
            $attachmentCreator->createFromUpload(
                DATA_ITEM_CANDIDATE, $candidateID, 'file', false, true
            );

            if ($attachmentCreator->isError())
            {
                CommonErrors::fatal(COMMONERROR_FILEERROR, $this, $attachmentCreator->getError());
                return;
            }

            $duplicatesOccurred = $attachmentCreator->duplicatesOccurred();

            $isTextExtractionError = $attachmentCreator->isTextExtractionError();
            $textExtractionErrorMessage = $attachmentCreator->getTextExtractionError();

            // FIXME: Show parse errors!

            $fileUploaded = true;
            $resumePath = $attachmentCreator->getNewFilePath();
        }
        /* Upload resume (with questionnaire) */
        else if (isset($_POST['file']) && !empty($_POST['file']))
        {
            $resumePath = '';

            $newFilePath = FileUtility::getUploadFilePath($siteID, 'careerportaladd', $_POST['file']);

            if ($newFilePath !== false)
            {
                $attachmentCreator = new AttachmentCreator($siteID);
                $attachmentCreator->createFromFile(
                    DATA_ITEM_CANDIDATE, $candidateID, $newFilePath, false, '', true, true
                );

                if ($attachmentCreator->isError())
                {
                    CommonErrors::fatal(COMMONERROR_FILEERROR, $this, $attachmentCreator->getError());
                    return;
                }

                $duplicatesOccurred = $attachmentCreator->duplicatesOccurred();

                $isTextExtractionError = $attachmentCreator->isTextExtractionError();
                $textExtractionErrorMessage = $attachmentCreator->getTextExtractionError();

                // FIXME: Show parse errors!

                $fileUploaded = true;
                $resumePath = $attachmentCreator->getNewFilePath();
            }
        }

        $pipelines = new Pipelines($siteID);
        $activityEntries = new ActivityEntries($siteID);

        /* Is the candidate already in the pipeline for this job order? */
        $rs = $pipelines->get($candidateID, $jobOrderID);
        if (count($rs) == 0)
        {
            /* Attempt to add the candidate to the pipeline. */
            if (!$pipelines->add($candidateID, $jobOrderID))
            {
                CommonErrors::fatal(COMMONERROR_RECORDERROR, $this, 'Failed to add candidate to pipeline.');
            }

            // FIXME: For some reason, pipeline entries like to disappear between
            //        the above add() and this get(). WTF?
            $rs = $pipelines->get($candidateID, $jobOrderID);
            if (isset($rs['candidateJobOrderID']))
                $pipelines->updateRatingValue($rs['candidateJobOrderID'], -1);

            $newApplication = true;
        }
        else
        {
            $newApplication = false;
        }

        /* Build activity note. */
        if (!$newApplication)
        {
            $activityNote = 'User re-applied through candidate portal';
        }
        else
        {
            $activityNote = 'User applied through candidate portal';
        }

        if ($fileUploaded)
        {
            if (!$duplicatesOccurred)
            {
                $activityNote .= ' <span style="font-weight: bold;">and'
                    . ' attached a new resume (<a href="' . $resumePath
                    . '">Download</a>)</span>';
            }
            else
            {
                $activityNote .= ' and attached an existing resume (<a href="'
                    . $resumePath . '">Download</a>)';
            }
        }

		if (!empty($extraNotes))
		{
        	$activityNote .= '; added these notes: ' . $extraNotes;
		}

        /* Add the activity note. */
        $activityID = $activityEntries->add(
            $candidateID,
            DATA_ITEM_CANDIDATE,
            ACTIVITY_OTHER,
            $activityNote,
            $automatedUser['userID'],
            $jobOrderID
        );

        /* Send an E-Mail describing what happened. */
        $emailTemplates = new EmailTemplates($siteID);
        $candidatesEmailTemplateRS = $emailTemplates->getByTag(
            'EMAIL_TEMPLATE_CANDIDATEAPPLY'
        );

        if (!isset($candidatesEmailTemplateRS['textReplaced']) ||
            empty($candidatesEmailTemplateRS['textReplaced']) ||
            $candidatesEmailTemplateRS['disabled'] == 1)
        {
            $candidatesEmailTemplate = '';
        }
        else
        {
            $candidatesEmailTemplate = $candidatesEmailTemplateRS['textReplaced'];
        }

        /* Replace e-mail template variables. */
        /* E-Mail #1 - to candidate */
        $stringsToFind = array(
            '%CANDFIRSTNAME%',
            '%CANDFULLNAME%',
            '%JBODOWNER%',
            '%JBODTITLE%',
            '%JBODCLIENT%'
        );
        $replacementStrings = array(
            $firstName,
            $firstName . ' ' . $lastName,
            $jobOrderData['ownerFullName'],
            $jobOrderData['title'],
            $jobOrderData['companyName']

            //'<a href="http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=candidates&amp;a=show&amp;candidateID=' . $candidateID . '">'.
              //  'http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], '?')) . '?m=candidates&amp;a=show&amp;candidateID=' . $candidateID . '</a>'
        );
        $candidatesEmailTemplate = str_replace(
            $stringsToFind,
            $replacementStrings,
            $candidatesEmailTemplate
        );

        $emailContents = $candidatesEmailTemplate;

        if (!empty($emailContents))
        {
            if(!$candidates->isLoaded())
            {
                $candidates->load($candidateID);
            }
            $candidates->sendEMail(
                $automatedUser['userID'],
                $email,
                CAREERS_CANDIDATEAPPLY_SUBJECT,
                $emailContents
            );
        }

        /* E-Mail #2 - to owner */

        $candidatesEmailTemplateRS = $emailTemplates->getByTag(
            'EMAIL_TEMPLATE_CANDIDATEPORTALNEW'
        );

        if (!isset($candidatesEmailTemplateRS['textReplaced']) ||
            empty($candidatesEmailTemplateRS['textReplaced']) ||
            $candidatesEmailTemplateRS['disabled'] == 1)
        {
            $candidatesEmailTemplate = '';
        }
        else
        {
            $candidatesEmailTemplate = $candidatesEmailTemplateRS['textReplaced'];
        }

        // FIXME: This will break if 'http' is elsewhere in the URL.
        $uri = str_replace('employment', '', $_SERVER['REQUEST_URI']);
        $uri = str_replace('http://', 'http', $uri);
        $uri = str_replace('//', '/', $uri);
        $uri = str_replace('http', 'http://', $uri);
        $uri = str_replace('/careers', '', $uri);

        /* Replace e-mail template variables. */
        $stringsToFind = array(
            '%CANDFIRSTNAME%',
            '%CANDFULLNAME%',
            '%JBODOWNER%',
            '%CANDOWNER%',     // Because the candidate was just added, we assume
            '%JBODTITLE%',     // the candidate owner = job order owner.
            '%JBODCLIENT%',
            '%CANDCATSURL%',
            '%JBODID%',
            '%JBODCATSURL%'
        );
        $replacementStrings = array(
            $firstName,
            $firstName . ' ' . $lastName,
            $jobOrderData['ownerFullName'],
            $jobOrderData['ownerFullName'],
            $jobOrderData['title'],
            $jobOrderData['companyName'],
            '<a href="http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=candidates&amp;a=show&amp;candidateID=' . $candidateID . '">'.
                'http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=candidates&amp;a=show&amp;candidateID=' . $candidateID . '</a>',
            $jobOrderData['jobOrderID'],
            '<a href="http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=joborders&amp;a=show&amp;jobOrderID=' . $jobOrderData['jobOrderID'] . '">'.
                'http://' . $_SERVER['HTTP_HOST'] . substr($uri, 0, strpos($uri, '?')) . '?m=joborders&amp;a=show&amp;jobOrderID=' . $jobOrderData['jobOrderID'] . '</a>',
        );
        $candidatesEmailTemplate = str_replace(
            $stringsToFind,
            $replacementStrings,
            $candidatesEmailTemplate
        );

        $emailContents = $candidatesEmailTemplate;

        if (!empty($emailContents))
        {
            if(!$jobOrders->isLoaded())
            {
                $jobOrders->load($jobOrderID);
            }
            $jobOrders->sendEmail(
                $automatedUser['userID'],
                $jobOrderData['owner_email'],
                CAREERS_OWNERAPPLY_SUBJECT,
                $emailContents
            );


            if ($jobOrderData['owner_email'] != $jobOrderData['recruiter_email'])
            {
                $jobOrders->sendEmail(
                    $automatedUser['userID'],
                    $jobOrderData['recruiter_email'],
                    CAREERS_OWNERAPPLY_SUBJECT,
                    $emailContents
                );
            }
        }
    }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Questionnaire the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Questionnaire::model()->findByPk(new MongoID($id));
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #24
0
<?php

namespace Ventus\Counselling;

//============================================================================================
// Session, configuration file, localization constructor
//============================================================================================
require '../includes/php/bootstrap.php';
$SESSION = new \Zend_Session_Namespace('internal', true);
if (isset($SESSION->lang)) {
    $l10n->setLanguage($SESSION->lang);
}
//============================================================================================
// Model and Header and L10N Includes
//============================================================================================
$questionnaire = new Questionnaire($dbo);
$dass = new DASS($dbo);
$l10n->addResource(FS_L10N . '/header-external.json');
//============================================================================================
// Load the content
//============================================================================================
if (!isset($_GET['page'])) {
    $l10n->addResource(__DIR__ . '/l10n/intake-form.json');
    require_once FS_PHP . '/header-external.php';
    require_once 'views/intake-form.php';
    require_once FS_PHP . '/footer-external.php';
} elseif ($_GET['page'] === "add") {
    $questionnaire_id = $questionnaire->addQuestionnaire($_POST);
    $loggers['audit']->info("Questionnaire added");
    $dass->addDASS($questionnaire_id, $_POST);
    $questionnaire->addOrUpdateStudentProfile($_POST);
Example #25
0
<div class="wide form">

    <?php 
$form = $this->beginWidget('CActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get'));
?>

    <div class="row">
        <div class="col-lg-6">
            <?php 
echo $form->label($model, 'name');
?>
            <?php 
echo $form->dropDownList($model, 'name', Questionnaire::model()->getNomsFiches(), array('prompt' => '----', "multiple" => "multiple"));
?>
        </div>
    </div>

    <div class="row buttons">
        <div class="col-lg-6">
            <?php 
echo CHtml::submitButton(Yii::t('common', 'search'), array('name' => 'rechercher', 'class' => 'btn btn-default', 'style' => 'margin-top: 8px; padding-bottom: 23px;'));
?>
            <?php 
echo CHtml::resetButton(Yii::t('common', 'reset'), array('class' => 'btn btn-default', 'style' => 'margin-top: 8px; padding-bottom: 23px;'));
?>
        </div>
    </div>

    <?php 
$this->endWidget();
?>
 /**
  * action pour afficher dynamiquement la liste de questions dans le formulaire
  * d ajout de question pour gerer le positionnement
  * @param id is questionnaire id
  */
 public function actionDynamicquestions($id)
 {
     Yii::log("dynamic question", CLogger::LEVEL_TRACE);
     $questionForm = new QuestionForm();
     $questionForm->attributes = $_POST['QuestionForm'];
     $questionnaire = Questionnaire::model()->findByPk(new MongoID($id));
     $data = $questionnaire->getArrayQuestions($questionForm->idQuestionGroup);
     Yii::log("count questions:" . count($data), CLogger::LEVEL_TRACE);
     //add the empty option si l on veut mettre la question au debut
     echo CHtml::tag('option', array('value' => ''), CHtml::encode("----"), true);
     foreach ($data as $value => $name) {
         echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
     }
 }
Example #27
0
<?php

Yii::app()->clientScript->registerScript('formulaire_view', "\n\$(document).ready(function() {\n    var inputs = document.getElementsByTagName('input');\n    var textareas = document.getElementsByTagName('textarea');\n    var selectlist = document.getElementsByTagName('select');\n    var len_inputs = inputs.length;\n    var len_textareas = textareas.length;\n    var len_selectlist = selectlist.length;\n\n    for (var i = 0; i < len_inputs; i++) {\n        inputs[i].disabled = true;\n    }\n    for (var i = 0; i < len_textareas; i++) {\n        textareas[i].disabled = true;\n    }\n    for (var i = 0; i < len_selectlist; i++) {\n        selectlist[i].disabled = true;\n    }\n});\n");
?>

<h3 align="center"><?php 
echo Yii::t('common', 'form') . $model->name;
?>
</h3>
<p><b>Description: </b><?php 
echo $model->description;
?>
</p>
<?php 
if ($model->last_modified != null && $model->last_modified != "") {
    $q = Questionnaire::model()->findByPk(new MongoId($_GET['id']));
    echo "<p><b>" . Yii::t('common', 'lastModifiedDate') . ": </b>" . date('d/m/Y', strtotime($q->last_modified['date'])) . "</p>";
}
?>
<p><b><?php 
echo Yii::t('common', 'createdBy');
?>
: </b><?php 
echo $model->creator;
?>
</p>
<hr />

<?php 
echo CHtml::errorSummary($model, null, null, array('class' => 'alert alert-error'));
?>
 public function actionPushQuestionnaireEnd()
 {
     $student_id = Yii::app()->request->getPost("student_id", NULL);
     $session_id = Yii::app()->request->getPost("session_id", NULL);
     /*
     	next session
     */
     $session = Session::model()->find('session_id=:session_id', array(':session_id' => $session_id));
     $mod_id = $session->mod_id;
     $next_order = $session->session_order + 1;
     $next_session = Session::model()->find('mod_id=:mod_id AND session_order=:session_order', array(':mod_id' => $mod_id, ':session_order' => $next_order));
     $current = Current::model()->find('student_id=:student_id', array(':student_id' => $student_id));
     //error_log(print_r($current,1));
     //error_log("\n");
     //error_log(print_r($next_session,1));
     if ($this->getMaxOrder($student_id) < $next_order) {
     }
     if ($current && $next_session) {
         $session_listening = SessionListening::model()->find('session_id=:session_id', array('session_id' => $next_session->session_id));
         $current->session_id = $next_session->session_id;
         if ($current->save()) {
             $current->listening_id = $session_listening->listening_id;
             $current->save();
         }
     }
     $end_questionnaire_answer = Yii::app()->request->getPost("end_questionnaire_answer", NULL);
     $questionnaire = Questionnaire::model()->find('student_id=:student_id AND session_id=:session_id', array(':student_id' => $student_id, ':session_id' => $session_id));
     if ($questionnaire) {
         $questionnaire->end_questionnaire_answer = $end_questionnaire_answer;
         if (!$questionnaire->save()) {
             $this->renderJSON($questionnaire->getErrors());
         } else {
             $this->renderJSON(array('status' => 1, 'message' => 'Successfully saved!'));
         }
     } else {
         $this->renderJSON(array('status' => 0, 'message' => 'Given Questionnaire could not be found!'));
     }
 }
Example #29
0
 /**
  * SystemPlugins may call UpdateInformation::setInformation to set information
  * to be sent via ajax to the main request. Core-functionality-data should be
  * collected and set here.
  * @return array: array(array('js_function' => $data), ...)
  */
 protected function coreInformation()
 {
     $data = array();
     if (PersonalNotifications::isActivated()) {
         $notifications = PersonalNotifications::getMyNotifications();
         if ($notifications && count($notifications)) {
             $ret = array();
             foreach ($notifications as $notification) {
                 $info = $notification->toArray();
                 $info['html'] = $notification->getLiElement();
                 $ret[] = $info;
             }
             $data['PersonalNotifications.newNotifications'] = $ret;
         } else {
             $data['PersonalNotifications.newNotifications'] = array();
         }
     }
     $page_info = Request::getArray("page_info");
     if (stripos(Request::get("page"), "dispatch.php/messages") !== false) {
         $messages = Message::findNew($GLOBALS["user"]->id, $page_info['Messages']['received'], $page_info['Messages']['since'], $page_info['Messages']['tag']);
         $template_factory = $this->get_template_factory();
         foreach ($messages as $message) {
             $data['Messages.newMessages']['messages'][$message->getId()] = $template_factory->open("messages/_message_row.php")->render(compact("message") + array('controller' => $this));
         }
     }
     if (count($page_info['Questionnaire']['questionnaire_ids']) > 0) {
         foreach ($page_info['Questionnaire']['questionnaire_ids'] as $questionnaire_id) {
             $questionnaire = new Questionnaire($questionnaire_id);
             if ($questionnaire->latestAnswerTimestamp() > $page_info['Questionnaire']['last_update']) {
                 $template = $this->get_template_factory()->open("questionnaire/evaluate");
                 $template->set_layout(null);
                 $template->set_attribute("questionnaire", $questionnaire);
                 $data['Questionnaire.updateQuestionnaireResults'][$questionnaire->getId()] = array('html' => $template->render());
             }
         }
     }
     return $data;
 }
Example #30
0
function getQuestionnaireByUtilisateur($idUtilisateur)
{
    $questionnaireRequete = "SELECT * FROM questionnaire WHERE ID_USERSAISI  = " . $idUtilisateur . "";
    $questionnaireResultat = $GLOBALS['bdd']->query($questionnaireRequete);
    $listeQuestionnaires = new ArrayObject();
    while ($unQuestionnaire = $questionnaireResultat->fetch()) {
        $questionnaire = new Questionnaire();
        $questionnaire->setId($unQuestionnaire['ID_QUESTIONNAIRE']);
        $questionnaire->setIdUtilisateur($unQuestionnaire['ID_USERSAISI']);
        $questionnaire->setLibelle($unQuestionnaire['LIBELLE_QUESTIONNAIRE']);
        $questionnaire->setNbContact($unQuestionnaire['nbContact']);
        $questionnaire->setIdTelemarket($unQuestionnaire['idUserTelemarket']);
        $questionnaire->setDateSaisi($unQuestionnaire['DATESAISIE_QUESTIONNAIRE']);
        $questionnaire->setDateMiseAJour($unQuestionnaire['DATEMAJ_QUESTIONNAIRE']);
        $listeQuestionnaires->append($questionnaire);
    }
    return $listeQuestionnaires;
}