MDL-20700 coding style cleanup - cvs keywords removed, closign php tag removed, trailing whitespace cleanup
This commit is contained in:
+11
-11
@@ -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>';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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();
|
||||
?>
|
||||
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -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);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php //$Id$
|
||||
<?php
|
||||
|
||||
// This file is executed right after the install.xml
|
||||
//
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
function xmldb_quiz_statistics_upgrade($oldversion) {
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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();
|
||||
?>
|
||||
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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();
|
||||
?>
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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 '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -424,4 +424,4 @@ class securewindow_access_rule_test extends UnitTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -60,4 +60,4 @@ class quiz_editlib_test extends UnitTestCase {
|
||||
$this->assertEqual(quiz_add_page_break_at('1,2,0', 3), '1,2,0');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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();
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Question bank backup code.
|
||||
*
|
||||
@@ -531,4 +531,4 @@
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Allows a teacher to create, edit and delete categories
|
||||
*
|
||||
@@ -132,4 +132,4 @@
|
||||
$qcobject->display_user_interface();
|
||||
}
|
||||
echo $OUTPUT->footer();
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Class representing question categories
|
||||
*
|
||||
@@ -513,4 +513,4 @@ class question_category_object {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Allows someone with appropriate permissions to move a category and associated
|
||||
* files to another context.
|
||||
@@ -236,4 +236,4 @@
|
||||
}
|
||||
$contextmoveform->display();
|
||||
echo $OUTPUT->footer();
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php //$Id$
|
||||
<?php
|
||||
|
||||
require_once($CFG->libdir.'/formslib.php');
|
||||
|
||||
@@ -100,4 +100,4 @@ class question_context_move_form extends moodleform {
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Page for moving questions
|
||||
*
|
||||
@@ -237,4 +237,4 @@ if (count($urls)){
|
||||
}
|
||||
$contextmoveform->display();
|
||||
echo $OUTPUT->footer();
|
||||
?>
|
||||
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
@@ -97,4 +97,4 @@
|
||||
echo "</div>\n";
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
?>
|
||||
|
||||
|
||||
@@ -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 = '
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Export quiz questions into the given category
|
||||
*
|
||||
@@ -134,4 +134,4 @@
|
||||
$export_form->display();
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
?>
|
||||
|
||||
|
||||
@@ -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 {
|
||||
//--------------------------------------------------------------------------------
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Base class for question import and export formats.
|
||||
*
|
||||
@@ -830,4 +830,4 @@ class qformat_default {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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
|
||||
?>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
//
|
||||
@@ -18,15 +18,15 @@
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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> ';
|
||||
|
||||
|
||||
$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> ';
|
||||
|
||||
|
||||
$text = preg_replace($search, $replace, $text);
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -11,16 +11,16 @@
|
||||
*
|
||||
* @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) {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -26,14 +26,14 @@
|
||||
{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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
//
|
||||
///////////////////////////////////////////////////////////////
|
||||
// XML import/export
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Import quiz questions into the given category
|
||||
*
|
||||
@@ -167,4 +167,4 @@
|
||||
$import_form->display();
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* This page displays a preview of a question
|
||||
*
|
||||
@@ -250,4 +250,4 @@
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
echo $OUTPUT->footer();
|
||||
?>
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* Question bank restore code.
|
||||
*
|
||||
@@ -680,14 +680,14 @@
|
||||
// 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']['#']);
|
||||
@@ -695,10 +695,10 @@
|
||||
$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')) {
|
||||
@@ -1070,4 +1070,4 @@
|
||||
|
||||
return $status;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
+2
-2
@@ -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());
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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';
|
||||
?>
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?PHP // $Id$
|
||||
<?php
|
||||
|
||||
$plugin->version = 2009092000;
|
||||
$plugin->requires = 2007101000;
|
||||
?>
|
||||
|
||||
|
||||
@@ -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 ('' != 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 ( $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> ".$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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="qtext">
|
||||
<?php echo $questiontext; ?>
|
||||
</div>
|
||||
|
||||
|
||||
<?php if ($image) { ?>
|
||||
<img class="qimage" src="<?php echo $image; ?>" alt="" />
|
||||
<?php } ?>
|
||||
|
||||
@@ -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());
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php // $Id$
|
||||
<?php
|
||||
/**
|
||||
* A base class for question editing forms.
|
||||
*
|
||||
@@ -335,4 +335,4 @@ class question_edit_form extends moodleform {
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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());
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP // $Id$
|
||||
<?php
|
||||
|
||||
$plugin->version = 2006032200;
|
||||
$plugin->requires = 2007101000;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -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());
|
||||
?>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?PHP // $Id$
|
||||
<?php
|
||||
|
||||
$plugin->version = 2006032200;
|
||||
$plugin->requires = 2007101000;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
?>
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user