From 2befe77859fef54a2c77b9b34d287c51587421cd Mon Sep 17 00:00:00 2001 From: tjhunt Date: Thu, 10 Aug 2006 18:23:09 +0000 Subject: [PATCH] Convert tabs to spaces. --- question/category_class.php | 2 +- question/format/aiken/format.php | 2 +- question/format/blackboard/format.php | 106 ++++++++++++------------ question/format/blackboard_6/format.php | 14 ++-- question/format/examview/format.php | 35 ++++---- question/format/gift/format.php | 18 ++-- question/format/learnwise/format.php | 10 +-- question/format/qti2/format.php | 6 +- 8 files changed, 98 insertions(+), 95 deletions(-) diff --git a/question/category_class.php b/question/category_class.php index 240d596b41..e02f8a7566 100644 --- a/question/category_class.php +++ b/question/category_class.php @@ -58,7 +58,7 @@ class question_category_object { $this->str->editcategory = get_string('editcategory', 'quiz'); $this->str->cancel = get_string('cancel'); $this->str->editcategories = get_string('editcategories', 'quiz'); - $this->str->page = get_string('page'); + $this->str->page = get_string('page'); $this->pixpath = $CFG->pixpath; } diff --git a/question/format/aiken/format.php b/question/format/aiken/format.php index 3684ec3898..c799bff83b 100644 --- a/question/format/aiken/format.php +++ b/question/format/aiken/format.php @@ -59,7 +59,7 @@ class qformat_aiken extends qformat_default { //trim off the label and space $question->answer[] = substr($nowline,3); $question->fraction[] = 0; - $question->feedback[] = ''; + $question->feedback[] = ''; continue; } if ($leader == "AN"){ diff --git a/question/format/blackboard/format.php b/question/format/blackboard/format.php index 77bc06bd37..a1aac2ab9f 100644 --- a/question/format/blackboard/format.php +++ b/question/format/blackboard/format.php @@ -91,15 +91,15 @@ function process_tf($xml, &$questions, $defaultq) { $question = $defaultq; $question->qtype = TRUEFALSE; - $question->single = 1; // Only one answer is allowed + $question->single = 1; // Only one answer is allowed - $thisquestion = $tfquestions[$i]; + $thisquestion = $tfquestions[$i]; // put questiontext in question object - $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"])); + $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"])); // put name in question object $question->name = $question->questiontext; - $choices = $thisquestion["#"]["ANSWER"]; + $choices = $thisquestion["#"]["ANSWER"]; $correct_answer = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"][0]["@"]["answer_id"]; @@ -136,30 +136,30 @@ function process_mc($xml, &$questions, $defaultq) { $question = $defaultq; $question->qtype = MULTICHOICE; - $question->single = 1; // Only one answer is allowed + $question->single = 1; // Only one answer is allowed - $thisquestion = $mcquestions[$i]; + $thisquestion = $mcquestions[$i]; // put questiontext in question object - $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"])); + $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"])); // put name of question in question object $question->name = $question->questiontext; - $choices = $thisquestion["#"]["ANSWER"]; - for ($j = 0; $j < sizeof ($choices); $j++) { + $choices = $thisquestion["#"]["ANSWER"]; + for ($j = 0; $j < sizeof ($choices); $j++) { - $choice = trim($choices[$j]["#"]["TEXT"][0]["#"]); + $choice = trim($choices[$j]["#"]["TEXT"][0]["#"]); // put this choice in the question object. $question->answer[$j] = addslashes($choice); - $id = $choices[$j]["@"]["id"]; - $correct_answer_id = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"][0]["@"]["answer_id"]; + $id = $choices[$j]["@"]["id"]; + $correct_answer_id = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"][0]["@"]["answer_id"]; // if choice is the answer, give 100%, otherwise give 0% - if (strcmp ($id, $correct_answer_id) == 0) { - $question->fraction[$j] = 1; - $question->feedback[$j] = addslashes(trim($thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_CORRECT"][0]["#"])); + if (strcmp ($id, $correct_answer_id) == 0) { + $question->fraction[$j] = 1; + $question->feedback[$j] = addslashes(trim($thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_CORRECT"][0]["#"])); } else { - $question->fraction[$j] = 0; - $question->feedback[$j] = addslashes(trim($thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_INCORRECT"][0]["#"])); + $question->fraction[$j] = 0; + $question->feedback[$j] = addslashes(trim($thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_INCORRECT"][0]["#"])); } } $questions[] = $question; @@ -184,21 +184,21 @@ function process_ma($xml, &$questions, $defaultq) { $question->qtype = MULTICHOICE; $question->defaultgrade = 1; - $question->single = 0; // More than one answers allowed - $question->image = ""; // No images with this format + $question->single = 0; // More than one answers allowed + $question->image = ""; // No images with this format - $thisquestion = $maquestions[$i]; + $thisquestion = $maquestions[$i]; // put questiontext in question object - $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"])); + $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"])); // put name of question in question object $question->name = $question->questiontext; - $choices = $thisquestion["#"]["ANSWER"]; + $choices = $thisquestion["#"]["ANSWER"]; $correctanswers = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"]; - for ($j = 0; $j < sizeof ($choices); $j++) { + for ($j = 0; $j < sizeof ($choices); $j++) { - $choice = trim($choices[$j]["#"]["TEXT"][0]["#"]); + $choice = trim($choices[$j]["#"]["TEXT"][0]["#"]); // put this choice in the question object. $question->answer[$j] = addslashes($choice); @@ -243,15 +243,15 @@ function process_fib($xml, &$questions, $defaultq) { $question = $defaultq; $question->qtype = SHORTANSWER; - $question->usecase = 0; // Ignore case + $question->usecase = 0; // Ignore case - $thisquestion = $fibquestions[$i]; + $thisquestion = $fibquestions[$i]; // put questiontext in question object - $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"])); + $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"])); // put name of question in question object $question->name = $question->questiontext; - $answer = trim($thisquestion["#"]["ANSWER"][0]["#"]["TEXT"][0]["#"]); + $answer = trim($thisquestion["#"]["ANSWER"][0]["#"]["TEXT"][0]["#"]); $question->answer[] = addslashes($answer); $question->fraction[] = 1; @@ -280,54 +280,54 @@ function process_matching($xml, &$questions, $defaultq) { $question->qtype = MATCH; - $thisquestion = $matchquestions[$i]; + $thisquestion = $matchquestions[$i]; // put questiontext in question object - $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"])); + $question->questiontext = addslashes(trim($thisquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"])); // put name of question in question object $question->name = $question->questiontext; - $choices = $thisquestion["#"]["CHOICE"]; - for ($j = 0; $j < sizeof ($choices); $j++) { + $choices = $thisquestion["#"]["CHOICE"]; + for ($j = 0; $j < sizeof ($choices); $j++) { $subquestion = NULL; - $choice = $choices[$j]["#"]["TEXT"][0]["#"]; - $choice_id = $choices[$j]["@"]["id"]; + $choice = $choices[$j]["#"]["TEXT"][0]["#"]; + $choice_id = $choices[$j]["@"]["id"]; $question->subanswers[] = addslashes(trim($choice)); - $correctanswers = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"]; - for ($k = 0; $k < sizeof ($correctanswers); $k++) { + $correctanswers = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"]; + for ($k = 0; $k < sizeof ($correctanswers); $k++) { - if (strcmp($choice_id, $correctanswers[$k]["@"]["choice_id"]) == 0) { + if (strcmp($choice_id, $correctanswers[$k]["@"]["choice_id"]) == 0) { - $answer_id = $correctanswers[$k]["@"]["answer_id"]; + $answer_id = $correctanswers[$k]["@"]["answer_id"]; - $answers = $thisquestion["#"]["ANSWER"]; - for ($m = 0; $m < sizeof ($answers); $m++) { + $answers = $thisquestion["#"]["ANSWER"]; + for ($m = 0; $m < sizeof ($answers); $m++) { - $answer = $answers[$m]; - $current_ans_id = $answer["@"]["id"]; - if (strcmp ($current_ans_id, $answer_id) == 0) { + $answer = $answers[$m]; + $current_ans_id = $answer["@"]["id"]; + if (strcmp ($current_ans_id, $answer_id) == 0) { - $answer = $answer["#"]["TEXT"][0]["#"]; + $answer = $answer["#"]["TEXT"][0]["#"]; $question->subquestions[] = addslashes(trim($answer)); - break; + break; - } + } - } + } - break; + break; - } + } - } + } - } + } - $questions[] = $question; + $questions[] = $question; - } + } } ?> diff --git a/question/format/blackboard_6/format.php b/question/format/blackboard_6/format.php index af27295652..1ae814c15e 100644 --- a/question/format/blackboard_6/format.php +++ b/question/format/blackboard_6/format.php @@ -518,9 +518,9 @@ function process_tf($quest, &$questions) { $question->qtype = TRUEFALSE; $question->defaultgrade = 1; - $question->single = 1; // Only one answer is allowed - $question->image = ""; // No images with this format - $question->questiontext = addslashes($quest->QUESTION_BLOCK->text); + $question->single = 1; // Only one answer is allowed + $question->image = ""; // No images with this format + $question->questiontext = addslashes($quest->QUESTION_BLOCK->text); // put name in question object $question->name = $question->questiontext; @@ -679,8 +679,8 @@ function process_ma($quest, &$questions) { $question->name = $question->questiontext; $question->qtype = MULTICHOICE; $question->defaultgrade = 1; - $question->single = 0; // More than one answers allowed - $question->image = ""; // No images with this format + $question->single = 0; // More than one answers allowed + $question->image = ""; // No images with this format $answers = $quest->responses; $correct_answers = array(); @@ -727,8 +727,8 @@ function process_essay($quest, &$questions) { // treat as short answer $question->qtype = ESSAY; $question->defaultgrade = 1; - $question->usecase = 0; // Ignore case - $question->image = ""; // No images with this format + $question->usecase = 0; // Ignore case + $question->image = ""; // No images with this format $question->questiontext = addslashes(trim($quest->QUESTION_BLOCK->text)); $question->name = $question->questiontext; diff --git a/question/format/examview/format.php b/question/format/examview/format.php index f7cdbef7fd..d6e6e18348 100755 --- a/question/format/examview/format.php +++ b/question/format/examview/format.php @@ -6,11 +6,14 @@ ** ** @TODO: ** Take care of odd unicode character mapping (ex: curly quotes) -** Image and table support +** Image and table support ** Formatting support ** Support of rejoinders ** ** $Log$ +** Revision 1.4 2006/08/10 18:23:39 tjhunt +** Convert tabs to spaces. +** ** Revision 1.3 2006/05/04 11:17:50 thepurpleblob ** Merging from STABLE ** @@ -139,37 +142,37 @@ class qformat_examview extends qformat_default { } foreach($this->matching_questions as $match_group) { $question = $this->defaultquestion(); - $htmltext = $this->htmlPrepare($match_group->questiontext); - $htmltext = addslashes($htmltext); + $htmltext = $this->htmlPrepare($match_group->questiontext); + $htmltext = addslashes($htmltext); $question->questiontext = $htmltext; $question->name = $question->questiontext; $question->qtype = MATCH; // No images with this format - // print($question->questiontext.' '.$question->id."
"); + // print($question->questiontext.' '.$question->id."
"); $question->subquestions = array(); $question->subanswers = array(); foreach($match_group->subquestions as $key => $value) { - $htmltext = $this->htmlPrepare($value); - $htmltext = addslashes($htmltext); + $htmltext = $this->htmlPrepare($value); + $htmltext = addslashes($htmltext); $question->subquestions[] = $htmltext; $htmltext = $this->htmlPrepare($match_group->subanswers[$key]); - $htmltext = addslashes($htmltext); + $htmltext = addslashes($htmltext); $question->subanswers[] = $htmltext; } $questions[] = $question; } } - // cleans unicode characters from string - // add to the array unicode_array as necessary - function cleanUnicode($text) { - //$unicode_array = array( "ߣ" => "'"); - //return strtr($text, $unicode_array); - return str_replace('’', "'", $text); - } - + // cleans unicode characters from string + // add to the array unicode_array as necessary + function cleanUnicode($text) { + //$unicode_array = array("ߣ" => "'"); + //return strtr($text, $unicode_array); + return str_replace('’', "'", $text); + } + function readquestions($lines) { /// Parses an array of lines into an array of questions, @@ -180,7 +183,7 @@ class qformat_examview extends qformat_default { $currentquestion = array(); $text = implode($lines, ' '); - $text = $this->cleanUnicode($text); + $text = $this->cleanUnicode($text); $xml = xmlize($text, 0); $this->parse_matching_groups($xml['examview']['#']['matching-group']); diff --git a/question/format/gift/format.php b/question/format/gift/format.php index 509e5ec020..6be1cd5ca9 100755 --- a/question/format/gift/format.php +++ b/question/format/gift/format.php @@ -269,9 +269,9 @@ class qformat_gift extends qformat_default { $countanswers = count($answers); - if (!$this->check_answer_count( 2,$answers,$text )) { - return false; - break; + if (!$this->check_answer_count( 2,$answers,$text )) { + return false; + break; } foreach ($answers as $key => $answer) { @@ -307,9 +307,9 @@ class qformat_gift extends qformat_default { array_shift($answers); } - if (!$this->check_answer_count( 2,$answers,$text )) { - return false; - break; + if (!$this->check_answer_count( 2,$answers,$text )) { + return false; + break; } foreach ($answers as $key => $answer) { @@ -364,9 +364,9 @@ class qformat_gift extends qformat_default { array_shift($answers); } - if (!$this->check_answer_count( 1,$answers,$text )) { - return false; - break; + if (!$this->check_answer_count( 1,$answers,$text )) { + return false; + break; } foreach ($answers as $key => $answer) { diff --git a/question/format/learnwise/format.php b/question/format/learnwise/format.php index 8834055d2d..1f3971374f 100755 --- a/question/format/learnwise/format.php +++ b/question/format/learnwise/format.php @@ -15,16 +15,16 @@ class qformat_learnwise extends qformat_default { function readquestions($lines) { $questions = array(); $currentquestion = array(); - + foreach($lines as $line) { $line = trim($line); $currentquestion[] = $line; - + if ($question = $this->readquestion($currentquestion)) { $questions[] = $question; $currentquestion = array(); } - } + } return $questions; } @@ -100,7 +100,7 @@ class qformat_learnwise extends qformat_default { $question->questiontext = $questiontext; $question->single = ($type == 'multichoice') ? 1 : 0; $question->feedback[] = ''; - + $question->fraction = array(); $question->answer = array(); for ($n = 0; $n < count($optionstext); ++$n) { @@ -130,7 +130,7 @@ class qformat_learnwise extends qformat_default { function stringbetween($text, $start, $end) { $startpos = strpos($text, $start) + strlen($start); $endpos = strpos($text, $end); - + if ($startpos <= $endpos) { return substr($text, $startpos, $endpos - $startpos); } diff --git a/question/format/qti2/format.php b/question/format/qti2/format.php index 6c5c2e0ee5..208e39c178 100644 --- a/question/format/qti2/format.php +++ b/question/format/qti2/format.php @@ -305,8 +305,8 @@ function handle_questions_media(&$questions, $path, $courseid) { // zip files into single export file zip_files( array($path), "$path.zip" ); - // remove the temporary directory - remove_dir( $path ); + // remove the temporary directory + remove_dir( $path ); return true; } @@ -548,7 +548,7 @@ function xml_entitize(&$collection) { $answers = $this->shuffle_things($answers); } - if (isset($question->response)) { + if (isset($question->response)) { $correctresponseid = $question->response[$questionid]; if ($answers[0]['id'] == $correctresponseid) { $correctresponse = $answers[0]; -- 2.39.5