From a0a88627cc79602c25710afa8dab4998d491d5b0 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Tue, 21 Oct 2008 06:22:16 +0000 Subject: [PATCH] Remove obsolete method. --- question/type/questiontype.php | 104 --------------------------------- 1 file changed, 104 deletions(-) diff --git a/question/type/questiontype.php b/question/type/questiontype.php index 088057b6ac4..4f5ee43f572 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -422,26 +422,6 @@ class default_questiontype { return null; } - /** - * Changes all states for the given attempts over to a new question - * - * This is used by the versioning code if the teacher requests that a question - * gets replaced by the new version. In order for the attempts to be regraded - * properly all data in the states referring to the old question need to be - * changed to refer to the new version instead. In particular for question types - * that use the answers table the answers belonging to the old question have to - * be changed to those belonging to the new version. - * - * @param integer $oldquestionid The id of the old question - * @param object $newquestion The new question - * @param array $attempts An array of all attempt objects in whose states - * replacement should take place - */ - function replace_question_in_attempts($oldquestionid, $newquestion, $attemtps) { - echo 'Not yet implemented'; - return; - } - /** * Loads the question type specific options for the question. * @@ -1450,90 +1430,6 @@ class default_questiontype { return true; } - /** - * Prints a table of course modules in which the question is used - * - * TODO: This should be made quiz-independent - * - * This function is used near the end of the question edit forms in all question types - * It prints the table of quizzes in which the question is used - * containing checkboxes to allow the teacher to replace the old question version - * - * @param object $question - * @param object $course - * @param integer $cmid optional The id of the course module currently being edited - */ - function print_replacement_options($question, $course, $cmid='0') { - global $DB; - - // Disable until the versioning code has been fixed - if (true) { - return; - } - - // no need to display replacement options if the question is new - if(empty($question->id)) { - return true; - } - - // get quizzes using the question (using the question_instances table) - $quizlist = array(); - if(!$instances = $DB->get_records('quiz_question_instances', array('question' => $question->id))) { - $instances = array(); - } - foreach($instances as $instance) { - $quizlist[$instance->quiz] = $instance->quiz; - } - if(empty($quizlist) or !$quizzes = $DB->get_records_list('quiz', 'id', $quizlist)) { - $quizzes = array(); - } - - // do the printing - if(count($quizzes) > 0) { - // print the table - $strquizname = get_string('modulename', 'quiz'); - $strdoreplace = get_string('replace', 'quiz'); - $straffectedstudents = get_string('affectedstudents', 'quiz', $course->students); - echo "\n"; - echo "".get_string("replacementoptions", "quiz").":\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - foreach($quizzes as $quiz) { - // work out whethere it should be checked by default - $checked = ''; - if((int)$cmid === (int)$quiz->id - or empty($quiz->usercount)) { - $checked = "checked=\"checked\""; - } - - // find how many different students have already attempted this quiz - $students = array(); - if($attempts = $DB->get_records_select('quiz_attempts', "quiz = ? AND preview = '0'", array($quiz->id))) { - foreach($attempts as $attempt) { - if ($DB->record_exists('question_states', array('attempt' => $attempt->uniqueid, 'question' => $question->id), 'originalquestion', 0)) { - $students[$attempt->userid] = 1; - } - } - } - $studentcount = count($students); - - $strstudents = $studentcount === 1 ? $course->student : $course->students; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - } - echo "
$strquizname$strdoreplace$straffectedstudents
".format_string($quiz->name)."id}replace\" type=\"checkbox\" ".$checked." />".(($studentcount) ? $studentcount.' '.$strstudents : '-')."
\n"; - } - echo "\n"; - } - /** * Call format_text from weblib.php with the options appropriate to question types. *