Ejemplo n.º 1
0
     }
     //foreach
     $question_data["db_error"] = $db_con->getErrorMessage();
     print json_encode($question_data);
 } else {
     if (isset($_POST['delete_test'])) {
         $test_id = $_POST['selected_test_id'];
         $db_con = new Db_Connection();
         //delete questions:
         $lookups = $db_con->selectEntries(false, 'dynmc_lookup', array("where" => "lookup_test_ID = " . $test_id));
         for ($i = 0; $i < sizeof($lookups); $i++) {
             deleteQuestion($lookups[$i]['lookup_question_ID'], $test_id);
         }
         //for
         $db_con->deleteEntries(true, 'tests', array("where" => "test_ID = " . $test_id));
         if ($db_con->getErrorMessage() !== '') {
             $error = true;
             $error_msg = 'The following error has occurred while deleting the test: ' . $db_con->getErrorMessage();
         } else {
             $deleted_successfully = true;
         }
         //else
         include INCLUDE_PATH . 'index.php';
     } else {
         if (isset($_GET['new_option'])) {
             resumeAndCheckSession();
             $timestamp = $_GET['timestamp'];
             if (sizeof($_SESSION[$timestamp]['options'][$_GET['question_ID']]) > 0) {
                 $_SESSION[$timestamp]['current_option'] = array_shift($_SESSION[$timestamp]['options'][$_GET['question_ID']]);
                 print $_SESSION[$timestamp]['current_option'][1];
             }