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