public function testQuestionCreation()
 {
     $this->assertEquals($this->single_choice_question->getTitle(), 'Basic Math');
     $this->assertEquals($this->single_choice_question->getDescription(), 'What is the result of 1+1?');
     $this->assertEquals($this->single_choice_question->getAvailableAnswers(), $this->single_choice_question_answers);
     $this->assertFalse($this->single_choice_question->wasAnswered());
     $this->assertEquals($this->multiple_choice_question->getTitle(), 'Planets');
     $this->assertEquals($this->multiple_choice_question->getDescription(), 'What planets are between the Sun and the Earth?');
     $this->assertEquals($this->multiple_choice_question->getAvailableAnswers(), $this->multiple_choice_question_answers);
     $this->assertFalse($this->multiple_choice_question->wasAnswered());
     $question = new Question();
     $question->setInternalId(4);
     $this->assertEquals($question->getInternalId(), 4);
     $question->setTopic(array('planets' => 'Planets related questions'));
     $this->assertEquals($question->getTopic(), array('planets' => 'Planets related questions'));
 }
Example #2
0
     // Fragen nach Thema sortieren
     $topics->getTopic();
     $topicarray = $topics->getTopicArray();
     $number = $qu->getNumberOfQuestions($topicarray);
     $inactive = $qu->getNumberOfInactiveQuestions($topicarray);
     //muss noch erstellt werden
     $lp = $qu->getLearnpathCount($topicarray);
     $topics->showTopicTableStatistic($number, $lp, $inactive);
     break;
 case 'getStatisticQuestions':
     // Fragen in Tabelle anzeigen
     $topics->setTopicID($t_id);
     $topics->setTopic($t_id);
     $Topic = $topics->getTopicName();
     echo "<br /><h2>" . Statistic_03 . " " . stripslashes($Topic) . "<br /></h2>";
     $qu->setTopic($t_id);
     $ok = $qu->setStatisticQuestions();
     if ($ok == 1) {
         $qu->showStatisticQuestionTable();
     }
     break;
 case 'changeActive':
     // Frage deaktivieren / aktivieren
     // Überbrüfung / Wertzuweisung
     $q_id = 0;
     if ($_GET['q_id']) {
         $q_id = abs(intval($_GET['q_id']));
     }
     $qu->setID($q_id);
     $qu->changeActive();
     $t_id = $_GET['t_id'];
Example #3
0
     reallyDelTopic($t_id);
     if ($_REQUEST['submit'] == Global_13) {
         $topics->setTopicID($t_id);
         $topics->delTopic();
         echo " <meta http-equiv='refresh' content='0; url=?site=topic' />";
     } else {
         if ($_REQUEST['submit'] == Global_14) {
             echo " <meta http-equiv='refresh' content='0; url=?site=topic' />";
         }
     }
     break;
 case 'getQuestions':
     // Fragen zum Thema anzeigen
     $topics->setTopic($t_id);
     echo "<br /><h2> " . Topic_03 . " " . stripslashes($topics->getTopicName()) . "<br /></h2>";
     $question->setTopic($t_id);
     $question->setAllQuestions();
     $question->showQuestionTable();
     break;
 case 'delQuestion':
     // Löschen einer Frage
     reallyDelQuestion($q_id, $t_id);
     if ($_REQUEST['submit'] == Global_13) {
         $answer->delAnswers($q_id);
         $question->delQuestion($q_id);
         echo " <meta http-equiv='refresh' content='0; url=?{$site}' />";
     } else {
         if ($_REQUEST['submit'] == Global_14) {
             echo " <meta http-equiv='refresh' content='0; url=?{$site}' />";
         }
     }
Example #4
0
         $new = htmlspecialchars($_POST["new"]);
     }
     // Umwandlung von Sonderzeichen in HTML-Code
     $_SESSION['values']['question']['description'] = 0;
     if ($_POST["description"]) {
         $_SESSION['values']['question']['description'] = abs(intval($_POST["description"]));
     }
     $_SESSION['values']['question']['descriptionText'] = "";
     if ($_POST["descriptionText"]) {
         $_SESSION['values']['question']['descriptionText'] = htmlspecialchars($_POST["descriptionText"]);
     }
     // Session Variable setzen
     $_SESSION['values']['question']['new'] = 1;
 }
 $question->setType($_SESSION['values']['question']['qt']);
 $question->setTopic($_SESSION['values']['question']['t_id']);
 if ($_SESSION['values']['question']['descriptionText'] == '') {
     $_SESSION['values']['question']['description'] = 0;
 }
 if ($_SESSION['values']['question']['description'] == 0 && $_SESSION['values']['question']['descriptionText'] != '') {
     $_SESSION['values']['question']['descriptionText'] = '';
 }
 $check = $question->checkQuestion();
 if ($check == 1 && $_SESSION['values']['question']['t_id'] != '') {
     $topic->getTopic();
     $topicArray = $topic->getTopicArray();
     $question->setAllTopics($topicArray);
     $question->showQuestionInfos();
     $answer->setQuestionType($_SESSION['values']['question']['qt']);
     $answer->addAnswer();
     $answer->addAnswer();