From: Petr Skoda restore response $responses ||
', false);
- }
+ }
//-------------------------------------------------------------------------------
$mform->addElement('header', 'preferencesuser', get_string('preferencesuser', 'quiz_overview'));
@@ -54,4 +54,4 @@ class mod_quiz_report_overview_settings extends moodleform {
$this->add_action_buttons(false, get_string('preferencessave', 'quiz_overview'));
}
}
-?>
+
diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php
index 2f21b1b7a7..2fb9174b04 100644
--- a/mod/quiz/report/overview/report.php
+++ b/mod/quiz/report/overview/report.php
@@ -2,7 +2,6 @@
/**
* This script lists student attempts
*
- * @version $Id$
* @author Martin Dougiamas, Tim Hunt and others.
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package quiz
@@ -32,7 +31,7 @@ class quiz_overview_report extends quiz_default_report {
$showgrades = quiz_has_grades($quiz) && $reviewoptions->scores;
$download = optional_param('download', '', PARAM_ALPHA);
-
+
/// find out current groups mode
$currentgroup = groups_get_activity_group($cm, true);
if (!$students = get_users_by_capability($this->context, array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'),'','','','','','',false)){
@@ -54,7 +53,7 @@ class quiz_overview_report extends quiz_default_report {
}
$allowed = $groupstudents;
}
-
+
if (empty($currentgroup)||$groupstudents) {
if (optional_param('delete', 0, PARAM_BOOL)){
if($attemptids = optional_param('attemptid', array(), PARAM_INT)) {
@@ -129,7 +128,7 @@ class quiz_overview_report extends quiz_default_report {
} else if ($attemptsmode === null){
//default
$attemptsmode = QUIZ_REPORT_ATTEMPTS_ALL;
- }
+ }
if (!$reviewoptions->scores) {
$detailedmarks = 0;
}
@@ -162,7 +161,7 @@ class quiz_overview_report extends quiz_default_report {
// Only print headers if not asked to download data
$this->print_header_and_tabs($cm, $course, $quiz, "overview");
}
-
+
if ($regradeall){
$this->regrade_all(false, $quiz, $groupstudents);
} else if ($regradealldry){
@@ -173,14 +172,14 @@ class quiz_overview_report extends quiz_default_report {
if ($regradeall || $regradealldry || $regradealldrydo){
redirect($reporturl->out(false, $displayoptions, false), '', 5);
}
-
+
if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used
if (!$table->is_downloading()) {
groups_print_activity_menu($cm, $reporturl->out(false, $displayoptions));
}
}
-
+
// Print information on the number of existing attempts
if (!$table->is_downloading()) { //do not print notices when downloading
if ($strattemptnum = quiz_num_attempt_summary($quiz, $cm, true, $currentgroup)) {
@@ -200,14 +199,14 @@ class quiz_overview_report extends quiz_default_report {
$mform->set_data($displayoptions +compact('detailedmarks', 'pagesize'));
$mform->display();
}
-
-
+
+
if (!$nostudents || ($attemptsmode == QUIZ_REPORT_ATTEMPTS_ALL)){
-
-
-
+
+
+
// Construct the SQL
$fields = $DB->sql_concat('u.id', '\'#\'', 'COALESCE(qa.attempt, \'0\')').' AS uniqueid, ';
if ($qmsubselect) {
@@ -217,7 +216,7 @@ class quiz_overview_report extends quiz_default_report {
" ELSE 0 " .
"END) AS gradedattempt, ";
}
-
+
$fields .='qa.uniqueid AS attemptuniqueid, qa.id AS attempt, ' .
'u.id AS userid, u.idnumber, u.firstname, u.lastname, u.picture, u.imagealt, '.
'qa.sumgrades, qa.timefinish, qa.timestart, qa.timefinish - qa.timestart AS duration ';
@@ -226,7 +225,7 @@ class quiz_overview_report extends quiz_default_report {
$from = '{user} u ';
$from .= 'LEFT JOIN {quiz_attempts} qa ON qa.userid = u.id AND qa.quiz = :quizid';
$params = array('quizid' => $quiz->id);
-
+
if ($qmsubselect && $qmfilter){
$from .= ' AND '.$qmsubselect;
}
@@ -254,7 +253,7 @@ class quiz_overview_report extends quiz_default_report {
$where = "u.id $allowed_usql AND (qa.preview = 0 OR qa.preview IS NULL)";
break;
}
-
+
$table->set_count_sql("SELECT COUNT(1) FROM $from WHERE $where", $params);
$sqlobject = new object;
@@ -272,7 +271,7 @@ class quiz_overview_report extends quiz_default_report {
$where .= ' AND COALESCE((SELECT MAX(qqr.regraded) FROM {quiz_question_regrade} qqr WHERE qqr.attemptid = qa.uniqueid),-1) !=\'-1\'';
}
$table->set_sql($fields, $from, $where, $params);
-
+
// Define table columns
$columns = array();
$headers = array();
@@ -311,12 +310,12 @@ class quiz_overview_report extends quiz_default_report {
echo '
'),false);
- $mform->addRule('format',null,'required',null,'client');
+ $mform->addRule('format',null,'required',null,'client');
//--------------------------------------------------------------------------------
$mform->addElement('header','general', get_string('general', 'form'));
@@ -36,7 +36,7 @@ class question_export_form extends moodleform {
$mform->disabledIf('categorygroup', 'cattofile', 'notchecked');
$mform->setDefault('cattofile', 1);
$mform->setDefault('contexttofile', 1);
-
+
// $fileformatnames = get_import_export_formats('export');
// $mform->addElement('select', 'format', get_string('fileformat','quiz'), $fileformatnames);
@@ -47,7 +47,7 @@ class question_export_form extends moodleform {
$mform->setDefault('exportfilename', $defaultfilename);
$mform->setType('exportfilename', PARAM_FILE);
- // set a template for the format select elements
+ // set a template for the format select elements
$renderer =& $mform->defaultRenderer();
$template = "{help} {element}\n";
$renderer->setGroupElementTemplate($template, 'format');
@@ -57,4 +57,4 @@ class question_export_form extends moodleform {
//--------------------------------------------------------------------------------
}
}
-?>
+
diff --git a/question/exportfile.php b/question/exportfile.php
index 0b3261d875..c22fb4a45a 100644
--- a/question/exportfile.php
+++ b/question/exportfile.php
@@ -1,4 +1,4 @@
-libdir . '/filelib.php');
@@ -14,4 +14,4 @@
$pathname = $CFG->dataroot . '/temp/questionexport/' . $USER->id . '/' . $relativepath;
send_temp_file($pathname, $relativepath);
-?>
+
diff --git a/question/format.php b/question/format.php
index 74d40c8aa5..1a53ca1bbf 100644
--- a/question/format.php
+++ b/question/format.php
@@ -1,4 +1,4 @@
-
+
diff --git a/question/format/README.txt b/question/format/README.txt
index 677e9256a6..f2436d2cf3 100644
--- a/question/format/README.txt
+++ b/question/format/README.txt
@@ -1,19 +1,19 @@
FILE FORMATS FOR QUESTION IMPORT/EXPORT
------------------------------------
-This directory contains plug-in sub-modules to add
+This directory contains plug-in sub-modules to add
import-export formats for Moodle questions
-Each sub-module must contain at least a format.php file
-containing a class that contains functions for reading,
+Each sub-module must contain at least a format.php file
+containing a class that contains functions for reading,
writing, importing and exporting questions.
For correct operation the class name must be based on the
name of the containing directory, e.g.,
directory: webct
-class: class qformat_webct extends qformat_default {
+class: class qformat_webct extends qformat_default {
-Most of them are based on the class found in question/format.php.
+Most of them are based on the class found in question/format.php.
See the comments therein for more information.
diff --git a/question/format/aiken/format.php b/question/format/aiken/format.php
index cde6211dbe..f738938e56 100644
--- a/question/format/aiken/format.php
+++ b/question/format/aiken/format.php
@@ -1,4 +1,4 @@
-defaultquestion();
- $endchar = chr(13);
+ $endchar = chr(13);
foreach ($lines as $line) {
$stp = strpos($line, $endchar, 0);
$newlines = explode($endchar, $line);
@@ -105,4 +105,4 @@ class qformat_aiken extends qformat_default {
}
}
-?>
+
diff --git a/question/format/blackboard/format.php b/question/format/blackboard/format.php
index 45bcad8426..23fd4cd381 100644
--- a/question/format/blackboard/format.php
+++ b/question/format/blackboard/format.php
@@ -1,4 +1,4 @@
-defaultquestion();
-
+
$question->qtype = ESSAY;
-
+
// determine if the question is already escaped html
$ishtml = $essayquestion["#"]["BODY"][0]["#"]["FLAGS"][0]["#"]["ISHTML"][0]["@"]["value"];
@@ -68,13 +68,13 @@ function process_essay($xml, &$questions ) {
if ($ishtml) {
$question->questiontext = html_entity_decode_php4(trim($essayquestion["#"]["BODY"][0]["#"]["TEXT"][0]["#"]));
}
-
+
// put name in question object
$question->name = substr($question->questiontext, 0, 254);
$question->answer = '';
$question->feedback = '';
$question->fraction = 0;
-
+
$questions[] = $question;
}
}
@@ -92,7 +92,7 @@ function process_tf($xml, &$questions) {
}
for ($i = 0; $i < sizeof ($tfquestions); $i++) {
-
+
$question = $this->defaultquestion();
$question->qtype = TRUEFALSE;
@@ -250,7 +250,7 @@ function process_ma($xml, &$questions) {
}
}
- if ($iscorrect) {
+ if ($iscorrect) {
$question->fraction[$j] = floor(100000/$correctanswercount)/100000; // strange behavior if we have more than 5 decimal places
$question->feedback[$j] = trim($thisquestion["#"]["GRADABLE"][$j]["#"]["FEEDBACK_WHEN_CORRECT"][0]["#"]);
} else {
@@ -305,14 +305,14 @@ function process_fib($xml, &$questions) {
}
else {
$question->feedback[0] = '';
- }
+ }
if (is_array( $thisquestion["#"]["GRADABLE"][0]["#"] )) {
$question->feedback[1] = trim($thisquestion["#"]["GRADABLE"][0]["#"]["FEEDBACK_WHEN_INCORRECT"][0]["#"]);
}
else {
$question->feedback[1] = '';
- }
-
+ }
+
$questions[] = $question;
}
}
@@ -355,9 +355,9 @@ function process_matching($xml, &$questions) {
$choice = $choices[$j]["#"]["TEXT"][0]["#"];
$choice_id = $choices[$j]["@"]["id"];
-
+
$question->subanswers[] = trim($choice);
-
+
$correctanswers = $thisquestion["#"]["GRADABLE"][0]["#"]["CORRECTANSWER"];
for ($k = 0; $k < sizeof ($correctanswers); $k++) {
@@ -385,13 +385,13 @@ function process_matching($xml, &$questions) {
}
}
-
+
}
$questions[] = $question;
-
+
}
}
}
-?>
+
diff --git a/question/format/blackboard_six/format.php b/question/format/blackboard_six/format.php
index 1cf7e36942..202599495b 100644
--- a/question/format/blackboard_six/format.php
+++ b/question/format/blackboard_six/format.php
@@ -19,12 +19,12 @@ class qformat_blackboard_six extends qformat_default {
function provide_import() {
return true;
}
-
-
+
+
//Function to check and create the needed dir to unzip file to
function check_and_create_import_dir($unique_code) {
- global $CFG;
+ global $CFG;
$status = $this->check_dir_exists($CFG->dataroot."/temp",true);
if ($status) {
@@ -33,18 +33,18 @@ class qformat_blackboard_six extends qformat_default {
if ($status) {
$status = $this->check_dir_exists($CFG->dataroot."/temp/bbquiz_import/".$unique_code,true);
}
-
+
return $status;
}
-
+
function clean_temp_dir($dir='') {
- // for now we will just say everything happened okay note
+ // for now we will just say everything happened okay note
// that a mess may be piling up in $CFG->dataroot/temp/bbquiz_import
// TODO return true at top of the function renders all the following code useless
return true;
-
+
if ($dir == '') {
- $dir = $this->temp_dir;
+ $dir = $this->temp_dir;
}
$slash = "/";
@@ -94,16 +94,16 @@ class qformat_blackboard_six extends qformat_default {
// Close directory
closedir($handle);
if (rmdir($this->temp_dir) == FALSE) {
- return false;
+ return false;
}
// Success, every thing is gone return true
return true;
}
-
+
//Function to check if a directory exists and, optionally, create it
function check_dir_exists($dir,$create=false) {
- global $CFG;
+ global $CFG;
$status = true;
if(!is_dir($dir)) {
@@ -119,9 +119,9 @@ class qformat_blackboard_six extends qformat_default {
function importpostprocess() {
/// Does any post-processing that may be desired
- /// Argument is a simple array of question ids that
+ /// Argument is a simple array of question ids that
/// have just been added.
-
+
// need to clean up temporary directory
return $this->clean_temp_dir();
}
@@ -131,9 +131,9 @@ class qformat_blackboard_six extends qformat_default {
$filename = str_replace('\\','/',$filename);
$fullpath = $this->temp_dir.'/res00001/'.$filename;
$basename = basename($filename);
-
+
$copy_to = $CFG->dataroot.'/'.$COURSE->id.'/bb_import';
-
+
if ($this->check_dir_exists($copy_to,true)) {
if(is_readable($fullpath)) {
$copy_to.= '/'.$basename;
@@ -146,24 +146,24 @@ class qformat_blackboard_six extends qformat_default {
}
}
else {
- return false;
+ return false;
}
}
function readdata($filename) {
/// Returns complete file with an array, one item per line
global $CFG;
-
+
// if the extension is .dat we just return that,
// if .zip we unzip the file and get the data
- $ext = substr($this->realfilename, strpos($this->realfilename,'.'), strlen($this->realfilename)-1);
+ $ext = substr($this->realfilename, strpos($this->realfilename,'.'), strlen($this->realfilename)-1);
if ($ext=='.dat') {
if (!is_readable($filename)) {
- print_error('filenotreadable', 'error');
- }
+ print_error('filenotreadable', 'error');
+ }
return file($filename);
- }
-
+ }
+
$unique_code = time();
$temp_dir = $CFG->dataroot."/temp/bbquiz_import/".$unique_code;
$this->temp_dir = $temp_dir;
@@ -188,33 +188,33 @@ class qformat_blackboard_six extends qformat_default {
}
}
else {
- print_error('cannotfindquestionfile', 'questioni');
+ print_error('cannotfindquestionfile', 'questioni');
}
}
else {
print "filename: $filename
tempdir: $temp_dir
";
- print_error('cannotunzip', 'question');
+ print_error('cannotunzip', 'question');
}
}
else {
- print_error('cannotreaduploadfile');
+ print_error('cannotreaduploadfile');
}
}
else {
- print_error('cannotcreatetempdir');
+ print_error('cannotcreatetempdir');
}
}
-
+
function save_question_options($question) {
- return true;
+ return true;
}
-
-
-
+
+
+
function readquestions ($lines) {
/// Parses an array of lines into an array of questions,
/// where each item is a question object as defined by
- /// readquestion().
+ /// readquestion().
$text = implode($lines, " ");
$xml = xmlize($text, 0);
@@ -260,14 +260,14 @@ class qformat_blackboard_six extends qformat_default {
// creates a cleaner object to deal with for processing into moodle
// the object created is NOT a moodle question object
function create_raw_question($quest) {
-
+
$question = new StdClass;
$question->qtype = $quest['#']['itemmetadata'][0]['#']['bbmd_questiontype'][0]['#'];
$question->id = $quest['#']['itemmetadata'][0]['#']['bbmd_asi_object_id'][0]['#'];
$presentation->blocks = $quest['#']['presentation'][0]['#']['flow'][0]['#']['flow'];
foreach($presentation->blocks as $pblock) {
-
+
$block = NULL;
$block->type = $pblock['@']['class'];
@@ -276,7 +276,7 @@ function create_raw_question($quest) {
$sub_blocks = $pblock['#']['flow'];
foreach($sub_blocks as $sblock) {
//echo "Calling process_block from line 263
";
- $this->process_block($sblock, $block);
+ $this->process_block($sblock, $block);
}
break;
@@ -314,7 +314,7 @@ function create_raw_question($quest) {
foreach($mc_choices as $mc_choice) {
$choices = NULL;
$choices = $this->process_block($mc_choice, $choices);
- $block->choices[] = $choices;
+ $block->choices[] = $choices;
}
break;
case 'Short Response':
@@ -348,8 +348,8 @@ function create_raw_question($quest) {
}
$question->{$block->type} = $block;
}
-
- // determine response processing
+
+ // determine response processing
// there is a section called 'outcomes' that I don't know what to do with
$resprocessing = $quest['#']['resprocessing'];
$respconditions = $resprocessing[0]['#']['respcondition'];
@@ -374,11 +374,11 @@ function process_block($cur_block, &$block) {
$cur_type = $cur_block['@']['class'];
switch($cur_type) {
case 'FORMATTED_TEXT_BLOCK':
- $block->text = $this->strip_applet_tags_get_mathml($cur_block['#']['material'][0]['#']['mat_extension'][0]['#']['mat_formattedtext'][0]['#']);
+ $block->text = $this->strip_applet_tags_get_mathml($cur_block['#']['material'][0]['#']['mat_extension'][0]['#']['mat_formattedtext'][0]['#']);
break;
case 'FILE_BLOCK':
//revisit this to make sure it is working correctly
- // Commented out ['matapplication']..., etc. because I
+ // Commented out ['matapplication']..., etc. because I
// noticed that when I imported a new Blackboard 6 file
// and printed out the block, the tree did not extend past ['material'][0]['#'] - CT 8/3/06
$block->file = $cur_block['#']['material'][0]['#'];//['matapplication'][0]['@']['uri'];
@@ -404,7 +404,7 @@ function process_block($cur_block, &$block) {
}
}
foreach($sub_blocks['#']['flow_mat'] as $sub_block) {
- $this->process_block($sub_block, $block);
+ $this->process_block($sub_block, $block);
}
}
else {
@@ -430,8 +430,8 @@ function process_block($cur_block, &$block) {
else {
$block->link = '';
}
- break;
- }
+ break;
+ }
return $block;
}
@@ -448,18 +448,18 @@ function process_choices($bb_choices, &$choices) {
// Reset $cur_choice to NULL because process_block is expecting an object
// for the second argument and not a string, which is what is was set as
// originally - CT 8/7/06
- $cur_choice = null;
+ $cur_choice = null;
$this->process_block($cur_block, $cur_choice);
}
elseif (isset($choice['#']['response_label'])) {
// Reset $cur_choice to NULL because process_block is expecting an object
// for the second argument and not a string, which is what is was set as
// originally - CT 8/7/06
- $cur_choice = null;
+ $cur_choice = null;
$this->process_block($choice, $cur_choice);
}
$choices[] = $cur_choice;
- }
+ }
}
function process_matching_responses($bb_responses, &$responses) {
@@ -485,30 +485,30 @@ function process_responses($bb_responses, &$responses) {
// gets added to the array
$response = null;
if (isset($bb_response['@']['title'])) {
- $response->title = $bb_response['@']['title'];
+ $response->title = $bb_response['@']['title'];
}
else {
$reponse->title = $bb_response['#']['displayfeedback'][0]['@']['linkrefid'];
}
$reponse->ident = array();
if (isset($bb_response['#']['conditionvar'][0]['#'])){//['varequal'][0]['#'])) {
- $response->ident[0] = $bb_response['#']['conditionvar'][0]['#'];//['varequal'][0]['#'];
+ $response->ident[0] = $bb_response['#']['conditionvar'][0]['#'];//['varequal'][0]['#'];
}
else if (isset($bb_response['#']['conditionvar'][0]['#']['other'][0]['#'])) {
- $response->ident[0] = $bb_response['#']['conditionvar'][0]['#']['other'][0]['#'];
+ $response->ident[0] = $bb_response['#']['conditionvar'][0]['#']['other'][0]['#'];
}
-
+
if (isset($bb_response['#']['conditionvar'][0]['#']['and'])){//[0]['#'])) {
$responseset = $bb_response['#']['conditionvar'][0]['#']['and'];//[0]['#']['varequal'];
foreach($responseset as $rs) {
$response->ident[] = $rs['#'];
if(!isset($response->feedback) and isset( $rs['@'] ) ) {
$response->feedback = $rs['@']['respident'];
- }
+ }
}
}
else {
- $response->feedback = $bb_response['#']['displayfeedback'][0]['@']['linkrefid'];
+ $response->feedback = $bb_response['#']['displayfeedback'][0]['@']['linkrefid'];
}
// determine what point value to give response
@@ -518,7 +518,7 @@ function process_responses($bb_responses, &$responses) {
$response->fraction = 1;
break;
default:
- // I have only seen this being 0 or unset
+ // I have only seen this being 0 or unset
// there are probably fractional values of SCORE.max, but I'm not sure what they look like
$response->fraction = 0;
break;
@@ -528,7 +528,7 @@ function process_responses($bb_responses, &$responses) {
// just going to assume this is the case this is probably not correct.
$response->fraction = 0;
}
-
+
$responses[] = $response;
}
}
@@ -537,7 +537,7 @@ function process_feedback($feedbackset, &$feedbacks) {
foreach($feedbackset as $bb_feedback) {
// Added line $feedback=null so that $feedback does not get reused in the loop
// and added the the $feedbacks[] array multiple times
- $feedback = null;
+ $feedback = null;
$feedback->ident = $bb_feedback['@']['ident'];
if (isset($bb_feedback['#']['flow_mat'][0])) {
$this->process_block($bb_feedback['#']['flow_mat'][0], $feedback);
@@ -572,16 +572,16 @@ function process_tf($quest, &$questions) {
$responses = $quest->responses;
$correctresponse = $responses[0]->ident[0]['varequal'][0]['#'];
if ($correctresponse != 'false') {
- $correct = true;
+ $correct = true;
}
else {
- $correct = false;
+ $correct = false;
}
-
+
foreach($quest->feedback as $fb) {
- $fback->{$fb->ident} = $fb->text;
+ $fback->{$fb->ident} = $fb->text;
}
-
+
if ($correct) { // true is correct
$question->answer = 1;
$question->feedbacktrue = $fback->correct;
@@ -607,7 +607,7 @@ function process_fblank($quest, &$questions) {
$answers = array();
$fractions = array();
$feedbacks = array();
-
+
// extract the feedback
$feedback = array();
foreach($quest->feedback as $fback) {
@@ -617,7 +617,7 @@ function process_fblank($quest, &$questions) {
}
}
}
-
+
foreach($quest->responses as $response) {
if(isset($response->title)) {
if (isset($response->ident[0]['varequal'][0]['#'])) {
@@ -633,11 +633,11 @@ function process_fblank($quest, &$questions) {
}
}
}
-
+
}
}
- //Adding catchall to so that students can see feedback for incorrect answers when they enter something the
+ //Adding catchall to so that students can see feedback for incorrect answers when they enter something the
//instructor did not enter
$answers[] = '*';
$fractions[] = 0;
@@ -647,7 +647,7 @@ function process_fblank($quest, &$questions) {
else {
$feedbacks[] = '';
}
-
+
$question->answer = $answers;
$question->fraction = $fractions;
$question->feedback = $feedbacks; // Changed to assign $feedbacks to $question->feedback instead of
@@ -665,12 +665,12 @@ function process_mc($quest, &$questions) {
$question = $this->process_common( $quest );
$question->qtype = MULTICHOICE;
$question->single = 1;
-
+
$feedback = array();
foreach($quest->feedback as $fback) {
$feedback[$fback->ident] = $fback->text;
}
-
+
foreach($quest->responses as $response) {
if (isset($response->title)) {
if ($response->title == 'correct') {
@@ -703,9 +703,9 @@ function process_mc($quest, &$questions) {
}
else {
// failsafe feedback (should be '' instead?)
- $question->feedback[$i] = "correct";
+ $question->feedback[$i] = "correct";
}
- }
+ }
else {
$question->fraction[$i] = 0;
if (!empty($feedback['incorrect'])) {
@@ -745,11 +745,11 @@ function process_ma($quest, &$questions) {
}
}
}
-
+
foreach ($quest->feedback as $fb) {
$feedback->{$fb->ident} = trim($fb->text);
}
-
+
$correct_answer_count = count($correct_answers);
$choiceset = $quest->RESPONSE_BLOCK->choices;
$i = 0;
@@ -761,7 +761,7 @@ function process_ma($quest, &$questions) {
$question->feedback[$i] = $feedback->correct;
}
else {
- // wrong answer
+ // wrong answer
$question->fraction[$i] = 0;
$question->feedback[$i] = $feedback->incorrect;
}
@@ -781,7 +781,7 @@ function process_essay($quest, &$questions) {
// treat as short answer
$question = $this->process_common( $quest ); // copied this from process_mc
$question->qtype = ESSAY;
-
+
$question->feedback = array();
// not sure where to get the correct answer from
foreach($quest->feedback as $feedback) {
@@ -791,9 +791,9 @@ function process_essay($quest, &$questions) {
$question->feedback = $feedback->text;
}
}
- //Added because essay/questiontype.php:save_question_option is expecting a
+ //Added because essay/questiontype.php:save_question_option is expecting a
//fraction property - CT 8/10/06
- $question->fraction[] = 1;
+ $question->fraction[] = 1;
if (!empty($question)) {
$questions[]=$question;
}
@@ -815,15 +815,15 @@ function process_matching($quest, &$questions) {
$question = $this->process_common( $quest );
$question->valid = true;
$question->qtype = 'renderedmatch';
-
+
foreach($quest->RESPONSE_BLOCK->subquestions as $qid => $subq) {
foreach($quest->responses as $rid => $resp) {
if ($resp->ident == $subq->ident) {
$correct = $resp->correct;
- $feedback = $resp->feedback;
+ $feedback = $resp->feedback;
}
}
-
+
foreach($subq->choices as $cid => $choice) {
if ($choice == $correct) {
$question->subquestions[] = $subq->text;
@@ -831,7 +831,7 @@ function process_matching($quest, &$questions) {
}
}
}
-
+
// check format
$status = true;
if ( count($quest->RESPONSE_BLOCK->subquestions) > count($quest->RIGHT_MATCH_BLOCK->matching_answerset) || count($question->subquestions) < 2) {
@@ -842,24 +842,24 @@ function process_matching($quest, &$questions) {
foreach($question->subanswers as $qstn) {
if(isset($previous)) {
if ($qstn == $previous) {
- $status = false;
- }
+ $status = false;
+ }
}
$previous = $qstn;
if ($qstn == '') {
- $status = false;
+ $status = false;
}
}
}
-
+
if ($status) {
- $questions[] = $question;
+ $questions[] = $question;
}
else {
global $COURSE, $CFG;
print '
- type = $wrapped->qtype ;
+ $a->type = $wrapped->qtype ;
$a->sub = $positionkey;
print_error('unknownquestiontypeofsubquestion', 'qtype_multianswer','',$a);
break;
@@ -654,7 +654,7 @@ class embedded_cloze_qtype extends default_questiontype {
}
return $responses;
}
-
+
/**
* @param object $question
* @return mixed either a integer score out of 1 that the average random
diff --git a/question/type/multianswer/version.php b/question/type/multianswer/version.php
index 6d0f10af81..3185c4892f 100644
--- a/question/type/multianswer/version.php
+++ b/question/type/multianswer/version.php
@@ -1,6 +1,6 @@
-version = 2008050800;
$plugin->requires = 2007101509;
-?>
+
diff --git a/question/type/multichoice/db/upgrade.php b/question/type/multichoice/db/upgrade.php
index 04087a1bc8..501af6ce8c 100644
--- a/question/type/multichoice/db/upgrade.php
+++ b/question/type/multichoice/db/upgrade.php
@@ -1,6 +1,6 @@
-libdir . '/questionlib.php');
// Get all categories containing random questions.
@@ -56,4 +56,4 @@ function xmldb_qtype_multichoice_upgrade($oldversion) {
return $result;
}
-?>
+
diff --git a/question/type/multichoice/edit_multichoice_form.php b/question/type/multichoice/edit_multichoice_form.php
index f8c9661c63..3e1c056af5 100644
--- a/question/type/multichoice/edit_multichoice_form.php
+++ b/question/type/multichoice/edit_multichoice_form.php
@@ -1,4 +1,4 @@
-
\ No newline at end of file
diff --git a/question/type/multichoice/questiontype.php b/question/type/multichoice/questiontype.php
index 8fd8eb12e3..856b59af9a 100644
--- a/question/type/multichoice/questiontype.php
+++ b/question/type/multichoice/questiontype.php
@@ -1,4 +1,4 @@
-format_text($response, $format);
}
@@ -712,4 +712,4 @@ class question_multichoice_qtype extends default_questiontype {
// Register this question type with the question bank.
question_register_questiontype(new question_multichoice_qtype());
-?>
+
diff --git a/question/type/multichoice/version.php b/question/type/multichoice/version.php
index c52c71debb..0d354e821d 100644
--- a/question/type/multichoice/version.php
+++ b/question/type/multichoice/version.php
@@ -1,6 +1,6 @@
-version = 2009021800;
$plugin->requires = 2007101000;
-?>
+
diff --git a/question/type/numerical/db/upgrade.php b/question/type/numerical/db/upgrade.php
index 930f91cfb1..f6d8946455 100644
--- a/question/type/numerical/db/upgrade.php
+++ b/question/type/numerical/db/upgrade.php
@@ -1,6 +1,6 @@
-table_exists($table)) {
// $dbman->create_table doesnt return a result, we just have to trust it
$dbman->create_table($table);
- }//else
+ }//else
upgrade_plugin_savepoint($result, 2009100100, 'qtype', 'numerical');
}
return $result;
}
-?>
+
diff --git a/question/type/numerical/display.html b/question/type/numerical/display.html
index 678b788aa2..ab34b86f34 100644
--- a/question/type/numerical/display.html
+++ b/question/type/numerical/display.html
@@ -1,17 +1,17 @@
-name_prefix."unit\"";
$nameanswer = "name=\"".$question->name_prefix."answer\"";
-//if left unit is placed before answer so we need to answer field text and a center pice for the show units options
+//if left unit is placed before answer so we need to answer field text and a center pice for the show units options
// split the respnse in 2 element numerical and units
/*if (!empty($question->options->showunits)){
if(isset($question->options->units) && count($question->options->units)){
$length = 0;
$goodkey = 0 ;
foreach ($question->options->units as $key => $unit){
- if (false === stripos($value, $unit->unit)){
+ if (false === stripos($value, $unit->unit)){
}else{
-
+
if(strlen($unit->unit)> $length) {$length =strlen($unit->unit);
$goodkey = $key ;
}
@@ -22,7 +22,7 @@
}
$state->responses['unit']=$goodkey ;
@@ -576,16 +576,16 @@ class embedded_cloze_qtype extends default_questiontype {
-options->units as $key => $unit) {
+options->units as $key => $unit) {
$checked = '';
$chosen = false;
-
+
$type = 'type="radio"';
// $nameunit = "name=\"".$question->name_prefix;//."unit\"";
if (isset($state->responses['unit'])){
@@ -141,8 +141,8 @@
$checked = 'checked="checked"';
$chosen = true;
}
-
- $aid = $question->id ;
+
+ $aid = $question->id ;
$a = new stdClass;
$a->id = $question->name_prefix."unit" ;//. "2"
$a->class = '';
@@ -181,15 +181,15 @@
-
- ";print_r($state);echo "
test response numerical state before apply
";print_r($state);echo ""; - + $response = $this->apply_unit($state->responses[''], $question->options->units); // $this->valid_numerical_unit = $this->valid_unit($state->responses[''], $question->options->units); - // if ($this->valid_numerical_unit) echo "
test responses valid unit
"; - // if (!$this->valid_numerical_unit) echo "test responses not valid unit
"; + // if ($this->valid_numerical_unit) echo "test responses valid unit
"; + // if (!$this->valid_numerical_unit) echo "test responses not valid unit
"; // echo "state response test $response
";print_r($state);echo ""; // $this->raw_unitpenalty = 0.1 ; @@ -458,17 +457,17 @@ class question_numerical_qtype extends question_shortanswer_qtype { // first one that matches. It also sets the marks and penalty. // This should be good enought for most simple question types. // echo "
grade responses
";print_r($state->responses);echo ""; - - //first the split response from unit choice display is converted as + + //first the split response from unit choice display is converted as // standard numerical response value.unit /* if (!empty($question->options->showunits) && isset($state->responses['unit'])){ $state->responses[''] .= $question->options->units[$state->responses['unit']]->unit ; } - */ + */ //to apply the unit penalty we need to analyse the response in a more complex way //the apply_unit() function analysis could be used to obtain the infos - // however it is used to detect good or bad numbers but also - // gives false + // however it is used to detect good or bad numbers but also + // gives false $state->raw_grade = 0; foreach($question->options->answers as $answer) { if($this->test_response($question, $state, $answer)) { @@ -482,8 +481,8 @@ class question_numerical_qtype extends question_shortanswer_qtype { break; } } - // if ($this->valid_numerical_unit) echo "
grade responses valid unit
"; - // if (!$this->valid_numerical_unit) echo "grade responses not valid unit
"; + // if ($this->valid_numerical_unit) echo "grade responses valid unit
"; + // if (!$this->valid_numerical_unit) echo "grade responses not valid unit
"; // apply unit penalty $this->raw_unitpenalty = 0 ; if(!empty($question->options->unitpenalty)&& !$this->valid_numerical_unit ){ @@ -510,8 +509,8 @@ class question_numerical_qtype extends question_shortanswer_qtype { return true; } - - + + function get_correct_responses(&$question, &$state) { $correct = parent::get_correct_responses($question, $state); $unit = $this->get_default_numerical_unit($question); @@ -519,7 +518,7 @@ class question_numerical_qtype extends question_shortanswer_qtype { if (isset($correct['']) && $correct[''] != '*' && $unit) { $correct[''] .= ' '.$unit->unit; $correct['unit']= $unit->unit; - } + } return $correct; } @@ -551,17 +550,17 @@ class question_numerical_qtype extends question_shortanswer_qtype { } function get_actual_response($question, $state) { // echo "state response numerical GET ACTUAL RESPONSE $question->id $question->qtype
";print_r($state);echo ""; - if (!empty($state->responses) && !empty($state->responses[''])) { + if (!empty($state->responses) && !empty($state->responses[''])) { if(false === strpos($state->responses[''], '|||||')){ $responses[] = $state->responses['']; }else { $resp = explode('|||||', $state->responses['']); - $responses[] = $resp[0].$resp[1]; + $responses[] = $resp[0].$resp[1]; } } else { $responses[] = ''; } - + return $responses; } @@ -647,7 +646,7 @@ class question_numerical_qtype extends question_shortanswer_qtype { // Valid number with unit. return (float)$responseparts[1] / $tmpunits[$responseparts[5]]; } else { - // Valid number with invalid unit. + // Valid number with invalid unit. return (float)$responseparts[1]; } @@ -662,7 +661,7 @@ class question_numerical_qtype extends question_shortanswer_qtype { function edit_numerical_options(&$mform, &$that){ $mform->addElement('header', 'unithandling', get_string("Units handling", 'qtype_numerical')); $currentgrp1 = array(); - + $currentgrp1[] =& $mform->createElement('text', 'unitpenalty', get_string('Penalty for bad unit', 'qtype_numerical') , array('size' => 3)); $currentgrp1[] =& $mform->createElement('static', 'penalty1','hello', get_string('as decimal fraction (0-1) of', 'qtype_numerical')); @@ -691,16 +690,16 @@ class question_numerical_qtype extends question_shortanswer_qtype { $mform->setType('instructions', PARAM_RAW); $mform->setHelpButton('instructions', array('instructions', get_string('instructions', 'quiz'), 'quiz')); - + } function print_question_grading_details(&$question, &$state, $cmoptions, $options) { // echo "
state uestion_grading_details $question->id $question->qtype
";print_r($state);echo ""; parent::print_question_grading_details($question, $state, $cmoptions, $options); - - } - + + } + function valid_unit($rawresponse, $units) { // Make units more useful $tmpunits = array(); @@ -877,4 +876,4 @@ class question_numerical_qtype extends question_shortanswer_qtype { // INITIATION - Without this line the question type is not in use. question_register_questiontype(new question_numerical_qtype()); -?> + diff --git a/question/type/numerical/simpletest/testquestiontype.php b/question/type/numerical/simpletest/testquestiontype.php index f425c033b6..24f2346a48 100644 --- a/question/type/numerical/simpletest/testquestiontype.php +++ b/question/type/numerical/simpletest/testquestiontype.php @@ -1,4 +1,4 @@ - + diff --git a/question/type/numerical/version.php b/question/type/numerical/version.php index c033bef16b..168f4ff99c 100644 --- a/question/type/numerical/version.php +++ b/question/type/numerical/version.php @@ -1,6 +1,6 @@ -version = 2009100100; $plugin->requires = 2007101000; -?> + diff --git a/question/type/question.html b/question/type/question.html index 3ba083bad5..f59ebe8bf3 100644 --- a/question/type/question.html +++ b/question/type/question.html @@ -1,5 +1,5 @@ - diff --git a/question/type/questiontype.php b/question/type/questiontype.php index e5d8a278fb..e683167d59 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -1,4 +1,4 @@ - + diff --git a/question/type/random/edit_random_form.php b/question/type/random/edit_random_form.php index e563d3ed75..35eddb91b7 100644 --- a/question/type/random/edit_random_form.php +++ b/question/type/random/edit_random_form.php @@ -1,4 +1,4 @@ -addElement('header', 'generalheader', get_string("general", 'form')); - $mform->addElement('questioncategory', 'category', get_string('category', 'quiz'), + $mform->addElement('questioncategory', 'category', get_string('category', 'quiz'), array('contexts' => $this->contexts->having_cap('moodle/question:useall'))); $mform->addElement('advcheckbox', 'questiontext', get_string("recurse", "quiz"), null, null, array(0, 1)); @@ -88,4 +88,3 @@ class question_edit_random_form extends question_edit_form { return 'random'; } } -?> \ No newline at end of file diff --git a/question/type/random/questiontype.php b/question/type/random/questiontype.php index 1af2884061..9fa059edfe 100644 --- a/question/type/random/questiontype.php +++ b/question/type/random/questiontype.php @@ -1,4 +1,4 @@ - + diff --git a/question/type/randomsamatch/db/upgrade.php b/question/type/randomsamatch/db/upgrade.php index dcefd68934..761e4a513c 100644 --- a/question/type/randomsamatch/db/upgrade.php +++ b/question/type/randomsamatch/db/upgrade.php @@ -1,6 +1,6 @@ -get_manager(); $result = true; -/// And upgrade begins here. For each one, you'll need one -/// block of code similar to the next one. Please, delete +/// And upgrade begins here. For each one, you'll need one +/// block of code similar to the next one. Please, delete /// this comment lines once this file start handling proper /// upgrade code. @@ -38,4 +38,4 @@ function xmldb_qtype_randomsamatch_upgrade($oldversion) { return $result; } -?> + diff --git a/question/type/randomsamatch/edit_randomsamatch_form.php b/question/type/randomsamatch/edit_randomsamatch_form.php index f6adcd72dd..24b9502e17 100644 --- a/question/type/randomsamatch/edit_randomsamatch_form.php +++ b/question/type/randomsamatch/edit_randomsamatch_form.php @@ -1,4 +1,4 @@ - + diff --git a/question/type/randomsamatch/questiontype.php b/question/type/randomsamatch/questiontype.php index 5f9bba05f3..710fea3179 100644 --- a/question/type/randomsamatch/questiontype.php +++ b/question/type/randomsamatch/questiontype.php @@ -1,4 +1,4 @@ -notification("Couldn't get question options (id=$response[0])!"); return false; } - + // Now we overwrite the $question->options->answers field to only // *one* (the first) correct answer. This loop can be deleted to // take all answers into account (i.e. put them all into the @@ -292,14 +292,14 @@ class question_randomsamatch_qtype extends question_match_qtype { } else { $categorylist = $question->category; } - + $question->options->subquestions = $this->get_sa_candidates($categorylist); foreach ($question->options->subquestions as $key => $wrappedquestion) { if (!$QTYPES[$wrappedquestion->qtype] ->get_question_options($wrappedquestion)) { return false; } - + // Now we overwrite the $question->options->answers field to only // *one* (the first) correct answer. This loop can be deleted to // take all answers into account (i.e. put them all into the @@ -454,4 +454,4 @@ class question_randomsamatch_qtype extends question_match_qtype { //// INITIATION - Without this line the question type is not in use... /// ////////////////////////////////////////////////////////////////////////// question_register_questiontype(new question_randomsamatch_qtype()); -?> + diff --git a/question/type/randomsamatch/version.php b/question/type/randomsamatch/version.php index fd7780c1c1..3e15273118 100644 --- a/question/type/randomsamatch/version.php +++ b/question/type/randomsamatch/version.php @@ -1,6 +1,6 @@ -version = 2006042800; $plugin->requires = 2007101000; -?> + diff --git a/question/type/shortanswer/db/upgrade.php b/question/type/shortanswer/db/upgrade.php index e0097e0abb..34351562d8 100644 --- a/question/type/shortanswer/db/upgrade.php +++ b/question/type/shortanswer/db/upgrade.php @@ -1,6 +1,6 @@ -get_manager(); $result = true; -/// And upgrade begins here. For each one, you'll need one -/// block of code similar to the next one. Please, delete +/// And upgrade begins here. For each one, you'll need one +/// block of code similar to the next one. Please, delete /// this comment lines once this file start handling proper /// upgrade code. @@ -38,4 +38,4 @@ function xmldb_qtype_shortanswer_upgrade($oldversion) { return $result; } -?> + diff --git a/question/type/shortanswer/display.html b/question/type/shortanswer/display.html index 375a20b428..0a8944fdbb 100644 --- a/question/type/shortanswer/display.html +++ b/question/type/shortanswer/display.html @@ -10,7 +10,7 @@