mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Removed tabs
This commit is contained in:
parent
bee7ee3815
commit
dabfd0ed85
67 changed files with 8204 additions and 8204 deletions
File diff suppressed because it is too large
Load diff
|
@ -2,24 +2,24 @@
|
|||
<INPUT type="hidden" name="sesskey" value="<?PHP print isset($USER->sesskey) ? $USER->sesskey : '' ?>">
|
||||
|
||||
<TABLE cellpadding="9" cellspacing="0">
|
||||
<TR valign="top">
|
||||
<TD align="right"><P>hotpot_showtimes:</TD>
|
||||
<TD><?PHP
|
||||
unset($choices);
|
||||
$choices["0"] = get_string("no");
|
||||
$choices["1"] = get_string("yes");
|
||||
choose_from_menu ($choices, "hotpot_showtimes", $CFG->hotpot_showtimes, "");
|
||||
?></TD>
|
||||
<TD><?PHP print_string("configshowtimes", "hotpot") ?></TD>
|
||||
</TR>
|
||||
<TR valign=top>
|
||||
<TD align="right"><P>hotpot_excelencodings:</TD>
|
||||
<TD><INPUT name=hotpot_excelencodings type=text size=30 value="<?PHP p($CFG->hotpot_excelencodings) ?>"></TD>
|
||||
<TD><?PHP print_string("configexcelencodings", "hotpot") ?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD colspan="3" align="center"><INPUT type="submit" value="<?PHP print_string("savechanges") ?>"></TD>
|
||||
</TR>
|
||||
<TR valign="top">
|
||||
<TD align="right"><P>hotpot_showtimes:</TD>
|
||||
<TD><?PHP
|
||||
unset($choices);
|
||||
$choices["0"] = get_string("no");
|
||||
$choices["1"] = get_string("yes");
|
||||
choose_from_menu ($choices, "hotpot_showtimes", $CFG->hotpot_showtimes, "");
|
||||
?></TD>
|
||||
<TD><?PHP print_string("configshowtimes", "hotpot") ?></TD>
|
||||
</TR>
|
||||
<TR valign=top>
|
||||
<TD align="right"><P>hotpot_excelencodings:</TD>
|
||||
<TD><INPUT name=hotpot_excelencodings type=text size=30 value="<?PHP p($CFG->hotpot_excelencodings) ?>"></TD>
|
||||
<TD><?PHP print_string("configexcelencodings", "hotpot") ?></TD>
|
||||
</TR>
|
||||
<TR>
|
||||
<TD colspan="3" align="center"><INPUT type="submit" value="<?PHP print_string("savechanges") ?>"></TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
|
||||
</FORM>
|
||||
|
|
|
@ -1,43 +1,43 @@
|
|||
<?PHP
|
||||
function hotpot_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
$ok = true;
|
||||
global $CFG;
|
||||
$ok = true;
|
||||
|
||||
if ($oldversion < 2004021400) {
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}hotpot_events` ADD `starttime` INT(10) unsigned NOT NULL DEFAULT '0' AFTER `time`");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}hotpot_events` ADD `endtime` INT(10) unsigned NOT NULL DEFAULT '0' AFTER `time`");
|
||||
}
|
||||
if ($oldversion < 2004021400) {
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}hotpot_events` ADD `starttime` INT(10) unsigned NOT NULL DEFAULT '0' AFTER `time`");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}hotpot_events` ADD `endtime` INT(10) unsigned NOT NULL DEFAULT '0' AFTER `time`");
|
||||
}
|
||||
|
||||
// set path to update functions
|
||||
$update_to_v2 = "$CFG->dirroot/mod/hotpot/db/update_to_v2.php";
|
||||
// set path to update functions
|
||||
$update_to_v2 = "$CFG->dirroot/mod/hotpot/db/update_to_v2.php";
|
||||
|
||||
// update from HotPot v1 to HotPot v2
|
||||
if ($oldversion < 2005031400) {
|
||||
require_once $update_to_v2;
|
||||
$ok = $ok && hotpot_update_to_v2_from_v1();
|
||||
}
|
||||
if ($oldversion < 2005090700) {
|
||||
require_once $update_to_v2;
|
||||
$ok = $ok && hotpot_update_to_v2_1();
|
||||
}
|
||||
if ($oldversion > 2005031419 && $oldversion < 2005090702) {
|
||||
// update to from HotPot v2.1.0 or v2.1.1
|
||||
require_once $update_to_v2;
|
||||
$ok = $ok && hotpot_update_to_v2_1_2();
|
||||
}
|
||||
if ($oldversion < 2006042103) {
|
||||
require_once $update_to_v2;
|
||||
$ok = $ok && hotpot_update_to_v2_1_16();
|
||||
}
|
||||
if ($oldversion < 2006042601) {
|
||||
require_once $update_to_v2;
|
||||
$ok = $ok && hotpot_update_to_v2_1_17();
|
||||
}
|
||||
if ($oldversion < 2006042803) {
|
||||
require_once $update_to_v2;
|
||||
$ok = $ok && hotpot_update_to_v2_1_18();
|
||||
}
|
||||
// update from HotPot v1 to HotPot v2
|
||||
if ($oldversion < 2005031400) {
|
||||
require_once $update_to_v2;
|
||||
$ok = $ok && hotpot_update_to_v2_from_v1();
|
||||
}
|
||||
if ($oldversion < 2005090700) {
|
||||
require_once $update_to_v2;
|
||||
$ok = $ok && hotpot_update_to_v2_1();
|
||||
}
|
||||
if ($oldversion > 2005031419 && $oldversion < 2005090702) {
|
||||
// update to from HotPot v2.1.0 or v2.1.1
|
||||
require_once $update_to_v2;
|
||||
$ok = $ok && hotpot_update_to_v2_1_2();
|
||||
}
|
||||
if ($oldversion < 2006042103) {
|
||||
require_once $update_to_v2;
|
||||
$ok = $ok && hotpot_update_to_v2_1_16();
|
||||
}
|
||||
if ($oldversion < 2006042601) {
|
||||
require_once $update_to_v2;
|
||||
$ok = $ok && hotpot_update_to_v2_1_17();
|
||||
}
|
||||
if ($oldversion < 2006042803) {
|
||||
require_once $update_to_v2;
|
||||
$ok = $ok && hotpot_update_to_v2_1_18();
|
||||
}
|
||||
|
||||
return $ok;
|
||||
return $ok;
|
||||
}
|
||||
?>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2,420 +2,420 @@
|
|||
|
||||
// This page lists all the instances of hotpot in a particular course
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("../../course/lib.php");
|
||||
require_once("lib.php");
|
||||
require_once("../../config.php");
|
||||
require_once("../../course/lib.php");
|
||||
require_once("lib.php");
|
||||
|
||||
$id = required_param("id"); // course
|
||||
$id = required_param("id"); // course
|
||||
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("Course ID is incorrect");
|
||||
}
|
||||
if (! $course = get_record("course", "id", $id)) {
|
||||
error("Course ID is incorrect");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
require_login($course->id);
|
||||
|
||||
add_to_log($course->id, "hotpot", "view all", "index.php?id=$course->id", "");
|
||||
add_to_log($course->id, "hotpot", "view all", "index.php?id=$course->id", "");
|
||||
|
||||
// Moodle 1.4+ requires sesskey to be passed in forms
|
||||
if (isset($USER->sesskey)) {
|
||||
$sesskey = '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
} else {
|
||||
$sesskey = '';
|
||||
}
|
||||
// Moodle 1.4+ requires sesskey to be passed in forms
|
||||
if (isset($USER->sesskey)) {
|
||||
$sesskey = '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
|
||||
} else {
|
||||
$sesskey = '';
|
||||
}
|
||||
|
||||
// get message strings for titles
|
||||
$strmodulenameplural = get_string("modulenameplural", "hotpot");
|
||||
$strmodulename = get_string("modulename", "hotpot");
|
||||
// get message strings for titles
|
||||
$strmodulenameplural = get_string("modulenameplural", "hotpot");
|
||||
$strmodulename = get_string("modulename", "hotpot");
|
||||
|
||||
// string translation array for single and double quotes
|
||||
$quotes = array("'"=>"\'", '"'=>'"');
|
||||
// string translation array for single and double quotes
|
||||
$quotes = array("'"=>"\'", '"'=>'"');
|
||||
|
||||
// Print the header
|
||||
// Print the header
|
||||
|
||||
$title = "$course->shortname: $strmodulenameplural";
|
||||
$heading = "$course->fullname";
|
||||
$navigation = "$strmodulenameplural";
|
||||
if ($course->category) {
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
|
||||
}
|
||||
print_header($title, $heading, $navigation, "", "", true, "", navmenu($course));
|
||||
$title = "$course->shortname: $strmodulenameplural";
|
||||
$heading = "$course->fullname";
|
||||
$navigation = "$strmodulenameplural";
|
||||
if ($course->category) {
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
|
||||
}
|
||||
print_header($title, $heading, $navigation, "", "", true, "", navmenu($course));
|
||||
|
||||
$next_url = "$CFG->wwwroot/course/view.php?id=$course->id";
|
||||
$next_url = "$CFG->wwwroot/course/view.php?id=$course->id";
|
||||
|
||||
// get display section, if any
|
||||
$section = optional_param('section', 0);
|
||||
if ($section) {
|
||||
$displaysection = course_set_display($course->id, $section);
|
||||
} else {
|
||||
if (isset($USER->display[$course->id])) {
|
||||
$displaysection = $USER->display[$course->id];
|
||||
} else {
|
||||
$displaysection = 0;
|
||||
}
|
||||
}
|
||||
// get display section, if any
|
||||
$section = optional_param('section', 0);
|
||||
if ($section) {
|
||||
$displaysection = course_set_display($course->id, $section);
|
||||
} else {
|
||||
if (isset($USER->display[$course->id])) {
|
||||
$displaysection = $USER->display[$course->id];
|
||||
} else {
|
||||
$displaysection = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Get all instances of this module
|
||||
if (!$hotpots = hotpot_get_all_instances_in_course("hotpot", $course)) {
|
||||
$hotpots = array();
|
||||
}
|
||||
// Get all instances of this module
|
||||
if (!$hotpots = hotpot_get_all_instances_in_course("hotpot", $course)) {
|
||||
$hotpots = array();
|
||||
}
|
||||
|
||||
// if necessary, remove hotpots that are not in section0 or this $USER's display section
|
||||
if ($displaysection) {
|
||||
foreach ($hotpots as $coursemodule=>$hotpot) {
|
||||
if ($hotpot->section!=0 && $hotpot->section!=$displaysection) {
|
||||
unset($hotpots[$coursemodule]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if necessary, remove hotpots that are not in section0 or this $USER's display section
|
||||
if ($displaysection) {
|
||||
foreach ($hotpots as $coursemodule=>$hotpot) {
|
||||
if ($hotpot->section!=0 && $hotpot->section!=$displaysection) {
|
||||
unset($hotpots[$coursemodule]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($hotpots)) {
|
||||
notice("There are no $strmodulenameplural", $next_url);
|
||||
exit;
|
||||
}
|
||||
if (empty($hotpots)) {
|
||||
notice("There are no $strmodulenameplural", $next_url);
|
||||
exit;
|
||||
}
|
||||
|
||||
// get list of hotpot ids
|
||||
$hotpotids = array();
|
||||
foreach ($hotpots as $cmid=>$hotpot) {
|
||||
$hotpotids[] = $hotpot->id;
|
||||
}
|
||||
$hotpotids = implode(',', $hotpotids);
|
||||
// get list of hotpot ids
|
||||
$hotpotids = array();
|
||||
foreach ($hotpots as $cmid=>$hotpot) {
|
||||
$hotpotids[] = $hotpot->id;
|
||||
}
|
||||
$hotpotids = implode(',', $hotpotids);
|
||||
|
||||
if (isadmin()) {
|
||||
if (isadmin()) {
|
||||
|
||||
// get regrade settings, if any
|
||||
$regrade = optional_param("regrade");
|
||||
$confirm = optional_param("confirm");
|
||||
// get regrade settings, if any
|
||||
$regrade = optional_param("regrade");
|
||||
$confirm = optional_param("confirm");
|
||||
|
||||
// check regrade is valid
|
||||
unset($regrade_cmid);
|
||||
if (isset($regrade)) {
|
||||
foreach ($hotpots as $cmid=>$hotpot) {
|
||||
$found = false;
|
||||
if ($hotpot->id==$regrade) {
|
||||
$regrade_cmid = $cmid;
|
||||
}
|
||||
}
|
||||
}
|
||||
// check regrade is valid
|
||||
unset($regrade_cmid);
|
||||
if (isset($regrade)) {
|
||||
foreach ($hotpots as $cmid=>$hotpot) {
|
||||
$found = false;
|
||||
if ($hotpot->id==$regrade) {
|
||||
$regrade_cmid = $cmid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// regrade, if necessary
|
||||
if (isset($regrade_cmid)) {
|
||||
// regrade, if necessary
|
||||
if (isset($regrade_cmid)) {
|
||||
|
||||
if (empty($confirm)) {
|
||||
if (empty($confirm)) {
|
||||
|
||||
$strregradecheck = get_string('regradecheck', 'hotpot', $hotpots[$regrade_cmid]->name);
|
||||
$strregradecheck = get_string('regradecheck', 'hotpot', $hotpots[$regrade_cmid]->name);
|
||||
|
||||
print_simple_box_start("center", "60%", "#FFAAAA", 20, "noticebox");
|
||||
print_heading($strregradecheck);
|
||||
print ''
|
||||
. '<table border="0"><tr><td>'
|
||||
. '<form target="_parent" method="post" action="'.$ME.'">'
|
||||
. '<input type="hidden" name="id" value="'.$course->id.'">'
|
||||
. '<input type="hidden" name="regrade" value="'.$regrade.'" />'
|
||||
. '<input type="hidden" name="confirm" value="1" />'
|
||||
. $sesskey
|
||||
. '<input type="submit" value="'.get_string("yes").'" />'
|
||||
. '</form>'
|
||||
. '</td><td> </td><td>'
|
||||
. '<form target="_parent" method="post" action="'.$ME.'">'
|
||||
. '<input type="hidden" name="id" value="'.$course->id.'">'
|
||||
. $sesskey
|
||||
. '<input type="submit" value="'.get_string("no").'" />'
|
||||
. '</form>'
|
||||
. '</td></tr></table>'
|
||||
;
|
||||
print_simple_box_end();
|
||||
print_footer($course);
|
||||
exit;
|
||||
print_simple_box_start("center", "60%", "#FFAAAA", 20, "noticebox");
|
||||
print_heading($strregradecheck);
|
||||
print ''
|
||||
. '<table border="0"><tr><td>'
|
||||
. '<form target="_parent" method="post" action="'.$ME.'">'
|
||||
. '<input type="hidden" name="id" value="'.$course->id.'">'
|
||||
. '<input type="hidden" name="regrade" value="'.$regrade.'" />'
|
||||
. '<input type="hidden" name="confirm" value="1" />'
|
||||
. $sesskey
|
||||
. '<input type="submit" value="'.get_string("yes").'" />'
|
||||
. '</form>'
|
||||
. '</td><td> </td><td>'
|
||||
. '<form target="_parent" method="post" action="'.$ME.'">'
|
||||
. '<input type="hidden" name="id" value="'.$course->id.'">'
|
||||
. $sesskey
|
||||
. '<input type="submit" value="'.get_string("no").'" />'
|
||||
. '</form>'
|
||||
. '</td></tr></table>'
|
||||
;
|
||||
print_simple_box_end();
|
||||
print_footer($course);
|
||||
exit;
|
||||
|
||||
} else { // regrade has been confirmed, so proceed
|
||||
} else { // regrade has been confirmed, so proceed
|
||||
|
||||
if ($regrade=='all') {
|
||||
$select = "hotpot IN ($hotpotids)";
|
||||
} else {
|
||||
$select = "hotpot=$regrade";
|
||||
}
|
||||
if ($regrade=='all') {
|
||||
$select = "hotpot IN ($hotpotids)";
|
||||
} else {
|
||||
$select = "hotpot=$regrade";
|
||||
}
|
||||
|
||||
$questionids = array();
|
||||
if ($questions = get_records_select("hotpot_questions", $select)) {
|
||||
$questionids = array_keys($questions);
|
||||
}
|
||||
$questionids = implode(',', $questionids);
|
||||
$questionids = array();
|
||||
if ($questions = get_records_select("hotpot_questions", $select)) {
|
||||
$questionids = array_keys($questions);
|
||||
}
|
||||
$questionids = implode(',', $questionids);
|
||||
|
||||
if ($questionids) {
|
||||
hotpot_delete_and_notify('hotpot_questions', "id IN ($questionids)", get_string('question', 'quiz'));
|
||||
hotpot_delete_and_notify('hotpot_responses', "question IN ($questionids)", get_string('answer', 'quiz'));
|
||||
}
|
||||
if ($questionids) {
|
||||
hotpot_delete_and_notify('hotpot_questions', "id IN ($questionids)", get_string('question', 'quiz'));
|
||||
hotpot_delete_and_notify('hotpot_responses', "question IN ($questionids)", get_string('answer', 'quiz'));
|
||||
}
|
||||
|
||||
if ($attempts = get_records_select('hotpot_attempts', $select)) {
|
||||
if ($attempts = get_records_select('hotpot_attempts', $select)) {
|
||||
|
||||
// start counter and timer
|
||||
$start = microtime();
|
||||
$count = 0;
|
||||
// start counter and timer
|
||||
$start = microtime();
|
||||
$count = 0;
|
||||
|
||||
// use while loop instead of foreach loop
|
||||
// to allow the possibility of splitting a regrade
|
||||
// and so avoid "maximum script time exceeded" errors
|
||||
$attemptids = array_keys($attempts);
|
||||
$i_max = count($attemptids);
|
||||
$i = 0;
|
||||
while ($i<$i_max) {
|
||||
// use while loop instead of foreach loop
|
||||
// to allow the possibility of splitting a regrade
|
||||
// and so avoid "maximum script time exceeded" errors
|
||||
$attemptids = array_keys($attempts);
|
||||
$i_max = count($attemptids);
|
||||
$i = 0;
|
||||
while ($i<$i_max) {
|
||||
|
||||
$attemptid = $attemptids[$i];
|
||||
$attempt =&$attempts[$attemptid];
|
||||
$attemptid = $attemptids[$i];
|
||||
$attempt =&$attempts[$attemptid];
|
||||
|
||||
$attempt->details = get_field('hotpot_details', 'details', 'attempt', $attemptid);
|
||||
if ($attempt->details) {
|
||||
$attempt->details = get_field('hotpot_details', 'details', 'attempt', $attemptid);
|
||||
if ($attempt->details) {
|
||||
|
||||
hotpot_add_attempt_details($attempt);
|
||||
if (! update_record('hotpot_attempts', $attempt)) {
|
||||
error("Could not update attempt record: ".$db->ErrorMsg(), $next_url);
|
||||
}
|
||||
}
|
||||
$count++;
|
||||
$i++;
|
||||
}
|
||||
if ($count) {
|
||||
notify(get_string('added', 'moodle', "$count x ".get_string('attempts', 'quiz')));
|
||||
}
|
||||
$msg = get_string('regradecomplete', 'quiz');
|
||||
if (!empty($CFG->hotpot_showtimes)) {
|
||||
$duration = format_time(sprintf("%0.2f", microtime_diff($start, microtime())));
|
||||
$msg .= " ($duration)";
|
||||
}
|
||||
notify($msg);
|
||||
}
|
||||
}
|
||||
} // end regrade
|
||||
hotpot_add_attempt_details($attempt);
|
||||
if (! update_record('hotpot_attempts', $attempt)) {
|
||||
error("Could not update attempt record: ".$db->ErrorMsg(), $next_url);
|
||||
}
|
||||
}
|
||||
$count++;
|
||||
$i++;
|
||||
}
|
||||
if ($count) {
|
||||
notify(get_string('added', 'moodle', "$count x ".get_string('attempts', 'quiz')));
|
||||
}
|
||||
$msg = get_string('regradecomplete', 'quiz');
|
||||
if (!empty($CFG->hotpot_showtimes)) {
|
||||
$duration = format_time(sprintf("%0.2f", microtime_diff($start, microtime())));
|
||||
$msg .= " ($duration)";
|
||||
}
|
||||
notify($msg);
|
||||
}
|
||||
}
|
||||
} // end regrade
|
||||
|
||||
//print '<center><form action="'.$ME.'" method="post">';
|
||||
//print '<input type="hidden" name="id" value="'.$course->id.'">';
|
||||
//print '<input type="submit" name="regrade" value="'.get_string('regrade', 'quiz').'">';
|
||||
//print '</form></center>'."\n";
|
||||
//print '<center><form action="'.$ME.'" method="post">';
|
||||
//print '<input type="hidden" name="id" value="'.$course->id.'">';
|
||||
//print '<input type="submit" name="regrade" value="'.get_string('regrade', 'quiz').'">';
|
||||
//print '</form></center>'."\n";
|
||||
|
||||
|
||||
// get duplicate hotpot-name questions
|
||||
// - JMatch LHS is longer than 255 bytes
|
||||
// - JQuiz question text is longer than 255 bytes
|
||||
// - other unidentified situations ?!?
|
||||
// get duplicate hotpot-name questions
|
||||
// - JMatch LHS is longer than 255 bytes
|
||||
// - JQuiz question text is longer than 255 bytes
|
||||
// - other unidentified situations ?!?
|
||||
|
||||
$field = '';
|
||||
$questions = false;
|
||||
$regradehotpots = array();
|
||||
$field = '';
|
||||
$questions = false;
|
||||
$regradehotpots = array();
|
||||
|
||||
switch (strtolower($CFG->dbtype)) {
|
||||
case 'mysql' :
|
||||
$field = "CONCAT(hotpot, '_', name)";
|
||||
break;
|
||||
case 'postgres7' :
|
||||
$field = "hotpot||'_'||name";
|
||||
break;
|
||||
}
|
||||
if ($field) {
|
||||
$questions = get_records_sql("
|
||||
SELECT $field, COUNT(*), hotpot, name
|
||||
FROM {$CFG->prefix}hotpot_questions
|
||||
WHERE hotpot IN ($hotpotids)
|
||||
GROUP BY hotpot, name
|
||||
HAVING COUNT(*) >1
|
||||
");
|
||||
}
|
||||
if ($questions) {
|
||||
foreach ($questions as $question) {
|
||||
$regradehotpots[] = $question->hotpot;
|
||||
}
|
||||
$regradehotpots = array_unique($regradehotpots);
|
||||
sort($regradehotpots);
|
||||
}
|
||||
}
|
||||
switch (strtolower($CFG->dbtype)) {
|
||||
case 'mysql' :
|
||||
$field = "CONCAT(hotpot, '_', name)";
|
||||
break;
|
||||
case 'postgres7' :
|
||||
$field = "hotpot||'_'||name";
|
||||
break;
|
||||
}
|
||||
if ($field) {
|
||||
$questions = get_records_sql("
|
||||
SELECT $field, COUNT(*), hotpot, name
|
||||
FROM {$CFG->prefix}hotpot_questions
|
||||
WHERE hotpot IN ($hotpotids)
|
||||
GROUP BY hotpot, name
|
||||
HAVING COUNT(*) >1
|
||||
");
|
||||
}
|
||||
if ($questions) {
|
||||
foreach ($questions as $question) {
|
||||
$regradehotpots[] = $question->hotpot;
|
||||
}
|
||||
$regradehotpots = array_unique($regradehotpots);
|
||||
sort($regradehotpots);
|
||||
}
|
||||
}
|
||||
|
||||
// start timer
|
||||
$start = microtime();
|
||||
// start timer
|
||||
$start = microtime();
|
||||
|
||||
// get total number of attempts, users and details for these hotpots
|
||||
$tables = "{$CFG->prefix}hotpot_attempts AS a";
|
||||
$fields = "
|
||||
a.hotpot AS hotpot,
|
||||
COUNT(DISTINCT a.clickreportid) AS attemptcount,
|
||||
COUNT(DISTINCT a.userid) AS usercount,
|
||||
MAX(a.score) AS maxscore
|
||||
";
|
||||
$select = "a.hotpot IN ($hotpotids)";
|
||||
if (isteacher($course->id)) {
|
||||
// do nothing (=get all users)
|
||||
} else {
|
||||
// restrict results to this user only
|
||||
$select .= " AND a.userid='$USER->id'";
|
||||
}
|
||||
$usejoin = 1;
|
||||
if (isadmin() && $usejoin) {
|
||||
// join attempts table and details table
|
||||
$tables .= ",{$CFG->prefix}hotpot_details AS d";
|
||||
$fields .= ',COUNT(DISTINCT d.id) AS detailcount';
|
||||
$select .= " AND a.id=d.attempt";
|
||||
// get total number of attempts, users and details for these hotpots
|
||||
$tables = "{$CFG->prefix}hotpot_attempts AS a";
|
||||
$fields = "
|
||||
a.hotpot AS hotpot,
|
||||
COUNT(DISTINCT a.clickreportid) AS attemptcount,
|
||||
COUNT(DISTINCT a.userid) AS usercount,
|
||||
MAX(a.score) AS maxscore
|
||||
";
|
||||
$select = "a.hotpot IN ($hotpotids)";
|
||||
if (isteacher($course->id)) {
|
||||
// do nothing (=get all users)
|
||||
} else {
|
||||
// restrict results to this user only
|
||||
$select .= " AND a.userid='$USER->id'";
|
||||
}
|
||||
$usejoin = 1;
|
||||
if (isadmin() && $usejoin) {
|
||||
// join attempts table and details table
|
||||
$tables .= ",{$CFG->prefix}hotpot_details AS d";
|
||||
$fields .= ',COUNT(DISTINCT d.id) AS detailcount';
|
||||
$select .= " AND a.id=d.attempt";
|
||||
|
||||
// this may take about twice as long as getting the gradecounts separately :-(
|
||||
// so this operation could be done after getting the $totals from the attempts table
|
||||
}
|
||||
$totals = get_records_sql("SELECT $fields FROM $tables WHERE $select GROUP BY a.hotpot");
|
||||
// this may take about twice as long as getting the gradecounts separately :-(
|
||||
// so this operation could be done after getting the $totals from the attempts table
|
||||
}
|
||||
$totals = get_records_sql("SELECT $fields FROM $tables WHERE $select GROUP BY a.hotpot");
|
||||
|
||||
if (isadmin() && empty($usejoin)) {
|
||||
foreach ($hotpots as $hotpot) {
|
||||
$totals[$hotpot->id]->detailcount = 0;
|
||||
if ($ids = get_records('hotpot_attempts', 'hotpot', $hotpot->id)) {
|
||||
$ids = join(',', array_keys($ids));
|
||||
$totals[$hotpot->id]->detailcount = count_records_select('hotpot_details', "attempt IN ($ids)");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isadmin() && empty($usejoin)) {
|
||||
foreach ($hotpots as $hotpot) {
|
||||
$totals[$hotpot->id]->detailcount = 0;
|
||||
if ($ids = get_records('hotpot_attempts', 'hotpot', $hotpot->id)) {
|
||||
$ids = join(',', array_keys($ids));
|
||||
$totals[$hotpot->id]->detailcount = count_records_select('hotpot_details', "attempt IN ($ids)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// message strings for main table
|
||||
$strusers = get_string('users');
|
||||
$strupdate = get_string('update');
|
||||
$strregrade = get_string('regrade', 'hotpot');
|
||||
$strneverclosed = get_string('neverclosed', 'hotpot');
|
||||
$strregraderequired = get_string('regraderequired', 'hotpot');
|
||||
// message strings for main table
|
||||
$strusers = get_string('users');
|
||||
$strupdate = get_string('update');
|
||||
$strregrade = get_string('regrade', 'hotpot');
|
||||
$strneverclosed = get_string('neverclosed', 'hotpot');
|
||||
$strregraderequired = get_string('regraderequired', 'hotpot');
|
||||
|
||||
// column headings and attributes
|
||||
$table->head = array();
|
||||
$table->align = array();
|
||||
// column headings and attributes
|
||||
$table->head = array();
|
||||
$table->align = array();
|
||||
|
||||
if (!empty($CFG->hotpot_showtimes)) {
|
||||
print '<H3>'.sprintf("%0.3f", microtime_diff($start, microtime())).' secs'."</H3>\n";
|
||||
}
|
||||
if (!empty($CFG->hotpot_showtimes)) {
|
||||
print '<H3>'.sprintf("%0.3f", microtime_diff($start, microtime())).' secs'."</H3>\n";
|
||||
}
|
||||
|
||||
switch ($course->format) {
|
||||
case 'weeks' :
|
||||
$title = get_string("week");
|
||||
break;
|
||||
case 'topics' :
|
||||
$title = get_string("topic");
|
||||
break;
|
||||
default :
|
||||
$title = '';
|
||||
break;
|
||||
}
|
||||
if ($title) {
|
||||
array_push($table->head, $title);
|
||||
array_push($table->align, "center");
|
||||
}
|
||||
if (isteacheredit($course->id)) {
|
||||
array_push($table->head, $strupdate);
|
||||
array_push($table->align, "center");
|
||||
}
|
||||
array_push($table->head,
|
||||
get_string("name"),
|
||||
get_string("quizcloses", "quiz"),
|
||||
get_string("bestgrade", "quiz"),
|
||||
get_string("attempts", "quiz")
|
||||
);
|
||||
array_push($table->align,
|
||||
"left", "left", "center", "left"
|
||||
);
|
||||
if (isadmin()) {
|
||||
array_push($table->head, $strregrade);
|
||||
array_push($table->align, "center");
|
||||
}
|
||||
switch ($course->format) {
|
||||
case 'weeks' :
|
||||
$title = get_string("week");
|
||||
break;
|
||||
case 'topics' :
|
||||
$title = get_string("topic");
|
||||
break;
|
||||
default :
|
||||
$title = '';
|
||||
break;
|
||||
}
|
||||
if ($title) {
|
||||
array_push($table->head, $title);
|
||||
array_push($table->align, "center");
|
||||
}
|
||||
if (isteacheredit($course->id)) {
|
||||
array_push($table->head, $strupdate);
|
||||
array_push($table->align, "center");
|
||||
}
|
||||
array_push($table->head,
|
||||
get_string("name"),
|
||||
get_string("quizcloses", "quiz"),
|
||||
get_string("bestgrade", "quiz"),
|
||||
get_string("attempts", "quiz")
|
||||
);
|
||||
array_push($table->align,
|
||||
"left", "left", "center", "left"
|
||||
);
|
||||
if (isadmin()) {
|
||||
array_push($table->head, $strregrade);
|
||||
array_push($table->align, "center");
|
||||
}
|
||||
|
||||
$currentsection = -1;
|
||||
foreach ($hotpots as $hotpot) {
|
||||
$currentsection = -1;
|
||||
foreach ($hotpots as $hotpot) {
|
||||
|
||||
$printsection = "";
|
||||
if ($hotpot->section != $currentsection) {
|
||||
if ($hotpot->section) {
|
||||
$printsection = $hotpot->section;
|
||||
if ($course->format=='weeks' || $course->format=='topics') {
|
||||
// Show the zoom boxes
|
||||
if ($displaysection==$hotpot->section) {
|
||||
$strshowall = get_string('showall'.$course->format);
|
||||
$printsection .= '<br /><a href="index.php?id='.$course->id.'§ion=all" title="'.$strshowall.'"><img src="'.$CFG->pixpath.'/i/all.gif" height=25 width=16 border=0></a><br />';
|
||||
} else {
|
||||
$strshowone = get_string('showonly'.preg_replace('|s$|', '', $course->format, 1), '', $hotpot->section);
|
||||
$printsection .= '<br /><a href="index.php?id='.$course->id.'§ion='.$hotpot->section.'" title="'.$strshowone.'"><img src="'.$CFG->pixpath.'/i/one.gif" height=16 width=16 border=0></a><br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($currentsection>=0) {
|
||||
$table->data[] = 'hr';
|
||||
}
|
||||
$currentsection = $hotpot->section;
|
||||
}
|
||||
$printsection = "";
|
||||
if ($hotpot->section != $currentsection) {
|
||||
if ($hotpot->section) {
|
||||
$printsection = $hotpot->section;
|
||||
if ($course->format=='weeks' || $course->format=='topics') {
|
||||
// Show the zoom boxes
|
||||
if ($displaysection==$hotpot->section) {
|
||||
$strshowall = get_string('showall'.$course->format);
|
||||
$printsection .= '<br /><a href="index.php?id='.$course->id.'§ion=all" title="'.$strshowall.'"><img src="'.$CFG->pixpath.'/i/all.gif" height=25 width=16 border=0></a><br />';
|
||||
} else {
|
||||
$strshowone = get_string('showonly'.preg_replace('|s$|', '', $course->format, 1), '', $hotpot->section);
|
||||
$printsection .= '<br /><a href="index.php?id='.$course->id.'§ion='.$hotpot->section.'" title="'.$strshowone.'"><img src="'.$CFG->pixpath.'/i/one.gif" height=16 width=16 border=0></a><br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($currentsection>=0) {
|
||||
$table->data[] = 'hr';
|
||||
}
|
||||
$currentsection = $hotpot->section;
|
||||
}
|
||||
|
||||
$class = ($hotpot->visible) ? '' : 'class="dimmed" ';
|
||||
$quizname = '<a '.$class.'href="view.php?id='.$hotpot->coursemodule.'">'.$hotpot->name.'</A>';
|
||||
$quizclose = empty($hotpot->timeclose) ? $strneverclosed : userdate($hotpot->timeclose);
|
||||
$class = ($hotpot->visible) ? '' : 'class="dimmed" ';
|
||||
$quizname = '<a '.$class.'href="view.php?id='.$hotpot->coursemodule.'">'.$hotpot->name.'</A>';
|
||||
$quizclose = empty($hotpot->timeclose) ? $strneverclosed : userdate($hotpot->timeclose);
|
||||
|
||||
// are there any totals for this hotpot?
|
||||
if (empty($totals[$hotpot->id]->attemptcount)) {
|
||||
$report = " ";
|
||||
$bestscore = " ";
|
||||
// are there any totals for this hotpot?
|
||||
if (empty($totals[$hotpot->id]->attemptcount)) {
|
||||
$report = " ";
|
||||
$bestscore = " ";
|
||||
|
||||
} else {
|
||||
// report number of attempts and users
|
||||
$report = get_string("viewallreports","quiz", $totals[$hotpot->id]->attemptcount);
|
||||
if (isteacher($course->id)) {
|
||||
$report .= " (".$totals[$hotpot->id]->usercount." $strusers)";
|
||||
}
|
||||
$report = '<a href="report.php?hp='.$hotpot->id.'">'.$report.'</a>';
|
||||
} else {
|
||||
// report number of attempts and users
|
||||
$report = get_string("viewallreports","quiz", $totals[$hotpot->id]->attemptcount);
|
||||
if (isteacher($course->id)) {
|
||||
$report .= " (".$totals[$hotpot->id]->usercount." $strusers)";
|
||||
}
|
||||
$report = '<a href="report.php?hp='.$hotpot->id.'">'.$report.'</a>';
|
||||
|
||||
// get best score
|
||||
if (is_numeric($totals[$hotpot->id]->maxscore)) {
|
||||
$bestscore = $totals[$hotpot->id]->maxscore." / $hotpot->grade";
|
||||
} else {
|
||||
$bestscore = " ";
|
||||
}
|
||||
}
|
||||
// get best score
|
||||
if (is_numeric($totals[$hotpot->id]->maxscore)) {
|
||||
$bestscore = $totals[$hotpot->id]->maxscore." / $hotpot->grade";
|
||||
} else {
|
||||
$bestscore = " ";
|
||||
}
|
||||
}
|
||||
|
||||
if (isadmin()) {
|
||||
if (in_array($hotpot->id, $regradehotpots)) {
|
||||
$report .= ' <font color="red">'.$strregraderequired.'</font>';
|
||||
}
|
||||
}
|
||||
if (isadmin()) {
|
||||
if (in_array($hotpot->id, $regradehotpots)) {
|
||||
$report .= ' <font color="red">'.$strregraderequired.'</font>';
|
||||
}
|
||||
}
|
||||
|
||||
$data = array ();
|
||||
$data = array ();
|
||||
|
||||
if ($course->format=="weeks" || $course->format=="topics") {
|
||||
array_push($data, $printsection);
|
||||
}
|
||||
if ($course->format=="weeks" || $course->format=="topics") {
|
||||
array_push($data, $printsection);
|
||||
}
|
||||
|
||||
if (isteacheredit($course->id)) {
|
||||
$updatebutton = ''
|
||||
. '<form target="'.$CFG->framename.'" method="get" action="'.$CFG->wwwroot.'/course/mod.php">'
|
||||
. '<input type="hidden" name="update" value="'.$hotpot->coursemodule.'" />'
|
||||
. $sesskey
|
||||
. '<input type="submit" value="'.$strupdate.'" />'
|
||||
. '</form>'
|
||||
;
|
||||
array_push($data, $updatebutton);
|
||||
}
|
||||
if (isteacheredit($course->id)) {
|
||||
$updatebutton = ''
|
||||
. '<form target="'.$CFG->framename.'" method="get" action="'.$CFG->wwwroot.'/course/mod.php">'
|
||||
. '<input type="hidden" name="update" value="'.$hotpot->coursemodule.'" />'
|
||||
. $sesskey
|
||||
. '<input type="submit" value="'.$strupdate.'" />'
|
||||
. '</form>'
|
||||
;
|
||||
array_push($data, $updatebutton);
|
||||
}
|
||||
|
||||
array_push($data, $quizname, $quizclose, $bestscore, $report);
|
||||
array_push($data, $quizname, $quizclose, $bestscore, $report);
|
||||
|
||||
if (isadmin()) {
|
||||
if (empty($totals[$hotpot->id]->detailcount)) {
|
||||
// no details records for this hotpot, so disable regrade
|
||||
$regradebutton = ' ';
|
||||
} else {
|
||||
$strregradecheck = get_string('regradecheck', 'hotpot', strtr($hotpot->name, $quotes));
|
||||
$regradebutton = ''
|
||||
. '<form target="_parent" method="post" action="'.$ME.'" onsubmit="var x=window.confirm('."'$strregradecheck'".');this.confirm.value=x;return x;">'
|
||||
. '<input type="hidden" name="id" value="'.$course->id.'">'
|
||||
. '<input type="hidden" name="regrade" value="'.$hotpot->id.'" />'
|
||||
. '<input type="hidden" name="confirm" value="" />'
|
||||
. $sesskey
|
||||
. '<input type="submit" value="'.$strregrade.'" />'
|
||||
. '</form>'
|
||||
;
|
||||
}
|
||||
array_push($data, $regradebutton);
|
||||
}
|
||||
if (isadmin()) {
|
||||
if (empty($totals[$hotpot->id]->detailcount)) {
|
||||
// no details records for this hotpot, so disable regrade
|
||||
$regradebutton = ' ';
|
||||
} else {
|
||||
$strregradecheck = get_string('regradecheck', 'hotpot', strtr($hotpot->name, $quotes));
|
||||
$regradebutton = ''
|
||||
. '<form target="_parent" method="post" action="'.$ME.'" onsubmit="var x=window.confirm('."'$strregradecheck'".');this.confirm.value=x;return x;">'
|
||||
. '<input type="hidden" name="id" value="'.$course->id.'">'
|
||||
. '<input type="hidden" name="regrade" value="'.$hotpot->id.'" />'
|
||||
. '<input type="hidden" name="confirm" value="" />'
|
||||
. $sesskey
|
||||
. '<input type="submit" value="'.$strregrade.'" />'
|
||||
. '</form>'
|
||||
;
|
||||
}
|
||||
array_push($data, $regradebutton);
|
||||
}
|
||||
|
||||
$table->data[] = $data;
|
||||
}
|
||||
$table->data[] = $data;
|
||||
}
|
||||
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
|
||||
print_table($table);
|
||||
print_table($table);
|
||||
|
||||
// Finish the page
|
||||
print_footer($course);
|
||||
// Finish the page
|
||||
print_footer($course);
|
||||
?>
|
||||
|
|
3452
mod/hotpot/lib.php
3452
mod/hotpot/lib.php
File diff suppressed because it is too large
Load diff
|
@ -11,309 +11,309 @@ set_form_fields($form);
|
|||
|
||||
// commonly used array of <select> options
|
||||
$yes_no_options = array(
|
||||
HOTPOT_NO => get_string("no"),
|
||||
HOTPOT_YES => get_string("yes")
|
||||
HOTPOT_NO => get_string("no"),
|
||||
HOTPOT_YES => get_string("yes")
|
||||
);
|
||||
$text_source_options = array(
|
||||
HOTPOT_TEXTSOURCE_QUIZ => get_string("textsourcequiz", "hotpot"),
|
||||
HOTPOT_TEXTSOURCE_FILENAME => get_string("textsourcefilename", "hotpot"),
|
||||
HOTPOT_TEXTSOURCE_FILEPATH => get_string("textsourcefilepath", "hotpot"),
|
||||
HOTPOT_TEXTSOURCE_SPECIFIC => get_string("textsourcespecific", "hotpot")
|
||||
HOTPOT_TEXTSOURCE_QUIZ => get_string("textsourcequiz", "hotpot"),
|
||||
HOTPOT_TEXTSOURCE_FILENAME => get_string("textsourcefilename", "hotpot"),
|
||||
HOTPOT_TEXTSOURCE_FILEPATH => get_string("textsourcefilepath", "hotpot"),
|
||||
HOTPOT_TEXTSOURCE_SPECIFIC => get_string("textsourcespecific", "hotpot")
|
||||
);
|
||||
?>
|
||||
<center>
|
||||
<form name="form" method="post" action="mod.php">
|
||||
<table cellpadding="5">
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("name") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
if ($form->mode=='add') {
|
||||
choose_from_menu($text_source_options, "namesource", "$form->namesource", "");
|
||||
} else {
|
||||
print '<input type="hidden" name="namesource" value="'.HOTPOT_TEXTSOURCE_SPECIFIC.'">';
|
||||
}
|
||||
print '<span id="nameSPAN">';
|
||||
print '<input type="text" name="name" size=40 value="'.$form->name.'">';
|
||||
print '</span>';
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
<b><?PHP
|
||||
print_string("summary")
|
||||
?>:</b><br />
|
||||
<FONT size="1"><?PHP
|
||||
helpbutton("summary", get_string("summary"), "resource", true, true);
|
||||
print '<br />';
|
||||
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
|
||||
print '<br />';
|
||||
if (isset($usehtmleditor) && $usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
print '<br />';
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle", true, true);
|
||||
print '<br />';
|
||||
emoticonhelpbutton("form", "description");
|
||||
print '<br />';
|
||||
}
|
||||
?></FONT>
|
||||
</td>
|
||||
<td align="left"><?PHP
|
||||
if ($form->mode=='add') {
|
||||
choose_from_menu($text_source_options, "summarysource", "$form->summarysource", "");
|
||||
} else {
|
||||
print '<input type="hidden" name="summarysource" value="'.HOTPOT_TEXTSOURCE_SPECIFIC.'">';
|
||||
}
|
||||
print '<span id="summarySPAN">';
|
||||
if (function_exists("print_textarea") && isset($usehtmleditor)) {
|
||||
print_textarea($usehtmleditor, 10, 65, 680, 400, "summary", $form->summary);
|
||||
} else {
|
||||
// Moodle 1.1.1 (original size was rows="5" cols="50")
|
||||
print '<textarea name="summary" rows="10" cols="65" wrap="virtual">'.$form->summary.'</textarea>';
|
||||
}
|
||||
print '</span>';
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("quizopen", "quiz") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
$options = array(
|
||||
HOTPOT_NO => get_string("alwaysopen", "hotpot"),
|
||||
HOTPOT_YES => get_string("specifictime", "hotpot")
|
||||
);
|
||||
choose_from_menu($options, "enabletimeopen", "$form->enabletimeopen", "");
|
||||
print '<span id="timeopenSPAN">';
|
||||
print ' ';
|
||||
if (!$form->timeopen && $course->format == "weeks") {
|
||||
$form->timeopen= $course->startdate + (($form->section - 1) * 608400);
|
||||
}
|
||||
print_date_selector("openday", "openmonth", "openyear", $form->timeopen);
|
||||
print ' - ';
|
||||
print_time_selector("openhour", "openminute", $form->timeopen);
|
||||
helpbutton("timeopen", get_string("quizopen","quiz"), "quiz");
|
||||
print '</span>';
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("quizclose", "quiz") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
$options = array(
|
||||
HOTPOT_NO => get_string("neverclosed", "hotpot"),
|
||||
HOTPOT_YES => get_string("specifictime", "hotpot")
|
||||
);
|
||||
choose_from_menu($options, "enabletimeclose", "$form->enabletimeclose", "");
|
||||
print '<span id="timecloseSPAN">';
|
||||
print ' ';
|
||||
if (!$form->timeclose && $course->format == "weeks") {
|
||||
$form->timeclose= $course->startdate + (($form->section) * 608400);
|
||||
}
|
||||
print_date_selector("closeday", "closemonth", "closeyear", $form->timeclose);
|
||||
print ' - ';
|
||||
print_time_selector("closehour", "closeminute", $form->timeclose);
|
||||
helpbutton("timeopen", get_string("quizclose","quiz"), "quiz");
|
||||
print '</span>';
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right" nowrap>
|
||||
<b><?PHP print get_string("location","hotpot") ?>:</b>
|
||||
</td>
|
||||
<td align="left"><?PHP
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("name") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
if ($form->mode=='add') {
|
||||
choose_from_menu($text_source_options, "namesource", "$form->namesource", "");
|
||||
} else {
|
||||
print '<input type="hidden" name="namesource" value="'.HOTPOT_TEXTSOURCE_SPECIFIC.'">';
|
||||
}
|
||||
print '<span id="nameSPAN">';
|
||||
print '<input type="text" name="name" size=40 value="'.$form->name.'">';
|
||||
print '</span>';
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
<b><?PHP
|
||||
print_string("summary")
|
||||
?>:</b><br />
|
||||
<FONT size="1"><?PHP
|
||||
helpbutton("summary", get_string("summary"), "resource", true, true);
|
||||
print '<br />';
|
||||
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
|
||||
print '<br />';
|
||||
if (isset($usehtmleditor) && $usehtmleditor) {
|
||||
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
|
||||
print '<br />';
|
||||
} else {
|
||||
helpbutton("text", get_string("helptext"), "moodle", true, true);
|
||||
print '<br />';
|
||||
emoticonhelpbutton("form", "description");
|
||||
print '<br />';
|
||||
}
|
||||
?></FONT>
|
||||
</td>
|
||||
<td align="left"><?PHP
|
||||
if ($form->mode=='add') {
|
||||
choose_from_menu($text_source_options, "summarysource", "$form->summarysource", "");
|
||||
} else {
|
||||
print '<input type="hidden" name="summarysource" value="'.HOTPOT_TEXTSOURCE_SPECIFIC.'">';
|
||||
}
|
||||
print '<span id="summarySPAN">';
|
||||
if (function_exists("print_textarea") && isset($usehtmleditor)) {
|
||||
print_textarea($usehtmleditor, 10, 65, 680, 400, "summary", $form->summary);
|
||||
} else {
|
||||
// Moodle 1.1.1 (original size was rows="5" cols="50")
|
||||
print '<textarea name="summary" rows="10" cols="65" wrap="virtual">'.$form->summary.'</textarea>';
|
||||
}
|
||||
print '</span>';
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("quizopen", "quiz") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
$options = array(
|
||||
HOTPOT_NO => get_string("alwaysopen", "hotpot"),
|
||||
HOTPOT_YES => get_string("specifictime", "hotpot")
|
||||
);
|
||||
choose_from_menu($options, "enabletimeopen", "$form->enabletimeopen", "");
|
||||
print '<span id="timeopenSPAN">';
|
||||
print ' ';
|
||||
if (!$form->timeopen && $course->format == "weeks") {
|
||||
$form->timeopen= $course->startdate + (($form->section - 1) * 608400);
|
||||
}
|
||||
print_date_selector("openday", "openmonth", "openyear", $form->timeopen);
|
||||
print ' - ';
|
||||
print_time_selector("openhour", "openminute", $form->timeopen);
|
||||
helpbutton("timeopen", get_string("quizopen","quiz"), "quiz");
|
||||
print '</span>';
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("quizclose", "quiz") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
$options = array(
|
||||
HOTPOT_NO => get_string("neverclosed", "hotpot"),
|
||||
HOTPOT_YES => get_string("specifictime", "hotpot")
|
||||
);
|
||||
choose_from_menu($options, "enabletimeclose", "$form->enabletimeclose", "");
|
||||
print '<span id="timecloseSPAN">';
|
||||
print ' ';
|
||||
if (!$form->timeclose && $course->format == "weeks") {
|
||||
$form->timeclose= $course->startdate + (($form->section) * 608400);
|
||||
}
|
||||
print_date_selector("closeday", "closemonth", "closeyear", $form->timeclose);
|
||||
print ' - ';
|
||||
print_time_selector("closehour", "closeminute", $form->timeclose);
|
||||
helpbutton("timeopen", get_string("quizclose","quiz"), "quiz");
|
||||
print '</span>';
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right" nowrap>
|
||||
<b><?PHP print get_string("location","hotpot") ?>:</b>
|
||||
</td>
|
||||
<td align="left"><?PHP
|
||||
|
||||
|
||||
if (isadmin()) {
|
||||
$site = get_site();
|
||||
if ($course->id==$site->id) {
|
||||
$id = $site->id;
|
||||
$location = HOTPOT_LOCATION_SITEFILES;
|
||||
} else {
|
||||
$id = "'+(getObjValue(this.form.location)==".HOTPOT_LOCATION_SITEFILES."?".$site->id.":".$course->id.")+'";
|
||||
$location = '';
|
||||
}
|
||||
} else { // ordinary teacher or content creator
|
||||
$id = $course->id;
|
||||
$location = HOTPOT_LOCATION_COURSEFILES;
|
||||
}
|
||||
if (isadmin()) {
|
||||
$site = get_site();
|
||||
if ($course->id==$site->id) {
|
||||
$id = $site->id;
|
||||
$location = HOTPOT_LOCATION_SITEFILES;
|
||||
} else {
|
||||
$id = "'+(getObjValue(this.form.location)==".HOTPOT_LOCATION_SITEFILES."?".$site->id.":".$course->id.")+'";
|
||||
$location = '';
|
||||
}
|
||||
} else { // ordinary teacher or content creator
|
||||
$id = $course->id;
|
||||
$location = HOTPOT_LOCATION_COURSEFILES;
|
||||
}
|
||||
|
||||
if (array_key_exists($location, $HOTPOT_LOCATION)) {
|
||||
print '<input type="hidden" name="location" value="'.$location.'" />';
|
||||
print '<i><font size="-1">'.$HOTPOT_LOCATION[$location].'</font></i> ';
|
||||
if (array_key_exists($location, $HOTPOT_LOCATION)) {
|
||||
print '<input type="hidden" name="location" value="'.$location.'" />';
|
||||
print '<i><font size="-1">'.$HOTPOT_LOCATION[$location].'</font></i> ';
|
||||
|
||||
} else { // admin can select from "site" or "course" files
|
||||
choose_from_menu($HOTPOT_LOCATION, "location", "$form->location", "");
|
||||
}
|
||||
} else { // admin can select from "site" or "course" files
|
||||
choose_from_menu($HOTPOT_LOCATION, "location", "$form->location", "");
|
||||
}
|
||||
|
||||
|
||||
if (function_exists("button_to_popup_window")) {
|
||||
if (function_exists("button_to_popup_window")) {
|
||||
|
||||
// use javascript to extract wdir from the reference field
|
||||
$wdir = "'+getDir(getObjValue(this.form.reference))+'";
|
||||
// use javascript to extract wdir from the reference field
|
||||
$wdir = "'+getDir(getObjValue(this.form.reference))+'";
|
||||
|
||||
// set button url depending on Moodle version
|
||||
if ($CFG->version < 2004083125) { // version may need refining
|
||||
// up to and including Moodle 1.4.1
|
||||
$url = "/mod/resource/coursefiles.php?id=$id&wdir=$wdir";
|
||||
} else {
|
||||
// Moodle 1.4.2 and beyond
|
||||
$url = "/files/index.php?id=$id&wdir=$wdir&choose=form.reference";
|
||||
}
|
||||
// set button url depending on Moodle version
|
||||
if ($CFG->version < 2004083125) { // version may need refining
|
||||
// up to and including Moodle 1.4.1
|
||||
$url = "/mod/resource/coursefiles.php?id=$id&wdir=$wdir";
|
||||
} else {
|
||||
// Moodle 1.4.2 and beyond
|
||||
$url = "/files/index.php?id=$id&wdir=$wdir&choose=form.reference";
|
||||
}
|
||||
|
||||
$strchooseafile = get_string("chooseafile", "resource");
|
||||
button_to_popup_window ($url, 'coursefiles', $strchooseafile, 500, 750, $strchooseafile);
|
||||
}
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right" nowrap>
|
||||
<b><?PHP print_string("filename", "resource") ?>:</b>
|
||||
</td>
|
||||
<td align="left"><?PHP
|
||||
if (function_exists("button_to_popup_window")) {
|
||||
print '<input name="reference" size="50" value="'.$form->reference.'"> ';
|
||||
$strchooseafile = get_string("chooseafile", "resource");
|
||||
button_to_popup_window ($url, 'coursefiles', $strchooseafile, 500, 750, $strchooseafile);
|
||||
}
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right" nowrap>
|
||||
<b><?PHP print_string("filename", "resource") ?>:</b>
|
||||
</td>
|
||||
<td align="left"><?PHP
|
||||
if (function_exists("button_to_popup_window")) {
|
||||
print '<input name="reference" size="50" value="'.$form->reference.'"> ';
|
||||
|
||||
} else if (function_exists("get_directory_list")) {
|
||||
// Moodle 1.1 (and perhaps some others)
|
||||
$dirs = get_directory_list("$CFG->dataroot/$course->id");
|
||||
$options = array();
|
||||
foreach ($dirs as $dir) {
|
||||
$options["$dir"] = $dir;
|
||||
}
|
||||
choose_from_menu ($options, "reference", $form->reference);
|
||||
} else if (function_exists("get_directory_list")) {
|
||||
// Moodle 1.1 (and perhaps some others)
|
||||
$dirs = get_directory_list("$CFG->dataroot/$course->id");
|
||||
$options = array();
|
||||
foreach ($dirs as $dir) {
|
||||
$options["$dir"] = $dir;
|
||||
}
|
||||
choose_from_menu ($options, "reference", $form->reference);
|
||||
|
||||
} else {
|
||||
// a very old Moodle (may be none left :-)
|
||||
print '<input name="reference" size="50" value="'.$form->reference.'"> ';
|
||||
}
|
||||
print '<br />';
|
||||
hotpot_print_show_links($form->course, $form->location, $form->reference, '', ' ', true);
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP
|
||||
$quizchain = "{$form->mode}quizchain";
|
||||
print_string($quizchain, "hotpot");
|
||||
?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($yes_no_options, "quizchain", $form->quizchain, "");
|
||||
helpbutton($quizchain, get_string($quizchain,"hotpot"), "hotpot");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("outputformat", "hotpot") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($HOTPOT_OUTPUTFORMAT, "outputformat", "$form->outputformat", "");
|
||||
helpbutton("outputformat", get_string("outputformat","hotpot"), "hotpot");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("navigation", "hotpot") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($HOTPOT_NAVIGATION, "navigation", "$form->navigation", "");
|
||||
helpbutton("navigation", get_string("navigation","hotpot"), "hotpot");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("studentfeedback", "hotpot") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($HOTPOT_FEEDBACK, "studentfeedback", "$form->studentfeedback", "");
|
||||
print "<input name=\"studentfeedbackurl\" size=\"50\" value=\"$form->studentfeedbackurl\">";
|
||||
helpbutton("studentfeedback", get_string("studentfeedback","hotpot"), "hotpot");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("forceplugins", "hotpot") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($yes_no_options, "forceplugins", "$form->forceplugins", "");
|
||||
helpbutton("forceplugins", get_string("forceplugins","hotpot"), "hotpot");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("shownextquiz", "hotpot") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($yes_no_options, "shownextquiz", "$form->shownextquiz", "");
|
||||
helpbutton("shownextquiz", get_string("shownextquiz","hotpot"), "hotpot");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("allowreview", "quiz") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($yes_no_options, "review", "$form->review", "");
|
||||
helpbutton("review", get_string("allowreview","quiz"), "quiz");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("maximumgrade") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
$options = array();
|
||||
for ($i=100; $i>=1; $i--) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
$options[0] = get_string("nograde");
|
||||
} else {
|
||||
// a very old Moodle (may be none left :-)
|
||||
print '<input name="reference" size="50" value="'.$form->reference.'"> ';
|
||||
}
|
||||
print '<br />';
|
||||
hotpot_print_show_links($form->course, $form->location, $form->reference, '', ' ', true);
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP
|
||||
$quizchain = "{$form->mode}quizchain";
|
||||
print_string($quizchain, "hotpot");
|
||||
?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($yes_no_options, "quizchain", $form->quizchain, "");
|
||||
helpbutton($quizchain, get_string($quizchain,"hotpot"), "hotpot");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("outputformat", "hotpot") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($HOTPOT_OUTPUTFORMAT, "outputformat", "$form->outputformat", "");
|
||||
helpbutton("outputformat", get_string("outputformat","hotpot"), "hotpot");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("navigation", "hotpot") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($HOTPOT_NAVIGATION, "navigation", "$form->navigation", "");
|
||||
helpbutton("navigation", get_string("navigation","hotpot"), "hotpot");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("studentfeedback", "hotpot") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($HOTPOT_FEEDBACK, "studentfeedback", "$form->studentfeedback", "");
|
||||
print "<input name=\"studentfeedbackurl\" size=\"50\" value=\"$form->studentfeedbackurl\">";
|
||||
helpbutton("studentfeedback", get_string("studentfeedback","hotpot"), "hotpot");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("forceplugins", "hotpot") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($yes_no_options, "forceplugins", "$form->forceplugins", "");
|
||||
helpbutton("forceplugins", get_string("forceplugins","hotpot"), "hotpot");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("shownextquiz", "hotpot") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($yes_no_options, "shownextquiz", "$form->shownextquiz", "");
|
||||
helpbutton("shownextquiz", get_string("shownextquiz","hotpot"), "hotpot");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("allowreview", "quiz") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($yes_no_options, "review", "$form->review", "");
|
||||
helpbutton("review", get_string("allowreview","quiz"), "quiz");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("maximumgrade") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
$options = array();
|
||||
for ($i=100; $i>=1; $i--) {
|
||||
$options[$i] = $i;
|
||||
}
|
||||
$options[0] = get_string("nograde");
|
||||
|
||||
choose_from_menu($options, "grade", "$form->grade", "");
|
||||
helpbutton("maxgrade", get_string("maximumgrade"), "quiz");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("grademethod", "quiz") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($HOTPOT_GRADEMETHOD, "grademethod", "$form->grademethod", "");
|
||||
helpbutton("grademethod", get_string("grademethod","quiz"), "quiz");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("attemptsallowed", "quiz") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
$options = array(
|
||||
0 => get_string("attemptsunlimited", "quiz"),
|
||||
1 => '1 '.strtolower(get_string("attempt", "quiz"))
|
||||
);
|
||||
for ($i=2; $i<=10; $i++) {
|
||||
$options[$i] = "$i ".strtolower(get_string("attempts", "quiz"));
|
||||
}
|
||||
choose_from_menu($options, "attempts", "$form->attempts", "");
|
||||
helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("requirepassword", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="password" size=40 value="<?PHP p($form->password) ?>">
|
||||
<?PHP helpbutton("requirepassword", get_string("requirepassword", "quiz"), "quiz"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("requiresubnet", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="subnet" size=40 value="<?PHP p($form->subnet) ?>">
|
||||
<?PHP helpbutton("requiresubnet", get_string("requiresubnet", "quiz"), "quiz"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("clickreporting", "hotpot") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($yes_no_options, "clickreporting", "$form->clickreporting", "");
|
||||
helpbutton("clickreporting", get_string("clickreporting","hotpot"), "hotpot");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"> </td>
|
||||
<td align="left">
|
||||
<!-- buttons -->
|
||||
<input type="submit" value="<?PHP print_string("savechanges") ?>">
|
||||
<input type="submit" name="cancel" value="<?PHP print_string("cancel") ?>" /><br />
|
||||
<?PHP
|
||||
if (isset($CFG->release) && substr($CFG->release, 0, 3)>=1.5) {
|
||||
$options = array(
|
||||
HOTPOT_DISPLAYNEXT_QUIZ => get_string("displayhotpotnext", "hotpot"),
|
||||
HOTPOT_DISPLAYNEXT_COURSE => get_string("displaycoursenext", "hotpot"),
|
||||
HOTPOT_DISPLAYNEXT_INDEX => get_string("displayindexnext", "hotpot")
|
||||
);
|
||||
choose_from_menu($options, "displaynext", "$form->displaynext", "");
|
||||
} else {
|
||||
print '<input type="hidden" name="displaynext" value="'.HOTPOT_NO.'">'."\n";
|
||||
}
|
||||
?>
|
||||
choose_from_menu($options, "grade", "$form->grade", "");
|
||||
helpbutton("maxgrade", get_string("maximumgrade"), "quiz");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("grademethod", "quiz") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($HOTPOT_GRADEMETHOD, "grademethod", "$form->grademethod", "");
|
||||
helpbutton("grademethod", get_string("grademethod","quiz"), "quiz");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("attemptsallowed", "quiz") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
$options = array(
|
||||
0 => get_string("attemptsunlimited", "quiz"),
|
||||
1 => '1 '.strtolower(get_string("attempt", "quiz"))
|
||||
);
|
||||
for ($i=2; $i<=10; $i++) {
|
||||
$options[$i] = "$i ".strtolower(get_string("attempts", "quiz"));
|
||||
}
|
||||
choose_from_menu($options, "attempts", "$form->attempts", "");
|
||||
helpbutton("attempts", get_string("attemptsallowed","quiz"), "quiz");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("requirepassword", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="password" size=40 value="<?PHP p($form->password) ?>">
|
||||
<?PHP helpbutton("requirepassword", get_string("requirepassword", "quiz"), "quiz"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("requiresubnet", "quiz") ?>:</b></td>
|
||||
<td align="left">
|
||||
<input type="text" name="subnet" size=40 value="<?PHP p($form->subnet) ?>">
|
||||
<?PHP helpbutton("requiresubnet", get_string("requiresubnet", "quiz"), "quiz"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?PHP print_string("clickreporting", "hotpot") ?>:</b></td>
|
||||
<td align="left"><?PHP
|
||||
choose_from_menu($yes_no_options, "clickreporting", "$form->clickreporting", "");
|
||||
helpbutton("clickreporting", get_string("clickreporting","hotpot"), "hotpot");
|
||||
?></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right"> </td>
|
||||
<td align="left">
|
||||
<!-- buttons -->
|
||||
<input type="submit" value="<?PHP print_string("savechanges") ?>">
|
||||
<input type="submit" name="cancel" value="<?PHP print_string("cancel") ?>" /><br />
|
||||
<?PHP
|
||||
if (isset($CFG->release) && substr($CFG->release, 0, 3)>=1.5) {
|
||||
$options = array(
|
||||
HOTPOT_DISPLAYNEXT_QUIZ => get_string("displayhotpotnext", "hotpot"),
|
||||
HOTPOT_DISPLAYNEXT_COURSE => get_string("displaycoursenext", "hotpot"),
|
||||
HOTPOT_DISPLAYNEXT_INDEX => get_string("displayindexnext", "hotpot")
|
||||
);
|
||||
choose_from_menu($options, "displaynext", "$form->displaynext", "");
|
||||
} else {
|
||||
print '<input type="hidden" name="displaynext" value="'.HOTPOT_NO.'">'."\n";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<!-- hidden fields -->
|
||||
|
@ -333,121 +333,121 @@ $text_source_options = array(
|
|||
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
function hpShowHideStudentFeedbackUrl() {
|
||||
var frm = document.forms['form'];
|
||||
if (frm) {
|
||||
var obj = frm.elements['studentfeedback'];
|
||||
var url = frm.elements['studentfeedbackurl'];
|
||||
if (obj && obj.type=='select-one' && url && url.style) {
|
||||
if (obj.onchange==null) {
|
||||
obj.onchange = hpShowHideStudentFeedbackUrl;
|
||||
}
|
||||
var v = obj.options[obj.selectedIndex].value;
|
||||
url.style.display = (v==1 || v==2) ? 'inline' : 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
hpShowHideStudentFeedbackUrl();
|
||||
function hpShowHideStudentFeedbackUrl() {
|
||||
var frm = document.forms['form'];
|
||||
if (frm) {
|
||||
var obj = frm.elements['studentfeedback'];
|
||||
var url = frm.elements['studentfeedbackurl'];
|
||||
if (obj && obj.type=='select-one' && url && url.style) {
|
||||
if (obj.onchange==null) {
|
||||
obj.onchange = hpShowHideStudentFeedbackUrl;
|
||||
}
|
||||
var v = obj.options[obj.selectedIndex].value;
|
||||
url.style.display = (v==1 || v==2) ? 'inline' : 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
hpShowHideStudentFeedbackUrl();
|
||||
|
||||
function hpShowHideTime(s) {
|
||||
var frm = document.forms['form'];
|
||||
if (frm) {
|
||||
var obj = frm.elements['enabletime'+s];
|
||||
if (obj && obj.type=='select-one' && document.getElementById) {
|
||||
if (obj.onchange==null) {
|
||||
obj.onchange = new Function("hpShowHideTime('"+s+"')");
|
||||
}
|
||||
var v = obj.options[obj.selectedIndex].value;
|
||||
var obj = document.getElementById('time'+s+'SPAN');
|
||||
if (obj && obj.style) {
|
||||
obj.style.display = (v==0) ? 'none' : 'inline';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
hpShowHideTime('open');
|
||||
hpShowHideTime('close');
|
||||
function hpShowHideTime(s) {
|
||||
var frm = document.forms['form'];
|
||||
if (frm) {
|
||||
var obj = frm.elements['enabletime'+s];
|
||||
if (obj && obj.type=='select-one' && document.getElementById) {
|
||||
if (obj.onchange==null) {
|
||||
obj.onchange = new Function("hpShowHideTime('"+s+"')");
|
||||
}
|
||||
var v = obj.options[obj.selectedIndex].value;
|
||||
var obj = document.getElementById('time'+s+'SPAN');
|
||||
if (obj && obj.style) {
|
||||
obj.style.display = (v==0) ? 'none' : 'inline';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
hpShowHideTime('open');
|
||||
hpShowHideTime('close');
|
||||
|
||||
function hpShowHideTextSource(s) {
|
||||
var frm = document.forms['form'];
|
||||
if (frm) {
|
||||
var obj = frm.elements[s+'source'];
|
||||
if (obj && obj.type=='select-one' && document.getElementById) {
|
||||
if (obj.onchange==null) {
|
||||
obj.onchange = new Function("hpShowHideTextSource('"+s+"')");
|
||||
}
|
||||
var v = obj.options[obj.selectedIndex].value;
|
||||
var obj = document.getElementById(s+'SPAN');
|
||||
if (obj && obj.style) {
|
||||
obj.style.display = (v==0 || v==1 || v==2) ? 'none' : 'inline';
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
hpShowHideTextSource('name');
|
||||
//hpShowHideTextSource('summary');
|
||||
function hpShowHideTextSource(s) {
|
||||
var frm = document.forms['form'];
|
||||
if (frm) {
|
||||
var obj = frm.elements[s+'source'];
|
||||
if (obj && obj.type=='select-one' && document.getElementById) {
|
||||
if (obj.onchange==null) {
|
||||
obj.onchange = new Function("hpShowHideTextSource('"+s+"')");
|
||||
}
|
||||
var v = obj.options[obj.selectedIndex].value;
|
||||
var obj = document.getElementById(s+'SPAN');
|
||||
if (obj && obj.style) {
|
||||
obj.style.display = (v==0 || v==1 || v==2) ? 'none' : 'inline';
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
hpShowHideTextSource('name');
|
||||
//hpShowHideTextSource('summary');
|
||||
|
||||
// override the standard Moodle "setfocus" function,
|
||||
// which gives a js error if the "name" field is hidden
|
||||
function setfocus() {
|
||||
var f = document.form;
|
||||
if (f) {
|
||||
if (canfocus(f, 'namesource')) {
|
||||
f.namesource.focus();
|
||||
} else if (canfocus(f, 'name')) {
|
||||
f.name.focus();
|
||||
}
|
||||
}
|
||||
var f = document.form;
|
||||
if (f) {
|
||||
if (canfocus(f, 'namesource')) {
|
||||
f.namesource.focus();
|
||||
} else if (canfocus(f, 'name')) {
|
||||
f.name.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
function canfocus(f, name) {
|
||||
var obj = eval('f.'+name);
|
||||
return (obj==null || obj.type=='hidden' || obj.focus==null || (obj.style && obj.style.display=='none')) ? false : true;
|
||||
var obj = eval('f.'+name);
|
||||
return (obj==null || obj.type=='hidden' || obj.focus==null || (obj.style && obj.style.display=='none')) ? false : true;
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
<?PHP
|
||||
|
||||
// ======================
|
||||
// functions
|
||||
// functions
|
||||
// ======================
|
||||
|
||||
function set_form_fields(&$form) {
|
||||
set_form_field($form, 'name');
|
||||
set_form_field($form, 'summary');
|
||||
set_form_field($form, 'timeopen', get_user_preferences('hotpot_timeopen', 0));
|
||||
set_form_field($form, 'enabletimeopen', empty($form->timeopen) ? HOTPOT_NO : HOTPOT_YES);
|
||||
set_form_field($form, 'timeclose', get_user_preferences('hotpot_timeclose', 0));
|
||||
set_form_field($form, 'enabletimeclose', empty($form->timeclose) ? HOTPOT_NO : HOTPOT_YES);
|
||||
set_form_field($form, 'location', HOTPOT_LOCATION_COURSEFILES);
|
||||
set_form_field($form, 'reference');
|
||||
set_form_field($form, 'navigation', get_user_preferences('hotpot_navigation', HOTPOT_NAVIGATION_BAR));
|
||||
set_form_field($form, 'outputformat', get_user_preferences('hotpot_outputformat', HOTPOT_OUTPUTFORMAT_BEST));
|
||||
set_form_field($form, 'studentfeedback', get_user_preferences('hotpot_studentfeedback', HOTPOT_FEEDBACK_NONE));
|
||||
set_form_field($form, 'studentfeedbackurl', get_user_preferences('hotpot_studentfeedbackurl', 'http://'));
|
||||
set_form_field($form, 'forceplugins', get_user_preferences('hotpot_forceplugins', HOTPOT_NO));
|
||||
if ($form->mode=='add') {
|
||||
set_form_field($form, 'namesource', get_user_preferences('hotpot_namesource', HOTPOT_TEXTSOURCE_QUIZ));
|
||||
set_form_field($form, 'summarysource', get_user_preferences('hotpot_summarysource', HOTPOT_TEXTSOURCE_QUIZ));
|
||||
$quizchain = get_user_preferences('hotpot_quizchain', HOTPOT_NO);
|
||||
} else {
|
||||
$quizchain = empty($form->quizchain) ? HOTPOT_NO : HOTPOT_YES;
|
||||
}
|
||||
set_form_field($form, 'quizchain', $quizchain);
|
||||
set_form_field($form, 'shownextquiz', get_user_preferences('hotpot_shownextquiz', HOTPOT_NO));
|
||||
set_form_field($form, 'review', get_user_preferences('hotpot_review', HOTPOT_YES));
|
||||
set_form_field($form, 'grade', get_user_preferences('hotpot_grade', 100));
|
||||
set_form_field($form, 'grademethod', get_user_preferences('hotpot_grademethod', HOTPOT_GRADEMETHOD_HIGHEST));
|
||||
set_form_field($form, 'attempts', get_user_preferences('hotpot_attempts', 0)); // 0=unlimited
|
||||
set_form_field($form, 'password');
|
||||
set_form_field($form, 'subnet', get_user_preferences('hotpot_subnet'));
|
||||
set_form_field($form, 'clickreporting', HOTPOT_NO);
|
||||
set_form_field($form, 'displaynext', get_user_preferences('hotpot_displaynext', HOTPOT_DISPLAYNEXT_QUIZ));
|
||||
set_form_field($form, 'name');
|
||||
set_form_field($form, 'summary');
|
||||
set_form_field($form, 'timeopen', get_user_preferences('hotpot_timeopen', 0));
|
||||
set_form_field($form, 'enabletimeopen', empty($form->timeopen) ? HOTPOT_NO : HOTPOT_YES);
|
||||
set_form_field($form, 'timeclose', get_user_preferences('hotpot_timeclose', 0));
|
||||
set_form_field($form, 'enabletimeclose', empty($form->timeclose) ? HOTPOT_NO : HOTPOT_YES);
|
||||
set_form_field($form, 'location', HOTPOT_LOCATION_COURSEFILES);
|
||||
set_form_field($form, 'reference');
|
||||
set_form_field($form, 'navigation', get_user_preferences('hotpot_navigation', HOTPOT_NAVIGATION_BAR));
|
||||
set_form_field($form, 'outputformat', get_user_preferences('hotpot_outputformat', HOTPOT_OUTPUTFORMAT_BEST));
|
||||
set_form_field($form, 'studentfeedback', get_user_preferences('hotpot_studentfeedback', HOTPOT_FEEDBACK_NONE));
|
||||
set_form_field($form, 'studentfeedbackurl', get_user_preferences('hotpot_studentfeedbackurl', 'http://'));
|
||||
set_form_field($form, 'forceplugins', get_user_preferences('hotpot_forceplugins', HOTPOT_NO));
|
||||
if ($form->mode=='add') {
|
||||
set_form_field($form, 'namesource', get_user_preferences('hotpot_namesource', HOTPOT_TEXTSOURCE_QUIZ));
|
||||
set_form_field($form, 'summarysource', get_user_preferences('hotpot_summarysource', HOTPOT_TEXTSOURCE_QUIZ));
|
||||
$quizchain = get_user_preferences('hotpot_quizchain', HOTPOT_NO);
|
||||
} else {
|
||||
$quizchain = empty($form->quizchain) ? HOTPOT_NO : HOTPOT_YES;
|
||||
}
|
||||
set_form_field($form, 'quizchain', $quizchain);
|
||||
set_form_field($form, 'shownextquiz', get_user_preferences('hotpot_shownextquiz', HOTPOT_NO));
|
||||
set_form_field($form, 'review', get_user_preferences('hotpot_review', HOTPOT_YES));
|
||||
set_form_field($form, 'grade', get_user_preferences('hotpot_grade', 100));
|
||||
set_form_field($form, 'grademethod', get_user_preferences('hotpot_grademethod', HOTPOT_GRADEMETHOD_HIGHEST));
|
||||
set_form_field($form, 'attempts', get_user_preferences('hotpot_attempts', 0)); // 0=unlimited
|
||||
set_form_field($form, 'password');
|
||||
set_form_field($form, 'subnet', get_user_preferences('hotpot_subnet'));
|
||||
set_form_field($form, 'clickreporting', HOTPOT_NO);
|
||||
set_form_field($form, 'displaynext', get_user_preferences('hotpot_displaynext', HOTPOT_DISPLAYNEXT_QUIZ));
|
||||
}
|
||||
function set_form_field(&$form, $fieldname, $defaultvalue='') {
|
||||
if (!isset($form->$fieldname)) {
|
||||
$form->$fieldname = $defaultvalue;
|
||||
}
|
||||
if (!isset($form->$fieldname)) {
|
||||
$form->$fieldname = $defaultvalue;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,240 +1,240 @@
|
|||
<?PHP // $Id$
|
||||
// This page prints a review of a particular quiz attempt
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
$id = optional_param("id"); // Course Module ID, or
|
||||
$hp = optional_param("hp"); // hotpot ID
|
||||
$attempt = required_param("attempt"); // A particular attempt ID for review
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
}
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
} else {
|
||||
if (! $hotpot = get_record("hotpot", "id", $hp)) {
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
if (! $course = get_record("course", "id", $hotpot->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
}
|
||||
}
|
||||
if (! $attempt = get_record("hotpot_attempts", "id", $attempt)) {
|
||||
error("Attempt ID was incorrect");
|
||||
}
|
||||
require_login($course->id);
|
||||
if (!isteacher($course->id)) {
|
||||
if (!$hotpot->review) {
|
||||
error(get_string("noreview", "quiz"));
|
||||
}
|
||||
//if (time() < $hotpot->timeclose) {
|
||||
// error(get_string("noreviewuntil", "quiz", userdate($hotpot->timeclose)));
|
||||
//}
|
||||
if ($attempt->userid != $USER->id) {
|
||||
error("This is not your attempt!");
|
||||
}
|
||||
}
|
||||
add_to_log($course->id, "hotpot", "review", "review.php?id=$cm->id&attempt=$attempt->id", "$hotpot->id", "$cm->id");
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
$id = optional_param("id"); // Course Module ID, or
|
||||
$hp = optional_param("hp"); // hotpot ID
|
||||
$attempt = required_param("attempt"); // A particular attempt ID for review
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
}
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
} else {
|
||||
if (! $hotpot = get_record("hotpot", "id", $hp)) {
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
if (! $course = get_record("course", "id", $hotpot->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
}
|
||||
}
|
||||
if (! $attempt = get_record("hotpot_attempts", "id", $attempt)) {
|
||||
error("Attempt ID was incorrect");
|
||||
}
|
||||
require_login($course->id);
|
||||
if (!isteacher($course->id)) {
|
||||
if (!$hotpot->review) {
|
||||
error(get_string("noreview", "quiz"));
|
||||
}
|
||||
//if (time() < $hotpot->timeclose) {
|
||||
// error(get_string("noreviewuntil", "quiz", userdate($hotpot->timeclose)));
|
||||
//}
|
||||
if ($attempt->userid != $USER->id) {
|
||||
error("This is not your attempt!");
|
||||
}
|
||||
}
|
||||
add_to_log($course->id, "hotpot", "review", "review.php?id=$cm->id&attempt=$attempt->id", "$hotpot->id", "$cm->id");
|
||||
// Print the page header
|
||||
$strmodulenameplural = get_string("modulenameplural", "hotpot");
|
||||
$strmodulename = get_string("modulename", "hotpot");
|
||||
// print header
|
||||
$title = "$course->shortname: $hotpot->name";
|
||||
$heading = "$course->fullname";
|
||||
$navigation = "<a href=\"index.php?id=$course->id\">$strmodulenameplural</a> -> ".get_string("review", "quiz");
|
||||
if ($course->category) {
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
|
||||
}
|
||||
$button = update_module_button($cm->id, $course->id, $strmodulename);
|
||||
print_header($title, $heading, $navigation, "", "", true, $button, navmenu($course, $cm));
|
||||
print '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib
|
||||
print_heading($hotpot->name);
|
||||
hotpot_print_attempt_summary($hotpot, $attempt);
|
||||
hotpot_print_review_buttons($course, $hotpot, $attempt);
|
||||
$action = isteacher($course->id) ? optional_param('action') : '';
|
||||
if ($action) {
|
||||
$xml = get_field('hotpot_details', 'details', 'attempt', $attempt->id);
|
||||
print '<hr>';
|
||||
switch ($action) {
|
||||
case 'showxmltree':
|
||||
print '<pre id="contents">';
|
||||
$xml_tree = new hotpot_xml_tree($xml, "['hpjsresult']['#']");
|
||||
print_r ($xml_tree->xml_value('fields'));
|
||||
print '</pre>';
|
||||
break;
|
||||
case 'showxmlsource':
|
||||
print htmlspecialchars($xml);
|
||||
break;
|
||||
default:
|
||||
print "Action '$action' not recognized";
|
||||
}
|
||||
print '<hr>';
|
||||
} else {
|
||||
hotpot_print_attempt_details($hotpot, $attempt);
|
||||
}
|
||||
hotpot_print_review_buttons($course, $hotpot, $attempt);
|
||||
print_footer($course);
|
||||
$strmodulenameplural = get_string("modulenameplural", "hotpot");
|
||||
$strmodulename = get_string("modulename", "hotpot");
|
||||
// print header
|
||||
$title = "$course->shortname: $hotpot->name";
|
||||
$heading = "$course->fullname";
|
||||
$navigation = "<a href=\"index.php?id=$course->id\">$strmodulenameplural</a> -> ".get_string("review", "quiz");
|
||||
if ($course->category) {
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
|
||||
}
|
||||
$button = update_module_button($cm->id, $course->id, $strmodulename);
|
||||
print_header($title, $heading, $navigation, "", "", true, $button, navmenu($course, $cm));
|
||||
print '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib
|
||||
print_heading($hotpot->name);
|
||||
hotpot_print_attempt_summary($hotpot, $attempt);
|
||||
hotpot_print_review_buttons($course, $hotpot, $attempt);
|
||||
$action = isteacher($course->id) ? optional_param('action') : '';
|
||||
if ($action) {
|
||||
$xml = get_field('hotpot_details', 'details', 'attempt', $attempt->id);
|
||||
print '<hr>';
|
||||
switch ($action) {
|
||||
case 'showxmltree':
|
||||
print '<pre id="contents">';
|
||||
$xml_tree = new hotpot_xml_tree($xml, "['hpjsresult']['#']");
|
||||
print_r ($xml_tree->xml_value('fields'));
|
||||
print '</pre>';
|
||||
break;
|
||||
case 'showxmlsource':
|
||||
print htmlspecialchars($xml);
|
||||
break;
|
||||
default:
|
||||
print "Action '$action' not recognized";
|
||||
}
|
||||
print '<hr>';
|
||||
} else {
|
||||
hotpot_print_attempt_details($hotpot, $attempt);
|
||||
}
|
||||
hotpot_print_review_buttons($course, $hotpot, $attempt);
|
||||
print_footer($course);
|
||||
///////////////////////////
|
||||
// functions
|
||||
///////////////////////////
|
||||
function hotpot_print_attempt_summary(&$hotpot, &$attempt) {
|
||||
// start table
|
||||
print_simple_box_start("center", "80%", "#ffffff", 0);
|
||||
print '<table width="100%" border="1" valign="top" align="center" cellpadding="2" cellspacing="2" class="generaltable">'."\n";
|
||||
// add attempt properties
|
||||
$fields = array('attempt', 'score', 'penalties', 'status', 'timetaken', 'timerecorded');
|
||||
foreach ($fields as $field) {
|
||||
switch ($field) {
|
||||
case 'score':
|
||||
$value = hotpot_format_score($attempt);
|
||||
break;
|
||||
case 'status':
|
||||
$value = hotpot_format_status($attempt);
|
||||
break;
|
||||
case 'timerecorded':
|
||||
$value = empty($attempt->timefinish) ? '-' : userdate($attempt->timefinish);
|
||||
break;
|
||||
case 'timetaken':
|
||||
$value = empty($attempt->timefinish) ? '-' : format_time($attempt->timefinish - $attempt->timestart);
|
||||
break;
|
||||
default:
|
||||
$value = isset($attempt->$field) ? $attempt->$field : NULL;
|
||||
}
|
||||
if (isset($value)) {
|
||||
switch ($field) {
|
||||
case 'status':
|
||||
case 'timerecorded':
|
||||
$name = get_string('report'.$field, 'hotpot');
|
||||
break;
|
||||
case 'penalties':
|
||||
$name = get_string('penalties', 'hotpot');
|
||||
break;
|
||||
default:
|
||||
$name = get_string($field, 'quiz');
|
||||
}
|
||||
print '<tr><th align="right" width="100" class="generaltableheader">'.$name.':</th><td class="generaltablecell">'.$value.'</td></tr>';
|
||||
}
|
||||
}
|
||||
// finish table
|
||||
print '</table>';
|
||||
print_simple_box_end();
|
||||
// start table
|
||||
print_simple_box_start("center", "80%", "#ffffff", 0);
|
||||
print '<table width="100%" border="1" valign="top" align="center" cellpadding="2" cellspacing="2" class="generaltable">'."\n";
|
||||
// add attempt properties
|
||||
$fields = array('attempt', 'score', 'penalties', 'status', 'timetaken', 'timerecorded');
|
||||
foreach ($fields as $field) {
|
||||
switch ($field) {
|
||||
case 'score':
|
||||
$value = hotpot_format_score($attempt);
|
||||
break;
|
||||
case 'status':
|
||||
$value = hotpot_format_status($attempt);
|
||||
break;
|
||||
case 'timerecorded':
|
||||
$value = empty($attempt->timefinish) ? '-' : userdate($attempt->timefinish);
|
||||
break;
|
||||
case 'timetaken':
|
||||
$value = empty($attempt->timefinish) ? '-' : format_time($attempt->timefinish - $attempt->timestart);
|
||||
break;
|
||||
default:
|
||||
$value = isset($attempt->$field) ? $attempt->$field : NULL;
|
||||
}
|
||||
if (isset($value)) {
|
||||
switch ($field) {
|
||||
case 'status':
|
||||
case 'timerecorded':
|
||||
$name = get_string('report'.$field, 'hotpot');
|
||||
break;
|
||||
case 'penalties':
|
||||
$name = get_string('penalties', 'hotpot');
|
||||
break;
|
||||
default:
|
||||
$name = get_string($field, 'quiz');
|
||||
}
|
||||
print '<tr><th align="right" width="100" class="generaltableheader">'.$name.':</th><td class="generaltablecell">'.$value.'</td></tr>';
|
||||
}
|
||||
}
|
||||
// finish table
|
||||
print '</table>';
|
||||
print_simple_box_end();
|
||||
}
|
||||
function hotpot_print_review_buttons(&$course, &$hotpot, &$attempt) {
|
||||
print "\n".'<table border="0" align="center" cellpadding="2" cellspacing="2" class="generaltable">';
|
||||
print "\n<tr>\n".'<td align="center">';
|
||||
print_single_button("report.php?hp=$hotpot->id", NULL, get_string('continue'), 'post');
|
||||
if (isteacher($course->id) && record_exists('hotpot_details', 'attempt', $attempt->id)) {
|
||||
print "</td>\n".'<td align="center">';
|
||||
print_single_button("review.php?hp=$hotpot->id&attempt=$attempt->id&action=showxmlsource", NULL, get_string('showxmlsource', 'hotpot'), 'post');
|
||||
print "</td>\n".'<td align="center">';
|
||||
print_single_button("review.php?hp=$hotpot->id&attempt=$attempt->id&action=showxmltree", NULL, get_string('showxmltree', 'hotpot'), 'post');
|
||||
$colspan = 3;
|
||||
} else {
|
||||
$colspan = 1;
|
||||
}
|
||||
print "</td>\n</tr>\n";
|
||||
print '<tr><td colspan="'.$colspan.'">';
|
||||
print_spacer(4, 1, false); // height=4, width=1, no <br />
|
||||
print "</td></tr>\n";
|
||||
print "</table>\n";
|
||||
print "\n".'<table border="0" align="center" cellpadding="2" cellspacing="2" class="generaltable">';
|
||||
print "\n<tr>\n".'<td align="center">';
|
||||
print_single_button("report.php?hp=$hotpot->id", NULL, get_string('continue'), 'post');
|
||||
if (isteacher($course->id) && record_exists('hotpot_details', 'attempt', $attempt->id)) {
|
||||
print "</td>\n".'<td align="center">';
|
||||
print_single_button("review.php?hp=$hotpot->id&attempt=$attempt->id&action=showxmlsource", NULL, get_string('showxmlsource', 'hotpot'), 'post');
|
||||
print "</td>\n".'<td align="center">';
|
||||
print_single_button("review.php?hp=$hotpot->id&attempt=$attempt->id&action=showxmltree", NULL, get_string('showxmltree', 'hotpot'), 'post');
|
||||
$colspan = 3;
|
||||
} else {
|
||||
$colspan = 1;
|
||||
}
|
||||
print "</td>\n</tr>\n";
|
||||
print '<tr><td colspan="'.$colspan.'">';
|
||||
print_spacer(4, 1, false); // height=4, width=1, no <br />
|
||||
print "</td></tr>\n";
|
||||
print "</table>\n";
|
||||
}
|
||||
function hotpot_print_attempt_details(&$hotpot, &$attempt) {
|
||||
// define fields to print
|
||||
$textfields = array('correct', 'ignored', 'wrong');
|
||||
$numfields = array('score', 'weighting', 'hints', 'clues', 'checks');
|
||||
$fields = array_merge($textfields, $numfields);
|
||||
$q = array(); // questions
|
||||
$f = array(); // fields
|
||||
foreach ($fields as $field) {
|
||||
$name = get_string($field, 'hotpot');
|
||||
$f[$field] = array('count'=>0, 'name'=>$name);
|
||||
}
|
||||
// get questions and responses for this attempt
|
||||
$questions = get_records_select('hotpot_questions', "hotpot='$hotpot->id'", 'id');
|
||||
$responses = get_records_select('hotpot_responses', "attempt='$attempt->id'", 'id');
|
||||
if ($questions && $responses) {
|
||||
foreach ($responses as $response) {
|
||||
$id = $response->question;
|
||||
foreach ($fields as $field) {
|
||||
if (!isset($f[$field])) {
|
||||
$name = get_string($field, 'hotpot');
|
||||
$f[$field] = array('count'=>0, 'name'=>$name);
|
||||
}
|
||||
if (isset($response->$field)) {
|
||||
$f[$field]['count']++;
|
||||
if (!isset($q[$id])) {
|
||||
$name = hotpot_get_question_name($questions[$id]);
|
||||
$q[$id] = array('name'=>$name);
|
||||
}
|
||||
$q[$id][$field] = $response->$field;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// count the number of columns required in the table
|
||||
$colspan = 0;
|
||||
foreach ($numfields as $field) {
|
||||
if ($f[$field]['count']) {
|
||||
$colspan += 2;
|
||||
}
|
||||
}
|
||||
$colspan = max(2, $colspan);
|
||||
// start table of questions and responses
|
||||
print_simple_box_start("center", "80%", "#ffffff", 0);
|
||||
print '<table width="100%" border="1" valign="top" align="center" cellpadding="2" cellspacing="2" class="generaltable">'."\n";
|
||||
if (empty($q)) {
|
||||
print '<tr><td align="center" class="generaltablecell"><b>'.get_string("noresponses", "hotpot")."</b></td></tr>\n";
|
||||
} else {
|
||||
// flag to ensure separators are only printed before the 2nd and subsequent questions
|
||||
$printseparator = false;
|
||||
foreach ($q as $i=>$question) {
|
||||
// flag to ensure questions are only printed when there is at least one response
|
||||
$printedquestion = false;
|
||||
// add rows of text fields
|
||||
foreach ($textfields as $field) {
|
||||
if (isset($question[$field])) {
|
||||
$text = hotpot_strings($question[$field]);
|
||||
if (trim($text)) {
|
||||
// print question if necessary
|
||||
if (!$printedquestion) {
|
||||
if ($printseparator) {
|
||||
print '<tr><td colspan="'.$colspan.'"><div class="tabledivider"></div></td></tr>'."\n";
|
||||
}
|
||||
$printseparator = true;
|
||||
print '<tr><td colspan="'.$colspan.'" class="generaltablecell"><b>'.$question['name'].'</b></td></tr>'."\n";
|
||||
$printedquestion = true;
|
||||
}
|
||||
// print response
|
||||
print '<tr><th align="right" width="100" class="generaltableheader">'.$f[$field]['name'].':</th><td colspan="'.($colspan-1).'" class="generaltablecell">'.$text.'</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
// add row of numeric fields
|
||||
print '<tr>';
|
||||
foreach ($numfields as $field) {
|
||||
if ($f[$field]['count']) {
|
||||
// print question if necessary
|
||||
if (!$printedquestion) {
|
||||
print '<td colspan="'.$colspan.'" class="generaltablecell"><b>'.$question['name']."</b></td></tr>\n<tr>";
|
||||
$printedquestion = true;
|
||||
}
|
||||
// print numeric response
|
||||
$value = isset($question[$field]) ? $question[$field] : '-';
|
||||
print '<th align="right" width="100" class="generaltableheader">'.$f[$field]['name'].':</th><td class="generaltablecell">'.$value.'</td>';
|
||||
}
|
||||
}
|
||||
print "</tr>\n";
|
||||
} // foreach $q
|
||||
}
|
||||
// finish table
|
||||
print "</table>\n";
|
||||
print_simple_box_end();
|
||||
// define fields to print
|
||||
$textfields = array('correct', 'ignored', 'wrong');
|
||||
$numfields = array('score', 'weighting', 'hints', 'clues', 'checks');
|
||||
$fields = array_merge($textfields, $numfields);
|
||||
$q = array(); // questions
|
||||
$f = array(); // fields
|
||||
foreach ($fields as $field) {
|
||||
$name = get_string($field, 'hotpot');
|
||||
$f[$field] = array('count'=>0, 'name'=>$name);
|
||||
}
|
||||
// get questions and responses for this attempt
|
||||
$questions = get_records_select('hotpot_questions', "hotpot='$hotpot->id'", 'id');
|
||||
$responses = get_records_select('hotpot_responses', "attempt='$attempt->id'", 'id');
|
||||
if ($questions && $responses) {
|
||||
foreach ($responses as $response) {
|
||||
$id = $response->question;
|
||||
foreach ($fields as $field) {
|
||||
if (!isset($f[$field])) {
|
||||
$name = get_string($field, 'hotpot');
|
||||
$f[$field] = array('count'=>0, 'name'=>$name);
|
||||
}
|
||||
if (isset($response->$field)) {
|
||||
$f[$field]['count']++;
|
||||
if (!isset($q[$id])) {
|
||||
$name = hotpot_get_question_name($questions[$id]);
|
||||
$q[$id] = array('name'=>$name);
|
||||
}
|
||||
$q[$id][$field] = $response->$field;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// count the number of columns required in the table
|
||||
$colspan = 0;
|
||||
foreach ($numfields as $field) {
|
||||
if ($f[$field]['count']) {
|
||||
$colspan += 2;
|
||||
}
|
||||
}
|
||||
$colspan = max(2, $colspan);
|
||||
// start table of questions and responses
|
||||
print_simple_box_start("center", "80%", "#ffffff", 0);
|
||||
print '<table width="100%" border="1" valign="top" align="center" cellpadding="2" cellspacing="2" class="generaltable">'."\n";
|
||||
if (empty($q)) {
|
||||
print '<tr><td align="center" class="generaltablecell"><b>'.get_string("noresponses", "hotpot")."</b></td></tr>\n";
|
||||
} else {
|
||||
// flag to ensure separators are only printed before the 2nd and subsequent questions
|
||||
$printseparator = false;
|
||||
foreach ($q as $i=>$question) {
|
||||
// flag to ensure questions are only printed when there is at least one response
|
||||
$printedquestion = false;
|
||||
// add rows of text fields
|
||||
foreach ($textfields as $field) {
|
||||
if (isset($question[$field])) {
|
||||
$text = hotpot_strings($question[$field]);
|
||||
if (trim($text)) {
|
||||
// print question if necessary
|
||||
if (!$printedquestion) {
|
||||
if ($printseparator) {
|
||||
print '<tr><td colspan="'.$colspan.'"><div class="tabledivider"></div></td></tr>'."\n";
|
||||
}
|
||||
$printseparator = true;
|
||||
print '<tr><td colspan="'.$colspan.'" class="generaltablecell"><b>'.$question['name'].'</b></td></tr>'."\n";
|
||||
$printedquestion = true;
|
||||
}
|
||||
// print response
|
||||
print '<tr><th align="right" width="100" class="generaltableheader">'.$f[$field]['name'].':</th><td colspan="'.($colspan-1).'" class="generaltablecell">'.$text.'</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
// add row of numeric fields
|
||||
print '<tr>';
|
||||
foreach ($numfields as $field) {
|
||||
if ($f[$field]['count']) {
|
||||
// print question if necessary
|
||||
if (!$printedquestion) {
|
||||
print '<td colspan="'.$colspan.'" class="generaltablecell"><b>'.$question['name']."</b></td></tr>\n<tr>";
|
||||
$printedquestion = true;
|
||||
}
|
||||
// print numeric response
|
||||
$value = isset($question[$field]) ? $question[$field] : '-';
|
||||
print '<th align="right" width="100" class="generaltableheader">'.$f[$field]['name'].':</th><td class="generaltablecell">'.$value.'</td>';
|
||||
}
|
||||
}
|
||||
print "</tr>\n";
|
||||
} // foreach $q
|
||||
}
|
||||
// finish table
|
||||
print "</table>\n";
|
||||
print_simple_box_end();
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1,68 +1,68 @@
|
|||
<?php // $Id$
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_login();
|
||||
// fetch and clean the required $_GET parameters
|
||||
// (script stops here if any parameters are missing)
|
||||
unset($params);
|
||||
$params->action = required_param('action');
|
||||
$params->course = required_param('course');
|
||||
$params->reference = required_param('reference');
|
||||
require_login($params->course);
|
||||
if (!isteacher($params->course)) {
|
||||
error("You are not allowed to view this page!");
|
||||
}
|
||||
if (isadmin()) {
|
||||
$params->location = optional_param('location', HOTPOT_LOCATION_COURSEFILES);
|
||||
} else {
|
||||
$params->location = HOTPOT_LOCATION_COURSEFILES;
|
||||
}
|
||||
$title = get_string($params->action, 'hotpot').': '.$params->reference;
|
||||
print_header($title, $title);
|
||||
hotpot_print_show_links($params->course, $params->location, $params->reference);
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_login();
|
||||
// fetch and clean the required $_GET parameters
|
||||
// (script stops here if any parameters are missing)
|
||||
unset($params);
|
||||
$params->action = required_param('action');
|
||||
$params->course = required_param('course');
|
||||
$params->reference = required_param('reference');
|
||||
require_login($params->course);
|
||||
if (!isteacher($params->course)) {
|
||||
error("You are not allowed to view this page!");
|
||||
}
|
||||
if (isadmin()) {
|
||||
$params->location = optional_param('location', HOTPOT_LOCATION_COURSEFILES);
|
||||
} else {
|
||||
$params->location = HOTPOT_LOCATION_COURSEFILES;
|
||||
}
|
||||
$title = get_string($params->action, 'hotpot').': '.$params->reference;
|
||||
print_header($title, $title);
|
||||
hotpot_print_show_links($params->course, $params->location, $params->reference);
|
||||
?>
|
||||
<script type="text/javascript" language="javascript">
|
||||
<!--
|
||||
// http://www.krikkit.net/howto_javascript_copy_clipboard.html
|
||||
function copy_contents(id) {
|
||||
if (id==null) {
|
||||
id = 'contents';
|
||||
}
|
||||
var obj = null;
|
||||
if (document.getElementById) {
|
||||
obj = document.getElementById(id);
|
||||
}
|
||||
if (obj && window.clipboardData) {
|
||||
window.clipboardData.setData("Text", obj.innerText);
|
||||
alert('<?php print_string('copiedtoclipboard', 'hotpot') ?>');
|
||||
}
|
||||
}
|
||||
document.write('<span class="helplink"> <a href="javascript:copy_contents()"><?php print_string('copytoclipboard', 'hotpot') ?></A></span>');
|
||||
// http://www.krikkit.net/howto_javascript_copy_clipboard.html
|
||||
function copy_contents(id) {
|
||||
if (id==null) {
|
||||
id = 'contents';
|
||||
}
|
||||
var obj = null;
|
||||
if (document.getElementById) {
|
||||
obj = document.getElementById(id);
|
||||
}
|
||||
if (obj && window.clipboardData) {
|
||||
window.clipboardData.setData("Text", obj.innerText);
|
||||
alert('<?php print_string('copiedtoclipboard', 'hotpot') ?>');
|
||||
}
|
||||
}
|
||||
document.write('<span class="helplink"> <a href="javascript:copy_contents()"><?php print_string('copytoclipboard', 'hotpot') ?></A></span>');
|
||||
-->
|
||||
</script>
|
||||
<?php
|
||||
print_simple_box_start("center", "96%");
|
||||
if($hp = new hotpot_xml_quiz($params)) {
|
||||
print '<pre id="contents">';
|
||||
switch ($params->action) {
|
||||
case 'showxmlsource':
|
||||
print htmlspecialchars($hp->source);
|
||||
break;
|
||||
case 'showxmltree':
|
||||
print_r($hp->xml);
|
||||
break;
|
||||
case 'showhtmlsource':
|
||||
print htmlspecialchars($hp->html);
|
||||
break;
|
||||
case 'showhtmlquiz':
|
||||
print $hp->html;
|
||||
break;
|
||||
}
|
||||
print '</pre>';
|
||||
} else {
|
||||
print_simple_box("Could not open Hot Potatoes XML file", "center", "", "#FFBBBB");
|
||||
}
|
||||
print_simple_box_end();
|
||||
print '<br />';
|
||||
close_window_button();
|
||||
print_simple_box_start("center", "96%");
|
||||
if($hp = new hotpot_xml_quiz($params)) {
|
||||
print '<pre id="contents">';
|
||||
switch ($params->action) {
|
||||
case 'showxmlsource':
|
||||
print htmlspecialchars($hp->source);
|
||||
break;
|
||||
case 'showxmltree':
|
||||
print_r($hp->xml);
|
||||
break;
|
||||
case 'showhtmlsource':
|
||||
print htmlspecialchars($hp->html);
|
||||
break;
|
||||
case 'showhtmlquiz':
|
||||
print $hp->html;
|
||||
break;
|
||||
}
|
||||
print '</pre>';
|
||||
} else {
|
||||
print_simple_box("Could not open Hot Potatoes XML file", "center", "", "#FFBBBB");
|
||||
}
|
||||
print_simple_box_end();
|
||||
print '<br />';
|
||||
close_window_button();
|
||||
?>
|
||||
|
|
|
@ -1,110 +1,110 @@
|
|||
<?PHP
|
||||
class hotpot_xml_template_default {
|
||||
function read_template($filename, $tag='temporary') {
|
||||
// create the file path to the template
|
||||
$filepath = $this->parent->template_dirpath.DIRECTORY_SEPARATOR.$filename;
|
||||
// try and open the template file
|
||||
if (!file_exists($filepath) || !is_readable($filepath)) {
|
||||
$msg = 'Could not open the '.$this->parent->template_dir.' template file "'.$filepath.'"';
|
||||
error($msg, $this->parent->course_homeurl);
|
||||
}
|
||||
// read in the template and close the file
|
||||
$this->$tag = file_get_contents($filepath);
|
||||
// expand the blocks and strings in the template
|
||||
$this->expand_blocks($tag);
|
||||
$this->expand_strings($tag);
|
||||
if ($tag=='temporary') {
|
||||
$template = $this->$tag;
|
||||
$this->$tag = '';
|
||||
return $template;
|
||||
}
|
||||
}
|
||||
function expand_blocks($tag) {
|
||||
// get block $names
|
||||
// [1] the full block name (including optional leading 'str' or 'incl')
|
||||
// [2] leading 'incl' or 'str', if any
|
||||
// [3] the real block name ([1] without [2])
|
||||
$search = '/\[\/((incl|str)?(\w+))\]/';
|
||||
preg_match_all($search, $this->$tag, $names);
|
||||
$i_max = count($names[0]);
|
||||
for ($i=0; $i<$i_max; $i++) {
|
||||
$method = $this->parent->template_dir.'_expand_'.$names[3][$i];
|
||||
if (method_exists($this, $method)) {
|
||||
eval('$value=$this->'.$method.'();');
|
||||
$search = '/\['.$names[1][$i].'\](.*?)\[\/'.$names[1][$i].'\]/s';
|
||||
preg_match_all($search, $this->$tag, $blocks);
|
||||
$ii_max = count($blocks[0]);
|
||||
for ($ii=0; $ii<$ii_max; $ii++) {
|
||||
$replace = empty($value) ? '' : $blocks[1][$ii];
|
||||
$this->$tag = str_replace($blocks[0][$ii], $replace, $this->$tag);
|
||||
}
|
||||
} else {
|
||||
$msg = 'Template block expand method not found: "'.$method.'"';
|
||||
error($msg, $this->parent->course_homeurl);
|
||||
}
|
||||
}
|
||||
}
|
||||
function expand_strings($tag, $search='') {
|
||||
if (empty($search)) {
|
||||
// default $search $pattern
|
||||
$search = '/\[(?:bool|int|str)(\\w+)\]/';
|
||||
}
|
||||
preg_match_all($search, $this->$tag, $matches);
|
||||
$i_max = count($matches[0]);
|
||||
for ($i=0; $i<$i_max; $i++) {
|
||||
$method = $this->parent->template_dir.'_expand_'.$matches[1][$i];
|
||||
if (method_exists($this, $method)) {
|
||||
eval('$replace=$this->'.$method.'();');
|
||||
$this->$tag = str_replace($matches[0][$i], $replace, $this->$tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
function bool_value($tags, $more_tags="[0]['#']") {
|
||||
$value = $this->parent->xml_value($tags, $more_tags);
|
||||
return empty($value) ? 'false' : 'true';
|
||||
}
|
||||
function int_value($tags, $more_tags="[0]['#']") {
|
||||
return intval($this->parent->xml_value($tags, $more_tags));
|
||||
}
|
||||
function js_value($tags, $more_tags="[0]['#']", $convert_to_unicode=false) {
|
||||
return $this->js_safe($this->parent->xml_value($tags, $more_tags), $convert_to_unicode);
|
||||
}
|
||||
function js_safe($str, $convert_to_unicode=false) {
|
||||
// encode a string for javascript
|
||||
// decode "<" and ">" - not necesary as it was done by xml_value()
|
||||
// $str = strtr($str, array('<' => '<', '>' => '>'));
|
||||
// escape single quotes and backslashes
|
||||
$str = strtr($str, array("'"=>"\\'", '\\'=>'\\\\'));
|
||||
// convert newlines (win = "\r\n", mac="\r", linix/unix="\n")
|
||||
$nl = '\\n'; // javascript newline
|
||||
$str = strtr($str, array("\r\n"=>$nl, "\r"=>$nl, "\n"=>$nl));
|
||||
// convert (hex and decimal) html entities to unicode, if required
|
||||
if ($convert_to_unicode) {
|
||||
$str = preg_replace('|&#x([0-9A-F]+);|i', '\\u\\1', $str);
|
||||
$str = preg_replace('|&#(\d+);|e', "'\\u'.sprintf('%04X', '\\1')", $str);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
function get_halfway_color($x, $y) {
|
||||
// returns the $color that is half way between $x and $y
|
||||
$color = $x; // default
|
||||
$rgb = '/^\#?([0-9a-f])([0-9a-f])([0-9a-f])$/i';
|
||||
$rrggbb = '/^\#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i';
|
||||
if ((
|
||||
preg_match($rgb, $x, $x_matches) ||
|
||||
preg_match($rrggbb, $x, $x_matches)
|
||||
) && (
|
||||
preg_match($rgb, $y, $y_matches) ||
|
||||
preg_match($rrggbb, $y, $y_matches)
|
||||
)) {
|
||||
$color = '#';
|
||||
for ($i=1; $i<=3; $i++) {
|
||||
$x_dec = hexdec($x_matches[$i]);
|
||||
$y_dec = hexdec($y_matches[$i]);
|
||||
$color .= sprintf('%02x', min($x_dec, $y_dec) + abs($x_dec-$y_dec)/2);
|
||||
}
|
||||
}
|
||||
return $color;
|
||||
}
|
||||
function read_template($filename, $tag='temporary') {
|
||||
// create the file path to the template
|
||||
$filepath = $this->parent->template_dirpath.DIRECTORY_SEPARATOR.$filename;
|
||||
// try and open the template file
|
||||
if (!file_exists($filepath) || !is_readable($filepath)) {
|
||||
$msg = 'Could not open the '.$this->parent->template_dir.' template file "'.$filepath.'"';
|
||||
error($msg, $this->parent->course_homeurl);
|
||||
}
|
||||
// read in the template and close the file
|
||||
$this->$tag = file_get_contents($filepath);
|
||||
// expand the blocks and strings in the template
|
||||
$this->expand_blocks($tag);
|
||||
$this->expand_strings($tag);
|
||||
if ($tag=='temporary') {
|
||||
$template = $this->$tag;
|
||||
$this->$tag = '';
|
||||
return $template;
|
||||
}
|
||||
}
|
||||
function expand_blocks($tag) {
|
||||
// get block $names
|
||||
// [1] the full block name (including optional leading 'str' or 'incl')
|
||||
// [2] leading 'incl' or 'str', if any
|
||||
// [3] the real block name ([1] without [2])
|
||||
$search = '/\[\/((incl|str)?(\w+))\]/';
|
||||
preg_match_all($search, $this->$tag, $names);
|
||||
$i_max = count($names[0]);
|
||||
for ($i=0; $i<$i_max; $i++) {
|
||||
$method = $this->parent->template_dir.'_expand_'.$names[3][$i];
|
||||
if (method_exists($this, $method)) {
|
||||
eval('$value=$this->'.$method.'();');
|
||||
$search = '/\['.$names[1][$i].'\](.*?)\[\/'.$names[1][$i].'\]/s';
|
||||
preg_match_all($search, $this->$tag, $blocks);
|
||||
$ii_max = count($blocks[0]);
|
||||
for ($ii=0; $ii<$ii_max; $ii++) {
|
||||
$replace = empty($value) ? '' : $blocks[1][$ii];
|
||||
$this->$tag = str_replace($blocks[0][$ii], $replace, $this->$tag);
|
||||
}
|
||||
} else {
|
||||
$msg = 'Template block expand method not found: "'.$method.'"';
|
||||
error($msg, $this->parent->course_homeurl);
|
||||
}
|
||||
}
|
||||
}
|
||||
function expand_strings($tag, $search='') {
|
||||
if (empty($search)) {
|
||||
// default $search $pattern
|
||||
$search = '/\[(?:bool|int|str)(\\w+)\]/';
|
||||
}
|
||||
preg_match_all($search, $this->$tag, $matches);
|
||||
$i_max = count($matches[0]);
|
||||
for ($i=0; $i<$i_max; $i++) {
|
||||
$method = $this->parent->template_dir.'_expand_'.$matches[1][$i];
|
||||
if (method_exists($this, $method)) {
|
||||
eval('$replace=$this->'.$method.'();');
|
||||
$this->$tag = str_replace($matches[0][$i], $replace, $this->$tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
function bool_value($tags, $more_tags="[0]['#']") {
|
||||
$value = $this->parent->xml_value($tags, $more_tags);
|
||||
return empty($value) ? 'false' : 'true';
|
||||
}
|
||||
function int_value($tags, $more_tags="[0]['#']") {
|
||||
return intval($this->parent->xml_value($tags, $more_tags));
|
||||
}
|
||||
function js_value($tags, $more_tags="[0]['#']", $convert_to_unicode=false) {
|
||||
return $this->js_safe($this->parent->xml_value($tags, $more_tags), $convert_to_unicode);
|
||||
}
|
||||
function js_safe($str, $convert_to_unicode=false) {
|
||||
// encode a string for javascript
|
||||
// decode "<" and ">" - not necesary as it was done by xml_value()
|
||||
// $str = strtr($str, array('<' => '<', '>' => '>'));
|
||||
// escape single quotes and backslashes
|
||||
$str = strtr($str, array("'"=>"\\'", '\\'=>'\\\\'));
|
||||
// convert newlines (win = "\r\n", mac="\r", linix/unix="\n")
|
||||
$nl = '\\n'; // javascript newline
|
||||
$str = strtr($str, array("\r\n"=>$nl, "\r"=>$nl, "\n"=>$nl));
|
||||
// convert (hex and decimal) html entities to unicode, if required
|
||||
if ($convert_to_unicode) {
|
||||
$str = preg_replace('|&#x([0-9A-F]+);|i', '\\u\\1', $str);
|
||||
$str = preg_replace('|&#(\d+);|e', "'\\u'.sprintf('%04X', '\\1')", $str);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
function get_halfway_color($x, $y) {
|
||||
// returns the $color that is half way between $x and $y
|
||||
$color = $x; // default
|
||||
$rgb = '/^\#?([0-9a-f])([0-9a-f])([0-9a-f])$/i';
|
||||
$rrggbb = '/^\#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i';
|
||||
if ((
|
||||
preg_match($rgb, $x, $x_matches) ||
|
||||
preg_match($rrggbb, $x, $x_matches)
|
||||
) && (
|
||||
preg_match($rgb, $y, $y_matches) ||
|
||||
preg_match($rrggbb, $y, $y_matches)
|
||||
)) {
|
||||
$color = '#';
|
||||
for ($i=1; $i<=3; $i++) {
|
||||
$x_dec = hexdec($x_matches[$i]);
|
||||
$y_dec = hexdec($y_matches[$i]);
|
||||
$color .= sprintf('%02x', min($x_dec, $y_dec) + abs($x_dec-$y_dec)/2);
|
||||
}
|
||||
}
|
||||
return $color;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,455 +1,455 @@
|
|||
<?PHP // $Id$
|
||||
/// This page prints a hotpot quiz
|
||||
if (defined('HOTPOT_FIRST_ATTEMPT') && HOTPOT_FIRST_ATTEMPT==false) {
|
||||
// this script is being included (by attempt.php)
|
||||
} else {
|
||||
// this script is being called directly from the browser
|
||||
define('HOTPOT_FIRST_ATTEMPT', true);
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
/// This page prints a hotpot quiz
|
||||
if (defined('HOTPOT_FIRST_ATTEMPT') && HOTPOT_FIRST_ATTEMPT==false) {
|
||||
// this script is being included (by attempt.php)
|
||||
} else {
|
||||
// this script is being called directly from the browser
|
||||
define('HOTPOT_FIRST_ATTEMPT', true);
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
$id = optional_param("id"); // Course Module ID, or
|
||||
$hp = optional_param("hp"); // hotpot ID
|
||||
$id = optional_param("id"); // Course Module ID, or
|
||||
$hp = optional_param("hp"); // hotpot ID
|
||||
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
}
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
if ($id) {
|
||||
if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
}
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
|
||||
} else {
|
||||
if (! $hotpot = get_record("hotpot", "id", $hp)) {
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
if (! $course = get_record("course", "id", $hotpot->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
}
|
||||
}
|
||||
require_login($course->id);
|
||||
}
|
||||
// set nextpage (for error messages)
|
||||
$nextpage = "$CFG->wwwroot/course/view.php?id=$course->id";
|
||||
// header strings
|
||||
$title = strip_tags($course->shortname.': '.$hotpot->name);
|
||||
$heading = "$course->fullname";
|
||||
$target = empty($CFG->framename) ? '' : ' target="'.$CFG->framename.'"';
|
||||
$navigation = '<a'.$target.' href="'.$CFG->wwwroot.'/mod/hotpot/index.php?id='.$course->id.'">'.get_string("modulenameplural", "hotpot")."</a> -> $hotpot->name";
|
||||
if ($course->category) {
|
||||
$navigation = '<a'.$target.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> -> '.$navigation;
|
||||
}
|
||||
$button = update_module_button($cm->id, $course->id, get_string("modulename", "hotpot").'" style="font-size:0.75em;');
|
||||
$loggedinas = '<span class="logininfo">'.user_login_string($course, $USER).'</span>';
|
||||
$time = time();
|
||||
$hppassword = optional_param('hppassword');
|
||||
if (HOTPOT_FIRST_ATTEMPT && !isteacher($course->id)) {
|
||||
// check this quiz is available to this student
|
||||
// error message, if quiz is unavailable
|
||||
$error = '';
|
||||
// check quiz is visible
|
||||
if (!hotpot_is_visible($cm)) {
|
||||
$error = get_string("activityiscurrentlyhidden");
|
||||
// check network address
|
||||
} else if ($hotpot->subnet && !address_in_subnet($_SERVER['REMOTE_ADDR'], $hotpot->subnet)) {
|
||||
$error = get_string("subneterror", "quiz");
|
||||
// check number of attempts
|
||||
} else if ($hotpot->attempts && $hotpot->attempts <= count_records('hotpot_attempts', 'hotpot', $hotpot->id, 'userid', $USER->id)) {
|
||||
$error = get_string("nomoreattempts", "quiz");
|
||||
// get password
|
||||
} else if ($hotpot->password && empty($hppassword)) {
|
||||
print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas, false);
|
||||
print_heading($hotpot->name);
|
||||
$boxalign = 'center';
|
||||
$boxwidth = 500;
|
||||
if (trim(strip_tags($hotpot->summary))) {
|
||||
print_simple_box_start($boxalign, $boxwidth);
|
||||
print '<div align="center">'.format_text($hotpot->summary)."</div>\n";
|
||||
print_simple_box_end();
|
||||
print "<br />\n";
|
||||
}
|
||||
print '<form name="passwordform" method="post" action="view.php?id='.$cm->id.'">'."\n";
|
||||
print_simple_box_start($boxalign, $boxwidth);
|
||||
print '<div align="center">';
|
||||
print get_string('requirepasswordmessage', 'quiz').'<br /><br />';
|
||||
print '<b>'.get_string('password').':</b> ';
|
||||
print '<input name="hppassword" type="password" value=""> ';
|
||||
print '<input type="submit" value="'.get_string("ok").'"> ';
|
||||
print "</div>\n";
|
||||
print_simple_box_end();
|
||||
print "</form>\n";
|
||||
print_footer();
|
||||
exit;
|
||||
// check password
|
||||
} else if ($hotpot->password && strcmp($hotpot->password, $hppassword)) {
|
||||
$error = get_string("passworderror", "quiz");
|
||||
$nextpage = "view.php?id=$cm->id";
|
||||
// check quiz is open
|
||||
} else if ($hotpot->timeopen && $hotpot->timeopen > $time) {
|
||||
$error = get_string("quiznotavailable", "quiz", userdate($hotpot->timeopen))."<br />\n";
|
||||
// check quiz is not closed
|
||||
} else if ($hotpot->timeclose && $hotpot->timeclose < $time) {
|
||||
$error = get_string("quizclosed", "quiz", userdate($hotpot->timeclose))."<br />\n";
|
||||
}
|
||||
if ($error) {
|
||||
print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas, false);
|
||||
notice($error, $nextpage);
|
||||
//
|
||||
// script stops here, if quiz is unavailable to student
|
||||
//
|
||||
}
|
||||
}
|
||||
$available_msg = '';
|
||||
if (!empty($hotpot->timeclose) && $hotpot->timeclose > $time) {
|
||||
// quiz is available until 'timeclose'
|
||||
$available_msg = get_string("quizavailable", "quiz", userdate($hotpot->timeclose))."<br />\n";
|
||||
}
|
||||
// open and parse the source file
|
||||
if(!$hp = new hotpot_xml_quiz($hotpot)) {
|
||||
error("Quiz is unavailable at the moment");
|
||||
}
|
||||
$get_js = optional_param('js');
|
||||
$get_css = optional_param('css');
|
||||
$framename = optional_param('framename');
|
||||
// look for <frameset> (HP5 v5)
|
||||
$frameset = '';
|
||||
$frameset_tags = '';
|
||||
if (preg_match_all('|<frameset([^>]*)>(.*?)</frameset>|is', $hp->html, $matches)) {
|
||||
$last = count($matches[0])-1;
|
||||
$frameset = $matches[2][$last];
|
||||
$frameset_tags = $matches[1][$last];
|
||||
}
|
||||
// if HTML is being requested ...
|
||||
if (empty($get_js) && empty($get_css)) {
|
||||
if (empty($frameset)) {
|
||||
// HP v6
|
||||
if ($hotpot->navigation==HOTPOT_NAVIGATION_FRAME || $hotpot->navigation==HOTPOT_NAVIGATION_IFRAME) {
|
||||
$get_html = ($framename=='main') ? true : false;
|
||||
} else {
|
||||
$get_html = true;
|
||||
}
|
||||
} else {
|
||||
// HP5 v5
|
||||
$get_html = empty($framename) ? true : false;
|
||||
}
|
||||
if ($get_html) {
|
||||
|
||||
if (HOTPOT_FIRST_ATTEMPT) {
|
||||
add_to_log($course->id, "hotpot", "view", "view.php?id=$cm->id", "$hotpot->id", "$cm->id");
|
||||
} else {
|
||||
if (! $hotpot = get_record("hotpot", "id", $hp)) {
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
if (! $course = get_record("course", "id", $hotpot->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
}
|
||||
}
|
||||
require_login($course->id);
|
||||
}
|
||||
// set nextpage (for error messages)
|
||||
$nextpage = "$CFG->wwwroot/course/view.php?id=$course->id";
|
||||
// header strings
|
||||
$title = strip_tags($course->shortname.': '.$hotpot->name);
|
||||
$heading = "$course->fullname";
|
||||
$target = empty($CFG->framename) ? '' : ' target="'.$CFG->framename.'"';
|
||||
$navigation = '<a'.$target.' href="'.$CFG->wwwroot.'/mod/hotpot/index.php?id='.$course->id.'">'.get_string("modulenameplural", "hotpot")."</a> -> $hotpot->name";
|
||||
if ($course->category) {
|
||||
$navigation = '<a'.$target.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> -> '.$navigation;
|
||||
}
|
||||
$button = update_module_button($cm->id, $course->id, get_string("modulename", "hotpot").'" style="font-size:0.75em;');
|
||||
$loggedinas = '<span class="logininfo">'.user_login_string($course, $USER).'</span>';
|
||||
$time = time();
|
||||
$hppassword = optional_param('hppassword');
|
||||
if (HOTPOT_FIRST_ATTEMPT && !isteacher($course->id)) {
|
||||
// check this quiz is available to this student
|
||||
// error message, if quiz is unavailable
|
||||
$error = '';
|
||||
// check quiz is visible
|
||||
if (!hotpot_is_visible($cm)) {
|
||||
$error = get_string("activityiscurrentlyhidden");
|
||||
// check network address
|
||||
} else if ($hotpot->subnet && !address_in_subnet($_SERVER['REMOTE_ADDR'], $hotpot->subnet)) {
|
||||
$error = get_string("subneterror", "quiz");
|
||||
// check number of attempts
|
||||
} else if ($hotpot->attempts && $hotpot->attempts <= count_records('hotpot_attempts', 'hotpot', $hotpot->id, 'userid', $USER->id)) {
|
||||
$error = get_string("nomoreattempts", "quiz");
|
||||
// get password
|
||||
} else if ($hotpot->password && empty($hppassword)) {
|
||||
print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas, false);
|
||||
print_heading($hotpot->name);
|
||||
$boxalign = 'center';
|
||||
$boxwidth = 500;
|
||||
if (trim(strip_tags($hotpot->summary))) {
|
||||
print_simple_box_start($boxalign, $boxwidth);
|
||||
print '<div align="center">'.format_text($hotpot->summary)."</div>\n";
|
||||
print_simple_box_end();
|
||||
print "<br />\n";
|
||||
}
|
||||
print '<form name="passwordform" method="post" action="view.php?id='.$cm->id.'">'."\n";
|
||||
print_simple_box_start($boxalign, $boxwidth);
|
||||
print '<div align="center">';
|
||||
print get_string('requirepasswordmessage', 'quiz').'<br /><br />';
|
||||
print '<b>'.get_string('password').':</b> ';
|
||||
print '<input name="hppassword" type="password" value=""> ';
|
||||
print '<input type="submit" value="'.get_string("ok").'"> ';
|
||||
print "</div>\n";
|
||||
print_simple_box_end();
|
||||
print "</form>\n";
|
||||
print_footer();
|
||||
exit;
|
||||
// check password
|
||||
} else if ($hotpot->password && strcmp($hotpot->password, $hppassword)) {
|
||||
$error = get_string("passworderror", "quiz");
|
||||
$nextpage = "view.php?id=$cm->id";
|
||||
// check quiz is open
|
||||
} else if ($hotpot->timeopen && $hotpot->timeopen > $time) {
|
||||
$error = get_string("quiznotavailable", "quiz", userdate($hotpot->timeopen))."<br />\n";
|
||||
// check quiz is not closed
|
||||
} else if ($hotpot->timeclose && $hotpot->timeclose < $time) {
|
||||
$error = get_string("quizclosed", "quiz", userdate($hotpot->timeclose))."<br />\n";
|
||||
}
|
||||
if ($error) {
|
||||
print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas, false);
|
||||
notice($error, $nextpage);
|
||||
//
|
||||
// script stops here, if quiz is unavailable to student
|
||||
//
|
||||
}
|
||||
}
|
||||
$available_msg = '';
|
||||
if (!empty($hotpot->timeclose) && $hotpot->timeclose > $time) {
|
||||
// quiz is available until 'timeclose'
|
||||
$available_msg = get_string("quizavailable", "quiz", userdate($hotpot->timeclose))."<br />\n";
|
||||
}
|
||||
// open and parse the source file
|
||||
if(!$hp = new hotpot_xml_quiz($hotpot)) {
|
||||
error("Quiz is unavailable at the moment");
|
||||
}
|
||||
$get_js = optional_param('js');
|
||||
$get_css = optional_param('css');
|
||||
$framename = optional_param('framename');
|
||||
// look for <frameset> (HP5 v5)
|
||||
$frameset = '';
|
||||
$frameset_tags = '';
|
||||
if (preg_match_all('|<frameset([^>]*)>(.*?)</frameset>|is', $hp->html, $matches)) {
|
||||
$last = count($matches[0])-1;
|
||||
$frameset = $matches[2][$last];
|
||||
$frameset_tags = $matches[1][$last];
|
||||
}
|
||||
// if HTML is being requested ...
|
||||
if (empty($get_js) && empty($get_css)) {
|
||||
if (empty($frameset)) {
|
||||
// HP v6
|
||||
if ($hotpot->navigation==HOTPOT_NAVIGATION_FRAME || $hotpot->navigation==HOTPOT_NAVIGATION_IFRAME) {
|
||||
$get_html = ($framename=='main') ? true : false;
|
||||
} else {
|
||||
$get_html = true;
|
||||
}
|
||||
} else {
|
||||
// HP5 v5
|
||||
$get_html = empty($framename) ? true : false;
|
||||
}
|
||||
if ($get_html) {
|
||||
|
||||
if (HOTPOT_FIRST_ATTEMPT) {
|
||||
add_to_log($course->id, "hotpot", "view", "view.php?id=$cm->id", "$hotpot->id", "$cm->id");
|
||||
|
||||
$attemptid = hotpot_add_attempt($hotpot->id);
|
||||
if (! is_numeric($attemptid)) {
|
||||
error('Could not insert attempt record: '.$db->ErrorMsg);
|
||||
}
|
||||
}
|
||||
$hp->adjust_media_urls();
|
||||
if (empty($frameset)) {
|
||||
// HP6 v6
|
||||
switch ($hotpot->navigation) {
|
||||
case HOTPOT_NAVIGATION_BUTTONS:
|
||||
// do nothing (i.e. leave buttons as they are)
|
||||
break;
|
||||
case HOTPOT_NAVIGATION_GIVEUP:
|
||||
$hp->insert_giveup_form($attemptid, '<!-- BeginTopNavButtons -->', '<!-- EndTopNavButtons -->');
|
||||
break;
|
||||
default:
|
||||
$hp->remove_nav_buttons();
|
||||
}
|
||||
if (isset($hp->real_outputformat) && $hp->real_outputformat==HOTPOT_OUTPUTFORMAT_MOBILE) {
|
||||
$hp->insert_submission_form($attemptid, '<!-- BeginSubmissionForm -->', '<!-- EndSubmissionForm -->', true);
|
||||
} else {
|
||||
$hp->insert_submission_form($attemptid, '<!-- BeginSubmissionForm -->', '<!-- EndSubmissionForm -->');
|
||||
}
|
||||
} else {
|
||||
// HP5 v5
|
||||
switch ($hotpot->navigation) {
|
||||
case HOTPOT_NAVIGATION_BUTTONS:
|
||||
// convert URLs in nav buttons
|
||||
break;
|
||||
case HOTPOT_NAVIGATION_GIVEUP:
|
||||
// $hp->insert_giveup_form($attemptid, '<!-- BeginTopNavButtons -->', '<!-- EndTopNavButtons -->');
|
||||
break;
|
||||
default:
|
||||
// remove navigation buttons
|
||||
$hp->html = preg_replace('#NavBar\+=(.*);#', '', $hp->html);
|
||||
}
|
||||
$hp->insert_submission_form($attemptid, "var NavBar='", "';");
|
||||
}
|
||||
}
|
||||
}
|
||||
//FEEDBACK = new Array();
|
||||
//FEEDBACK[0] = ''; // url of feedback page/script
|
||||
//FEEDBACK[1] = ''; // array of array('teachername', 'value');
|
||||
//FEEDBACK[2] = ''; // 'student name' [formmail only]
|
||||
//FEEDBACK[3] = ''; // 'student email' [formmail only]
|
||||
//FEEDBACK[4] = ''; // window width
|
||||
//FEEDBACK[5] = ''; // window height
|
||||
//FEEDBACK[6] = ''; // 'Send a message to teacher' [prompt/button text]
|
||||
//FEEDBACK[7] = ''; // 'Title'
|
||||
//FEEDBACK[8] = ''; // 'Teacher'
|
||||
//FEEDBACK[9] = ''; // 'Message'
|
||||
//FEEDBACK[10] = ''; // 'Close this window'
|
||||
$feedback = array();
|
||||
switch ($hotpot->studentfeedback) {
|
||||
case HOTPOT_FEEDBACK_NONE:
|
||||
// do nothing
|
||||
break;
|
||||
case HOTPOT_FEEDBACK_WEBPAGE:
|
||||
if (empty($hotpot->studentfeedbackurl)) {
|
||||
$hotpot->studentfeedback = HOTPOT_FEEDBACK_NONE;
|
||||
} else {
|
||||
$feedback[0] = "'$hotpot->studentfeedbackurl'";
|
||||
}
|
||||
break;
|
||||
case HOTPOT_FEEDBACK_FORMMAIL:
|
||||
$teachers = hotpot_feedback_teachers($course, $hotpot);
|
||||
if (empty($teachers) || empty($hotpot->studentfeedbackurl)) {
|
||||
$hotpot->studentfeedback = HOTPOT_FEEDBACK_NONE;
|
||||
} else {
|
||||
$feedback[0] = "'$hotpot->studentfeedbackurl'";
|
||||
$feedback[1] = $teachers;
|
||||
$feedback[2] = "'".fullname($USER)."'";
|
||||
$feedback[3] = "'".$USER->email."'";
|
||||
$feedback[4] = 500; // width
|
||||
$feedback[5] = 300; // height
|
||||
}
|
||||
break;
|
||||
case HOTPOT_FEEDBACK_MOODLEFORUM:
|
||||
$module = get_record('modules', 'name', 'forum');
|
||||
$forums = get_records('forum', 'course', "$course->id");
|
||||
if (empty($module) || empty($module->visible) || empty($forums)) {
|
||||
$hotpot->studentfeedback = HOTPOT_FEEDBACK_NONE;
|
||||
} else {
|
||||
$feedback[0] = "'$CFG->wwwroot/mod/forum/index.php?id=$course->id'";
|
||||
}
|
||||
break;
|
||||
case HOTPOT_FEEDBACK_MOODLEMESSAGING:
|
||||
$teachers = hotpot_feedback_teachers($course, $hotpot);
|
||||
if (empty($CFG->messaging) || empty($teachers)) {
|
||||
$hotpot->studentfeedback = HOTPOT_FEEDBACK_NONE;
|
||||
} else {
|
||||
$feedback[0] = "'$CFG->wwwroot/message/discussion.php?id='";
|
||||
$feedback[1] = $teachers;
|
||||
$feedback[4] = 400; // width
|
||||
$feedback[5] = 500; // height
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// do nothing
|
||||
}
|
||||
if ($hotpot->studentfeedback != HOTPOT_FEEDBACK_NONE) {
|
||||
$feedback[6] = "'Send a message to teacher'";
|
||||
$feedback[7] = "'Title'";
|
||||
$feedback[8] = "'Teacher'";
|
||||
$feedback[9] = "'Message'";
|
||||
$feedback[10] = "'Close this window'";
|
||||
$js = '';
|
||||
foreach ($feedback as $i=>$str) {
|
||||
$js .= 'FEEDBACK['.$i."] = $str;\n";
|
||||
}
|
||||
$js = '<script type="text/javascript" language="javascript">'."<!--\n"."FEEDBACK = new Array();\n".$js."//--></script>\n";
|
||||
$hp->html = preg_replace('|</head>|i', "$js</head>", $hp->html, 1);
|
||||
}
|
||||
// insert hot-potatoes.js
|
||||
$hp->insert_script(HOTPOT_JS);
|
||||
// extract first <head> tag
|
||||
$head = '';
|
||||
$pattern = '|<head([^>]*)>(.*?)</head>|is';
|
||||
if (preg_match($pattern, $hp->html, $matches)) {
|
||||
$head = $matches[2];
|
||||
// remove <title>
|
||||
$head = preg_replace('|<title[^>]*>(.*?)</title>|is', '', $head);
|
||||
}
|
||||
// extract <style> tags (and remove from $head)
|
||||
$styles = '';
|
||||
$pattern = '|<style([^>]*)>(.*?)</style>|is';
|
||||
if (preg_match_all($pattern, $head, $matches)) {
|
||||
$count = count($matches[0]);
|
||||
for ($i=0; $i<$count; $i++) {
|
||||
$styles .= $matches[0][$i]."\n";
|
||||
$head = str_replace($matches[0][$i], '', $head);
|
||||
}
|
||||
}
|
||||
// extract <script> tags (and remove from $head)
|
||||
$scripts = '';
|
||||
$pattern = '|<script([^>]*)>(.*?)</script>|is';
|
||||
if (preg_match_all($pattern, $head, $matches)) {
|
||||
$count = count($matches[0]);
|
||||
for ($i=0; $i<$count; $i++) {
|
||||
$scripts .= $matches[0][$i]."\n";
|
||||
$head = str_replace($matches[0][$i], '', $head);
|
||||
}
|
||||
}
|
||||
// extract <body> tags
|
||||
$body = '';
|
||||
$body_tags = '';
|
||||
$footer = '</html>';
|
||||
// HP6 and some HP5 (v6 and v4)
|
||||
if (preg_match('|<body'.'([^>]*'.'onLoad=(["\'])(.*?)(\\2)'.'[^>]*)'.'>(.*)</body>|is', $hp->html, $matches)) {
|
||||
$body = $matches[5]; // contents of first <body onload="StartUp()">...</body> block
|
||||
$body_tags = $matches[1];
|
||||
// workaround to ensure javascript onload routine for quiz is always executed
|
||||
// $body_tags will only be inserted into the <body ...> tag
|
||||
// if it is included in the theme/$CFG->theme/header.html,
|
||||
// so some old or modified themes may not insert $body_tags
|
||||
$body .= ""
|
||||
. '<script type="text/javascript">'."\n"
|
||||
. "<!--\n"
|
||||
. " var s = (typeof(window.onload)=='function') ? onload.toString() : '';\n"
|
||||
. " if (s.indexOf('".$matches[3]."')<0) {\n"
|
||||
. " if (s=='') {\n" // no previous onload
|
||||
. " window.onload = new Function('".$matches[3]."');\n"
|
||||
. " } else {\n"
|
||||
. " window.onload_hotpot = onload;\n"
|
||||
. " window.onload = new Function('window.onload_hotpot();'+'".$matches[3]."');\n"
|
||||
. " }\n"
|
||||
. " }\n"
|
||||
. "//-->\n"
|
||||
. "</script>\n"
|
||||
;
|
||||
$footer = '</body>'.$footer;
|
||||
} else if ($frameset) { // HP5 v5
|
||||
switch ($framename) {
|
||||
case 'top':
|
||||
print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas);
|
||||
print $footer;
|
||||
break;
|
||||
default:
|
||||
// add a HotPot navigation frame at the top of the page
|
||||
//$rows = empty($CFG->resource_framesize) ? 85 : $CFG->resource_framesize;
|
||||
//$frameset = "\n\t".'<frame src="view.php?id='.$cm->id.'&framename=top" frameborder="0" name="top"></frame>'.$frameset;
|
||||
//$frameset_tags = preg_replace('|rows="(.*?)"|', 'rows="'.$rows.',\\1"', $frameset_tags);
|
||||
// put navigation into var NavBar='';
|
||||
// add form to TopFrame in "WriteFeedback" function
|
||||
// OR add form to BottomFrame in "DisplayExercise" function
|
||||
// submission form: '<!-- BeginSubmissionForm -->', '<!-- EndSubmissionForm -->'
|
||||
// give up form: '<!-- BeginTopNavButtons -->', '<!-- EndTopNavButtons -->'
|
||||
print "<html>\n";
|
||||
print "<head>\n<title>$title</title>\n$styles\n$scripts</head>\n";
|
||||
print "<frameset$frameset_tags>$frameset</frameset>\n";
|
||||
print "</html>\n";
|
||||
break;
|
||||
} // end switch $framename
|
||||
exit;
|
||||
// other files (maybe not even a HotPots)
|
||||
} else if (preg_match('|<body'.'([^>]*)'.'>(.*)</body>|is', $hp->html, $matches)) {
|
||||
$body = $matches[2];
|
||||
$body_tags = $matches[1];
|
||||
}
|
||||
// print the quiz to the browser
|
||||
if ($get_js) {
|
||||
print($scripts);
|
||||
exit;
|
||||
}
|
||||
if ($get_css) {
|
||||
print($styles);
|
||||
exit;
|
||||
}
|
||||
switch ($hotpot->navigation) {
|
||||
case HOTPOT_NAVIGATION_BAR:
|
||||
//update_module_button($cm->id, $course->id, $strmodulename.'" style="font-size:0.8em')
|
||||
print_header(
|
||||
$title, $heading, $navigation,
|
||||
"", $head.$styles.$scripts, true, $button,
|
||||
$loggedinas, false, $body_tags
|
||||
);
|
||||
if (!empty($available_msg)) {
|
||||
notify($available_msg);
|
||||
}
|
||||
print $body.$footer;
|
||||
break;
|
||||
case HOTPOT_NAVIGATION_FRAME:
|
||||
switch ($framename) {
|
||||
case 'top':
|
||||
print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas);
|
||||
print $footer;
|
||||
break;
|
||||
case 'main':
|
||||
if (!empty($available_msg)) {
|
||||
$hp->insert_message('<!-- BeginTopNavButtons -->', $available_msg);
|
||||
}
|
||||
print $hp->html;
|
||||
break;
|
||||
default:
|
||||
$rows = empty($CFG->resource_framesize) ? 85 : $CFG->resource_framesize;
|
||||
print "<html>\n";
|
||||
print "<head><title>$title</title></head>\n";
|
||||
print "<frameset rows=$rows,*>\n";
|
||||
print "<frame src=\"view.php?id=$cm->id&framename=top\">\n";
|
||||
print "<frame src=\"view.php?id=$cm->id&framename=main\">\n";
|
||||
print "</frameset>\n";
|
||||
print "</html>\n";
|
||||
break;
|
||||
} // end switch $framename
|
||||
break;
|
||||
case HOTPOT_NAVIGATION_IFRAME:
|
||||
switch ($framename) {
|
||||
case 'main':
|
||||
print $hp->html;
|
||||
break;
|
||||
default:
|
||||
$iframe_id = 'hotpot_iframe';
|
||||
$body_tags = " onload=\"set_iframe_height('$iframe_id')\"";
|
||||
$iframe_js = '<script src="iframe.js" type="text/javascript" language="javascript"></script>'."\n";
|
||||
print_header(
|
||||
$title, $heading, $navigation,
|
||||
"", $head.$styles.$scripts.$iframe_js, true, $button,
|
||||
$loggedinas, false, $body_tags
|
||||
);
|
||||
if (!empty($available_msg)) {
|
||||
notify($available_msg);
|
||||
}
|
||||
print "<iframe id=\"$iframe_id\" src=\"view.php?id=$cm->id&framename=main\" height=\"100%\" width=\"100%\">";
|
||||
print "<ilayer name=\"$iframe_id\" src=\"view.php?id=$cm->id&framename=main\" height=\"100%\" width=\"100%\">";
|
||||
print "</ilayer>\n";
|
||||
print "</iframe>\n";
|
||||
print $footer;
|
||||
break;
|
||||
} // end switch $framename
|
||||
break;
|
||||
default:
|
||||
// HOTPOT_NAVIGATION_BUTTONS
|
||||
// HOTPOT_NAVIGATION_GIVEUP
|
||||
// HOTPOT_NAVIGATION_NONE
|
||||
if (!empty($available_msg)) {
|
||||
$hp->insert_message('<!-- BeginTopNavButtons -->', $available_msg);
|
||||
}
|
||||
print($hp->html);
|
||||
}
|
||||
$attemptid = hotpot_add_attempt($hotpot->id);
|
||||
if (! is_numeric($attemptid)) {
|
||||
error('Could not insert attempt record: '.$db->ErrorMsg);
|
||||
}
|
||||
}
|
||||
$hp->adjust_media_urls();
|
||||
if (empty($frameset)) {
|
||||
// HP6 v6
|
||||
switch ($hotpot->navigation) {
|
||||
case HOTPOT_NAVIGATION_BUTTONS:
|
||||
// do nothing (i.e. leave buttons as they are)
|
||||
break;
|
||||
case HOTPOT_NAVIGATION_GIVEUP:
|
||||
$hp->insert_giveup_form($attemptid, '<!-- BeginTopNavButtons -->', '<!-- EndTopNavButtons -->');
|
||||
break;
|
||||
default:
|
||||
$hp->remove_nav_buttons();
|
||||
}
|
||||
if (isset($hp->real_outputformat) && $hp->real_outputformat==HOTPOT_OUTPUTFORMAT_MOBILE) {
|
||||
$hp->insert_submission_form($attemptid, '<!-- BeginSubmissionForm -->', '<!-- EndSubmissionForm -->', true);
|
||||
} else {
|
||||
$hp->insert_submission_form($attemptid, '<!-- BeginSubmissionForm -->', '<!-- EndSubmissionForm -->');
|
||||
}
|
||||
} else {
|
||||
// HP5 v5
|
||||
switch ($hotpot->navigation) {
|
||||
case HOTPOT_NAVIGATION_BUTTONS:
|
||||
// convert URLs in nav buttons
|
||||
break;
|
||||
case HOTPOT_NAVIGATION_GIVEUP:
|
||||
// $hp->insert_giveup_form($attemptid, '<!-- BeginTopNavButtons -->', '<!-- EndTopNavButtons -->');
|
||||
break;
|
||||
default:
|
||||
// remove navigation buttons
|
||||
$hp->html = preg_replace('#NavBar\+=(.*);#', '', $hp->html);
|
||||
}
|
||||
$hp->insert_submission_form($attemptid, "var NavBar='", "';");
|
||||
}
|
||||
}
|
||||
}
|
||||
//FEEDBACK = new Array();
|
||||
//FEEDBACK[0] = ''; // url of feedback page/script
|
||||
//FEEDBACK[1] = ''; // array of array('teachername', 'value');
|
||||
//FEEDBACK[2] = ''; // 'student name' [formmail only]
|
||||
//FEEDBACK[3] = ''; // 'student email' [formmail only]
|
||||
//FEEDBACK[4] = ''; // window width
|
||||
//FEEDBACK[5] = ''; // window height
|
||||
//FEEDBACK[6] = ''; // 'Send a message to teacher' [prompt/button text]
|
||||
//FEEDBACK[7] = ''; // 'Title'
|
||||
//FEEDBACK[8] = ''; // 'Teacher'
|
||||
//FEEDBACK[9] = ''; // 'Message'
|
||||
//FEEDBACK[10] = ''; // 'Close this window'
|
||||
$feedback = array();
|
||||
switch ($hotpot->studentfeedback) {
|
||||
case HOTPOT_FEEDBACK_NONE:
|
||||
// do nothing
|
||||
break;
|
||||
case HOTPOT_FEEDBACK_WEBPAGE:
|
||||
if (empty($hotpot->studentfeedbackurl)) {
|
||||
$hotpot->studentfeedback = HOTPOT_FEEDBACK_NONE;
|
||||
} else {
|
||||
$feedback[0] = "'$hotpot->studentfeedbackurl'";
|
||||
}
|
||||
break;
|
||||
case HOTPOT_FEEDBACK_FORMMAIL:
|
||||
$teachers = hotpot_feedback_teachers($course, $hotpot);
|
||||
if (empty($teachers) || empty($hotpot->studentfeedbackurl)) {
|
||||
$hotpot->studentfeedback = HOTPOT_FEEDBACK_NONE;
|
||||
} else {
|
||||
$feedback[0] = "'$hotpot->studentfeedbackurl'";
|
||||
$feedback[1] = $teachers;
|
||||
$feedback[2] = "'".fullname($USER)."'";
|
||||
$feedback[3] = "'".$USER->email."'";
|
||||
$feedback[4] = 500; // width
|
||||
$feedback[5] = 300; // height
|
||||
}
|
||||
break;
|
||||
case HOTPOT_FEEDBACK_MOODLEFORUM:
|
||||
$module = get_record('modules', 'name', 'forum');
|
||||
$forums = get_records('forum', 'course', "$course->id");
|
||||
if (empty($module) || empty($module->visible) || empty($forums)) {
|
||||
$hotpot->studentfeedback = HOTPOT_FEEDBACK_NONE;
|
||||
} else {
|
||||
$feedback[0] = "'$CFG->wwwroot/mod/forum/index.php?id=$course->id'";
|
||||
}
|
||||
break;
|
||||
case HOTPOT_FEEDBACK_MOODLEMESSAGING:
|
||||
$teachers = hotpot_feedback_teachers($course, $hotpot);
|
||||
if (empty($CFG->messaging) || empty($teachers)) {
|
||||
$hotpot->studentfeedback = HOTPOT_FEEDBACK_NONE;
|
||||
} else {
|
||||
$feedback[0] = "'$CFG->wwwroot/message/discussion.php?id='";
|
||||
$feedback[1] = $teachers;
|
||||
$feedback[4] = 400; // width
|
||||
$feedback[5] = 500; // height
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// do nothing
|
||||
}
|
||||
if ($hotpot->studentfeedback != HOTPOT_FEEDBACK_NONE) {
|
||||
$feedback[6] = "'Send a message to teacher'";
|
||||
$feedback[7] = "'Title'";
|
||||
$feedback[8] = "'Teacher'";
|
||||
$feedback[9] = "'Message'";
|
||||
$feedback[10] = "'Close this window'";
|
||||
$js = '';
|
||||
foreach ($feedback as $i=>$str) {
|
||||
$js .= 'FEEDBACK['.$i."] = $str;\n";
|
||||
}
|
||||
$js = '<script type="text/javascript" language="javascript">'."<!--\n"."FEEDBACK = new Array();\n".$js."//--></script>\n";
|
||||
$hp->html = preg_replace('|</head>|i', "$js</head>", $hp->html, 1);
|
||||
}
|
||||
// insert hot-potatoes.js
|
||||
$hp->insert_script(HOTPOT_JS);
|
||||
// extract first <head> tag
|
||||
$head = '';
|
||||
$pattern = '|<head([^>]*)>(.*?)</head>|is';
|
||||
if (preg_match($pattern, $hp->html, $matches)) {
|
||||
$head = $matches[2];
|
||||
// remove <title>
|
||||
$head = preg_replace('|<title[^>]*>(.*?)</title>|is', '', $head);
|
||||
}
|
||||
// extract <style> tags (and remove from $head)
|
||||
$styles = '';
|
||||
$pattern = '|<style([^>]*)>(.*?)</style>|is';
|
||||
if (preg_match_all($pattern, $head, $matches)) {
|
||||
$count = count($matches[0]);
|
||||
for ($i=0; $i<$count; $i++) {
|
||||
$styles .= $matches[0][$i]."\n";
|
||||
$head = str_replace($matches[0][$i], '', $head);
|
||||
}
|
||||
}
|
||||
// extract <script> tags (and remove from $head)
|
||||
$scripts = '';
|
||||
$pattern = '|<script([^>]*)>(.*?)</script>|is';
|
||||
if (preg_match_all($pattern, $head, $matches)) {
|
||||
$count = count($matches[0]);
|
||||
for ($i=0; $i<$count; $i++) {
|
||||
$scripts .= $matches[0][$i]."\n";
|
||||
$head = str_replace($matches[0][$i], '', $head);
|
||||
}
|
||||
}
|
||||
// extract <body> tags
|
||||
$body = '';
|
||||
$body_tags = '';
|
||||
$footer = '</html>';
|
||||
// HP6 and some HP5 (v6 and v4)
|
||||
if (preg_match('|<body'.'([^>]*'.'onLoad=(["\'])(.*?)(\\2)'.'[^>]*)'.'>(.*)</body>|is', $hp->html, $matches)) {
|
||||
$body = $matches[5]; // contents of first <body onload="StartUp()">...</body> block
|
||||
$body_tags = $matches[1];
|
||||
// workaround to ensure javascript onload routine for quiz is always executed
|
||||
// $body_tags will only be inserted into the <body ...> tag
|
||||
// if it is included in the theme/$CFG->theme/header.html,
|
||||
// so some old or modified themes may not insert $body_tags
|
||||
$body .= ""
|
||||
. '<script type="text/javascript">'."\n"
|
||||
. "<!--\n"
|
||||
. " var s = (typeof(window.onload)=='function') ? onload.toString() : '';\n"
|
||||
. " if (s.indexOf('".$matches[3]."')<0) {\n"
|
||||
. " if (s=='') {\n" // no previous onload
|
||||
. " window.onload = new Function('".$matches[3]."');\n"
|
||||
. " } else {\n"
|
||||
. " window.onload_hotpot = onload;\n"
|
||||
. " window.onload = new Function('window.onload_hotpot();'+'".$matches[3]."');\n"
|
||||
. " }\n"
|
||||
. " }\n"
|
||||
. "//-->\n"
|
||||
. "</script>\n"
|
||||
;
|
||||
$footer = '</body>'.$footer;
|
||||
} else if ($frameset) { // HP5 v5
|
||||
switch ($framename) {
|
||||
case 'top':
|
||||
print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas);
|
||||
print $footer;
|
||||
break;
|
||||
default:
|
||||
// add a HotPot navigation frame at the top of the page
|
||||
//$rows = empty($CFG->resource_framesize) ? 85 : $CFG->resource_framesize;
|
||||
//$frameset = "\n\t".'<frame src="view.php?id='.$cm->id.'&framename=top" frameborder="0" name="top"></frame>'.$frameset;
|
||||
//$frameset_tags = preg_replace('|rows="(.*?)"|', 'rows="'.$rows.',\\1"', $frameset_tags);
|
||||
// put navigation into var NavBar='';
|
||||
// add form to TopFrame in "WriteFeedback" function
|
||||
// OR add form to BottomFrame in "DisplayExercise" function
|
||||
// submission form: '<!-- BeginSubmissionForm -->', '<!-- EndSubmissionForm -->'
|
||||
// give up form: '<!-- BeginTopNavButtons -->', '<!-- EndTopNavButtons -->'
|
||||
print "<html>\n";
|
||||
print "<head>\n<title>$title</title>\n$styles\n$scripts</head>\n";
|
||||
print "<frameset$frameset_tags>$frameset</frameset>\n";
|
||||
print "</html>\n";
|
||||
break;
|
||||
} // end switch $framename
|
||||
exit;
|
||||
// other files (maybe not even a HotPots)
|
||||
} else if (preg_match('|<body'.'([^>]*)'.'>(.*)</body>|is', $hp->html, $matches)) {
|
||||
$body = $matches[2];
|
||||
$body_tags = $matches[1];
|
||||
}
|
||||
// print the quiz to the browser
|
||||
if ($get_js) {
|
||||
print($scripts);
|
||||
exit;
|
||||
}
|
||||
if ($get_css) {
|
||||
print($styles);
|
||||
exit;
|
||||
}
|
||||
switch ($hotpot->navigation) {
|
||||
case HOTPOT_NAVIGATION_BAR:
|
||||
//update_module_button($cm->id, $course->id, $strmodulename.'" style="font-size:0.8em')
|
||||
print_header(
|
||||
$title, $heading, $navigation,
|
||||
"", $head.$styles.$scripts, true, $button,
|
||||
$loggedinas, false, $body_tags
|
||||
);
|
||||
if (!empty($available_msg)) {
|
||||
notify($available_msg);
|
||||
}
|
||||
print $body.$footer;
|
||||
break;
|
||||
case HOTPOT_NAVIGATION_FRAME:
|
||||
switch ($framename) {
|
||||
case 'top':
|
||||
print_header($title, $heading, $navigation, "", "", true, $button, $loggedinas);
|
||||
print $footer;
|
||||
break;
|
||||
case 'main':
|
||||
if (!empty($available_msg)) {
|
||||
$hp->insert_message('<!-- BeginTopNavButtons -->', $available_msg);
|
||||
}
|
||||
print $hp->html;
|
||||
break;
|
||||
default:
|
||||
$rows = empty($CFG->resource_framesize) ? 85 : $CFG->resource_framesize;
|
||||
print "<html>\n";
|
||||
print "<head><title>$title</title></head>\n";
|
||||
print "<frameset rows=$rows,*>\n";
|
||||
print "<frame src=\"view.php?id=$cm->id&framename=top\">\n";
|
||||
print "<frame src=\"view.php?id=$cm->id&framename=main\">\n";
|
||||
print "</frameset>\n";
|
||||
print "</html>\n";
|
||||
break;
|
||||
} // end switch $framename
|
||||
break;
|
||||
case HOTPOT_NAVIGATION_IFRAME:
|
||||
switch ($framename) {
|
||||
case 'main':
|
||||
print $hp->html;
|
||||
break;
|
||||
default:
|
||||
$iframe_id = 'hotpot_iframe';
|
||||
$body_tags = " onload=\"set_iframe_height('$iframe_id')\"";
|
||||
$iframe_js = '<script src="iframe.js" type="text/javascript" language="javascript"></script>'."\n";
|
||||
print_header(
|
||||
$title, $heading, $navigation,
|
||||
"", $head.$styles.$scripts.$iframe_js, true, $button,
|
||||
$loggedinas, false, $body_tags
|
||||
);
|
||||
if (!empty($available_msg)) {
|
||||
notify($available_msg);
|
||||
}
|
||||
print "<iframe id=\"$iframe_id\" src=\"view.php?id=$cm->id&framename=main\" height=\"100%\" width=\"100%\">";
|
||||
print "<ilayer name=\"$iframe_id\" src=\"view.php?id=$cm->id&framename=main\" height=\"100%\" width=\"100%\">";
|
||||
print "</ilayer>\n";
|
||||
print "</iframe>\n";
|
||||
print $footer;
|
||||
break;
|
||||
} // end switch $framename
|
||||
break;
|
||||
default:
|
||||
// HOTPOT_NAVIGATION_BUTTONS
|
||||
// HOTPOT_NAVIGATION_GIVEUP
|
||||
// HOTPOT_NAVIGATION_NONE
|
||||
if (!empty($available_msg)) {
|
||||
$hp->insert_message('<!-- BeginTopNavButtons -->', $available_msg);
|
||||
}
|
||||
print($hp->html);
|
||||
}
|
||||
///////////////////////////////////
|
||||
/// functions
|
||||
/// functions
|
||||
///////////////////////////////////
|
||||
function hotpot_feedback_teachers(&$course, &$hotpot) {
|
||||
global $CFG;
|
||||
$teachers = get_records_sql("
|
||||
SELECT
|
||||
u.*
|
||||
FROM
|
||||
{$CFG->prefix}user AS u,
|
||||
{$CFG->prefix}user_teachers AS t
|
||||
WHERE
|
||||
t.userid = u.id
|
||||
AND t.course = $course->id
|
||||
");
|
||||
$teacherdetails = '';
|
||||
if (!empty($teachers)) {
|
||||
$details = array();
|
||||
foreach ($teachers as $teacher) {
|
||||
if ($hotpot->studentfeedback==HOTPOT_FEEDBACK_MOODLEMESSAGING) {
|
||||
$detail = $teacher->id;
|
||||
} else {
|
||||
$detail =$teacher->email;
|
||||
}
|
||||
$details[] = "new Array('".fullname($teacher)."', '$detail')";
|
||||
}
|
||||
$teacherdetails = 'new Array('.implode(',', $details).");\n";
|
||||
}
|
||||
return $teacherdetails;
|
||||
global $CFG;
|
||||
$teachers = get_records_sql("
|
||||
SELECT
|
||||
u.*
|
||||
FROM
|
||||
{$CFG->prefix}user AS u,
|
||||
{$CFG->prefix}user_teachers AS t
|
||||
WHERE
|
||||
t.userid = u.id
|
||||
AND t.course = $course->id
|
||||
");
|
||||
$teacherdetails = '';
|
||||
if (!empty($teachers)) {
|
||||
$details = array();
|
||||
foreach ($teachers as $teacher) {
|
||||
if ($hotpot->studentfeedback==HOTPOT_FEEDBACK_MOODLEMESSAGING) {
|
||||
$detail = $teacher->id;
|
||||
} else {
|
||||
$detail =$teacher->email;
|
||||
}
|
||||
$details[] = "new Array('".fullname($teacher)."', '$detail')";
|
||||
}
|
||||
$teacherdetails = 'new Array('.implode(',', $details).");\n";
|
||||
}
|
||||
return $teacherdetails;
|
||||
}
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue