Exemplo n.º 1
0
             $new_quiz['enableoffline'] = false;
         }
         // online is always enabled
         $new_quiz['enableonline'] = true;
         /* Save new entry */
         $qdb->addQuiz($new_quiz);
         // we do not add to the array instead we will reload the quizzes once complete
     }
 }
 // re initialise array by reloading entries
 $all_quizzes = new Quizzes();
 $quiz_array = array();
 $quiz_array = $qdb->getQuizzesAll();
 // add this one to allQuizzes
 foreach ($quiz_array as $this_quiz_array) {
     $all_quizzes->addQuiz(new Quiz($this_quiz_array));
 }
 /*** Load questions from old database and store in new database ***/
 // Connect to the old database
 $olddb = new Database($old_db_entries);
 if ($db->getStatus() != 1) {
     die("Unable to connect to database " . $old_db_entries['hostname'] . " " . $old_db_entries['database']);
 }
 // create sql to load questions
 $old_sql = "SELECT * from " . $old_entries['$dbtable'];
 // Loads all questions - note that this requires a significant
 // amount of available memory - depending upon the number of questions and php settings
 // If this fails due to insufficient memory then check memory_limit in php.ini
 // Questions take up very little memory in the database so it would need to be a very large number of questions to be of concern
 $old_questions_array = $olddb->getRowsAll($old_sql);
 foreach ($old_questions_array as $this_question) {