]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-20700 coding style cleanup - cvs keywords removed, closign php tag removed, trail...
authorPetr Skoda <skodak@moodle.org>
Wed, 4 Nov 2009 11:57:52 +0000 (11:57 +0000)
committerPetr Skoda <skodak@moodle.org>
Wed, 4 Nov 2009 11:57:52 +0000 (11:57 +0000)
136 files changed:
mod/quiz/report/default.php
mod/quiz/report/grading/report.php
mod/quiz/report/overview/db/upgrade.php
mod/quiz/report/overview/overview_table.php
mod/quiz/report/overview/overviewgraph.php
mod/quiz/report/overview/overviewsettings_form.php
mod/quiz/report/overview/report.php
mod/quiz/report/overview/version.php
mod/quiz/report/reportlib.php
mod/quiz/report/responses/report.php
mod/quiz/report/responses/responses_table.php
mod/quiz/report/responses/responsessettings_form.php
mod/quiz/report/simpletest/testreportlib.php
mod/quiz/report/statistics/cron.php
mod/quiz/report/statistics/db/install.php
mod/quiz/report/statistics/db/upgrade.php
mod/quiz/report/statistics/qstats.php
mod/quiz/report/statistics/report.php
mod/quiz/report/statistics/simpletest/test_qstats.php
mod/quiz/report/statistics/statistics_form.php
mod/quiz/report/statistics/statistics_graph.php
mod/quiz/report/statistics/statistics_question_table.php
mod/quiz/report/statistics/statistics_table.php
mod/quiz/simpletest/testaccessrules.php
mod/quiz/simpletest/testeditlib.php
question/addquestion.php
question/backuplib.php
question/category.php
question/category_class.php
question/category_form.php
question/category_form_randomquestion.php
question/contextmove.php
question/contextmove_form.php
question/contextmoveq.php
question/contextmoveq_form.php
question/edit.php
question/editlib.php
question/export.php
question/export_form.php
question/exportfile.php
question/format.php
question/format/README.txt
question/format/aiken/format.php
question/format/blackboard/format.php
question/format/blackboard_six/format.php
question/format/examview/format.php
question/format/gift/examples.txt
question/format/gift/format.php
question/format/hotpot/format.php
question/format/learnwise/format.php
question/format/missingword/format.php
question/format/multianswer/format.php
question/format/qti_two/custommediafilter.php
question/format/qti_two/format.php
question/format/qti_two/qt_common.php
question/format/qti_two/templates/choice.tpl
question/format/qti_two/templates/choiceMultiple.tpl
question/format/qti_two/templates/composite.tpl
question/format/qti_two/templates/extendedText.tpl
question/format/qti_two/templates/extendedText_simpleEssay.tpl
question/format/qti_two/templates/imsmanifest.tpl
question/format/qti_two/templates/match.tpl
question/format/qti_two/templates/mmchoiceMultiple.tpl
question/format/qti_two/templates/notimplemented.tpl
question/format/qti_two/templates/numerical.tpl
question/format/qti_two/templates/textEntry.tpl
question/format/webct/format.php
question/format/xhtml/format.php
question/format/xhtml/xhtml.css
question/format/xml/format.php
question/import.php
question/import_form.php
question/move_form.php
question/preview.php
question/question.php
question/restorelib.php
question/tabs.php
question/toggleflag.php
question/type/calculated/datasetdefinitions_form.php
question/type/calculated/datasetitems_form.php
question/type/calculated/db/upgrade.php
question/type/calculated/edit_calculated_form.php
question/type/calculated/questiontype.php
question/type/calculated/version.php
question/type/calculatedsimple/edit_calculatedsimple_form.php
question/type/calculatedsimple/questiontype.php
question/type/description/edit_description_form.php
question/type/description/question.html
question/type/description/questiontype.php
question/type/edit_question_form.php
question/type/essay/db/upgrade.php
question/type/essay/edit_essay_form.php
question/type/essay/questiontype.php
question/type/essay/version.php
question/type/match/db/upgrade.php
question/type/match/edit_match_form.php
question/type/match/questiontype.php
question/type/match/version.php
question/type/missingtype/edit_missingtype_form.php
question/type/missingtype/questiontype.php
question/type/multianswer/db/upgrade.php
question/type/multianswer/edit_multianswer_form.php
question/type/multianswer/questiontype.php
question/type/multianswer/version.php
question/type/multichoice/db/upgrade.php
question/type/multichoice/edit_multichoice_form.php
question/type/multichoice/questiontype.php
question/type/multichoice/version.php
question/type/numerical/db/upgrade.php
question/type/numerical/display.html
question/type/numerical/edit_numerical_form.php
question/type/numerical/questiontype.php
question/type/numerical/simpletest/testquestiontype.php
question/type/numerical/version.php
question/type/question.html
question/type/questiontype.php
question/type/random/edit_random_form.php
question/type/random/questiontype.php
question/type/randomsamatch/db/upgrade.php
question/type/randomsamatch/edit_randomsamatch_form.php
question/type/randomsamatch/questiontype.php
question/type/randomsamatch/version.php
question/type/shortanswer/db/upgrade.php
question/type/shortanswer/display.html
question/type/shortanswer/edit_shortanswer_form.php
question/type/shortanswer/questiontype.php
question/type/shortanswer/simpletest/testquestiontype.php
question/type/shortanswer/version.php
question/type/simpletest/testquestiontype.php
question/type/truefalse/db/upgrade.php
question/type/truefalse/display.html
question/type/truefalse/edit_truefalse_form.php
question/type/truefalse/questiontype.php
question/type/truefalse/version.php
question/upgrade.php
theme/orangewhitepda/styles_pda.css

index cda0d1a4978c27a72e0565d02e300844002707a3..4fd7cf9599f861300d82f657e1d4e33eb39e26fb 100644 (file)
@@ -1,15 +1,15 @@
-<?php  // $Id$ 
+<?php  // $Id$
 
 ////////////////////////////////////////////////////////////////////
-/// Default class for report plugins                            
-///                                                               
-/// Doesn't do anything on it's own -- it needs to be extended.   
-/// This class displays quiz reports.  Because it is called from 
+/// Default class for report plugins
+///
+/// Doesn't do anything on it's own -- it needs to be extended.
+/// This class displays quiz reports.  Because it is called from
 /// within /mod/quiz/report.php you can assume that the page header
 /// and footer are taken care of.
-/// 
-/// This file can refer to itself as report.php to pass variables 
-/// to itself - all these will also be globally available.  You must 
+///
+/// This file can refer to itself as report.php to pass variables
+/// to itself - all these will also be globally available.  You must
 /// pass "id=$cm->id" or q=$quiz->id", and "mode=reportname".
 ////////////////////////////////////////////////////////////////////
 
@@ -30,17 +30,17 @@ class quiz_default_report {
         $PAGE->set_title(format_string($quiz->name));
         $PAGE->set_button($OUTPUT->update_module_button($cm->id, 'quiz'));
         echo $OUTPUT->header();
-    /// Print the tabs    
+    /// Print the tabs
         $currenttab = 'reports';
         $mode = $reportmode;
         require($CFG->dirroot . '/mod/quiz/tabs.php');
         $course_context = get_context_instance(CONTEXT_COURSE, $course->id);
         if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {
-            echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">' 
+            echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">'
                 . get_string('seeallcoursegrades', 'grades') . '</a></div>';
         }
 
     }
 }
 
-?>
+
index 60993cf9b935e6b8d19d1c77ffc8f88f06d9ecfe..84fab2cba97aa82bf8e0e9c0206d5d64b3e9daad 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Quiz report to help teachers manually grade quiz questions that need it.
  *
@@ -128,13 +128,13 @@ class quiz_grading_report extends quiz_default_report {
                                     "quiz=?", array_merge(array($uniqueid), $params, array($quiz->id)))){
                         print_error('invalidattemptid', 'quiz_grading');
                     }
-    
+
                     // Load the state for this attempt (The questions array was created earlier)
                     $states = get_question_states($questions, $quiz, $attempt);
                     // The $states array is indexed by question id but because we are dealing
                     // with only one question there is only one entry in this array
                     $state = &$states[$question->id];
-    
+
                     // the following will update the state and attempt
                     $error = question_process_comment($question, $state, $attempt, $response['comment'], $response['grade']);
                     if (is_string($error)) {
@@ -205,7 +205,7 @@ class quiz_grading_report extends quiz_default_report {
 
         // our 2 different views
 
-        // the first view allows a user to select a question and 
+        // the first view allows a user to select a question and
         // displays the users who have answered the essay question
         // and all of their attempts at answering the question
 
@@ -456,7 +456,7 @@ class quiz_grading_report extends quiz_default_report {
             $where  = "WHERE u.id $usql ";
             $params = array_merge($params, $u_params);
         }
-        
+
         $where .= ' AND qs.event IN ('.QUESTION_EVENTS_CLOSED_OR_GRADED.')';
 
         $where .= ' AND u.id = qa.userid AND qa.quiz = ?';
@@ -471,4 +471,4 @@ class quiz_grading_report extends quiz_default_report {
 
 }
 
-?>
+
index 6c6ccaf4c3dcd999899b63d3f145c599d6e72115..45c6c8b9392038caf33e4bb5d500b18be7cdf916 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 function xmldb_quiz_overview_upgrade($oldversion) {
     global $CFG, $DB;
@@ -37,4 +37,4 @@ function xmldb_quiz_overview_upgrade($oldversion) {
     return $result;
 }
 
-?>
+
index cf3420c02b54675ad09d09e59b7c56f9b32d0e96..1bad73b924a5a7070820fe8d9f6bf8d25ba306ce 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 class quiz_report_overview_table extends table_sql {
 
@@ -231,7 +231,7 @@ class quiz_report_overview_table extends table_sql {
                     $link = html_link::make("/mod/quiz/reviewquestion.php?attempt=$attempt->attempt&question=$question->id", $grade);
                     $link->add_action(new popup_action('click', $link->url, 'reviewquestion', array('height' => 450, 'width' => 650)));
                     $link->title = get_string('reviewresponsetoq', 'quiz', $question->formattedname);
-                    $linktopopup = $OUTPUT->link($link); 
+                    $linktopopup = $OUTPUT->link($link);
 
                     if (($this->questions[$questionid]->maxgrade != 0)){
                         $fractionofgrade = $stateforqinattempt->grade
@@ -331,4 +331,4 @@ class quiz_report_overview_table extends table_sql {
         }
     }
 }
-?>
+
index 6b9abb930b938e0000d969b7b0f365b46165953e..9fb13b66abbe5c62613a56925991cfe937d21852 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 include '../../../../config.php';
 include $CFG->dirroot."/lib/graphlib.php";
 include $CFG->dirroot."/mod/quiz/report/reportlib.php";
@@ -96,4 +96,4 @@ while ($gridlines >= 10){
 
 $line->parameter['y_axis_gridlines'] = $gridlines+1;
 $line->draw();
-?>
+
index ed2690a64f37d5c80cf0ebd20395bb9d5cffd3e3..7e9e1ad555e5bb4ecbe3ee0c1f88ad0e63cd6ca2 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 require_once "$CFG->libdir/formslib.php";
 class mod_quiz_report_overview_settings extends moodleform {
 
@@ -42,7 +42,7 @@ class mod_quiz_report_overview_settings extends moodleform {
         }
         if ($showattemptsgrp){
             $mform->addGroup($showattemptsgrp, null, get_string('showattempts', 'quiz_overview'), '<br />', 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'));
     }
 }
-?>
+
index 2f21b1b7a7a5dcebb87febe09d76222f49d073de..2fb9174b0426a40085fcfc34661d10772a8a0a65 100644 (file)
@@ -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 '<div class="quizattemptcounts">' . $strattempthighlight . '</div>';
                 }
             }
-    
+
             if (!$table->is_downloading() && $candelete) {
                 $columns[]= 'checkbox';
                 $headers[]= NULL;
             }
-    
+
             if (!$table->is_downloading() && $CFG->grade_report_showuserimage) {
                 $columns[]= 'picture';
                 $headers[]= '';
@@ -330,21 +329,21 @@ class quiz_overview_report extends quiz_default_report {
                 $columns[]= 'firstname';
                 $headers[]= get_string('firstname');
              }
-    
+
             if ($CFG->grade_report_showuseridnumber) {
                 $columns[]= 'idnumber';
                 $headers[]= get_string('idnumber');
             }
-    
+
             $columns[]= 'timestart';
             $headers[]= get_string('startedon', 'quiz');
-    
+
             $columns[]= 'timefinish';
             $headers[]= get_string('timecompleted','quiz');
-    
+
             $columns[]= 'duration';
             $headers[]= get_string('attemptduration', 'quiz');
-    
+
             if ($detailedmarks) {
                 foreach ($questions as $id => $question) {
                     // Ignore questions of zero length
@@ -368,35 +367,35 @@ class quiz_overview_report extends quiz_default_report {
                 $columns[] = 'sumgrades';
                 $headers[] = get_string('grade', 'quiz').'/'.quiz_format_grade($quiz, $quiz->grade);
              }
-    
+
             if ($hasfeedback) {
                 $columns[] = 'feedbacktext';
                 $headers[] = get_string('feedback', 'quiz');
              }
-    
+
             $table->define_columns($columns);
             $table->define_headers($headers);
             $table->sortable(true, 'uniqueid');
-    
+
             // Set up the table
             $table->define_baseurl($reporturl->out(false, $displayoptions));
-    
+
             $table->collapsible(false);
-    
+
             $table->column_suppress('picture');
             $table->column_suppress('fullname');
             $table->column_suppress('idnumber');
-    
+
             $table->no_sorting('feedbacktext');
-    
+
             $table->column_class('picture', 'picture');
             $table->column_class('lastname', 'bold');
             $table->column_class('firstname', 'bold');
             $table->column_class('fullname', 'bold');
             $table->column_class('sumgrades', 'bold');
-    
+
             $table->set_attribute('id', 'attempts');
-    
+
             $table->out($pagesize, true);
         }
         if (!$table->is_downloading() && $showgrades) {
@@ -648,7 +647,7 @@ class quiz_overview_report extends quiz_default_report {
         list($asql, $aparams) = $DB->get_in_or_equal($attemptids);
         $where = "qa.id $asql AND ";
         $params = array_merge($params, $aparams);
-        
+
         $where .= "qa.quiz = ? AND qa.preview = 0";
         $params[] = $quiz->id;
         if (!$attempts = $DB->get_records_sql('SELECT qa.* FROM {quiz_attempts} qa WHERE '. $where, $params)) {
@@ -671,4 +670,4 @@ class quiz_overview_report extends quiz_default_report {
 }
 
 
-?>
+
index 837fbf593ab9e7493d25cc966719e70c1c0a9883..61cc45d9f6bef74ea92eabbd2b28682250d0b549 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 
 ////////////////////////////////////////////////////////////////////////////////
 //  Code fragment to define the version of quiz overview report
@@ -7,4 +7,4 @@
 
 $plugin->version  = 2009091400;   // The (date) version of this module
 
-?>
+
index a0b47aefb80a204f3902b4b4b00b2c26310a1ac4..0534c54a93fa8553b7061506a3f0e08dc5b42cc7 100644 (file)
@@ -119,7 +119,7 @@ function quiz_get_average_grade_for_questions($quiz, $userids){
     list($usql, $params) = $DB->get_in_or_equal($userids);
     $params[] = $quiz->id;
     $questionavgssql = "SELECT qns.questionid, AVG(qs.grade) FROM
-                        {quiz_attempts} qa 
+                        {quiz_attempts} qa
                         LEFT JOIN {question_sessions} qns ON (qns.attemptid = qa.uniqueid)
                         LEFT JOIN {question_states} qs ON (qns.newgraded = qs.id AND qs.event IN (".QUESTION_EVENTS_GRADED."))
                         WHERE " .
@@ -135,7 +135,7 @@ function quiz_get_total_qas_graded_and_ungraded($quiz, $questionids, $userids){
     $params = array($quiz->id);
     list($u_sql, $u_params) = $DB->get_in_or_equal($userids);
     list($q_sql, $q_params) = $DB->get_in_or_equal($questionids);
-    
+
     $params = array_merge($params, $u_params, $q_params);
     $sql = "SELECT qs.question, COUNT(1) AS totalattempts,
             SUM(CASE WHEN (qs.event IN(".QUESTION_EVENTS_GRADED.")) THEN 1 ELSE 0 END) AS gradedattempts
@@ -382,4 +382,4 @@ function quiz_report_list($context){
     return $reportlist;
 }
 
-?>
+
index 2e0babcc53283fc8abbbc63f62b358cf8552eb61..a9a3cddf0812557af9e5cfe9512f5c983bc98d44 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * This script lists student attempts and responses
  *
@@ -55,7 +55,7 @@ class quiz_responses_report extends quiz_default_report {
         $reporturl = new moodle_url($CFG->wwwroot.'/mod/quiz/report.php', $pageoptions);
         $qmsubselect = quiz_report_qm_filter_select($quiz);
 
-        
+
 
         /// find out current groups mode
         $currentgroup = groups_get_activity_group($cm, true);
@@ -131,7 +131,7 @@ class quiz_responses_report extends quiz_default_report {
         $table->is_downloading($download, get_string('reportresponses','quiz_responses'),
                     "$COURSE->shortname ".format_string($quiz->name,true));
         if (!$table->is_downloading()) {
-            
+
             // Only print headers if not asked to download data
             $PAGE->requires->css('mod/quiz/report/responses/styles.css');
             $this->print_header_and_tabs($cm, $course, $quiz, 'responses', '');
@@ -170,12 +170,12 @@ class quiz_responses_report extends quiz_default_report {
                     echo '<div class="quizattemptcounts">' . $strattempthighlight . '</div>';
                 }
             }
-    
-    
+
+
             $showgrades = quiz_has_grades($quiz) && $reviewoptions->scores;
             $hasfeedback = quiz_has_feedback($quiz);
-    
-    
+
+
             // Construct the SQL
             $fields = $DB->sql_concat('u.id', '\'#\'', 'COALESCE(qa.attempt, \'0\')').' AS concattedid, ';
             if ($qmsubselect) {
@@ -185,17 +185,17 @@ class quiz_responses_report extends quiz_default_report {
                     "   ELSE 0 " .
                     "END) AS gradedattempt, ";
             }
-            
+
             $fields .='qa.uniqueid, qa.id AS attempt, u.id AS userid, u.idnumber, u.firstname,'.
                 ' u.lastname, u.institution, u.department, u.email, u.picture, u.imagealt, '.
                 'qa.sumgrades, qa.timefinish, qa.timestart, qa.timefinish - qa.timestart AS duration, ' .
                 'qa.layout ';
-    
+
             // This part is the same for all cases - join users and quiz_attempts tables
             $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;
             }
@@ -223,23 +223,23 @@ class quiz_responses_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);
-    
-    
-            
+
+
+
             $table->set_sql($fields, $from, $where, $params);
-            
+
             // Define table columns
             $columns = array();
             $headers = array();
-    
-    
+
+
             if (!$table->is_downloading() && $candelete) {
                 $columns[]= 'checkbox';
                 $headers[]= NULL;
             }
-    
+
             if (!$table->is_downloading() && $CFG->grade_report_showuserimage) {
                 $columns[]= 'picture';
                 $headers[]= '';
@@ -253,7 +253,7 @@ class quiz_responses_report extends quiz_default_report {
                 $columns[]= 'firstname';
                 $headers[]= get_string('firstname');
             }
-    
+
             if ($CFG->grade_report_showuseridnumber) {
                 $columns[]= 'idnumber';
                 $headers[]= get_string('idnumber');
@@ -270,14 +270,14 @@ class quiz_responses_report extends quiz_default_report {
 
                 $columns[]= 'timestart';
                 $headers[]= get_string('startedon', 'quiz');
-    
+
                 $columns[]= 'timefinish';
                 $headers[]= get_string('timecompleted','quiz');
-    
+
                 $columns[]= 'duration';
                 $headers[]= get_string('attemptduration', 'quiz');
             }
-            
+
             if ($showgrades) {
                 $columns[] = 'sumgrades';
                 $headers[] = get_string('grade', 'quiz').'/'.quiz_format_grade($quiz, $quiz->grade);
@@ -287,7 +287,7 @@ class quiz_responses_report extends quiz_default_report {
                 $columns[] = 'feedbacktext';
                 $headers[] = get_string('feedback', 'quiz');
             }
-        
+
             // we want to display responses for all questions
             foreach ($questions as $id => $question) {
                 // Ignore questions of zero length
@@ -295,36 +295,36 @@ class quiz_responses_report extends quiz_default_report {
                 $headers[] = '#'.$question->number;
                 $question->formattedname = strip_tags(format_string($question->name));
             }
-    
-    
+
+
             // Load the question type specific information
             if (!get_question_options($questions)) {
                 print_error('cannotloadoptions', 'quiz_responses');
             }
-    
+
             $table->define_columns($columns);
             $table->define_headers($headers);
             $table->sortable(true, 'concattedid');
-        
+
             // Set up the table
             $table->define_baseurl($reporturl->out(false, $displayoptions));
-        
+
             $table->collapsible(true);
-        
+
             $table->column_suppress('picture');
             $table->column_suppress('fullname');
             $table->column_suppress('idnumber');
-        
+
             $table->no_sorting('feedbacktext');
-        
+
             $table->column_class('picture', 'picture');
             $table->column_class('lastname', 'bold');
             $table->column_class('firstname', 'bold');
             $table->column_class('fullname', 'bold');
             $table->column_class('sumgrades', 'bold');
-        
+
             $table->set_attribute('id', 'attempts');
-        
+
             $table->out($pagesize, true);
         }
         return true;
@@ -333,4 +333,4 @@ class quiz_responses_report extends quiz_default_report {
 }
 
 
-?>
+
index 2f968b4ba852ce733e0c86bd9418ed64ecc90b3a..898cad1fbd042cc25d44532ada81134e1f49e285 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 define ('QUIZ_REPORT_RESPONSES_MAX_LEN_TO_DISPLAY', 150);
 
 class quiz_report_responses_table extends table_sql {
@@ -149,10 +149,10 @@ class quiz_report_responses_table extends table_sql {
             } else {
                 return '-';
             }
-            
+
             $question = $this->questions[$questionid];
             restore_question_state($question, $stateforqinattempt);
-            
+
             if (!$this->is_downloading() || $this->is_downloading() == 'xhtml'){
                 $formathtml = true;
             } else {
@@ -182,7 +182,7 @@ class quiz_report_responses_table extends table_sql {
                 } else {
                     return '';
                 }
-                
+
             } else {
                 return $summary;
             }
@@ -241,4 +241,4 @@ class quiz_report_responses_table extends table_sql {
         }
     }
 }
-?>
+
index 9f281854512a8371b5e609c53bb7367e1c58f32b..a3c9024960a5ef0825b7e6adf141353c8ca383b1 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 require_once "$CFG->libdir/formslib.php";
 class mod_quiz_report_responses_settings extends moodleform {
 
@@ -44,4 +44,3 @@ class mod_quiz_report_responses_settings extends moodleform {
         $this->add_action_buttons(false, get_string('preferencessave', 'quiz_overview'));
     }
 }
-?>
\ No newline at end of file
index 67db041ce520de8d23d3d3d2e96049c42ab71472..be39c3bc66613ef3b1dc602083cd1e14fb1db500 100644 (file)
@@ -25,21 +25,21 @@ class question_reportlib_test extends UnitTestCase {
         $object->response = '';
         $object->grade = 3;
         $datum[] = $object;
-        
+
         $indexed = quiz_report_index_by_keys($datum, array('aid','qid'));
-        
+
         $this->assertEqual($indexed[101][3]->qid, 3);
         $this->assertEqual($indexed[101][3]->aid, 101);
         $this->assertEqual($indexed[101][3]->response, '');
         $this->assertEqual($indexed[101][3]->grade, 3);
-        
+
         $indexed = quiz_report_index_by_keys($datum, array('aid','qid'), false);
-        
+
         $this->assertEqual($indexed[101][3][0]->qid, 3);
         $this->assertEqual($indexed[101][3][0]->aid, 101);
         $this->assertEqual($indexed[101][3][0]->response, '');
         $this->assertEqual($indexed[101][3][0]->grade, 3);
-        
+
     }
 }
-?>
+
index c6f6aab077c838ded67a28daafd12784bcfadd08..7ddd3bbe2f34990be631cdcec9d1cb1df8e58c20 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 function quiz_report_statistics_cron(){
     global $DB;
     if ($todelete = $DB->get_records_select_menu('quiz_statistics', 'timemodified < ?', array(time()-5*HOURSECS))){
@@ -12,4 +12,4 @@ function quiz_report_statistics_cron(){
     }
     return true;
 }
-?>
+
index 5d2ffd2e2da0f6158e1b71900f82fd2e6ef38ece..0c9b3bfc2b8bd28bcfe6c8ecf37dc94652b6c15b 100644 (file)
@@ -1,4 +1,4 @@
-<?php  //$Id$
+<?php
 
 // This file is executed right after the install.xml
 //
index e828732af74e2d1fbda1e2fbb16845d8b6b8f222..80030d9c0d7c2e48c8cc2aa612f36cdcca9947af 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 function xmldb_quiz_statistics_upgrade($oldversion) {
 
index 3b5adc9845bd2ab2ec34aab19c8f99b242367910..c2ae7221180cc95ef574b79240cf50a87f9d04fa 100644 (file)
@@ -4,17 +4,17 @@ class qstats{
      * @var mixed states from which to calculate stats - iteratable.
      */
     var $states;
-    
+
     var $sumofgradevariance = 0;
     var $questions;
     var $subquestions = array();
     var $randomselectors = array();
     var $responses = array();
-    
+
     function qstats($questions, $s, $sumgradesavg){
         $this->s = $s;
         $this->sumgradesavg = $sumgradesavg;
-        
+
         foreach (array_keys($questions) as $qid){
             $questions[$qid]->_stats = $this->stats_init_object();
         }
@@ -58,7 +58,7 @@ class qstats{
             print_error('errorstatisticsquestions', 'quiz_statistics');
         }
     }
-    
+
     function _initial_states_walker($state, &$stats, $positionstat = true){
         $stats->s++;
         $stats->totalgrades += $state->grade;
@@ -113,12 +113,12 @@ class qstats{
         }
     }
 
-    /** 
+    /**
      * Get the data for the individual question response analysis table.
      */
     function _process_actual_responses($question, $state){
         global $QTYPES;
-        if ($question->qtype != 'random' && 
+        if ($question->qtype != 'random' &&
                 $QTYPES[$question->qtype]->show_analysis_of_responses()){
             $restoredstate = clone($state);
             restore_question_state($question, $restoredstate);
@@ -159,7 +159,7 @@ class qstats{
         }
         //avoid divide by zero
         if ($stats->gradevariance * $stats->othergradevariance){
-            $stats->discriminationindex = 100*$stats->covariance 
+            $stats->discriminationindex = 100*$stats->covariance
                         / sqrt($stats->gradevariance * $stats->othergradevariance);
         } else {
             $stats->discriminationindex = null;
@@ -170,7 +170,7 @@ class qstats{
             $stats->discriminativeefficiency = null;
         }
     }
-    
+
     function process_states(){
         global $DB, $OUTPUT;
         set_time_limit(0);
@@ -276,7 +276,7 @@ class qstats{
             }
         }
     }
-    
+
     function process_responses(){
         foreach ($this->states as $state){
             if ($this->questions[$state->question]->qtype == 'random'){
@@ -296,4 +296,4 @@ class qstats{
         return $this->sumofgradevariance;
     }
 }
-?>
+
index 954ea542d340623a48ad713db8310ec851082414..94e5711b76ab32cabeb4e71229f01111b2678834 100644 (file)
@@ -2,7 +2,6 @@
 /**
  * This script calculates various statistics about student attempts
  *
- * @version $Id$
  * @author Martin Dougiamas, Jamie Pratt, Tim Hunt and others.
  * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
  * @package quiz
@@ -662,4 +661,4 @@ function quiz_report_attempts_sql($quizid, $currentgroup, $groupstudents, $allat
     return array($fromqa, $whereqa, $qaparams);
 }
 
-?>
+
index e69edb971251928d40e8160392b90fcb1f223ae9..d629c55075900e0d682dd5c8be066726dc8fe57f 100644 (file)
@@ -17,8 +17,8 @@ require_once($CFG->dirroot.'/mod/quiz/locallib.php');
 require_once($CFG->dirroot.'/mod/quiz/report/reportlib.php');
 
 /**
- *  This class contains the test cases for the functions in qstats.php. 
- * 
+ *  This class contains the test cases for the functions in qstats.php.
+ *
  * */
 class quiz_report_qstats_test extends UnitTestCase {
     public static $includecoverage = array('mod/quiz/report/reportlib.php');
@@ -36,7 +36,7 @@ class quiz_report_qstats_test extends UnitTestCase {
         $this->qstats = new qstats($questions, 22, 10045.45455);
         $this->qstats->states = $states;
         $this->qstats->process_states();
-        
+
         //values expected are taken from contrib/tools/quiz_tools/stats.xls
         $facility = array(0,0,0,0,null,null,null,41.19318182,81.36363636,71.36363636,65.45454545,65.90909091,36.36363636,59.09090909,50,59.09090909,63.63636364,45.45454545,27.27272727,50);
         $this->qstats_q_fields('facility', $facility, 100);
@@ -80,7 +80,7 @@ class quiz_report_qstats_test extends UnitTestCase {
         }
         return $items;
     }
-    
+
     function get_records_from_csv($filename){
         $filecontents = file($filename, FILE_IGNORE_NEW_LINES);
         $records = array();
@@ -105,4 +105,4 @@ class quiz_report_qstats_test extends UnitTestCase {
 
 //$test = new quiz_report_qstats_test();
 //$test->test_qstats();
-?>
+
index 4c599c544d14a26c59873b04f84c8f25b35a0c1f..9deb6d14f4d640584f94d825e13ba7010061b780 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 require_once "$CFG->libdir/formslib.php";
 class mod_quiz_report_statistics extends moodleform {
 
@@ -17,4 +17,4 @@ class mod_quiz_report_statistics extends moodleform {
         $this->add_action_buttons(false, get_string('preferencessave', 'quiz_overview'));
     }
 }
-?>
+
index 9283d074256fd3d3fc9da8a8f0a3543c4e924c9c..08a8af5976d786b7bdfa1d3599b39c26f9212085 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 include '../../../../config.php';
 include $CFG->dirroot."/lib/graphlib.php";
 include $CFG->dirroot."/mod/quiz/locallib.php";
@@ -47,7 +47,7 @@ $line->parameter['legend_border'] = 'black';
 $line->parameter['legend_offset'] = 4;
 
 
-$line->parameter['bar_size']    = 1; 
+$line->parameter['bar_size']    = 1;
 
 $line->parameter['zero_axis']        = 'grayEE';
 
@@ -97,8 +97,8 @@ $line->parameter['y_axis_gridlines'] = $gridlines+1;
 
 $line->parameter['y_min_left'] = $min;
 $line->parameter['y_max_left'] = $max;
-$line->parameter['y_decimal_left'] = 0; 
+$line->parameter['y_decimal_left'] = 0;
 
 
 $line->draw();
-?>
+
index 90e2474f411abf295bd32e111517aad9f60c2118..fa45a8d613e6ea9b0a59c3f7924699ac940e590a 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 require_once($CFG->libdir.'/tablelib.php');
 
 class quiz_report_statistics_question_table extends flexible_table {
@@ -20,7 +20,7 @@ class quiz_report_statistics_question_table extends flexible_table {
         // Define table columns
         $columns = array();
         $headers = array();
-        
+
         if ($hassubqs){
             $columns[]= 'subq';
             $headers[]= '';
@@ -28,11 +28,11 @@ class quiz_report_statistics_question_table extends flexible_table {
 
         $columns[]= 'response';
         $headers[]= get_string('response', 'quiz_statistics');
-        
+
 
         $columns[]= 'credit';
         $headers[]= get_string('optiongrade', 'quiz_statistics');
-        
+
         $columns[]= 'rcount';
         $headers[]= get_string('count', 'quiz_statistics');
 
@@ -56,7 +56,7 @@ class quiz_report_statistics_question_table extends flexible_table {
 
         parent::setup();
     }
-    
+
     function col_response($response){
         global $QTYPES;
         if (!$this->is_downloading() || $this->is_downloading() == 'xhtml'){
@@ -65,11 +65,11 @@ class quiz_report_statistics_question_table extends flexible_table {
             return $response->response;
         }
     }
-    
+
     function col_subq($response){
         return $response->subq;
     }
-    
+
     function col_credit($response){
         if (!is_null($response->credit)){
             return ($response->credit*100).'%';
@@ -77,7 +77,7 @@ class quiz_report_statistics_question_table extends flexible_table {
             return '';
         }
     }
-    
+
     function col_frequency($response){
         if ($this->question->_stats->s){
             return format_float((($response->rcount / $this->question->_stats->s)*100),2).'%';
@@ -89,4 +89,4 @@ class quiz_report_statistics_question_table extends flexible_table {
 
 
 }
-?>
+
index 5d4efa3f37f7bca23cf36a08a5b58523e3f2ffbf..3f9c1ba04a7208553b4ea279cd0e56c5fccf2ea7 100644 (file)
@@ -1,10 +1,10 @@
-<?php  // $Id$
+<?php
 require_once($CFG->libdir.'/tablelib.php');
 
 class quiz_report_statistics_table extends flexible_table {
-    
-    var $quiz; 
-    
+
+    var $quiz;
+
     function quiz_report_statistics_table(){
         parent::flexible_table('mod-quiz-report-statistics-report');
     }
@@ -19,10 +19,10 @@ class quiz_report_statistics_table extends flexible_table {
         // Define table columns
         $columns = array();
         $headers = array();
-        
+
         $columns[]= 'number';
         $headers[]= get_string('questionnumber', 'quiz_statistics');
-        
+
         if (!$this->is_downloading()){
             $columns[]= 'icon';
             $headers[]= '';
@@ -34,29 +34,29 @@ class quiz_report_statistics_table extends flexible_table {
         }
         $columns[]= 'name';
         $headers[]= get_string('questionname', 'quiz');
-        
+
         $columns[]= 's';
         $headers[]= get_string('attempts', 'quiz_statistics');
 
         if ($s>1){
             $columns[]= 'facility';
             $headers[]= get_string('facility', 'quiz_statistics');
-            
+
             $columns[]= 'sd';
             $headers[]= get_string('standarddeviationq', 'quiz_statistics');
         }
         $columns[]= 'random_guess_score';
         $headers[]= get_string('random_guess_score', 'quiz_statistics');
-        
+
         $columns[]= 'intended_weight';
         $headers[]= get_string('intended_weight', 'quiz_statistics');
-        
+
         $columns[]= 'effective_weight';
         $headers[]= get_string('effective_weight', 'quiz_statistics');
-        
+
         $columns[]= 'discrimination_index';
         $headers[]= get_string('discrimination_index', 'quiz_statistics');
-        
+
         $columns[]= 'discriminative_efficiency';
         $headers[]= get_string('discriminative_efficiency', 'quiz_statistics');
 
@@ -119,11 +119,11 @@ class quiz_report_statistics_table extends flexible_table {
             return $question->_stats->discriminativeefficiency < 15;
         }
     }
-    
+
     function col_icon($question){
         return print_question_icon($question, true);
     }
-    
+
     function col_number($question){
         if (!$question->_stats->subquestion){
             return $question->number;
@@ -180,7 +180,7 @@ class quiz_report_statistics_table extends flexible_table {
             return $randomguessscore; // empty string returned by random question.
         }
     }
-    
+
     function col_sd($question){
         if (!is_null($question->_stats->sd) && ($question->_stats->maxgrade!=0)){
             return number_format($question->_stats->sd*100 / $question->_stats->maxgrade, 2).'%';
@@ -202,6 +202,6 @@ class quiz_report_statistics_table extends flexible_table {
             return '';
         }
     }
-    
+
 }
-?>
+
index 05a4305bb34e03d245adcb3d6edafb85e9ac90b3..12448defa1274d136e76316395ab88ccf202a725 100644 (file)
@@ -424,4 +424,4 @@ class securewindow_access_rule_test extends UnitTestCase {
     }
 }
 
-?>
+
index f3c894e729e06c15df67edfb658faaa0f68b687d..c70299da666afa8c272f9ed5e79525667522ef47 100644 (file)
@@ -60,4 +60,4 @@ class quiz_editlib_test extends UnitTestCase {
         $this->assertEqual(quiz_add_page_break_at('1,2,0', 3), '1,2,0');
     }
 }
-?>
+
index 266416d095db2068e7deac07befa2fe390221e70..7a3ee303afccc16c948aff3ceef898868f73f7ca 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 ///////////////////////////////////////////////////////////////////////////
 //                                                                       //
@@ -101,4 +101,4 @@ print_choose_qtype_to_add_form($hiddenparams);
 echo $OUTPUT->box_end();
 
 echo $OUTPUT->footer();
-?>
+
index 51061ccf089dfe44aa923a3a07971634a020b287..94f6735438a20378121fcda64f393535cdb16c6d 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 /**
  * Question bank backup code.
  *
         }
         return $status;
     }
-?>
+
index 03652e7e48c50e1246147e3b612f7e359bea1446..7ac6930e202feff398340af7eb65a0bd04f8710f 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 /**
  * Allows a teacher to create, edit and delete categories
  *
         $qcobject->display_user_interface();
     }
     echo $OUTPUT->footer();
-?>
+
index 935120427d3c3c1d450fb5c091a9a9f8e5411240..fa76965ca8dcc05a15ce3fc054fb066001da80bf 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 /**
  * Class representing question categories
  *
@@ -513,4 +513,4 @@ class question_category_object {
 
 }
 
-?>
+
index 53a8be5cb7c16ee39abc57745910b16f98826473..1fd9b6e0962af713bddc4659d3b970f4fe306ccf 100644 (file)
@@ -1,4 +1,4 @@
-<?php  //$Id$
+<?php
 
 require_once($CFG->libdir.'/formslib.php');
 
@@ -36,4 +36,4 @@ class question_category_edit_form extends moodleform {
         $mform->setType('id', PARAM_INT);
     }
 }
-?>
+
index 8806feb3ee0d491f0ff8c7f4796049f947e720f3..8e6315036dd74516d62274807cdbb15a9207ff2c 100644 (file)
@@ -1,4 +1,4 @@
-<?php  //$Id$
+<?php
 
 require_once($CFG->libdir.'/formslib.php');
 
@@ -35,4 +35,4 @@ class question_category_edit_form_randomquestion extends moodleform {
         $mform->setType('addonpage', PARAM_SEQUENCE);
     }
 }
-?>
+
index c8526415c32068b18659e8cf2784d63f153a93e3..5982dee61d36e4b220be7fc091a737d6a9406a39 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 /**
  * Allows someone with appropriate permissions to move a category and associated
  * files to another context.
     }
     $contextmoveform->display();
     echo $OUTPUT->footer();
-?>
+
index f2f20d8b41c4467580e436f628fe3b7cf6108e46..76965bb64db5f797eebfb4c5b3f59cb468bc55b0 100644 (file)
@@ -1,4 +1,4 @@
-<?php  //$Id$
+<?php
 
 require_once($CFG->libdir.'/formslib.php');
 
@@ -100,4 +100,4 @@ class question_context_move_form extends moodleform {
         }
     }
 }
-?>
+
index 277d6be47b97e93193d1b586246e5e5edf5f3a41..f19b80fc5af3d2a2ae6da0947738409f1e88c3ea 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 /**
  * Page for moving questions
  *
@@ -237,4 +237,4 @@ if (count($urls)){
 }
 $contextmoveform->display();
 echo $OUTPUT->footer();
-?>
+
index ee0232de87ed4a47ec6b636ccddcbdc0c3e73446..25b65ed2b5b34a2004481b6c17160749fd78cd17 100644 (file)
@@ -1,4 +1,4 @@
-<?php  //$Id$
+<?php
 
 require_once($CFG->libdir.'/formslib.php');
 
@@ -104,4 +104,4 @@ class question_context_move_question_form extends moodleform {
         }
     }
 }
-?>
+
index 984f32990f12af49c82ea9bdd040a4fba785b671..01f5936c1dd7853fc0905c2b1ab3c0040012b3af 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 
 ///////////////////////////////////////////////////////////////////////////
 //                                                                       //
@@ -97,4 +97,4 @@
     echo "</div>\n";
 
     echo $OUTPUT->footer();
-?>
+
index 5c2dca3893f1e2fd6fe39bbb94e8f05080c25ea9..30dad125f17a0d29f02a0bf2167514ff347feb96 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 
 ///////////////////////////////////////////////////////////////////////////
 //                                                                       //
@@ -1512,7 +1512,7 @@ class question_bank_view {
             }
             $baseurl = new moodle_url('edit.php');
             $r = $baseurl->params($this->baseurl->params());
-           
+
             echo $OUTPUT->confirm(get_string("deletequestionscheck", "quiz", $questionnames),
                         $baseurl->out_action(array('deleteselected'=>$questionlist, 'confirm'=>md5($questionlist))),
                         $baseurl);
@@ -1945,4 +1945,4 @@ function create_new_question_button($categoryid, $params, $caption, $tooltip = '
     }
 }
 
-?>
+
index cb389cb89ee865f92712dc15a60849ec145a638c..1e999843cd42fb8c98dc50873dc12644072239a7 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 /**
  * Export quiz questions into the given category
  *
     $export_form->display();
 
     echo $OUTPUT->footer();
-?>
+
index 598cedb26f6b6f26996fe9189eec631efc0fd696..4a52accfa8da0eeb287e748bdbedb3d37d3cfc32 100644 (file)
@@ -1,4 +1,4 @@
-<?php  //$Id$
+<?php
 
 require_once($CFG->libdir.'/formslib.php');
 
@@ -20,7 +20,7 @@ class question_export_form extends moodleform {
             $radioarray[] = $radioelement;
         }
         $mform->addGroup($radioarray,'format','',array('<br />'),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 {
 //--------------------------------------------------------------------------------
     }
 }
-?>
+
index 0b3261d875fe51e639e717fcc4900017f5bca688..c22fb4a45a86198d8c3ab34d6ae271ee920c50d4 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
     require_once(dirname(__FILE__) . '/../config.php');
     require_once($CFG->libdir . '/filelib.php');
 
@@ -14,4 +14,4 @@
     $pathname = $CFG->dataroot . '/temp/questionexport/' . $USER->id . '/' .  $relativepath;
 
     send_temp_file($pathname, $relativepath);
-?>
+
index 74d40c8aa524fad000750e86e9e033f46d94d0ca..1a53ca1bbf9b579a3f72b1b112e342bd5b813742 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Base class for question import and export formats.
  *
@@ -830,4 +830,4 @@ class qformat_default {
 
 }
 
-?>
+
index 677e9256a6457b12baff3c17ddab7008bcde4c7c..f2436d2cf3aee3328da6f04469d3ff655620a46c 100644 (file)
@@ -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.
 
index cde6211dbe22b3e8d88046129118d66942f07878..f738938e56b44ea20b939eb6a87c23e6db034893 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$ 
+<?php
 
 ///////////////////////////////////////////////////////////////////////////
 //                                                                       //
@@ -54,7 +54,7 @@ class qformat_aiken extends qformat_default {
     function readquestions($lines) {
         $questions = array();
         $question = $this->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 {
     }
 }
 
-?>
+
index 45bcad842624071cb5e94b6fd764d88922009e36..23fd4cd3811f2a13e567c00e94c121a08f13c964 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 
 
 ////////////////////////////////////////////////////////////////////////////
@@ -26,7 +26,7 @@ class qformat_blackboard extends qformat_default {
   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);
@@ -47,20 +47,20 @@ class qformat_blackboard extends qformat_default {
 // Process Essay Questions
 //----------------------------------------
 function process_essay($xml, &$questions ) {
-  
+
     if (isset($xml["POOL"]["#"]["QUESTION_ESSAY"])) {
        $essayquestions = $xml["POOL"]["#"]["QUESTION_ESSAY"];
     }
     else {
        return;
     }  
-    
+
     foreach ($essayquestions as $essayquestion) {
-        
+
         $question = $this->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;
-          
+
     }
 }
 
 }
-?>
+
index 1cf7e36942be9448bc23d928d1d6b38886a4af85..202599495b993e050fe5401327278a32386d7eab 100644 (file)
@@ -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<br />tempdir: $temp_dir <br />";
-                    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<br>";
-                    $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 '<table class="boxaligncenter" border="1">';
-            print '<tr><td colspan="2" style="background-color:#FF8888;">This matching question is malformed. Please ensure there are no blank answers, no two questions have the same answer, and/or there are correct answers for each question. There must be at least as many subanswers as subquestions, and at least one subquestion.</td></tr>'; 
-        
+            print '<tr><td colspan="2" style="background-color:#FF8888;">This matching question is malformed. Please ensure there are no blank answers, no two questions have the same answer, and/or there are correct answers for each question. There must be at least as many subanswers as subquestions, and at least one subquestion.</td></tr>';
+
             print "<tr><td>Question:</td><td>".$quest->QUESTION_BLOCK->text;
             if (isset($quest->QUESTION_BLOCK->file)) {
                 print '<br/><font color="red">There is a subfile contained in the zipfile that has been copied to course files: bb_import/'.basename($quest->QUESTION_BLOCK->file).'</font>';
@@ -870,7 +870,7 @@ function process_matching($quest, &$questions) {
             print "</td></tr>";
             print "<tr><td>Subquestions:</td><td><ul>";
             foreach($quest->responses as $rs) {
-                $correct_responses->{$rs->ident} = $rs->correct;   
+                $correct_responses->{$rs->ident} = $rs->correct;
             }
             foreach($quest->RESPONSE_BLOCK->subquestions as $subq) {
                 print '<li>'.$subq->text.'<ul>';
@@ -887,7 +887,7 @@ function process_matching($quest, &$questions) {
                 print '</ul>';
             }
             print '</ul></td></tr>';
-        
+
             print '<tr><td>Feedback:</td><td><ul>';
             foreach($quest->feedback as $fb) {
                 print '<li>'.$fb->ident.': '.$fb->text.'</li>';
@@ -904,7 +904,7 @@ function process_matching($quest, &$questions) {
 
 function strip_applet_tags_get_mathml($string) {
     if(stristr($string, '</APPLET>') === FALSE) {
-        return $string;    
+        return $string;
     }
     else {
         // strip all applet tags keeping stuff before/after and inbetween (if mathml) them
@@ -912,9 +912,9 @@ function strip_applet_tags_get_mathml($string) {
             preg_match("/(.*)\<applet.*value=\"(\<math\>.*\<\/math\>)\".*\<\/applet\>(.*)/i",$string, $mathmls);
             $string = $mathmls[1].$mathmls[2].$mathmls[3];
         }
-        return $string;    
+        return $string;
     }
 }
 
 } // close object
-?>
+
index 3448d79574b028308b25eddab581915a930de787..29b46447c85b49c77331aed42f9f29a1e4f8e456 100755 (executable)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 
 // Based on default.php, included by ../import.php
 /**
@@ -283,4 +283,4 @@ class qformat_examview extends qformat_default {
 }
 // end class
 
-?>
+
index 7dfed88958213461b437b79366cf065adc094d05..c0c1e0e2b7cef52ed9eed1e953487d9ba7c51e54 100644 (file)
@@ -57,7 +57,7 @@ Matching Question. {
     =subquestion2 -> subanswer2
     =subquestion3 -> subanswer3
     }
-    
+
 Match the following countries with their corresponding capitals. {
     =Canada -> Ottawa
     =Italy  -> Rome
@@ -77,7 +77,7 @@ When was Ulysses S. Grant born? {#
     =1822:0
     =%50%1822:2}
 
-// OPTIONS 
+// OPTIONS
 
 // ===Line Comments===
 
@@ -90,7 +90,7 @@ What's 2 plus 2? {#4}
 ::Kanji Origins::Japanese characters originally
 came from what country? {=China}
 
-::Thanksgiving Date::The American holiday of Thanksgiving is 
+::Thanksgiving Date::The American holiday of Thanksgiving is
 celebrated on the {~second ~third =fourth} Thursday of November.
 
 // ===Feedback===
@@ -99,7 +99,7 @@ What's the answer to this multiple-choice question?{
 ~wrong answer#feedback comment on the wrong answer
 ~another wrong answer#feedback comment on this wrong answer
 =right answer#Very good!}
-    
+
 Who's buried in Grant's tomb?{
 =no one#excellent answer!
 =nobody#excellent answer!}
@@ -113,13 +113,13 @@ Who's buried in Grant's tomb?{
 Grant is buried in Grant's tomb.{FALSE#No one is buried in Grant's tomb.}
 
 Difficult question.{~wrong answer ~%50%half credit answer =full credit answer}
-         
+
 ::Jesus' hometown::Jesus Christ was from {
     ~Jerusalem#This was an important city, but the wrong answer.
     ~%25%Bethlehem#He was born here, but not raised here.
     ~%50%Galilee#You need to be more specific.
     =Nazareth#Yes! That's right!}.
-    
+
 ::Jesus' hometown:: Jesus Christ was from {
     =Nazareth#Yes! That's right!
     =%75%Nazereth#Right, but misspelled.
index bb3bc13c81e8570af6e4156afd9c335a8ec4385e..9ad9d32d2e26c80451d2a0a66cc2a6916cfa6658 100755 (executable)
@@ -1,7 +1,7 @@
-<?php // $Id$
+<?php
 //
 ///////////////////////////////////////////////////////////////
-// The GIFT import filter was designed as an easy to use method 
+// The GIFT import filter was designed as an easy to use method
 // for teachers writing questions as a text file. It supports most
 // question types and the missing word format.
 //
 //     Match the following countries with their corresponding
 //     capitals.{=Canada->Ottawa =Italy->Rome =Japan->Tokyo}
 //
-// Comment lines start with a double backslash (//). 
-// Optional question names are enclosed in double colon(::). 
+// Comment lines start with a double backslash (//).
+// Optional question names are enclosed in double colon(::).
 // Answer feedback is indicated with hash mark (#).
 // Percentage answer weights immediately follow the tilde (for
 // multiple choice) or equal sign (for short answer and numerical),
 // and are enclosed in percent signs (% %). See docs and examples.txt for more.
-// 
-// This filter was written through the collaboration of numerous 
-// members of the Moodle community. It was originally based on 
+//
+// This filter was written through the collaboration of numerous
+// members of the Moodle community. It was originally based on
 // the missingword format, which included code from Thomas Robb
 // and others. Paul Tsuchido Shew wrote this filter in December 2003.
 //////////////////////////////////////////////////////////////////////////
@@ -79,10 +79,10 @@ class qformat_gift extends qformat_default {
         }
         return $feedback;
     }
-    
+
     function escapedchar_pre($string) {
         //Replaces escaped control characters with a placeholder BEFORE processing
-        
+
         $escapedcharacters = array("\\:",    "\\#",    "\\=",    "\\{",    "\\}",    "\\~",    "\\n"   );  //dlnsk
         $placeholders      = array("&&058;", "&&035;", "&&061;", "&&123;", "&&125;", "&&126;", "&&010" );  //dlnsk
 
@@ -119,7 +119,7 @@ class qformat_gift extends qformat_default {
         $question = $this->defaultquestion();
         $comment = NULL;
         // define replaced by simple assignment, stop redefine notices
-        $gift_answerweight_regex = "/^%\-*([0-9]{1,2})\.?([0-9]*)%/";        
+        $gift_answerweight_regex = "/^%\-*([0-9]{1,2})\.?([0-9]*)%/";
 
         // REMOVED COMMENTED LINES and IMPLODE
         foreach ($lines as $key => $line) {
@@ -148,7 +148,7 @@ class qformat_gift extends qformat_default {
             $question->category = $newcategory;
             return $question;
         }
-        
+
         // QUESTION NAME parser
         if (substr($text, 0, 2) == "::") {
             $text = substr($text, 2);
@@ -209,7 +209,7 @@ class qformat_gift extends qformat_default {
             $questiontext = substr( $questiontext, $rh_brace+1 );
             if (!$questiontextformat = text_format_name( $qtformat )) {
                 $questiontext = $oldquestiontext;
-            }          
+            }
         }
         $question->questiontextformat = $questiontextformat;
         $question->questiontext = trim($this->escapedchar_post($questiontext));
@@ -245,17 +245,17 @@ class qformat_gift extends qformat_default {
         } elseif (strpos($answertext, "~") !== false)  {
             // only Multiplechoice questions contain tilde ~
             $question->qtype = MULTICHOICE;
-    
-        } elseif (strpos($answertext, "=")  !== false 
+
+        } elseif (strpos($answertext, "=")  !== false
                 && strpos($answertext, "->") !== false) {
             // only Matching contains both = and ->
             $question->qtype = MATCH;
 
         } else { // either TRUEFALSE or SHORTANSWER
-    
+
             // TRUEFALSE question check
             $truefalse_check = $answertext;
-            if (strpos($answertext,"#") > 0){ 
+            if (strpos($answertext,"#") > 0){
                 // strip comments to check for TrueFalse question
                 $truefalse_check = trim(substr($answertext, 0, strpos($answertext,"#")));
             }
@@ -288,7 +288,7 @@ class qformat_gift extends qformat_default {
                 break;
             case MULTICHOICE:
                 if (strpos($answertext,"=") === false) {
-                    $question->single = 0;   // multiple answers are enabled if no single answer is 100% correct                        
+                    $question->single = 0;   // multiple answers are enabled if no single answer is 100% correct
                 } else {
                     $question->single = 1;   // only one answer allowed (the default)
                 }
@@ -301,9 +301,9 @@ class qformat_gift extends qformat_default {
                 if (empty($answers[0])) {
                     array_shift($answers);
                 }
-    
+
                 $countanswers = count($answers);
-                
+
                 if (!$this->check_answer_count( 2,$answers,$text )) {
                     return false;
                     break;
@@ -316,10 +316,10 @@ class qformat_gift extends qformat_default {
                     if ($answer[0] == "=") {
                         $answer_weight = 1;
                         $answer = substr($answer, 1);
-    
+
                     } elseif (preg_match($gift_answerweight_regex, $answer)) {    // check for properly formatted answer weight
                         $answer_weight = $this->answerweightparser($answer);
-                    
+
                     } else {     //default, i.e., wrong anwer
                         $answer_weight = 0;
                     }
@@ -330,7 +330,7 @@ class qformat_gift extends qformat_default {
                     $question->partiallycorrectfeedback = '';
                     $question->incorrectfeedback = '';
                 }  // end foreach answer
-    
+
                 //$question->defaultgrade = 1;
                 //$question->image = "";   // No images with this format
                 return $question;
@@ -344,12 +344,12 @@ class qformat_gift extends qformat_default {
                 if (empty($answers[0])) {
                     array_shift($answers);
                 }
-    
+
                 if (!$this->check_answer_count( 2,$answers,$text )) {
                     return false;
                     break;
                 }
-    
+
                 foreach ($answers as $key => $answer) {
                     $answer = trim($answer);
                     if (strpos($answer, "->") === false) {
@@ -364,10 +364,10 @@ class qformat_gift extends qformat_default {
                     $question->subanswers[$key]   = trim($this->escapedchar_post(substr($answer, $marker+2)));
 
                 }  // end foreach answer
-    
+
                 return $question;
                 break;
-            
+
             case TRUEFALSE:
                 $answer = $answertext;
                 $comment = $this->commentparser($answer); // commentparser also removes comment from $answer
@@ -388,7 +388,7 @@ class qformat_gift extends qformat_default {
 
                 return $question;
                 break;
-                
+
             case SHORTANSWER:
                 // SHORTANSWER Question
                 $answers = explode("=", $answertext);
@@ -398,7 +398,7 @@ class qformat_gift extends qformat_default {
                 if (empty($answers[0])) {
                     array_shift($answers);
                 }
-    
+
                 if (!$this->check_answer_count( 1,$answers,$text )) {
                     return false;
                     break;
@@ -443,7 +443,7 @@ class qformat_gift extends qformat_default {
                 if (empty($answers[0])) {
                     array_shift($answers);
                 }
-    
+
                 if (count($answers) == 0) {
                     // invalid question
                     $giftnonumericalanswers = get_string('giftnonumericalanswers','quiz');
@@ -479,14 +479,14 @@ class qformat_gift extends qformat_default {
                         $tol = 0;
                         $ans = trim($answer);
                     }
-    
+
                     if (!(is_numeric($ans) || $ans = '*') || !is_numeric($tol)) {
                             $errornotnumbers = get_string( 'errornotnumbers' );
                             $this->error( $errornotnumbers, $text );
                         return false;
                         break;
                     }
-                    
+
                     // store results
                     $question->answer[$key] = $ans;
                     $question->tolerance[$key] = $tol;
@@ -507,8 +507,8 @@ class qformat_gift extends qformat_default {
                     $giftnovalidquestion = get_string('giftnovalidquestion','quiz');
                     $this->error( $giftnovalidquestion, $text );
                 return false;
-                break;                
-        
+                break;
+
         } // end switch ($question->qtype)
 
     }    // end function readquestion($lines)
@@ -519,7 +519,7 @@ function repchar( $text, $format=0 ) {
     $reserved = array( '#', '=', '~', '{', '}', ':', "\n","\r");
     $escaped =  array( '\#','\=','\~','\{','\}','\:','\n',''  ); //dlnsk
 
-    $newtext = str_replace( $reserved, $escaped, $text ); 
+    $newtext = str_replace( $reserved, $escaped, $text );
     $format = 0; // turn this off for now
     if ($format) {
         $newtext = format_text( $format );
@@ -550,7 +550,7 @@ function writequestion( $question ) {
     switch($question->qtype) {
     case 'category':
         // not a real question, used to insert category switch
-        $expout .= "\$CATEGORY: $question->category\n";    
+        $expout .= "\$CATEGORY: $question->category\n";
         break;
     case DESCRIPTION:
         $expout .= '::'.$this->repchar($question->name).'::';
@@ -656,4 +656,4 @@ function writequestion( $question ) {
     return $expout;
 }
 }
-?>
+
index 68d9afb2b246992780029b5a1b9fe2ceb37fdf2f..3c95de161a1d42f9a9d75dbd072b5f5003f7f3d1 100644 (file)
@@ -1,4 +1,4 @@
-<?PHP // $Id$
+<?php
 ////////////////////////////////////////////////////////////////////////////
 /// Hotpotatoes 5.0 and 6.0 Format
 ///
@@ -42,7 +42,7 @@ class qformat_hotpot extends qformat_default {
                 break;
             default:
                 // shouldn't happen !!
-                $courseid = 0; 
+                $courseid = 0;
         }
         require_once($CFG->libdir.'/filelib.php');
         $baseurl = get_file_url($courseid).'/';
@@ -159,7 +159,7 @@ class qformat_hotpot extends qformat_default {
                     $gap_count ++;
                     $positionkey = $q+1;
                     $question->questiontext .= '{#'.$positionkey.'}';
-        
+
                     // initialize answer settings
                     $wrapped = new stdClass();
                     $wrapped->qtype = SHORTANSWER;
@@ -170,7 +170,7 @@ class qformat_hotpot extends qformat_default {
                     $wrapped->fraction = array();
                     $wrapped->feedback = array();
                     $answers = array();
-        
+
                     // add answers
                     $a = 0;
                     while (($answer=$question_record."['answer'][$a]['#']") && $xml->xml_value($tags, $answer)) {
@@ -450,7 +450,7 @@ class qformat_hotpot extends qformat_default {
                     $a++;
                 }
                 if ($correct_answers_all_zero) {
-                    // correct answers all have score of 0%, 
+                    // correct answers all have score of 0%,
                     // so reset score for correct answers 100%
                     foreach ($correct_answers as $aa) {
                         $question->fraction[$aa] = 1;
index a65037d6fa40aedde559537ef496f596d2eb3e49..88b4dd0a0d3c89cf18479fdd80ee7fc7b639404f 100755 (executable)
@@ -1,8 +1,8 @@
-<?php    // $Id$ 
+<?php
 // Alton College, Hampshire, UK - Tom Flannaghan, Andrew Walker
 // Imports learnwise multiple choice quizzes (single and multiple answers)
 // currently ignores the deduct attribute for multiple answer questions
-// deductions are currently simply found by dividing the award for the incorrect 
+// deductions are currently simply found by dividing the award for the incorrect
 // answer by the total number of options
 // Based on format.php, included by ../../import.php
 /**
@@ -61,7 +61,7 @@ class qformat_learnwise extends qformat_default {
             foreach ($optionlist as $option) {
                 $correct = $this->stringbetween($option, ' correct="', '">');
                 $answer = $this->stringbetween($option, '">', '</option>');
-                $optionscorrect[$n] = $correct; 
+                $optionscorrect[$n] = $correct;
                 $optionstext[$n] = $this->unhtmlentities($answer);
                 ++$n;
             }
@@ -84,7 +84,7 @@ class qformat_learnwise extends qformat_default {
 
                 $answer = $this->stringbetween($option, '">', '</option>');
 
-                $optionscorrect[$n] = $correct; 
+                $optionscorrect[$n] = $correct;
                 $optionstext[$n] = $this->unhtmlentities($answer);
                 $optionsaward[$n] = $award;
                 ++$n;
@@ -111,13 +111,13 @@ class qformat_learnwise extends qformat_default {
             if ($optionstext[$n]) {
                 if (!isset($numcorrect)) { // single answer
                     if ($optionscorrect[$n] == 'yes') {
-                        $fraction = (int) $questionaward; 
+                        $fraction = (int) $questionaward;
                     } else {
                         $fraction = 0;
-                    } 
+                    }
                 } else { // mulitple answers
                     if ($optionscorrect[$n] == 'yes') {
-                        $fraction = $optionsaward[$n] / $totalaward; 
+                        $fraction = $optionsaward[$n] / $totalaward;
                     } else {
                         $fraction = -$optionsaward[$n] / count($optionstext);
                     }
@@ -144,8 +144,8 @@ class qformat_learnwise extends qformat_default {
         $transtable = get_html_translation_table(HTML_ENTITIES);
         $transtable = array_flip($transtable);
         return strtr($string, $transtable);
-    } 
+    }
 
 }
 
-?>
+
index ec3666481a02085fcc31b1396b40c358f28801d4..ce0fd902393c6e8b2d65e4963f9168191e6e1e61 100644 (file)
@@ -1,18 +1,18 @@
-<?php  // $Id$ 
+<?php
 /// Modified by Tom Robb 12 June 2003 to include percentage and comment insertion
 /// facility.
 
 ////////////////////////////////////////////////////////////////////////////
 /// MISSING WORD FORMAT
 ///
-/// This Moodle class provides all functions necessary to import and export 
+/// This Moodle class provides all functions necessary to import and export
 /// one-correct-answer multiple choice questions in this format:
 ///
 ///    As soon as we begin to explore our body parts as infants
-///    we become students of {=anatomy and physiology ~reflexology 
+///    we become students of {=anatomy and physiology ~reflexology
 ///    ~science ~experiment}, and in a sense we remain students for life.
-/// 
-/// Each answer is separated with a tilde ~, and the correct answer is 
+///
+/// Each answer is separated with a tilde ~, and the correct answer is
 /// prefixed with an equals sign =
 ///
 /// Percentage weights can be included by following the tilde with the
@@ -36,8 +36,8 @@ class qformat_missingword extends qformat_default {
     }
 
     function readquestion($lines) {
-    /// Given an array of lines known to define a question in 
-    /// this format, this function converts it into a question 
+    /// Given an array of lines known to define a question in
+    /// this format, this function converts it into a question
     /// object suitable for processing and insertion into Moodle.
 
         $question = $this->defaultquestion();
@@ -100,7 +100,7 @@ class qformat_missingword extends qformat_default {
                 $question->answer[]   = $answer;
                 $question->fraction[] = 1;
                 $question->feedback[] = "";
-    
+
                 return $question;
 
             default:
@@ -118,7 +118,7 @@ class qformat_missingword extends qformat_default {
                             $answeight = round(($answeight0/100),2);
                             $answer = substr($answer,(strspn($answer,"1234567890%")));
                         }
-                    } 
+                    }
                     if ($answer[0] == "="){
                         $answeight = 1;
                     }
@@ -148,10 +148,10 @@ class qformat_missingword extends qformat_default {
                     $question->answer[$key]   = $answer;
                     $question->feedback[$key] = $comment;
                 }
-    
+
                 return $question;
         }
     }
 }
 
-?>
+
index ce42e6321b0e25bc6158914cf64d9e683b643be2..531330c0db593ae474f6cf05eac359861a8caaa1 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$ 
+<?php
 
 ////////////////////////////////////////////////////////////////////////////
 /// MULTIANSWER FORMAT
@@ -32,7 +32,7 @@ class qformat_multianswer extends qformat_default {
 
         if (!empty($thequestion)) {
             $thequestion->name = $lines[0];
-            
+
             $questions[] = $thequestion;
         }
 
@@ -40,4 +40,4 @@ class qformat_multianswer extends qformat_default {
     }
 }
 
-?>
+
index c7fcba8cf249ebf49683fac042cd847cbcabfa97..5cbdc4b2fd240aad55201ec1746b4f7b070d65f3 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $id$
+<?php
 
 // note: modified from the original filter/mediaplugin/filter.php
 
@@ -32,7 +32,7 @@ function custom_mediaplugin_filter($text, $width = null, $height = null) {
         $replace .= ' pluginspage="http://www.macromedia.com/go/getflashplayer">';
         $replace .= '</embed>';
         $replace .= '</object>&nbsp;';
-    
+
         $text = preg_replace($search, $replace, $text);
     }
 
@@ -59,7 +59,7 @@ function custom_mediaplugin_filter($text, $width = null, $height = null) {
         $replace .= ' pluginspage="http://www.macromedia.com/go/getflashplayer">';
         $replace .= '</embed>';
         $replace .= '</object></p>';*/
-    
+
         $text = preg_replace($search, $replace, $text);
     }
 
@@ -116,7 +116,7 @@ function custom_mediaplugin_filter($text, $width = null, $height = null) {
         $width = 240;
         $height = 180;
     }
-    
+
     if (empty($CFG->filter_mediaplugin_ignore_mpg)) {
         $search = '/<a(.*?)href=\"([^<]+)\.(mpe?g)\"([^>]*)>(.*?)<\/a>/i';
 
@@ -126,7 +126,7 @@ function custom_mediaplugin_filter($text, $width = null, $height = null) {
         $replace .= '<param name="autoplay" value="false">';
         $replace .= '<embed src="\\2.\\3" width="' . $width . '" height="' . $height . '" controller="true" autoplay="false"> </embed>';
         $replace .= '</object></p>';
-        
+
         $text = preg_replace($search, $replace, $text);
     }
 
@@ -139,12 +139,12 @@ function custom_mediaplugin_filter($text, $width = null, $height = null) {
         $replace .= '<param name="autoplay" value="false">';
         $replace .= '<embed src="\\2.avi" width="' . $width . '" height="' . $height . '" controller="true" autoplay="false"> </embed>';
         $replace .= '</object>&nbsp;';
-    
+
         $text = preg_replace($search, $replace, $text);
     }
     return $text;
 }
 
 
-?>
+
 
index a5dfa597c893ca79988cf3849e56ae353d6d4867..eee76a347bae3b37f9071431dec33bfe570ce6fd 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 require_once("$CFG->dirroot/question/format/qti_two/qt_common.php");
 ////////////////////////////////////////////////////////////////////////////
@@ -917,4 +917,4 @@ function xml_entitize(&$collection) {
 
 }
 
-?>
+
index a94394f3213265aec356456eeb51a0f8b1d8c969..65bb7fd3f3f08842e9499108dbcdee75be77530f 100644 (file)
  *
  * @param int courseid
  * @return array containing filenames
- * @calledfrom type/<typename>/editquestion.php 
+ * @calledfrom type/<typename>/editquestion.php
  * @package questionbank
  * @subpackage importexport
  */
-function get_course_media_files($courseid) 
+function get_course_media_files($courseid)
 {
 // this code lifted from mod/quiz/question.php and modified
     global $CFG;
     $images = null;
-    
+
     make_upload_directory("$course->id");    // Just in case
     $coursefiles = get_directory_list("$CFG->dataroot/$courseid", $CFG->moddata);
     foreach ($coursefiles as $filename) {
@@ -29,7 +29,7 @@ function get_course_media_files($courseid)
         }
     }
     return $images;
-}    
+}
 
 /**
  * determines whether or not a file is an image, based on the file extension
@@ -94,7 +94,7 @@ function is_sizable_multimedia($file) {
  * @param string $file the filename
  * @param string $courseid the course id
  * @param string $alt to specify the alt tag
- * @return string either an image tag, or html for an embedded object 
+ * @return string either an image tag, or html for an embedded object
  */
 function get_media_tag($file, $courseid = 0, $alt = 'media file', $width = 0, $height = 0) {
     global $CFG;
@@ -112,14 +112,14 @@ function get_media_tag($file, $courseid = 0, $alt = 'media file', $width = 0, $h
     if (!$isimage = is_image_by_extension($file)) {
            $ismultimedia = is_multimedia_by_extension($file);
     }
-    
+
     // if there is no known width and height, try to get one
     if ($width == 0) {
          if ($isimage || is_sizable_multimedia($file)) {
-             
+
          }
-        
-    } 
+
+    }
     // create either an image link or a generic link.
     // if the moodle multimedia filter is turned on, it'll catch multimedia content in the generic link
     if (is_image_by_extension($file)) {
@@ -134,7 +134,7 @@ function get_media_tag($file, $courseid = 0, $alt = 'media file', $width = 0, $h
 /**
  * determines the x and y size of the given file
  *
- * @param string $file the filename 
+ * @param string $file the filename
  * @return array looks like array('x'=>171, 'y'=>323), or array('x'=>0, 'y'=>0) if size can't be determined
  */
 function get_file_dimensions($file) {
@@ -146,4 +146,4 @@ function get_file_dimensions($file) {
     }
 }
 
-?>
+
index 3a06d3378e02864a8d71880e130962d431c9bdf4..33333c202c72e3c576e4d6020e358df3ad85f602 100755 (executable)
@@ -19,7 +19,7 @@
                <div class="intreactive.choiceSimple">
                        <choiceInteraction responseIdentifier="{$questionid}" shuffle="false" maxChoices="1">
                {section name=answer loop=$answers}
-                               <simpleChoice identifier="{$answers[answer].id}">{$answers[answer].answer}                
+                               <simpleChoice identifier="{$answers[answer].id}">{$answers[answer].answer}
                                {if $answers[answer].feedback != ''}
                                {if $answers[answer].answer != $correctresponse.answer}
                                    <feedbackInline identifier="{$answers[answer].id}" outcomeIdentifier="FEEDBACK" showHide="hide">{$answers[answer].feedback}</feedbackInline>
@@ -33,7 +33,7 @@
            {if $hassize == 1}
                         <object type="{$question->mediamimetype}" data="{$question->mediaurl}" width="{$question->mediax}" height="{$question->mediay}" />
                {else}
-                        <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />     
+                        <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />
                {/if}
             </div>
        {/if}
index 9b6ac0d8ae4506c22b5ba2e99faeaa854071c7de..7e4bcb33f17d6f850fc207feba527e7d5b4426de 100755 (executable)
            {if $hassize == 1}
                        <object type="{$question->mediamimetype}" data="{$question->mediaurl}" width="{$question->mediax}" height="{$question->mediay}" />
                {else}
-                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />     
+                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />
                {/if}
                </div>
        {/if}
                <div class="interactive.choiceMultiple">
                        <choiceInteraction responseIdentifier="{$questionid}" shuffle="{$shuffle}" maxChoices="{$maxChoices}">
                {section name=answer loop=$answers}
-                               <simpleChoice identifier="i{$answers[answer].id}">{$answers[answer].answer}                
+                               <simpleChoice identifier="i{$answers[answer].id}">{$answers[answer].answer}
                                {if $answers[answer].feedback != ''}
                                {if $answers[answer].answer != $correctresponse.answer}
                                    <feedbackInline identifier="i{$answers[answer].id}" outcomeIdentifier="FEEDBACK" showHide="show">{$answers[answer].feedback}</feedbackInline>
@@ -44,7 +44,7 @@
                        </choiceInteraction>
                </div>
        </itemBody>
-       <responseProcessing> 
+       <responseProcessing>
                {section name=answer loop=$answers}
                <responseCondition>
                        <responseIf>
index 802cd08a57dac559fcca817e90677315469ee1ee..7be2a4ff13ee21af252e640846b619bbedd70265 100755 (executable)
@@ -64,7 +64,7 @@
            {if $hassize == 1}
                        <object type="{$question->mediamimetype}" data="{$question->mediaurl}" width="{$question->mediax}" height="{$question->mediay}" />
                {else}
-                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />     
+                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />
                {/if}
                </div>
        {/if}
@@ -96,6 +96,6 @@
        {if $answers[answer].subanswers[subanswer].feedback != ''}
        <modalFeedback outcomeIdentifier="FEEDBACK" identifier="{$answers[answer].subanswers[subanswer].id}" showHide="show">{$answers[answer].subanswers[subanswer].feedback}</modalFeedback>
 {/if}{/section}
-    {/if}   
+    {/if}
        {/section}
 </assessmentItem>
index 52d2bd94ed060bb27f6af1b892d2d424e8de8537..641b07ce350cb808a956552201a658c0a182f4de 100755 (executable)
@@ -9,7 +9,7 @@
            {if $hassize == 1}
                        <object type="{$question->mediamimetype}" data="{$question->mediaurl}" width="{$question->mediax}" height="{$question->mediay}" />
                {else}
-                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />     
+                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />
                {/if}
                </div>
        {/if}
index 76d7d23ee26afdf992ced7d35e4aa057ea757797..1acd89bd6d14ec5140c15ed480879064a763c10b 100755 (executable)
@@ -15,7 +15,7 @@
            {if $hassize == 1}
                        <object type="{$question->mediamimetype}" data="{$question->mediaurl}" width="{$question->mediax}" height="{$question->mediay}" />
                {else}
-                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />     
+                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />
                {/if}
                </div>
        {/if}
index 570d35a7cf6d505f632699fc160d78835f26fb54..8f431634bd3c9a96a6a24d4f10bea7e9a14bb83a 100755 (executable)
@@ -3,8 +3,8 @@
        <metadata>
                <schema>ADL SCORM</schema>
                <schemaversion>1.2</schemaversion>
-               <lom xmlns="http://www.imsglobal.org/xsd/imsmd_v1p2" 
-                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+               <lom xmlns="http://www.imsglobal.org/xsd/imsmd_v1p2"
+                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xsi:schemaLocation="http://www.imsglobal.org/xsd/imsmd_v1p2 imsmd_v1p2p2.xsd">
                <general>
                                <title><langstring xml:lang="{$lang}">{$quiztitle}</langstring></title>
index e1246320115234c0c6a02636a29c5b52aa41ccbc..fba30f34d612ebc027ab57188ea1f141ba3ef037 100644 (file)
@@ -35,7 +35,7 @@
            {if $hassize == 1}
                        <object type="{$question->mediamimetype}" data="{$question->mediaurl}" width="{$question->mediax}" height="{$question->mediay}" />
                {else}
-                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />     
+                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />
                {/if}
                </div>
        {/if}
index 558e0774145e14fd0a96465d66bca7f6a79e6e3f..e4f7ab97590195e2a46d1d4b23bc6ebd8faaf7ae 100755 (executable)
@@ -41,7 +41,7 @@
            {if $hassize == 1}
                        <object type="{$question->mediamimetype}" data="{$question->mediaurl}" width="{$question->mediax}" height="{$question->mediay}" />
                {else}
-                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />     
+                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />
                {/if}
                </div>
        {/if}
index e431354f25bd7109163582bb7c10c5bf2b134dad..51c189e066f526af85f4134b3580b6ed51791eb2 100755 (executable)
@@ -12,7 +12,7 @@
            {if $hassize == 1}
                        <object type="{$question->mediamimetype}" data="{$question->mediaurl}" width="{$question->mediax}" height="{$question->mediay}" />
                {else}
-                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />     
+                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />
                {/if}
                </div>
        {/if}
index d15992ecd068afbf3531b3de3e0216d2a162c31a..2f2846bd5c31ee20a89b9501c78a7dc17842d552 100755 (executable)
@@ -19,7 +19,7 @@
            {if $hassize == 1}
                        <object type="{$question->mediamimetype}" data="{$question->mediaurl}" width="{$question->mediax}" height="{$question->mediay}" />
                {else}
-                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />     
+                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />
                {/if}
                </div>
        {/if}
index 6c03937998be6e0a1d1d56a22c7e459bd9f8d06b..101c20bd9beada4c41e6d86f3418860cad11f52a 100755 (executable)
@@ -25,7 +25,7 @@
            {if $hassize == 1}
                        <object type="{$question->mediamimetype}" data="{$question->mediaurl}" width="{$question->mediax}" height="{$question->mediay}" />
                {else}
-                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />     
+                       <object type="{$question->mediamimetype}" data="{$question->mediaurl}" />
                {/if}
                </div>
        {/if}
index 9c64a4c1b36ed816c1a5deb8b89aeae1c542bc2e..81ae23a902c09378b4b7fe7dde5935834d9f560c 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 ///////////////////////////////////////////////////////////////////////////
 //                                                                       //
 // WebCT FORMAT                                                          //
@@ -277,7 +277,7 @@ class qformat_webct extends qformat_default {
                        $QuestionOK = FALSE;
                     }
                     else {
-                        // Create empty feedback array                      
+                        // Create empty feedback array
                         foreach ($question->answer as $key => $dataanswer) {
                             if(!isset( $question->feedback[$key])){
                                 $question->feedback[$key] = '';
@@ -288,15 +288,15 @@ class qformat_webct extends qformat_default {
                         if (isset($question->tempgeneralfeedback)){
                             if (isset($question->generalfeedback)) {
                                 $question->generalfeedback = $question->tempgeneralfeedback;
-                            } else {  
+                            } else {
                                 foreach ($question->answer as $key => $dataanswer) {
                                     if ($question->tempgeneralfeedback !=''){
                                         $question->feedback[$key] = $question->tempgeneralfeedback.'<br/>'.$question->feedback[$key];
                                     }
                                 }
                             }
-                            unset($question->tempgeneralfeedback);   
-                        }   
+                            unset($question->tempgeneralfeedback);
+                        }
                         $maxfraction = -1;
                         $totalfraction = 0;
                         foreach($question->fraction as $fraction) {
@@ -325,7 +325,7 @@ class qformat_webct extends qformat_default {
                                     }
                                 } else {
                                     $totalfraction = round($totalfraction,2);
-                                    if ($totalfraction != 1) {                               
+                                    if ($totalfraction != 1) {
                                         $totalfraction = $totalfraction * 100;
                                         $errors[] = "'$question->name': ".get_string("wronggrade", "quiz", $nLineCounter).' '.get_string("fractionsaddwrong", "quiz", $totalfraction);
                                         $QuestionOK = FALSE;
@@ -352,24 +352,24 @@ class qformat_webct extends qformat_default {
                                 foreach ($question->subquestions as $id=>$subquestion) {
                                     $temp = $question->subquestions[$id];
                                     $question->subquestions[$id] = $question->subanswers[$id];
-                                    $question->subanswers[$id] = $temp; 
+                                    $question->subanswers[$id] = $temp;
                                 }
                                 if (count($question->answer) < 3){
                                     // add a dummy missing question
                                     $question->name = 'Dummy question added '.$question->name ;
                                     $question->answer[] = 'dummy';
                                     $question->subanswers[] = 'dummy';
-                                    $question->subquestions[] = 'dummy';                                    
+                                    $question->subquestions[] = 'dummy';
                                     $question->fraction[] = '0.0';
                                     $question->feedback[] = '';
-                                 }   
-                                 break;   
+                                 }
+                                 break;
                             default:
                                 // No problemo
                         }
                     }
 
-                    if ($QuestionOK) {                        
+                    if ($QuestionOK) {
                        // echo "<pre>"; print_r ($question);
                         $questions[] = $question;    // store it
                         unset($question);            // and prepare a new one
@@ -484,7 +484,7 @@ class qformat_webct extends qformat_default {
             // if question isn't defined yet there is nothing to do here (avoid notices)
             if (!isset($question)) {
                 continue;
-            } 
+            }
             if (isset($question->qtype ) && CALCULATED == $question->qtype && preg_match(
                     "~^:([[:lower:]].*|::.*)-(MIN|MAX|DEC|VAL([0-9]+))::?:?($webctnumberregex)~", $line, $webct_options)) {
                 $datasetname = preg_replace('/^::/', '', $webct_options[1]);
@@ -548,8 +548,8 @@ class qformat_webct extends qformat_default {
                 foreach ($datasetnames as $datasetname) {
                     $question->dataset[$datasetname] = new stdClass();
                     $question->dataset[$datasetname]->datasetitem = array();
-                    $question->dataset[$datasetname]->name = $datasetname ; 
-                    $question->dataset[$datasetname]->distribution = 'uniform'; 
+                    $question->dataset[$datasetname]->name = $datasetname ;
+                    $question->dataset[$datasetname]->distribution = 'uniform';
                     $question->dataset[$datasetname]->status ='private';
                 }
                 continue;
@@ -558,7 +558,7 @@ class qformat_webct extends qformat_default {
             if (preg_match("~^:L([0-9]+)~i",$line,$webct_options)) {
                 $answertext="";                 // Start gathering next lines
                 $currentchoice=$webct_options[1];
-                $question->fraction[$currentchoice]=1; 
+                $question->fraction[$currentchoice]=1;
                 continue;
             }
 
@@ -583,7 +583,7 @@ class qformat_webct extends qformat_default {
                 continue;
             }
             if (preg_match('~^:LAYOUT:(.*)~i',$line,$webct_options)) {
-            //    ignore  since layout in question_multichoice  is no more used in moodle       
+            //    ignore  since layout in question_multichoice  is no more used in moodle
             //    $webct_options[1] contains either vertical or horizontal ;
                 continue;
             }
index 5e89e2798a951086eb6f185db3b17aa5f18493ed..bb73ff5cdb8303ccddbb5ced05ddb8a11da7cfc5 100755 (executable)
@@ -1,4 +1,4 @@
-<?php 
+<?php
 // Based on default.php, included by ../import.php
 /**
  * @package questionbank
@@ -15,7 +15,7 @@ function repchar( $text ) {
     $reserved = array( '#','=','~','{','}',"\n","\r" );
     $escaped = array( '\#','\=','\~','\{','\}',' ','' );
 
-    return str_replace( $reserved, $escaped, $text ); 
+    return str_replace( $reserved, $escaped, $text );
     }
 
 function writequestion( $question ) {
@@ -38,12 +38,12 @@ function writequestion( $question ) {
 
     // add header
     $expout .= "<h3>$question->name</h3>\n";
+
     // format and add question text
     $questiontext = $question->questiontext;
     $format = $question->questiontextformat;
     $formatted_text = format_text( $questiontext, $format );
-    $expout .= "<p class=\"questiontext\">$formatted_text</p>\n"; 
+    $expout .= "<p class=\"questiontext\">$formatted_text</p>\n";
 
     // selection depends on question type
     switch($question->qtype) {
@@ -85,9 +85,9 @@ function writequestion( $question ) {
         $ans_list = array();
         foreach($question->options->subquestions as $subquestion) {
            $ans_list[] = $this->repchar( $subquestion->answertext );
-        } 
+        }
         shuffle( $ans_list ); // random display order
-        
+
         // build drop down for answers
         $dropdown = "<select name=\"quest_$id\">\n";
         foreach($ans_list as $ans) {
@@ -111,7 +111,7 @@ function writequestion( $question ) {
     default:
         echo $OUTPUT->notification("No handler for qtype $question->qtype for GIFT export" );
     }
-    // close off div 
+    // close off div
     $expout .= "</div>\n\n\n";
     return $expout;
 }
@@ -124,7 +124,7 @@ function presave_process( $content ) {
 
   // get css bit
   $css_lines = file( "$CFG->dirroot/question/format/xhtml/xhtml.css" );
-  $css = implode( ' ',$css_lines ); 
+  $css = implode( ' ',$css_lines );
 
   $xp =  "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n";
   $xp .= "  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
@@ -152,4 +152,4 @@ function export_file_extension() {
 }
 
 }
-?>
+
index 4eb3b28d69d143353e3d2c11cae3106b4abee9c0..5b3a556b55e7b08e21a7e5950dfa49734fc886c2 100644 (file)
@@ -4,21 +4,21 @@
     background-color: #fff;
     color: #000;
   }
-  
+
   .question {
     border: 1px solid #ddd;
     margin: 5px;
     padding: 3px;
-    }  
-    
+    }
+
   .question h3 {
     font-weight: normal;
     font-size: 125%;
-  }    
-  
+  }
+
   .question ul {
     list-style-type: none;
-  }  
+  }
 
 </style>
 
index 1924328d5d7e7e7efa2e59180f28849507a302e1..76c80d72e8324a3d97cd2bc49c5f3dc439ddb400 100755 (executable)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 //
 ///////////////////////////////////////////////////////////////
 // XML import/export
index d4913fc8b3a1f9763a42c98a8730074bdb92f703..21a926bc040ad662eb221a1e77e5e76dd85edff1 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 /**
  * Import quiz questions into the given category
  *
     $import_form->display();
     echo $OUTPUT->footer();
 
-?>
+
index f8d0b147fb3957d49cf0c2525da60bd8c314a6a7..7e71c0acb55f224051427b32b2a48f1ec3df6436 100644 (file)
@@ -1,4 +1,4 @@
-<?php  //$Id$
+<?php
 
 require_once($CFG->libdir.'/formslib.php');
 
@@ -20,7 +20,7 @@ class question_import_form extends moodleform {
             $radioelement->setHelpButton(array("$shortname",$fileformatname,"qformat_$shortname"));
             $radioarray[] = $radioelement;
         }
-        $mform->addGroup($radioarray,'format', '', array('<br />'), false);     
+        $mform->addGroup($radioarray,'format', '', array('<br />'), false);
         $mform->addRule('format', null, 'required', null, 'client' );
 //--------------------------------------------------------------------------------
         $mform->addElement('header','general', get_string('general', 'form'));
@@ -67,8 +67,8 @@ class question_import_form extends moodleform {
 //--------------------------------------------------------------------------------
         $mform->addElement('static', 'dummy', '');
         $mform->closeHeaderBefore('dummy');
-     
-        // 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');
@@ -83,7 +83,7 @@ class question_import_form extends moodleform {
             return  NULL;
         }
     }
-    
+
     function get_importfile_realname(){
         if ($this->is_submitted() and $this->is_validated()) {
             // return the temporary filename to process
@@ -94,4 +94,4 @@ class question_import_form extends moodleform {
         }
     }
 }
-?>
+
index f779342234d6adb141b4a8c51f6e2bf3211822ff..b10f2bc1d1355d536c0c50b199f1a309255f6f18 100644 (file)
@@ -1,4 +1,4 @@
-<?php  //$Id$
+<?php
 
 require_once($CFG->libdir.'/formslib.php');
 
@@ -21,4 +21,4 @@ class question_move_form extends moodleform {
         $mform->setType('delete', PARAM_INT);
     }
 }
-?>
+
index 7eb808a49b759a783e3f9e86e9f58b707a38b5e1..0b27383d437041adc3b232e54a3628cc953a0842 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 /**
  * This page displays a preview of a question
  *
     echo '</div>';
     echo '</form>';
     echo $OUTPUT->footer();
-?>
+
index e477c7589130aed7aa08dc4b440584549c941adb..e5bf9225a206883c940ebdeda6ed73b07c2a0690 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 /**
  * Page for editing questions using the new form library.
  *
@@ -238,7 +238,7 @@ if ($mform->is_cancelled()){
     }
 
     $question = $QTYPES[$question->qtype]->save_question($question, $fromform, $COURSE, $wizardnow, true);
-    // a wizardpage from multipe pages questiontype like calculated may not allow editing the question tags 
+    // a wizardpage from multipe pages questiontype like calculated may not allow editing the question tags
     if (!empty($CFG->usetags) && isset($fromform->tags)) {
         require_once($CFG->dirroot.'/tag/lib.php');
         tag_set('question', $question->id, $fromform->tags);
@@ -305,4 +305,4 @@ if ($mform->is_cancelled()){
     $QTYPES[$question->qtype]->display_question_editing_page($mform, $question, $wizardnow);
     echo $OUTPUT->footer();
 }
-?>
+
index 860efc0536683ffa72b572f9c1389afa26ad5dd4..59b48581875956174443ebc089a71ef1a153ab84 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 /**
  * Question bank restore code.
  *
         // need to check as old questions don't have calculated_options record
         if(isset($info['#']['NUMERICAL_OPTIONS'])){
             $numerical_options = $info['#']['numerical_OPTIONS'];
-    
+
             //Iterate over numerical_options
             for($i = 0; $i < sizeof($numerical_options); $i++){
                 $num_info = $numerical_options[$i];
                 //traverse_xmlize($cal_info);                                                                 //Debug
                 //print_object ($GLOBALS['traverse_array']);                                                  //Debug
                 //$GLOBALS['traverse_array']="";                                                              //Debug
-    
+
                 //Now, build the question_numerical_options record structure
                 $numerical_options->questionid = $new_question_id;
                 $numerical_options->instructions = backup_todb($num_info['#']['INSTRUCTIONS']['0']['#']);
                 $numerical_options->unitsleft = backup_todb($num_info['#']['UNITSLEFT']['0']['#']);
                 $numerical_options->unitgradingtype = backup_todb($num_info['#']['UNITGRADINGTYPE']['0']['#']);
                 $numerical_options->unitpenalty = backup_todb($num_info['#']['UNITPENALTY']['0']['#']);
-    
+
                 //The structure is equal to the db, so insert the question_numerical__options
                 $newid = $DB->insert_record ("question_numerical__options",$numerical__options);
-    
+
                 //Do some output
                 if (($i+1) % 50 == 0) {
                     if (!defined('RESTORE_SILENTLY')) {
 
         return $status;
     }
-?>
+
index 3e01c27dcaf141811cbf4d5eed255e73f5aa6db1..8941622f208648d31a0ef94bc3b71e3c03d03d90 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Sets up the tabs used by the question bank editing page
  *
@@ -24,4 +24,4 @@
     print_tabs($tabs, $currenttab, array());
 
 
-?>
+
index d095674dbe6c4b48aa71930956f6052bb6b6b4a3..0c49db4cc70ee168f5ebd0f25e06096ba82618a8 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Used by ajax calls to toggle the flagged state of a question in an attempt.
  * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
@@ -24,7 +24,7 @@ if (!confirm_sesskey()) {
 }
 
 // Check the checksum - it is very hard to know who a question session belongs
-// to, so we require that checksum parameter is matches an md5 hash of the 
+// to, so we require that checksum parameter is matches an md5 hash of the
 // three ids and the users username. Since we are only updating a flag, that
 // probably makes it sufficiently difficult for malicious users to toggle
 // other users flags.
@@ -45,4 +45,3 @@ if (!question_update_flag($sessionid, $newstate)) {
 }
 
 echo 'OK';
-?>
\ No newline at end of file
index 0bff62a3d118e29f7a83bee9518a1cc7f14bdcc0..8aceae401786c88b4278633f34e883de7e8f1b19 100644 (file)
@@ -117,7 +117,7 @@ class question_dataset_dependent_definitions_form extends moodleform {
         $mform->addElement('hidden', 'category');
         $mform->setType('category', PARAM_RAW);
         $mform->setDefault('category', array('contexts' => array($this->categorycontext)));
-                  
+
         $mform->addElement('hidden', 'courseid');
         $mform->setType('courseid', PARAM_INT);
         $mform->setDefault('courseid', 0);
@@ -148,4 +148,4 @@ class question_dataset_dependent_definitions_form extends moodleform {
     }
 
 }
-?>
+
index 575650f77d64392442e951267c93b96de5e20f24..93ccd3b796e8b2fac07fc4f988b6307eb10580c9 100644 (file)
@@ -22,9 +22,9 @@ class question_dataset_dependent_items_form extends moodleform {
     public $regenerate;
 
     public $noofitems;
-    
+
     public $outsidelimit = false ;
-    
+
     public $commentanswers = array();
     /**
      * Add question-type specific form fields.
@@ -97,7 +97,7 @@ class question_dataset_dependent_items_form extends moodleform {
         $mform->addElement('submit', 'updateanswers', get_string('updatetolerancesparam', 'qtype_datasetdependent'));
         $mform->setAdvanced('updateanswers',true);
         $mform->registerNoSubmitButton('updateanswers');
+
         $answers = fullclone($this->question->options->answers);
         $key1 =1;
         foreach ($answers as $key => $answer) {
@@ -122,10 +122,10 @@ class question_dataset_dependent_items_form extends moodleform {
                 $mform->setAdvanced('tolerance['.$key.']',true);
                 $mform->addElement('select', 'tolerancetype['.$key.']', get_string('tolerancetype', 'quiz'), $this->qtypeobj->tolerance_types());
                 $mform->setAdvanced('tolerancetype['.$key.']',true);
-        
+
                 $mform->addElement('select', 'correctanswerlength['.$key.']', get_string('correctanswershows', 'qtype_calculated'), range(0, 9));
                 $mform->setAdvanced('correctanswerlength['.$key.']',true);
-        
+
                 $answerlengthformats = array('1' => get_string('decimalformat', 'quiz'), '2' => get_string('significantfiguresformat', 'quiz'));
                 $mform->addElement('select', 'correctanswerformat['.$key.']', get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats);
                 $mform->setAdvanced('correctanswerformat['.$key.']',true);
@@ -133,7 +133,7 @@ class question_dataset_dependent_items_form extends moodleform {
                 $mform->setAdvanced('dividertolerance',true);
             }
             $key1++;
-        }    
+        }
 
         $addremoveoptions = array();
         $addremoveoptions['1']='1';
@@ -211,7 +211,7 @@ class question_dataset_dependent_items_form extends moodleform {
         $mform->addElement('hidden', 'category');
         $mform->setType('category', PARAM_RAW);
         $mform->setDefault('category', array('contexts' => array($this->categorycontext)));
-              
+
         $mform->addElement('hidden', 'cmid');
         $mform->setType('cmid', PARAM_INT);
         $mform->setDefault('cmid', 0);
@@ -244,10 +244,10 @@ class question_dataset_dependent_items_form extends moodleform {
                         if( is_array($fromform->correctanswerformat[$key])) $fromform->correctanswerformat[$key]= $fromform->correctanswerformat[$key][0];
                         $answer->correctanswerformat = $fromform->correctanswerformat[$key];
                     }
-                    $this->qtypeobj->save_question_calculated($question,$fromform); 
-                }else {             
+                    $this->qtypeobj->save_question_calculated($question,$fromform);
+                }else {
                 foreach ($answers as $key => $answer){
-                  
+
                     $formdata['tolerance['.$key.']'] = $answer->tolerance;
                     $formdata['tolerancetype['.$key.']'] = $answer->tolerancetype;
                     $formdata['correctanswerlength['.$key.']'] = $answer->correctanswerlength;
@@ -351,7 +351,7 @@ class question_dataset_dependent_items_form extends moodleform {
         $errors = array();
         if (isset($data['backtoquiz']) && ($this->noofitems==0) ){
             $errors['warning'] = get_string('warning', 'mnet');
-        } 
+        }
         if ($this->outsidelimit){
          //   if(!isset($errors['warning'])) $errors['warning']=' ';
            $errors['outsidelimits'] = get_string('oneanswertrueansweroutsidelimits','qtype_calculated');
@@ -361,18 +361,18 @@ class question_dataset_dependent_items_form extends moodleform {
             if(! is_numeric($number)){
                 if (stristr($number,',')){
                     $errors['number['.$key.']'] = get_string('The , cannot be used, use . as in 0.013 or 1.3e-2', 'qtype_datasetdependent');
-                }else {    
+                }else {
                     $errors['number['.$key.']'] = get_string('This is not a valid number', 'qtype_datasetdependent');
                 }
             }else if( stristr($number,'x')){
                 $errors['number['.$key.']'] = get_string('Hexadecimal format (i.e. 0X12d) is not allowed', 'qtype_datasetdependent');
             } else if( is_nan($number)){
                 $errors['number['.$key.']'] = get_string('is a NAN number', 'qtype_datasetdependent');
-            }        
+            }
         }
         return $errors;
     }
 
 
 }
-?>
+
index 521693c289dbdcab0e0a608a0d9e80a5882eb18a..a689f7cf8c097f601732d190c7c88a8e97df3e50 100644 (file)
@@ -1,6 +1,6 @@
-<?php  // $Id$
+<?php
 
-// This file keeps track of upgrades to 
+// This file keeps track of upgrades to
 // the calculated qtype plugin
 //
 // Sometimes, changes between versions involve
@@ -120,9 +120,9 @@ function xmldb_qtype_calculated_upgrade($oldversion) {
         }
         upgrade_plugin_savepoint($result, 2009092000, 'qtype', 'calculated');
 
-        
+
     }
-    
+
 /// calculated savepoint reached
 /// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
 ///     $result = result of database_manager methods
@@ -132,4 +132,4 @@ function xmldb_qtype_calculated_upgrade($oldversion) {
     return $result;
 }
 
-?>
+
index 80537cc33f68a343bd10b72eea6ef2442aadfa80..0889aea11903e99f59c9aca4024142c62d91898d 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Defines the editing form for the calculated question type.
  *
@@ -63,7 +63,7 @@ class question_edit_calculated_form extends question_edit_form {
         }else {
             $addrepeated[] =& $mform->createElement('text', 'tolerance', get_string('tolerance', 'qtype_calculated'));
             $addrepeated[] =& $mform->createElement('select', 'tolerancetype', get_string('tolerancetype', 'quiz'), $this->qtypeobj->tolerance_types());
-        }        
+        }
         $repeatedoptions['tolerance']['type'] = PARAM_NUMBER;
         $repeatedoptions['tolerance']['default'] = 0.01;
 
@@ -74,7 +74,7 @@ class question_edit_calculated_form extends question_edit_form {
         $addrepeated[] =&  $mform->createElement('select', 'correctanswerformat', get_string('correctanswershowsformat', 'qtype_calculated'), $answerlengthformats);
         array_splice($repeated, 3, 0, $addrepeated);
         if ($this->editasmultichoice == 1){
-             $repeated[1]->setLabel('...<strong>{={x}+..}</strong>...');       
+             $repeated[1]->setLabel('...<strong>{={x}+..}</strong>...');
         }else {
             $repeated[1]->setLabel(get_string('correctanswerformula', 'quiz').'=');
 
@@ -91,7 +91,7 @@ class question_edit_calculated_form extends question_edit_form {
     function definition_inner(&$mform) {
         global $QTYPES;
         $this->qtypeobj =& $QTYPES[$this->qtype()];
-      // echo code left for testing period 
+      // echo code left for testing period
       //  echo "<p>question ".optional_param('multichoice', '', PARAM_RAW)." optional<pre>";print_r($this->question);echo "</pre></p>";
         $label = get_string("sharedwildcards", "qtype_datasetdependent");
         $mform->addElement('hidden', 'initialcategory', 1);
@@ -103,7 +103,7 @@ class question_edit_calculated_form extends question_edit_form {
                 $mform->registerNoSubmitButton($addfieldsname);
         $this->editasmultichoice =  0 ;
         if ( isset($this->question->options->multichoice) && $this->question->options->multichoice == '1'){
-            $this->editasmultichoice = 1 ;   
+            $this->editasmultichoice = 1 ;
         }else {
             if ( !isset($this->question->id ) && 1 ==  optional_param('multichoice', '', PARAM_RAW )){
                 $this->editasmultichoice = 1 ;
@@ -117,21 +117,21 @@ class question_edit_calculated_form extends question_edit_form {
                 $this->editasmultichoice = 0 ;
             }
         }
-            
+
    /*      if ( '' !=  optional_param('changetomultichoice', '', PARAM_RAW)){
-           $this->editasmultichoice = 1 ;            
+           $this->editasmultichoice = 1 ;
         }
          if ( '' !=  optional_param('changetocalculated', '', PARAM_RAW)){
-            $this->editasmultichoice = 0 ;            
+            $this->editasmultichoice = 0 ;
        }*/
 
         $mform->insertElementBefore(    $mform->createElement('submit', $addfieldsname, $addstring),'listcategory');
         $mform->registerNoSubmitButton('createoptionbutton');
-                                            
+
         if(!isset($this->question->id ) ){
             $mform->addElement('header', 'choicehdr',get_string('Choosingcreationmode', 'qtype_calculated'));
             $createoptions = Array();
-                                                    
+
             $createoptions['0']=get_string('Regularcalculated', 'qtype_calculated');
             $createoptions['1']=get_string('Multiplechoicecalculated', 'qtype_calculated');
             $addgrp1 = array();
@@ -148,11 +148,11 @@ class question_edit_calculated_form extends question_edit_form {
             $menu = array(get_string('answersingleno', 'qtype_multichoice'), get_string('answersingleyes', 'qtype_multichoice'));
             $mform->addElement('select', 'single', get_string('answerhowmany', 'qtype_multichoice'), $menu);
             $mform->setDefault('single', 1);
-    
+
             $mform->addElement('advcheckbox', 'shuffleanswers', get_string('shuffleanswers', 'qtype_multichoice'), null, null, array(0,1));
             $mform->setHelpButton('shuffleanswers', array('multichoiceshuffle', get_string('shuffleanswers','qtype_multichoice'), 'qtype_multichoice'));
             $mform->setDefault('shuffleanswers', 1);
-    
+
             $numberingoptions = $QTYPES['multichoice']->get_numbering_styles();
             $menu = array();
             foreach ($numberingoptions as $numberingoption) {
@@ -164,7 +164,7 @@ class question_edit_calculated_form extends question_edit_form {
             $mform->addElement('header', 'choicehdr', get_string('regularcalculatedquestion', 'qtype_calculated'));
             $mform->addElement('hidden','single', '1');
             $mform->setType('single', PARAM_INT);
-            
+
             $mform->addElement('hidden','shuffleanswers', '1');
             $mform->setType('shuffleanswers', PARAM_INT);
             $mform->addElement('hidden','answernumbering', 'abc');
@@ -179,7 +179,7 @@ class question_edit_calculated_form extends question_edit_form {
             $this->add_per_answer_fields($mform, get_string('answerhdr', 'qtype_calculated', '{no}'),
                 $creategrades->gradeoptions, 1, 1);
         }
-            
+
 
         $repeated = array();
         if ($this->editasmultichoice == 1){
@@ -189,22 +189,22 @@ class question_edit_calculated_form extends question_edit_form {
             $mform->setConstants(array('nounits'=>$nounits));
             for ($i=0; $i< $nounits; $i++) {
                 $mform->addElement('hidden','unit'."[$i]", optional_param('unit'."[$i]", '', PARAM_NOTAGS));
-                $mform->setType('unit'."[$i]", PARAM_NOTAGS); 
+                $mform->setType('unit'."[$i]", PARAM_NOTAGS);
                 $mform->addElement('hidden', 'multiplier'."[$i]", optional_param('multiplier'."[$i]", '', PARAM_NUMBER));
                 $mform->setType('multiplier'."[$i]", PARAM_NUMBER);
-            }  
+            }
           $mform->addElement('hidden','unitgradingtype',optional_param('unitgradingtype', '', PARAM_INT)) ;
           $mform->addElement('hidden','unitpenalty',optional_param('unitpenalty', '', PARAM_NUMBER)) ;
           $mform->addElement('hidden','showunits',optional_param('showunits', '', PARAM_INT)) ;
-          $mform->addElement('hidden','unitsleft',optional_param('unitsleft', '', PARAM_INT)) ; 
-          $mform->addElement('hidden','instructions',optional_param('instructions', '', PARAM_RAW)) ;  
+          $mform->addElement('hidden','unitsleft',optional_param('unitsleft', '', PARAM_INT)) ;
+          $mform->addElement('hidden','instructions',optional_param('instructions', '', PARAM_RAW)) ;
 
         }else {
         $QTYPES['numerical']->edit_numerical_options($mform,$this);
-            $repeated[] =& $mform->createElement('header', 'unithdr', get_string('unithdr', 'qtype_numerical', '{no}'));    
+            $repeated[] =& $mform->createElement('header', 'unithdr', get_string('unithdr', 'qtype_numerical', '{no}'));
             $repeated[] =& $mform->createElement('text', 'unit', get_string('unit', 'quiz'));
             $repeated[] =& $mform->createElement('text', 'multiplier', get_string('multiplier', 'quiz'));
-        
+
         $mform->setType('unit', PARAM_NOTAGS);
 
         $mform->setType('multiplier', PARAM_NUMBER);
@@ -339,7 +339,7 @@ class question_edit_calculated_form extends question_edit_form {
     }
 
     function validation($data, $files) {
-              // echo code left for testing period 
+              // echo code left for testing period
 
               //  echo "<p>question <pre>";print_r($this->question);echo "</pre></p>";
               //  echo "<p>data <pre>";print_r($data);echo "</pre></p>";
@@ -382,7 +382,7 @@ class question_edit_calculated_form extends question_edit_form {
         if ($data['multichoice']== 1 ){
             foreach ($answers as $key => $answer){
                 $trimmedanswer = trim($answer);
-                if (($trimmedanswer!='')||$answercount==0){    
+                if (($trimmedanswer!='')||$answercount==0){
                     //verifying for errors in {=...} in answer text;
                     $qanswer = "";
                     $qanswerremaining =  $trimmedanswer ;
@@ -415,7 +415,7 @@ class question_edit_calculated_form extends question_edit_form {
                     if ($data['fraction'][$key] == 1) {
                        $maxgrade = true;
                     }
-    
+
                     $answercount++;
                 }
                 //check grades
@@ -426,14 +426,14 @@ class question_edit_calculated_form extends question_edit_form {
                     if ($data['fraction'][$key] > $maxfraction) {
                         $maxfraction = $data['fraction'][$key];
                     }
-                }        
+                }
             }
             if ($answercount==0){
                 $errors['answer[0]'] = get_string('notenoughanswers', 'qtype_multichoice', 2);
                 $errors['answer[1]'] = get_string('notenoughanswers', 'qtype_multichoice', 2);
             } elseif ($answercount==1){
                 $errors['answer[1]'] = get_string('notenoughanswers', 'qtype_multichoice', 2);
-    
+
             }
 
             /// Perform sanity checks on fractional grades
@@ -471,11 +471,11 @@ class question_edit_calculated_form extends question_edit_form {
                     if ($data['fraction'][$key] == 1) {
                        $maxgrade = true;
                     }
-    
+
                     $answercount++;
                 }
                 //check grades
-    
+
                 //TODO how should grade checking work here??
                 /*if ($answer != '') {
                     if ($data['fraction'][$key] > 0) {
@@ -486,7 +486,7 @@ class question_edit_calculated_form extends question_edit_form {
                     }
                 }*/
             }
-        
+
             //grade checking :
             /// Perform sanity checks on fractional grades
             /*if ( ) {
@@ -516,7 +516,7 @@ class question_edit_calculated_form extends question_edit_form {
                         if (!is_numeric($trimmedmultiplier)){
                             $errors['multiplier['.$key.']'] = get_string('mustbenumeric', 'qtype_calculated');
                         }
-    
+
                     }
                 }
             }
@@ -531,4 +531,4 @@ class question_edit_calculated_form extends question_edit_form {
         return $errors;
     }
 }
-?>
+
index 9c223ed7c18622b49f3a259066f322e7074158ec..6dc9eb5af0e2465eb7acb2d5c8e1112c63a9b794 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 /////////////////
 // CALCULATED ///
@@ -34,7 +34,7 @@ class question_calculated_qtype extends default_questiontype {
           //  return false;
           $question->options->synchronize = 0;
           $question->options->multichoice = 0;
-          
+
         }
     //    echo "<p> questionoptions <pre>";print_r($question);echo "</pre></p>";
         $QTYPES['numerical']->get_numerical_options($question);
@@ -147,7 +147,7 @@ class question_calculated_qtype extends default_questiontype {
             $question->answers = $question->answer;
         }
         // calculated options
-        $update = true ; 
+        $update = true ;
         $options = $DB->get_record("question_calculated_options", array("question" => $question->id));
         if (!$options) {
             $update = false;
@@ -332,11 +332,11 @@ class question_calculated_qtype extends default_questiontype {
         $state->responses = array('' => $regs[2]);
         $virtualqtype = $this->get_virtual_qtype( $question);
    //     if ( isset($question->options->multichoice) && $question->options->multichoice == '1'){
-                   
+
 
             return $virtualqtype->restore_session_and_responses($question, $state);
       //  }else { // numerical
-            
+
       //  return true;
     }
 
@@ -355,27 +355,27 @@ class question_calculated_qtype extends default_questiontype {
                     FROM {question_datasets} d,
                          {question_dataset_definitions} i
                     WHERE d.question = ?
-                    AND   d.datasetdefinition = i.id  
-                    AND   i.category != 0 
+                    AND   d.datasetdefinition = i.id
+                    AND   i.category != 0
                    ";
         if (!$question->options->synchronize || !$records = $DB->get_records_sql($sql, array($question->id))) {
-            $synchronize_calculated  =  false ; 
+            $synchronize_calculated  =  false ;
         }else {
-            $synchronize_calculated  = true ; 
-        }    
+            $synchronize_calculated  = true ;
+        }
 
         // Choose a random dataset
         if ( $synchronize_calculated === false ) {
             $state->options->datasetitem = rand(1, $maxnumber);
         }else{
-            $state->options->datasetitem = intval( $maxnumber * substr($attempt->timestart,-2) /100 ) ;            
+            $state->options->datasetitem = intval( $maxnumber * substr($attempt->timestart,-2) /100 ) ;
             if ($state->options->datasetitem < 1) {
                 $state->options->datasetitem =1 ;
             } else if ($state->options->datasetitem > $maxnumber){
                 $state->options->datasetitem = $maxnumber ;
             }
-           
-        };  
+
+        };
         $state->options->dataset =
          $this->pick_question_dataset($question,$state->options->datasetitem);
       //  $state->responses = array('' => '');
@@ -395,18 +395,18 @@ class question_calculated_qtype extends default_questiontype {
                 $state->responses = array();
             }
             return true;
-        } else { // numerical   
+        } else { // numerical
                     $virtualqtype = $this->get_virtual_qtype( $question);
-            return $virtualqtype->create_session_and_responses($question, $state, $cmoptions, $attempt); 
+            return $virtualqtype->create_session_and_responses($question, $state, $cmoptions, $attempt);
         }
-        
+
     }
-    
+
     function save_session_and_responses(&$question, &$state) {
         global $DB;
-        $responses = 'dataset'.$state->options->datasetitem.'-' ;       
+        $responses = 'dataset'.$state->options->datasetitem.'-' ;
         if ( isset($question->options->multichoice) && $question->options->multichoice == '1'){
+
         // Bundle the answer order and the responses into the legacy answer
         // field.
         // The serialized format for multiple choice quetsions
@@ -419,7 +419,7 @@ class question_calculated_qtype extends default_questiontype {
             $responses .= implode(',', $state->options->order) . ':';
             $responses .= implode(',', $state->responses);
         }else {
-        // regular numeric type 
+        // regular numeric type
          if(isset($state->responses['unit']) && isset($question->options->units[$state->responses['unit']])){
             $responses .= $state->responses['answer'].'|||||'.$question->options->units[$state->responses['unit']]->unit;
         }else if(isset($state->responses['unit'])){
@@ -428,10 +428,10 @@ class question_calculated_qtype extends default_questiontype {
             $responses .= $state->responses['answer'].'|||||';
         }
 
-        
+
         }
-         
-        // Set the legacy answer field        
+
+        // Set the legacy answer field
         if (!$DB->set_field('question_states', 'answer', $responses, array('id'=> $state->id))) {
             return false;
         }
@@ -740,7 +740,7 @@ class question_calculated_qtype extends default_questiontype {
     function delete_question($questionid) {
         global $DB;
         $DB->delete_records("question_calculated", array("question" => $questionid));
-        if ( $DB->table_exists("question_calculated_options") ){       
+        if ( $DB->table_exists("question_calculated_options") ){
             $DB->delete_records("question_calculated_options", array("question" => $questionid));
         };
         $DB->delete_records("question_numerical_units", array("question" => $questionid));
@@ -749,7 +749,7 @@ class question_calculated_qtype extends default_questiontype {
                 if (!$DB->get_records_select(
                         'question_datasets',
                         "question != ?
-                        AND datasetdefinition = ?;", array($questionid, $dataset->datasetdefinition))){                                 
+                        AND datasetdefinition = ?;", array($questionid, $dataset->datasetdefinition))){
                     $DB->delete_records('question_dataset_definitions', array('id' => $dataset->datasetdefinition));
                     $DB->delete_records('question_dataset_items', array('definition' => $dataset->datasetdefinition));
                 }
@@ -760,8 +760,8 @@ class question_calculated_qtype extends default_questiontype {
     }
     function test_response(&$question, &$state, $answer) {
           $virtualqtype = $this->get_virtual_qtype( $question);
-        return $virtualqtype->test_response($question, $state, $answer);       
-            
+        return $virtualqtype->test_response($question, $state, $answer);
+
     }
     function compare_responses(&$question, $state, $teststate) {
                  $virtualqtype = $this->get_virtual_qtype( $question);
@@ -780,7 +780,7 @@ class question_calculated_qtype extends default_questiontype {
                 $unit = '';
             }
         }
-        
+
         // We modify the question to look like a numerical question
         $numericalquestion = fullclone($question);
         if ($question->options->multichoice == 1 ) {
@@ -835,7 +835,7 @@ class question_calculated_qtype extends default_questiontype {
                 $qtext = $qtext.$str ;
         }
         $numericalquestion->questiontext = $qtext.$qtextremaining ; // end replace equations
-        
+
         $virtualqtype->print_question_formulation_and_controls($numericalquestion, $state, $cmoptions, $options);
     }
     function grade_responses(&$question, &$state, $cmoptions) {
@@ -913,7 +913,7 @@ class question_calculated_qtype extends default_questiontype {
      /*   if ($this->options->multichoice == 1 ) {
             require_once("$CFG->dirroot/question/type/multichoice/questiontype.php");
             return new question_multichoice_qtype();
-        }else { */           
+        }else { */
             require_once("$CFG->dirroot/question/type/numerical/questiontype.php");
             return new question_numerical_qtype();
        // }
@@ -969,7 +969,7 @@ class question_calculated_qtype extends default_questiontype {
             $select1 = html_select::make($lengthoptions, 'calclength[]', $regs[4], false);
             $select1->nothingvalue = '';
             $menu1 = $OUTPUT->select($select1);
-            
+
             $select2 = html_select::make(array('uniform' => get_string('uniform', 'quiz'),
                                              'loguniform' => get_string('loguniform', 'quiz')), 'calcdistribution[]', $regs[1], false);
             $select2->nothingvalue = '';
@@ -1043,11 +1043,11 @@ class question_calculated_qtype extends default_questiontype {
 
                /**
                * This function get the dataset items using id as unique parameter and return an
-               * array with itemnumber as index sorted ascendant 
-               * If the multiple records with the same itemnumber exist, only the newest one 
+               * array with itemnumber as index sorted ascendant
+               * If the multiple records with the same itemnumber exist, only the newest one
                * i.e with the greatest id is used, the others are ignored but not deleted.
                * MDL-19210
-               */ 
+               */
     function get_database_dataset_items($definition){
        global $CFG, $DB;
                $databasedataitems = $DB->get_records_sql( // Use number as key!!
@@ -1065,7 +1065,7 @@ class question_calculated_qtype extends default_questiontype {
                ksort($dataitems);
                return $dataitems ;
     }
-            
+
     function save_dataset_items($question, $fromform){
         global $CFG, $DB;
         // max datasets = 100 items
@@ -1227,7 +1227,7 @@ class question_calculated_qtype extends default_questiontype {
                 $strheader .= $delimiter.$answer->answer;
             }
             if($question->options->multichoice == 1 ){
-                $delimiter = '<br/>';            
+                $delimiter = '<br/>';
             }else{
                 $delimiter = '<br/><br/><br/>';
             }
@@ -1266,7 +1266,7 @@ class question_calculated_qtype extends default_questiontype {
                     }else {
                         eval('$answer->answer = '.$formula.';') ;
                         $virtualqtype->get_tolerance_interval($answer);
-                    } 
+                    }
             if ($answer->min === '') {
                 // This should mean that something is wrong
                 $comment->stranswers[$key] = " $formattedanswer->answer".'<br/><br/>';
@@ -1331,8 +1331,8 @@ class question_calculated_qtype extends default_questiontype {
                 }
                 $answer->answer = $qtext.$qtextremaining ; ;
                 $comment->stranswers[$key]= $answer->answer ;
-            
-            
+
+
           /*  $formula = $this->substitute_variables($answer->answer,$data);
             $formattedanswer = qtype_calculated_calculate_answer(
                     $answer->answer, $data, $answer->tolerance,
@@ -1344,7 +1344,7 @@ class question_calculated_qtype extends default_questiontype {
                     }else {
                         eval('$answer->answer = '.$formula.';') ;
                         $virtualqtype->get_tolerance_interval($answer);
-                    } 
+                    }
             if ($answer->min === '') {
                 // This should mean that something is wrong
                 $comment->stranswers[$key] = " $formattedanswer->answer".'<br/><br/>';
@@ -1457,7 +1457,7 @@ class question_calculated_qtype extends default_questiontype {
 
     function substitute_variables($str, $dataset) {
           //  testing for wrong numerical values
-          // all calculations used this function so testing here should be OK 
+          // all calculations used this function so testing here should be OK
 
         foreach ($dataset as $name => $value) {
             $val = $value ;
@@ -1467,7 +1467,7 @@ class question_calculated_qtype extends default_questiontype {
                 $a->value = $value ;
                     echo $OUTPUT->notification(get_string('notvalidnumber','qtype_calculated',$a));
                     $val = 1.0 ;
-            }                   
+            }
             if($val < 0 ){
                 $str = str_replace('{'.$name.'}', '('.$val.')', $str);
             } else {
@@ -1483,7 +1483,7 @@ class question_calculated_qtype extends default_questiontype {
         }
         return $str;
     }
-         
+
 
     function substitute_variables_and_eval($str, $dataset) {
         $formula = $this->substitute_variables($str, $dataset) ;
@@ -1543,7 +1543,7 @@ class question_calculated_qtype extends default_questiontype {
     function save_dataset_definitions($form) {
         global $DB;
         // save synchronize
-        
+
         // Save datasets
         $datasetdefinitions = $this->get_dataset_definitions($form->id, $form->dataset);
         $tmpdatasets = array_flip($form->dataset);
@@ -1730,7 +1730,7 @@ class question_calculated_qtype extends default_questiontype {
                }
         return $dataset;
     }
-    
+
     function dataset_options_from_database($form, $name,$prefix='',$langfile='quiz') {
 
         // First options - it is not a dataset...
@@ -1738,7 +1738,7 @@ class question_calculated_qtype extends default_questiontype {
 
         // Construct question local options
         global $CFG, $DB;
-        $type = 1 ; // only type = 1 (i.e. old 'LITERAL') has ever been used 
+        $type = 1 ; // only type = 1 (i.e. old 'LITERAL') has ever been used
         if ( ! $currentdatasetdef = $DB->get_record_sql(
                 "SELECT a.*
                    FROM {question_dataset_definitions} a,
@@ -1758,9 +1758,9 @@ class question_calculated_qtype extends default_questiontype {
         }
         // Construct question category options
         $categorydatasetdefs = $DB->get_records_sql(
-                "SELECT b.question, a.* 
+                "SELECT b.question, a.*
                    FROM {question_datasets} b,
-                        {question_dataset_definitions} a                       
+                        {question_dataset_definitions} a
                   WHERE a.id = b.datasetdefinition
                     AND a.type = '1'
                     AND a.category = ?
@@ -2002,14 +2002,14 @@ class question_calculated_qtype extends default_questiontype {
         // need to check as old questions don't have calculated_options record
         if(isset($info['#']['CALCULATED_OPTIONS'])){
             $calculatedoptions = $info['#']['CALCULATED_OPTIONS'];
-    
+
             //Iterate over calculated_options
             for($i = 0; $i < sizeof($calculatedoptions); $i++){
                 $cal_info = $calculatedoptions[$i];
                 //traverse_xmlize($cal_info);                                                                 //Debug
                 //print_object ($GLOBALS['traverse_array']);                                                  //Debug
                 //$GLOBALS['traverse_array']="";                                                              //Debug
-    
+
                 //Now, build the question_calculated_options record structure
                 $calculated_options->questionid = $new_question_id;
                 $calculated_options->synchronize = backup_todb($cal_info['#']['SYNCHRONIZE']['0']['#']);
@@ -2020,10 +2020,10 @@ class question_calculated_qtype extends default_questiontype {
                 $calculated_options->partiallycorrectfeedback = backup_todb($cal_info['#']['PARTIALLYCORRECTFEEDBACK']['0']['#']);
                 $calculated_options->incorrectfeedback = backup_todb($cal_info['#']['INCORRECTFEEDBACK']['0']['#']);
                 $calculated_options->answernumbering = backup_todb($cal_info['#']['ANSWERNUMBERING']['0']['#']);
-    
+
                 //The structure is equal to the db, so insert the question_calculated_options
                 $newid = $DB->insert_record ("question_calculated_options",$calculated_options);
-    
+
                 //Do some output
                 if (($i+1) % 50 == 0) {
                     if (!defined('RESTORE_SILENTLY')) {
@@ -2302,4 +2302,4 @@ function dump($obj) {
     echo "</pre><br />\n";
 }
 
-?>
+
index c11728d2e66baf9236cb22d8ac16051906e4d3be..3af9c601afbce2e1b225af25bf56cb1c27e41c39 100644 (file)
@@ -1,5 +1,5 @@
-<?PHP // $Id$
+<?php
 
 $plugin->version  = 2009092000;
 $plugin->requires = 2007101000;
-?>
+
index 0ef397a17fce38da0ed274b160d33c4185c1a55f..16ab7c0c36a7fc8a77d37df68386e8df31de207a 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Defines the editing form for the calculated simplequestion type.
  *
@@ -27,26 +27,26 @@ class question_edit_calculatedsimple_form extends question_edit_form {
     public $datasetdefs;
 
     public $reload = false ;
-    
+
     public $maxnumber = -1;
 
     public $regenerate = true;
 
     public $noofitems;
-    
+
     public $outsidelimit = false ;
-    
-    public $commentanswer = array(); 
-    
+
+    public $commentanswer = array();
+
     public $answer = array();
 
     public $nonemptyanswer = array();
-    
+
     public $numbererrors = array();
 
-    public $formdata = array();      
+    public $formdata = array();
+
 
-     
 
     function question_edit_calculatedsimple_form(&$submiturl, &$question, &$category, &$contexts, $formeditable = true){
         global $QTYPES, $SESSION, $CFG, $DB;
@@ -60,24 +60,24 @@ class question_edit_calculatedsimple_form extends question_edit_form {
         //so this will only set the values to the actual question database content which is not what we want
         //so this should be removed from here
         // get priority to paramdatasets
-        
+
         if  (  "1" == optional_param('reload','', PARAM_INT )) {
             $this->reload = true ;
         }else {
             $this->reload = false ;
         }
-        if(!$this->reload ){ // use database data as this is first pass 
+        if(!$this->reload ){ // use database data as this is first pass
             // question->id == 0 so no stored datasets
-            // else get datasets 
+            // else get datasets
             if ( !empty($question->id)) {
                 if (empty($question->options)) {
                     $this->get_question_options($question);
                 }
                 $this->datasetdefs = $this->qtypeobj->get_dataset_definitions($question->id, array());
-            
+
                 if(!empty($this->datasetdefs)){
                     foreach ($this->datasetdefs as $defid => $datasetdef) {
-                        // first get the items in case their number does not correspond to itemcount        
+                        // first get the items in case their number does not correspond to itemcount
                         if (isset($datasetdef->id)) {
                             $this->datasetdefs[$defid]->items = $this->qtypeobj->get_database_dataset_items($datasetdef->id);
                             if ( $this->datasetdefs[$defid]->items != '') {
@@ -97,45 +97,45 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                 foreach($this->question->options->answers as $answer){
                      $this->answer[$i] = $answer ;
                      $i++;
-                } 
+                }
                 $this->nonemptyanswer = $this->answer ;
-            }        
+            }
             $datasettoremove = false;
-            $newdatasetvalues = false ; 
-            $newdataset = false ; 
-        }else { 
+            $newdatasetvalues = false ;
+            $newdataset = false ;
+        }else {
             // handle reload to get values from the form-elements
             // answers, datasetdefs and data_items
-            // In any case the validation step will warn the user of any error in settings the values. 
-            // Verification for the specific dataset values as the other parameters 
+            // In any case the validation step will warn the user of any error in settings the values.
+            // Verification for the specific dataset values as the other parameters
             // unints, feeedback etc are handled elsewhere
             // handle request buttons :
-            //    'analyzequestion' (Identify the wild cards {x..} present in answers) 
+            //    'analyzequestion' (Identify the wild cards {x..} present in answers)
             //    'addbutton' (create new set of datatitems)
             //    'updatedatasets' is handled automatically on each reload
-            // The analyzequestion is done every time on reload  
+            // The analyzequestion is done every time on reload
             // to detect any new wild cards so that the current display reflects
             // the mandatory (i.e. in answers) datasets
             //  to implement : don't do any changes if the question is used in a quiz.
-            // If new datadef, new properties should erase items. 
-            // Most of the data 
+            // If new datadef, new properties should erase items.
+            // Most of the data
             $datasettoremove = false;
-            $newdatasetvalues = false ; 
-            $newdataset = false ; 
+            $newdatasetvalues = false ;
+            $newdataset = false ;
             $dummyform = new stdClass();
             $mandatorydatasets = array();
-            // should not test on adding a new answer 
+            // should not test on adding a new answer
             // should test if there are already olddatasets or if the 'analyzequestion' submit button has been clicked
-            if (''  != optional_param('datasetdef', '', PARAM_RAW) || ''  != optional_param('analyzequestion', '', PARAM_RAW)){ 
-
-                if  (  $dummyform->answer = optional_param('answer', '', PARAM_NOTAGS)) { // there is always at least one answer... 
-                    $tolerance = optional_param('tolerance', '', PARAM_NUMBER); 
-                    $tolerancetype = optional_param('tolerancetype', '', PARAM_NUMBER); 
-                    $correctanswerlength = optional_param('correctanswerlength', '', PARAM_INT); 
-                    $correctanswerformat = optional_param('correctanswerformat', '', PARAM_INT); 
-                    
+            if (''  != optional_param('datasetdef', '', PARAM_RAW) || ''  != optional_param('analyzequestion', '', PARAM_RAW)){
+
+                if  (  $dummyform->answer = optional_param('answer', '', PARAM_NOTAGS)) { // there is always at least one answer...
+                    $tolerance = optional_param('tolerance', '', PARAM_NUMBER);
+                    $tolerancetype = optional_param('tolerancetype', '', PARAM_NUMBER);
+                    $correctanswerlength = optional_param('correctanswerlength', '', PARAM_INT);
+                    $correctanswerformat = optional_param('correctanswerformat', '', PARAM_INT);
+
                     foreach( $dummyform->answer as $key => $answer ) {
-                        if(trim($answer) != ''){  // just look for non-empty 
+                        if(trim($answer) != ''){  // just look for non-empty
                             $this->answer[$key]=new stdClass();
                             $this->answer[$key]->answer = $answer;
                             $this->answer[$key]->fraction = $fraction[$key];
@@ -150,12 +150,12 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                 }
                 $this->datasetdefs = array();
                 // rebuild datasetdefs from old values
-                if ($olddef  = optional_param('datasetdef', '', PARAM_RAW)){ 
-                    $calcmin = optional_param('calcmin', '', PARAM_NUMBER); 
-                    $calclength = optional_param('calclength', '', PARAM_INT); 
+                if ($olddef  = optional_param('datasetdef', '', PARAM_RAW)){
+                    $calcmin = optional_param('calcmin', '', PARAM_NUMBER);
+                    $calclength = optional_param('calclength', '', PARAM_INT);
                     $calcmax = optional_param('calcmax', '', PARAM_NUMBER);
-                    $oldoptions  = optional_param('defoptions', '', PARAM_RAW); 
-                    $newdatasetvalues = false ; 
+                    $oldoptions  = optional_param('defoptions', '', PARAM_RAW);
+                    $newdatasetvalues = false ;
                     for($key = 1 ; $key <= sizeof($olddef) ; $key++) {
                         $def = $olddef[$key] ;
                         $this->datasetdefs[$def]= new stdClass ;
@@ -172,13 +172,13 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                             $this->datasetdefs[$def]->calcmax != $regs[3] ||
                             $this->datasetdefs[$def]->calclength != $regs[4]){
                                  $newdatasetvalues = true ;
-                            }                        
+                            }
                         }
                         $this->datasetdefs[$def]->options="uniform:".$this->datasetdefs[$def]->calcmin.":".$this->datasetdefs[$def]->calcmax.":".$this->datasetdefs[$def]->calclength;
                     }
                 }// if (olddef...
-                // detect new datasets        
-            $newdataset = false ; 
+                // detect new datasets
+            $newdataset = false ;
             foreach ($mandatorydatasets as $datasetname) {
                 if (!isset($this->datasetdefs["1-0-$datasetname"])) {
                     $key = "1-0-$datasetname";
@@ -187,12 +187,12 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                     $this->datasetdefs[$key]->category = 0;
                     $this->datasetdefs[$key]->name = $datasetname;
                     $this->datasetdefs[$key]->options = "uniform:1.0:10.0:1";
-                    $newdataset = true ;     
+                    $newdataset = true ;
                 }else {
                     $this->datasetdefs["1-0-$datasetname"]->name = $datasetname ;
                 }
             }
-            // remove obsolete datasets        
+            // remove obsolete datasets
             $datasettoremove = false;
             foreach ($this->datasetdefs as $defkey => $datasetdef){
                 if(!isset($datasetdef->name )){
@@ -200,7 +200,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                     unset($this->datasetdefs[$defkey]);
                 }
             }
-        }                    
+        }
         } // handle reload
         // create items if  $newdataset and noofitems > 0 and !$newdatasetvalues
         // eliminate any items if $newdatasetvalues
@@ -228,13 +228,13 @@ class question_edit_calculatedsimple_form extends question_edit_form {
             $this->maxnumber = $maxnumber ;
         }else {
             // Handle reload dataset items
-            if  (  "" !=optional_param('definition')&& !($datasettoremove ||$newdataset ||$newdatasetvalues )){              
+            if  (  "" !=optional_param('definition')&& !($datasettoremove ||$newdataset ||$newdatasetvalues )){
                 $i = 1;
-                $fromformdefinition = optional_param('definition', '', PARAM_NOTAGS); 
-                $fromformnumber = optional_param('number', '', PARAM_INT); 
-                $fromformitemid = optional_param('itemid', '', PARAM_INT); 
+                $fromformdefinition = optional_param('definition', '', PARAM_NOTAGS);
+                $fromformnumber = optional_param('number', '', PARAM_INT);
+                $fromformitemid = optional_param('itemid', '', PARAM_INT);
                 ksort($fromformdefinition);
-              
+
                 foreach($fromformdefinition as $key => $defid) {
                     $addeditem = new stdClass();
                     $addeditem->id = $fromformitemid[$i]  ;
@@ -247,7 +247,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
             }
             if (isset($addeditem->itemnumber) && $this->maxnumber < $addeditem->itemnumber){
                 $this->maxnumber = $addeditem->itemnumber;
-                if(!empty($this->datasetdefs)){                        
+                if(!empty($this->datasetdefs)){
                     foreach ($this->datasetdefs as $datasetdef) {
                             $datasetdef->itemcount = $this->maxnumber ;
                     }
@@ -304,7 +304,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                 $creategrades->gradeoptions, 1, 1);
 
         $QTYPES['numerical']->edit_numerical_options($mform,$this);
-        
+
         $repeated = array();
         $repeated[] =& $mform->createElement('header', 'unithdr', get_string('unithdr', 'qtype_numerical', '{no}'));
 
@@ -369,7 +369,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                     $mform->addElement('hidden', "datasetdef[$idx]");
                     $mform->setType("datasetdef[$idx]", PARAM_RAW);
                     $mform->addElement('hidden', "defoptions[$idx]");
-                    $mform->setType("defoptions[$idx]", PARAM_RAW);                                        
+                    $mform->setType("defoptions[$idx]", PARAM_RAW);
                     $idx++;
                     $mform->addElement('static', "divider[$j]", '', '<hr />');
                     $j++;
@@ -377,7 +377,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
             }
             //this should be done before the elements are created and stored as $this->formdata ;
             //fill out all data sets and also the fields for the next item to add.
-        /*Here we do already the values error analysis so that 
+        /*Here we do already the values error analysis so that
         * we could force all wild cards values display if there is an error in values.
         * as using a , in a number */
         $this->numbererrors = array();
@@ -404,13 +404,13 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                 if (stristr($number,',')){
                                     $this->numbererrors["number[$j]"]=get_string('nocommaallowed', 'qtype_datasetdependent');
                                 $numbererrors .= $this->numbererrors['number['.$j.']']."<br />";
-                    
+
                 }else {
                                     $this->numbererrors["number[$j]"]= get_string('notvalidnumber','qtype_datasetdependent',$a);
                                     $numbererrors .= $this->numbererrors['number['.$j.']']."<br />";
                                     //$comment->outsidelimit = false ;
                                   }
-            }else if( stristr($number,'x')){ // hexa will pass the test                
+            }else if( stristr($number,'x')){ // hexa will pass the test
                 $a = new stdClass;
                 $a->name = '{'.$datasetdef->name.'}' ;
                 $a->value = $datasetdef->items[$itemnumber]->value ;
@@ -423,7 +423,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                                             $this->numbererrors["number[$j]"]= get_string('notvalidnumber','qtype_datasetdependent',$a);
                                             $numbererrors .= $this->numbererrors['number['.$j.']']."<br />";
                          //   $val = 1.0 ;
-                    }                    
+                    }
                             }
                             $j--;
                         }
@@ -435,11 +435,11 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                                             $this->outsidelimit=$comment->outsidelimit ;
                                         }
                                         $totalcomment='';
-        
+
                                         foreach ($this->nonemptyanswer as $key => $answer) {
                                             $totalcomment .= $comment->stranswers[$key].'<br/>';
                                         }
-        
+
                                         $this->formdata['answercomment['.$itemnumber.']'] = $totalcomment ;
                                 }
                             }
@@ -456,7 +456,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                     $this->formdata = $this->qtypeobj->custom_generator_set_data($this->datasetdefs, $this->formdata);
                 }
 
-         
+
         $addoptions = Array();
         $addoptions['1']='1';
         for ($i=10; $i<=100 ; $i+=10){
@@ -495,7 +495,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
          if( !empty($this->numbererrors) || $this->outsidelimit) {
         $mform->addElement('static', "alert", '', '<span class="error">'.get_string('useadvance', 'qtype_calculatedsimple').'</span>');
         }
-            
+
           $mform->addElement('submit', 'updatedatasets', get_string('updatewildcardvalues', 'qtype_calculatedsimple'));
           $mform->registerNoSubmitButton('updatedatasets');
           $mform->setAdvanced("updatedatasets",true);
@@ -504,7 +504,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
         $j = $this->noofitems * count($this->datasetdefs);
         $k = 1 ;
         if ("" != optional_param('selectshow')){
-            $k = optional_param('selectshow', '', PARAM_INT); 
+            $k = optional_param('selectshow', '', PARAM_INT);
         }
 
         for ($i = $this->noofitems; $i >= 1 ; $i--){
@@ -512,7 +512,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                 if($k > 0 ||  $this->outsidelimit || !empty($this->numbererrors ) ){
                 $mform->addElement('text',"number[$j]" , get_string('wildcard', 'qtype_calculatedsimple', $datasetdef->name));
                 $mform->setAdvanced("number[$j]",true);
-                if(!empty($this->numbererrors['number['.$j.']']) ){ 
+                if(!empty($this->numbererrors['number['.$j.']']) ){
                     $mform->addElement('static', "numbercomment[$j]",'','<span class="error">'.$this->numbererrors['number['.$j.']'].'</span>');
                 $mform->setAdvanced("numbercomment[$j]",true);
               }
@@ -520,7 +520,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                 $mform->addElement('hidden',"number[$j]" , get_string('wildcard', 'qtype_calculatedsimple', $datasetdef->name));
               }
                 $mform->setType("number[$j]", PARAM_NUMBER);
-                
+
                 $mform->addElement('hidden', "itemid[$j]");
                 $mform->setType("itemid[$j]", PARAM_INT);
 
@@ -532,11 +532,11 @@ class question_edit_calculatedsimple_form extends question_edit_form {
             if (!empty( $strquestionlabel) && ($k > 0 ||  $this->outsidelimit || !empty($this->numbererrors ) ) ){
              //   $repeated[] =& $mform->addElement('static', "answercomment[$i]", $strquestionlabel);
                     $mform->addElement('static', "answercomment[$i]", "<b>".get_string('setno', 'qtype_calculatedsimple', $i)."</b>&nbsp;&nbsp;".$strquestionlabel);
-                    
+
             }
-               if($k > 0 ||  $this->outsidelimit || !empty($this->numbererrors )){             
+               if($k > 0 ||  $this->outsidelimit || !empty($this->numbererrors )){
                 $mform->addElement('static', "divider1[$j]", '', '<hr />');
-               
+
                }
                         $k-- ;
         }
@@ -568,7 +568,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
             if ($this->question->formoptions->cansaveasnew){
         $mform->addElement('header', 'additemhdr', get_string('converttocalculated', 'qtype_calculatedsimple'));
         $mform->closeHeaderBefore('additemhdr');
-                
+
                 $mform->addElement('checkbox', 'convert','' ,get_string('willconverttocalculated', 'qtype_calculatedsimple'));
                                 $mform->setDefault('convert', 0);
 
@@ -591,7 +591,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
                 $key = 0;
                 foreach ($answer as $answer){
                     $default_values['answer['.$key.']'] = $answer->answer;
-                  //  echo "<p> $answer->fraction </p>"; 
+                  //  echo "<p> $answer->fraction </p>";
                     $default_values['fraction['.$key.']'] = $answer->fraction;
                     $default_values['tolerance['.$key.']'] = $answer->tolerance;
                     $default_values['tolerancetype['.$key.']'] = $answer->tolerancetype;
@@ -645,7 +645,7 @@ class question_edit_calculatedsimple_form extends question_edit_form {
             }
     //                 echo "<p>answers avant  comment <pre>";print_r($answer);echo"</pre></p>";
     //                 echo "<p>data avant  comment <pre>";print_r($data);echo"</pre></p>";
-                     
+
             if($this->noofitems != 0 ) {
                 if(!isset($question->id)) $question->id = 0 ;
             $comment = $this->qtypeobj->comment_on_datasetitems($question->id,$this->nonemptyanswer, $data, $itemnumber);//$this->
@@ -795,12 +795,12 @@ class question_edit_calculatedsimple_form extends question_edit_form {
         }
         if (isset($data['backtoquiz']) && ($this->noofitems==0) ){
             $errors['warning'] = get_string('warning', 'mnet');
-        } 
+        }
         if ($this->outsidelimit){
          //   if(!isset($errors['warning'])) $errors['warning']=' ';
            $errors['outsidelimits'] = get_string('oneanswertrueansweroutsidelimits','qtype_calculated');
         }
-                /*Here we use the already done the error analysis so that 
+                /*Here we use the already done the error analysis so that
         * we could force all wild cards values display if there is an error in values.
         * as using a , in a number *//*
         $numbers = $data['number'];
@@ -808,14 +808,14 @@ class question_edit_calculatedsimple_form extends question_edit_form {
             if(! is_numeric($number)){
                 if (stristr($number,',')){
                     $errors['number['.$key.']'] = get_string('notvalidnumber', 'qtype_datasetdependent');
-                }else {    
+                }else {
                     $errors['number['.$key.']'] = get_string('notvalidnumber', 'qtype_datasetdependent');
                 }
             }else if( stristr($number,'x')){
                 $errors['number['.$key.']'] = get_string('notvalidnumber', 'qtype_datasetdependent');
             } else if( is_nan($number)){
                 $errors['number['.$key.']'] = get_string('notvalidnumber', 'qtype_datasetdependent');
-            }        
+            }
         }
         */
         if ( $this->noofitems==0  ){
@@ -825,4 +825,4 @@ class question_edit_calculatedsimple_form extends question_edit_form {
         return $errors;
     }
 }
-?>
+
index 3009c28f1486c0b628ff4065507b593e1e2a1469..da7e92fe4dea516db0fa76cf4835e0557cf259ce 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 /////////////////
 // CALCULATED ///
@@ -174,7 +174,7 @@ class question_calculatedsimple_qtype extends question_calculated_qtype {
                 }
             }
         }
-         }   
+         }
         // Report any problems.
         //convert to calculated
         if(!empty($question->makecopy) && !empty($question->convert)) {
@@ -246,7 +246,7 @@ class question_calculatedsimple_qtype extends question_calculated_qtype {
 
 
     }
+
     function comment_header($answers) {
         //$this->get_question_options($question);
         $strheader = "";
@@ -296,7 +296,7 @@ class question_calculatedsimple_qtype extends question_calculated_qtype {
                     }else {
                         eval('$answer->answer = '.$formula.';') ;
                         $virtualqtype->get_tolerance_interval($answer);
-                    } 
+                    }
             if ($answer->min === '') {
                 // This should mean that something is wrong
                 $comment->stranswers[$key] = " $formattedanswer->answer".'<br/><br/>';
@@ -410,4 +410,4 @@ question_register_questiontype(new question_calculatedsimple_qtype());
 
 define("CALCULATEDSIMPLE",    "calculatedsimple");
 
-?>
+
index 184ff5cb287fed06f919a5df517f35e0b29c5b7c..3170740f00f72461ff38cec9ca9d0bc8fca49663 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Defines the editing form for the description question type.
  *
@@ -31,4 +31,3 @@ class question_edit_description_form extends question_edit_form {
         return 'description';
     }
 }
-?>
\ No newline at end of file
index 6353f5ad0c4d91c07c6d4d9eb7d617d1e519703e..c55db3daf6e324abf56813d533999c1e193427ae 100644 (file)
@@ -6,7 +6,7 @@
     <div class="qtext">
       <?php echo $questiontext; ?>
     </div>
-    
+
     <?php if ($image) { ?>
       <img class="qimage" src="<?php echo $image; ?>" alt="" />
     <?php } ?>
index e1dfff390091e042ab1b12095ec376a6b89eedee..2d4221e70ee58ca1610c25219a8d294c1bacaa1b 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 ///////////////////////////////////////////////////////////////////////////
 //                                                                       //
@@ -91,4 +91,4 @@ class description_qtype extends default_questiontype {
 }
 // Register this question type with questionlib.php.
 question_register_questiontype(new description_qtype());
-?>
+
index 4e44305315eed558cf3d19c5fad64ca701b5fb77..4d9d7c33fb808f4efeae617e66eaa49c5a2b19ef 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * A base class for question editing forms.
  *
@@ -335,4 +335,4 @@ class question_edit_form extends moodleform {
     }
 }
 
-?>
+
index 0ec034a1151cd8cbfe4e857b922d467880f5cfae..eee7859962861ff26f52608c60be0880980481d9 100644 (file)
@@ -1,6 +1,6 @@
-<?php  // $Id$
+<?php
 
-// This file keeps track of upgrades to 
+// This file keeps track of upgrades to
 // the essay qtype plugin
 //
 // Sometimes, changes between versions involve
@@ -26,8 +26,8 @@ function xmldb_qtype_essay_upgrade($oldversion) {
     $dbman = $DB->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_essay_upgrade($oldversion) {
     return $result;
 }
 
-?>
+
index 9efd100cc325d860cfc1750d151c3d522deea6a1..991c76de293e7e5b84f95f8e78902ebbe22401f8 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Defines the editing form for the essay question type.
  *
@@ -45,4 +45,4 @@ class question_edit_essay_form extends question_edit_form {
         return 'essay';
     }
 }
-?>
+
index 046f2a17c745d9d033cc429419f2e0097a19e830..da7197b29027b3a2c67f17e1c1656633f8d69562 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 //////////////////
 ///   ESSAY   ///
@@ -152,4 +152,4 @@ class question_essay_qtype extends default_questiontype {
 //// INITIATION - Without this line the question type is not in use... ///
 //////////////////////////////////////////////////////////////////////////
 question_register_questiontype(new question_essay_qtype());
-?>
+
index c39730578d9b771d0b380eb833b7afe30d4b030c..1950094efc88b6fd15a3392dc786d8711e80304e 100644 (file)
@@ -1,6 +1,6 @@
-<?PHP // $Id$
+<?php
 
 $plugin->version  = 2006032200;
 $plugin->requires = 2007101000;
 
-?>
+
index 77f555cefc96f3fbb11fe025053dfe27ad9b6d63..2708e116c88342fd79e6ec0d443fcd8a85d33aad 100644 (file)
@@ -1,6 +1,6 @@
-<?php  // $Id$
+<?php
 
-// This file keeps track of upgrades to 
+// This file keeps track of upgrades to
 // the match qtype plugin
 //
 // Sometimes, changes between versions involve
@@ -26,8 +26,8 @@ function xmldb_qtype_match_upgrade($oldversion) {
     $dbman = $DB->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_match_upgrade($oldversion) {
     return $result;
 }
 
-?>
+
index 132cd354d86dd6d80dbc0a4d9e1e908de9518e77..f9e7c9b47add3f03b43db860c92ecaec946060f5 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Defines the editing form for the match question type.
  *
@@ -96,4 +96,3 @@ class question_edit_match_form extends question_edit_form {
         return $errors;
     }
 }
-?>
\ No newline at end of file
index 8b8ddd64961f2e2d1755249724c871a8e0c89685..6220ed434b03173ae1b2e1f215106fbf5168ca9b 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 /////////////
 /// MATCH ///
@@ -294,7 +294,7 @@ class question_match_qtype extends default_questiontype {
                         $a->feedbackimg = question_get_feedback_image($correctresponse);
                     }
                 }
-                
+
                 $select = html_select::make($answers, $menuname, $response);
                 $select->disabled = $options->readonly;
                 $a->control = $OUTPUT->select($select);
@@ -410,7 +410,7 @@ class question_match_qtype extends default_questiontype {
         }
         return $answers;
     }
-    
+
     // ULPGC ecastro
     function get_actual_response($question, $state) {
        $subquestions = &$state->options->subquestions;
@@ -425,7 +425,7 @@ class question_match_qtype extends default_questiontype {
        }
        return $results;
    }
-   
+
    function get_actual_response_details($question, $state) {
         $responses = $this->get_actual_response($question, $state);
         $teacherresponses = $this->get_possible_responses($question, $state);
@@ -764,4 +764,4 @@ class question_match_qtype extends default_questiontype {
 //// INITIATION - Without this line the question type is not in use... ///
 //////////////////////////////////////////////////////////////////////////
 question_register_questiontype(new question_match_qtype());
-?>
+
index c39730578d9b771d0b380eb833b7afe30d4b030c..1950094efc88b6fd15a3392dc786d8711e80304e 100644 (file)
@@ -1,6 +1,6 @@
-<?PHP // $Id$
+<?php
 
 $plugin->version  = 2006032200;
 $plugin->requires = 2007101000;
 
-?>
+
index 7e1583f5801c5f93720d8874d9de8a9b25770d4e..451749ac4a7c06d380ad7f1a1a808a00d51052db 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Defines the editing form for the missingtype question type.
  *
@@ -85,4 +85,4 @@ class question_edit_missingtype_form extends question_edit_form {
         return $errors;
     }
 }
-?>
+
index 978aac8657db281b1fbd13eeb078e09129d35b4d..e0422d474bac422a19c4923148605e3ce50044e4 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 ///////////////////
 /// missingtype ///
@@ -76,4 +76,4 @@ class question_missingtype_qtype extends default_questiontype {
 //////////////////////////////////////////////////////////////////////////
 question_register_questiontype(new question_missingtype_qtype());
 
-?>
+
index ee85f12f2aa33021c332beb960b6defb847f3896..c4a70b83460abc6f88599af3005679d9c4cfbed0 100644 (file)
@@ -1,6 +1,6 @@
-<?php  // $Id$
+<?php
 
-// This file keeps track of upgrades to 
+// This file keeps track of upgrades to
 // the multianswer qtype plugin
 //
 // Sometimes, changes between versions involve
@@ -61,4 +61,4 @@ function question_multianswer_fix_subquestion_parents_and_categories() {
     }
     return $result;
 }
-?>
+
index ce6e1e0257f2543d3b518e4b92ea272a5492bcae..27173061878815823e9bbcd03eb2f906255d17a6 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Defines the editing form for the multianswer question type.
  *
@@ -26,7 +26,7 @@ class question_edit_multianswer_form extends question_edit_form {
     var $nb_of_attempts = 0;
     public $confirm = 0 ;
     public $reload = false ;
-    
+
     function question_edit_multianswer_form(&$submiturl, &$question, &$category, &$contexts, $formeditable = true){
         global $QTYPES, $SESSION, $CFG, $DB;
         $this->regenerate = true;
@@ -50,14 +50,14 @@ class question_edit_multianswer_form extends question_edit_form {
             }
         }
 
-            
-            
-        
-  
+
+
+
+
         parent::question_edit_form($submiturl, $question, $category, $contexts, $formeditable);
     }
 
-            
+
 
     function definition_inner(&$mform) {
         $mform->addElement('hidden', 'reload', 1);
@@ -75,8 +75,8 @@ class question_edit_multianswer_form extends question_edit_form {
             $this->questiondisplay = fullclone(qtype_multianswer_extract_question(optional_param('questiontext','', PARAM_RAW))) ;
 
         }else {
-            if(!$this->reload && !empty($this->savedquestiondisplay->id)){ 
-                // use database data as this is first pass 
+            if(!$this->reload && !empty($this->savedquestiondisplay->id)){
+                // use database data as this is first pass
                 // question->id == 0 so no stored datasets
                 $this->questiondisplay = fullclone($this->savedquestiondisplay);
                 foreach($this->questiondisplay->options->questions as $subquestion){
@@ -86,9 +86,9 @@ class question_edit_multianswer_form extends question_edit_form {
                         $subquestion->answer[]=$ans->answer ;
                     }
                   //  $subquestion->answer = fullclone($subquestion->options->answers);
-                } 
-            }                
-            }else {               
+                }
+            }
+            }else {
                 $this->questiondisplay = "";
             }
         }
@@ -119,15 +119,15 @@ class question_edit_multianswer_form extends question_edit_form {
             }
                //           echo "<p> saved question $countsavedsubquestions <pre>";print_r($this->savedquestiondisplay);echo "</pre></p>";
                //            echo "<p> saved question $countsubquestions <pre>";print_r($this->questiondisplay);echo "</pre></p>";
-    
-                
+
+
             $mform->addElement('submit', 'analyzequestion', get_string('decodeverifyquestiontext','qtype_multianswer'));
             $mform->registerNoSubmitButton('analyzequestion');
             echo '<div class="ablock clearfix">';
             echo '<div class=" clearfix">';
             if ( $this->reload ){
             for ($sub =1;$sub <=$countsubquestions ;$sub++) {
-            
+
                 $this->editas[$sub] =  'unknown type';
                 if (isset( $this->questiondisplay->options->questions[$sub]->qtype) ) {
                     $this->editas[$sub] =  $this->questiondisplay->options->questions[$sub]->qtype ;
@@ -135,44 +135,44 @@ class question_edit_multianswer_form extends question_edit_form {
                     $this->editas[$sub] = optional_param('sub_'.$sub."_".'qtype', '', PARAM_RAW);
                 }
                 $storemess = '';
-                 if(isset($this->savedquestiondisplay->options->questions[$sub]->qtype) && 
+                 if(isset($this->savedquestiondisplay->options->questions[$sub]->qtype) &&
                  $this->savedquestiondisplay->options->questions[$sub]->qtype != $this->questiondisplay->options->questions[$sub]->qtype ){
                     $this->type_change = true ;
                    $storemess = "<font class=\"error\"> STORED QTYPE ".$question_type_names[$this->savedquestiondisplay->options->questions[$sub]->qtype]."</font >";
                 }
-    
+
                 $mform->addElement('header', 'subhdr'.$sub, get_string('questionno', 'quiz',
                      '{#'.$sub.'}').'&nbsp;'.$question_type_names[$this->questiondisplay->options->questions[$sub]->qtype].$storemess);
-        
+
                 $mform->addElement('static', 'sub_'.$sub."_".'questiontext', get_string('questiondefinition','qtype_multianswer'),array('cols'=>60, 'rows'=>3));
-    
+
                 if (isset ( $this->questiondisplay->options->questions[$sub]->questiontext)) {
                     $mform->setDefault('sub_'.$sub."_".'questiontext', $this->questiondisplay->options->questions[$sub]->questiontext);
                 }
-    
+
                 $mform->addElement('static', 'sub_'.$sub."_".'defaultgrade', get_string('defaultgrade', 'quiz'));
                 $mform->setDefault('sub_'.$sub."_".'defaultgrade',$this->questiondisplay->options->questions[$sub]->defaultgrade);
-    
+
                     if ($this->questiondisplay->options->questions[$sub]->qtype =='shortanswer'   ) {
                         $mform->addElement('static', 'sub_'.$sub."_".'usecase', get_string('casesensitive', 'quiz'));
                     }
-    
+
                     if ($this->questiondisplay->options->questions[$sub]->qtype =='multichoice'   ) {
                         $mform->addElement('static', 'sub_'.$sub."_".'layout', get_string('layout', 'qtype_multianswer'),array('cols'=>60, 'rows'=>1)) ;//, $gradeoptions);
                     }
                 foreach ($this->questiondisplay->options->questions[$sub]->answer as $key =>$ans) {
-    
+
                    $mform->addElement('static', 'sub_'.$sub."_".'answer['.$key.']', get_string('answer', 'quiz'), array('cols'=>60, 'rows'=>1));
-    
+
                     if ($this->questiondisplay->options->questions[$sub]->qtype =='numerical' && $key == 0 ) {
                         $mform->addElement('static', 'sub_'.$sub."_".'tolerance['.$key.']', get_string('acceptederror', 'quiz')) ;//, $gradeoptions);
                     }
-    
+
                     $mform->addElement('static', 'sub_'.$sub."_".'fraction['.$key.']', get_string('grade')) ;//, $gradeoptions);
-    
+
                     $mform->addElement('static', 'sub_'.$sub."_".'feedback['.$key.']', get_string('feedback', 'quiz'));
                 }
-    
+
             }
             echo '</div>';
             $this->negative_diff =$countsavedsubquestions - $countsubquestions ;
@@ -181,13 +181,13 @@ class question_edit_multianswer_form extends question_edit_form {
                 }
             if($this->negative_diff > 0) {
                 //$this->used_in_quiz
-                
+
                             $mform->addElement('static', 'alert1', "<strong>"."Question deleted"."</strong>","<strong>".$this->negative_diff.get_string(' questions less than in the multtianswer question stored in the database','qtype_multianswer')."</strong>");//$countsubquestions."-".$countsavedsubquestions
             }
             if($this->type_change )
                {
                 //$this->used_in_quiz
-                
+
                   //  $mform->addElement('header', 'additemhdr', "WARNING");
                             $mform->addElement('static', 'alert1', "<strong>"."Question type change "."</strong>","<strong>".get_string(' at least one question type has been changed. Did you add,delete or move a question ? Look ahead ','qtype_multianswer')."</strong>");//$countsubquestions."-".$countsavedsubquestions
             }
@@ -202,10 +202,10 @@ class question_edit_multianswer_form extends question_edit_form {
                              $mform->addElement('static', 'alertas', "<strong>"."YOU SHOULD NOT "."</strong>");//$countsubquestions."-".$countsavedsubquestions
          }
         if ( ($this->negative_diff > 0 || $this->used_in_quiz && ($this->negative_diff > 0 ||$this->negative_diff < 0 || $this->type_change ) ) &&  $this->reload ){
-            $mform->addElement('header', 'additemhdr', get_string('The question will be saved as edited', 'qtype_calculatedsimple'));            
+            $mform->addElement('header', 'additemhdr', get_string('The question will be saved as edited', 'qtype_calculatedsimple'));
             $mform->addElement('checkbox', 'confirm','' ,get_string('I confirm that I want the question be saved as edited', 'qtype_calculatedsimple'));
             $mform->setDefault('confirm', 0);
-        }else {        
+        }else {
             $mform->addElement('hidden', 'confirm',0);
         }
 
@@ -280,10 +280,10 @@ class question_edit_multianswer_form extends question_edit_form {
                         switch ($subquestion->usecase) {
                             case '1':
                                 $default_values[$prefix.'usecase']= get_string('caseyes', 'quiz');
-                                break;                                   
+                                break;
                             case '0':
                             default :
-                                $default_values[$prefix.'usecase']= get_string('caseno', 'quiz');                               
+                                $default_values[$prefix.'usecase']= get_string('caseno', 'quiz');
                         }
                     }
 
@@ -295,13 +295,13 @@ class question_edit_multianswer_form extends question_edit_form {
                                 break;
                             case '1':
                                 $default_values[$prefix.'layout']= get_string('layoutvertical', 'qtype_multianswer');
-                                break;                         
+                                break;
                             case '2':
                                 $default_values[$prefix.'layout']= get_string('layouthorizontal', 'qtype_multianswer');
                                 break;
                             default:
                                 $default_values[$prefix.'layout']= get_string('layoutundefined', 'qtype_multianswer');
-                        } 
+                        }
                     }
                     foreach ($subquestion->answer as $key=>$answer) {
                         if ( $subquestion->qtype == 'numerical' && $key == 0 ) {
@@ -348,9 +348,9 @@ class question_edit_multianswer_form extends question_edit_form {
         }
         if (( $this->negative_diff || $this->used_in_quiz && ($this->negative_diff > 0 ||$this->negative_diff < 0 || $this->type_change ))&& $this->confirm == 0 ){
             $this->_form->setElementError('confirm',"confirm then save");
-        } 
-       $default_values['alertas']= "<strong>".get_string(" 
-                             
+        }
+       $default_values['alertas']= "<strong>".get_string("
+
 <ul>
   <li>add or delete questions, </li>
   <li>change the questions order in the text,</li>
@@ -375,7 +375,7 @@ class question_edit_multianswer_form extends question_edit_form {
                     $answercount = 0;
                     $maxgrade = false;
                     $maxfraction = -1;
-             if(isset($this->savedquestiondisplay->options->questions[$sub]->qtype) && 
+             if(isset($this->savedquestiondisplay->options->questions[$sub]->qtype) &&
              $this->savedquestiondisplay->options->questions[$sub]->qtype != $this->questiondisplay->options->questions[$sub]->qtype ){
                $storemess = " STORED QTYPE ".$question_type_names[$this->savedquestiondisplay->options->questions[$sub]->qtype];
             }
@@ -419,4 +419,4 @@ class question_edit_multianswer_form extends question_edit_form {
         return 'multianswer';
     }
 }
-?>
+
index a3672e452e044e09878ccd8c3b8da0c5ca91d525..81fc8df460badfe2db46bb1b4d7297ed55956420 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 ///////////////////
 /// MULTIANSWER /// (Embedded - cloze)
@@ -22,7 +22,7 @@ class embedded_cloze_qtype extends default_questiontype {
     function name() {
         return 'multianswer';
     }
-    
+
     function has_wildcards_in_responses($question, $subqid) {
         global $QTYPES, $OUTPUT;
         foreach ($question->options->questions as $subq){
@@ -54,9 +54,9 @@ class embedded_cloze_qtype extends default_questiontype {
         $sequence = array_flip(explode(',', $sequence));
         array_walk($sequence, create_function('&$val', '$val++;'));
         //If a question is lost, the corresponding index is null
-        // so this null convention is used to test $question->options->questions 
+        // so this null convention is used to test $question->options->questions
         // before using the values.
-        // first all possible questions from sequence are nulled 
+        // first all possible questions from sequence are nulled
         // then filled with the data if available in  $wrappedquestions
         $nbvaliquestion = 0 ;
         foreach($sequence as $seq){
@@ -133,7 +133,7 @@ class embedded_cloze_qtype extends default_questiontype {
             $wrapped = $QTYPES[$wrapped->qtype]->save_question($wrapped,
                     $wrapped, $question->course);
             $sequence[] = $wrapped->id;
-            if ($previousid != 0 && $previousid != $wrapped->id ) { 
+            if ($previousid != 0 && $previousid != $wrapped->id ) {
                 // for some reasons a new question has been created
                 // so delete the old one
                 delete_question($previousid) ;
@@ -507,7 +507,7 @@ class embedded_cloze_qtype extends default_questiontype {
                             $a->id   = $question->name_prefix . $mcanswer->id;
                             $a->class = '';
                             $a->feedbackimg = '';
-        
+
                     // Print the control
                     $a->control = "<input $readonly id=\"$a->id\" $name $checked $type value=\"$mcanswer->id\" />";
                 if ($options->correct_responses && $mcanswer->fraction > 0) {
@@ -520,18 +520,18 @@ class embedded_cloze_qtype extends default_questiontype {
                         $a->feedbackimg = question_get_feedback_image($mcanswer->fraction, $chosen && $options->feedback);
                     }
                 }
-    
+
                 // Print the answer text: no automatic numbering
 
                 $a->text =format_text($mcanswer->answer, FORMAT_MOODLE, $formatoptions, $cmoptions->course);
-    
+
                 // Print feedback if feedback is on
                 if (($options->feedback || $options->correct_responses) && ($checked )) { //|| $options->readonly
                     $a->feedback = format_text($mcanswer->feedback, true, $formatoptions, $cmoptions->course);
                 } else {
                     $a->feedback = '';
                 }
-    
+
                     $anss[] = clone($a);
                 }
                 ?>
@@ -557,7 +557,7 @@ class embedded_cloze_qtype extends default_questiontype {
                   </table>
                   <?php }else  if ($wrapped->options->layout == 2 ){
                     ?>
-           
+
                   <table class="answer">
                       <tr class="<?php echo 'r'.$row = $row ? 0 : 1; ?>">
                     <?php $row = 1; foreach ($anss as $answer) { ?>
@@ -576,16 +576,16 @@ class embedded_cloze_qtype extends default_questiontype {
                     <?php } ?>
                       </tr>
                   </table>
-                  <?php }  
-                        
+                  <?php }
+
                     }else {
                         echo "no valid layout";
                     }
-                    
+
                     break;
                 default:
                     $a = new stdClass;
-                    $a->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
index 6d0f10af814912d2c127897db51c7a890de9cac0..3185c4892f63f06c5e9db7c4a2b8362f8404d98f 100644 (file)
@@ -1,6 +1,6 @@
-<?PHP // $Id$
+<?php
 
 $plugin->version  = 2008050800;
 $plugin->requires = 2007101509;
 
-?>
+
index 04087a1bc82fad71cc317ef41e92b13784950c6d..501af6ce8c4e6c15d95a86abcf1c1fa5a13c7627 100644 (file)
@@ -1,6 +1,6 @@
-<?php  // $Id$
+<?php
 
-// This file keeps track of upgrades to 
+// This file keeps track of upgrades to
 // the multichoice qtype plugin
 //
 // Sometimes, changes between versions involve
@@ -29,7 +29,7 @@ function xmldb_qtype_multichoice_upgrade($oldversion) {
     // This upgrade actually belongs to the random question type,
     // but that does not have a DB upgrade script. Therefore, multichoice
     // is doing it.
-    // Rename random questions to give them more helpful names. 
+    // Rename random questions to give them more helpful names.
     if ($result && $oldversion < 2008021800) {
         require_once($CFG->libdir . '/questionlib.php');
         // Get all categories containing random questions.
@@ -56,4 +56,4 @@ function xmldb_qtype_multichoice_upgrade($oldversion) {
     return $result;
 }
 
-?>
+
index f8c9661c6303589a3b955f719a7d9314ac5775b5..3e1c056af570ab114fb5a2d2f71428f66962ae09 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Defines the editing form for the multichoice question type.
  *
@@ -130,4 +130,3 @@ class question_edit_multichoice_form extends question_edit_form {
         return $errors;
     }
 }
-?>
\ No newline at end of file
index 8fd8eb12e3b05f88187a2637e022bd7995b989e2..856b59af9a8a8a7057d923098fcf04afca0fb7ff 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * The questiontype class for the multiple choice question type.
  *
@@ -384,7 +384,7 @@ class question_multichoice_qtype extends default_questiontype {
         return $responses;
     }
 
-    
+
     function format_response($response, $format){
         return $this->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());
-?>
+
index c52c71debbff4bcd0c099e85a2e334f637638f8e..0d354e821d2bdf9d9d5dc758163bc3ce437cea78 100644 (file)
@@ -1,6 +1,6 @@
-<?PHP // $Id$
+<?php
 
 $plugin->version  = 2009021800;
 $plugin->requires = 2007101000;
 
-?>
+
index 930f91cfb101657bd065fadc9ea30e18214efde6..f6d894645526557cab6494b5e93d8dab55b78512 100644 (file)
@@ -1,6 +1,6 @@
-<?php  // $Id$
+<?php
 
-// This file keeps track of upgrades to 
+// This file keeps track of upgrades to
 // the numerical qtype plugin
 //
 // Sometimes, changes between versions involve
@@ -48,11 +48,11 @@ function xmldb_qtype_numerical_upgrade($oldversion) {
         if (!$dbman->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;
 }
 
-?>
+
index 678b788aa264eebe2d6c80df053a0bacdf0554f6..ab34b86f34f0cb6968e86a48ab1ed162aa7e29ca 100644 (file)
@@ -1,17 +1,17 @@
-<?php     
+<?php
 // as the entry is controlled the question type here is numerical
                   $nameunit   = "name=\"".$question->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 ;<div class="ablock clearfix">
         }
-        
+
     }*/
             if (isset($state->responses['answer']) && $state->responses['answer']!='') {
             $valueanswer = ' value="'.s($state->responses['answer']).'" ';
             if (isset($state->responses['unit']) && $state->responses['unit']!='') {
             $valueunit = ' value="'.s($state->responses['unit']).'" ';
         } else {
-            
+
             $valueunit = ' value="" ';
             if ($question->options->showunits == 2 ){
-              $valueunit = ' value="'.s($question->options->units[0]->unit).'" '; 
-            } 
+              $valueunit = ' value="'.s($question->options->units[0]->unit).'" ';
+            }
         }
-        // put a div to enclose the answer and unit elements<div class="clearfix"></div> 
+        // put a div to enclose the answer and unit elements<div class="clearfix"></div>
         $textlength = 20 ;
 ?>
 
     <?php echo $feedbackimg; ?>
 </fieldset>
   </div>
-    
+
+
 <?php }// display unit
-        $class = ''; 
+        $class = '';
         $feedbackimgunit = '';
         if ($options->feedback){
             $classunit = question_get_feedback_class(1-$this->raw_unitpenalty);
             $feedbackimgunit = question_get_feedback_image(1-$this->raw_unitpenalty, $options->feedback);
         }
         if ($question->options->showunits == 3 || (isset($question->options->units) && count($question->options->units) == 0 )) {// no unit display or tested
-     
+
 ?>
   <div class="answer">
-    <input type="hidden"  
-    <?php 
-    echo $nameunit;  
-    ?> 
+    <input type="hidden"
+    <?php
+    echo $nameunit;
+    ?>
    value ="" />
   </div>
 <?php
-  } else if ($question->options->showunits == 0  ) {// display unit text input 
-?>   
+  } else if ($question->options->showunits == 0  ) {// display unit text input
+?>
 <div class="answer">
     <fieldset class="clearfix"  id="generalheader">
         <legend class="ftoggler">
     <?php echo $feedbackimgunit; ?>
 </fieldset>
   </div>
-<?php            
+<?php
 
   } else if ($question->options->showunits == 2 ) {// display text
-     
+
 ?>
   <div class="answer">
     <fieldset class="clearfix"  id="generalheader">
         <legend class="ftoggler">
-           <?php echo get_string('unit', 'quiz'); 
+           <?php echo get_string('unit', 'quiz');
            //echo $question->options->units[0]->unit  ;
             ?>
         </legend>
-    <input type="hidden"  
-    <?php 
-    echo $nameunit; echo $valueunit ; 
+    <input type="hidden"
+    <?php
+    echo $nameunit; echo $valueunit ;
 
-    ?> 
+    ?>
    />
  <?php   echo $question->options->units[0]->unit  ;
 
-         echo '&nbsp; ' ; 
+         echo '&nbsp; ' ;
      ?>
     </fieldset>
   </div>
-  
+
   <?php
 
-    //display the units as choice    
-    
+    //display the units as choice
+
     } else if ($question->options->showunits == 1){?>
 
 
-<?php 
-    //display the units as choice    
+
+<?php
+    //display the units as choice
     if ($question->options->showunits == 1 && isset($question->options->units)){?>
           <div class="answer">
             <table class="answer">
 
-<?php       foreach ($question->options->units as $key => $unit) { 
+<?php       foreach ($question->options->units as $key => $unit) {
             $checked = '';
             $chosen = false;
-              
+
                 $type = 'type="radio"';
              //   $nameunit   = "name=\"".$question->name_prefix;//."unit\"";
                 if (isset($state->responses['unit'])){
                     $checked = 'checked="checked"';
                     $chosen = true;
                 }
-            $aid = $question->id ; 
+
+            $aid = $question->id ;
             $a = new stdClass;
             $a->id   = $question->name_prefix."unit" ;//. "2"
             $a->class = '';
                 <?php } ?>
 
          </table>
-                                      
-         </div>  
+
+         </div>
             <?php } // end unit choices
             // display intructions
             // general message first
         }
-     
+
  if ($question->options->unitsleft == 1 ){?>
-             
+
  <div class="answer">
     <fieldset class="clearfix"  id="generalheader">
         <legend class="ftoggler">
     ?> size="<?php echo $textlength;?>"/>
     <?php echo $feedbackimg; ?>
    </fieldset>
-  </div>                   
-<?php }  
+  </div>
+<?php }
         //</div> put a div to enclose the answer and unit elements
 ?>
 
      <?php echo get_string('validnumberformats', 'qtype_numerical');?>
         </legend>
      <?php echo get_string('validnumbers', 'qtype_numerical');?>
-     </fieldset>      
+     </fieldset>
        </div>
      <?php if (!empty($question->options->instructions)){?>
         <div>
      <?php   echo  format_text($question->options->instructions, true, $formatoptions, $cmoptions->course);?>
-        </div> 
-     <?php }?> 
-     </fieldset>      
-     </div>           
+        </div>
+     <?php }?>
+     </fieldset>
+     </div>
 
   <?php  ?>
 
index 2933439f644f2834aec0b8fe66926b6d92feb435..6eae9bb8715167b3c65f85cc71116d8bd5e8cccf 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Defines the editing form for the numerical question type.
  *
@@ -42,7 +42,7 @@ class question_edit_numerical_form extends question_edit_form {
         /*
         $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'));
@@ -179,4 +179,3 @@ class question_edit_numerical_form extends question_edit_form {
         return 'numerical';
     }
 }
-?>
\ No newline at end of file
index e2d85dc260da49a7426fbc451a2916008b732bf6..6b8f90e66a9eead282dbee187793ff4438b2d231 100644 (file)
@@ -1,6 +1,5 @@
-<?php  // $Id$
+<?php
 /**
- * @version $Id$
  * @author Martin Dougiamas and many others. Tim Hunt.
  * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
  * @package questionbank
@@ -30,7 +29,7 @@ class question_numerical_qtype extends question_shortanswer_qtype {
     function name() {
         return 'numerical';
     }
-    
+
     function has_wildcards_in_responses() {
         return true;
     }
@@ -90,8 +89,8 @@ class question_numerical_qtype extends question_shortanswer_qtype {
           $question->options->unitsleft = $options->unitsleft ;
           $question->options->instructions = $options->instructions ;
         }
-            
-        
+
+
         return true;
     }
     function get_numerical_units(&$question) {
@@ -219,7 +218,7 @@ class question_numerical_qtype extends question_shortanswer_qtype {
         global $DB;
         $result = new stdClass;
         // numerical options
-        $update = true ; 
+        $update = true ;
         $options = $DB->get_record("question_numerical_options", array("question" => $question->id));
         if (!$options) {
             $update = false;
@@ -303,13 +302,13 @@ class question_numerical_qtype extends question_shortanswer_qtype {
      /*   if ($question->options->showunits == 1){
             $state->responses['unit'] = '0';
         }*/
-            
+
         return true;
     }
     function restore_session_and_responses(&$question, &$state) {
        if(false === strpos($state->responses[''], '|||||')){
         // temporary
-             $state->responses['answer']= $state->responses[''];                    
+             $state->responses['answer']= $state->responses[''];
              $state->responses['unit'] = '';
              split_old_answer($state->responses[''], $question->options->units, $state->responses['answer'] ,$state->responses['unit'] );
        }else {
@@ -319,7 +318,7 @@ class question_numerical_qtype extends question_shortanswer_qtype {
        }
       //                             echo "<p> restore response $responses ||   <pre>";print_r($state);echo "</pre></p>";
 
-      /* 
+      /*
        if ($question->options->showunits == 1 && isset($question->options->units)){
             $state->responses['unit']=$this->find_unit_index($question,$state->responses['unit']);
        }*/
@@ -333,7 +332,7 @@ class question_numerical_qtype extends question_shortanswer_qtype {
                     if($unit->unit ==$value ) {
                     return $key ;
                 }
-            }            
+            }
         return 0 ;
     }
 
@@ -384,14 +383,14 @@ class question_numerical_qtype extends question_shortanswer_qtype {
         $DB->delete_records("question_numerical_units", array("question" => $questionid));
         return true;
     }
+
 
     function compare_responses(&$question, $state, $teststate) {
                if ($question->options->showunits == 1 && isset($question->options->units) && isset($question->options->units[$state->responses['unit']] )){
             $state->responses['unit']=$question->options->units[$state->responses['unit']]->unit;
         };
 
-        
+
         $responses = '';
         $testresponses = '';
         if (isset($state->responses['answer'])){
@@ -434,11 +433,11 @@ class question_numerical_qtype extends question_shortanswer_qtype {
             $state->responses['']= $state->responses['answer'].$state->responses['unit'] ;// why?
         }
          //       echo "<p> test response numerical state  before apply <pre>";print_r($state);echo "</pre></p>";
-           
+
         $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 "<p>test responses valid unit </p>"; 
-     //  if (!$this->valid_numerical_unit) echo "<p>test responses not valid unit </p>"; 
+     //  if ($this->valid_numerical_unit) echo "<p>test responses valid unit </p>";
+     //  if (!$this->valid_numerical_unit) echo "<p>test responses not valid unit </p>";
        // echo "<p>state response test $response <pre>";print_r($state);echo "</pre></p>";
        // $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 "<p>grade responses  <pre>";print_r($state->responses);echo "</pre></p>";
-  
-        //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 "<p>grade responses valid unit </p>"; 
-     //  if (!$this->valid_numerical_unit) echo "<p>grade responses not valid unit </p>"; 
+     //  if ($this->valid_numerical_unit) echo "<p>grade responses valid unit </p>";
+     //  if (!$this->valid_numerical_unit) echo "<p>grade responses not valid unit </p>";
         // 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 "<p>state response numerical GET ACTUAL RESPONSE $question->id $question->qtype <pre>";print_r($state);echo "</pre></p>";
-       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 "<p>state uestion_grading_details $question->id $question->qtype <pre>";print_r($state);echo "</pre></p>";
 
         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());
-?>
+
index f425c033b65c472e071b012086951119824b02a9..24f2346a480fddabf9aee4a974380445178c15ba 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Unit tests for (some of) question/type/numerical/questiontype.php.
  *
@@ -149,4 +149,4 @@ class question_numerical_qtype_test extends UnitTestCase {
 //    }
 }
 
-?>
+
index c033bef16bcb3975854d5f4cf44f7f0bf5268be0..168f4ff99cc71f7e40989953a36701b29c3f568d 100644 (file)
@@ -1,6 +1,6 @@
-<?PHP // $Id$
+<?php
 
 $plugin->version  = 2009100100;
 $plugin->requires = 2007101000;
 
-?>
+
index 3ba083bad5ae467c319953f876b6c3dfafe7d6e9..f59ebe8bf30a6ccb578032e4c657c63d8862f832 100644 (file)
@@ -1,5 +1,5 @@
-<?php  // $Id$
-/* This template determines the overall layout of a question. It is included by the 
+<?php
+/* This template determines the overall layout of a question. It is included by the
  * print_question() method.
  */
 ?>
index e5d8a278fb06abd2b457dcf98d6fb052f5ad64c5..e683167d5935596cdcf5ecb3a5adc549c8832963 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * The default questiontype class.
  *
@@ -1816,4 +1816,4 @@ class default_questiontype {
         return array($form, $question);
     }
 }
-?>
+
index e563d3ed75a123f4faefbd7b0993f968d92c0896..35eddb91b71fde11348d79ba9bf825ffc0e79dc7 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Defines the editing form for the random question type.
  *
@@ -31,7 +31,7 @@ class question_edit_random_form extends question_edit_form {
         // Standard fields at the start of the form.
         $mform->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
index 1af2884061355b5774bc9da0c4f0238162aa46db..9fa059edfe6776f0ec63bd89b9fdaa07021e6090 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Class for the random question type.
  *
@@ -409,7 +409,7 @@ class random_qtype extends default_questiontype {
 
         return $answer_field;
     }
-    
+
     /**
      * For random question type return empty string which means won't calculate.
      * @param object $question
@@ -429,4 +429,4 @@ class random_qtype extends default_questiontype {
 //////////////////////////////////////////////////////////////////////////
 question_register_questiontype(new random_qtype());
 
-?>
+
index dcefd68934aabf729cb226a846a2a54cdf106961..761e4a513cae2ec7616014f24f46d064be41e32b 100644 (file)
@@ -1,6 +1,6 @@
-<?php  // $Id$
+<?php
 
-// This file keeps track of upgrades to 
+// This file keeps track of upgrades to
 // the randomsamatch qtype plugin
 //
 // Sometimes, changes between versions involve
@@ -26,8 +26,8 @@ function xmldb_qtype_randomsamatch_upgrade($oldversion) {
     $dbman = $DB->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;
 }
 
-?>
+
index f6adcd72ddbcbe80155d4a2435cbab3c317142c4..24b9502e175aad307a3e2c803244e133134b2296 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Defines the editing form for the randomsamatch question type.
  *
@@ -73,4 +73,4 @@ class question_edit_randomsamatch_form extends question_edit_form {
 
     }
 }
-?>
+
index 5f9bba05f3dd199f760d1c8de7667717586f1590..710fea3179021369ba13298c3b1fe1891329f600 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 /////////////////////
 /// RANDOMSAMATCH ///
@@ -199,7 +199,7 @@ class question_randomsamatch_qtype extends question_match_qtype {
                         echo $OUTPUT->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());
-?>
+
index fd7780c1c1aa3bb1e0ce1f4fb07f4df25115715c..3e15273118d3eb85ba8158bd0395c5a89a85e7fb 100644 (file)
@@ -1,6 +1,6 @@
-<?PHP // $Id$
+<?php
 
 $plugin->version  = 2006042800;
 $plugin->requires = 2007101000;
 
-?>
+
index e0097e0abb7d72a2f7e8b0e040f0cd1fa1ad8e96..34351562d8ff51ce33328163524906dd17a0a8da 100644 (file)
@@ -1,6 +1,6 @@
-<?php  // $Id$
+<?php
 
-// This file keeps track of upgrades to 
+// This file keeps track of upgrades to
 // the shortanswer qtype plugin
 //
 // Sometimes, changes between versions involve
@@ -26,8 +26,8 @@ function xmldb_qtype_shortanswer_upgrade($oldversion) {
     $dbman = $DB->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;
 }
 
-?>
+
index 375a20b42809932796e3f1673f9938c04e36b8eb..0a8944fdbb14106fd1629614f249cbb3cf9a6161 100644 (file)
@@ -10,7 +10,7 @@
   <div class="prompt">
     <?php echo get_string("answer", "quiz").': '; ?>
   </div>
-  <?php if ($question->qtype == 'numerical' || $question->qtype == 'calculated' || $question->qtype == 'calculatedsimple' ){ 
+  <?php if ($question->qtype == 'numerical' || $question->qtype == 'calculated' || $question->qtype == 'calculatedsimple' ){
         include("$CFG->dirroot/question/type/numerical/display.html");?>
 <?php }else {?>
   <div class="answer">
index cede3cc74bbe1a1913842bfc5b027a8d121c98e6..fae996e4642fe56cb7ebad76d9b2a2ed256e4a19 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Defines the editing form for the shortanswer question type.
  *
@@ -76,4 +76,3 @@ class question_edit_shortanswer_form extends question_edit_form {
         return 'shortanswer';
     }
 }
-?>
\ No newline at end of file
index 061fdec38ea7d48e25d6ab03e52f871f29d37b83..e023f003475be1c2511c9f69ba0bcc79455a5ff6 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 ///////////////////
 /// SHORTANSWER ///
@@ -133,7 +133,7 @@ class question_shortanswer_qtype extends default_questiontype {
         if ($options->feedback) {
             $class = question_get_feedback_class(0);
             $feedbackimg = question_get_feedback_image(0);
-            //this is OK for the first answer with a good response 
+            //this is OK for the first answer with a good response
             foreach($question->options->answers as $answer) {
 
                 if ($this->test_response($question, $state, $answer)) {
@@ -322,7 +322,7 @@ class question_shortanswer_qtype extends default_questiontype {
             }
 
                 // let student know wether the answer was correct
-                $class = question_get_feedback_class($state->last_graded->raw_grade / 
+                $class = question_get_feedback_class($state->last_graded->raw_grade /
                         $question->maxgrade);
                 echo '<div class="correctness ' . $class . '">' . get_string($class, 'quiz');
                 if ($correctanswer && ($class == 'partiallycorrect' || $class == 'incorrect')) {
@@ -348,7 +348,7 @@ class question_shortanswer_qtype extends default_questiontype {
                             // A penalty was applied so display it
                             echo ' '.$grade->numerical;
                             //print_string('gradingdetailspenalty', 'quiz', question_format_grade($cmoptions, $this->raw_unitpenalty));
-                           echo ' ';      
+                           echo ' ';
                             print_string('gradingdetailspenalty', 'quiz', question_format_grade($cmoptions, $state->last_graded->penalty));
                         } else {
                             /* No penalty was applied even though the answer was
@@ -399,4 +399,4 @@ class question_shortanswer_qtype extends default_questiontype {
 //// INITIATION - Without this line the question type is not in use... ///
 //////////////////////////////////////////////////////////////////////////
 question_register_questiontype(new question_shortanswer_qtype());
-?>
+
index 523819975d37ce6510cf4d422963ffef43be8acb..ddb09c88094dd650898339bbb771dfdee882a7af 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 /**
  * Unit tests for (some of) question/type/shortanswer/questiontype.php.
  *
@@ -264,4 +264,4 @@ class question_shortanswer_qtype_test extends UnitTestCase {
     }
 }
 
-?>
+
index c39730578d9b771d0b380eb833b7afe30d4b030c..1950094efc88b6fd15a3392dc786d8711e80304e 100644 (file)
@@ -1,6 +1,6 @@
-<?PHP // $Id$
+<?php
 
 $plugin->version  = 2006032200;
 $plugin->requires = 2007101000;
 
-?>
+
index 7a9be84d68f2798fa4a656ccfa1984a090084f33..77e07b15471ce4fecbf8b98e9c621f9684c2220c 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 
 ///////////////////////////////////////////////////////////////////////////
 //                                                                       //
@@ -71,4 +71,4 @@ class default_questiontype_test extends UnitTestCase {
     }
 }
 
-?>
+
index c2b85e99bbc7706eee9bc0a3ad3501d5f6cd6dbf..5495c6251e07baf4dcbe691c07272dc74856022d 100644 (file)
@@ -1,6 +1,6 @@
-<?php  // $Id$
+<?php
 
-// This file keeps track of upgrades to 
+// This file keeps track of upgrades to
 // the truefalse qtype plugin
 //
 // Sometimes, changes between versions involve
@@ -26,8 +26,8 @@ function xmldb_qtype_truefalse_upgrade($oldversion) {
     $dbman = $DB->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_truefalse_upgrade($oldversion) {
     return $result;
 }
 
-?>
+
index 6cc2e49bd4bc563435f76bc1e1e506786d4e84ef..2bd99a5702c42993e7f65f2321b528f0488f83d8 100644 (file)
@@ -8,7 +8,7 @@
 
 <div class="ablock clearfix">
   <div class="prompt">
-    <?php print_string('answer', 'quiz') ?>: 
+    <?php print_string('answer', 'quiz') ?>:
   </div>
 
   <div class="answer">
index 4ee306d0e75838e8aeb26e1a062eadb87bc40027..1bc8604b0538da2c1e8fdbe366e49071f71e4411 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 require_once($CFG->dirroot.'/question/type/edit_question_form.php');
 /**
  * Defines the editing form for the thruefalse question type.
@@ -50,4 +50,3 @@ class question_edit_truefalse_form extends question_edit_form {
         return 'truefalse';
     }
 }
-?>
\ No newline at end of file
index db745801d61219014bb5b2dda9fb5b4ded8caed6..87ae461e071dd36758438ed93b65ef7aba33b10f 100644 (file)
@@ -1,4 +1,4 @@
-<?php  // $Id$
+<?php
 
 /////////////////
 /// TRUEFALSE ///
@@ -359,4 +359,4 @@ class question_truefalse_qtype extends default_questiontype {
 //// INITIATION - Without this line the question type is not in use... ///
 //////////////////////////////////////////////////////////////////////////
 question_register_questiontype(new question_truefalse_qtype());
-?>
+
index c39730578d9b771d0b380eb833b7afe30d4b030c..1950094efc88b6fd15a3392dc786d8711e80304e 100644 (file)
@@ -1,6 +1,6 @@
-<?PHP // $Id$
+<?php
 
 $plugin->version  = 2006032200;
 $plugin->requires = 2007101000;
 
-?>
+
index ab51ad7c9e5fbfd00d5b24631ce6de70dcc5663d..8f0c952097f176ef02ed4cf6a7d1612fe19e138b 100644 (file)
@@ -1,4 +1,4 @@
-<?php // $Id$
+<?php
 /**
  * This file contains dtabase upgrade code that is called from lib/db/upgrade.php,
  * and also check methods that can be used for pre-install checks via
@@ -23,4 +23,4 @@ function question_fix_random_question_parents() {
     return $DB->execute("UPDATE {question} SET parent = id WHERE qtype = 'random' AND parent <> id");
 }
 
-?>
+
index 39d58bc9db37d90ac06535b3ce0f556a89b97ce8..eca14d0a95ff04378425b31fa416c5c05c0ca039 100644 (file)
@@ -1,5 +1,3 @@
-/*  $Id$ */
-
 /*************************************************
 ***
 *** pda