Beispiel #1
0
 // check if the quiz exists
 if ($quiz->exists()) {
     $quiz_exist = true;
     // Unpublish the quiz
     if (isset($_GET['unlist'])) {
         $state = $quiz->unpublish($member->id);
         if (!$state) {
             $quiz_exist = false;
         }
     } else {
         // Publish the quiz
         require '../modules/checkAchievements.php';
         // prepare the achievement array for possible multiple achievements
         $achievement_array = array();
         // set the quiz as published
         $level = $quiz->publish($member->id);
         if ($level == false) {
             // authentication error
             $quiz_exist = false;
         } elseif ($level == -2) {
             // publish failed, redirect user
             header("Location: modifyQuiz.php?step=4&id=" . $quiz->quiz_id);
         } else {
             if ($level != -1) {
                 $achievement_array[] = $level;
                 // provide the ID of the level acheievement
             }
             // check if there are any achievements
             $achievement_array = checkAchievements($member->id, $achievement_array);
         }
         //----------------------------------------