setTopicName($name);
$checkNum=$topics->setNumOfQu($questPerQuiz);
$checkPerc=$topics->setrawToPass($rawToPass);
$topics->setSession();
if($checkPerc!=0) echo" ";
if($checkNum!=0)echo" ";
else if($checkPerc==0 && $checkNum==0){
$reply=$topics->saveTopic();
if($reply=='none'){
$topics->unsetSession();
echo" ";
} else echo" ";
}
break;
}
case 'new_topic':{ // neues Topic
if($error)$topics->setError($error);
$topics->newForm();
break;
}
case 'setTopicInactive':{ //inaktiv setzen
$topics->setTopicID($t_id);
$topics->setInactiveTopic();
echo" ";
break;
}
case 'setTopicAvtive':{ //aktivieren
$topics->setTopicID($t_id);
$topics->setActiveTopic();
echo" ";
break;
}
case'delTopic':{ // Löschen eines Themas
$questionArray=array();
reallyDelTopic($t_id);
if($_REQUEST['submit']==Global_13){
$topics->setTopicID($t_id);
$topics->delTopic();
echo" ";
}
else if($_REQUEST['submit']==Global_14)echo" ";
break;
}
case 'getQuestions':{ // Fragen zum Thema anzeigen
$topics->setTopic($t_id);
echo "
".Topic_03." ".stripslashes($topics->getTopicName())."
";
$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" ";
}
else if($_REQUEST['submit']==Global_14) echo" ";
break;
}
case 'setQuestionInactive':{ // Deaktivieren einer Frage
$question->setID($q_id);
$question->setInactive();
echo" ";
break;
}
case 'setQuestionActive':{ //Aktivieren einer Frage
$question->setID($q_id);
$question->setActive();
echo" ";
break;
}
case 'showDetails':{ // Anzeigen der Fragedetails
if($q_id!=0) $_SESSION ['values']['question']['q_id']=$q_id;
if($error=='conflict') echo "".Topic_01."
";
$question->setID($_SESSION ['values']['question']['q_id']);
$question->loadQuestion();
$type=$question->getType();
$topics->getTopic();
$topicArray=$topics->getTopicArray();
$question->setAllTopics($topicArray);
$question->showQuestionDetails();
$answer->setQuestionID($_SESSION ['values']['question']['q_id']);
$answer->setAnswerType($_SESSION ['values']['question']['qt']);
$answer->getAnswers();
$answer->showAnswers();
break;
}
case 'updateQuestion': { // Question updaten
// Wertzuweisung
$questionText=""; if(isset($_REQUEST["question"]))$questionText= htmlspecialchars($_REQUEST["question"]);
$descriptionText=""; if(isset($_REQUEST["descriptionText"]))$descriptionText= htmlspecialchars($_REQUEST["descriptionText"]);
$description=0; if(isset($_REQUEST["description"]))$description=$_REQUEST["description"];
$question->setID($q_id);
$question->loadQuestion();
$reply=$question->setUpdateQuestion($questionText,$t_id);
// neue Beschreibung
if($descriptionText!="" && $description==1)$question->saveDescription($q_id,$descriptionText);
// Änderung der Beschreibung
else if($descriptionText!="" && $description==0)$question->updateDescription($q_id,$descriptionText);
// Beschreibung löschen
if($descriptionText =="" && $description==0)$question->delDescription($q_id,$descriptionText);
if($reply=='conflict') echo" ";
else echo" ";
break;
}
case 'updateAnswers': { // Antwort updaten
// Wertzuweisung
$type=0; if(isset($_GET['type'])) $type=abs(intval($_GET['type']));
$a_id=0; if(isset($_GET['a_id'])) $a_id=abs(intval($_GET['a_id']));
$changed_answers=array(); if(isset($_REQUEST["change"]))$changed_answers= $_REQUEST["change"];// array der geänderten Antworten
//$answerList=array();$answerList=$_SESSION['values']['answerList'];
$question->setID($q_id);
$question->loadQuestion();
$topics->getTopic();
$topicArray=$topics->getTopicArray();
$question->setAllTopics($topicArray);
$type=$question->getType();
$question->showQuestionDetails();
$answer->setQuestionID($q_id);
$answer->getAnswers();
$answer->setAnswerList();
$answer->setAnswerType($type);
if(isset($_REQUEST['submit']) && !$a_id && $_REQUEST['submit']==Button_11){
$answer->setChangedAnswers($changed_answers);
$answer->updateChangedAnswers();
}
if($a_id){
$answer->changeCorrect($a_id);
$answer->updateTruthFalse();
}
if (isset($_REQUEST["editAnsw"])){
//$answer->setAnswerList($answerList);
$answer->setType();
}
if(!isset($_REQUEST["editAnsw"]) || empty($_REQUEST["editAnsw"])){
$answer->showAnswers();
}
break;
}
case 'editTopic':{
if(!isset($_SESSION['values']['topic']) || empty($_SESSION['values']['topic'])){
$topics->setTopicID($t_id);
$topics->setTopic($t_id);
} else {
if($error)$topics->setError($error);
$topics->setTopicID($_SESSION['values']['topic']['t_id']);
}
$topics->updateForm();
break;
}
case 'updateTopic':{ // Topic updaten
//Wertzuweisung
$name=""; if(isset($_REQUEST["new_topic"]))$name= htmlspecialchars($_REQUEST["new_topic"]);
$numofQuiz=0; if(isset($_REQUEST["questPerQuiz"]))$numOfQuiz =abs(intval($_REQUEST["questPerQuiz"]));
$rawToPass=0; if(isset($_REQUEST["rawToPass"])) $rawToPass =abs(intval($_REQUEST["rawToPass"]));
$topics->setTopicID($t_id);
$topics->setTopicName($name);
$checkNum=$topics->setNumOfQu($numOfQuiz);
$checkPerc=$topics->setrawToPass($rawToPass);
$topics->setSession();
if($checkPerc!=0) echo" ";
else if($checkNum!=0)echo" ";
else if($checkPerc==0 && $checkNum==0){
$topics->updateTopic();
$topics->unsetSession();
echo" ";
}
break;
}
default: { // Übersicht der Themen
echo"
".Topic_02."
";
clearDatabase();
$topics->unsetSession();
$question->unsetSession();
$topics->getTopic();
$topicarray=$topics->getTopicArray();
$number=$question->getNumberOfQuestions($topicarray);
$topics->showTopicTable($number);
unset($_SESSION['values']['return_site']);
}
}
}
else echo ''.Global_01.'
';
?>