mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
make compatible with PHP 5.1.2 by removing variable assignments in calls to functions e.g. myfunction($a=1); Micro-incremented version number to 2.1.15
This commit is contained in:
parent
475e9de86f
commit
c20b623804
6 changed files with 772 additions and 759 deletions
|
@ -1,10 +1,10 @@
|
|||
This is v2.1.14 of the HotPot module
|
||||
This is v2.1.15 of the HotPot module
|
||||
|
||||
This module allows teachers to administer Hot Potatoes and TexToys quizzes via Moodle.
|
||||
It has been tested on:
|
||||
- Hot Potatoes 6
|
||||
- Moodle 1.1 thru 1.6
|
||||
- PHP 4.1 thru 5.0
|
||||
- PHP 4.1 thru 5.1.2
|
||||
- MySQL and PostgreSQL databases
|
||||
|
||||
This module may be distributed under the terms of the General Public License
|
||||
|
|
|
@ -166,23 +166,23 @@ define("HOTPOT_DISPLAYNEXT_INDEX", "2");
|
|||
|
||||
|
||||
// possible return values:
|
||||
// false:
|
||||
// display moderr.html (if exists) OR "Could not update" and return to couse view
|
||||
// string:
|
||||
// display as error message and return to course view
|
||||
// false:
|
||||
// display moderr.html (if exists) OR "Could not update" and return to couse view
|
||||
// string:
|
||||
// display as error message and return to course view
|
||||
// true (or non-zero number):
|
||||
// continue to $hp->redirect (if set) OR hotpot/view.php (to displsay quiz)
|
||||
// continue to $hp->redirect (if set) OR hotpot/view.php (to displsay quiz)
|
||||
|
||||
// $hp is an object containing the values of the form in mod.html
|
||||
// i.e. all the fields in the 'hotpot' table, plus the following:
|
||||
// $hp->course : an id in the 'course' table
|
||||
// $hp->coursemodule : an id in the 'course_modules' table
|
||||
// $hp->section : an id in the 'course_sections' table
|
||||
// $hp->module : an id in the 'modules' table
|
||||
// $hp->modulename : always 'hotpot'
|
||||
// $hp->instance : an id in the 'hotpot' table
|
||||
// $hp->mode : 'add' or 'update'
|
||||
// $hp->sesskey : unique string required for Moodle's session management
|
||||
// $hp->course : an id in the 'course' table
|
||||
// $hp->coursemodule : an id in the 'course_modules' table
|
||||
// $hp->section : an id in the 'course_sections' table
|
||||
// $hp->module : an id in the 'modules' table
|
||||
// $hp->modulename : always 'hotpot'
|
||||
// $hp->instance : an id in the 'hotpot' table
|
||||
// $hp->mode : 'add' or 'update'
|
||||
// $hp->sesskey : unique string required for Moodle's session management
|
||||
|
||||
function hotpot_add_instance(&$hp) {
|
||||
if (hotpot_set_form_values($hp)) {
|
||||
|
@ -1255,9 +1255,9 @@ class hotpot_xml_tree {
|
|||
if (empty($str)) {
|
||||
$this->xml = array();
|
||||
} else {
|
||||
if (empty($CFG->unicodedb)) {
|
||||
$str = utf8_encode($str);
|
||||
}
|
||||
if (empty($CFG->unicodedb)) {
|
||||
$str = utf8_encode($str);
|
||||
}
|
||||
$this->xml = xmlize($str, 0);
|
||||
}
|
||||
$this->xml_root = $xml_root;
|
||||
|
@ -1268,9 +1268,9 @@ class hotpot_xml_tree {
|
|||
eval('$value = &$this->xml'.$this->xml_root.$tags.$more_tags.';');
|
||||
|
||||
if (is_string($value)) {
|
||||
if (empty($CFG->unicodedb)) {
|
||||
$value = utf8_decode($value);
|
||||
}
|
||||
if (empty($CFG->unicodedb)) {
|
||||
$value = utf8_decode($value);
|
||||
}
|
||||
|
||||
// decode angle brackets
|
||||
$value = strtr($value, array('<'=>'<', '>'=>'>', '&'=>'&'));
|
||||
|
@ -1296,7 +1296,7 @@ class hotpot_xml_tree {
|
|||
// encode unicode characters as HTML entities
|
||||
// (in particular, accented charaters that have not been encoded by HP)
|
||||
|
||||
// unicode characetsr can be detected by checking the hex value of a character
|
||||
// unicode characters can be detected by checking the hex value of a character
|
||||
// 00 - 7F : ascii char (roman alphabet + punctuation)
|
||||
// 80 - BF : byte 2, 3 or 4 of a unicode char
|
||||
// C0 - DF : 1st byte of 2-byte char
|
||||
|
@ -1306,20 +1306,6 @@ class hotpot_xml_tree {
|
|||
// 80 - FF : single-byte, non-ascii char
|
||||
$search = '#('.'[\xc0-\xdf][\x80-\xbf]'.'|'.'[\xe0-\xef][\x80-\xbf]{2}'.'|'.'[\xf0-\xff][\x80-\xbf]{3}'.'|'.'[\x80-\xff]'.')#se';
|
||||
$value = preg_replace($search, "hotpot_utf8_to_html_entity('\\1')", $value);
|
||||
|
||||
// NOTICE
|
||||
// ======
|
||||
// the following lines have been removed because
|
||||
// the final "preg_replace" takes several SECONDS to run
|
||||
|
||||
// encode any orphaned angle brackets back to html entities
|
||||
//if (empty($this->tag_pattern)) {
|
||||
// $q = "'"; // single quote
|
||||
// $qq = '"'; // double quote
|
||||
// $this->tag_pattern = '<(([^>'.$q.$qq.']*)|('."{$q}[^$q]*$q".')|('."{$qq}[^$qq]*$qq".'))*>';
|
||||
//}
|
||||
//$value = preg_replace('/<([^>]*'.$this->tag_pattern.')/', '<$1', $value);
|
||||
//$value = preg_replace('/('.$this->tag_pattern.'[^<]*)>/', '$1>', $value);
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
@ -1389,9 +1375,9 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
|
|||
$this->create_html = $create_html;
|
||||
|
||||
// extract fields from $obj
|
||||
// course : the course id
|
||||
// reference : the filename within the files folder
|
||||
// location : "site" files folder or "course" files folder
|
||||
// course : the course id
|
||||
// reference : the filename within the files folder
|
||||
// location : "site" files folder or "course" files folder
|
||||
// navigation : type of navigation required in quiz
|
||||
// forceplugins : force Moodle compatible media players
|
||||
$this->course = $this->obj_value($obj, 'course');
|
||||
|
@ -1664,10 +1650,10 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
|
|||
$filepath = "$Q\.($filetype)";
|
||||
|
||||
// pattern to match <param> tags which contain the file path
|
||||
// wmp : url
|
||||
// wmp : url
|
||||
// quicktime : src
|
||||
// realplayer : src
|
||||
// flash : movie (doesn't need replacing)
|
||||
// flash : movie (doesn't need replacing)
|
||||
$param_url = "/<param$s{$n}name=$q(src|url)$q$s{$n}value=$q($filepath)$q$n>/is";
|
||||
|
||||
// pattern to match <a> tags which link to multimedia files (not swf)
|
||||
|
@ -2176,7 +2162,7 @@ if (!function_exists('html_entity_decode')) {
|
|||
|
||||
// required for Moodle 1.x
|
||||
if (!isset($CFG->pixpath)) {
|
||||
$CFG->pixpath = "$CFG->wwwroot/pix";
|
||||
$CFG->pixpath = "$CFG->wwwroot/pix";
|
||||
}
|
||||
|
||||
if (!defined('PARAM_RAW')) define('PARAM_RAW', 0x0000);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,167 +1,169 @@
|
|||
<?php // $Id$
|
||||
/// Overview report just displays a big table of all the attempts
|
||||
class hotpot_report extends hotpot_default_report {
|
||||
function display(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options) {
|
||||
$this->create_overview_table($hotpot, $cm, $course, $users, $attempts, $questions, $options, $tables=array());
|
||||
$this->print_report($course, $hotpot, $tables, $options);
|
||||
return true;
|
||||
}
|
||||
function create_overview_table(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options, &$tables) {
|
||||
global $CFG;
|
||||
$strtimeformat = get_string('strftimedatetime');
|
||||
$is_html = ($options['reportformat']=='htm');
|
||||
$spacer = $is_html ? ' ' : ' ';
|
||||
$br = $is_html ? "<br />\n" : "\n";
|
||||
// initialize $table
|
||||
unset($table);
|
||||
$table->border = 1;
|
||||
$table->width = 10;
|
||||
$table->head = array();
|
||||
$table->align = array();
|
||||
$table->size = array();
|
||||
$table->wrap = array();
|
||||
// picture column, if required
|
||||
if ($is_html) {
|
||||
$table->head[] = $spacer;
|
||||
$table->align[] = 'center';
|
||||
$table->size[] = 10;
|
||||
$table->wrap[] = "nowrap";
|
||||
}
|
||||
array_push($table->head,
|
||||
get_string("name"),
|
||||
hotpot_grade_heading($hotpot, $options),
|
||||
get_string("attempt", "quiz"),
|
||||
get_string("time", "quiz"),
|
||||
get_string("reportstatus", "hotpot"),
|
||||
get_string("timetaken", "quiz"),
|
||||
get_string("score", "quiz")
|
||||
);
|
||||
array_push($table->align, "left", "center", "center", "left", "center", "center", "center");
|
||||
array_push($table->wrap, "nowrap", "nowrap", "nowrap", "nowrap", "nowrap", "nowrap", "nowrap");
|
||||
array_push($table->size, "*", "*", "*", "*", "*", "*", "*");
|
||||
$abandoned = 0;
|
||||
foreach ($users as $user) {
|
||||
// shortcut to user info held in first attempt record
|
||||
$u = &$user->attempts[0];
|
||||
$picture = '';
|
||||
$name = fullname($u);
|
||||
if ($is_html) {
|
||||
$picture = print_user_picture($u->userid, $course->id, $u->picture, false, true);
|
||||
$name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$u->userid.'&course='.$course->id.'">'.$name.'</a>';
|
||||
}
|
||||
$grade = isset($user->grade) ? $user->grade : $spacer;
|
||||
$attemptcount = count($user->attempts);
|
||||
if ($attemptcount>1) {
|
||||
$text = $name;
|
||||
$name = NULL;
|
||||
$name->text = $text;
|
||||
$name->rowspan = $attemptcount;
|
||||
$text = $grade;
|
||||
$grade = NULL;
|
||||
$grade->text = $text;
|
||||
$grade->rowspan = $attemptcount;
|
||||
}
|
||||
$data = array();
|
||||
if ($is_html) {
|
||||
if ($attemptcount>1) {
|
||||
$text = $picture;
|
||||
$picture = NULL;
|
||||
$picture->text = $text;
|
||||
$picture->rowspan = $attemptcount;
|
||||
}
|
||||
$data[] = $picture;
|
||||
}
|
||||
array_push($data, $name, $grade);
|
||||
foreach ($user->attempts as $attempt) {
|
||||
// increment count of abandoned attempts
|
||||
// if attempt is marked as finished but has no score
|
||||
if ($attempt->status==HOTPOT_STATUS_ABANDONED) {
|
||||
$abandoned++;
|
||||
}
|
||||
$attemptnumber = $attempt->attempt;
|
||||
$starttime = trim(userdate($attempt->timestart, $strtimeformat));
|
||||
if ($is_html && isset($attempt->score) && (isteacher($course->id) || $hotpot->review)) {
|
||||
$attemptnumber = '<a href="review.php?hp='.$hotpot->id.'&attempt='.$attempt->id.'">'.$attemptnumber.'</a>';
|
||||
$starttime = '<a href="review.php?hp='.$hotpot->id.'&attempt='.$attempt->id.'">'.$starttime.'</a>';
|
||||
}
|
||||
if ($is_html && isteacher($course->id)) {
|
||||
$checkbox = '<input type=checkbox name="box'.$attempt->clickreportid.'" value="'.$attempt->clickreportid.'">'.$spacer;
|
||||
} else {
|
||||
$checkbox = '';
|
||||
}
|
||||
$timetaken = empty($attempt->timefinish) ? $spacer : format_time($attempt->timefinish - $attempt->timestart);
|
||||
$score = hotpot_format_score($attempt);
|
||||
if ($is_html && is_numeric($score) && $score==$user->grade) { // best grade
|
||||
$score = '<span class="highlight">'.$score.'</span>';
|
||||
}
|
||||
array_push($data,
|
||||
$attemptnumber,
|
||||
$checkbox.$starttime,
|
||||
hotpot_format_status($attempt),
|
||||
$timetaken,
|
||||
$score
|
||||
);
|
||||
$table->data[] = $data;
|
||||
$data = array();
|
||||
} // end foreach $attempt
|
||||
$table->data[] = 'hr';
|
||||
} // end foreach $user
|
||||
// remove final 'hr' from data rows
|
||||
array_pop($table->data);
|
||||
// add the "delete" form to the table
|
||||
if ($options['reportformat']=='htm' && isteacher($course->id)) {
|
||||
$strdeletecheck = get_string('deleteattemptcheck','quiz');
|
||||
$table->start = $this->deleteform_javascript();
|
||||
$table->start .= '<form method="post" action="report.php" name="deleteform" onsubmit="'."return deletecheck('".$strdeletecheck."', 'selection')".'">'."\n";
|
||||
$table->start .= '<input type="hidden" name="del" value="selection">'."\n";
|
||||
$table->start .= '<input type="hidden" name="id" value="'.$cm->id.'">'."\n";
|
||||
$table->finish = '<center>'."\n";
|
||||
$table->finish .= '<input type="submit" value="'.get_string("deleteselected").'"> '."\n";
|
||||
if ($abandoned) {
|
||||
$table->finish .= '<input type=button value="'.get_string('deleteabandoned', 'hotpot').'" onClick="if(deletecheck('."'".addslashes(get_string('deleteabandonedcheck', 'hotpot', $abandoned))."', 'abandoned', true".'))document.deleteform.submit();">'."\n";
|
||||
}
|
||||
$table->finish .= '<input type=button value="'.get_string("deleteall").'" onClick="if(deletecheck('."'".addslashes($strdeletecheck)."', 'all', true".'))document.deleteform.submit();">'."\n";
|
||||
$table->finish .= '</center>'."\n";
|
||||
$table->finish .= '</form>'."\n";
|
||||
}
|
||||
$tables[] = &$table;
|
||||
}
|
||||
function deleteform_javascript() {
|
||||
$strselectattempt = addslashes(get_string('selectattempt','hotpot'));
|
||||
return <<<END_OF_JAVASCRIPT
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function deletecheck(p, v, x) {
|
||||
var r = false; // result
|
||||
// get length of form elements
|
||||
var f = document.deleteform;
|
||||
var l = f ? f.elements.length : 0;
|
||||
// count selected items, if necessary
|
||||
if (!x) {
|
||||
x = 0;
|
||||
for (var i=0; i<l; i++) {
|
||||
var obj = f.elements[i];
|
||||
if (obj.type && obj.type=='checkbox' && obj.checked) {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// confirm deletion
|
||||
var n = navigator;
|
||||
if (x || (n.appName=='Netscape' && parseint(n.appVersion)==2)) {
|
||||
r = confirm(p);
|
||||
if (r) {
|
||||
f.del.value = v;
|
||||
}
|
||||
} else {
|
||||
alert('$strselectattempt');
|
||||
}
|
||||
return r;
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
END_OF_JAVASCRIPT
|
||||
;
|
||||
} // end function
|
||||
} // end class
|
||||
?>
|
||||
<?php // $Id$
|
||||
/// Overview report just displays a big table of all the attempts
|
||||
class hotpot_report extends hotpot_default_report {
|
||||
|
||||
function display(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options) {
|
||||
$tables = array();
|
||||
$this->create_overview_table($hotpot, $cm, $course, $users, $attempts, $questions, $options, $tables);
|
||||
$this->print_report($course, $hotpot, $tables, $options);
|
||||
return true;
|
||||
}
|
||||
function create_overview_table(&$hotpot, &$cm, &$course, &$users, &$attempts, &$questions, &$options, &$tables) {
|
||||
global $CFG;
|
||||
$strtimeformat = get_string('strftimedatetime');
|
||||
$is_html = ($options['reportformat']=='htm');
|
||||
$spacer = $is_html ? ' ' : ' ';
|
||||
$br = $is_html ? "<br />\n" : "\n";
|
||||
// initialize $table
|
||||
unset($table);
|
||||
$table->border = 1;
|
||||
$table->width = 10;
|
||||
$table->head = array();
|
||||
$table->align = array();
|
||||
$table->size = array();
|
||||
$table->wrap = array();
|
||||
// picture column, if required
|
||||
if ($is_html) {
|
||||
$table->head[] = $spacer;
|
||||
$table->align[] = 'center';
|
||||
$table->size[] = 10;
|
||||
$table->wrap[] = "nowrap";
|
||||
}
|
||||
array_push($table->head,
|
||||
get_string("name"),
|
||||
hotpot_grade_heading($hotpot, $options),
|
||||
get_string("attempt", "quiz"),
|
||||
get_string("time", "quiz"),
|
||||
get_string("reportstatus", "hotpot"),
|
||||
get_string("timetaken", "quiz"),
|
||||
get_string("score", "quiz")
|
||||
);
|
||||
array_push($table->align, "left", "center", "center", "left", "center", "center", "center");
|
||||
array_push($table->wrap, "nowrap", "nowrap", "nowrap", "nowrap", "nowrap", "nowrap", "nowrap");
|
||||
array_push($table->size, "*", "*", "*", "*", "*", "*", "*");
|
||||
$abandoned = 0;
|
||||
foreach ($users as $user) {
|
||||
// shortcut to user info held in first attempt record
|
||||
$u = &$user->attempts[0];
|
||||
$picture = '';
|
||||
$name = fullname($u);
|
||||
if ($is_html) {
|
||||
$picture = print_user_picture($u->userid, $course->id, $u->picture, false, true);
|
||||
$name = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$u->userid.'&course='.$course->id.'">'.$name.'</a>';
|
||||
}
|
||||
$grade = isset($user->grade) ? $user->grade : $spacer;
|
||||
$attemptcount = count($user->attempts);
|
||||
if ($attemptcount>1) {
|
||||
$text = $name;
|
||||
$name = NULL;
|
||||
$name->text = $text;
|
||||
$name->rowspan = $attemptcount;
|
||||
$text = $grade;
|
||||
$grade = NULL;
|
||||
$grade->text = $text;
|
||||
$grade->rowspan = $attemptcount;
|
||||
}
|
||||
$data = array();
|
||||
if ($is_html) {
|
||||
if ($attemptcount>1) {
|
||||
$text = $picture;
|
||||
$picture = NULL;
|
||||
$picture->text = $text;
|
||||
$picture->rowspan = $attemptcount;
|
||||
}
|
||||
$data[] = $picture;
|
||||
}
|
||||
array_push($data, $name, $grade);
|
||||
foreach ($user->attempts as $attempt) {
|
||||
// increment count of abandoned attempts
|
||||
// if attempt is marked as finished but has no score
|
||||
if ($attempt->status==HOTPOT_STATUS_ABANDONED) {
|
||||
$abandoned++;
|
||||
}
|
||||
$attemptnumber = $attempt->attempt;
|
||||
$starttime = trim(userdate($attempt->timestart, $strtimeformat));
|
||||
if ($is_html && isset($attempt->score) && (isteacher($course->id) || $hotpot->review)) {
|
||||
$attemptnumber = '<a href="review.php?hp='.$hotpot->id.'&attempt='.$attempt->id.'">'.$attemptnumber.'</a>';
|
||||
$starttime = '<a href="review.php?hp='.$hotpot->id.'&attempt='.$attempt->id.'">'.$starttime.'</a>';
|
||||
}
|
||||
if ($is_html && isteacher($course->id)) {
|
||||
$checkbox = '<input type=checkbox name="box'.$attempt->clickreportid.'" value="'.$attempt->clickreportid.'">'.$spacer;
|
||||
} else {
|
||||
$checkbox = '';
|
||||
}
|
||||
$timetaken = empty($attempt->timefinish) ? $spacer : format_time($attempt->timefinish - $attempt->timestart);
|
||||
$score = hotpot_format_score($attempt);
|
||||
if ($is_html && is_numeric($score) && $score==$user->grade) { // best grade
|
||||
$score = '<span class="highlight">'.$score.'</span>';
|
||||
}
|
||||
array_push($data,
|
||||
$attemptnumber,
|
||||
$checkbox.$starttime,
|
||||
hotpot_format_status($attempt),
|
||||
$timetaken,
|
||||
$score
|
||||
);
|
||||
$table->data[] = $data;
|
||||
$data = array();
|
||||
} // end foreach $attempt
|
||||
$table->data[] = 'hr';
|
||||
} // end foreach $user
|
||||
// remove final 'hr' from data rows
|
||||
array_pop($table->data);
|
||||
// add the "delete" form to the table
|
||||
if ($options['reportformat']=='htm' && isteacher($course->id)) {
|
||||
$strdeletecheck = get_string('deleteattemptcheck','quiz');
|
||||
$table->start = $this->deleteform_javascript();
|
||||
$table->start .= '<form method="post" action="report.php" name="deleteform" onsubmit="'."return deletecheck('".$strdeletecheck."', 'selection')".'">'."\n";
|
||||
$table->start .= '<input type="hidden" name="del" value="selection">'."\n";
|
||||
$table->start .= '<input type="hidden" name="id" value="'.$cm->id.'">'."\n";
|
||||
$table->finish = '<center>'."\n";
|
||||
$table->finish .= '<input type="submit" value="'.get_string("deleteselected").'"> '."\n";
|
||||
if ($abandoned) {
|
||||
$table->finish .= '<input type=button value="'.get_string('deleteabandoned', 'hotpot').'" onClick="if(deletecheck('."'".addslashes(get_string('deleteabandonedcheck', 'hotpot', $abandoned))."', 'abandoned', true".'))document.deleteform.submit();">'."\n";
|
||||
}
|
||||
$table->finish .= '<input type=button value="'.get_string("deleteall").'" onClick="if(deletecheck('."'".addslashes($strdeletecheck)."', 'all', true".'))document.deleteform.submit();">'."\n";
|
||||
$table->finish .= '</center>'."\n";
|
||||
$table->finish .= '</form>'."\n";
|
||||
}
|
||||
$tables[] = &$table;
|
||||
}
|
||||
function deleteform_javascript() {
|
||||
$strselectattempt = addslashes(get_string('selectattempt','hotpot'));
|
||||
return <<<END_OF_JAVASCRIPT
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
function deletecheck(p, v, x) {
|
||||
var r = false; // result
|
||||
// get length of form elements
|
||||
var f = document.deleteform;
|
||||
var l = f ? f.elements.length : 0;
|
||||
// count selected items, if necessary
|
||||
if (!x) {
|
||||
x = 0;
|
||||
for (var i=0; i<l; i++) {
|
||||
var obj = f.elements[i];
|
||||
if (obj.type && obj.type=='checkbox' && obj.checked) {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// confirm deletion
|
||||
var n = navigator;
|
||||
if (x || (n.appName=='Netscape' && parseint(n.appVersion)==2)) {
|
||||
r = confirm(p);
|
||||
if (r) {
|
||||
f.del.value = v;
|
||||
}
|
||||
} else {
|
||||
alert('$strselectattempt');
|
||||
}
|
||||
return r;
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
END_OF_JAVASCRIPT
|
||||
;
|
||||
} // end function
|
||||
} // end class
|
||||
?>
|
||||
|
|
|
@ -411,9 +411,9 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
|||
return $i;
|
||||
}
|
||||
function v6_expand_MatchDivItems() {
|
||||
$str = '';
|
||||
|
||||
$this->get_jmatch_items($l_items=array(), $r_items = array());
|
||||
$l_items = array();
|
||||
$r_items = array();
|
||||
$this->get_jmatch_items($l_items, $r_items);
|
||||
|
||||
$l_keys = $this->shuffle_jmatch_items($l_items);
|
||||
$r_keys = $this->shuffle_jmatch_items($r_items);
|
||||
|
@ -422,6 +422,8 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
|||
foreach ($r_keys as $key) {
|
||||
$options .= '<option value="'.$key.'">'.$r_items[$key]['text'][0]['#'].'</option>'."\n";
|
||||
}
|
||||
|
||||
$str = '';
|
||||
foreach ($l_keys as $key) {
|
||||
$str .= '<tr><td class="LeftItem">'.$l_items[$key]['text'][0]['#'].'</td>';
|
||||
$str .= '<td class="RightItem"><select id="s'.$key.'_'.$key.'">'.$options.'</select></td>';
|
||||
|
@ -693,8 +695,11 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
|||
// specials (JMatch)
|
||||
|
||||
function v6_expand_FixedArray() {
|
||||
$l_items = array();
|
||||
$r_items = array();
|
||||
$this->get_jmatch_items($l_items, $r_items);
|
||||
|
||||
$str = '';
|
||||
$this->get_jmatch_items($l_items=array(), $r_items = array());
|
||||
foreach ($l_items as $i=>$item) {
|
||||
$str .= "F[$i] = new Array();\n";
|
||||
$str .= "F[$i][0] = '".$this->js_safe($item['text'][0]['#'], true)."';\n";
|
||||
|
@ -703,8 +708,11 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
|||
return $str;
|
||||
}
|
||||
function v6_expand_DragArray() {
|
||||
$l_items = array();
|
||||
$r_items = array();
|
||||
$this->get_jmatch_items($l_items, $r_items);
|
||||
|
||||
$str = '';
|
||||
$this->get_jmatch_items($l_items=array(), $r_items = array());
|
||||
foreach ($r_items as $i=>$item) {
|
||||
$str .= "D[$i] = new Array();\n";
|
||||
$str .= "D[$i][0] = '".$this->js_safe($item['text'][0]['#'], true)."';\n";
|
||||
|
@ -1085,7 +1093,11 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
|||
// jcross6.js_
|
||||
|
||||
function v6_expand_LetterArray() {
|
||||
$this->v6_get_jcross_grid($row=NULL, $r_max=0, $c_max=0);
|
||||
$row=NULL;
|
||||
$r_max=0;
|
||||
$c_max=0;
|
||||
$this->v6_get_jcross_grid($row, $r_max, $c_max);
|
||||
|
||||
$str = '';
|
||||
for($r=0; $r<=$r_max; $r++) {
|
||||
$str .= "L[$r] = new Array(";
|
||||
|
@ -1097,7 +1109,11 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
|||
return $str;
|
||||
}
|
||||
function v6_expand_GuessArray() {
|
||||
$this->v6_get_jcross_grid($row=NULL, $r_max=0, $c_max=0);
|
||||
$row=NULL;
|
||||
$r_max=0;
|
||||
$c_max=0;
|
||||
$this->v6_get_jcross_grid($row, $r_max, $c_max);
|
||||
|
||||
$str = '';
|
||||
for($r=0; $r<=$r_max; $r++) {
|
||||
$str .= "G[$r] = new Array('".str_repeat("','", $c_max)."');\n";
|
||||
|
@ -1105,7 +1121,11 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
|||
return $str;
|
||||
}
|
||||
function v6_expand_ClueNumArray() {
|
||||
$this->v6_get_jcross_grid($row=NULL, $r_max=0, $c_max=0);
|
||||
$row=NULL;
|
||||
$r_max=0;
|
||||
$c_max=0;
|
||||
$this->v6_get_jcross_grid($row, $r_max, $c_max);
|
||||
|
||||
$i = 0; // clue index
|
||||
$str = '';
|
||||
for($r=0; $r<=$r_max; $r++) {
|
||||
|
@ -1128,7 +1148,11 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default {
|
|||
return $str;
|
||||
}
|
||||
function v6_expand_GridBody() {
|
||||
$this->v6_get_jcross_grid($row=NULL, $r_max=0, $c_max=0);
|
||||
$row=NULL;
|
||||
$r_max=0;
|
||||
$c_max=0;
|
||||
$this->v6_get_jcross_grid($row, $r_max, $c_max);
|
||||
|
||||
$i = 0; // clue index;
|
||||
$str = '';
|
||||
for($r=0; $r<=$r_max; $r++) {
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
/// Code fragment to define the version of hotpot
|
||||
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
$module->version = 2005090714; // release date of this version (see note below)
|
||||
$module->release = 'v2.1.14'; // human-friendly version name (used in mod/hotpot/lib.php)
|
||||
$module->version = 2005090715; // release date of this version (see note below)
|
||||
$module->release = 'v2.1.15'; // human-friendly version name (used in mod/hotpot/lib.php)
|
||||
$module->cron = 0; // period for cron to check this module (secs)
|
||||
// interpretation of YYYYMMDDXY version numbers
|
||||
// YYYY : year
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue