mirror of
https://github.com/moodle/moodle.git
synced 2025-08-03 08:09:47 +02:00
Removed tabs
This commit is contained in:
parent
bee7ee3815
commit
dabfd0ed85
67 changed files with 8204 additions and 8204 deletions
|
@ -107,10 +107,10 @@ class assignment_base {
|
|||
*/
|
||||
function view() {
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE,$this->cm->id);
|
||||
$context = get_context_instance(CONTEXT_MODULE,$this->cm->id);
|
||||
has_capability('mod/assignment:view', $context->id, true);
|
||||
|
||||
add_to_log($this->course->id, "assignment", "view", "view.php?id={$this->cm->id}",
|
||||
add_to_log($this->course->id, "assignment", "view", "view.php?id={$this->cm->id}",
|
||||
$this->assignment->id, $this->cm->id);
|
||||
|
||||
$this->view_header();
|
||||
|
@ -281,7 +281,7 @@ class assignment_base {
|
|||
|
||||
// if this user can mark and is put in a group
|
||||
// then he can only see/mark submission in his own groups
|
||||
if (user_group($this->course->id, $USER->id)) {
|
||||
if (user_group($this->course->id, $USER->id)) {
|
||||
$count = $this->count_real_submissions($this->currentgroup); // Only their groups
|
||||
} else {
|
||||
$count = $this->count_real_submissions(); // Everyone
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
var availableitems = ['availableday','availablemonth','availableyear','availablehour', 'availableminute'];
|
||||
</script>
|
||||
|
||||
<form name="form" method="post" action="../mod/assignment/details.php">
|
||||
<form name="form" method="post" action="../mod/assignment/details.php">
|
||||
<table cellpadding="5">
|
||||
<tr valign="top">
|
||||
<td align="right"><b><?php print_string("assignmentname", "assignment") ?>:</b></td>
|
||||
|
|
|
@ -17,17 +17,17 @@
|
|||
if (!$cm = get_coursemodule_from_instance('chat', $chat->id, $course->id)) {
|
||||
error('Course Module ID was incorrect');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
has_capability('mod/chat:chat',$context->id, true);
|
||||
/*
|
||||
has_capability('mod/chat:chat',$context->id, true);
|
||||
/*
|
||||
if (isguest()) {
|
||||
error('Guest does not have access to chat rooms');
|
||||
}
|
||||
*/
|
||||
*/
|
||||
if (!$cm->visible and !isteacher($course->id)) {
|
||||
print_header();
|
||||
notice(get_string("activityiscurrentlyhidden"));
|
||||
|
|
|
@ -200,17 +200,17 @@ function chat_print_recent_activity($course, $isteacher, $timestart) {
|
|||
}
|
||||
if ($chat = get_record('chat', 'id', $chatuser->chatid)) {
|
||||
|
||||
// we find the course module id
|
||||
$chatmod = get_record('modules', 'name', 'chat');
|
||||
$SQL = "select * from {$CFG->prefix}course_modules where
|
||||
course = $course->id
|
||||
and module = $chatmod->id
|
||||
and instance = $chat->id";
|
||||
$cm = get_records_sql($SQL);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
// we find the course module id
|
||||
$chatmod = get_record('modules', 'name', 'chat');
|
||||
$SQL = "select * from {$CFG->prefix}course_modules where
|
||||
course = $course->id
|
||||
and module = $chatmod->id
|
||||
and instance = $chat->id";
|
||||
$cm = get_records_sql($SQL);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
// needs to be fixed
|
||||
if (!(has_capability('mod/chat:readlog', $context->id) or instance_is_visible('chat', $chat))) { // Chat hidden to students
|
||||
// needs to be fixed
|
||||
if (!(has_capability('mod/chat:readlog', $context->id) or instance_is_visible('chat', $chat))) { // Chat hidden to students
|
||||
//if (!($isteacher or instance_is_visible('chat', $chat))) { // Chat hidden to students
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -21,16 +21,16 @@
|
|||
error('Course is misconfigured');
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
$isteacher = isteacher($course->id);
|
||||
$isteacheredit = isteacheredit($course->id);
|
||||
|
||||
//if (isguest() or (!$isteacher and !$chat->studentlogs)) {
|
||||
//error('You can not view these chat reports');
|
||||
//error('You can not view these chat reports');
|
||||
//}
|
||||
has_capability('mod/chat:readlog', $context->id, true); // if can't even read, kill
|
||||
has_capability('mod/chat:readlog', $context->id, true); // if can't even read, kill
|
||||
|
||||
add_to_log($course->id, 'chat', 'report', "report.php?id=$cm->id", $chat->id, $cm->id);
|
||||
|
||||
|
@ -89,7 +89,7 @@
|
|||
print_simple_box_end('center');
|
||||
}
|
||||
|
||||
if (!$deletesession or !has_capability('mod/chat:deletelog', $context->id)) {
|
||||
if (!$deletesession or !has_capability('mod/chat:deletelog', $context->id)) {
|
||||
//if (!$deletesession or !$isteacheredit) {
|
||||
print_continue("report.php?id=$cm->id");
|
||||
}
|
||||
|
@ -124,7 +124,7 @@
|
|||
|
||||
/// Delete a session if one has been specified
|
||||
|
||||
if ($deletesession and has_capability('mod/chat:deletelog', $context->id) and $confirmdelete and $start and $end and confirm_sesskey()) {
|
||||
if ($deletesession and has_capability('mod/chat:deletelog', $context->id) and $confirmdelete and $start and $end and confirm_sesskey()) {
|
||||
//if ($deletesession and $isteacheredit and $confirmdelete and $start and $end and confirm_sesskey()) {
|
||||
delete_records_select('chat_messages', "chatid = $chat->id AND
|
||||
timestamp >= '$start' AND
|
||||
|
@ -194,7 +194,7 @@
|
|||
echo '<p align="right">';
|
||||
echo "<a href=\"report.php?id=$cm->id&start=$sessionstart&end=$sessionend\">$strseesession</a>";
|
||||
//if ($isteacheredit)
|
||||
if (has_capability('mod/chat:deletelog', $context->id)) {
|
||||
if (has_capability('mod/chat:deletelog', $context->id)) {
|
||||
echo "<br /><a href=\"report.php?id=$cm->id&start=$sessionstart&end=$sessionend&deletesession=1\">$strdeletesession</a>";
|
||||
}
|
||||
echo '</p>';
|
||||
|
|
|
@ -43,9 +43,9 @@
|
|||
|
||||
require_course_login($course, true, $cm);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
add_to_log($course->id, 'chat', 'view', "view.php?id=$cm->id", $chat->id, $cm->id);
|
||||
add_to_log($course->id, 'chat', 'view', "view.php?id=$cm->id", $chat->id, $cm->id);
|
||||
|
||||
// Initialize $PAGE, compute blocks
|
||||
|
||||
|
@ -76,7 +76,7 @@
|
|||
|
||||
echo '<td id="middle-column">';
|
||||
|
||||
if ($chat->studentlogs or has_capability('mod/chat:readlog',$context->id)) {
|
||||
if ($chat->studentlogs or has_capability('mod/chat:readlog',$context->id)) {
|
||||
//if (($chat->studentlogs or isteacher($course->id)) and !isguest()) {
|
||||
echo '<div class="reportlink">';
|
||||
echo "<a href=\"report.php?id=$cm->id\">".
|
||||
|
|
|
@ -144,7 +144,7 @@ function choice_update_instance($choice) {
|
|||
}
|
||||
|
||||
function choice_show_form($choice, $user, $cm) {
|
||||
|
||||
|
||||
//$cdisplay is an array of the display info for a choice $cdisplay[$optionid]->text - text name of option.
|
||||
// ->maxanswers -maxanswers for this option
|
||||
// ->full - whether this option is full or not. 0=not full, 1=full
|
||||
|
@ -157,9 +157,9 @@ $cdisplay = array();
|
|||
$countans = 0;
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
if (!empty($countanswers)) {
|
||||
foreach ($countanswers as $ca) { //only return enrolled users.
|
||||
if (has_capability('mod/choice:choose', $context->id)) {
|
||||
//if (isstudent($cm->course, $ca->userid) or isteacher($cm->course, $ca->userid)) {
|
||||
foreach ($countanswers as $ca) { //only return enrolled users.
|
||||
if (has_capability('mod/choice:choose', $context->id)) {
|
||||
//if (isstudent($cm->course, $ca->userid) or isteacher($cm->course, $ca->userid)) {
|
||||
$countans = $countans+1;
|
||||
}
|
||||
}
|
||||
|
@ -171,21 +171,21 @@ $cdisplay = array();
|
|||
}
|
||||
$maxans = $choice->maxanswers[$optionid];
|
||||
|
||||
$cdisplay[$aid]->optionid = $optionid;
|
||||
$cdisplay[$aid]->text = $text;
|
||||
$cdisplay[$aid]->maxanswers = $maxans;
|
||||
$cdisplay[$aid]->countanswers = $countans;
|
||||
$cdisplay[$aid]->optionid = $optionid;
|
||||
$cdisplay[$aid]->text = $text;
|
||||
$cdisplay[$aid]->maxanswers = $maxans;
|
||||
$cdisplay[$aid]->countanswers = $countans;
|
||||
|
||||
if ($current = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $user->id, 'optionid', $optionid)) {
|
||||
$cdisplay[$aid]->checked = ' checked="checked" ';
|
||||
} else {
|
||||
$cdisplay[$aid]->checked = '';
|
||||
}
|
||||
if ($current = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $user->id, 'optionid', $optionid)) {
|
||||
$cdisplay[$aid]->checked = ' checked="checked" ';
|
||||
} else {
|
||||
$cdisplay[$aid]->checked = '';
|
||||
}
|
||||
if ($choice->limitanswers && ($countans >= $maxans) && (empty($cdisplay[$aid]->checked)) ) {
|
||||
$cdisplay[$aid]->disabled = ' disabled="disabled" ';
|
||||
} else {
|
||||
$cdisplay[$aid]->disabled = '';
|
||||
}
|
||||
$cdisplay[$aid]->disabled = ' disabled="disabled" ';
|
||||
} else {
|
||||
$cdisplay[$aid]->disabled = '';
|
||||
}
|
||||
$aid++;
|
||||
}
|
||||
}
|
||||
|
@ -193,13 +193,13 @@ $cdisplay = array();
|
|||
switch ($choice->display) {
|
||||
case CHOICE_DISPLAY_HORIZONTAL:
|
||||
echo "<table cellpadding=\"20\" cellspacing=\"20\" align=\"center\"><tr>";
|
||||
|
||||
|
||||
foreach ($cdisplay as $cd) {
|
||||
echo "<td align=\"center\" valign=\"top\">";
|
||||
echo "<input type=\"radio\" name=\"answer\" value=\"".$cd->optionid."\" alt=\"".strip_tags(format_text($cd->text))."\"". $cd->checked.$cd->disabled." />";
|
||||
if (!empty($cd->disabled)) {
|
||||
echo format_text($cd->text."<br /><strong>".get_string('full', 'choice')."</strong>");
|
||||
} else {
|
||||
echo format_text($cd->text."<br /><strong>".get_string('full', 'choice')."</strong>");
|
||||
} else {
|
||||
echo format_text($cd->text);
|
||||
}
|
||||
echo "</td>";
|
||||
|
@ -222,8 +222,8 @@ $cdisplay = array();
|
|||
|
||||
if (!empty($cd->disabled)) {
|
||||
echo get_string('full', 'choice');
|
||||
} elseif(!empty($cd->checked)) {
|
||||
//currently do nothing - maybe some text could be added here to signfy that the choice has been 'selected'
|
||||
} elseif(!empty($cd->checked)) {
|
||||
//currently do nothing - maybe some text could be added here to signfy that the choice has been 'selected'
|
||||
} elseif ($cd->maxanswers-$cd->countanswers==1) {
|
||||
echo ($cd->maxanswers - $cd->countanswers);
|
||||
echo " ".get_string('spaceleft', 'choice');
|
||||
|
@ -256,26 +256,26 @@ $cdisplay = array();
|
|||
function choice_user_submit_response($formanswer, $choice, $userid, $courseid, $cm) {
|
||||
|
||||
$current = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $userid);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$countanswers = get_records("choice_answers", "optionid", $formanswer);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$countanswers = get_records("choice_answers", "optionid", $formanswer);
|
||||
if ($countanswers) {
|
||||
$countans = 0;
|
||||
foreach ($countanswers as $ca) { //only return enrolled users.
|
||||
if (has_capability('mod/choice:choose', $context->id)) {
|
||||
//if (isstudent($courseid, $ca->userid) or isteacher($courseid, $ca->userid)) {
|
||||
$countans = $countans+1;
|
||||
}
|
||||
}
|
||||
|
||||
if (has_capability('mod/choice:choose', $context->id)) {
|
||||
//if (isstudent($courseid, $ca->userid) or isteacher($courseid, $ca->userid)) {
|
||||
$countans = $countans+1;
|
||||
}
|
||||
}
|
||||
|
||||
$countanswers = count($countans);
|
||||
} else {
|
||||
$countanswers = 0;
|
||||
}
|
||||
$maxans = $choice->maxanswers[$formanswer];
|
||||
|
||||
if (!($choice->limitanswers && ($countanswers >= $maxans) )) {
|
||||
if (!($choice->limitanswers && ($countanswers >= $maxans) )) {
|
||||
if ($current) {
|
||||
|
||||
|
||||
$newanswer = $current;
|
||||
$newanswer->optionid = $formanswer;
|
||||
$newanswer->timemodified = time();
|
||||
|
@ -304,11 +304,11 @@ $current = get_record('choice_answers', 'choiceid', $choice->id, 'userid', $user
|
|||
|
||||
function choice_show_reportlink($choice, $courseid, $cmid) {
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cmid);
|
||||
if ( $allanswers = get_records("choice_answers", "choiceid", $choice->id)) {
|
||||
if ( $allanswers = get_records("choice_answers", "choiceid", $choice->id)) {
|
||||
$responsecount = 0;
|
||||
foreach ($allanswers as $aa) {
|
||||
if (has_capability('mod/choice:readresponses', $context->id)) {
|
||||
//if (isstudent($courseid, $aa->userid) or isteacher($courseid, $aa->userid)) { //check to make sure user is enrolled in course.
|
||||
//if (isstudent($courseid, $aa->userid) or isteacher($courseid, $aa->userid)) { //check to make sure user is enrolled in course.
|
||||
$responsecount++;
|
||||
}
|
||||
}
|
||||
|
@ -323,12 +323,12 @@ function choice_show_reportlink($choice, $courseid, $cmid) {
|
|||
function choice_show_results($choice, $course, $cm, $forcepublish='') {
|
||||
|
||||
global $CFG, $COLUMN_HEIGHT, $USER;
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
print_heading(get_string("responses", "choice"));
|
||||
if (empty($forcepublish)) { //alow the publish setting to be overridden
|
||||
$forcepublish = $choice->publish;
|
||||
}
|
||||
|
||||
$forcepublish = $choice->publish;
|
||||
}
|
||||
|
||||
/// Check to see if groups are being used in this choice
|
||||
if ($groupmode = groupmode($course, $cm)) { // Groups are being used
|
||||
$currentgroup = setup_and_print_groups($course, $groupmode, $_SERVER['PHP_SELF']."?id=$cm->id");
|
||||
|
@ -383,9 +383,9 @@ function choice_show_results($choice, $course, $cm, $forcepublish='') {
|
|||
//$isteacher = isteacher($course->id);
|
||||
|
||||
$tablewidth = (int) (100.0 / count($useranswer));
|
||||
if (has_capability('mod/choice:readresponses', $context->id)) {
|
||||
if (has_capability('mod/choice:readresponses', $context->id)) {
|
||||
//if (isteacher($course->id, $USER->id)) {
|
||||
echo '<div id="tablecontainer">';
|
||||
echo '<div id="tablecontainer">';
|
||||
echo '<form id="attemptsform" method="post" action="'.$_SERVER['PHP_SELF'].'" onsubmit="var menu = document.getElementById(\'menuaction\'); return (menu.options[menu.selectedIndex].value == \'delete\' ? \''.addslashes(get_string('deleteattemptcheck','quiz')).'\' : true);">';
|
||||
echo '<input type="hidden" name="id" value="'.$cm->id.'" />';
|
||||
echo '<input type="hidden" name="mode" value="overview" />';
|
||||
|
@ -420,7 +420,7 @@ function choice_show_results($choice, $course, $cm, $forcepublish='') {
|
|||
|
||||
echo "<table width=\"100%\">";
|
||||
foreach ($userlist as $user) {
|
||||
// this needs to be fixed
|
||||
// this needs to be fixed
|
||||
if (!($optionid==0 && isadmin($user->id)) && !($optionid==0 && isteacher($course->id, $user->id) && !(isteacheredit($course->id, $user->id)) ) ) { //make sure admins and hidden teachers are not shown in not answered yet column.
|
||||
echo "<tr>";
|
||||
if (isteacher($course->id, $USER->id) && !($optionid==0)) {
|
||||
|
@ -450,12 +450,12 @@ function choice_show_results($choice, $course, $cm, $forcepublish='') {
|
|||
$countanswers = get_records("choice_answers", "optionid", $optionid);
|
||||
$countans = 0;
|
||||
if (!empty($countanswers)) {
|
||||
foreach ($countanswers as $ca) { //only return enrolled users.
|
||||
// needs fixing too
|
||||
if (isstudent($course->id, $ca->userid) or isteacher($course->id, $ca->userid)) {
|
||||
$countans = $countans+1;
|
||||
}
|
||||
}
|
||||
foreach ($countanswers as $ca) { //only return enrolled users.
|
||||
// needs fixing too
|
||||
if (isstudent($course->id, $ca->userid) or isteacher($course->id, $ca->userid)) {
|
||||
$countans = $countans+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($choice->limitanswers && !$optionid==0) {
|
||||
echo get_string("taken", "choice").":";
|
||||
|
@ -490,8 +490,8 @@ function choice_show_results($choice, $course, $cm, $forcepublish='') {
|
|||
echo "</tr></table>";
|
||||
//if (isteacher($course->id, $USER->id)) {
|
||||
if (has_capability('mod/choice:readresponses', $context->id)) {
|
||||
echo "</form></div>";
|
||||
}
|
||||
echo "</form></div>";
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
@ -572,13 +572,13 @@ function choice_show_results($choice, $course, $cm, $forcepublish='') {
|
|||
echo "</tr></table>";
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function choice_delete_responses($attemptids) {
|
||||
|
||||
if(!is_array($attemptids) || empty($attemptids)) {
|
||||
|
||||
if(!is_array($attemptids) || empty($attemptids)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
has_capability('mod/choice:readresponses', $context->id, true);
|
||||
|
||||
//if (!isteacher($course->id)) {
|
||||
//if (!isteacher($course->id)) {
|
||||
// error("Only teachers can look at this page");
|
||||
//}
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
|||
//if ($action == 'delete') { //some responses need to be deleted
|
||||
$attemptids = isset($_POST['attemptid']) ? $_POST['attemptid'] : array(); //get array of repsonses to delete.
|
||||
choice_delete_responses($attemptids); //delete responses.
|
||||
redirect("report.php?id=$cm->id");
|
||||
redirect("report.php?id=$cm->id");
|
||||
}
|
||||
|
||||
if ($download <> "xls" and $download <> "txt" ) {
|
||||
|
@ -123,9 +123,9 @@
|
|||
$ug2 = '';
|
||||
if ($usergrps = user_group($course->id, $user->id)) {
|
||||
foreach ($usergrps as $ug) {
|
||||
$ug2 = $ug2. $ug->name;
|
||||
}
|
||||
}
|
||||
$ug2 = $ug2. $ug->name;
|
||||
}
|
||||
}
|
||||
$myxls->write_string($row,3,$ug2);
|
||||
|
||||
$useroption = choice_get_option_text($choice, $answers[$user->id]->optionid);
|
||||
|
@ -144,7 +144,7 @@
|
|||
exit;
|
||||
}
|
||||
// print text file
|
||||
//if ($download == "txt") {
|
||||
//if ($download == "txt") {
|
||||
if ($download == "txt" && has_capability('mod/choice:downloadresponses', $context->id, true)) {
|
||||
$filename = clean_filename("$course->shortname ".strip_tags(format_string($choice->name,true))).'.txt';
|
||||
|
||||
|
@ -172,15 +172,15 @@
|
|||
echo "\t".$user->firstname;
|
||||
$studentid = " ";
|
||||
if (!empty($user->idnumber)) {
|
||||
$studentid = $user->idnumber;
|
||||
}
|
||||
$studentid = $user->idnumber;
|
||||
}
|
||||
echo "\t". $studentid."\t";
|
||||
$ug2 = '';
|
||||
if ($usergrps = user_group($course->id, $user->id)) {
|
||||
foreach ($usergrps as $ug) {
|
||||
$ug2 = $ug2. $ug->name;
|
||||
}
|
||||
}
|
||||
$ug2 = $ug2. $ug->name;
|
||||
}
|
||||
}
|
||||
echo $ug2. "\t";
|
||||
echo format_string(choice_get_option_text($choice, $answers[$user->id]->optionid),true). "\n";
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
if ($form = data_submitted()) {
|
||||
$timenow = time();
|
||||
if (has_capability('mod/choice:deleteresponses', $context->id)) {
|
||||
if (has_capability('mod/choice:deleteresponses', $context->id)) {
|
||||
//if (isteacher($course->id, $USER->id)) {
|
||||
if ($action == 'delete') { //some responses need to be deleted
|
||||
choice_delete_responses($attemptids); //delete responses.
|
||||
|
@ -59,7 +59,7 @@
|
|||
"<a href=\"index.php?id=$course->id\">$strchoices</a> -> ".format_string($choice->name), "", "", true,
|
||||
update_module_button($cm->id, $course->id, $strchoice), navmenu($course, $cm));
|
||||
|
||||
if (has_capability('mod/choice:readresponses', $context->id)) {
|
||||
if (has_capability('mod/choice:readresponses', $context->id)) {
|
||||
//if (isteacher($course->id)) {
|
||||
choice_show_reportlink($choice, $course->id, $cm->id);
|
||||
} else if (!$cm->visible) {
|
||||
|
@ -102,7 +102,7 @@
|
|||
( $choice->showresults == CHOICE_SHOWRESULTS_AFTER_ANSWER and $current ) or
|
||||
( $choice->showresults == CHOICE_SHOWRESULTS_AFTER_CLOSE and $choice->timeclose <= time() ) ) {
|
||||
|
||||
choice_show_results($choice, $course, $cm);
|
||||
choice_show_results($choice, $course, $cm);
|
||||
}
|
||||
|
||||
print_footer($course);
|
||||
|
|
|
@ -26,11 +26,11 @@
|
|||
}
|
||||
|
||||
require_login($course->id);
|
||||
|
||||
$cm = data_get_cm($data);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
if ($commentid) {
|
||||
$cm = data_get_cm($data);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
if ($commentid) {
|
||||
if (! $comment = get_record('data_comments', 'id', $commentid)) {
|
||||
error('Comment ID is misconfigured');
|
||||
}
|
||||
|
|
|
@ -65,8 +65,8 @@
|
|||
|
||||
require_course_login($course, true, $cm);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/data:managetemplates', $context->id, true);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/data:managetemplates', $context->id, true);
|
||||
|
||||
|
||||
if (!isteacheredit($course->id)){
|
||||
|
|
|
@ -57,8 +57,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/data:uploadentries', $context->id, true);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/data:uploadentries', $context->id, true);
|
||||
|
||||
if (has_capability('mod/data:managetemplates', $context->id)) {
|
||||
if (!count_records('data_fields','dataid',$data->id)) { // Brand new database!
|
||||
|
|
|
@ -557,7 +557,7 @@ function data_add_record($data, $groupid=0){
|
|||
$record->groupid = $groupid;
|
||||
$record->timecreated = $record->timemodified = time();
|
||||
if (has_capability('mod/data:approve', $context->id)) {
|
||||
//if (isteacher($data->course)) {
|
||||
//if (isteacher($data->course)) {
|
||||
$record->approved = 1;
|
||||
} else {
|
||||
$record->approved = 0;
|
||||
|
@ -839,8 +839,8 @@ function data_get_coursemodule_info($coursemodule) {
|
|||
function data_print_template($template, $records, $data, $search='',$page=0, $return=false) {
|
||||
global $CFG;
|
||||
|
||||
$cm = data_get_cm($data);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$cm = data_get_cm($data);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
static $fields = NULL;
|
||||
static $isteacher;
|
||||
|
@ -991,9 +991,9 @@ function data_print_preference_form($data, $perpage, $search, $sort='', $order='
|
|||
function data_print_ratings($data, $record) {
|
||||
global $USER;
|
||||
|
||||
$cm = data_get_cm($data);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
$cm = data_get_cm($data);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
$ratingsmenuused = false;
|
||||
if ($data->ratings and !empty($USER->id)) {
|
||||
if ($ratings->scale = make_grades_menu($data->scale)) {
|
||||
|
@ -1165,10 +1165,10 @@ function data_print_comment($data, $comment, $page=0) {
|
|||
|
||||
global $USER, $CFG;
|
||||
|
||||
$cm = data_get_cm($data);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$cm = data_get_cm($data);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
$stredit = get_string('edit');
|
||||
$stredit = get_string('edit');
|
||||
$strdelete = get_string('delete');
|
||||
|
||||
$user = get_record('user','id',$comment->userid);
|
||||
|
@ -1254,13 +1254,13 @@ function data_convert_arrays_to_strings(&$fieldinput) {
|
|||
|
||||
// returns the $cm given $data
|
||||
function data_get_cm($data) {
|
||||
global $CFG, $course;
|
||||
$datamod = get_record('modules', 'name', 'data');
|
||||
$SQL = "select * from {$CFG->prefix}course_modules
|
||||
where course = $course->id and
|
||||
module = $datamod->id and
|
||||
instance = $data->id";
|
||||
return get_record_sql($SQL);
|
||||
global $CFG, $course;
|
||||
$datamod = get_record('modules', 'name', 'data');
|
||||
$SQL = "select * from {$CFG->prefix}course_modules
|
||||
where course = $course->id and
|
||||
module = $datamod->id and
|
||||
instance = $data->id";
|
||||
return get_record_sql($SQL);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -92,11 +92,11 @@ function data_restore_mods($mod,$restore) {
|
|||
$mod->id, $newid);
|
||||
//Now check if want to restore user data and do it.
|
||||
if (function_exists('restore_userdata_selected')) {
|
||||
// Moodle 1.6
|
||||
$restore_userdata_selected = restore_userdata_selected($restore, 'data', $mod->id);
|
||||
// Moodle 1.6
|
||||
$restore_userdata_selected = restore_userdata_selected($restore, 'data', $mod->id);
|
||||
} else {
|
||||
// Moodle 1.5
|
||||
$restore_userdata_selected = $restore->mods['data']->userinfo;
|
||||
$restore_userdata_selected = $restore->mods['data']->userinfo;
|
||||
}
|
||||
if ($restore_userdata_selected) {
|
||||
//Restore data_fields first!!! need to hold an array of [oldid]=>newid due to double dependencies
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
}
|
||||
|
||||
$cm = data_get_cm($data);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
$inactive = NULL;
|
||||
$row = array();
|
||||
|
@ -46,7 +46,7 @@
|
|||
//if (isloggedin() and !isguest()) {
|
||||
if (isloggedin()) {
|
||||
if (has_capability('mod/data:writeentry', $context->id)) { // took out participation list here!
|
||||
$addstring = empty($editentry) ? get_string('add', 'data') : get_string('editentry', 'data');
|
||||
$addstring = empty($editentry) ? get_string('add', 'data') : get_string('editentry', 'data');
|
||||
$row[] = new tabobject('add', $CFG->wwwroot.'/mod/data/edit.php?d='.$data->id, $addstring, '', true);
|
||||
}
|
||||
if (has_capability('mod/data:managetemplates', $context->id)) {
|
||||
|
|
|
@ -56,9 +56,9 @@
|
|||
}
|
||||
|
||||
require_course_login($course, true, $cm);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/data:managetemplates', $context->id, true);
|
||||
/*
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/data:managetemplates', $context->id, true);
|
||||
/*
|
||||
if (!isteacheredit($course->id)){
|
||||
error(get_string('noaccess','data'));
|
||||
}
|
||||
|
|
|
@ -82,9 +82,9 @@
|
|||
}
|
||||
|
||||
require_course_login($course, true, $cm);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/data:readentry', $context->id, true);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/data:readentry', $context->id, true);
|
||||
|
||||
/// If it's hidden then it's don't show anything. :)
|
||||
if (empty($cm->visible) and !has_capability('mod/data:managetemplates', $context->id)) {
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
$strexercises = get_string("modulenameplural", "exercise");
|
||||
$strexercise = get_string("modulename", "exercise");
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
// ...log activity...
|
||||
add_to_log($course->id, "exercise", "view", "view.php?id=$cm->id", $exercise->id, $cm->id);
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
}
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/glossary:approve', $context->id, true);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/glossary:approve', $context->id, true);
|
||||
|
||||
$newentry->id = $eid;
|
||||
$newentry->approved = 1;
|
||||
|
|
|
@ -38,9 +38,9 @@
|
|||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
if (isguest()) {
|
||||
if (isguest()) {
|
||||
error('Guests are not allowed to post comments', $_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
add_to_log($course->id, 'glossary', 'view', "view.php?id=$cm->id", "$glossary->id",$cm->id);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
error("Entry is incorrect");
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
}
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
if (isguest()) {
|
||||
error("Guests are not allowed to edit or delete entries", $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ if ( $confirm ) {
|
|||
error("Could not update this glossary entry because this concept already exist.");
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
$newentry->userid = $USER->id;
|
||||
$newentry->timecreated = $timenow;
|
||||
$newentry->sourceglossaryid = 0;
|
||||
|
@ -332,7 +332,7 @@ $tab = GLOSSARY_ADDENTRY_VIEW;
|
|||
include("tabs.html");
|
||||
|
||||
if (!$e) {
|
||||
has_capability('glossary_write', $context->id, true);
|
||||
has_capability('glossary_write', $context->id, true);
|
||||
}
|
||||
|
||||
include("edit.html");
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
require_login($course->id, false);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/glossary:managecategories', $context->id, true);
|
||||
has_capability('mod/glossary:managecategories', $context->id, true);
|
||||
|
||||
$strglossaries = get_string("modulenameplural", "glossary");
|
||||
$strglossary = get_string("modulename", "glossary");
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
error("Course module is incorrect");
|
||||
}
|
||||
|
||||
require_login($course->id, false);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/glossary:export', $context->id, true);
|
||||
require_login($course->id, false);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/glossary:export', $context->id, true);
|
||||
|
||||
$strglossaries = get_string("modulenameplural", "glossary");
|
||||
$strglossary = get_string("modulename", "glossary");
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
$lcase = 'lcase';
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/glossary:export', $context->id, true);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/glossary:export', $context->id, true);
|
||||
|
||||
if (! $course = get_record('course', 'id', $cm->course)) {
|
||||
error('Course is misconfigured');
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
}
|
||||
|
||||
require_login($course->id, false);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/glossary:export', $context->id, true);
|
||||
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/glossary:export', $context->id, true);
|
||||
|
||||
$filename = clean_filename(strip_tags(format_string($glossary->name,true)).'.xml');
|
||||
$content = glossary_generate_export_file($glossary,$l,$cat);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
}
|
||||
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
|
@ -27,10 +27,10 @@
|
|||
error("Course module is incorrect");
|
||||
}
|
||||
|
||||
require_login($course->id, false);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/glossary:import', $context->id, true);
|
||||
require_login($course->id, false);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/glossary:import', $context->id, true);
|
||||
|
||||
if ($dest != 'new' and $dest != 'current') {
|
||||
$dest = 'current';
|
||||
|
|
|
@ -738,8 +738,8 @@ function glossary_print_entry_aliases($course, $cm, $glossary, $entry,$mode='',
|
|||
|
||||
function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$hook='', $type = 'print') {
|
||||
global $USER, $CFG;
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
$output = false; //To decide if we must really return text in "return". Activate when needed only!
|
||||
$importedentry = ($entry->sourceglossaryid == $glossary->id);
|
||||
|
@ -754,15 +754,15 @@ function glossary_print_entry_icons($course, $cm, $glossary, $entry, $mode='',$h
|
|||
$return .= glossary_print_entry_commentslink($course, $cm, $glossary, $entry,$mode,$hook,'html');
|
||||
|
||||
if (has_capability('mod/glossary:comment', $context->id)) {
|
||||
$output = true;
|
||||
$output = true;
|
||||
$return .= ' <a title="' . get_string('addcomment','glossary') . '" href="comment.php?id='.$cm->id.'&eid='.$entry->id.'"><img src="comment.gif" height="11" width="11" border="0" alt="'.get_string('addcomment','glossary').'" /></a>';
|
||||
}
|
||||
|
||||
|
||||
if (has_capability('mod/glossary:write', $context->id) or (!empty($USER->id) and $glossary->studentcanpost and $entry->userid == $USER->id)) {
|
||||
// only teachers can export entries so check it out
|
||||
if (has_capability('mod/glossary:export', $context->id) and !$ismainglossary and !$importedentry) {
|
||||
$mainglossary = get_record('glossary','mainglossary',1,'course',$course->id);
|
||||
if (has_capability('mod/glossary:export', $context->id) and !$ismainglossary and !$importedentry) {
|
||||
$mainglossary = get_record('glossary','mainglossary',1,'course',$course->id);
|
||||
if ( $mainglossary ) { // if there is a main glossary defined, allow to export the current entry
|
||||
$output = true;
|
||||
$return .= ' <a title="'.get_string('exporttomainglossary','glossary') . '" href="exportentry.php?id='.$cm->id.'&entry='.$entry->id.'&mode='.$mode.'&hook='.$hook.'"><img src="export.gif" height="11" width="11" border="0" alt="'.get_string('exporttomainglossary','glossary').'" /></a>';
|
||||
|
@ -1303,9 +1303,9 @@ function glossary_print_author_menu($cm, $glossary,$mode, $hook, $sortkey = '',
|
|||
|
||||
function glossary_print_categories_menu($cm, $glossary, $hook, $category) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
global $CFG;
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
echo '<table border="0" width="100%">';
|
||||
echo '<tr>';
|
||||
|
@ -1563,8 +1563,8 @@ function glossary_print_entry_ratings($course, $entry, $ratings = NULL) {
|
|||
$glossary = get_record('glossary', 'id', $entry->glossaryid);
|
||||
$glossarymod = get_record('modules','name','glossary');
|
||||
$cm = get_record_sql("select * from {$CFG->prefix}course_modules where course = $course->id
|
||||
and module = $glossarymod->id and instance = $glossary->id");
|
||||
|
||||
and module = $glossarymod->id and instance = $glossary->id");
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
$ratingsmenuused = false;
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
$module = get_record("modules","name","glossary");
|
||||
$cm = get_record("course_modules","module",$module->id,"instance",$entry->glossaryid);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
if (!has_capability('mod/glossary:manageentries', $context->id) and $USER->id != $entry->userid) {
|
||||
error("You can only look at results for your own entries");
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
}
|
||||
if (has_capability('mod/glossary:import', $context->id)) {
|
||||
$data[GLOSSARY_IMPORT_VIEW]->caption = get_string("importentries", "glossary");
|
||||
$data[GLOSSARY_IMPORT_VIEW]->link = "import.php?id=$cm->id";
|
||||
}
|
||||
$data[GLOSSARY_IMPORT_VIEW]->link = "import.php?id=$cm->id";
|
||||
}
|
||||
|
||||
if (has_capability('mod/glossary:export', $context->id)) {
|
||||
$data[GLOSSARY_EXPORT_VIEW]->caption = get_string("exportentries", "glossary");
|
||||
|
@ -39,8 +39,8 @@
|
|||
$data[GLOSSARY_CATEGORY_VIEW]->link = "view.php?id=$id&mode=cat";
|
||||
$data[GLOSSARY_AUTHOR_VIEW]->link = "view.php?id=$id&mode=author";
|
||||
|
||||
if (has_capability('mod/glossary:approve', $context->id)) {
|
||||
$data[GLOSSARY_APPROVAL_VIEW]->caption = get_string("waitingapproval", "glossary");
|
||||
if (has_capability('mod/glossary:approve', $context->id)) {
|
||||
$data[GLOSSARY_APPROVAL_VIEW]->caption = get_string("waitingapproval", "glossary");
|
||||
$data[GLOSSARY_APPROVAL_VIEW]->link = "";
|
||||
|
||||
$hiddenentries = get_records_select("glossary_entries","glossaryid = $glossary->id and approved = 0");
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
error("Must specify glossary ID or course module ID");
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/glossary:view', $context->id, true); // kill the page if user can't even read
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
has_capability('mod/glossary:view', $context->id, true); // kill the page if user can't even read
|
||||
|
||||
if ($CFG->forcelogin) {
|
||||
require_login();
|
||||
|
|
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;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -136,8 +136,8 @@
|
|||
error('Flash is not supported yet');
|
||||
|
||||
} else if ($mimetype == "audio/x-pn-realaudio") { // It's a realmedia file
|
||||
|
||||
echo '<object id="rvocx" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="600" height="50">';
|
||||
|
||||
echo '<object id="rvocx" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="600" height="50">';
|
||||
echo "<param name=\"src\" value=\"$fullurl\">";
|
||||
echo '<param name="console" value="video">'; // not sure what the console param should equal
|
||||
echo '<param name="controls" value="ControlPanel">';
|
||||
|
|
|
@ -461,9 +461,9 @@ if ($form->mode == "add") {
|
|||
$select = "course = $course->id AND id != $form->instance";
|
||||
}
|
||||
if ($lessons = get_records_select('lesson', $select, 'name ASC')) {
|
||||
foreach($lessons as $lesson) {
|
||||
$options[$lesson->id] = $lesson->name;
|
||||
}
|
||||
foreach($lessons as $lesson) {
|
||||
$options[$lesson->id] = $lesson->name;
|
||||
}
|
||||
}
|
||||
|
||||
choose_from_menu($options, "dependency", $form->dependency, "");
|
||||
|
|
|
@ -493,8 +493,8 @@
|
|||
var ourForm = document.forms['responseform'];
|
||||
ourForm.page.value=page;
|
||||
if (ourForm.onsubmit) {
|
||||
ourForm.onsubmit();
|
||||
}
|
||||
ourForm.onsubmit();
|
||||
}
|
||||
ourForm.submit();
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -552,22 +552,22 @@ function quiz_upgrade($oldversion) {
|
|||
|
||||
if ($oldversion < 2005051400) {
|
||||
modify_database('', 'ALTER TABLE prefix_quiz_rqp_type RENAME prefix_quiz_rqp_types;');
|
||||
modify_database('', "CREATE TABLE `prefix_quiz_rqp_servers` (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
typeid int(10) unsigned NOT NULL default '0',
|
||||
url varchar(255) NOT NULL default '',
|
||||
can_render tinyint(2) unsigned NOT NULL default '0',
|
||||
can_author tinyint(2) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (id)
|
||||
) TYPE=MyISAM COMMENT='Information about RQP servers';");
|
||||
if ($types = get_records('quiz_rqp_types')) {
|
||||
foreach($types as $type) {
|
||||
$server->typeid = $type->id;
|
||||
$server->url = $type->rendering_server;
|
||||
$server->can_render = 1;
|
||||
insert_record('quiz_rqp_servers', $server);
|
||||
}
|
||||
}
|
||||
modify_database('', "CREATE TABLE `prefix_quiz_rqp_servers` (
|
||||
id int(10) unsigned NOT NULL auto_increment,
|
||||
typeid int(10) unsigned NOT NULL default '0',
|
||||
url varchar(255) NOT NULL default '',
|
||||
can_render tinyint(2) unsigned NOT NULL default '0',
|
||||
can_author tinyint(2) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (id)
|
||||
) TYPE=MyISAM COMMENT='Information about RQP servers';");
|
||||
if ($types = get_records('quiz_rqp_types')) {
|
||||
foreach($types as $type) {
|
||||
$server->typeid = $type->id;
|
||||
$server->url = $type->rendering_server;
|
||||
$server->can_render = 1;
|
||||
insert_record('quiz_rqp_servers', $server);
|
||||
}
|
||||
}
|
||||
modify_database('', 'ALTER TABLE prefix_quiz_rqp_types DROP rendering_server');
|
||||
modify_database('', 'ALTER TABLE prefix_quiz_rqp_types DROP cloning_server');
|
||||
modify_database('', 'ALTER TABLE prefix_quiz_rqp_types DROP flags');
|
||||
|
|
|
@ -1143,7 +1143,7 @@ function quiz_upgrade($oldversion) {
|
|||
}
|
||||
|
||||
if ($oldversion < 2006032100) {
|
||||
// change from the old questiontype numbers to using the questiontype names
|
||||
// change from the old questiontype numbers to using the questiontype names
|
||||
table_column('question', 'qtype', 'qtype', 'varchar', 20, '', '', 'not null');
|
||||
set_field('question', 'qtype', 'shortanswer', 'qtype', 1);
|
||||
set_field('question', 'qtype', 'truefalse', 'qtype', 2);
|
||||
|
@ -1362,11 +1362,11 @@ function quiz_upgrade($oldversion) {
|
|||
modify_database('', 'ALTER TABLE prefix_question_multichoice DROP CONSTRAINT prefix_quiz_multichoice_pkey');
|
||||
modify_database('', 'ALTER TABLE prefix_question_multichoice ADD CONSTRAINT prefix_question_multichoice_pkey PRIMARY KEY (id)');
|
||||
|
||||
modify_database('', 'ALTER TABLE prefix_question_rqp_states DROP CONSTRAINT prefix_quiz_rqp_states_pkey');
|
||||
modify_database('', 'ALTER TABLE prefix_question_rqp_states ADD CONSTRAINT prefix_question_rqp_states_pkey PRIMARY KEY (id)');
|
||||
modify_database('', 'ALTER TABLE prefix_question_rqp_states DROP CONSTRAINT prefix_quiz_rqp_states_pkey');
|
||||
modify_database('', 'ALTER TABLE prefix_question_rqp_states ADD CONSTRAINT prefix_question_rqp_states_pkey PRIMARY KEY (id)');
|
||||
|
||||
modify_database('', 'ALTER TABLE prefix_question_categories DROP CONSTRAINT prefix_quiz_categories_pkey');
|
||||
modify_database('', 'ALTER TABLE prefix_question_categories ADD CONSTRAINT prefix_question_categories_pkey PRIMARY KEY (id)');
|
||||
modify_database('', 'ALTER TABLE prefix_question_categories DROP CONSTRAINT prefix_quiz_categories_pkey');
|
||||
modify_database('', 'ALTER TABLE prefix_question_categories ADD CONSTRAINT prefix_question_categories_pkey PRIMARY KEY (id)');
|
||||
|
||||
modify_database('', 'ALTER TABLE prefix_question_shortanswer DROP CONSTRAINT prefix_quiz_shortanswer_pkey');
|
||||
modify_database('', 'ALTER TABLE prefix_question_shortanswer ADD CONSTRAINT prefix_question_shortanswer_pkey PRIMARY KEY (id)');
|
||||
|
@ -1377,8 +1377,8 @@ function quiz_upgrade($oldversion) {
|
|||
modify_database('', 'ALTER TABLE prefix_question_sessions DROP CONSTRAINT prefix_quiz_newest_states_pkey');
|
||||
modify_database('', 'ALTER TABLE prefix_question_sessions ADD CONSTRAINT prefix_question_sessions_pkey PRIMARY KEY (id)');
|
||||
|
||||
modify_database('', 'ALTER TABLE prefix_question_calculated DROP CONSTRAINT prefix_quiz_calculated_pkey');
|
||||
modify_database('', 'ALTER TABLE prefix_question_calculated ADD CONSTRAINT prefix_question_calculated_pkey PRIMARY KEY (id)');
|
||||
modify_database('', 'ALTER TABLE prefix_question_calculated DROP CONSTRAINT prefix_quiz_calculated_pkey');
|
||||
modify_database('', 'ALTER TABLE prefix_question_calculated ADD CONSTRAINT prefix_question_calculated_pkey PRIMARY KEY (id)');
|
||||
|
||||
modify_database('', 'ALTER TABLE prefix_question_answers DROP CONSTRAINT prefix_quiz_answers_pkey');
|
||||
modify_database('', 'ALTER TABLE prefix_question_answers ADD CONSTRAINT prefix_question_answers_pkey PRIMARY KEY (id)');
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
'quiz_fix_timelimit' => 0,
|
||||
'quiz_fix_adaptive' => 0,
|
||||
'quiz_fix_penaltyscheme' => 0,
|
||||
'quiz_fix_delay1' => 0,
|
||||
'quiz_fix_delay1' => 0,
|
||||
'quiz_fix_delay2' => 0,
|
||||
|
||||
);
|
||||
|
|
|
@ -85,7 +85,7 @@ body#mod-quiz-grading table#grading td
|
|||
}
|
||||
|
||||
#mod-quiz-attempt #page {
|
||||
text-align: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#mod-quiz-attempt #timer .generalbox {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require_once("../../config.php");
|
||||
require_once('locallib.php');
|
||||
|
||||
|
||||
$id = optional_param('id', '', PARAM_INT); // Course Module ID, or
|
||||
$a = optional_param('a', '', PARAM_INT); // scorm ID
|
||||
$scoid = required_param('scoid', PARAM_INT); // sco ID
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require_once("../../config.php");
|
||||
require_once('locallib.php');
|
||||
|
||||
|
||||
$id = optional_param('id', '', PARAM_INT); // Course Module ID, or
|
||||
$a = optional_param('a', '', PARAM_INT); // SCORM ID
|
||||
$b = optional_param('b', '', PARAM_INT); // SCO ID
|
||||
|
@ -58,8 +58,8 @@
|
|||
$strscorm = get_string("modulename", "scorm");
|
||||
$strreport = get_string("report", "scorm");
|
||||
$strname = get_string('name');
|
||||
$strcoefficient = get_string('coefficient',"scorm");
|
||||
$strcoefficient = "Thiet lap he so";
|
||||
$strcoefficient = get_string('coefficient',"scorm");
|
||||
$strcoefficient = "Thiet lap he so";
|
||||
if (empty($b)) {
|
||||
print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
|
||||
"$navigation <a href=\"index.php?id=$course->id\">$strscorms</a>
|
||||
|
@ -77,32 +77,32 @@
|
|||
|
||||
$scormpixdir = $CFG->modpixpath.'/scorm/pix';
|
||||
|
||||
//Phan trinh bay chinh
|
||||
//Phan trinh bay chinh
|
||||
?>
|
||||
|
||||
<?php
|
||||
$examScoes = get_records_select('scorm_scoes', 'scorm ='.($scorm->id).' and minnormalizedmeasure > -1');
|
||||
foreach ($examScoes as $examSco){
|
||||
$newcoefficient = optional_param($examSco->id,'',PARAM_INT);
|
||||
$sco = get_record('scorm_scoes','scorm',$scorm->id,'id',$examSco->id,'','');
|
||||
$sco->score_coefficient = $newcoefficient;
|
||||
$ketqua = update_record('scorm_scoes',$sco);
|
||||
//echo "Cap nhat $examSco->id voi he so diem ".$newcoefficient."<br>";
|
||||
}
|
||||
$examScoes = get_records_select('scorm_scoes', 'scorm ='.($scorm->id).' and minnormalizedmeasure > -1');
|
||||
foreach ($examScoes as $examSco){
|
||||
$newcoefficient = optional_param($examSco->id,'',PARAM_INT);
|
||||
$sco = get_record('scorm_scoes','scorm',$scorm->id,'id',$examSco->id,'','');
|
||||
$sco->score_coefficient = $newcoefficient;
|
||||
$ketqua = update_record('scorm_scoes',$sco);
|
||||
//echo "Cap nhat $examSco->id voi he so diem ".$newcoefficient."<br>";
|
||||
}
|
||||
|
||||
if ($ketqua)
|
||||
{
|
||||
echo "".get_string('updatesuccess','scorm');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "".get_string('updatefail','scorm');
|
||||
}
|
||||
if ($ketqua)
|
||||
{
|
||||
echo "".get_string('updatesuccess','scorm');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "".get_string('updatefail','scorm');
|
||||
}
|
||||
|
||||
echo "<br><br><a href=coefficientsetting.php?id=$id>".get_string('back','scorm')."</a>"
|
||||
echo "<br><br><a href=coefficientsetting.php?id=$id>".get_string('back','scorm')."</a>"
|
||||
?>
|
||||
<?php
|
||||
//ket thuc phan trinh bay chinh
|
||||
//ket thuc phan trinh bay chinh
|
||||
|
||||
if (empty($noheader)) {
|
||||
print_footer($course);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
require_once("../../config.php");
|
||||
require_once('locallib.php');
|
||||
|
||||
|
||||
$id = optional_param('id', '', PARAM_INT); // Course Module ID, or
|
||||
$a = optional_param('a', '', PARAM_INT); // SCORM ID
|
||||
$b = optional_param('b', '', PARAM_INT); // SCO ID
|
||||
|
@ -58,7 +58,7 @@
|
|||
$strscorm = get_string("modulename", "scorm");
|
||||
$strreport = get_string("report", "scorm");
|
||||
$strname = get_string('name');
|
||||
$strcoefficient = get_string('coefficient','scorm');
|
||||
$strcoefficient = get_string('coefficient','scorm');
|
||||
if (empty($b)) {
|
||||
print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
|
||||
"$navigation <a href=\"index.php?id=$course->id\">$strscorms</a>
|
||||
|
@ -76,12 +76,12 @@
|
|||
|
||||
$scormpixdir = $CFG->modpixpath.'/scorm/pix';
|
||||
|
||||
//Phan trinh bay chinh
|
||||
//Phan trinh bay chinh
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
function validate_form()
|
||||
{
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
<form name="form" method="post" action="coefficientconfirm.php" onsubmit="return validate_form();" >
|
||||
|
@ -92,15 +92,15 @@ function validate_form()
|
|||
</tr>
|
||||
|
||||
<?php
|
||||
$examScoes = get_records_select('scorm_scoes', 'scorm ='.($scorm->id).' and minnormalizedmeasure > -1');
|
||||
if(!empty($examScoes))
|
||||
{
|
||||
|
||||
foreach ($examScoes as $examSco){
|
||||
echo "<tr><td>";
|
||||
echo "$examSco->identifier.</td><td><input type='text' name='$examSco->id' class='scormtextbox' value=$examSco->score_coefficient /></td></tr><br>";
|
||||
}
|
||||
}
|
||||
$examScoes = get_records_select('scorm_scoes', 'scorm ='.($scorm->id).' and minnormalizedmeasure > -1');
|
||||
if(!empty($examScoes))
|
||||
{
|
||||
|
||||
foreach ($examScoes as $examSco){
|
||||
echo "<tr><td>";
|
||||
echo "$examSco->identifier.</td><td><input type='text' name='$examSco->id' class='scormtextbox' value=$examSco->score_coefficient /></td></tr><br>";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
|
@ -109,7 +109,7 @@ function validate_form()
|
|||
<input type="submit" value="<?php print_string('savechanges') ?>" />
|
||||
</form>
|
||||
<?php
|
||||
//ket thuc phan trinh bay chinh
|
||||
//ket thuc phan trinh bay chinh
|
||||
|
||||
if (empty($noheader)) {
|
||||
print_footer($course);
|
||||
|
|
|
@ -91,7 +91,7 @@ function SCORMapi1_3() {
|
|||
'cmi.learner_preference.language':{'defaultvalue':'', 'format':CMIString250, 'mod':'rw'},
|
||||
'cmi.learner_preference.delivery_speed':{'defaultvalue':'0', 'format':CMIDecimal, 'range':speed_range, 'mod':'rw'},
|
||||
'cmi.learner_preference.audio_caption':{'defaultvalue':'0', 'format':CMISInteger, 'range':text_range, 'mod':'rw'},
|
||||
'cmi.location':{'defaultvalue':<?php echo isset($userdata->{'cmi.location'})?'\''.$userdata->{'cmi.location'}.'\'':'null' ?>, 'format':CMIString1000, 'mod':'rw'},
|
||||
'cmi.location':{'defaultvalue':<?php echo isset($userdata->{'cmi.location'})?'\''.$userdata->{'cmi.location'}.'\'':'null' ?>, 'format':CMIString1000, 'mod':'rw'},
|
||||
'cmi.max_time_allowed':{'defaultvalue':<?php echo isset($userdata->maxtimeallowed)?'\''.$userdata->maxtimeallowed.'\'':'null' ?>, 'mod':'r'},
|
||||
'cmi.mode':{'defaultvalue':'<?php echo $userdata->mode ?>', 'mod':'r'},
|
||||
'cmi.objectives._children':{'defaultvalue':objectives_children, 'mod':'r'},
|
||||
|
|
|
@ -189,7 +189,7 @@ function scorm_upgrade($oldversion) {
|
|||
foreach($scorms as $scorm) {
|
||||
if ($scorm->browsemode = 1) {
|
||||
$scorm->hidebrowse = 0;
|
||||
} else {
|
||||
} else {
|
||||
$scorm->hidebrowse = 1;
|
||||
}
|
||||
update_record('scorm',$scorm);
|
||||
|
|
|
@ -205,7 +205,7 @@ function scorm_upgrade($oldversion) {
|
|||
foreach($scorms as $scorm) {
|
||||
if ($scorm->browsemode = 1) {
|
||||
$scorm->hidebrowse = 0;
|
||||
} else {
|
||||
} else {
|
||||
$scorm->hidebrowse = 1;
|
||||
}
|
||||
update_record('scorm',$scorm);
|
||||
|
|
|
@ -71,8 +71,8 @@
|
|||
} else if (isstudent($course->id)) {
|
||||
require_once('locallib.php');
|
||||
$report = scorm_grade_user_new(get_records('scorm_scoes','scorm',$scorm->id), $USER->id, $scorm->grademethod);
|
||||
$sco_count = scorm_get_user_sco_count($scorm->id,$USER->id);
|
||||
$reportshow = get_string('implement','scorm').$sco_count.get_string('lesson','scorm') ."<br><table width=".($report*100)."% bgcolor=#800000><tr><td height=15></td></tr></table>".get_string('scoreRate','scorm').": ".($report*100)."%"; }
|
||||
$sco_count = scorm_get_user_sco_count($scorm->id,$USER->id);
|
||||
$reportshow = get_string('implement','scorm').$sco_count.get_string('lesson','scorm') ."<br><table width=".($report*100)."% bgcolor=#800000><tr><td height=15></td></tr></table>".get_string('scoreRate','scorm').": ".($report*100)."%"; }
|
||||
if (!$scorm->visible) {
|
||||
//Show dimmed if the mod is hidden
|
||||
$table->data[] = array ($tt, "<a class=\"dimmed\" href=\"view.php?id=$scorm->coursemodule\">".format_string($scorm->name,true)."</a>",
|
||||
|
|
|
@ -112,10 +112,10 @@ function scorm_update_instance($scorm) {
|
|||
|
||||
// Check if scorm manifest needs to be reparsed
|
||||
if ($scorm->launch == 0) {
|
||||
//$f = "D:\\test.txt";
|
||||
//@$ft = fopen($f,"a");
|
||||
//fwrite($ft,"\n Xu ly trong update trong lib.php \n");
|
||||
//fwrite($ft,"\n Lauch co gia tri \n".($scorm->launch));
|
||||
//$f = "D:\\test.txt";
|
||||
//@$ft = fopen($f,"a");
|
||||
//fwrite($ft,"\n Xu ly trong update trong lib.php \n");
|
||||
//fwrite($ft,"\n Lauch co gia tri \n".($scorm->launch));
|
||||
|
||||
// Delete old related records
|
||||
delete_records('scorm_scoes','scorm',$scorm->id);
|
||||
|
@ -124,9 +124,9 @@ function scorm_update_instance($scorm) {
|
|||
delete_records('scorm_sequencing_rolluprules','scormid',$scorm->id);
|
||||
delete_records('scorm_sequencing_rolluprule','scormid',$scorm->id);
|
||||
delete_records('scorm_sequencing_rollupruleconditions','scormid',$scorm->id);
|
||||
delete_records('scorm_sequencing_rolluprulecondition','scormid',$scorm->id);
|
||||
delete_records('scorm_sequencing_rolluprulecondition','scormid',$scorm->id);
|
||||
delete_records('scorm_sequencing_ruleconditions','scormid',$scorm->id);
|
||||
delete_records('scorm_sequencing_rulecondition','scormid',$scorm->id);
|
||||
delete_records('scorm_sequencing_rulecondition','scormid',$scorm->id);
|
||||
|
||||
|
||||
$scorm->dir = $CFG->dataroot.'/'.$scorm->course.'/moddata/scorm';
|
||||
|
@ -193,7 +193,7 @@ function scorm_delete_instance($id) {
|
|||
}
|
||||
if (! delete_records('scorm_sequencing_ruleconditions', 'scormid', $scorm->id)) {
|
||||
$result = false;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -220,8 +220,8 @@ function scorm_user_outline($course, $user, $mod, $scorm) {
|
|||
require_once('locallib.php');
|
||||
foreach ($scoes as $sco) {
|
||||
if ($sco->launch!='') {
|
||||
$scores->count++;
|
||||
if ($userdata = scorm_get_tracks($sco->id, $user->id)) {
|
||||
$scores->count++;
|
||||
if ($userdata = scorm_get_tracks($sco->id, $user->id)) {
|
||||
if (!isset($scores->{$userdata->status})) {
|
||||
$scores->{$userdata->status} = 1;
|
||||
} else {
|
||||
|
@ -240,7 +240,7 @@ function scorm_user_outline($course, $user, $mod, $scorm) {
|
|||
}
|
||||
switch ($scorm->grademethod) {
|
||||
case GRADEHIGHEST:
|
||||
if ($scores->values > 0) {
|
||||
if ($scores->values > 0) {
|
||||
$return->info = get_string('score','scorm').': '.$scores->max;
|
||||
$return->time = $scores->lastmodify;
|
||||
}
|
||||
|
@ -261,30 +261,30 @@ function scorm_user_outline($course, $user, $mod, $scorm) {
|
|||
$return->info = '';
|
||||
$scores->notattempted = $scores->count;
|
||||
if (isset($scores->completed)) {
|
||||
$return->info .= get_string('completed','scorm').': '.$scores->completed.'<br />';
|
||||
$return->info .= get_string('completed','scorm').': '.$scores->completed.'<br />';
|
||||
$scores->notattempted -= $scores->completed;
|
||||
}
|
||||
if (isset($scores->passed)) {
|
||||
$return->info .= get_string('passed','scorm').': '.$scores->passed.'<br />';
|
||||
$return->info .= get_string('passed','scorm').': '.$scores->passed.'<br />';
|
||||
$scores->notattempted -= $scores->passed;
|
||||
}
|
||||
if (isset($scores->failed)) {
|
||||
$return->info .= get_string('failed','scorm').': '.$scores->failed.'<br />';
|
||||
$return->info .= get_string('failed','scorm').': '.$scores->failed.'<br />';
|
||||
$scores->notattempted -= $scores->failed;
|
||||
}
|
||||
if (isset($scores->incomplete)) {
|
||||
$return->info .= get_string('incomplete','scorm').': '.$scores->incomplete.'<br />';
|
||||
$return->info .= get_string('incomplete','scorm').': '.$scores->incomplete.'<br />';
|
||||
$scores->notattempted -= $scores->incomplete;
|
||||
}
|
||||
if (isset($scores->browsed)) {
|
||||
$return->info .= get_string('browsed','scorm').': '.$scores->browsed.'<br />';
|
||||
$return->info .= get_string('browsed','scorm').': '.$scores->browsed.'<br />';
|
||||
$scores->notattempted -= $scores->browsed;
|
||||
}
|
||||
$return->time = $scores->lastmodify;
|
||||
if ($return->info == '') {
|
||||
$return = NULL;
|
||||
} else {
|
||||
$return->info .= get_string('notattempted','scorm').': '.$scores->notattempted.'<br />';
|
||||
$return->info .= get_string('notattempted','scorm').': '.$scores->notattempted.'<br />';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -422,7 +422,7 @@ function scorm_user_complete($course, $user, $mod, $scorm) {
|
|||
echo get_string('report','scorm').":<br />\n";
|
||||
echo $report;
|
||||
} else {
|
||||
print_string('noactivity','scorm');
|
||||
print_string('noactivity','scorm');
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
require_once("../../config.php");
|
||||
require_once('locallib.php');
|
||||
|
||||
|
||||
$id = optional_param('id', '', PARAM_INT); // Course Module ID, or
|
||||
$a = optional_param('a', '', PARAM_INT); // scorm ID
|
||||
$scoid = required_param('scoid', PARAM_INT); // sco ID
|
||||
|
|
|
@ -145,8 +145,8 @@
|
|||
result.concat('<?php print_string('errorlogs','scorm') ?>:\n'+errorlogs);
|
||||
}
|
||||
alert(result);
|
||||
alert("Khong tuan chuan Scorm");
|
||||
document.form.name.focus();
|
||||
alert("Khong tuan chuan Scorm");
|
||||
document.form.name.focus();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
require_once("../../config.php");
|
||||
require_once('locallib.php');
|
||||
|
||||
|
||||
$id = optional_param('id', '', PARAM_INT); // Course Module ID, or
|
||||
$a = optional_param('a', '', PARAM_INT); // SCORM ID
|
||||
$b = optional_param('b', '', PARAM_INT); // SCO ID
|
||||
|
@ -314,54 +314,54 @@
|
|||
error('Missing script parameter');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print_heading(format_string(get_string('timestatistic','scorm')));
|
||||
$scousers=get_records_select("scorm_scoes_track", "scormid='$scorm->id' GROUP BY userid,scormid", "", "userid,scormid");
|
||||
$attempt = scorm_get_last_attempt($scorm->id,$USER->id);
|
||||
|
||||
foreach($scousers as $scouser){
|
||||
$str = 'scormid ='.($scorm->id).' and userid = '.$scouser->userid.' and attempt = '.$attempt.' ORDER BY timemodified asc';
|
||||
$endtrack = get_record_select("scorm_scoes_track", $str,'max(timemodified) as maxtimemodified');
|
||||
$scousers=get_records_select("scorm_scoes_track", "scormid='$scorm->id' GROUP BY userid,scormid", "", "userid,scormid");
|
||||
$attempt = scorm_get_last_attempt($scorm->id,$USER->id);
|
||||
|
||||
foreach($scousers as $scouser){
|
||||
$str = 'scormid ='.($scorm->id).' and userid = '.$scouser->userid.' and attempt = '.$attempt.' ORDER BY timemodified asc';
|
||||
$endtrack = get_record_select("scorm_scoes_track", $str,'max(timemodified) as maxtimemodified');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Phan trinh bay thong ke theo thoi gian
|
||||
$table = new stdClass();
|
||||
$table->head = array(' ', get_string('name','scorm'));
|
||||
$table->align = array('center', 'left');
|
||||
$table->wrap = array('nowrap', 'nowrap');
|
||||
$table->width = '100%';
|
||||
$table->size = array(10, '*');
|
||||
$table = new stdClass();
|
||||
$table->head = array(' ', get_string('name','scorm'));
|
||||
$table->align = array('center', 'left');
|
||||
$table->wrap = array('nowrap', 'nowrap');
|
||||
$table->width = '100%';
|
||||
$table->size = array(10, '*');
|
||||
|
||||
$table->head[]=scorm_string_wrap(get_string('beginTime','scorm'));
|
||||
$table->align[] = 'center';
|
||||
$table->wrap[] = 'nowrap';
|
||||
$table->size[] = '*';
|
||||
$table->head[]=scorm_string_wrap(get_string('beginTime','scorm'));
|
||||
$table->align[] = 'center';
|
||||
$table->wrap[] = 'nowrap';
|
||||
$table->size[] = '*';
|
||||
|
||||
$table->head[]=scorm_string_wrap(get_string('endTime','scorm'));
|
||||
$table->align[] = 'center';
|
||||
$table->wrap[] = 'nowrap';
|
||||
$table->size[] = '*';
|
||||
$table->head[]=scorm_string_wrap(get_string('endTime','scorm'));
|
||||
$table->align[] = 'center';
|
||||
$table->wrap[] = 'nowrap';
|
||||
$table->size[] = '*';
|
||||
|
||||
$row = array();
|
||||
$row[] = "";
|
||||
$row[] = "(".get_string('coefficient','scorm').")";
|
||||
foreach($scousers as $scouser){
|
||||
$userdata = scorm_get_user_data($scouser->userid);
|
||||
$row = array();
|
||||
$row[] = print_user_picture($scouser->userid, $course->id, $userdata->picture, false, true);
|
||||
$row[] = "<a href=\"$CFG->wwwroot/user/view.php?id=$scouser->userid&course=$course->id\">".
|
||||
"$userdata->firstname $userdata->lastname</a>";
|
||||
$str = 'scormid ='.($scorm->id).' and userid = '.$scouser->userid.' and attempt = '.$attempt.' ORDER BY timemodified asc';
|
||||
$begintrack = get_record_select("scorm_scoes_track", $str,'min(timemodified) as mintimemodified');
|
||||
$row[] = strftime( "%H h -%M ' - %S s - %d -%m-%Y", $begintrack->mintimemodified);
|
||||
$endtrack = get_record_select("scorm_scoes_track", $str,'max(timemodified) as maxtimemodified');
|
||||
$row[] = strftime( "%H h -%M ' - %S s - %d -%m-%Y", $endtrack->maxtimemodified);
|
||||
$table->data[] = $row;
|
||||
}
|
||||
print_table($table);
|
||||
|
||||
echo "<br><a href='viewScore.php?a=$scorm->id'>".format_string(get_string('viewscore','scorm'))."</a>";
|
||||
$row = array();
|
||||
$row[] = "";
|
||||
$row[] = "(".get_string('coefficient','scorm').")";
|
||||
foreach($scousers as $scouser){
|
||||
$userdata = scorm_get_user_data($scouser->userid);
|
||||
$row = array();
|
||||
$row[] = print_user_picture($scouser->userid, $course->id, $userdata->picture, false, true);
|
||||
$row[] = "<a href=\"$CFG->wwwroot/user/view.php?id=$scouser->userid&course=$course->id\">".
|
||||
"$userdata->firstname $userdata->lastname</a>";
|
||||
$str = 'scormid ='.($scorm->id).' and userid = '.$scouser->userid.' and attempt = '.$attempt.' ORDER BY timemodified asc';
|
||||
$begintrack = get_record_select("scorm_scoes_track", $str,'min(timemodified) as mintimemodified');
|
||||
$row[] = strftime( "%H h -%M ' - %S s - %d -%m-%Y", $begintrack->mintimemodified);
|
||||
$endtrack = get_record_select("scorm_scoes_track", $str,'max(timemodified) as maxtimemodified');
|
||||
$row[] = strftime( "%H h -%M ' - %S s - %d -%m-%Y", $endtrack->maxtimemodified);
|
||||
$table->data[] = $row;
|
||||
}
|
||||
print_table($table);
|
||||
|
||||
echo "<br><a href='viewScore.php?a=$scorm->id'>".format_string(get_string('viewscore','scorm'))."</a>";
|
||||
if (empty($noheader)) {
|
||||
print_footer($course);
|
||||
}
|
||||
|
|
|
@ -29,60 +29,60 @@
|
|||
|
||||
#-- I'm sorry for that, but all the @ annoy me
|
||||
error_reporting(0x0000377 & error_reporting());
|
||||
# error_reporting(E_ALL^E_NOTICE);
|
||||
# error_reporting(E_ALL^E_NOTICE);
|
||||
|
||||
#-- the position of your ewiki-wrapper script
|
||||
define("EWIKI_SCRIPT", "?id="); # relative/absolute to docroot
|
||||
# define("EWIKI_SCRIPT_URL", "http://...?id="); # absolute URL
|
||||
#-- the position of your ewiki-wrapper script
|
||||
define("EWIKI_SCRIPT", "?id="); # relative/absolute to docroot
|
||||
# define("EWIKI_SCRIPT_URL", "http://...?id="); # absolute URL
|
||||
|
||||
#-- change to your needs (site lang)
|
||||
define("EWIKI_NAME", "ErfurtWiki");
|
||||
define("EWIKI_PAGE_INDEX", "ErfurtWiki");
|
||||
define("EWIKI_PAGE_NEWEST", "NewestPages");
|
||||
define("EWIKI_PAGE_SEARCH", "SearchPages");
|
||||
define("EWIKI_PAGE_HITS", "MostVisitedPages");
|
||||
define("EWIKI_PAGE_VERSIONS", "MostOftenChangedPages");
|
||||
define("EWIKI_PAGE_UPDATES", "UpdatedPages");
|
||||
define("EWIKI_NAME", "ErfurtWiki");
|
||||
define("EWIKI_PAGE_INDEX", "ErfurtWiki");
|
||||
define("EWIKI_PAGE_NEWEST", "NewestPages");
|
||||
define("EWIKI_PAGE_SEARCH", "SearchPages");
|
||||
define("EWIKI_PAGE_HITS", "MostVisitedPages");
|
||||
define("EWIKI_PAGE_VERSIONS", "MostOftenChangedPages");
|
||||
define("EWIKI_PAGE_UPDATES", "UpdatedPages");
|
||||
|
||||
#-- default settings are good settings - most often ;)
|
||||
#-- default settings are good settings - most often ;)
|
||||
#- look & feel
|
||||
define("EWIKI_PRINT_TITLE", 1); # <h2>WikiPageName</h2> on top
|
||||
define("EWIKI_SPLIT_TITLE", 0); # <h2>Wiki Page Name</h2>
|
||||
define("EWIKI_CONTROL_LINE", 1); # EditThisPage-link at bottom
|
||||
define("EWIKI_LIST_LIMIT", 20); # listing limit
|
||||
define("EWIKI_PRINT_TITLE", 1); # <h2>WikiPageName</h2> on top
|
||||
define("EWIKI_SPLIT_TITLE", 0); # <h2>Wiki Page Name</h2>
|
||||
define("EWIKI_CONTROL_LINE", 1); # EditThisPage-link at bottom
|
||||
define("EWIKI_LIST_LIMIT", 20); # listing limit
|
||||
#- behaviour
|
||||
define("EWIKI_AUTO_EDIT", 1); # edit box for non-existent pages
|
||||
define("EWIKI_EDIT_REDIRECT", 1); # redirect after edit save
|
||||
define("EWIKI_DEFAULT_ACTION", "view"); # (keep!)
|
||||
define("EWIKI_CASE_INSENSITIVE", 1); # wikilink case sensitivity
|
||||
define("EWIKI_HIT_COUNTING", 1);
|
||||
define("UNIX_MILLENNIUM", 1000000000);
|
||||
define("EWIKI_AUTO_EDIT", 1); # edit box for non-existent pages
|
||||
define("EWIKI_EDIT_REDIRECT", 1); # redirect after edit save
|
||||
define("EWIKI_DEFAULT_ACTION", "view"); # (keep!)
|
||||
define("EWIKI_CASE_INSENSITIVE", 1); # wikilink case sensitivity
|
||||
define("EWIKI_HIT_COUNTING", 1);
|
||||
define("UNIX_MILLENNIUM", 1000000000);
|
||||
#- rendering
|
||||
define("EWIKI_ALLOW_HTML", 0); # often a very bad idea
|
||||
define("EWIKI_HTML_CHARS", 1); # allows for È
|
||||
define("EWIKI_ESCAPE_AT", 1); # "@" -> "@"
|
||||
define("EWIKI_ALLOW_HTML", 0); # often a very bad idea
|
||||
define("EWIKI_HTML_CHARS", 1); # allows for È
|
||||
define("EWIKI_ESCAPE_AT", 1); # "@" -> "@"
|
||||
#- http/urls
|
||||
define("EWIKI_HTTP_HEADERS", 1); # most often a good thing
|
||||
define("EWIKI_NO_CACHE", 1); # browser+proxy shall not cache
|
||||
define("EWIKI_URLENCODE", 1); # disable when _USE_PATH_INFO
|
||||
define("EWIKI_URLDECODE", 1);
|
||||
define("EWIKI_USE_PATH_INFO", 1 &&!strstr($_SERVER["SERVER_SOFTWARE"],"Apache"));
|
||||
define("EWIKI_USE_ACTION_PARAM", 1);
|
||||
define("EWIKI_ACTION_SEP_CHAR", "/");
|
||||
define("EWIKI_UP_PAGENUM", "n"); # _UP_ means "url parameter"
|
||||
define("EWIKI_UP_PAGEEND", "e");
|
||||
define("EWIKI_UP_BINARY", "binary");
|
||||
define("EWIKI_UP_UPLOAD", "upload");
|
||||
define("EWIKI_HTTP_HEADERS", 1); # most often a good thing
|
||||
define("EWIKI_NO_CACHE", 1); # browser+proxy shall not cache
|
||||
define("EWIKI_URLENCODE", 1); # disable when _USE_PATH_INFO
|
||||
define("EWIKI_URLDECODE", 1);
|
||||
define("EWIKI_USE_PATH_INFO", 1 &&!strstr($_SERVER["SERVER_SOFTWARE"],"Apache"));
|
||||
define("EWIKI_USE_ACTION_PARAM", 1);
|
||||
define("EWIKI_ACTION_SEP_CHAR", "/");
|
||||
define("EWIKI_UP_PAGENUM", "n"); # _UP_ means "url parameter"
|
||||
define("EWIKI_UP_PAGEEND", "e");
|
||||
define("EWIKI_UP_BINARY", "binary");
|
||||
define("EWIKI_UP_UPLOAD", "upload");
|
||||
#- other stuff
|
||||
define("EWIKI_DEFAULT_LANG", "en");
|
||||
define("EWIKI_CHARSET", current_charset());
|
||||
#- user permissions
|
||||
define("EWIKI_PROTECTED_MODE", 0); # disable funcs + require auth
|
||||
define("EWIKI_PROTECTED_MODE_HIDING", 0); # hides disallowed actions
|
||||
define("EWIKI_AUTH_DEFAULT_RING", 3); # 0=root 1=priv 2=user 3=view
|
||||
define("EWIKI_AUTO_LOGIN", 1); # [auth_query] on startup
|
||||
#- user permissions
|
||||
define("EWIKI_PROTECTED_MODE", 0); # disable funcs + require auth
|
||||
define("EWIKI_PROTECTED_MODE_HIDING", 0); # hides disallowed actions
|
||||
define("EWIKI_AUTH_DEFAULT_RING", 3); # 0=root 1=priv 2=user 3=view
|
||||
define("EWIKI_AUTO_LOGIN", 1); # [auth_query] on startup
|
||||
|
||||
#-- allowed WikiPageNameCharacters
|
||||
#-- allowed WikiPageNameCharacters
|
||||
|
||||
#### BEGIN MOODLE CHANGES - to remove auto-camelcase linking.
|
||||
global $moodle_disable_camel_case;
|
||||
|
@ -93,72 +93,72 @@
|
|||
else {
|
||||
#### END MOODLE CHANGES
|
||||
|
||||
define("EWIKI_CHARS_L", "a-z_µ¤$\337-\377");
|
||||
define("EWIKI_CHARS_L", "a-z_µ¤$\337-\377");
|
||||
define("EWIKI_CHARS_U", "A-Z0-9\300-\336");
|
||||
|
||||
#### BEGIN MOODLE CHANGES
|
||||
}
|
||||
#### END MOODLE CHANGES
|
||||
|
||||
define("EWIKI_CHARS", EWIKI_CHARS_L.EWIKI_CHARS_U);
|
||||
define("EWIKI_CHARS", EWIKI_CHARS_L.EWIKI_CHARS_U);
|
||||
|
||||
#-- database
|
||||
define("EWIKI_DB_TABLE_NAME", "ewiki"); # MySQL / ADOdb
|
||||
define("EWIKI_DBFILES_DIRECTORY", "/tmp"); # see "db_flat_files.php"
|
||||
define("EWIKI_DBA", "/tmp/ewiki.dba"); # see "db_dba.php"
|
||||
define("EWIKI_DBQUERY_BUFFER", 512*1024); # 512K
|
||||
define("EWIKI_INIT_PAGES", "./init-pages"); # for initialization
|
||||
define("EWIKI_DB_TABLE_NAME", "ewiki"); # MySQL / ADOdb
|
||||
define("EWIKI_DBFILES_DIRECTORY", "/tmp"); # see "db_flat_files.php"
|
||||
define("EWIKI_DBA", "/tmp/ewiki.dba"); # see "db_dba.php"
|
||||
define("EWIKI_DBQUERY_BUFFER", 512*1024); # 512K
|
||||
define("EWIKI_INIT_PAGES", "./init-pages"); # for initialization
|
||||
|
||||
define("EWIKI_DB_F_TEXT", 1<<0);
|
||||
define("EWIKI_DB_F_BINARY", 1<<1);
|
||||
define("EWIKI_DB_F_DISABLED", 1<<2);
|
||||
define("EWIKI_DB_F_HTML", 1<<3);
|
||||
define("EWIKI_DB_F_READONLY", 1<<4);
|
||||
define("EWIKI_DB_F_WRITEABLE", 1<<5);
|
||||
define("EWIKI_DB_F_APPENDONLY", 1<<6); #nyi
|
||||
define("EWIKI_DB_F_SYSTEM", 1<<7);
|
||||
define("EWIKI_DB_F_PART", 1<<8);
|
||||
define("EWIKI_DB_F_TYPE", EWIKI_DB_F_TEXT | EWIKI_DB_F_BINARY | EWIKI_DB_F_DISABLED | EWIKI_DB_F_SYSTEM | EWIKI_DB_F_PART);
|
||||
define("EWIKI_DB_F_ACCESS", EWIKI_DB_F_READONLY | EWIKI_DB_F_WRITEABLE | EWIKI_DB_F_APPENDONLY);
|
||||
define("EWIKI_DB_F_COPYMASK", EWIKI_DB_F_TYPE | EWIKI_DB_F_ACCESS);
|
||||
define("EWIKI_DB_F_TEXT", 1<<0);
|
||||
define("EWIKI_DB_F_BINARY", 1<<1);
|
||||
define("EWIKI_DB_F_DISABLED", 1<<2);
|
||||
define("EWIKI_DB_F_HTML", 1<<3);
|
||||
define("EWIKI_DB_F_READONLY", 1<<4);
|
||||
define("EWIKI_DB_F_WRITEABLE", 1<<5);
|
||||
define("EWIKI_DB_F_APPENDONLY", 1<<6); #nyi
|
||||
define("EWIKI_DB_F_SYSTEM", 1<<7);
|
||||
define("EWIKI_DB_F_PART", 1<<8);
|
||||
define("EWIKI_DB_F_TYPE", EWIKI_DB_F_TEXT | EWIKI_DB_F_BINARY | EWIKI_DB_F_DISABLED | EWIKI_DB_F_SYSTEM | EWIKI_DB_F_PART);
|
||||
define("EWIKI_DB_F_ACCESS", EWIKI_DB_F_READONLY | EWIKI_DB_F_WRITEABLE | EWIKI_DB_F_APPENDONLY);
|
||||
define("EWIKI_DB_F_COPYMASK", EWIKI_DB_F_TYPE | EWIKI_DB_F_ACCESS);
|
||||
|
||||
define("EWIKI_DBFILES_NLR", '\\n');
|
||||
define("EWIKI_DBFILES_ENCODE", 0 || (DIRECTORY_SEPARATOR != "/"));
|
||||
define("EWIKI_DBFILES_GZLEVEL", "2");
|
||||
define("EWIKI_DBFILES_NLR", '\\n');
|
||||
define("EWIKI_DBFILES_ENCODE", 0 || (DIRECTORY_SEPARATOR != "/"));
|
||||
define("EWIKI_DBFILES_GZLEVEL", "2");
|
||||
|
||||
#-- internal
|
||||
define("EWIKI_ADDPARAMDELIM", (strstr(EWIKI_SCRIPT,"?") ? "&" : "?"));
|
||||
#-- internal
|
||||
define("EWIKI_ADDPARAMDELIM", (strstr(EWIKI_SCRIPT,"?") ? "&" : "?"));
|
||||
|
||||
#-- binary content (images)
|
||||
define("EWIKI_SCRIPT_BINARY", /*"/binary.php?binary="*/ ltrim(strtok(" ".EWIKI_SCRIPT,"?"))."?".EWIKI_UP_BINARY."=" );
|
||||
define("EWIKI_CACHE_IMAGES", 1 &&!headers_sent());
|
||||
define("EWIKI_IMAGE_MAXSIZE", 64 *1024);
|
||||
define("EWIKI_IMAGE_MAXWIDTH", 3072);
|
||||
define("EWIKI_IMAGE_MAXHEIGHT", 2048);
|
||||
define("EWIKI_IMAGE_MAXALLOC", 1<<19);
|
||||
define("EWIKI_IMAGE_RESIZE", 1);
|
||||
define("EWIKI_IMAGE_ACCEPT", "image/jpeg,image/png,image/gif,application/x-shockwave-flash");
|
||||
define("EWIKI_IDF_INTERNAL", "internal://");
|
||||
define("EWIKI_ACCEPT_BINARY", 0); # for arbitrary binary data files
|
||||
#-- binary content (images)
|
||||
define("EWIKI_SCRIPT_BINARY", /*"/binary.php?binary="*/ ltrim(strtok(" ".EWIKI_SCRIPT,"?"))."?".EWIKI_UP_BINARY."=" );
|
||||
define("EWIKI_CACHE_IMAGES", 1 &&!headers_sent());
|
||||
define("EWIKI_IMAGE_MAXSIZE", 64 *1024);
|
||||
define("EWIKI_IMAGE_MAXWIDTH", 3072);
|
||||
define("EWIKI_IMAGE_MAXHEIGHT", 2048);
|
||||
define("EWIKI_IMAGE_MAXALLOC", 1<<19);
|
||||
define("EWIKI_IMAGE_RESIZE", 1);
|
||||
define("EWIKI_IMAGE_ACCEPT", "image/jpeg,image/png,image/gif,application/x-shockwave-flash");
|
||||
define("EWIKI_IDF_INTERNAL", "internal://");
|
||||
define("EWIKI_ACCEPT_BINARY", 0); # for arbitrary binary data files
|
||||
|
||||
#-- misc
|
||||
#-- misc
|
||||
define("EWIKI_TMP", $_SERVER["TEMP"] ? $_SERVER["TEMP"] : "/tmp");
|
||||
define("EWIKI_LOGLEVEL", -1); # 0=error 1=warn 2=info 3=debug
|
||||
define("EWIKI_LOGFILE", "/tmp/ewiki.log");
|
||||
define("EWIKI_LOGLEVEL", -1); # 0=error 1=warn 2=info 3=debug
|
||||
define("EWIKI_LOGFILE", "/tmp/ewiki.log");
|
||||
|
||||
#-- plugins (tasks mapped to function names)
|
||||
$ewiki_plugins["database"][] = "ewiki_database_mysql";
|
||||
$ewiki_plugins["edit_preview"][] = "ewiki_page_edit_preview";
|
||||
$ewiki_plugins["render"][] = "ewiki_format";
|
||||
$ewiki_plugins["init"][-5] = "ewiki_localization";
|
||||
$ewiki_plugins["init"][-1] = "ewiki_binary";
|
||||
#-- plugins (tasks mapped to function names)
|
||||
$ewiki_plugins["database"][] = "ewiki_database_mysql";
|
||||
$ewiki_plugins["edit_preview"][] = "ewiki_page_edit_preview";
|
||||
$ewiki_plugins["render"][] = "ewiki_format";
|
||||
$ewiki_plugins["init"][-5] = "ewiki_localization";
|
||||
$ewiki_plugins["init"][-1] = "ewiki_binary";
|
||||
$ewiki_plugins["handler"][-105] = "ewiki_eventually_initialize";
|
||||
$ewiki_plugins["handler"][] = "ewiki_intermap_walking";
|
||||
$ewiki_plugins["view_append"][-1] = "ewiki_control_links";
|
||||
$ewiki_plugins["view_append"][-1] = "ewiki_control_links";
|
||||
$ewiki_plugins["view_final"][-1] = "ewiki_add_title";
|
||||
$ewiki_plugins["page_final"][] = "ewiki_http_headers";
|
||||
$ewiki_plugins["page_final"][99115115] = "ewiki_page_css_container";
|
||||
$ewiki_plugins["edit_form_final"][] = "ewiki_page_edit_form_final_imgupload";
|
||||
$ewiki_plugins["edit_form_final"][] = "ewiki_page_edit_form_final_imgupload";
|
||||
$ewiki_plugins["format_block"]["pre"][] = "ewiki_format_pre";
|
||||
$ewiki_plugins["format_block"]["code"][] = "ewiki_format_pre";
|
||||
$ewiki_plugins["format_block"]["htm"][] = "ewiki_format_html";
|
||||
|
@ -166,36 +166,36 @@
|
|||
$ewiki_plugins["format_block"]["comment"][] = "ewiki_format_comment";
|
||||
|
||||
|
||||
#-- internal pages
|
||||
$ewiki_plugins["page"][EWIKI_PAGE_NEWEST] = "ewiki_page_newest";
|
||||
$ewiki_plugins["page"][EWIKI_PAGE_SEARCH] = "ewiki_page_search";
|
||||
if (EWIKI_HIT_COUNTING) $ewiki_plugins["page"][EWIKI_PAGE_HITS] = "ewiki_page_hits";
|
||||
$ewiki_plugins["page"][EWIKI_PAGE_VERSIONS] = "ewiki_page_versions";
|
||||
$ewiki_plugins["page"][EWIKI_PAGE_UPDATES] = "ewiki_page_updates";
|
||||
#-- internal pages
|
||||
$ewiki_plugins["page"][EWIKI_PAGE_NEWEST] = "ewiki_page_newest";
|
||||
$ewiki_plugins["page"][EWIKI_PAGE_SEARCH] = "ewiki_page_search";
|
||||
if (EWIKI_HIT_COUNTING) $ewiki_plugins["page"][EWIKI_PAGE_HITS] = "ewiki_page_hits";
|
||||
$ewiki_plugins["page"][EWIKI_PAGE_VERSIONS] = "ewiki_page_versions";
|
||||
$ewiki_plugins["page"][EWIKI_PAGE_UPDATES] = "ewiki_page_updates";
|
||||
|
||||
#-- page actions
|
||||
$ewiki_plugins["action"]["edit"] = "ewiki_page_edit";
|
||||
$ewiki_plugins["action_always"]["links"] = "ewiki_page_links";
|
||||
$ewiki_plugins["action"]["info"] = "ewiki_page_info";
|
||||
$ewiki_plugins["action"]["view"] = "ewiki_page_view";
|
||||
#-- page actions
|
||||
$ewiki_plugins["action"]["edit"] = "ewiki_page_edit";
|
||||
$ewiki_plugins["action_always"]["links"] = "ewiki_page_links";
|
||||
$ewiki_plugins["action"]["info"] = "ewiki_page_info";
|
||||
$ewiki_plugins["action"]["view"] = "ewiki_page_view";
|
||||
|
||||
#-- helper vars ---------------------------------------------------
|
||||
$ewiki_config["idf"]["url"] = array("http://", "mailto:", "internal://", "ftp://", "https://", "irc://", "telnet://", "news://", "chrome://", "file://", "gopher://", "httpz://");
|
||||
$ewiki_config["idf"]["img"] = array(".jpeg", ".png", ".jpg", ".gif", ".j2k");
|
||||
$ewiki_config["idf"]["obj"] = array(".swf", ".svg");
|
||||
#-- helper vars ---------------------------------------------------
|
||||
$ewiki_config["idf"]["url"] = array("http://", "mailto:", "internal://", "ftp://", "https://", "irc://", "telnet://", "news://", "chrome://", "file://", "gopher://", "httpz://");
|
||||
$ewiki_config["idf"]["img"] = array(".jpeg", ".png", ".jpg", ".gif", ".j2k");
|
||||
$ewiki_config["idf"]["obj"] = array(".swf", ".svg");
|
||||
|
||||
#-- entitle actions
|
||||
$ewiki_config["action_links"]["view"] = @array_merge(array(
|
||||
"edit" => "EDITTHISPAGE", # ewiki_t() is called on these
|
||||
"links" => "BACKLINKS",
|
||||
"info" => "PAGEHISTORY",
|
||||
"like" => "LIKEPAGES",
|
||||
), @$ewiki_config["action_links"]["view"]
|
||||
#-- entitle actions
|
||||
$ewiki_config["action_links"]["view"] = @array_merge(array(
|
||||
"edit" => "EDITTHISPAGE", # ewiki_t() is called on these
|
||||
"links" => "BACKLINKS",
|
||||
"info" => "PAGEHISTORY",
|
||||
"like" => "LIKEPAGES",
|
||||
), @$ewiki_config["action_links"]["view"]
|
||||
);
|
||||
$ewiki_config["action_links"]["info"] = @array_merge(array(
|
||||
"view" => "browse",
|
||||
"edit" => "fetchback",
|
||||
), @$ewiki_config["action_links"]["info"]
|
||||
$ewiki_config["action_links"]["info"] = @array_merge(array(
|
||||
"view" => "browse",
|
||||
"edit" => "fetchback",
|
||||
), @$ewiki_config["action_links"]["info"]
|
||||
);
|
||||
|
||||
#-- variable configuration settings (go into '$ewiki_config')
|
||||
|
@ -209,72 +209,72 @@
|
|||
"script" => EWIKI_SCRIPT,
|
||||
"script_url" => (defined("EWIKI_SCRIPT_URL")?EWIKI_SCRIPT_URL:NULL),
|
||||
"script_binary" => EWIKI_SCRIPT_BINARY,
|
||||
#-- heart of the wiki -- don't try to read this! ;)
|
||||
#-- heart of the wiki -- don't try to read this! ;)
|
||||
|
||||
"wiki_pre_scan_regex" => '/
|
||||
(?<![~!])
|
||||
((?:(?:\w+:)*['.EWIKI_CHARS_U.']+['.EWIKI_CHARS_L.']+){2,}[\w\d]*)
|
||||
|\^([-'.EWIKI_CHARS_L.EWIKI_CHARS_U.']{3,})
|
||||
|\[ (?:"[^\]\"]+" | \s+ | [^:\]#]+\|)* ([^\|\"\[\]\#]+) (?:\s+ | "[^\]\"]+")* [\]\#]
|
||||
|(\w{3,9}:\/\/[^?#\s\[\]\'\"\)\,<]+) /x',
|
||||
"wiki_pre_scan_regex" => '/
|
||||
(?<![~!])
|
||||
((?:(?:\w+:)*['.EWIKI_CHARS_U.']+['.EWIKI_CHARS_L.']+){2,}[\w\d]*)
|
||||
|\^([-'.EWIKI_CHARS_L.EWIKI_CHARS_U.']{3,})
|
||||
|\[ (?:"[^\]\"]+" | \s+ | [^:\]#]+\|)* ([^\|\"\[\]\#]+) (?:\s+ | "[^\]\"]+")* [\]\#]
|
||||
|(\w{3,9}:\/\/[^?#\s\[\]\'\"\)\,<]+) /x',
|
||||
|
||||
"wiki_link_regex" => "\007 [!~]?(
|
||||
\#?\[[^<>\[\]\n]+\] |
|
||||
\^[-".EWIKI_CHARS_U.EWIKI_CHARS_L."]{3,} |
|
||||
\b([\w]{3,}:)*([".EWIKI_CHARS_U."]+[".EWIKI_CHARS_L."]+){2,}\#?[\w\d]* |
|
||||
([a-z]{2,9}://|mailto:)[^\s\[\]\'\"\)\,<]+ |
|
||||
\w[-_.+\w]+@(\w[-_\w]+[.])+\w{2,} ) \007x",
|
||||
\#?\[[^<>\[\]\n]+\] |
|
||||
\^[-".EWIKI_CHARS_U.EWIKI_CHARS_L."]{3,} |
|
||||
\b([\w]{3,}:)*([".EWIKI_CHARS_U."]+[".EWIKI_CHARS_L."]+){2,}\#?[\w\d]* |
|
||||
([a-z]{2,9}://|mailto:)[^\s\[\]\'\"\)\,<]+ |
|
||||
\w[-_.+\w]+@(\w[-_\w]+[.])+\w{2,} ) \007x",
|
||||
|
||||
#-- rendering ruleset
|
||||
#-- rendering ruleset
|
||||
"wm_indent" => '<div style="margin-left:15px;" class="indent">',
|
||||
"wm_table_defaults" => 'cellpadding="2" border="1" cellspacing="0"',
|
||||
"wm_whole_line" => array(),
|
||||
"htmlentities" => array(
|
||||
"&" => "&",
|
||||
">" => ">",
|
||||
"<" => "<",
|
||||
"&" => "&",
|
||||
">" => ">",
|
||||
"<" => "<",
|
||||
),
|
||||
"wm_source" => array(
|
||||
"%%%" => "<br />",
|
||||
"\t" => " ",
|
||||
"\n;:" => "\n ", # workaround, replaces the old ;:
|
||||
"%%%" => "<br />",
|
||||
"\t" => " ",
|
||||
"\n;:" => "\n ", # workaround, replaces the old ;:
|
||||
),
|
||||
"wm_list" => array(
|
||||
"-" => array('ul type="square"', "", "li"),
|
||||
"*" => array('ul type="circle"', "", "li"),
|
||||
"#" => array("ol", "", "li"),
|
||||
":" => array("dl", "dt", "dd"),
|
||||
#<out># ";" => array("dl", "dt", "dd"),
|
||||
"-" => array('ul type="square"', "", "li"),
|
||||
"*" => array('ul type="circle"', "", "li"),
|
||||
"#" => array("ol", "", "li"),
|
||||
":" => array("dl", "dt", "dd"),
|
||||
#<out># ";" => array("dl", "dt", "dd"),
|
||||
),
|
||||
"wm_style" => array(
|
||||
"'''''" => array("<b><i>", "</i></b>"),
|
||||
"'''" => array("<b>", "</b>"),
|
||||
"___" => array("<i><b>", "</b></i>"),
|
||||
"''" => array("<em>", "</em>"),
|
||||
"__" => array("<strong>", "</strong>"),
|
||||
"^^" => array("<sup>", "</sup>"),
|
||||
"==" => array("<tt>", "</tt>"),
|
||||
#<off># "***" => array("<b><i>", "</i></b>"),
|
||||
#<off># "###" => array("<big><b>", "</b></big>"),
|
||||
"**" => array("<b>", "</b>"),
|
||||
"##" => array("<big>", "</big>"),
|
||||
"µµ" => array("<small>", "</small>"),
|
||||
"'''''" => array("<b><i>", "</i></b>"),
|
||||
"'''" => array("<b>", "</b>"),
|
||||
"___" => array("<i><b>", "</b></i>"),
|
||||
"''" => array("<em>", "</em>"),
|
||||
"__" => array("<strong>", "</strong>"),
|
||||
"^^" => array("<sup>", "</sup>"),
|
||||
"==" => array("<tt>", "</tt>"),
|
||||
#<off># "***" => array("<b><i>", "</i></b>"),
|
||||
#<off># "###" => array("<big><b>", "</b></big>"),
|
||||
"**" => array("<b>", "</b>"),
|
||||
"##" => array("<big>", "</big>"),
|
||||
"µµ" => array("<small>", "</small>"),
|
||||
),
|
||||
"wm_start_end" => array(
|
||||
),
|
||||
#-- rendering plugins
|
||||
#-- rendering plugins
|
||||
"format_block" => array(
|
||||
"html" => array("<html>", "</html>", "html", 0x0000),
|
||||
"htm" => array("<htm>", "</htm>", "html", 0x0003),
|
||||
"code" => array("<code>", "</code>", false, 0x0000),
|
||||
"pre" => array("<pre>", "</pre>", false, 0x003F),
|
||||
"comment" => array("\n<!--", "-->", false, 0x0030),
|
||||
# "verbatim" => array("<verbatim>", "</verbatim>", false, 0x0000),
|
||||
"html" => array("<html>", "</html>", "html", 0x0000),
|
||||
"htm" => array("<htm>", "</htm>", "html", 0x0003),
|
||||
"code" => array("<code>", "</code>", false, 0x0000),
|
||||
"pre" => array("<pre>", "</pre>", false, 0x003F),
|
||||
"comment" => array("\n<!--", "-->", false, 0x0030),
|
||||
# "verbatim" => array("<verbatim>", "</verbatim>", false, 0x0000),
|
||||
),
|
||||
"format_params" => array(
|
||||
"scan_links" => 1,
|
||||
"html" => EWIKI_ALLOW_HTML,
|
||||
"mpi" => 1,
|
||||
"scan_links" => 1,
|
||||
"html" => EWIKI_ALLOW_HTML,
|
||||
"mpi" => 1,
|
||||
),
|
||||
);
|
||||
foreach ($ewiki_config_DEFAULTSTMP as $set => $val) {
|
||||
|
@ -292,9 +292,9 @@
|
|||
}
|
||||
$ewiki_config_DEFAULTSTMP = $valv = $vali = $val = NULL;
|
||||
|
||||
#-- init stuff, autostarted parts
|
||||
ksort($ewiki_plugins["init"]);
|
||||
if ($pf_a = $ewiki_plugins["init"]) foreach ($pf_a as $pf) {
|
||||
#-- init stuff, autostarted parts
|
||||
ksort($ewiki_plugins["init"]);
|
||||
if ($pf_a = $ewiki_plugins["init"]) foreach ($pf_a as $pf) {
|
||||
// Binary Handling starts here
|
||||
#### MOODLE CHANGE TO BE COMPATIBLE WITH PHP 4.1
|
||||
#if(headers_sent($file,$line)) {
|
||||
|
@ -304,52 +304,52 @@
|
|||
}
|
||||
$pf($GLOBALS);
|
||||
}
|
||||
unset($ewiki_plugins["init"]);
|
||||
unset($ewiki_plugins["init"]);
|
||||
|
||||
#-- text (never remove the "C" or "en" sections!)
|
||||
#-- text (never remove the "C" or "en" sections!)
|
||||
#
|
||||
$ewiki_t["C"] = @array_merge(@$ewiki_t["C"], array(
|
||||
$ewiki_t["C"] = @array_merge(@$ewiki_t["C"], array(
|
||||
"DATE" => "%a, %d %b %G %T %Z",
|
||||
"EDIT_TEXTAREA_RESIZE_JS" => '<a href="javascript:ewiki_enlarge()" style="text-decoration:none">+</a><script type="text/javascript"><!--'."\n".'function ewiki_enlarge() {var ta=document.getElementById("ewiki_content");ta.style.width=((ta.cols*=1.1)*10).toString()+"px";ta.style.height=((ta.rows*=1.1)*30).toString()+"px";}'."\n".'//--></script>',
|
||||
"EDIT_TEXTAREA_RESIZE_JS" => '<a href="javascript:ewiki_enlarge()" style="text-decoration:none">+</a><script type="text/javascript"><!--'."\n".'function ewiki_enlarge() {var ta=document.getElementById("ewiki_content");ta.style.width=((ta.cols*=1.1)*10).toString()+"px";ta.style.height=((ta.rows*=1.1)*30).toString()+"px";}'."\n".'//--></script>',
|
||||
));
|
||||
#
|
||||
$ewiki_t["en"] = @array_merge(@$ewiki_t["en"], array(
|
||||
"EDITTHISPAGE" => "EditThisPage",
|
||||
$ewiki_t["en"] = @array_merge(@$ewiki_t["en"], array(
|
||||
"EDITTHISPAGE" => "EditThisPage",
|
||||
"APPENDTOPAGE" => "Add to",
|
||||
"BACKLINKS" => "BackLinks",
|
||||
"PAGESLINKINGTO" => "Pages linking to \$title",
|
||||
"PAGEHISTORY" => "PageInfo",
|
||||
"INFOABOUTPAGE" => "Information about page",
|
||||
"LIKEPAGES" => "Pages like this",
|
||||
"NEWESTPAGES" => "Newest Pages",
|
||||
"LASTCHANGED" => "last changed on %c",
|
||||
"DOESNOTEXIST" => "This page does not yet exist, please click on EditThisPage if you'd like to create it.",
|
||||
"DISABLEDPAGE" => "This page is currently not available.",
|
||||
"ERRVERSIONSAVE" => "Sorry, while you edited this page someone else
|
||||
did already save a changed version. Please go back to the
|
||||
previous screen and copy your changes to your computers
|
||||
clipboard to insert it again after you reload the edit
|
||||
screen.",
|
||||
"ERRORSAVING" => "An error occoured while saving your changes. Please try again.",
|
||||
"THANKSFORCONTRIBUTION" => "Thank you for your contribution!",
|
||||
"CANNOTCHANGEPAGE" => "This page cannot be changed.",
|
||||
"OLDVERCOMEBACK" => "Make this old version come back to replace the current one",
|
||||
"PREVIEW" => "Preview",
|
||||
"SAVE" => "Save",
|
||||
"CANCEL_EDIT" => "CancelEditing",
|
||||
"UPLOAD_PICTURE_BUTTON" => "upload picture >>>",
|
||||
"EDIT_FORM_1" => "<a href=\"".EWIKI_SCRIPT."GoodStyle\">GoodStyle</a> is to
|
||||
write what comes to your mind. Don't care about how it
|
||||
looks too much now. You can add <a href=\"".EWIKI_SCRIPT."WikiMarkup\">WikiMarkup</a>
|
||||
also later if you think it is necessary.<br />",
|
||||
"EDIT_FORM_2" => "<br />Please do not write things, which may make other
|
||||
people angry. And please keep in mind that you are not all that
|
||||
anonymous in the internet (find out more about your computers
|
||||
'<a href=\"http://google.com/search?q=my+computers+IP+address\">IP address</a>' at Google).",
|
||||
"BIN_IMGTOOLARGE" => "Image file is too large!",
|
||||
"BIN_NOIMG" => "This is no image file (inacceptable file format)!",
|
||||
"FORBIDDEN" => "You are not authorized to access this page.",
|
||||
));
|
||||
"BACKLINKS" => "BackLinks",
|
||||
"PAGESLINKINGTO" => "Pages linking to \$title",
|
||||
"PAGEHISTORY" => "PageInfo",
|
||||
"INFOABOUTPAGE" => "Information about page",
|
||||
"LIKEPAGES" => "Pages like this",
|
||||
"NEWESTPAGES" => "Newest Pages",
|
||||
"LASTCHANGED" => "last changed on %c",
|
||||
"DOESNOTEXIST" => "This page does not yet exist, please click on EditThisPage if you'd like to create it.",
|
||||
"DISABLEDPAGE" => "This page is currently not available.",
|
||||
"ERRVERSIONSAVE" => "Sorry, while you edited this page someone else
|
||||
did already save a changed version. Please go back to the
|
||||
previous screen and copy your changes to your computers
|
||||
clipboard to insert it again after you reload the edit
|
||||
screen.",
|
||||
"ERRORSAVING" => "An error occoured while saving your changes. Please try again.",
|
||||
"THANKSFORCONTRIBUTION" => "Thank you for your contribution!",
|
||||
"CANNOTCHANGEPAGE" => "This page cannot be changed.",
|
||||
"OLDVERCOMEBACK" => "Make this old version come back to replace the current one",
|
||||
"PREVIEW" => "Preview",
|
||||
"SAVE" => "Save",
|
||||
"CANCEL_EDIT" => "CancelEditing",
|
||||
"UPLOAD_PICTURE_BUTTON" => "upload picture >>>",
|
||||
"EDIT_FORM_1" => "<a href=\"".EWIKI_SCRIPT."GoodStyle\">GoodStyle</a> is to
|
||||
write what comes to your mind. Don't care about how it
|
||||
looks too much now. You can add <a href=\"".EWIKI_SCRIPT."WikiMarkup\">WikiMarkup</a>
|
||||
also later if you think it is necessary.<br />",
|
||||
"EDIT_FORM_2" => "<br />Please do not write things, which may make other
|
||||
people angry. And please keep in mind that you are not all that
|
||||
anonymous in the internet (find out more about your computers
|
||||
'<a href=\"http://google.com/search?q=my+computers+IP+address\">IP address</a>' at Google).",
|
||||
"BIN_IMGTOOLARGE" => "Image file is too large!",
|
||||
"BIN_NOIMG" => "This is no image file (inacceptable file format)!",
|
||||
"FORBIDDEN" => "You are not authorized to access this page.",
|
||||
));
|
||||
#
|
||||
$ewiki_t["es"] = @array_merge(@$ewiki_t["es"], array(
|
||||
"EDITTHISPAGE" => "EditarEstaPágina",
|
||||
|
@ -363,10 +363,10 @@
|
|||
"DOESNOTEXIST" => "Esta página aún no existe, por favor eliga EditarEstaPágina si desea crearla.",
|
||||
"DISABLEDPAGE" => "Esta página no está disponible en este momento.",
|
||||
"ERRVERSIONSAVE" => "Disculpe, mientras editaba esta página alguién más
|
||||
salvó una versión modificada. Por favor regrese a
|
||||
a la pantalla anterior y copie sus cambios a su computador
|
||||
para insertalos nuevamente después de que cargue
|
||||
la pantalla de edición.",
|
||||
salvó una versión modificada. Por favor regrese a
|
||||
a la pantalla anterior y copie sus cambios a su computador
|
||||
para insertalos nuevamente después de que cargue
|
||||
la pantalla de edición.",
|
||||
"ERRORSAVING" => "Ocurrió un error mientras se salvavan sus cambios. Por favor intente de nuevo.",
|
||||
"THANKSFORCONTRIBUTION" => "Gracias por su contribución!",
|
||||
"CANNOTCHANGEPAGE" => "Esta página no puede ser modificada.",
|
||||
|
@ -376,88 +376,88 @@
|
|||
"CANCEL_EDIT" => "CancelarEdición",
|
||||
"UPLOAD_PICTURE_BUTTON" => "subir gráfica >>>",
|
||||
"EDIT_FORM_1" => "<a href=\"".EWIKI_SCRIPT."BuenEstilo\">BuenEstilo</a> es
|
||||
escribir lo que viene a su mente. No se preocupe mucho
|
||||
por la apariencia. También puede agregar <a href=\"".EWIKI_SCRIPT."ReglasDeMarcadoWiki\">ReglasDeMarcadoWiki</a>
|
||||
más adelante si piensa que es necesario.<br />",
|
||||
escribir lo que viene a su mente. No se preocupe mucho
|
||||
por la apariencia. También puede agregar <a href=\"".EWIKI_SCRIPT."ReglasDeMarcadoWiki\">ReglasDeMarcadoWiki</a>
|
||||
más adelante si piensa que es necesario.<br />",
|
||||
"EDIT_FORM_2" => "<br />Por favor no escriba cosas, que puedan
|
||||
enfadar a otras personas. Y por favor tenga en mente que
|
||||
usted no es del todo anónimo en Internet
|
||||
(encuentre más sobre
|
||||
'<a href=\"http://google.com/search?q=my+computers+IP+address\">IP address</a>' de su computador con Google).",
|
||||
enfadar a otras personas. Y por favor tenga en mente que
|
||||
usted no es del todo anónimo en Internet
|
||||
(encuentre más sobre
|
||||
'<a href=\"http://google.com/search?q=my+computers+IP+address\">IP address</a>' de su computador con Google).",
|
||||
"BIN_IMGTOOLARGE" => "¡La gráfica es demasiado grande!",
|
||||
"BIN_NOIMG" => "¡No es un archivo con una gráfica (formato de archivo inaceptable)!",
|
||||
"FORBIDDEN" => "No está autorizado para acceder a esta página.",
|
||||
));
|
||||
#
|
||||
$ewiki_t["de"] = @array_merge(@$ewiki_t["de"], array(
|
||||
"EDITTHISPAGE" => "DieseSeiteÄndern",
|
||||
$ewiki_t["de"] = @array_merge(@$ewiki_t["de"], array(
|
||||
"EDITTHISPAGE" => "DieseSeiteÄndern",
|
||||
"APPENDTOPAGE" => "Ergänze",
|
||||
"BACKLINKS" => "ZurückLinks",
|
||||
"PAGESLINKINGTO" => "Verweise zur Seite \$title",
|
||||
"PAGEHISTORY" => "SeitenInfo",
|
||||
"INFOABOUTPAGE" => "Informationen über Seite",
|
||||
"LIKEPAGES" => "Ähnliche Seiten",
|
||||
"NEWESTPAGES" => "Neueste Seiten",
|
||||
"LASTCHANGED" => "zuletzt geändert am %d.%m.%Y um %H:%M",
|
||||
"DISABLEDPAGE" => "Diese Seite kann momentan nicht angezeigt werden.",
|
||||
"ERRVERSIONSAVE" => "Entschuldige, aber während Du an der Seite
|
||||
gearbeitet hast, hat bereits jemand anders eine geänderte
|
||||
Fassung gespeichert. Damit nichts verloren geht, browse bitte
|
||||
zurück und speichere Deine Änderungen in der Zwischenablage
|
||||
(Bearbeiten->Kopieren) um sie dann wieder an der richtigen
|
||||
Stelle einzufügen, nachdem du die EditBoxSeite nocheinmal
|
||||
geladen hast.<br />
|
||||
Vielen Dank für Deine Mühe.",
|
||||
"ERRORSAVING" => "Beim Abspeichern ist ein Fehler aufgetreten. Bitte versuche es erneut.",
|
||||
"THANKSFORCONTRIBUTION" => "Vielen Dank für Deinen Beitrag!",
|
||||
"CANNOTCHANGEPAGE" => "Diese Seite kann nicht geändert werden.",
|
||||
"OLDVERCOMEBACK" => "Diese alte Version der Seite wieder zur Aktuellen machen",
|
||||
"PREVIEW" => "Vorschau",
|
||||
"SAVE" => "Speichern",
|
||||
"CANCEL_EDIT" => "ÄnderungenVerwerfen",
|
||||
"UPLOAD_PICTURE_BUTTON" => "Bild hochladen >>>",
|
||||
"EDIT_FORM_1" => "<a href=\"".EWIKI_SCRIPT."GuterStil\">GuterStil</a> ist es,
|
||||
ganz einfach das zu schreiben, was einem gerade in den
|
||||
Sinn kommt. Du solltest dich jetzt noch nicht so sehr
|
||||
darum kümmern, wie die Seite aussieht. Du kannst später
|
||||
immernoch zurückkommen und den Text mit <a href=\"".EWIKI_SCRIPT."FormatierungsRegeln\">WikiTextFormatierungsRegeln</a>
|
||||
aufputschen.<br />",
|
||||
"EDIT_FORM_2" => "<br />Bitte schreib keine Dinge, die andere Leute
|
||||
verärgern könnten. Und bedenke auch, daß es schnell auf
|
||||
dich zurückfallen kann wenn du verschiedene andere Dinge sagst (mehr Informationen zur
|
||||
'<a href=\"http://google.de/search?q=computer+IP+adresse\">IP Adresse</a>'
|
||||
deines Computers findest du bei Google).",
|
||||
));
|
||||
"BACKLINKS" => "ZurückLinks",
|
||||
"PAGESLINKINGTO" => "Verweise zur Seite \$title",
|
||||
"PAGEHISTORY" => "SeitenInfo",
|
||||
"INFOABOUTPAGE" => "Informationen über Seite",
|
||||
"LIKEPAGES" => "Ähnliche Seiten",
|
||||
"NEWESTPAGES" => "Neueste Seiten",
|
||||
"LASTCHANGED" => "zuletzt geändert am %d.%m.%Y um %H:%M",
|
||||
"DISABLEDPAGE" => "Diese Seite kann momentan nicht angezeigt werden.",
|
||||
"ERRVERSIONSAVE" => "Entschuldige, aber während Du an der Seite
|
||||
gearbeitet hast, hat bereits jemand anders eine geänderte
|
||||
Fassung gespeichert. Damit nichts verloren geht, browse bitte
|
||||
zurück und speichere Deine Änderungen in der Zwischenablage
|
||||
(Bearbeiten->Kopieren) um sie dann wieder an der richtigen
|
||||
Stelle einzufügen, nachdem du die EditBoxSeite nocheinmal
|
||||
geladen hast.<br />
|
||||
Vielen Dank für Deine Mühe.",
|
||||
"ERRORSAVING" => "Beim Abspeichern ist ein Fehler aufgetreten. Bitte versuche es erneut.",
|
||||
"THANKSFORCONTRIBUTION" => "Vielen Dank für Deinen Beitrag!",
|
||||
"CANNOTCHANGEPAGE" => "Diese Seite kann nicht geändert werden.",
|
||||
"OLDVERCOMEBACK" => "Diese alte Version der Seite wieder zur Aktuellen machen",
|
||||
"PREVIEW" => "Vorschau",
|
||||
"SAVE" => "Speichern",
|
||||
"CANCEL_EDIT" => "ÄnderungenVerwerfen",
|
||||
"UPLOAD_PICTURE_BUTTON" => "Bild hochladen >>>",
|
||||
"EDIT_FORM_1" => "<a href=\"".EWIKI_SCRIPT."GuterStil\">GuterStil</a> ist es,
|
||||
ganz einfach das zu schreiben, was einem gerade in den
|
||||
Sinn kommt. Du solltest dich jetzt noch nicht so sehr
|
||||
darum kümmern, wie die Seite aussieht. Du kannst später
|
||||
immernoch zurückkommen und den Text mit <a href=\"".EWIKI_SCRIPT."FormatierungsRegeln\">WikiTextFormatierungsRegeln</a>
|
||||
aufputschen.<br />",
|
||||
"EDIT_FORM_2" => "<br />Bitte schreib keine Dinge, die andere Leute
|
||||
verärgern könnten. Und bedenke auch, daß es schnell auf
|
||||
dich zurückfallen kann wenn du verschiedene andere Dinge sagst (mehr Informationen zur
|
||||
'<a href=\"http://google.de/search?q=computer+IP+adresse\">IP Adresse</a>'
|
||||
deines Computers findest du bei Google).",
|
||||
));
|
||||
|
||||
#-- InterWiki:Links
|
||||
$ewiki_config["interwiki"] = @array_merge(
|
||||
@$ewiki_config["interwiki"],
|
||||
array(
|
||||
#-- InterWiki:Links
|
||||
$ewiki_config["interwiki"] = @array_merge(
|
||||
@$ewiki_config["interwiki"],
|
||||
array(
|
||||
"javascript" => "", # this actually protects from javascript: links
|
||||
"url" => "",
|
||||
# "self" => "this",
|
||||
"this" => EWIKI_SCRIPT, # better was absolute _URL to ewiki wrapper
|
||||
"jump" => "",
|
||||
"ErfurtWiki" => "http://erfurtwiki.sourceforge.net/?id=",
|
||||
"InterWiki" => "InterWikiSearch",
|
||||
"InterWikiSearch" => "http://sunir.org/apps/meta.pl?",
|
||||
"Wiki" => "WardsWiki",
|
||||
"WardsWiki" => "http://www.c2.com/cgi/wiki?",
|
||||
"WikiFind" => "http://c2.com/cgi/wiki?FindPage&value=",
|
||||
"WikiPedia" => "http://www.wikipedia.com/wiki.cgi?",
|
||||
"MeatBall" => "MeatballWiki",
|
||||
"MeatballWiki" => "http://www.usemod.com/cgi-bin/mb.pl?",
|
||||
"UseMod" => "http://www.usemod.com/cgi-bin/wiki.pl?",
|
||||
"PhpWiki" => "http://phpwiki.sourceforge.net/phpwiki/index.php3?",
|
||||
"LinuxWiki" => "http://linuxwiki.de/",
|
||||
"OpenWiki" => "http://openwiki.com/?",
|
||||
"Tavi" => "http://andstuff.org/tavi/",
|
||||
"TWiki" => "http://twiki.sourceforge.net/cgi-bin/view/",
|
||||
"MoinMoin" => "http://www.purl.net/wiki/moin/",
|
||||
"Google" => "http://google.com/search?q=",
|
||||
"ISBN" => "http://www.amazon.com/exec/obidos/ISBN=",
|
||||
"icq" => "http://www.icq.com/",
|
||||
));
|
||||
"ErfurtWiki" => "http://erfurtwiki.sourceforge.net/?id=",
|
||||
"InterWiki" => "InterWikiSearch",
|
||||
"InterWikiSearch" => "http://sunir.org/apps/meta.pl?",
|
||||
"Wiki" => "WardsWiki",
|
||||
"WardsWiki" => "http://www.c2.com/cgi/wiki?",
|
||||
"WikiFind" => "http://c2.com/cgi/wiki?FindPage&value=",
|
||||
"WikiPedia" => "http://www.wikipedia.com/wiki.cgi?",
|
||||
"MeatBall" => "MeatballWiki",
|
||||
"MeatballWiki" => "http://www.usemod.com/cgi-bin/mb.pl?",
|
||||
"UseMod" => "http://www.usemod.com/cgi-bin/wiki.pl?",
|
||||
"PhpWiki" => "http://phpwiki.sourceforge.net/phpwiki/index.php3?",
|
||||
"LinuxWiki" => "http://linuxwiki.de/",
|
||||
"OpenWiki" => "http://openwiki.com/?",
|
||||
"Tavi" => "http://andstuff.org/tavi/",
|
||||
"TWiki" => "http://twiki.sourceforge.net/cgi-bin/view/",
|
||||
"MoinMoin" => "http://www.purl.net/wiki/moin/",
|
||||
"Google" => "http://google.com/search?q=",
|
||||
"ISBN" => "http://www.amazon.com/exec/obidos/ISBN=",
|
||||
"icq" => "http://www.icq.com/",
|
||||
));
|
||||
|
||||
|
||||
|
||||
|
@ -2091,7 +2091,7 @@ function ewiki_format (
|
|||
global $ewiki_use_editor, $ewiki_editor_content;
|
||||
if(!($ewiki_use_editor && $ewiki_editor_content)) {
|
||||
##### END MOODLE ADDITION #####
|
||||
ewiki_render_wiki_links($ooo[$in][0]);
|
||||
ewiki_render_wiki_links($ooo[$in][0]);
|
||||
##### BEGIN MOODLE ADDITION #####
|
||||
}
|
||||
##### END MOODLE ADDITION #####
|
||||
|
@ -2422,7 +2422,7 @@ function ewiki_link_regex_callback($uu, $force_noimg=0) {
|
|||
$str = ($obj ? '<embed width="70%"' : '<img') . ' src="' . $href . '"' .
|
||||
' alt="' . ($title) . '"' .
|
||||
(@$states["titled"] ? ' title="' . ($title) . '"' : '').
|
||||
($x && $y ? " width=\"$x\" height=\"$y\"" : "") .
|
||||
($x && $y ? " width=\"$x\" height=\"$y\"" : "") .
|
||||
$align . " />" . ($obj ? "</embed>" : "");
|
||||
# htmlentities($title)
|
||||
}
|
||||
|
@ -2977,8 +2977,8 @@ function ewiki_array($array, $key=false, $am=1, $ci=EWIKI_CASE_INSENSITIVE) {
|
|||
$r[$i] = $v;
|
||||
}
|
||||
else {
|
||||
$r[$i] .= $v; //RET: doubling for images`meta won't happen
|
||||
} // but should be "+" here for integers
|
||||
$r[$i] .= $v; //RET: doubling for images`meta won't happen
|
||||
} // but should be "+" here for integers
|
||||
}
|
||||
$array = &$r;
|
||||
}
|
||||
|
@ -3008,7 +3008,7 @@ function ewiki_author($defstr="") {
|
|||
|
||||
(empty($author)) && (
|
||||
($author = $defstr) ||
|
||||
($author = $_SERVER["HTTP_FROM"]) || // RFC2068 sect 14.22
|
||||
($author = $_SERVER["HTTP_FROM"]) || // RFC2068 sect 14.22
|
||||
($author = $_SERVER["PHP_AUTH_USER"])
|
||||
);
|
||||
|
||||
|
@ -3418,7 +3418,7 @@ function ewiki_database_mysql($action, &$args, $sw1, $sw2) {
|
|||
existing entries (using WRITE); returns 0 on failure and 1 if
|
||||
saved correctly.
|
||||
*/
|
||||
case "OVERWRITE": // fall-through
|
||||
case "OVERWRITE": // fall-through
|
||||
$COMMAND = "REPLACE";
|
||||
|
||||
case "WRITE":
|
||||
|
|
|
@ -348,13 +348,13 @@
|
|||
/// Insert a link to force page refresh if new content isn't showing.
|
||||
|
||||
// build new URL + query string
|
||||
$queries = preg_split('/[?&]/', me());
|
||||
$queries = preg_split('/[?&]/', me());
|
||||
$nqueries = count($queries);
|
||||
$me = $queries[0] . '?';
|
||||
for($i=1; $i < $nqueries; $i++)
|
||||
{
|
||||
if( !strstr($queries[$i], 'allowcache') )
|
||||
$me .= $queries[$i] . '&';
|
||||
$me .= $queries[$i] . '&';
|
||||
}
|
||||
$me .= 'allowcache=0';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue