Removed notices by introducing new function print_header_simple() which works on site as well as in courses without extra logic.

This commit is contained in:
gustav_delius 2004-08-21 20:20:58 +00:00
parent 64c3e85374
commit 90fcc576ea
49 changed files with 1530 additions and 1709 deletions

View file

@ -1153,6 +1153,26 @@ function print_header ($title="", $heading="", $navigation="", $focus="", $meta=
include ("$CFG->dirroot/theme/$CFG->theme/header.html"); include ("$CFG->dirroot/theme/$CFG->theme/header.html");
} }
function print_header_simple($title="", $heading="", $navigation="", $focus="", $meta="",
$cache=true, $button=" ", $menu="", $usexml=false, $bodytags="") {
/// This version of print_header is simpler because the course name does not have to be
/// provided explicitly in the strings. It can be used on the site page as in courses
/// Eventually all print_header could be replaced by print_header_simple
global $course; // The same hack is used in print_header
$shortname ='';
if ($course->category) {
$shortname = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
print_header("$course->shortname: $title", "$course->fullname $heading", "$shortname $navigation", $focus, $meta,
$cache, $button, $menu, $usexml, $bodytags);
}
function print_footer ($course=NULL, $usercourse=NULL) { function print_footer ($course=NULL, $usercourse=NULL) {
// Can provide a course object to make the footer contain a link to // Can provide a course object to make the footer contain a link to
// to the course home page, otherwise the link will go to the site home // to the course home page, otherwise the link will go to the site home

View file

@ -12,10 +12,6 @@
require_login($course->id); require_login($course->id);
add_to_log($course->id, "assignment", "view all", "index.php?id=$course->id", ""); add_to_log($course->id, "assignment", "view all", "index.php?id=$course->id", "");
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strassignments = get_string("modulenameplural", "assignment"); $strassignments = get_string("modulenameplural", "assignment");
$strassignment = get_string("modulename", "assignment"); $strassignment = get_string("modulename", "assignment");
$strweek = get_string("week"); $strweek = get_string("week");
@ -25,7 +21,7 @@
$strsubmitted = get_string("submitted", "assignment"); $strsubmitted = get_string("submitted", "assignment");
print_header("$course->shortname: $strassignments", "$course->fullname", "$navigation $strassignments", "", "", true, "", navmenu($course)); print_header_simple($strassignments, "", $strassignments, "", "", true, "", navmenu($course));
if (! $assignments = get_all_instances_in_course("assignment", $course)) { if (! $assignments = get_all_instances_in_course("assignment", $course)) {
notice("There are no assignments", "../../course/view.php?id=$course->id"); notice("There are no assignments", "../../course/view.php?id=$course->id");

View file

@ -27,17 +27,13 @@
error("Only teachers can look at this page"); error("Only teachers can look at this page");
} }
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
$strassignments = get_string("modulenameplural", "assignment"); $strassignments = get_string("modulenameplural", "assignment");
$strassignment = get_string("modulename", "assignment"); $strassignment = get_string("modulename", "assignment");
$strsubmissions = get_string("submissions", "assignment"); $strsubmissions = get_string("submissions", "assignment");
$strsaveallfeedback = get_string("saveallfeedback", "assignment"); $strsaveallfeedback = get_string("saveallfeedback", "assignment");
print_header("$course->shortname: $assignment->name", "$course->fullname", print_header_simple($assignment->name, "",
"$navigation <a href=\"index.php?id=$course->id\">$strassignments</a> -> "<a href=\"index.php?id=$course->id\">$strassignments</a> ->
<a href=\"view.php?a=$assignment->id\">$assignment->name</a> -> $strsubmissions", <a href=\"view.php?a=$assignment->id\">$assignment->name</a> -> $strsubmissions",
"", "", true, update_module_button($cm->id, $course->id, $strassignment), navmenu($course, $cm)); "", "", true, update_module_button($cm->id, $course->id, $strassignment), navmenu($course, $cm));

View file

@ -25,15 +25,12 @@
add_to_log($course->id, "assignment", "upload", "view.php?a=$assignment->id", "$assignment->id", $cm->id); add_to_log($course->id, "assignment", "upload", "view.php?a=$assignment->id", "$assignment->id", $cm->id);
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strassignments = get_string("modulenameplural", "assignment"); $strassignments = get_string("modulenameplural", "assignment");
$strassignment = get_string("modulename", "assignment"); $strassignment = get_string("modulename", "assignment");
$strupload = get_string("upload"); $strupload = get_string("upload");
print_header("$course->shortname: $assignment->name : $strupload", "$course->fullname", print_header_simple("$assignment->name : $strupload", "",
"$navigation <A HREF=index.php?id=$course->id>$strassignments</A> -> "<A HREF=index.php?id=$course->id>$strassignments</A> ->
<A HREF=\"view.php?a=$assignment->id\">$assignment->name</A> -> $strupload", <A HREF=\"view.php?a=$assignment->id\">$assignment->name</A> -> $strupload",
"", "", true); "", "", true);

View file

@ -35,15 +35,11 @@
add_to_log($course->id, "assignment", "view", "view.php?id=$cm->id", $assignment->id, $cm->id); add_to_log($course->id, "assignment", "view", "view.php?id=$cm->id", $assignment->id, $cm->id);
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strassignments = get_string("modulenameplural", "assignment"); $strassignments = get_string("modulenameplural", "assignment");
$strassignment = get_string("modulename", "assignment"); $strassignment = get_string("modulename", "assignment");
print_header("$course->shortname: $assignment->name", "$course->fullname", print_header_simple($assignment->name, "",
"$navigation <A HREF=index.php?id=$course->id>$strassignments</A> -> $assignment->name", "<A HREF=index.php?id=$course->id>$strassignments</A> -> $assignment->name",
"", "", true, update_module_button($cm->id, $course->id, $strassignment), navmenu($course, $cm)); "", "", true, update_module_button($cm->id, $course->id, $strassignment), navmenu($course, $cm));
if (isteacher($course->id)) { if (isteacher($course->id)) {

View file

@ -26,11 +26,7 @@
/// Print the header /// Print the header
if ($course->category) { print_header_simple($strattendance, "", "$strattendances", "", "", true, "", navmenu($course));
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
print_header("$course->shortname: $strattendance", "$course->fullname", "$navigation $strattendances", "", "", true, "", navmenu($course));
/// Get all the appropriate data /// Get all the appropriate data

View file

@ -34,16 +34,12 @@
/// Print the page header /// Print the page header
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strattendances = get_string("modulenameplural", "attendance"); $strattendances = get_string("modulenameplural", "attendance");
$strattendance = get_string("modulename", "attendance"); $strattendance = get_string("modulename", "attendance");
$strteacheredit = get_string("teacheredit", "attendance"); $strteacheredit = get_string("teacheredit", "attendance");
print_header("$course->shortname: $attendance->name", "$course->fullname", print_header_simple($attendance->name, "",
"$navigation <A HREF=index.php?id=$course->id>$strattendances</A> -> $attendance->name", "<A HREF=index.php?id=$course->id>$strattendances</A> -> $attendance->name",
"", "", true, update_module_button($cm->id, $course->id, $strattendance), "", "", true, update_module_button($cm->id, $course->id, $strattendance),
navmenu($course, $cm)); navmenu($course, $cm));
@ -72,9 +68,9 @@
// get the list of attendance records for all hours of the given day and // get the list of attendance records for all hours of the given day and
// put it in the array for use in the attendance table // put it in the array for use in the attendance table
$strviewall = get_string("viewall", "attendance"); $strviewall = get_string("viewall", "attendance");
$strviewweek = get_string("viewweek", "attendance"); $strviewweek = get_string("viewweek", "attendance");
echo "<p align=\"right\">"; echo "<p align=\"right\">";
if (isteacher($course->id)) { if (isteacher($course->id)) {
echo "<a href=\"teacheredit.php?update=".$cm->id."&return=true\">$strteacheredit</a><br/>"; echo "<a href=\"teacheredit.php?update=".$cm->id."&return=true\">$strteacheredit</a><br/>";
} }
@ -89,26 +85,26 @@
echo "<table width=\"100%\" border=\"0\" valign=\"top\" align=\"center\" ". echo "<table width=\"100%\" border=\"0\" valign=\"top\" align=\"center\" ".
"cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">"; "cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">";
// print the date headings at the top of the table // print the date headings at the top of the table
echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">". echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">".
"&nbsp;</th>\n"; "&nbsp;</th>\n";
// put notes for the date in the date heading // put notes for the date in the date heading
$notes = ($form->notes != "") ? ":<br />".$form->notes : ""; $notes = ($form->notes != "") ? ":<br />".$form->notes : "";
echo "<th valign=\"top\" align=\"left\" colspan=\"" .$form->hours. "\" nowrap class=\"generaltableheader\">". echo "<th valign=\"top\" align=\"left\" colspan=\"" .$form->hours. "\" nowrap class=\"generaltableheader\">".
userdate($form->day,get_string("strftimedateshort")).$notes."</th>\n"; userdate($form->day,get_string("strftimedateshort")).$notes."</th>\n";
echo (($form->hours > 1) ? "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">&nbsp;</th>\n" : ""); echo (($form->hours > 1) ? "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">&nbsp;</th>\n" : "");
echo "</tr>\n"; echo "</tr>\n";
// print the second level headings with name and possibly hour numbers // print the second level headings with name and possibly hour numbers
echo "<tr><th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">Last Name</th>\n"; echo "<tr><th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">Last Name</th>\n";
echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">First Name</th>\n"; echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">First Name</th>\n";
echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">ID</th>\n"; echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">ID</th>\n";
// generate the headers for the attendance hours // generate the headers for the attendance hours
if ($form->hours > 1) { if ($form->hours > 1) {
for($i=1;$i<=$form->hours;$i++) { for($i=1;$i<=$form->hours;$i++) {
echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$i."</th>\n"; echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$i."</th>\n";
} }
echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">total</td>"; echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">total</td>";
} else { echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">&nbsp;</th>\n"; } } else { echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">&nbsp;</th>\n"; }
echo "</tr>\n"; echo "</tr>\n";
// get the list of students along with student ID field // get the list of students along with student ID field
// get back array of stdclass objects in sorted order, with members: // get back array of stdclass objects in sorted order, with members:
// id, username,firstname,lastname,maildisplay,mailformat,email,city,country, // id, username,firstname,lastname,maildisplay,mailformat,email,city,country,
@ -116,7 +112,7 @@
if (isteacher($course->id)){ if (isteacher($course->id)){
$students = attendance_get_course_students($form->course, "u.lastname ASC"); $students = attendance_get_course_students($form->course, "u.lastname ASC");
} else { // must be a student } else { // must be a student
$students[0] = get_user_info_from_db("id", $USER->id); $students[0] = get_user_info_from_db("id", $USER->id);
} }
$i=0; $i=0;
$A = get_string("absentshort","attendance"); $A = get_string("absentshort","attendance");
@ -129,16 +125,16 @@
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$student->firstname."</td>\n"; echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$student->firstname."</td>\n";
$studentid=(($student->idnumber != "") ? $student->idnumber : "&nbsp"); $studentid=(($student->idnumber != "") ? $student->idnumber : "&nbsp");
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$studentid."</td>\n"; echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$studentid."</td>\n";
$abs=$tar=0; $abs=$tar=0;
for($j=1;$j<=$form->hours;$j++) { for($j=1;$j<=$form->hours;$j++) {
// set the attendance defaults for each student // set the attendance defaults for each student
if ($sroll[$student->id][$j]->status == 1) {$status=$T;$tar++;} if ($sroll[$student->id][$j]->status == 1) {$status=$T;$tar++;}
elseif ($sroll[$student->id][$j]->status == 2) {$status=$A;$abs++;} elseif ($sroll[$student->id][$j]->status == 2) {$status=$A;$abs++;}
else {$status=$P;} else {$status=$P;}
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$status."</td>\n"; echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$status."</td>\n";
} /// for loop } /// for loop
if ($form->hours > 1) { if ($form->hours > 1) {
$tot=attendance_tally_overall_absences_fraction($abs,$tar); $tot=attendance_tally_overall_absences_fraction($abs,$tar);
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$tot."</td></tr>\n"; echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$tot."</td></tr>\n";
} }
} }
@ -154,22 +150,22 @@
echo "<table width=\"100%\" border=\"0\" valign=\"top\" align=\"center\" ". echo "<table width=\"100%\" border=\"0\" valign=\"top\" align=\"center\" ".
"cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">"; "cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">";
echo"<tr><th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">". echo"<tr><th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">".
get_string("dynsectionshort","attendance").":</th>\n"; get_string("dynsectionshort","attendance").":</th>\n";
echo"<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">". echo"<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">".
(($form->dynsection=="1")?"Yes":"No")."</th></tr>\n"; (($form->dynsection=="1")?"Yes":"No")."</th></tr>\n";
echo"<tr><th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">". echo"<tr><th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">".
get_string("autoattendshort","attendance").":</th>\n"; get_string("autoattendshort","attendance").":</th>\n";
echo"<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">". echo"<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">".
(($form->autoattend=="1")?"Yes":"No")."</th></tr>\n"; (($form->autoattend=="1")?"Yes":"No")."</th></tr>\n";
echo"<tr><th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">". echo"<tr><th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">".
get_string("gradeshort","attendance").":</th>\n"; get_string("gradeshort","attendance").":</th>\n";
echo"<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">". echo"<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">".
(($form->grade=="1")?"Yes":"No")."</th></tr>\n"; (($form->grade=="1")?"Yes":"No")."</th></tr>\n";
if ($form->grade == "1") { if ($form->grade == "1") {
echo"<tr><th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">". echo"<tr><th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">".
get_string("maxgradeshort","attendance").":</th>\n"; get_string("maxgradeshort","attendance").":</th>\n";
echo"<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">". echo"<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">".
$form->maxgrade."</th></tr>\n"; $form->maxgrade."</th></tr>\n";
} }
echo "</table></td></table>\n"; echo "</table></td></table>\n";

View file

@ -40,7 +40,7 @@
/// Print the main part of the page /// Print the main part of the page
if ($attendances) { if ($attendances) {
if ( isstudent($course->id) && !isteacher($course->id)) { if ( isstudent($course->id) && !isteacher($course->id)) {
attendance_print_header(); attendance_print_header();
notice(get_string("noviews", "attendance")); notice(get_string("noviews", "attendance"));
print_footer($course); exit; print_footer($course); exit;
} }
@ -61,13 +61,13 @@ if ($attendances) {
if (isstudent($course->id) && !isteacher($course->id)) { if (isstudent($course->id) && !isteacher($course->id)) {
$rolls = get_records("attendance_roll", "dayid", $form->id, "userid", $USER->id); $rolls = get_records("attendance_roll", "dayid", $form->id, "userid", $USER->id);
} else { // must be a teacher } else { // must be a teacher
$rolls = get_records("attendance_roll", "dayid", $attendance->id); $rolls = get_records("attendance_roll", "dayid", $attendance->id);
} }
if ($rolls) { if ($rolls) {
foreach ($rolls as $roll) { foreach ($rolls as $roll) {
$atts[$numatt]->sroll[$roll->userid][$roll->hour]->status=$roll->status; $atts[$numatt]->sroll[$roll->userid][$roll->hour]->status=$roll->status;
$atts[$numatt]->sroll[$roll->userid][$roll->hour]->notes=$roll->notes; $atts[$numatt]->sroll[$roll->userid][$roll->hour]->notes=$roll->notes;
} }
} }
$numatt++; $numatt++;
} }
@ -98,22 +98,22 @@ if ($download == "xls") {
if ($dlsub== "all") { if ($dlsub== "all") {
for($k=0;$k<$numatt;$k++) { for($k=0;$k<$numatt;$k++) {
// put notes for the date in the date heading // put notes for the date in the date heading
$myxls->write_string(1,$pos,userdate($atts[$k]->attendance->day,"%m/%0d")); $myxls->write_string(1,$pos,userdate($atts[$k]->attendance->day,"%m/%0d"));
$myxls->set_column($pos,$pos,5); $myxls->set_column($pos,$pos,5);
$myxls->write_string(2,$pos,$atts[$k]->attendance->notes); $myxls->write_string(2,$pos,$atts[$k]->attendance->notes);
for ($i=1;$i<=$atts[$k]->attendance->hours;$i++) { for ($i=1;$i<=$atts[$k]->attendance->hours;$i++) {
$myxls->write_number(3,$pos,$i); $myxls->write_number(3,$pos,$i);
$myxls->set_column($pos,$pos,1); $myxls->set_column($pos,$pos,1);
$pos++; $pos++;
} }
} }
} // if dlsub==all } // if dlsub==all
$myxls->write_string(3,$pos,get_string("total")); $myxls->write_string(3,$pos,get_string("total"));
$myxls->set_column($pos,$pos,5); $myxls->set_column($pos,$pos,5);
/// generate the attendance rolls for the body of the spreadsheet /// generate the attendance rolls for the body of the spreadsheet
if (isstudent($course->id) && !isteacher($course->id)) { if (isstudent($course->id) && !isteacher($course->id)) {
$students[0] = get_user_info_from_db("id", $USER->id); $students[0] = get_user_info_from_db("id", $USER->id);
} else { // must be a teacher } else { // must be a teacher
$students = attendance_get_course_students($attendance->course, "u.lastname ASC"); $students = attendance_get_course_students($attendance->course, "u.lastname ASC");
} }
@ -129,28 +129,28 @@ if ($dlsub== "all") {
$myxls->write_string($row,2,$studentid); $myxls->write_string($row,2,$studentid);
$pos=3; $pos=3;
if ($dlsub== "all") { if ($dlsub== "all") {
for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student
for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { for($j=1;$j<=$atts[$k]->attendance->hours;$j++) {
// set the attendance defaults for each student // set the attendance defaults for each student
if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;} if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;}
elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;} elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;}
else {$status=$P;} else {$status=$P;}
$myxls->write_string($row,$pos,$status); $myxls->write_string($row,$pos,$status);
$pos++; $pos++;
} /// for loop } /// for loop
} }
} }
$abs=$tar=0; $abs=$tar=0;
for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student
for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { for($j=1;$j<=$atts[$k]->attendance->hours;$j++) {
// set the attendance defaults for each student // set the attendance defaults for each student
if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;} if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;}
elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;} elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;}
} /// for loop } /// for loop
} // outer for for each day of attendance } // outer for for each day of attendance
$tot=attendance_tally_overall_absences_decimal($abs,$tar); $tot=attendance_tally_overall_absences_decimal($abs,$tar);
$myxls->write_number($row,$pos,$tot); $myxls->write_number($row,$pos,$tot);
$row++; $row++;
} }
$workbook->close(); $workbook->close();
@ -170,16 +170,16 @@ if ($download == "txt") {
if ($dlsub== "all") { if ($dlsub== "all") {
for($k=0;$k<$numatt;$k++) { for($k=0;$k<$numatt;$k++) {
// put notes for the date in the date heading // put notes for the date in the date heading
echo "\t" . userdate($atts[$k]->attendance->day,"%m/%0d"); echo "\t" . userdate($atts[$k]->attendance->day,"%m/%0d");
echo (($atts[$k]->attendance->notes != "")?" ".$atts[$k]->attendance->notes:""); echo (($atts[$k]->attendance->notes != "")?" ".$atts[$k]->attendance->notes:"");
for ($i=2;$i<=$atts[$k]->attendance->hours;$i++) { echo "\t$i"; } for ($i=2;$i<=$atts[$k]->attendance->hours;$i++) { echo "\t$i"; }
} }
} // if dlsub==all } // if dlsub==all
echo "\t". get_string("total") . "\n"; echo "\t". get_string("total") . "\n";
/// generate the attendance rolls for the body of the spreadsheet /// generate the attendance rolls for the body of the spreadsheet
if (isstudent($course->id) && !isteacher($course->id)) { if (isstudent($course->id) && !isteacher($course->id)) {
$students[0] = get_user_info_from_db("id", $USER->id); $students[0] = get_user_info_from_db("id", $USER->id);
} else { // must be a teacher } else { // must be a teacher
$students = attendance_get_course_students($attendance->course, "u.lastname ASC"); $students = attendance_get_course_students($attendance->course, "u.lastname ASC");
} }
@ -194,27 +194,27 @@ if ($dlsub== "all") {
$studentid=(($student->idnumber != "") ? $student->idnumber : " "); $studentid=(($student->idnumber != "") ? $student->idnumber : " ");
echo "\t". $studentid; echo "\t". $studentid;
if ($dlsub== "all") { if ($dlsub== "all") {
for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student
for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { for($j=1;$j<=$atts[$k]->attendance->hours;$j++) {
// set the attendance defaults for each student // set the attendance defaults for each student
if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;} if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;}
elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;} elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;}
else {$status=$P;} else {$status=$P;}
echo "\t".$status; echo "\t".$status;
} /// for loop } /// for loop
} }
} }
$abs=$tar=0; $abs=$tar=0;
for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student
for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { for($j=1;$j<=$atts[$k]->attendance->hours;$j++) {
// set the attendance defaults for each student // set the attendance defaults for each student
if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;} if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;}
elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;} elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;}
} /// for loop } /// for loop
} // outer for for each day of attendance } // outer for for each day of attendance
$tot=attendance_tally_overall_absences_decimal($abs,$tar); $tot=attendance_tally_overall_absences_decimal($abs,$tar);
echo "\t".$tot."\n"; echo "\t".$tot."\n";
$row++; $row++;
} }
exit; exit;
} }
@ -237,7 +237,7 @@ if ($dlsub== "all") {
} else if ($onepage) { } else if ($onepage) {
$multipage=false; $multipage=false;
} else { // if onepage is set to false } else { // if onepage is set to false
$multilpage=true; $multilpage=true;
} }
// adjust the width for the report for students // adjust the width for the report for students
@ -251,36 +251,36 @@ if ($dlsub== "all") {
} }
while (($multipage || $onepage) && (!$endonepage)) { while (($multipage || $onepage) && (!$endonepage)) {
// this makes for a one iteration loop for multipage // this makes for a one iteration loop for multipage
if ($multipage) {$onepage = false; $multipage = false; $endonepage=false;} if ($multipage) {$onepage = false; $multipage = false; $endonepage=false;}
if ($numhours>=$hoursinreport) { if ($numhours>=$hoursinreport) {
if (!isset($pagereport)) { if (!isset($pagereport)) {
// $pagereport is used to determine whether the report needs to be paged at all // $pagereport is used to determine whether the report needs to be paged at all
$pagereport=true; $pagereport=true;
$endatt=0; $endatt=0;
$page=1; $page=1;
} }
// find the last hour to have on this page of the report // find the last hour to have on this page of the report
// go to the next (or first) page // go to the next (or first) page
// $endatt++; // $endatt++;
// $startatt=$endatt; // $startatt=$endatt;
$curpage=1; $curpage=1;
$endatt=0; $endatt=0;
for($curpage=1;true;$curpage++) { // the for loop is broken from the inside for($curpage=1;true;$curpage++) { // the for loop is broken from the inside
$pagehours=$atts[$endatt]->attendance->hours; $pagehours=$atts[$endatt]->attendance->hours;
$startatt=$endatt; $startatt=$endatt;
while(($pagehours<=$hoursinreport)) { while(($pagehours<=$hoursinreport)) {
if ($endatt>=$numatt) { break 2; } // end the page number calculations and trigger the end of a multi-page report! if ($endatt>=$numatt) { break 2; } // end the page number calculations and trigger the end of a multi-page report!
$endatt++; $endatt++;
$pagehours=$pagehours+$atts[$endatt]->attendance->hours; $pagehours=$pagehours+$atts[$endatt]->attendance->hours;
} }
// if this is the page we're on, save the info // if this is the page we're on, save the info
if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; } if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; }
} // hopefully at this point, startatt and endatt are set correctly for the current page } // hopefully at this point, startatt and endatt are set correctly for the current page
if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; } else { if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; } else {
$endatt=$endatt_target; $startatt=$startatt_target; } $endatt=$endatt_target; $startatt=$startatt_target; }
$maxpages = $curpage; $maxpages = $curpage;
} else {$pagereport=false;} } else {$pagereport=false;}
$minatt=($pagereport ? $startatt : 0); $minatt=($pagereport ? $startatt : 0);
@ -301,10 +301,10 @@ while (($multipage || $onepage) && (!$endonepage)) {
attendance_print_header(); attendance_print_header();
// print other links at top of page // print other links at top of page
$strviewone = get_string("viewone", "attendance"); $strviewone = get_string("viewone", "attendance");
$strviewtable = get_string("viewtable", "attendance"); $strviewtable = get_string("viewtable", "attendance");
$strviewmulti = get_string("viewmulti", "attendance"); $strviewmulti = get_string("viewmulti", "attendance");
$strviewweek = get_string("viewweek", "attendance"); $strviewweek = get_string("viewweek", "attendance");
if ($onepage) { // one page for all tables if ($onepage) { // one page for all tables
echo "<p align=\"right\"><a href=\"viewall.php?id=".$course->id."\">"; echo "<p align=\"right\"><a href=\"viewall.php?id=".$course->id."\">";
echo "$strviewmulti</a><br />"; echo "$strviewmulti</a><br />";
@ -343,7 +343,7 @@ while (($multipage || $onepage) && (!$endonepage)) {
"cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">"; "cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">";
if (isteacher($course->id)) { if (isteacher($course->id)) {
echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">". echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">".
"&nbsp;</th>\n"; "&nbsp;</th>\n";
} }
// $minpage=0;$maxpage=$numatt; // $minpage=0;$maxpage=$numatt;
// print the date headings at the top of the table // print the date headings at the top of the table
@ -352,9 +352,9 @@ while (($multipage || $onepage) && (!$endonepage)) {
// put notes for the date in the date heading // put notes for the date in the date heading
$notes = ($atts[$k]->attendance->notes != "") ? ":<br />".$atts[$k]->attendance->notes : ""; $notes = ($atts[$k]->attendance->notes != "") ? ":<br />".$atts[$k]->attendance->notes : "";
$auto = ($atts[$k]->attendance->autoattend == 1) ? "(".get_string("auto","attendance").")" : ""; $auto = ($atts[$k]->attendance->autoattend == 1) ? "(".get_string("auto","attendance").")" : "";
echo "<th valign=\"top\" align=\"left\" colspan=\"" .$atts[$k]->attendance->hours. "\" nowrap class=\"generaltableheader\">". echo "<th valign=\"top\" align=\"left\" colspan=\"" .$atts[$k]->attendance->hours. "\" nowrap class=\"generaltableheader\">".
"<a href=\"view.php?id=".$atts[$k]->attendance->cmid."\">".userdate($atts[$k]->attendance->day,"%m/%0d")."</a>".$auto. "<a href=\"view.php?id=".$atts[$k]->attendance->cmid."\">".userdate($atts[$k]->attendance->day,"%m/%0d")."</a>".$auto.
$notes."</th>\n"; $notes."</th>\n";
} }
// if we're at the end of the report // if we're at the end of the report
if ($maxatt==$numatt || !$pagereport) { if ($maxatt==$numatt || !$pagereport) {
@ -363,23 +363,23 @@ while (($multipage || $onepage) && (!$endonepage)) {
echo "</tr>\n"; echo "</tr>\n";
// print the second level headings with name and possibly hour numbers // print the second level headings with name and possibly hour numbers
if (isteacher($course->id)) { if (isteacher($course->id)) {
echo "<tr><th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">Last Name</th>\n"; echo "<tr><th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">Last Name</th>\n";
echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">First Name</th>\n"; echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">First Name</th>\n";
echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">ID</th>\n"; echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">ID</th>\n";
} }
// generate the headers for the attendance hours // generate the headers for the attendance hours
for($k=$minatt;$k<$maxatt;$k++) { for($k=$minatt;$k<$maxatt;$k++) {
if ($atts[$k]->attendance->hours > 1) { if ($atts[$k]->attendance->hours > 1) {
for($i=1;$i<=$atts[$k]->attendance->hours;$i++) { for($i=1;$i<=$atts[$k]->attendance->hours;$i++) {
echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$i."</th>\n"; echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$i."</th>\n";
} }
} else { echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">&nbsp;</th>\n"; } } else { echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">&nbsp;</th>\n"; }
} }
// if we're at the end of the report // if we're at the end of the report
if ($maxatt==$numatt || !$pagereport) { if ($maxatt==$numatt || !$pagereport) {
echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">total</th>"; echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">total</th>";
} }
echo "</tr>\n"; echo "</tr>\n";
// get the list of students along with student ID field // get the list of students along with student ID field
// get back array of stdclass objects in sorted order, with members: // get back array of stdclass objects in sorted order, with members:
@ -388,7 +388,7 @@ while (($multipage || $onepage) && (!$endonepage)) {
if (isstudent($course->id) && !isteacher($course->id)) { if (isstudent($course->id) && !isteacher($course->id)) {
$students[0] = get_user_info_from_db("id", $USER->id); $students[0] = get_user_info_from_db("id", $USER->id);
} else { // must be a teacher } else { // must be a teacher
$students = attendance_get_course_students($attendance->course, "u.lastname ASC"); $students = attendance_get_course_students($attendance->course, "u.lastname ASC");
} }
@ -404,24 +404,24 @@ while (($multipage || $onepage) && (!$endonepage)) {
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$studentid."</td>\n"; echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$studentid."</td>\n";
} }
for($k=$minatt;$k<$maxatt;$k++) { // for eacj day of attendance for the student for($k=$minatt;$k<$maxatt;$k++) { // for eacj day of attendance for the student
for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { for($j=1;$j<=$atts[$k]->attendance->hours;$j++) {
// set the attendance defaults for each student // set the attendance defaults for each student
if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;} if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;}
elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;} elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;}
else {$status=$P;} else {$status=$P;}
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$status."</td>\n"; echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$status."</td>\n";
} /// for loop } /// for loop
} }
if ($maxatt==$numatt || !$pagereport) { if ($maxatt==$numatt || !$pagereport) {
// tally total attendances for the students // tally total attendances for the students
$abs=$tar=0; $abs=$tar=0;
for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student
for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { for($j=1;$j<=$atts[$k]->attendance->hours;$j++) {
// set the attendance defaults for each student // set the attendance defaults for each student
if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;} if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;}
elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;} elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;}
} /// for loop } /// for loop
} // outer for for each day of attendance } // outer for for each day of attendance
$tot=attendance_tally_overall_absences_fraction($abs,$tar); $tot=attendance_tally_overall_absences_fraction($abs,$tar);
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$tot."</td></tr>\n"; echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$tot."</td></tr>\n";
} }
@ -440,9 +440,9 @@ if ($onepage) {$page++; echo "<br /> <br />\n"; }
echo "<center><TABLE BORDER=0 ALIGN=CENTER><TR>"; echo "<center><TABLE BORDER=0 ALIGN=CENTER><TR>";
echo "<TD>"; echo "<TD>";
if (($numhours-4) > 255) { if (($numhours-4) > 255) {
echo "<form><input type=\"button\" value=\"".get_string("downloadexcelfull", "attendance"). echo "<form><input type=\"button\" value=\"".get_string("downloadexcelfull", "attendance").
"\" onclick=\"alert('Sorry, you have more than 251 days on this report. This will not fit into an Excel Spreadsheet. ". "\" onclick=\"alert('Sorry, you have more than 251 days on this report. This will not fit into an Excel Spreadsheet. ".
" Please try downloading the report week by week instead.')\"></form>"; " Please try downloading the report week by week instead.')\"></form>";
} else { } else {
$options["id"] = "$course->id"; $options["id"] = "$course->id";
$options["download"] = "xls"; $options["download"] = "xls";
@ -473,50 +473,47 @@ if ($onepage) {$page++; echo "<br /> <br />\n"; }
function attendance_print_header() { function attendance_print_header() {
global $course, $cm; global $course, $cm;
/// Print the page header /// Print the page header
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strattendances = get_string("modulenameplural", "attendance"); $strattendances = get_string("modulenameplural", "attendance");
$strattendance = get_string("modulename", "attendance"); $strattendance = get_string("modulename", "attendance");
$strallattendance = get_string("allmodulename", "attendance"); $strallattendance = get_string("allmodulename", "attendance");
print_header("$course->shortname: $strallattendance", "$course->fullname", print_header_simple("$strallattendance", "",
"$navigation <A HREF=index.php?id=$course->id>$strattendances</A> -> $strallattendance", "<A HREF=index.php?id=$course->id>$strattendances</A> -> $strallattendance",
"", "", true, "&nbsp;", "", "", true, "&nbsp;",
navmenu($course, $cm)); navmenu($course, $cm));
} }
function attendance_print_pagenav() { function attendance_print_pagenav() {
global $pagereport, $minatt, $maxatt, $course, $page, $numatt, $maxpages; global $pagereport, $minatt, $maxatt, $course, $page, $numatt, $maxpages;
if ($pagereport) { if ($pagereport) {
$of = get_string('of','attendance'); $of = get_string('of','attendance');
$pg = get_string('page'); $pg = get_string('page');
echo "<center><table align=\"center\" width=\"80\" class=\"generalbox\"". echo "<center><table align=\"center\" width=\"80\" class=\"generalbox\"".
"border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>". "border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>".
"<td bgcolor=\"#ffffff\" class=\"generalboxcontent\">"; "<td bgcolor=\"#ffffff\" class=\"generalboxcontent\">";
// this is the main table // this is the main table
echo "<table width=\"100%\" border=\"0\" valign=\"top\" align=\"center\" ". echo "<table width=\"100%\" border=\"0\" valign=\"top\" align=\"center\" ".
"cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">"; "cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">";
echo "<tr>"; echo "<tr>";
if ($minatt!=0) { if ($minatt!=0) {
echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">". echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">".
"<a href=\"viewall.php?id=".$course->id ."&pagereport=1&page=1\">&lt;&lt;</a>&nbsp;\n". "<a href=\"viewall.php?id=".$course->id ."&pagereport=1&page=1\">&lt;&lt;</a>&nbsp;\n".
"<a href=\"viewall.php?id=".$course->id ."&pagereport=1&page=".($page-1)."\">&lt;</a></th>\n"; "<a href=\"viewall.php?id=".$course->id ."&pagereport=1&page=".($page-1)."\">&lt;</a></th>\n";
} else { } else {
echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">&lt;&lt;&nbsp;&lt;</th>\n"; echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">&lt;&lt;&nbsp;&lt;</th>\n";
} }
echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">". echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">".
"$pg $page $of $maxpages</th>\n"; "$pg $page $of $maxpages</th>\n";
if ($maxatt!=$numatt) { if ($maxatt!=$numatt) {
echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">". echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">".
"<a href=\"viewall.php?id=".$course->id ."&pagereport=1&page=". ($page+1)."\">&gt;</a>&nbsp;". "<a href=\"viewall.php?id=".$course->id ."&pagereport=1&page=". ($page+1)."\">&gt;</a>&nbsp;".
"<a href=\"viewall.php?id=".$course->id ."&pagereport=1&page=$maxpages\">&gt;&gt;</a></th>"; "<a href=\"viewall.php?id=".$course->id ."&pagereport=1&page=$maxpages\">&gt;&gt;</a></th>";
} else { } else {
echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">&gt;&nbsp;&gt;&gt;</th>\n"; echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">&gt;&nbsp;&gt;&gt;</th>\n";
} }
echo "</tr></table></td></tr></table></center>\n"; echo "</tr></table></td></tr></table></center>\n";
} }
} }

View file

@ -38,7 +38,7 @@
if ($attendances) { if ($attendances) {
if ( !(isteacher($course->id) || isstudent($course->id)) ) { if ( !(isteacher($course->id) || isstudent($course->id)) ) {
attendance_print_header(); attendance_print_header();
notice(get_string("noviews", "attendance")); notice(get_string("noviews", "attendance"));
print_footer($course); exit; print_footer($course); exit;
} }
@ -61,13 +61,13 @@ if ($attendances) {
if (isstudent($course->id)) { if (isstudent($course->id)) {
$rolls = get_records("attendance_roll", "dayid", $form->id, "userid", $USER->id); $rolls = get_records("attendance_roll", "dayid", $form->id, "userid", $USER->id);
} else { // must be a teacher } else { // must be a teacher
$rolls = get_records("attendance_roll", "dayid", $attendance->id); $rolls = get_records("attendance_roll", "dayid", $attendance->id);
} }
if ($rolls) { if ($rolls) {
foreach ($rolls as $roll) { foreach ($rolls as $roll) {
$atts[$numatt]->sroll[$roll->userid][$roll->hour]->status=$roll->status; $atts[$numatt]->sroll[$roll->userid][$roll->hour]->status=$roll->status;
$atts[$numatt]->sroll[$roll->userid][$roll->hour]->notes=$roll->notes; $atts[$numatt]->sroll[$roll->userid][$roll->hour]->notes=$roll->notes;
} }
} }
$numatt++; $numatt++;
} }
@ -99,22 +99,22 @@ if ($download == "xls") {
if ($dlsub== "all") { if ($dlsub== "all") {
for($k=0;$k<$numatt;$k++) { for($k=0;$k<$numatt;$k++) {
// put notes for the date in the date heading // put notes for the date in the date heading
$myxls->write_string(1,$pos,userdate($atts[$k]->attendance->day,"%m/%0d")); $myxls->write_string(1,$pos,userdate($atts[$k]->attendance->day,"%m/%0d"));
$myxls->set_column($pos,$pos,5); $myxls->set_column($pos,$pos,5);
$myxls->write_string(2,$pos,$atts[$k]->attendance->notes); $myxls->write_string(2,$pos,$atts[$k]->attendance->notes);
for ($i=1;$i<=$atts[$k]->attendance->hours;$i++) { for ($i=1;$i<=$atts[$k]->attendance->hours;$i++) {
$myxls->write_number(3,$pos,$i); $myxls->write_number(3,$pos,$i);
$myxls->set_column($pos,$pos,1); $myxls->set_column($pos,$pos,1);
$pos++; $pos++;
} }
} }
} // if dlsub==all } // if dlsub==all
$myxls->write_string(3,$pos,get_string("total")); $myxls->write_string(3,$pos,get_string("total"));
$myxls->set_column($pos,$pos,5); $myxls->set_column($pos,$pos,5);
/// generate the attendance rolls for the body of the spreadsheet /// generate the attendance rolls for the body of the spreadsheet
if (isstudent($course->id)) { if (isstudent($course->id)) {
$students[0] = get_user_info_from_db("id", $USER->id); $students[0] = get_user_info_from_db("id", $USER->id);
} else { // must be a teacher } else { // must be a teacher
$students = attendance_get_course_students($attendance->course, "u.lastname ASC"); $students = attendance_get_course_students($attendance->course, "u.lastname ASC");
} }
@ -130,28 +130,28 @@ if ($dlsub== "all") {
$myxls->write_string($row,2,$studentid); $myxls->write_string($row,2,$studentid);
$pos=3; $pos=3;
if ($dlsub== "all") { if ($dlsub== "all") {
for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student
for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { for($j=1;$j<=$atts[$k]->attendance->hours;$j++) {
// set the attendance defaults for each student // set the attendance defaults for each student
if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;} if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;}
elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;} elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;}
else {$status=$P;} else {$status=$P;}
$myxls->write_string($row,$pos,$status); $myxls->write_string($row,$pos,$status);
$pos++; $pos++;
} /// for loop } /// for loop
} }
} }
$abs=$tar=0; $abs=$tar=0;
for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student
for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { for($j=1;$j<=$atts[$k]->attendance->hours;$j++) {
// set the attendance defaults for each student // set the attendance defaults for each student
if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;} if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;}
elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;} elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;}
} /// for loop } /// for loop
} // outer for for each day of attendance } // outer for for each day of attendance
$tot=attendance_tally_overall_absences_decimal($abs,$tar); $tot=attendance_tally_overall_absences_decimal($abs,$tar);
$myxls->write_number($row,$pos,$tot); $myxls->write_number($row,$pos,$tot);
$row++; $row++;
} }
$workbook->close(); $workbook->close();
@ -170,16 +170,16 @@ if ($download == "txt") {
if ($dlsub== "all") { if ($dlsub== "all") {
for($k=0;$k<$numatt;$k++) { for($k=0;$k<$numatt;$k++) {
// put notes for the date in the date heading // put notes for the date in the date heading
echo "\t" . userdate($atts[$k]->attendance->day,"%m/%0d"); echo "\t" . userdate($atts[$k]->attendance->day,"%m/%0d");
echo (($atts[$k]->attendance->notes != "")?" ".$atts[$k]->attendance->notes:""); echo (($atts[$k]->attendance->notes != "")?" ".$atts[$k]->attendance->notes:"");
for ($i=2;$i<=$atts[$k]->attendance->hours;$i++) { echo "\t$i"; } for ($i=2;$i<=$atts[$k]->attendance->hours;$i++) { echo "\t$i"; }
} }
} // if dlsub==all } // if dlsub==all
echo "\t". get_string("total") . "\n"; echo "\t". get_string("total") . "\n";
/// generate the attendance rolls for the body of the spreadsheet /// generate the attendance rolls for the body of the spreadsheet
if (isstudent($course->id)) { if (isstudent($course->id)) {
$students[0] = get_user_info_from_db("id", $USER->id); $students[0] = get_user_info_from_db("id", $USER->id);
} else { // must be a teacher } else { // must be a teacher
$students = attendance_get_course_students($attendance->course, "u.lastname ASC"); $students = attendance_get_course_students($attendance->course, "u.lastname ASC");
} }
@ -194,27 +194,27 @@ if ($dlsub== "all") {
$studentid=(($student->idnumber != "") ? $student->idnumber : " "); $studentid=(($student->idnumber != "") ? $student->idnumber : " ");
echo "\t". $studentid; echo "\t". $studentid;
if ($dlsub== "all") { if ($dlsub== "all") {
for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student
for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { for($j=1;$j<=$atts[$k]->attendance->hours;$j++) {
// set the attendance defaults for each student // set the attendance defaults for each student
if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;} if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;}
elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;} elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;}
else {$status=$P;} else {$status=$P;}
echo "\t".$status; echo "\t".$status;
} /// for loop } /// for loop
} }
} }
$abs=$tar=0; $abs=$tar=0;
for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student
for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { for($j=1;$j<=$atts[$k]->attendance->hours;$j++) {
// set the attendance defaults for each student // set the attendance defaults for each student
if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;} if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;}
elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;} elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;}
} /// for loop } /// for loop
} // outer for for each day of attendance } // outer for for each day of attendance
$tot=attendance_tally_overall_absences_decimal($abs,$tar); $tot=attendance_tally_overall_absences_decimal($abs,$tar);
echo "\t".$tot."\n"; echo "\t".$tot."\n";
$row++; $row++;
} }
exit; exit;
} }
@ -238,7 +238,7 @@ if ($dlsub== "all") {
} else if ($onepage) { } else if ($onepage) {
$multipage=false; $multipage=false;
} else { // if onepage is set to false } else { // if onepage is set to false
$multilpage=true; $multilpage=true;
} }
// adjust the width for the report for students // adjust the width for the report for students
@ -252,36 +252,36 @@ if ($dlsub== "all") {
} }
while (($multipage || $onepage) && (!$endonepage)) { while (($multipage || $onepage) && (!$endonepage)) {
// this makes for a one iteration loop for multipage // this makes for a one iteration loop for multipage
$multipage = false; $multipage = false;
if ($numhours>=$hoursinreport) { if ($numhours>=$hoursinreport) {
if (!isset($pagereport)) { if (!isset($pagereport)) {
// $pagereport is used to determine whether the report needs to be paged at all // $pagereport is used to determine whether the report needs to be paged at all
$pagereport=true; $pagereport=true;
$endatt=0; $endatt=0;
$page=1; $page=1;
} }
// find the last hour to have on this page of the report // find the last hour to have on this page of the report
// go to the next (or first) page // go to the next (or first) page
// $endatt++; // $endatt++;
// $startatt=$endatt; // $startatt=$endatt;
$curpage=1; $curpage=1;
$endatt=0; $endatt=0;
for($curpage=1;true;$curpage++) { // the for loop is broken from the inside for($curpage=1;true;$curpage++) { // the for loop is broken from the inside
$pagehours=$atts[$endatt]->attendance->hours; $pagehours=$atts[$endatt]->attendance->hours;
$startatt=$endatt; $startatt=$endatt;
while(($pagehours<$hoursinreport)) { while(($pagehours<$hoursinreport)) {
if ($endatt>=$numatt) { break 2; } // end the page number calculations and trigger the end of a multi-page report! if ($endatt>=$numatt) { break 2; } // end the page number calculations and trigger the end of a multi-page report!
$endatt++; $endatt++;
$pagehours=$pagehours+$atts[$endatt]->attendance->hours; $pagehours=$pagehours+$atts[$endatt]->attendance->hours;
} }
// if this is the page we're on, save the info // if this is the page we're on, save the info
if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; } if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; }
} // hopefully at this point, startatt and endatt are set correctly for the current page } // hopefully at this point, startatt and endatt are set correctly for the current page
if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; } else { if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; } else {
$endatt=$endatt_target; $startatt=$startatt_target; } $endatt=$endatt_target; $startatt=$startatt_target; }
$maxpages = $curpage; $maxpages = $curpage;
} else {$pagereport=false;} } else {$pagereport=false;}
$minatt=($pagereport ? $startatt : 0); $minatt=($pagereport ? $startatt : 0);
@ -298,12 +298,12 @@ while (($multipage || $onepage) && (!$endonepage)) {
// print other links at top of page // print other links at top of page
$strviewsection = get_string("viewsection", "attendance"); $strviewsection = get_string("viewsection", "attendance");
$strviewweek = get_string("viewweek", "attendance"); $strviewweek = get_string("viewweek", "attendance");
$strviewall = get_string("viewall", "attendance"); $strviewall = get_string("viewall", "attendance");
$strviewone = get_string("viewone", "attendance"); $strviewone = get_string("viewone", "attendance");
$strviewtable = get_string("viewtable", "attendance"); $strviewtable = get_string("viewtable", "attendance");
$strviewmulti = get_string("viewmulti", "attendance"); $strviewmulti = get_string("viewmulti", "attendance");
echo "<p align=\"right\"><a href=\"viewall.php?id=".$course->id."\">"; echo "<p align=\"right\"><a href=\"viewall.php?id=".$course->id."\">";
@ -350,7 +350,7 @@ while (($multipage || $onepage) && (!$endonepage)) {
"cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">"; "cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">";
if (isteacher($course->id)) { if (isteacher($course->id)) {
echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">". echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">".
"&nbsp;</th>\n"; "&nbsp;</th>\n";
} }
// $minpage=0;$maxpage=$numatt; // $minpage=0;$maxpage=$numatt;
// print the date headings at the top of the table // print the date headings at the top of the table
@ -359,9 +359,9 @@ while (($multipage || $onepage) && (!$endonepage)) {
// put notes for the date in the date heading // put notes for the date in the date heading
$notes = ($atts[$k]->attendance->notes != "") ? ":<br />".$atts[$k]->attendance->notes : ""; $notes = ($atts[$k]->attendance->notes != "") ? ":<br />".$atts[$k]->attendance->notes : "";
$auto = ($atts[$k]->attendance->autoattend == 1) ? "(".get_string("auto","attendance").")" : ""; $auto = ($atts[$k]->attendance->autoattend == 1) ? "(".get_string("auto","attendance").")" : "";
echo "<th valign=\"top\" align=\"left\" colspan=\"" .$atts[$k]->attendance->hours. "\" nowrap class=\"generaltableheader\">". echo "<th valign=\"top\" align=\"left\" colspan=\"" .$atts[$k]->attendance->hours. "\" nowrap class=\"generaltableheader\">".
"<a href=\"view.php?id=".$atts[$k]->attendance->cmid."\">".userdate($atts[$k]->attendance->day,"%m/%0d")."</a>".$auto. "<a href=\"view.php?id=".$atts[$k]->attendance->cmid."\">".userdate($atts[$k]->attendance->day,"%m/%0d")."</a>".$auto.
$notes."</th>\n"; $notes."</th>\n";
} }
// if we're at the end of the report // if we're at the end of the report
if ($maxatt==$numatt || !$pagereport) { if ($maxatt==$numatt || !$pagereport) {
@ -370,23 +370,23 @@ while (($multipage || $onepage) && (!$endonepage)) {
echo "</tr>\n"; echo "</tr>\n";
// print the second level headings with name and possibly hour numbers // print the second level headings with name and possibly hour numbers
if (isteacher($course->id)) { if (isteacher($course->id)) {
echo "<tr><th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">Last Name</th>\n"; echo "<tr><th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">Last Name</th>\n";
echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">First Name</th>\n"; echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">First Name</th>\n";
echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">ID</th>\n"; echo "<th valign=\"top\" align=\"left\" nowrap class=\"generaltableheader\">ID</th>\n";
} }
// generate the headers for the attendance hours // generate the headers for the attendance hours
for($k=$minatt;$k<$maxatt;$k++) { for($k=$minatt;$k<$maxatt;$k++) {
if ($atts[$k]->attendance->hours > 1) { if ($atts[$k]->attendance->hours > 1) {
for($i=1;$i<=$atts[$k]->attendance->hours;$i++) { for($i=1;$i<=$atts[$k]->attendance->hours;$i++) {
echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$i."</th>\n"; echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">".$i."</th>\n";
} }
} else { echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">&nbsp;</th>\n"; } } else { echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">&nbsp;</th>\n"; }
} }
// if we're at the end of the report // if we're at the end of the report
if ($maxatt==$numatt || !$pagereport) { if ($maxatt==$numatt || !$pagereport) {
echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">total</th>"; echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">total</th>";
} }
echo "</tr>\n"; echo "</tr>\n";
// get the list of students along with student ID field // get the list of students along with student ID field
// get back array of stdclass objects in sorted order, with members: // get back array of stdclass objects in sorted order, with members:
@ -395,7 +395,7 @@ while (($multipage || $onepage) && (!$endonepage)) {
if (isstudent($course->id)) { if (isstudent($course->id)) {
$students[0] = get_user_info_from_db("id", $USER->id); $students[0] = get_user_info_from_db("id", $USER->id);
} else { // must be a teacher } else { // must be a teacher
$students = attendance_get_course_students($attendance->course, "u.lastname ASC"); $students = attendance_get_course_students($attendance->course, "u.lastname ASC");
} }
@ -411,24 +411,24 @@ while (($multipage || $onepage) && (!$endonepage)) {
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$studentid."</td>\n"; echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$studentid."</td>\n";
} }
for($k=$minatt;$k<$maxatt;$k++) { // for eacj day of attendance for the student for($k=$minatt;$k<$maxatt;$k++) { // for eacj day of attendance for the student
for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { for($j=1;$j<=$atts[$k]->attendance->hours;$j++) {
// set the attendance defaults for each student // set the attendance defaults for each student
if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;} if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;}
elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;} elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;}
else {$status=$P;} else {$status=$P;}
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$status."</td>\n"; echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$status."</td>\n";
} /// for loop } /// for loop
} }
if ($maxatt==$numatt || !$pagereport) { if ($maxatt==$numatt || !$pagereport) {
// tally total attendances for the students // tally total attendances for the students
$abs=$tar=0; $abs=$tar=0;
for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student
for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { for($j=1;$j<=$atts[$k]->attendance->hours;$j++) {
// set the attendance defaults for each student // set the attendance defaults for each student
if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;} if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;}
elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;} elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;}
} /// for loop } /// for loop
} // outer for for each day of attendance } // outer for for each day of attendance
$tot=attendance_tally_overall_absences_fraction($abs,$tar); $tot=attendance_tally_overall_absences_fraction($abs,$tar);
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$tot."</td></tr>\n"; echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-left: 1px dotted; border-top: 1px solid;\">".$tot."</td></tr>\n";
} }
@ -447,9 +447,9 @@ if ($onepage) {$page++; echo "<br /> <br />\n"; }
echo "<center><TABLE BORDER=0 ALIGN=CENTER><TR>"; echo "<center><TABLE BORDER=0 ALIGN=CENTER><TR>";
echo "<TD>"; echo "<TD>";
if (($numhours-4) > 255) { if (($numhours-4) > 255) {
echo "<form><input type=\"button\" value=\"".get_string("downloadexcelfull", "attendance"). echo "<form><input type=\"button\" value=\"".get_string("downloadexcelfull", "attendance").
"\" onclick=\"alert('Sorry, you have more than 251 days on this report. This will not fit into an Excel Spreadsheet. ". "\" onclick=\"alert('Sorry, you have more than 251 days on this report. This will not fit into an Excel Spreadsheet. ".
" Please try downloading the report week by week instead.')\"></form>"; " Please try downloading the report week by week instead.')\"></form>";
} else { } else {
$options["id"] = "$id"; $options["id"] = "$id";
$options["download"] = "xls"; $options["download"] = "xls";
@ -480,34 +480,34 @@ if ($onepage) {$page++; echo "<br /> <br />\n"; }
function attendance_print_pagenav() { function attendance_print_pagenav() {
global $pagereport, $minatt, $maxatt, $course, $page, $numatt, $maxpages, $attendance,$scope,$id; global $pagereport, $minatt, $maxatt, $course, $page, $numatt, $maxpages, $attendance,$scope,$id;
if ($pagereport) { if ($pagereport) {
$of = get_string('of','attendance'); $of = get_string('of','attendance');
$pg = get_string('page'); $pg = get_string('page');
echo "<center><table align=\"center\" width=\"80\" class=\"generalbox\"". echo "<center><table align=\"center\" width=\"80\" class=\"generalbox\"".
"border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>". "border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr>".
"<td bgcolor=\"#ffffff\" class=\"generalboxcontent\">"; "<td bgcolor=\"#ffffff\" class=\"generalboxcontent\">";
// this is the main table // this is the main table
echo "<table width=\"100%\" border=\"0\" valign=\"top\" align=\"center\" ". echo "<table width=\"100%\" border=\"0\" valign=\"top\" align=\"center\" ".
"cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">"; "cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">";
echo "<tr>"; echo "<tr>";
if ($minatt!=0) { if ($minatt!=0) {
echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">". echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">".
"<a href=\"viewweek.php?scope=".$scope."&id=".$id ."&pagereport=1&page=".($page-1)."\">&lt;</a>&nbsp;\n"; "<a href=\"viewweek.php?scope=".$scope."&id=".$id ."&pagereport=1&page=".($page-1)."\">&lt;</a>&nbsp;\n";
"<a href=\"viewweek.php?scope=".$scope."&id=".$id ."&pagereport=1&page=1\">&lt;&lt;</a></th>\n"; "<a href=\"viewweek.php?scope=".$scope."&id=".$id ."&pagereport=1&page=1\">&lt;&lt;</a></th>\n";
} else { } else {
echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">&lt;&lt;&nbsp;&lt;</th>\n"; echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">&lt;&lt;&nbsp;&lt;</th>\n";
} }
echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">". echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">".
"$pg $page $of $maxpages</th>\n"; "$pg $page $of $maxpages</th>\n";
if ($maxatt!=$numatt) { if ($maxatt!=$numatt) {
echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">". echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">".
"<a href=\"viewweek.php?scope=".$scope."&id=".$id ."&pagereport=1&page=". ($page+1)."\">&gt;</a>&nbsp;". "<a href=\"viewweek.php?scope=".$scope."&id=".$id ."&pagereport=1&page=". ($page+1)."\">&gt;</a>&nbsp;".
"<a href=\"viewweek.php?scope=".$scope."&id=".$id ."&pagereport=1&page=$maxpages\">&gt;&gt;</a></th>"; "<a href=\"viewweek.php?scope=".$scope."&id=".$id ."&pagereport=1&page=$maxpages\">&gt;&gt;</a></th>";
} else { } else {
echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">&gt;&nbsp;&gt;&gt;</th>\n"; echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">&gt;&nbsp;&gt;&gt;</th>\n";
} }
echo "</tr></table></td></tr></table></center>\n"; echo "</tr></table></td></tr></table></center>\n";
} }
} }
@ -516,15 +516,12 @@ function attendance_print_header() {
/// Print the page header /// Print the page header
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strattendances = get_string("modulenameplural", "attendance"); $strattendances = get_string("modulenameplural", "attendance");
$strattendance = get_string("modulename", "attendance"); $strattendance = get_string("modulename", "attendance");
$strweekattendance = get_string("weekmodulename", "attendance"); $strweekattendance = get_string("weekmodulename", "attendance");
print_header("$course->shortname: $strallattendance", "$course->fullname", print_header_simple("$strallattendance", "",
"$navigation <A HREF=index.php?id=$course->id>$strattendances</A> -> $strweekattendance", "<A HREF=index.php?id=$course->id>$strattendances</A> -> $strweekattendance",
"", "", true, "&nbsp;", "", "", true, "&nbsp;",
navmenu($course, $cm)); navmenu($course, $cm));
} }

View file

@ -22,11 +22,7 @@
/// Print the header /// Print the header
if ($course->category) { print_header_simple($strchats, "", $strchats, "", "", true, "", navmenu($course));
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
print_header("$course->shortname: $strchats", "$course->fullname", "$navigation $strchats", "", "", true, "", navmenu($course));
/// Get all the appropriate data /// Get all the appropriate data

View file

@ -33,12 +33,6 @@
add_to_log($course->id, "chat", "report", "report.php?id=$cm->id", "$chat->id", "$cm->id"); add_to_log($course->id, "chat", "report", "report.php?id=$cm->id", "$chat->id", "$cm->id");
/// Print the page header
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
$strchats = get_string("modulenameplural", "chat"); $strchats = get_string("modulenameplural", "chat");
$strchat = get_string("modulename", "chat"); $strchat = get_string("modulename", "chat");
$strchatreport = get_string("chatreport", "chat"); $strchatreport = get_string("chatreport", "chat");
@ -58,8 +52,8 @@
$groupparam = ""; $groupparam = "";
} }
print_header("$course->shortname: $chat->name: $strchatreport", "$course->fullname", print_header_simple("$chat->name: $strchatreport", "",
"$navigation <a href=\"index.php?id=$course->id\">$strchats</a> -> "<a href=\"index.php?id=$course->id\">$strchats</a> ->
<a href=\"view.php?id=$cm->id\">$chat->name</a> -> <a href=\"view.php?id=$cm->id\">$chat->name</a> ->
<a href=\"report.php?id=$cm->id\">$strchatreport</a>", <a href=\"report.php?id=$cm->id\">$strchatreport</a>",
"", "", true, "", navmenu($course, $cm)); "", "", true, "", navmenu($course, $cm));
@ -97,8 +91,8 @@
/// Print the Sessions display /// Print the Sessions display
print_header("$course->shortname: $chat->name: $strchatreport", "$course->fullname", print_header_simple("$chat->name: $strchatreport", "",
"$navigation <a href=\"index.php?id=$course->id\">$strchats</a> -> "<a href=\"index.php?id=$course->id\">$strchats</a> ->
<a href=\"view.php?id=$cm->id\">$chat->name</a> -> $strchatreport", <a href=\"view.php?id=$cm->id\">$chat->name</a> -> $strchatreport",
"", "", true, "", navmenu($course, $cm)); "", "", true, "", navmenu($course, $cm));

View file

@ -43,10 +43,6 @@
/// Print the page header /// Print the page header
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strchats = get_string("modulenameplural", "chat"); $strchats = get_string("modulenameplural", "chat");
$strchat = get_string("modulename", "chat"); $strchat = get_string("modulename", "chat");
$strenterchat = get_string("enterchat", "chat"); $strenterchat = get_string("enterchat", "chat");
@ -54,8 +50,8 @@
$strcurrentusers = get_string("currentusers", "chat"); $strcurrentusers = get_string("currentusers", "chat");
$strnextsession = get_string("nextsession", "chat"); $strnextsession = get_string("nextsession", "chat");
print_header("$course->shortname: $chat->name", "$course->fullname", print_header_simple("$chat->name", "",
"$navigation <A HREF=index.php?id=$course->id>$strchats</A> -> $chat->name", "<A HREF=index.php?id=$course->id>$strchats</A> -> $chat->name",
"", "", true, update_module_button($cm->id, $course->id, $strchat), "", "", true, update_module_button($cm->id, $course->id, $strchat),
navmenu($course, $cm)); navmenu($course, $cm));

View file

@ -13,17 +13,11 @@
add_to_log($course->id, "choice", "view all", "index?id=$course->id", ""); add_to_log($course->id, "choice", "view all", "index?id=$course->id", "");
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
} else {
$navigation = "";
}
$strchoice = get_string("modulename", "choice"); $strchoice = get_string("modulename", "choice");
$strchoices = get_string("modulenameplural", "choice"); $strchoices = get_string("modulenameplural", "choice");
print_header("$course->shortname: $strchoices", "$course->fullname", print_header_simple("$strchoices", "",
"$navigation $strchoices", "", "", true, "", navmenu($course)); "$strchoices", "", "", true, "", navmenu($course));
if (! $choices = get_all_instances_in_course("choice", $course)) { if (! $choices = get_all_instances_in_course("choice", $course)) {

View file

@ -61,13 +61,8 @@
add_to_log($course->id, "choice", "view", "view.php?id=$cm->id", $choice->id, $cm->id); add_to_log($course->id, "choice", "view", "view.php?id=$cm->id", $choice->id, $cm->id);
if ($course->category) { print_header_simple("$choice->name", "",
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->"; "<A HREF=index.php?id=$course->id>$strchoices</A> -> $choice->name", "", "", true,
} else {
$navigation = "";
}
print_header("$course->shortname: $choice->name", "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strchoices</A> -> $choice->name", "", "", true,
update_module_button($cm->id, $course->id, $strchoice), navmenu($course, $cm)); update_module_button($cm->id, $course->id, $strchoice), navmenu($course, $cm));
/// Check to see if groups are being used in this choice /// Check to see if groups are being used in this choice

View file

@ -1,13 +1,13 @@
<?PHP // $Id$ <?PHP // $Id$
/************************************************* /*************************************************
ACTIONS handled are: ACTIONS handled are:
closeconversation closeconversation
confirmclose confirmclose
getsubject getsubject
insertentries insertentries
openconversation openconversation
printdialogue printdialogue
showdialogues showdialogues
updatesubject updatesubject
@ -32,80 +32,75 @@
error("Course module dialogue is incorrect"); error("Course module dialogue is incorrect");
} }
require_login($course->id); require_login($course->id);
// set up some general variables // set up some general variables
$usehtmleditor = can_use_html_editor(); $usehtmleditor = can_use_html_editor();
$navigation = "";
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strdialogues = get_string("modulenameplural", "dialogue"); $strdialogues = get_string("modulenameplural", "dialogue");
$strdialogue = get_string("modulename", "dialogue"); $strdialogue = get_string("modulename", "dialogue");
// ... print the header and... // ... print the header and...
print_header("$course->shortname: $dialogue->name", "$course->fullname", print_header_simple("$dialogue->name", "",
"$navigation <A HREF=index.php?id=$course->id>$strdialogues</A> -> "<A HREF=index.php?id=$course->id>$strdialogues</A> ->
<A HREF=\"view.php?id=$cm->id\">$dialogue->name</A>", <A HREF=\"view.php?id=$cm->id\">$dialogue->name</A>",
"", "", true); "", "", true);
require_variable($action); // need something to do! require_variable($action); // need something to do!
/************** close conversation ************************************/ /************** close conversation ************************************/
if ($action == 'closeconversation') { if ($action == 'closeconversation') {
if (empty($_GET['cid'])) { if (empty($_GET['cid'])) {
error("Close dialogue: Missing conversation id"); error("Close dialogue: Missing conversation id");
} }
else { else {
$conversationid = $_GET['cid']; $conversationid = $_GET['cid'];
} }
if (!set_field("dialogue_conversations", "closed", 1, "id", $conversationid)) { if (!set_field("dialogue_conversations", "closed", 1, "id", $conversationid)) {
error("Close dialogue: unable to set closed"); error("Close dialogue: unable to set closed");
} }
if (!set_field("dialogue_conversations", "lastid", $USER->id, "id", $conversationid)) { if (!set_field("dialogue_conversations", "lastid", $USER->id, "id", $conversationid)) {
error("Close dialogue: unable to set lastid"); error("Close dialogue: unable to set lastid");
} }
$pane=$_GET['pane']; $pane=$_GET['pane'];
add_to_log($course->id, "dialogue", "closed", "view.php?id=$cm->id", "$conversationid"); add_to_log($course->id, "dialogue", "closed", "view.php?id=$cm->id", "$conversationid");
redirect("view.php?id=$cm->id&pane=$pane", get_string("dialogueclosed", "dialogue")); redirect("view.php?id=$cm->id&pane=$pane", get_string("dialogueclosed", "dialogue"));
} }
/****************** confirm close ************************************/ /****************** confirm close ************************************/
elseif ($action == 'confirmclose' ) { elseif ($action == 'confirmclose' ) {
if (empty($_GET['cid'])) { if (empty($_GET['cid'])) {
error("Confirm Close: conversation id missing"); error("Confirm Close: conversation id missing");
} }
if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) { if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) {
error("Confirm close: cannot get conversation record"); error("Confirm close: cannot get conversation record");
} }
if ($conversation->userid == $USER->id) { if ($conversation->userid == $USER->id) {
if (!$user = get_record("user", "id", $conversation->recipientid)) { if (!$user = get_record("user", "id", $conversation->recipientid)) {
error("Confirm Close: cannot get recipient record"); error("Confirm Close: cannot get recipient record");
} }
} }
else { else {
if (!$user = get_record("user", "id", $conversation->userid)) { if (!$user = get_record("user", "id", $conversation->userid)) {
error("Confirm Close: cannot get user record"); error("Confirm Close: cannot get user record");
} }
} }
$pane = $_GET['pane']; $pane = $_GET['pane'];
notice_yesno(get_string("confirmclosure", "dialogue", fullname($user)), notice_yesno(get_string("confirmclosure", "dialogue", fullname($user)),
"dialogues.php?action=closeconversation&id=$cm->id&cid=$conversation->id&pane=$pane", "dialogues.php?action=closeconversation&id=$cm->id&cid=$conversation->id&pane=$pane",
"view.php?id=$cm->id&pane=$pane"); "view.php?id=$cm->id&pane=$pane");
} }
/****************** get subject ************************************/ /****************** get subject ************************************/
elseif ($action == 'getsubject' ) { elseif ($action == 'getsubject' ) {
if (empty($_GET['cid'])) { if (empty($_GET['cid'])) {
error("Confirm Close: conversation id missing"); error("Confirm Close: conversation id missing");
} }
print_heading(get_string("addsubject", "dialogue")); print_heading(get_string("addsubject", "dialogue"));
echo "<form name=\"getsubjectform\" method=\"post\" action=\"dialogues.php\">\n"; echo "<form name=\"getsubjectform\" method=\"post\" action=\"dialogues.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"updatesubject\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"updatesubject\">\n";
@ -119,70 +114,70 @@
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"". echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"".
get_string("addsubject", "dialogue")."\"></td></tr>\n"; get_string("addsubject", "dialogue")."\"></td></tr>\n";
echo "</table></center></form>\n"; echo "</table></center></form>\n";
} }
/****************** insert conversation entries ******************************/ /****************** insert conversation entries ******************************/
elseif ($action == 'insertentries' ) { elseif ($action == 'insertentries' ) {
$timenow = time(); $timenow = time();
$n = 0; $n = 0;
// get all the open conversations for this user // get all the open conversations for this user
if ($conversations = dialogue_get_conversations($dialogue, $USER, "closed = 0")) { if ($conversations = dialogue_get_conversations($dialogue, $USER, "closed = 0")) {
foreach ($conversations as $conversation) { foreach ($conversations as $conversation) {
$textarea_name = "reply$conversation->id"; $textarea_name = "reply$conversation->id";
$stripped_text = ''; $stripped_text = '';
if (isset($_POST[$textarea_name])) { if (isset($_POST[$textarea_name])) {
$stripped_text = strip_tags(trim($_POST[$textarea_name])); $stripped_text = strip_tags(trim($_POST[$textarea_name]));
} }
if ($stripped_text) { if ($stripped_text) {
unset($item); unset($item);
$item->dialogueid = $dialogue->id; $item->dialogueid = $dialogue->id;
$item->conversationid = $conversation->id; $item->conversationid = $conversation->id;
$item->userid = $USER->id; $item->userid = $USER->id;
$item->timecreated = time(); $item->timecreated = time();
// reverse the dialogue mail default // reverse the dialogue mail default
$item->mailed = !$dialogue->maildefault; $item->mailed = !$dialogue->maildefault;
$item->text = $_POST[$textarea_name]; $item->text = $_POST[$textarea_name];
if (!$item->id = insert_record("dialogue_entries", $item)) { if (!$item->id = insert_record("dialogue_entries", $item)) {
error("Insert Entries: Could not insert dialogue record!"); error("Insert Entries: Could not insert dialogue record!");
} }
if (!set_field("dialogue_conversations", "lastid", $USER->id, "id", $conversation->id)) { if (!set_field("dialogue_conversations", "lastid", $USER->id, "id", $conversation->id)) {
error("Insert Dialogue Entries: could not set lastid"); error("Insert Dialogue Entries: could not set lastid");
} }
if (!set_field("dialogue_conversations", "timemodified", $timenow, "id", if (!set_field("dialogue_conversations", "timemodified", $timenow, "id",
$conversation->id)) { $conversation->id)) {
error("Insert Dialogue Entries: could not set lastid"); error("Insert Dialogue Entries: could not set lastid");
} }
// reset seenon time // reset seenon time
if (!set_field("dialogue_conversations", "seenon", 0, "id", if (!set_field("dialogue_conversations", "seenon", 0, "id",
$conversation->id)) { $conversation->id)) {
error("Insert Dialogue Entries: could not reset seenon"); error("Insert Dialogue Entries: could not reset seenon");
} }
add_to_log($course->id, "dialogue", "add entry", "view.php?id=$cm->id", "$item->id"); add_to_log($course->id, "dialogue", "add entry", "view.php?id=$cm->id", "$item->id");
$n++; $n++;
} }
} }
} }
redirect("view.php?id=$cm->id&pane={$_POST['pane']}", get_string("numberofentriesadded", redirect("view.php?id=$cm->id&pane={$_POST['pane']}", get_string("numberofentriesadded",
"dialogue", $n)); "dialogue", $n));
} }
/****************** list closed conversations *********************************/ /****************** list closed conversations *********************************/
elseif ($action == 'listclosed') { elseif ($action == 'listclosed') {
echo "<center>\n"; echo "<center>\n";
print_simple_box( text_to_html($dialogue->intro) , "center"); print_simple_box( text_to_html($dialogue->intro) , "center");
echo "<br />"; echo "<br />";
dialogue_list_closed_conversations($dialogue); dialogue_list_closed_conversations($dialogue);
} }
/****************** open conversation ************************************/ /****************** open conversation ************************************/
elseif ($action == 'openconversation' ) { elseif ($action == 'openconversation' ) {
if (empty($_POST['recipientid'])) { if (empty($_POST['recipientid'])) {
redirect("view.php?id=$cm->id", get_string("nopersonchosen", "dialogue")); redirect("view.php?id=$cm->id", get_string("nopersonchosen", "dialogue"));
} else { } else {
$recipientid = $_POST['recipientid']; $recipientid = $_POST['recipientid'];
if (substr($recipientid, 0, 1) == 'g') { // it's a group if (substr($recipientid, 0, 1) == 'g') { // it's a group
@ -256,47 +251,47 @@
} }
redirect("view.php?id=$cm->id", get_string("dialogueopened", "dialogue", fullname($user) )); redirect("view.php?id=$cm->id", get_string("dialogueopened", "dialogue", fullname($user) ));
} }
} }
} }
/****************** print dialogue (allowing new entry)********************/ /****************** print dialogue (allowing new entry)********************/
elseif ($action == 'printdialogue') { elseif ($action == 'printdialogue') {
if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) { if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) {
error("Print Dialogue: can not get conversation record"); error("Print Dialogue: can not get conversation record");
} }
echo "<center>\n"; echo "<center>\n";
print_simple_box( text_to_html($dialogue->intro) , "center"); print_simple_box( text_to_html($dialogue->intro) , "center");
echo "<br />"; echo "<br />";
dialogue_print_conversation($dialogue, $conversation); dialogue_print_conversation($dialogue, $conversation);
} }
/****************** show dialogues ****************************************/ /****************** show dialogues ****************************************/
elseif ($action == 'showdialogues') { elseif ($action == 'showdialogues') {
if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) { if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) {
error("Show Dialogue: can not get conversation record"); error("Show Dialogue: can not get conversation record");
} }
echo "<center>\n"; echo "<center>\n";
print_simple_box( text_to_html($dialogue->intro) , "center"); print_simple_box( text_to_html($dialogue->intro) , "center");
echo "<br />"; echo "<br />";
dialogue_show_conversation($dialogue, $conversation); dialogue_show_conversation($dialogue, $conversation);
dialogue_show_other_conversations($dialogue, $conversation); dialogue_show_other_conversations($dialogue, $conversation);
} }
/****************** update subject ****************************************/ /****************** update subject ****************************************/
elseif ($action == 'updatesubject') { elseif ($action == 'updatesubject') {
if (!$conversation = get_record("dialogue_conversations", "id", $_POST['cid'])) { if (!$conversation = get_record("dialogue_conversations", "id", $_POST['cid'])) {
error("Update Subject: can not get conversation record"); error("Update Subject: can not get conversation record");
} }
if (!$_POST['subject']) { if (!$_POST['subject']) {
redirect("view.php?id=$cm->id&pane=$_POST[pane]", get_string("nosubject", "dialogue")); redirect("view.php?id=$cm->id&pane=$_POST[pane]", get_string("nosubject", "dialogue"));
@ -304,13 +299,13 @@
error("Update subject: could not update conversation record"); error("Update subject: could not update conversation record");
} }
redirect("view.php?id=$cm->id&pane=$_POST[pane]", get_string("subjectadded", "dialogue")); redirect("view.php?id=$cm->id&pane=$_POST[pane]", get_string("subjectadded", "dialogue"));
} }
/*************** no man's land **************************************/ /*************** no man's land **************************************/
else { else {
error("Fatal Error: Unknown Action: ".$action."\n"); error("Fatal Error: Unknown Action: ".$action."\n");
} }
print_footer($course); print_footer($course);

View file

@ -13,17 +13,13 @@
require_login($course->id); require_login($course->id);
add_to_log($course->id, "dialogue", "view all", "index.php?id=$course->id", ""); add_to_log($course->id, "dialogue", "view all", "index.php?id=$course->id", "");
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strdialogue = get_string("modulename", "dialogue"); $strdialogue = get_string("modulename", "dialogue");
$strdialogues = get_string("modulenameplural", "dialogue"); $strdialogues = get_string("modulenameplural", "dialogue");
$strname = get_string("name"); $strname = get_string("name");
$stropendialogues = get_string("open", "dialogue")." ".$strdialogues; $stropendialogues = get_string("open", "dialogue")." ".$strdialogues;
$strcloseddialogues = get_string("closed", "dialogue")." ".$strdialogues; $strcloseddialogues = get_string("closed", "dialogue")." ".$strdialogues;
print_header("$course->shortname: $strdialogues", "$course->fullname", "$navigation $strdialogues", print_header_simple("$strdialogues", "", "$strdialogues",
"", "", true, "", navmenu($course)); "", "", true, "", navmenu($course));
@ -42,7 +38,7 @@
if (!$cm = get_coursemodule_from_instance("dialogue", $dialogue->id, $course->id)) { if (!$cm = get_coursemodule_from_instance("dialogue", $dialogue->id, $course->id)) {
error("Course Module ID was incorrect"); error("Course Module ID was incorrect");
} }
$table->data[] = array ("<a href=\"view.php?id=$cm->id\">$dialogue->name</a>", $table->data[] = array ("<a href=\"view.php?id=$cm->id\">$dialogue->name</a>",
dialogue_count_open($dialogue, $USER), dialogue_count_closed($dialogue, $USER)); dialogue_count_open($dialogue, $USER), dialogue_count_closed($dialogue, $USER));
} }
echo "<br />"; echo "<br />";

View file

@ -29,48 +29,44 @@
// set up some general variables // set up some general variables
$usehtmleditor = can_use_html_editor(); $usehtmleditor = can_use_html_editor();
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
$strdialogue = get_string("modulename", "dialogue"); $strdialogue = get_string("modulename", "dialogue");
$strdialogues = get_string("modulenameplural", "dialogue"); $strdialogues = get_string("modulenameplural", "dialogue");
print_header("$course->shortname: $dialogue->name", "$course->fullname", print_header_simple("$dialogue->name", "",
"$navigation <a href=\"index.php?id=$course->id\">$strdialogues</a> -> $dialogue->name", "<a href=\"index.php?id=$course->id\">$strdialogues</a> -> $dialogue->name",
"", "", true, "", "", true,
update_module_button($cm->id, $course->id, $strdialogue), navmenu($course, $cm)); update_module_button($cm->id, $course->id, $strdialogue), navmenu($course, $cm));
// ...and if necessary set default action // ...and if necessary set default action
optional_variable($action); optional_variable($action);
if (!isguest()) { // it's a teacher or student if (!isguest()) { // it's a teacher or student
if (!$cm->visible and isstudent($course->id)) { if (!$cm->visible and isstudent($course->id)) {
$action = 'notavailable'; $action = 'notavailable';
} }
if (empty($action)) { if (empty($action)) {
$action = 'view'; $action = 'view';
} }
} }
else { // it's a guest, oh no! else { // it's a guest, oh no!
$action = 'notavailable'; $action = 'notavailable';
} }
/*********************** dialogue not available (for gusets mainly)***********************/ /*********************** dialogue not available (for gusets mainly)***********************/
if ($action == 'notavailable') { if ($action == 'notavailable') {
print_heading(get_string("notavailable", "dialogue")); print_heading(get_string("notavailable", "dialogue"));
} }
/************ view **************************************************/ /************ view **************************************************/
elseif ($action == 'view') { elseif ($action == 'view') {
print_simple_box( format_text($dialogue->intro) , "center"); print_simple_box( format_text($dialogue->intro) , "center");
echo "<br />"; echo "<br />";
// get some stats // get some stats
$countneedingrepliesself = dialogue_count_needing_replies_self($dialogue, $USER); $countneedingrepliesself = dialogue_count_needing_replies_self($dialogue, $USER);
$countneedingrepliesother = dialogue_count_needing_replies_other($dialogue, $USER); $countneedingrepliesother = dialogue_count_needing_replies_other($dialogue, $USER);
$countclosed = dialogue_count_closed($dialogue, $USER); $countclosed = dialogue_count_closed($dialogue, $USER);
@ -121,7 +117,7 @@
echo "<br/><center>\n"; echo "<br/><center>\n";
switch ($pane) { switch ($pane) {
case 0: case 0:
if (isteacher($course->id)) { if (isteacher($course->id)) {
/// Check to see if groups are being used in this dialogue /// Check to see if groups are being used in this dialogue
@ -139,57 +135,57 @@
} }
if ($names = dialogue_get_available_users($dialogue)) { if ($names = dialogue_get_available_users($dialogue)) {
print_simple_box_start("center"); print_simple_box_start("center");
echo "<center>"; echo "<center>";
echo "<form name=\"startform\" method=\"post\" action=\"dialogues.php\">\n"; echo "<form name=\"startform\" method=\"post\" action=\"dialogues.php\">\n";
echo "<input type=\"hidden\" name=\"id\"value=\"$cm->id\">\n"; echo "<input type=\"hidden\" name=\"id\"value=\"$cm->id\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"openconversation\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"openconversation\">\n";
echo "<table border=\"0\"><tr>\n"; echo "<table border=\"0\"><tr>\n";
echo "<td align=\"right\"><b>".get_string("openadialoguewith", "dialogue"). echo "<td align=\"right\"><b>".get_string("openadialoguewith", "dialogue").
" : </b></td>\n"; " : </b></td>\n";
echo "<td>"; echo "<td>";
choose_from_menu($names, "recipientid"); choose_from_menu($names, "recipientid");
echo "</td></tr>\n"; echo "</td></tr>\n";
echo "<tr><td align=\"right\"><b>".get_string("subject", "dialogue")." : </b></td>\n"; echo "<tr><td align=\"right\"><b>".get_string("subject", "dialogue")." : </b></td>\n";
echo "<td><input type=\"text\" size=\"50\" maxsize=\"100\" name=\"subject\" echo "<td><input type=\"text\" size=\"50\" maxsize=\"100\" name=\"subject\"
value=\"\"></td></tr>\n"; value=\"\"></td></tr>\n";
echo "<tr><td colspan=\"2\" align=\"center\" valign=\"top\"><i>". echo "<tr><td colspan=\"2\" align=\"center\" valign=\"top\"><i>".
get_string("typefirstentry", "dialogue")."</i></td></tr>\n"; get_string("typefirstentry", "dialogue")."</i></td></tr>\n";
echo "<tr><td valign=\"top\" align=\"right\">\n"; echo "<tr><td valign=\"top\" align=\"right\">\n";
helpbutton("writing", get_string("helpwriting"), "moodle", true, true); helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />"; echo "<br />";
echo "</td><td>\n"; echo "</td><td>\n";
print_textarea($usehtmleditor, 20, 75, 630, 300, "firstentry"); print_textarea($usehtmleditor, 20, 75, 630, 300, "firstentry");
use_html_editor(); use_html_editor();
echo "</td></tr>"; echo "</td></tr>";
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"". echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"".
get_string("opendialogue","dialogue")."\"></td></tr>\n"; get_string("opendialogue","dialogue")."\"></td></tr>\n";
echo "</table></form>\n"; echo "</table></form>\n";
echo "</center>"; echo "</center>";
print_simple_box_end(); print_simple_box_end();
} else { } else {
print_heading(get_string("noavailablepeople", "dialogue")); print_heading(get_string("noavailablepeople", "dialogue"));
print_continue("view.php?id=$cm->id"); print_continue("view.php?id=$cm->id");
} }
break; break;
case 1: case 1:
// print active conversations requiring a reply // print active conversations requiring a reply
dialogue_list_conversations_self($dialogue, $USER); dialogue_list_conversations_self($dialogue, $USER);
break; break;
case 2: case 2:
// print active conversations requiring a reply from the other person. // print active conversations requiring a reply from the other person.
dialogue_list_conversations_other($dialogue, $USER); dialogue_list_conversations_other($dialogue, $USER);
break; break;
case 3: case 3:
dialogue_list_conversations_closed($dialogue, $USER); dialogue_list_conversations_closed($dialogue, $USER);
} }
} }
/*************** no man's land **************************************/ /*************** no man's land **************************************/
else { else {
error("Fatal Error: Unknown Action: ".$action."\n"); error("Fatal Error: Unknown Action: ".$action."\n");
} }
print_footer($course); print_footer($course);

View file

@ -51,18 +51,13 @@
require_login($course->id); require_login($course->id);
$navigation = "";
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strexercises = get_string("modulenameplural", "exercise"); $strexercises = get_string("modulenameplural", "exercise");
$strexercise = get_string("modulename", "exercise"); $strexercise = get_string("modulename", "exercise");
$strassessments = get_string("assessments", "exercise"); $strassessments = get_string("assessments", "exercise");
// ... print the header and... // ... print the header and...
print_header("$course->shortname: $exercise->name", "$course->fullname", print_header_simple("$exercise->name", "",
"$navigation <A HREF=index.php?id=$course->id>$strexercises</A> -> "<A HREF=index.php?id=$course->id>$strexercises</A> ->
<A HREF=\"view.php?id=$cm->id\">$exercise->name</A> -> $strassessments", <A HREF=\"view.php?id=$cm->id\">$exercise->name</A> -> $strassessments",
"", "", true); "", "", true);

View file

@ -13,22 +13,18 @@
require_login($course->id); require_login($course->id);
add_to_log($course->id, "exercise", "view all", "index.php?id=$course->id", ""); add_to_log($course->id, "exercise", "view all", "index.php?id=$course->id", "");
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strexercises = get_string("modulenameplural", "exercise"); $strexercises = get_string("modulenameplural", "exercise");
$strexercise = get_string("modulename", "exercise"); $strexercise = get_string("modulename", "exercise");
$strweek = get_string("week"); $strweek = get_string("week");
$strtopic = get_string("topic"); $strtopic = get_string("topic");
$strname = get_string("name"); $strname = get_string("name");
$strtitle = get_string("title", "exercise"); $strtitle = get_string("title", "exercise");
$strphase = get_string("phase", "exercise"); $strphase = get_string("phase", "exercise");
$strgrade = get_string("grade"); $strgrade = get_string("grade");
$strdeadline = get_string("deadline", "exercise"); $strdeadline = get_string("deadline", "exercise");
$strsubmitted = get_string("submitted", "assignment"); $strsubmitted = get_string("submitted", "assignment");
print_header("$course->shortname: $strexercises", "$course->fullname", "$navigation $strexercises", "", "", true, "", navmenu($course)); print_header_simple("$strexercises", "", "$strexercises", "", "", true, "", navmenu($course));
if (! $exercises = get_all_instances_in_course("exercise", $course)) { if (! $exercises = get_all_instances_in_course("exercise", $course)) {
notice("There are no exercises", "../../course/view.php?id=$course->id"); notice("There are no exercises", "../../course/view.php?id=$course->id");
@ -57,22 +53,22 @@
} }
foreach ($exercises as $exercise) { foreach ($exercises as $exercise) {
if ($exercise->deadline > $timenow) { if ($exercise->deadline > $timenow) {
$due = userdate($exercise->deadline); $due = userdate($exercise->deadline);
} else { } else {
$due = "<FONT COLOR=\"red\">".userdate($exercise->deadline)."</FONT>"; $due = "<FONT COLOR=\"red\">".userdate($exercise->deadline)."</FONT>";
} }
if ($submissions = exercise_get_user_submissions($exercise, $USER)) { if ($submissions = exercise_get_user_submissions($exercise, $USER)) {
foreach ($submissions as $submission) { foreach ($submissions as $submission) {
if ($submission->late) { if ($submission->late) {
$submitted = "<FONT COLOR=\"red\">".userdate($submission->timecreated)."</FONT>"; $submitted = "<FONT COLOR=\"red\">".userdate($submission->timecreated)."</FONT>";
} }
else { else {
$submitted = userdate($submission->timecreated); $submitted = userdate($submission->timecreated);
} }
$link = "<A HREF=\"view.php?id=$exercise->coursemodule\">$exercise->name</A>"; $link = "<A HREF=\"view.php?id=$exercise->coursemodule\">$exercise->name</A>";
$title = $submission->title; $title = $submission->title;
if ($course->format == "weeks" or $course->format == "topics") { if ($course->format == "weeks" or $course->format == "topics") {
if (isteacher($course->id)) { if (isteacher($course->id)) {
$phase = ''; $phase = '';
switch ($exercise->phase) { switch ($exercise->phase) {
@ -89,7 +85,7 @@
} }
break; break;
} }
$table->data[] = array ($exercise->section, $link, $title, $phase, $table->data[] = array ($exercise->section, $link, $title, $phase,
$submitted, $due); $submitted, $due);
} else { // it's a student } else { // it's a student
if ($assessments = exercise_get_user_assessments($exercise, $USER)) { // should be only one... if ($assessments = exercise_get_user_assessments($exercise, $USER)) { // should be only one...
@ -110,31 +106,31 @@
$submitted, $due); $submitted, $due);
} }
} else { } else {
$table->data[] = array ($exercise->section, $link, $title, $table->data[] = array ($exercise->section, $link, $title,
"-", $submitted, $due); "-", $submitted, $due);
} }
} }
} }
} else { } else {
$table->data[] = array ($link, $submitted, $due); $table->data[] = array ($link, $submitted, $due);
} }
} }
} else { } else {
$submitted = get_string("no"); $submitted = get_string("no");
$title = ''; $title = '';
$link = "<A HREF=\"view.php?id=$exercise->coursemodule\">$exercise->name</A>"; $link = "<A HREF=\"view.php?id=$exercise->coursemodule\">$exercise->name</A>";
if ($course->format == "weeks" or $course->format == "topics") { if ($course->format == "weeks" or $course->format == "topics") {
if (isteacher($course->id)) { if (isteacher($course->id)) {
$table->data[] = array ($exercise->section, $link, $title, $exercise->phase, $table->data[] = array ($exercise->section, $link, $title, $exercise->phase,
$submitted, $due); $submitted, $due);
} else { } else {
$table->data[] = array ($exercise->section, $link, $title, "-", $submitted, $due); $table->data[] = array ($exercise->section, $link, $title, "-", $submitted, $due);
} }
} else { } else {
$table->data[] = array ($link, $submitted, $due); $table->data[] = array ($link, $submitted, $due);
} }
} }
} }
echo "<BR>"; echo "<BR>";
print_table($table); print_table($table);

View file

@ -41,17 +41,13 @@
require_login($course->id); require_login($course->id);
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strexercises = get_string("modulenameplural", "exercise"); $strexercises = get_string("modulenameplural", "exercise");
$strexercise = get_string("modulename", "exercise"); $strexercise = get_string("modulename", "exercise");
$strsubmissions = get_string("submissions", "exercise"); $strsubmissions = get_string("submissions", "exercise");
// ... print the header and... // ... print the header and...
print_header("$course->shortname: $exercise->name", "$course->fullname", print_header_simple("$exercise->name", "",
"$navigation <A HREF=index.php?id=$course->id>$strexercises</A> -> "$<A HREF=index.php?id=$course->id>$strexercises</A> ->
<A HREF=\"view.php?id=$cm->id\">$exercise->name</A> -> $strsubmissions", <A HREF=\"view.php?id=$cm->id\">$exercise->name</A> -> $strsubmissions",
"", "", true); "", "", true);

View file

@ -10,29 +10,26 @@
$newfile = $HTTP_POST_FILES["newfile"]; $newfile = $HTTP_POST_FILES["newfile"];
// get some esential stuff... // get some esential stuff...
if (! $cm = get_record("course_modules", "id", $id)) { if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect"); error("Course Module ID was incorrect");
} }
if (! $course = get_record("course", "id", $cm->course)) { if (! $course = get_record("course", "id", $cm->course)) {
error("Course is misconfigured"); error("Course is misconfigured");
} }
if (! $exercise = get_record("exercise", "id", $cm->instance)) { if (! $exercise = get_record("exercise", "id", $cm->instance)) {
error("Course module is incorrect"); error("Course module is incorrect");
} }
require_login($course->id); require_login($course->id);
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strexercises = get_string("modulenameplural", "exercise"); $strexercises = get_string("modulenameplural", "exercise");
$strexercise = get_string("modulename", "exercise"); $strexercise = get_string("modulename", "exercise");
$strupload = get_string("upload"); $strupload = get_string("upload");
print_header("$course->shortname: $exercise->name : $strupload", "$course->fullname", print_header_simple("$exercise->name : $strupload", "",
"$navigation <A HREF=index.php?id=$course->id>$strexercises</A> -> "<A HREF=index.php?id=$course->id>$strexercises</A> ->
<A HREF=\"view.php?id=$cm->id\">$exercise->name</A> -> $strupload", <A HREF=\"view.php?id=$cm->id\">$exercise->name</A> -> $strupload",
"", "", true); "", "", true);
@ -54,58 +51,58 @@
// check existence of title // check existence of title
if (!$title = $_POST['title']) { if (!$title = $_POST['title']) {
notify(get_string("notitlegiven", "exercise") ); notify(get_string("notitlegiven", "exercise") );
} }
else { else {
if (is_uploaded_file($newfile['tmp_name']) and $newfile['size'] > 0) { if (is_uploaded_file($newfile['tmp_name']) and $newfile['size'] > 0) {
if ($newfile['size'] > $exercise->maxbytes) { if ($newfile['size'] > $exercise->maxbytes) {
notify(get_string("uploadfiletoobig", "assignment", $exercise->maxbytes)); notify(get_string("uploadfiletoobig", "assignment", $exercise->maxbytes));
} }
else { else {
$newfile_name = clean_filename($newfile['name']); $newfile_name = clean_filename($newfile['name']);
if ($newfile_name) { if ($newfile_name) {
$newsubmission->exerciseid = $exercise->id; $newsubmission->exerciseid = $exercise->id;
if (isteacher($course->id)) { if (isteacher($course->id)) {
// it's an exercise submission, flag it as such // it's an exercise submission, flag it as such
$newsubmission->userid = 0; $newsubmission->userid = 0;
$newsubmission->isexercise = 1; // it's a description of an exercise $newsubmission->isexercise = 1; // it's a description of an exercise
} }
else { else {
$newsubmission->userid = $USER->id; $newsubmission->userid = $USER->id;
} }
$newsubmission->title = $title; $newsubmission->title = $title;
$newsubmission->timecreated = $timenow; $newsubmission->timecreated = $timenow;
if ($timenow > $exercise->deadline) { if ($timenow > $exercise->deadline) {
$newsubmission->late = 1; $newsubmission->late = 1;
} }
if (!$newsubmission->id = insert_record("exercise_submissions", $newsubmission)) { if (!$newsubmission->id = insert_record("exercise_submissions", $newsubmission)) {
error("exercise upload: Failure to create new submission record!"); error("exercise upload: Failure to create new submission record!");
} }
if (! $dir = exercise_file_area($exercise, $newsubmission)) { if (! $dir = exercise_file_area($exercise, $newsubmission)) {
error("Sorry, an error in the system prevents you from uploading files: contact your teacher or system administrator"); error("Sorry, an error in the system prevents you from uploading files: contact your teacher or system administrator");
} }
if (move_uploaded_file($newfile['tmp_name'], "$dir/$newfile_name")) { if (move_uploaded_file($newfile['tmp_name'], "$dir/$newfile_name")) {
add_to_log($course->id, "exercise", "submit", "view.php?id=$cm->id", "$exercise->id"); add_to_log($course->id, "exercise", "submit", "view.php?id=$cm->id", "$exercise->id");
print_heading(get_string("uploadsuccess", "assignment", $newfile_name) ); print_heading(get_string("uploadsuccess", "assignment", $newfile_name) );
} }
else { else {
notify(get_string("uploaderror", "assignment") ); notify(get_string("uploaderror", "assignment") );
} }
// clear resubmit flags // clear resubmit flags
if (!set_field("exercise_submissions", "resubmit", 0, "exerciseid", $exercise->id, "userid", $USER->id)) { if (!set_field("exercise_submissions", "resubmit", 0, "exerciseid", $exercise->id, "userid", $USER->id)) {
error("Exercise Upload: unable to reset resubmit flag"); error("Exercise Upload: unable to reset resubmit flag");
} }
} }
else { else {
notify(get_string("uploadbadname", "assignment") ); notify(get_string("uploadbadname", "assignment") );
} }
} }
} }
elseif (!is_uploaded_file($newfile['tmp_name']) and !$newfile['size'] > 0 and $newfile['name']) { elseif (!is_uploaded_file($newfile['tmp_name']) and !$newfile['size'] > 0 and $newfile['name']) {
notify(get_string("uploadfiletoobig", "assignment", $exercise->maxbytes)); notify(get_string("uploadfiletoobig", "assignment", $exercise->maxbytes));
} else { } else {
notify(get_string("uploadnofilefound", "assignment")); notify(get_string("uploadnofilefound", "assignment"));
} }
} }
print_continue("view.php?id=$cm->id"); print_continue("view.php?id=$cm->id");

View file

@ -1,114 +1,110 @@
<?PHP // $Id: view.php, v1.1 23 Aug 2003 <?PHP // $Id: view.php, v1.1 23 Aug 2003
/************************************************* /*************************************************
ACTIONS handled are: ACTIONS handled are:
displayfinalgrade (for students) displayfinalgrade (for students)
makeleaguetableavailable (for teachers) makeleaguetableavailable (for teachers)
notavailable (for students) notavailable (for students)
openexercise (for teachers) openexercise (for teachers)
setupassignment (for teachers) setupassignment (for teachers)
showsubmissions (for students) showsubmissions (for students)
studentsview studentsview
submitassignment submitassignment
teachersview teachersview
************************************************/ ************************************************/
require("../../config.php"); require("../../config.php");
require("lib.php"); require("lib.php");
require("locallib.php"); require("locallib.php");
require_variable($id); // Course Module ID require_variable($id); // Course Module ID
// get some esential stuff... // get some esential stuff...
if (! $cm = get_record("course_modules", "id", $id)) { if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect"); error("Course Module ID was incorrect");
} }
if (! $course = get_record("course", "id", $cm->course)) { if (! $course = get_record("course", "id", $cm->course)) {
error("Course is misconfigured"); error("Course is misconfigured");
} }
if (! $exercise = get_record("exercise", "id", $cm->instance)) { if (! $exercise = get_record("exercise", "id", $cm->instance)) {
error("Course module is incorrect"); error("Course module is incorrect");
} }
require_login($course->id); require_login($course->id);
// ...log activity... // ...log activity...
add_to_log($course->id, "exercise", "view", "view.php?id=$cm->id", $exercise->id, $cm->id); add_to_log($course->id, "exercise", "view", "view.php?id=$cm->id", $exercise->id, $cm->id);
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strexercises = get_string("modulenameplural", "exercise"); $strexercises = get_string("modulenameplural", "exercise");
$strexercise = get_string("modulename", "exercise"); $strexercise = get_string("modulename", "exercise");
// ...display header... // ...display header...
print_header("$course->shortname: $exercise->name", "$course->fullname", print_header_simple("$exercise->name", "",
"$navigation <A HREF=index.php?id=$course->id>$strexercises</A> -> $exercise->name", "<A HREF=index.php?id=$course->id>$strexercises</A> -> $exercise->name",
"", "", true, update_module_button($cm->id, $course->id, $strexercise), navmenu($course, $cm)); "", "", true, update_module_button($cm->id, $course->id, $strexercise), navmenu($course, $cm));
// ...and if necessary set default action // ...and if necessary set default action
optional_variable($action); optional_variable($action);
if (isteacher($course->id)) { if (isteacher($course->id)) {
if (empty($action)) { // no action specified, either go straight to elements page else the admin page if (empty($action)) { // no action specified, either go straight to elements page else the admin page
// has the assignment any elements // has the assignment any elements
if (count_records("exercise_elements", "exerciseid", $exercise->id)) { if (count_records("exercise_elements", "exerciseid", $exercise->id)) {
$action = "teachersview"; $action = "teachersview";
} }
else { else {
redirect("assessments.php?action=editelements&id=$cm->id"); redirect("assessments.php?action=editelements&id=$cm->id");
} }
} }
} }
elseif (!isguest()) { // it's a student then elseif (!isguest()) { // it's a student then
if (!$cm->visible) { if (!$cm->visible) {
notice(get_string("activityiscurrentlyhidden")); notice(get_string("activityiscurrentlyhidden"));
} }
switch ($exercise->phase) { switch ($exercise->phase) {
case 0 : case 0 :
case 1 : $action = 'notavailable'; break; case 1 : $action = 'notavailable'; break;
case 2 : $action = 'studentsview'; break; case 2 : $action = 'studentsview'; break;
case 3 : $action = 'displayfinalgrade'; case 3 : $action = 'displayfinalgrade';
} }
} }
else { // it's a guest, oh no! else { // it's a guest, oh no!
$action = 'notavailable'; $action = 'notavailable';
} }
/****************** display final grade (for students) ************************************/ /****************** display final grade (for students) ************************************/
if ($action == 'displayfinalgrade' ) { if ($action == 'displayfinalgrade' ) {
// show the final grades as stored in the tables... // show the final grades as stored in the tables...
print_heading(get_string("displayoffinalgrades", "exercise")); print_heading(get_string("displayoffinalgrades", "exercise"));
if ($submissions = exercise_get_user_submissions($exercise, $USER)) { // any submissions from user? if ($submissions = exercise_get_user_submissions($exercise, $USER)) { // any submissions from user?
echo "<center><table border=\"1\" width=\"90%\"><tr>"; echo "<center><table border=\"1\" width=\"90%\"><tr>";
echo "<td bgcolor=\"$THEME->cellheading2\"><b>".get_string("submissions", "exercise")."</b></td>"; echo "<td bgcolor=\"$THEME->cellheading2\"><b>".get_string("submissions", "exercise")."</b></td>";
echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("gradeforassessment", "exercise")."</b></td>"; echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("gradeforassessment", "exercise")."</b></td>";
echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("gradeforsubmission", "exercise", $course->teacher)."</b></td>"; echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("gradeforsubmission", "exercise", $course->teacher)."</b></td>";
echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("overallgrade", "exercise")."</b></td></TR>\n"; echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("overallgrade", "exercise")."</b></td></TR>\n";
// now the weights // now the weights
echo "<TR><td bgcolor=\"$THEME->cellheading2\"><b>".get_string("maximumgrade")."</b></td>"; echo "<TR><td bgcolor=\"$THEME->cellheading2\"><b>".get_string("maximumgrade")."</b></td>";
echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>$exercise->gradinggrade</b></td>\n"; echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>$exercise->gradinggrade</b></td>\n";
echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>$exercise->grade</b></td>\n"; echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>$exercise->grade</b></td>\n";
echo "<td bgcolor=\"$THEME->cellheading2\"><b>&nbsp;</b></td></TR>\n"; echo "<td bgcolor=\"$THEME->cellheading2\"><b>&nbsp;</b></td></TR>\n";
// first get user's own assessment reord, it should contain their grading grade // first get user's own assessment reord, it should contain their grading grade
if ($ownassessments = exercise_get_user_assessments($exercise, $USER)) { if ($ownassessments = exercise_get_user_assessments($exercise, $USER)) {
foreach ($ownassessments as $ownassessment) { foreach ($ownassessments as $ownassessment) {
break; // there should only be one break; // there should only be one
} }
} }
else { else {
$ownassessment->gradinggrade = 0; $ownassessment->gradinggrade = 0;
} }
foreach ($submissions as $submission) { foreach ($submissions as $submission) {
if ($assessments = exercise_get_assessments($submission)) { if ($assessments = exercise_get_assessments($submission)) {
foreach ($assessments as $assessment) { // (normally there should only be one foreach ($assessments as $assessment) { // (normally there should only be one
$gradinggrade = number_format($ownassessment->gradinggrade * $exercise->gradinggrade / 100.0, $gradinggrade = number_format($ownassessment->gradinggrade * $exercise->gradinggrade / 100.0,
1); 1);
$grade = number_format($assessment->grade * $exercise->grade / 100.0, 1); $grade = number_format($assessment->grade * $exercise->grade / 100.0, 1);
@ -118,86 +114,86 @@
$grade = "<font color=\"red\">(".$grade.")</font>"; $grade = "<font color=\"red\">(".$grade.")</font>";
$overallgrade = "<font color=\"red\">(".$overallgrade.")</font>"; $overallgrade = "<font color=\"red\">(".$overallgrade.")</font>";
} }
echo "<TR><td>".exercise_print_submission_title($exercise, $submission)."</td>\n"; echo "<TR><td>".exercise_print_submission_title($exercise, $submission)."</td>\n";
echo "<td align=\"center\">$gradinggrade</td>"; echo "<td align=\"center\">$gradinggrade</td>";
echo "<td align=\"center\">$grade</td>"; echo "<td align=\"center\">$grade</td>";
echo "<td align=\"center\">$overallgrade</td></TR>\n"; echo "<td align=\"center\">$overallgrade</td></TR>\n";
} }
} }
} }
} }
echo "</TABLE><BR CLEAR=ALL>\n"; echo "</TABLE><BR CLEAR=ALL>\n";
if ($exercise->showleaguetable) { if ($exercise->showleaguetable) {
exercise_print_league_table($exercise); exercise_print_league_table($exercise);
} }
echo "<br />".get_string("maximumgrade").": $exercise->grade<br />\n"; echo "<br />".get_string("maximumgrade").": $exercise->grade<br />\n";
} }
/****************** make final grades available (for teachers only)**************/ /****************** make final grades available (for teachers only)**************/
elseif ($action == 'makeleaguetableavailable') { elseif ($action == 'makeleaguetableavailable') {
if (!isteacheredit($course->id)) { if (!isteacheredit($course->id)) {
error("Only teachers with editing permissions can do this."); error("Only teachers with editing permissions can do this.");
} }
set_field("exercise", "phase", 3, "id", "$exercise->id"); set_field("exercise", "phase", 3, "id", "$exercise->id");
add_to_log($course->id, "exercise", "display", "view.php?id=$cm->id", "$exercise->id", $cm->id); add_to_log($course->id, "exercise", "display", "view.php?id=$cm->id", "$exercise->id", $cm->id);
redirect("view.php?id=$cm->id", get_string("movingtophase", "exercise", 3)); redirect("view.php?id=$cm->id", get_string("movingtophase", "exercise", 3));
} }
/*********************** assignment not available (for students)***********************/ /*********************** assignment not available (for students)***********************/
elseif ($action == 'notavailable') { elseif ($action == 'notavailable') {
print_heading(get_string("notavailable", "exercise")); print_heading(get_string("notavailable", "exercise"));
} }
/****************** open exercise for student assessments and submissions (phase 2) (for teachers)**/ /****************** open exercise for student assessments and submissions (phase 2) (for teachers)**/
elseif ($action == 'openexercise') { elseif ($action == 'openexercise') {
if (!isteacheredit($course->id)) { if (!isteacheredit($course->id)) {
error("Only teachers with editing permissions can do this."); error("Only teachers with editing permissions can do this.");
} }
// move to phase 2, check that teacher has made enough submissions // move to phase 2, check that teacher has made enough submissions
if (exercise_count_teacher_submissions($exercise) == 0) { if (exercise_count_teacher_submissions($exercise) == 0) {
redirect("view.php?id=$cm->id", get_string("noexercisedescriptionssubmitted", "exercise")); redirect("view.php?id=$cm->id", get_string("noexercisedescriptionssubmitted", "exercise"));
} }
elseif (($exercise->gradingstrategy == 3) and ($exercise->nelements ==1 )) { elseif (($exercise->gradingstrategy == 3) and ($exercise->nelements ==1 )) {
// only one criterion specified // only one criterion specified
redirect("view.php?id=$cm->id", get_string("numberofcriterionelements", "exercise")); redirect("view.php?id=$cm->id", get_string("numberofcriterionelements", "exercise"));
} else { } else {
set_field("exercise", "phase", 2, "id", "$exercise->id"); set_field("exercise", "phase", 2, "id", "$exercise->id");
add_to_log($course->id, "exercise", "open", "view.php?id=$cm->id", "$exercise->id", $cm->id); add_to_log($course->id, "exercise", "open", "view.php?id=$cm->id", "$exercise->id", $cm->id);
redirect("view.php?id=$cm->id", get_string("movingtophase", "exercise", 2)); redirect("view.php?id=$cm->id", get_string("movingtophase", "exercise", 2));
} }
} }
/****************** set up assignment (move back to phase 1) (for teachers)***********************/ /****************** set up assignment (move back to phase 1) (for teachers)***********************/
elseif ($action == 'setupassignment') { elseif ($action == 'setupassignment') {
if (!isteacher($course->id)) { if (!isteacher($course->id)) {
error("Only teachers with editing permissions can do this."); error("Only teachers with editing permissions can do this.");
} }
set_field("exercise", "phase", 1, "id", "$exercise->id"); set_field("exercise", "phase", 1, "id", "$exercise->id");
add_to_log($course->id, "exercise", "set up", "view.php?id=$cm->id", "$exercise->id", $cm->id); add_to_log($course->id, "exercise", "set up", "view.php?id=$cm->id", "$exercise->id", $cm->id);
redirect("view.php?id=$cm->id", get_string("movingtophase", "exercise", 1)); redirect("view.php?id=$cm->id", get_string("movingtophase", "exercise", 1));
} }
/****************** showsubmissions (for students, in phase 3)***********************/ /****************** showsubmissions (for students, in phase 3)***********************/
elseif ($action == 'showsubmissions') { elseif ($action == 'showsubmissions') {
exercise_print_assignment_info($exercise); exercise_print_assignment_info($exercise);
print_heading(get_string("submissionsnowclosed", "exercise")); print_heading(get_string("submissionsnowclosed", "exercise"));
// show student's assessment (linked to the teacher's exercise/submission // show student's assessment (linked to the teacher's exercise/submission
print_heading(get_string("yourassessment", "exercise")); print_heading(get_string("yourassessment", "exercise"));
exercise_list_teacher_submissions($exercise, $USER); exercise_list_teacher_submissions($exercise, $USER);
echo "<hr size=\"1\" noshade>"; echo "<hr size=\"1\" noshade>";
if ($submissions = exercise_get_user_submissions($exercise, $USER)) { if ($submissions = exercise_get_user_submissions($exercise, $USER)) {
print_heading(get_string("yoursubmission", "exercise")); print_heading(get_string("yoursubmission", "exercise"));
print_simple_box_start("center"); print_simple_box_start("center");
$table->head = array (get_string("submission", "exercise"), get_string("submitted", "exercise"), $table->head = array (get_string("submission", "exercise"), get_string("submitted", "exercise"),
get_string("assessed", "exercise"), get_string("grade")); get_string("assessed", "exercise"), get_string("grade"));
@ -233,73 +229,73 @@
print_heading(get_string("pleasesubmityourwork", "exercise").":"); print_heading(get_string("pleasesubmityourwork", "exercise").":");
exercise_print_upload_form($exercise); exercise_print_upload_form($exercise);
} }
echo "<hr size=\"1\" noshade>"; echo "<hr size=\"1\" noshade>";
} }
/****************** student's view could be in 1 of 3 stages ***********************/ /****************** student's view could be in 1 of 3 stages ***********************/
elseif ($action == 'studentsview') { elseif ($action == 'studentsview') {
exercise_print_assignment_info($exercise); exercise_print_assignment_info($exercise);
// in Stage 1 - the student must make an assessment (linked to the teacher's exercise/submission // in Stage 1 - the student must make an assessment (linked to the teacher's exercise/submission
if (!exercise_test_user_assessments($exercise, $USER)) { if (!exercise_test_user_assessments($exercise, $USER)) {
print_heading(get_string("pleaseviewtheexercise", "exercise", $course->teacher)); print_heading(get_string("pleaseviewtheexercise", "exercise", $course->teacher));
exercise_list_teacher_submissions($exercise, $USER); exercise_list_teacher_submissions($exercise, $USER);
} }
// in stage 2? - submit own first attempt // in stage 2? - submit own first attempt
else { else {
// show assessment the teacher's examples, there may be feedback from teacher // show assessment the teacher's examples, there may be feedback from teacher
if (exercise_count_user_submissions($exercise, $USER) == 0) { if (exercise_count_user_submissions($exercise, $USER) == 0) {
print_heading(get_string("atthisstageyou", "exercise", $course->teacher)); print_heading(get_string("atthisstageyou", "exercise", $course->teacher));
exercise_list_teacher_submissions($exercise, $USER, true); // true = allow re-assessing exercise_list_teacher_submissions($exercise, $USER, true); // true = allow re-assessing
// print upload form // print upload form
print_heading(get_string("pleasesubmityourwork", "exercise").":"); print_heading(get_string("pleasesubmityourwork", "exercise").":");
exercise_print_upload_form($exercise); exercise_print_upload_form($exercise);
} }
// in stage 3? - awaiting grading of assessment and assessment of work by teacher, // in stage 3? - awaiting grading of assessment and assessment of work by teacher,
// may resubmit if allowed // may resubmit if allowed
else { else {
exercise_list_teacher_submissions($exercise, $USER); exercise_list_teacher_submissions($exercise, $USER);
echo "<hr size=\"1\" noshade>"; echo "<hr size=\"1\" noshade>";
print_heading(get_string("yoursubmission", "exercise")); print_heading(get_string("yoursubmission", "exercise"));
exercise_list_user_submissions($exercise, $USER); exercise_list_user_submissions($exercise, $USER);
if (exercise_test_for_resubmission($exercise, $USER)) { if (exercise_test_for_resubmission($exercise, $USER)) {
// if resubmission requested print upload form // if resubmission requested print upload form
echo "<hr size=\"1\" noshade>"; echo "<hr size=\"1\" noshade>";
print_heading(get_string("pleasesubmityourwork", "exercise").":"); print_heading(get_string("pleasesubmityourwork", "exercise").":");
exercise_print_upload_form($exercise); exercise_print_upload_form($exercise);
echo "<hr size=\"1\" noshade>"; echo "<hr size=\"1\" noshade>";
} }
} }
} }
} }
/****************** submission of assignment by teacher only***********************/ /****************** submission of assignment by teacher only***********************/
elseif ($action == 'submitassignment') { elseif ($action == 'submitassignment') {
if (!isteacheredit($course->id)) { if (!isteacheredit($course->id)) {
error("Only teachers with editing permissions can do this."); error("Only teachers with editing permissions can do this.");
} }
exercise_print_assignment_info($exercise); exercise_print_assignment_info($exercise);
// list previous submissions from this user // list previous submissions from this user
exercise_list_user_submissions($exercise, $USER); exercise_list_user_submissions($exercise, $USER);
echo "<HR SIZE=1 NOSHADE>"; echo "<HR SIZE=1 NOSHADE>";
// print upload form // print upload form
print_heading(get_string("submitexercisedescription", "exercise").":"); print_heading(get_string("submitexercisedescription", "exercise").":");
exercise_print_upload_form($exercise); exercise_print_upload_form($exercise);
} }
/****************** teacher's view - display admin page (current phase options) ************/ /****************** teacher's view - display admin page (current phase options) ************/
elseif ($action == 'teachersview') { elseif ($action == 'teachersview') {
if (!isteacher($course->id)) { if (!isteacher($course->id)) {
error("Only teachers can look at this page"); error("Only teachers can look at this page");
} }
/// Check to see if groups are being used in this exercise /// Check to see if groups are being used in this exercise
/// and if so, set $currentgroup to reflect the current group /// and if so, set $currentgroup to reflect the current group
@ -316,24 +312,24 @@
print_heading_with_help(get_string("managingassignment", "exercise"), "managing", "exercise"); print_heading_with_help(get_string("managingassignment", "exercise"), "managing", "exercise");
exercise_print_assignment_info($exercise); exercise_print_assignment_info($exercise);
$tabs->names = array("1. ".get_string("phase1", "exercise"), $tabs->names = array("1. ".get_string("phase1", "exercise"),
"2. ".get_string("phase2", "exercise", $course->student), "2. ".get_string("phase2", "exercise", $course->student),
"3. ".get_string("phase3", "exercise", $course->student)); "3. ".get_string("phase3", "exercise", $course->student));
$tabs->urls = array("view.php?id=$cm->id&action=setupassignment", $tabs->urls = array("view.php?id=$cm->id&action=setupassignment",
"view.php?id=$cm->id&action=openexercise", "view.php?id=$cm->id&action=openexercise",
"view.php?id=$cm->id&action=makeleaguetableavailable"); "view.php?id=$cm->id&action=makeleaguetableavailable");
if ($exercise->phase) { // phase 1 or more if ($exercise->phase) { // phase 1 or more
$tabs->highlight = $exercise->phase - 1; $tabs->highlight = $exercise->phase - 1;
} else { } else {
$tabs->highlight = 0; // phase is zero $tabs->highlight = 0; // phase is zero
} }
exercise_print_tabbed_heading($tabs); exercise_print_tabbed_heading($tabs);
echo "<center>\n"; echo "<center>\n";
switch ($exercise->phase) { switch ($exercise->phase) {
case 0: case 0:
case 1: // set up assignment case 1: // set up assignment
if (isteacheredit($course->id)) { if (isteacheredit($course->id)) {
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=editelements\">". echo "<p><b><a href=\"assessments.php?id=$cm->id&action=editelements\">".
get_string("amendassessmentelements", "exercise")."</a></b> \n"; get_string("amendassessmentelements", "exercise")."</a></b> \n";
@ -342,37 +338,37 @@
get_string("submitexercisedescription", "exercise")."</a></b> \n"; get_string("submitexercisedescription", "exercise")."</a></b> \n";
helpbutton("submissionofdescriptions", get_string("submitexercisedescription", "exercise"), "exercise"); helpbutton("submissionofdescriptions", get_string("submitexercisedescription", "exercise"), "exercise");
} }
break; break;
case 2: // submissions and assessments case 2: // submissions and assessments
// just show student submissions link, the (self) assessments are show above the assessment form for // just show student submissions link, the (self) assessments are show above the assessment form for
// the submissions // the submissions
echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">". echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">".
get_string("studentsubmissionsforassessment", "exercise", get_string("studentsubmissionsforassessment", "exercise",
exercise_count_unassessed_student_submissions($exercise))."</a></b> \n"; exercise_count_unassessed_student_submissions($exercise))."</a></b> \n";
helpbutton("grading", get_string("studentsubmissionsforassessment", "exercise"), helpbutton("grading", get_string("studentsubmissionsforassessment", "exercise"),
"exercise"); "exercise");
break; break;
case 3: // show final grades case 3: // show final grades
echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">". echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">".
get_string("studentsubmissionsforassessment", "exercise", get_string("studentsubmissionsforassessment", "exercise",
exercise_count_unassessed_student_submissions($exercise))."</a></b> \n"; exercise_count_unassessed_student_submissions($exercise))."</a></b> \n";
helpbutton("grading", get_string("studentsubmissionsforassessment", "exercise"), helpbutton("grading", get_string("studentsubmissionsforassessment", "exercise"),
"exercise"); "exercise");
print_heading("<A HREF=\"submissions.php?id=$cm->id&action=displayfinalgrades\">". print_heading("<A HREF=\"submissions.php?id=$cm->id&action=displayfinalgrades\">".
get_string("displayoffinalgrades", "exercise")."</A>"); get_string("displayoffinalgrades", "exercise")."</A>");
} }
print_heading("<A HREF=\"submissions.php?id=$cm->id&action=adminlist\">". print_heading("<A HREF=\"submissions.php?id=$cm->id&action=adminlist\">".
get_string("administration")."</A>"); get_string("administration")."</A>");
} }
/*************** no man's land **************************************/ /*************** no man's land **************************************/
else { else {
error("Fatal Error: Unknown Action: ".$action."\n"); error("Fatal Error: Unknown Action: ".$action."\n");
} }
print_footer($course); print_footer($course);
?> ?>

View file

@ -43,16 +43,10 @@
$strsubscribers = get_string("subscribers", "forum"); $strsubscribers = get_string("subscribers", "forum");
$strforums = get_string("forums", "forum"); $strforums = get_string("forums", "forum");
if ($course->category) { $navigation = "<a href=\"index.php?id=$course->id\">$strforums</a> ->
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
<a href=\"index.php?id=$course->id\">$strforums</a> ->
<a href=\"view.php?f=$forum->id\">$forum->name</a> -> $strsubscribers"; <a href=\"view.php?f=$forum->id\">$forum->name</a> -> $strsubscribers";
} else {
$navigation = "<a href=\"index.php?id=$course->id\">$strforums</a> ->
<a href=\"view.php?f=$forum->id\">$forum->name</a> -> $strsubscribers";
}
print_header("$course->shortname: $strsubscribers", "$course->fullname", "$navigation", print_header_simple("$strsubscribers", "", "$navigation",
"", "", true, forum_update_subscriptions_button($course->id, $id)); "", "", true, forum_update_subscriptions_button($course->id, $id));
/// Check to see if groups are being used in this forum /// Check to see if groups are being used in this forum

View file

@ -60,11 +60,8 @@
if ($course->category) { if ($course->category) {
require_login($course->id); require_login($course->id);
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
<a href=\"index.php?id=$course->id\">$strforums</a> ->";
} else {
$navigation = "<a href=\"index.php?id=$course->id\">$strforums</a> ->";
} }
$navigation = "<a href=\"index.php?id=$course->id\">$strforums</a> ->";
if ($forum->type == "teacher") { if ($forum->type == "teacher") {
if (!isteacher($course->id)) { if (!isteacher($course->id)) {
@ -78,7 +75,7 @@
add_to_log($course->id, "forum", "view forum", "view.php?f=$forum->id", "$forum->id"); add_to_log($course->id, "forum", "view forum", "view.php?f=$forum->id", "$forum->id");
} }
print_header("$course->shortname: $forum->name", "$course->fullname", print_header_simple("$forum->name", "",
"$navigation $forum->name", "", "", true, $buttontext, navmenu($course, $cm)); "$navigation $forum->name", "", "", true, $buttontext, navmenu($course, $cm));
if (!$cm->visible and !isteacher($course->id)) { if (!$cm->visible and !isteacher($course->id)) {

View file

@ -46,11 +46,6 @@
} }
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id",$cm->id); add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id",$cm->id);
/// Printing the page header
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
switch ( $action ){ switch ( $action ){
case "add": case "add":
$straction = get_string("addingcomment","glossary"); $straction = get_string("addingcomment","glossary");
@ -66,8 +61,8 @@
$strglossary = get_string("modulename", "glossary"); $strglossary = get_string("modulename", "glossary");
$strcomments = get_string("comments", "glossary"); $strcomments = get_string("comments", "glossary");
print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname", print_header_simple(strip_tags("$glossary->name"), "",
"$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> <A HREF=view.php?id=$cm->id>$glossary->name</a> -> <A HREF=comments.php?id=$cm->id&eid=$entry->id>$strcomments</a> -> " . $straction, "<A HREF=index.php?id=$course->id>$strglossaries</A> -> <A HREF=view.php?id=$cm->id>$glossary->name</a> -> <A HREF=comments.php?id=$cm->id&eid=$entry->id>$strcomments</a> -> " . $straction,
"", "", true, update_module_button($cm->id, $course->id, $strglossary), "", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm)); navmenu($course, $cm));
@ -89,7 +84,7 @@
} else { } else {
glossary_print_comment($course, $cm, $glossary, $entry, $comment); glossary_print_comment($course, $cm, $glossary, $entry, $comment);
print_simple_box_start("center","40%", "#FFBBBB"); print_simple_box_start("center","40%", "#FFBBBB");
echo "<center><br>" . get_string("areyousuredeletecomment","glossary"); echo "<center><br>" . get_string("areyousuredeletecomment","glossary");

View file

@ -7,7 +7,7 @@
require_variable($id); // Course Module ID require_variable($id); // Course Module ID
require_variable($eid); // Entry ID require_variable($eid); // Entry ID
global $THEME, $USER, $CFG; global $THEME, $USER, $CFG;
if (! $cm = get_record("course_modules", "id", $id)) { if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect"); error("Course Module ID was incorrect");
@ -33,12 +33,6 @@
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id",$cm->id); add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id",$cm->id);
/// Printing the page header
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
$strglossaries = get_string("modulenameplural", "glossary"); $strglossaries = get_string("modulenameplural", "glossary");
$strglossary = get_string("modulename", "glossary"); $strglossary = get_string("modulename", "glossary");
$strallcategories = get_string("allcategories", "glossary"); $strallcategories = get_string("allcategories", "glossary");
@ -50,8 +44,8 @@
$strcomments = get_string("comments", "glossary"); $strcomments = get_string("comments", "glossary");
$straddcomment = get_string("addcomment", "glossary"); $straddcomment = get_string("addcomment", "glossary");
print_header(strip_tags("$course->shortname: $strcomments: $entry->concept"), "$course->fullname", print_header_simple(strip_tags("$strcomments: $entry->concept"), "",
"$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> <A HREF=view.php?id=$cm->id>$glossary->name</a> -> $strcomments", "<A HREF=index.php?id=$course->id>$strglossaries</A> -> <A HREF=view.php?id=$cm->id>$glossary->name</a> -> $strcomments",
"", "", true, update_module_button($cm->id, $course->id, $strglossary), "", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm)); navmenu($course, $cm));
@ -71,7 +65,7 @@
if ($comments = get_records("glossary_comments","entryid",$entry->id,"timemodified ASC")) { if ($comments = get_records("glossary_comments","entryid",$entry->id,"timemodified ASC")) {
foreach ($comments as $comment) { foreach ($comments as $comment) {
glossary_print_comment($course, $cm, $glossary, $entry, $comment); glossary_print_comment($course, $cm, $glossary, $entry, $comment);
echo '<br />'; echo '<br />';
} }
} else { } else {

View file

@ -40,18 +40,14 @@
$entryfields = get_record("glossary_entries", "id", $entry); $entryfields = get_record("glossary_entries", "id", $entry);
$strareyousuredelete = get_string("areyousuredelete","glossary"); $strareyousuredelete = get_string("areyousuredelete","glossary");
print_header_simple("$glossary->name", "",
if ($course->category) { "<A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
print_header("$course->shortname: $glossary->name", "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
"", "", true, update_module_button($cm->id, $course->id, $strglossary), "", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm)); navmenu($course, $cm));
/// If data submitted, then process and store. /// If data submitted, then process and store.
if ($confirm) { // the operation was confirmed. if ($confirm) { // the operation was confirmed.
// if it is an imported entry, just delete the relation // if it is an imported entry, just delete the relation
$entry = get_record("glossary_entries","id", $entry); $entry = get_record("glossary_entries","id", $entry);
@ -59,7 +55,7 @@
$entry->glossaryid = $entry->sourceglossaryid; $entry->glossaryid = $entry->sourceglossaryid;
$entry->sourceglossaryid = 0; $entry->sourceglossaryid = 0;
if (! update_record("glossary_entries", $entry)) { if (! update_record("glossary_entries", $entry)) {
error("Could not update your glossary"); error("Could not update your glossary");
} }
} else { } else {

View file

@ -36,15 +36,11 @@
// add_to_log($course->id, "glossary", "edit categories", "view.php?id=$cm->id", "$glossary->id", $cm->id); // add_to_log($course->id, "glossary", "edit categories", "view.php?id=$cm->id", "$glossary->id", $cm->id);
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strglossaries = get_string("modulenameplural", "glossary"); $strglossaries = get_string("modulenameplural", "glossary");
$strglossary = get_string("modulename", "glossary"); $strglossary = get_string("modulename", "glossary");
print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname", print_header_simple(strip_tags("$glossary->name"), "",
"$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> <A HREF=view.php?id=$cm->id&tab=GLOSSARY_CATEGORY_VIEW>$glossary->name</a> -> " . get_string("categories","glossary"), "<A HREF=index.php?id=$course->id>$strglossaries</A> -> <A HREF=view.php?id=$cm->id&tab=GLOSSARY_CATEGORY_VIEW>$glossary->name</a> -> " . get_string("categories","glossary"),
"", "", true, update_module_button($cm->id, $course->id, $strglossary), "", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm)); navmenu($course, $cm));
@ -59,8 +55,8 @@
$cat->usedynalink = $usedynalink; $cat->usedynalink = $usedynalink;
if ( !update_record("glossary_categories", $cat) ) { if ( !update_record("glossary_categories", $cat) ) {
error("Weird error. The category was not updated."); error("Weird error. The category was not updated.");
redirect("editcategories.php?id=$cm->id"); redirect("editcategories.php?id=$cm->id");
} else { } else {
add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $hook,$cm->id); add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $hook,$cm->id);
} }
@ -76,26 +72,26 @@
} elseif ( $action == "delete" ) { } elseif ( $action == "delete" ) {
if ( $confirm ) { if ( $confirm ) {
delete_records("glossary_entries_categories","categoryid", $hook); delete_records("glossary_entries_categories","categoryid", $hook);
delete_records("glossary_categories","id", $hook); delete_records("glossary_categories","id", $hook);
print_simple_box_start("center","40%", "#FFBBBB"); print_simple_box_start("center","40%", "#FFBBBB");
echo "<center>" . get_string("categorydeleted","glossary") ."</center>"; echo "<center>" . get_string("categorydeleted","glossary") ."</center>";
echo "</center>"; echo "</center>";
print_simple_box_end(); print_simple_box_end();
print_footer($course); print_footer($course);
add_to_log($course->id, "glossary", "delete category", "editcategories.php?id=$cm->id", $hook,$cm->id); add_to_log($course->id, "glossary", "delete category", "editcategories.php?id=$cm->id", $hook,$cm->id);
redirect("editcategories.php?id=$cm->id"); redirect("editcategories.php?id=$cm->id");
} else { } else {
echo "<p align=\"center\">" . get_string("delete"). " " . get_string("category","glossary") . "<font size=\"3\">"; echo "<p align=\"center\">" . get_string("delete"). " " . get_string("category","glossary") . "<font size=\"3\">";
print_simple_box_start("center","40%", "#FFBBBB"); print_simple_box_start("center","40%", "#FFBBBB");
echo "<center><b>$category->name</b><br>"; echo "<center><b>$category->name</b><br>";
$num_entries = count_records("glossary_entries_categories","categoryid",$category->id); $num_entries = count_records("glossary_entries_categories","categoryid",$category->id);
if ( $num_entries ) { if ( $num_entries ) {
print_string("deletingnoneemptycategory","glossary"); print_string("deletingnoneemptycategory","glossary");
} }
@ -105,7 +101,7 @@
?> ?>
<form name="form" method="post" action="editcategories.php"> <form name="form" method="post" action="editcategories.php">
<input type="hidden" name=id value="<?php p($cm->id) ?>"> <input type="hidden" name=id value="<?php p($cm->id) ?>">
<input type="hidden" name=action value="delete"> <input type="hidden" name=action value="delete">
<input type="hidden" name=confirm value="1"> <input type="hidden" name=confirm value="1">
<input type="hidden" name=mode value="<?php echo $mode ?>"> <input type="hidden" name=mode value="<?php echo $mode ?>">
@ -119,8 +115,8 @@
$options = array ("id" => $id); $options = array ("id" => $id);
print_single_button("editcategories.php", $options, get_string("no") ); print_single_button("editcategories.php", $options, get_string("no") );
echo "</td></tr></table>"; echo "</td></tr></table>";
echo "</center>"; echo "</center>";
print_simple_box_end(); print_simple_box_end();
} }
} }
} elseif ( $action == "add" ) { } elseif ( $action == "add" ) {
@ -129,14 +125,14 @@
if ( $dupcategory ) { if ( $dupcategory ) {
echo "<p align=\"center\">" . get_string("add"). " " . get_string("category","glossary") . "<font size=\"3\">"; echo "<p align=\"center\">" . get_string("add"). " " . get_string("category","glossary") . "<font size=\"3\">";
print_simple_box_start("center","40%", "#FFBBBB"); print_simple_box_start("center","40%", "#FFBBBB");
echo "<center>" . get_string("duplicatedcategory","glossary") ."</center>"; echo "<center>" . get_string("duplicatedcategory","glossary") ."</center>";
echo "</center>"; echo "</center>";
print_simple_box_end(); print_simple_box_end();
print_footer($course); print_footer($course);
redirect("editcategories.php?id=$cm->id&action=add&&name=$name"); redirect("editcategories.php?id=$cm->id&action=add&&name=$name");
} else { } else {
$action = ""; $action = "";
@ -145,9 +141,9 @@
$cat->glossaryid = $glossary->id; $cat->glossaryid = $glossary->id;
if ( ! $cat->id = insert_record("glossary_categories", $cat) ) { if ( ! $cat->id = insert_record("glossary_categories", $cat) ) {
error("Weird error. The category was not inserted."); error("Weird error. The category was not inserted.");
redirect("editcategories.php?id=$cm->id"); redirect("editcategories.php?id=$cm->id");
} else { } else {
add_to_log($course->id, "glossary", "add category", "editcategories.php?id=$cm->id", $cat->id,$cm->id); add_to_log($course->id, "glossary", "add category", "editcategories.php?id=$cm->id", $cat->id,$cm->id);
} }
@ -195,8 +191,8 @@
</td> </td>
<td width="10%" align="center"><b> <td width="10%" align="center"><b>
<?php <?php
echo "<a href=\"editcategories.php?id=$cm->id&action=delete&mode=cat&hook=$category->id\"><img alt=\"" . get_string("delete") . "\"src=\"../../pix/t/delete.gif\" height=11 width=11 border=0></a> "; echo "<a href=\"editcategories.php?id=$cm->id&action=delete&mode=cat&hook=$category->id\"><img alt=\"" . get_string("delete") . "\"src=\"../../pix/t/delete.gif\" height=11 width=11 border=0></a> ";
echo "<a href=\"editcategories.php?id=$cm->id&action=edit&mode=cat&hook=$category->id\"><img alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>"; echo "<a href=\"editcategories.php?id=$cm->id&action=edit&mode=cat&hook=$category->id\"><img alt=\"" . get_string("edit") . "\" src=\"../../pix/t/edit.gif\" height=11 width=11 border=0></a>";
?> ?>
</b></td> </b></td>
</tr> </tr>

View file

@ -1,31 +1,31 @@
<?PHP // $Id$ <?PHP // $Id$
require_once("../../config.php"); require_once("../../config.php");
require_once("lib.php"); require_once("lib.php");
require_variable($id); // course module ID require_variable($id); // course module ID
require_variable($entry); // Entry ID require_variable($entry); // Entry ID
optional_variable($confirm); // confirmation optional_variable($confirm); // confirmation
optional_variable($mode); optional_variable($mode);
optional_variable($hook); optional_variable($hook);
global $THEME, $USER, $CFG; global $THEME, $USER, $CFG;
$PermissionGranted = 1; $PermissionGranted = 1;
$cm = get_record("course_modules","id",$id); $cm = get_record("course_modules","id",$id);
if ( ! $cm ) { if ( ! $cm ) {
$PermissionGranted = 0; $PermissionGranted = 0;
} else { } else {
$mainglossary = get_record("glossary","course",$cm->course, "mainglossary",1); $mainglossary = get_record("glossary","course",$cm->course, "mainglossary",1);
if ( ! $mainglossary ) { if ( ! $mainglossary ) {
$PermissionGranted = 0; $PermissionGranted = 0;
} }
} }
if ( !isteacher($cm->course) ) { if ( !isteacher($cm->course) ) {
$PermissionGranted = 0; $PermissionGranted = 0;
error("You must be a teacher to use this page."); error("You must be a teacher to use this page.");
} }
if (! $course = get_record("course", "id", $cm->course)) { if (! $course = get_record("course", "id", $cm->course)) {
error("Course is misconfigured"); error("Course is misconfigured");
@ -39,69 +39,65 @@
$entryalreadyexist = get_string("entryalreadyexist","glossary"); $entryalreadyexist = get_string("entryalreadyexist","glossary");
$entryexported = get_string("entryexported","glossary"); $entryexported = get_string("entryexported","glossary");
if ($course->category) { print_header_simple("$glossary->name", "",
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->"; "<A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
}
print_header("$course->shortname: $glossary->name", "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
"", "", true, "", "", "", true, "",
navmenu($course, $cm)); navmenu($course, $cm));
if ( $PermissionGranted ) { if ( $PermissionGranted ) {
$entry = get_record("glossary_entries", "id", $entry); $entry = get_record("glossary_entries", "id", $entry);
if ( !$confirm ) { if ( !$confirm ) {
echo "<center>"; echo "<center>";
$areyousure = get_string("areyousureexport","glossary"); $areyousure = get_string("areyousureexport","glossary");
notice_yesno ("<center><h2>$entry->concept</h2><p align=center>$areyousure<br><b>$mainglossary->name</b>?", notice_yesno ("<center><h2>$entry->concept</h2><p align=center>$areyousure<br><b>$mainglossary->name</b>?",
"exportentry.php?id=$id&mode=$mode&hook=$hook&entry=$entry->id&confirm=1", "exportentry.php?id=$id&mode=$mode&hook=$hook&entry=$entry->id&confirm=1",
"view.php?id=$cm->id&mode=$mode&hook=$hook" ); "view.php?id=$cm->id&mode=$mode&hook=$hook" );
} else { } else {
if ( ! $mainglossary->allowduplicatedentries ) { if ( ! $mainglossary->allowduplicatedentries ) {
$dupentry = get_record("glossary_entries","glossaryid", $mainglossary->id, "UCASE(concept)",strtoupper($entry->concept)); $dupentry = get_record("glossary_entries","glossaryid", $mainglossary->id, "UCASE(concept)",strtoupper($entry->concept));
if ( $dupentry ) { if ( $dupentry ) {
$PermissionGranted = 0; $PermissionGranted = 0;
} }
} }
if ( $PermissionGranted ) { if ( $PermissionGranted ) {
$entry->glossaryid = $mainglossary->id; $entry->glossaryid = $mainglossary->id;
$entry->sourceglossaryid = $glossary->id; $entry->sourceglossaryid = $glossary->id;
if (! update_record("glossary_entries", $entry)) { if (! update_record("glossary_entries", $entry)) {
error("Could not export the entry to the main glossary"); error("Could not export the entry to the main glossary");
} else { } else {
print_simple_box_start("center", "60%", "$THEME->cellheading"); print_simple_box_start("center", "60%", "$THEME->cellheading");
echo "<p align=center><font size=3>$entryexported</font></p></font>"; echo "<p align=center><font size=3>$entryexported</font></p></font>";
print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id); print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
print_simple_box_end(); print_simple_box_end();
print_footer(); print_footer();
redirect("view.php?id=$cm->id&mode=entry&hook=".$entry->id); redirect("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
die; die;
} }
} else { } else {
print_simple_box_start("center", "60%", "#FFBBBB"); print_simple_box_start("center", "60%", "#FFBBBB");
echo "<p align=center><font size=3>$entryalreadyexist</font></p></font>"; echo "<p align=center><font size=3>$entryalreadyexist</font></p></font>";
echo "<p align=center>"; echo "<p align=center>";
print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id); print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
print_simple_box_end(); print_simple_box_end();
} }
} }
} else { } else {
print_simple_box_start("center", "60%", "#FFBBBB"); print_simple_box_start("center", "60%", "#FFBBBB");
notice("A weird error was found while trying to export this entry. Operation cancelled."); notice("A weird error was found while trying to export this entry. Operation cancelled.");
print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id); print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
print_simple_box_end(); print_simple_box_end();
} }
print_footer(); print_footer();
?> ?>

View file

@ -32,10 +32,6 @@
error("You must be a teacher to use this page."); error("You must be a teacher to use this page.");
} }
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
if ($dest != 'new' and $dest != 'current') { if ($dest != 'new' and $dest != 'current') {
$dest = 'current'; $dest = 'current';
} }
@ -48,8 +44,8 @@
$strsearchindefinition = get_string("searchindefinition", "glossary"); $strsearchindefinition = get_string("searchindefinition", "glossary");
$strsearch = get_string("search"); $strsearch = get_string("search");
print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname", print_header_simple(strip_tags("$glossary->name"), "",
"$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name", "<A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
"", "", true, update_module_button($cm->id, $course->id, $strglossary), "", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm)); navmenu($course, $cm));

View file

@ -27,11 +27,7 @@
/// Print the header /// Print the header
if ($course->category) { print_header_simple("$strglossarys", "", "$strglossarys", "", "", true, "", navmenu($course));
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
print_header("$course->shortname: $strglossarys", "$course->fullname", "$navigation $strglossarys", "", "", true, "", navmenu($course));
/// Get all the appropriate data /// Get all the appropriate data

View file

@ -12,16 +12,12 @@
require_login($course->id); require_login($course->id);
add_to_log($course->id, "journal", "view all", "index.php?id=$course->id", ""); add_to_log($course->id, "journal", "view all", "index.php?id=$course->id", "");
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
$strjournal = get_string("modulename", "journal"); $strjournal = get_string("modulename", "journal");
$strjournals = get_string("modulenameplural", "journal"); $strjournals = get_string("modulenameplural", "journal");
$strweek = get_string("week"); $strweek = get_string("week");
$strtopic = get_string("topic"); $strtopic = get_string("topic");
print_header("$course->shortname: $strjournals", "$course->fullname", "$navigation $strjournals", print_header_simple("$strjournals", "", "$strjournals",
"", "", true, "", navmenu($course)); "", "", true, "", navmenu($course));

View file

@ -25,15 +25,11 @@
error("Course module is incorrect"); error("Course module is incorrect");
} }
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strjournal = get_string("modulename", "journal"); $strjournal = get_string("modulename", "journal");
$strjournals = get_string("modulenameplural", "journal"); $strjournals = get_string("modulenameplural", "journal");
print_header("$course->shortname: $journal->name", "$course->fullname", print_header_simple("$journal->name", "",
"$navigation <A HREF=index.php?id=$course->id>$strjournals</A> -> $journal->name", "", "", true, "<A HREF=index.php?id=$course->id>$strjournals</A> -> $journal->name", "", "", true,
update_module_button($cm->id, $course->id, $strjournal), navmenu($course, $cm)); update_module_button($cm->id, $course->id, $strjournal), navmenu($course, $cm));
if (isteacher($course->id)) { if (isteacher($course->id)) {

View file

@ -24,11 +24,7 @@
/// Print the header /// Print the header
if ($course->category) { print_header_simple("$strlessons", "", "$strlessons", "", "", true, "", navmenu($course));
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
print_header("$course->shortname: $strlessons", "$course->fullname", "$navigation $strlessons", "", "", true, "", navmenu($course));
/// Get all the appropriate data /// Get all the appropriate data

View file

@ -26,15 +26,11 @@
/// Print the page header /// Print the page header
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
$strlessons = get_string("modulenameplural", "lesson"); $strlessons = get_string("modulenameplural", "lesson");
$strlesson = get_string("modulename", "lesson"); $strlesson = get_string("modulename", "lesson");
print_header("$course->shortname: $lesson->name", "$course->fullname", print_header_simple("$lesson->name", "",
"$navigation <A HREF=index.php?id=$course->id>$strlessons</A> -> <a href=\"view.php?id=$cm->id\">$lesson->name</a>", "<A HREF=index.php?id=$course->id>$strlessons</A> -> <a href=\"view.php?id=$cm->id\">$lesson->name</a>",
"", "", true, update_module_button($cm->id, $course->id, $strlesson), "", "", true, update_module_button($cm->id, $course->id, $strlesson),
navmenu($course, $cm)); navmenu($course, $cm));

View file

@ -54,15 +54,11 @@
// Print the page header // Print the page header
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strquizzes = get_string("modulenameplural", "quiz"); $strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz"); $strquiz = get_string("modulename", "quiz");
print_header("$course->shortname: $quiz->name", "$course->fullname", print_header_simple("$quiz->name", "",
"$navigation <A HREF=index.php?id=$course->id>$strquizzes</A> -> "<A HREF=index.php?id=$course->id>$strquizzes</A> ->
<A HREF=\"view.php?id=$cm->id\">$quiz->name</A> -> $strattemptnum", <A HREF=\"view.php?id=$cm->id\">$quiz->name</A> -> $strattemptnum",
"", "", true); "", "", true);

View file

@ -30,11 +30,7 @@
: ""; : "";
$strquiz = get_string("modulename", "quiz"); $strquiz = get_string("modulename", "quiz");
if ($course->category) { print_header_simple("$strquizzes", "", "$strquizzes",
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
print_header("$course->shortname: $strquizzes", "$course->fullname", "$navigation $strquizzes",
"", "", true, $streditquestions, navmenu($course)); "", "", true, $streditquestions, navmenu($course));
// Get all the appropriate data // Get all the appropriate data

View file

@ -46,16 +46,12 @@
/// Print the page header /// Print the page header
if (empty($noheader)) { if (empty($noheader)) {
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
$strquizzes = get_string("modulenameplural", "quiz"); $strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz"); $strquiz = get_string("modulename", "quiz");
$strreport = get_string("report", "quiz"); $strreport = get_string("report", "quiz");
print_header("$course->shortname: $quiz->name", "$course->fullname", print_header_simple("$quiz->name", "",
"$navigation <A HREF=index.php?id=$course->id>$strquizzes</A> "<A HREF=index.php?id=$course->id>$strquizzes</A>
-> <a href=\"view.php?id=$cm->id\">$quiz->name</a> -> $strreport", -> <a href=\"view.php?id=$cm->id\">$quiz->name</a> -> $strreport",
"", "", true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm)); "", "", true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));

View file

@ -59,10 +59,6 @@
// Print the page header // Print the page header
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strquizzes = get_string("modulenameplural", "quiz"); $strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz"); $strquiz = get_string("modulename", "quiz");
$strreport = get_string("report", "quiz"); $strreport = get_string("report", "quiz");
@ -76,8 +72,8 @@
$strtimecompleted = get_string("timecompleted", "quiz"); $strtimecompleted = get_string("timecompleted", "quiz");
$stroverdue = get_string("overdue", "quiz"); $stroverdue = get_string("overdue", "quiz");
print_header("$course->shortname: $quiz->name", "$course->fullname", print_header_simple("$quiz->name", "",
"$navigation <A HREF=index.php?id=$course->id>$strquizzes</A> "<A HREF=index.php?id=$course->id>$strquizzes</A>
-> <a href=\"view.php?id=$cm->id\">$quiz->name</a> -> $strreview", -> <a href=\"view.php?id=$cm->id\">$quiz->name</a> -> $strreview",
"", "", true); "", "", true);

View file

@ -42,15 +42,11 @@
// Print the page header // Print the page header
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
$strquizzes = get_string("modulenameplural", "quiz"); $strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz"); $strquiz = get_string("modulename", "quiz");
print_header("$course->shortname: $quiz->name", "$course->fullname", print_header_simple("$quiz->name", "",
"$navigation <A HREF=index.php?id=$course->id>$strquizzes</A> -> $quiz->name", "<A HREF=index.php?id=$course->id>$strquizzes</A> -> $quiz->name",
"", "", true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm)); "", "", true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));
if (isteacher($course->id)) { if (isteacher($course->id)) {

View file

@ -13,10 +13,6 @@
add_to_log($course->id, "survey", "view all", "index.php?id=$course->id", ""); add_to_log($course->id, "survey", "view all", "index.php?id=$course->id", "");
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strsurveys = get_string("modulenameplural", "survey"); $strsurveys = get_string("modulenameplural", "survey");
$strweek = get_string("week"); $strweek = get_string("week");
$strtopic = get_string("topic"); $strtopic = get_string("topic");
@ -25,7 +21,7 @@
$strdone = get_string("done", "survey"); $strdone = get_string("done", "survey");
$strnotdone = get_string("notdone", "survey"); $strnotdone = get_string("notdone", "survey");
print_header("$course->shortname: $strsurveys", "$course->fullname", "$navigation $strsurveys", print_header_simple("$strsurveys", "", "$strsurveys",
"", "", true, "", navmenu($course)); "", "", true, "", navmenu($course));
if (! $surveys = get_all_instances_in_course("survey", $course)) { if (! $surveys = get_all_instances_in_course("survey", $course)) {

View file

@ -25,15 +25,11 @@
$showscales = ($template->name != 'ciqname'); $showscales = ($template->name != 'ciqname');
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strsurveys = get_string("modulenameplural", "survey"); $strsurveys = get_string("modulenameplural", "survey");
$strsurvey = get_string("modulename", "survey"); $strsurvey = get_string("modulename", "survey");
print_header("$course->shortname: $survey->name", "$course->fullname", print_header_simple("$survey->name", "",
"$navigation <A HREF=index.php?id=$course->id>$strsurveys</A> -> $survey->name", "", "", true, "<A HREF=index.php?id=$course->id>$strsurveys</A> -> $survey->name", "", "", true,
update_module_button($cm->id, $course->id, $strsurvey), navmenu($course, $cm)); update_module_button($cm->id, $course->id, $strsurvey), navmenu($course, $cm));
/// Check to see if groups are being used in this survey /// Check to see if groups are being used in this survey

View file

@ -91,12 +91,6 @@
# The mighty Wiki itself # The mighty Wiki itself
include_once($CFG->dirroot."/mod/wiki/ewiki/ewiki.php"); include_once($CFG->dirroot."/mod/wiki/ewiki/ewiki.php");
/// Print the page header
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strwikis = get_string("modulenameplural", "wiki"); $strwikis = get_string("modulenameplural", "wiki");
$strwiki = get_string("modulename", "wiki"); $strwiki = get_string("modulename", "wiki");
@ -121,8 +115,8 @@
} }
} }
print_header("$course->shortname: $wiki_entry->pagename", "$course->fullname", print_header_simple("$wiki_entry->pagename", "",
"$navigation <A HREF=\"index.php?id=$course->id\">$strwikis</A> -> <A HREF=\"view.php?id=$id\">$wiki->name</a> ->". "<A HREF=\"index.php?id=$course->id\">$strwikis</A> -> <A HREF=\"view.php?id=$id\">$wiki->name</a> ->".
get_string("administration","wiki"), get_string("administration","wiki"),
$focus, "", true, update_module_button($cm->id, $course->id, $strwiki), $focus, "", true, update_module_button($cm->id, $course->id, $strwiki),
navmenu($course, $cm)); navmenu($course, $cm));

View file

@ -25,11 +25,7 @@
/// Print the header /// Print the header
if ($course->category) { print_header_simple("$strwikis", "", "$strwikis", "", "", true, "", navmenu($course));
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
print_header("$course->shortname: $strwikis", "$course->fullname", "$navigation $strwikis", "", "", true, "", navmenu($course));
/// Get all the appropriate data /// Get all the appropriate data

View file

@ -215,15 +215,12 @@
/// Print the page header /// Print the page header
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strwikis = get_string("modulenameplural", "wiki"); $strwikis = get_string("modulenameplural", "wiki");
$strwiki = get_string("modulename", "wiki"); $strwiki = get_string("modulename", "wiki");
print_header("$course->shortname: ".($ewiki_title?$ewiki_title:$wiki->name), "$course->fullname", print_header_simple(($ewiki_title?$ewiki_title:$wiki->name), "",
"$navigation <A HREF=\"index.php?id=$course->id\">$strwikis</A> -> <A HREF=\"view.php?id=$moodleID\">$wiki->name</a>".($ewiki_title?" -> $ewiki_title":""), "<A HREF=\"index.php?id=$course->id\">$strwikis</A> -> <A HREF=\"view.php?id=$moodleID\">$wiki->name</a>".($ewiki_title?" -> $ewiki_title":""),
"", "", true, update_module_button($cm->id, $course->id, $strwiki), "", "", true, update_module_button($cm->id, $course->id, $strwiki),
navmenu($course, $cm)); navmenu($course, $cm));

View file

@ -13,10 +13,6 @@
require_login($course->id); require_login($course->id);
add_to_log($course->id, "workshop", "view all", "index.php?id=$course->id", ""); add_to_log($course->id, "workshop", "view all", "index.php?id=$course->id", "");
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strworkshops = get_string("modulenameplural", "workshop"); $strworkshops = get_string("modulenameplural", "workshop");
$strworkshop = get_string("modulename", "workshop"); $strworkshop = get_string("modulename", "workshop");
$strweek = get_string("week"); $strweek = get_string("week");
@ -24,9 +20,9 @@
$strname = get_string("name"); $strname = get_string("name");
$strphase = get_string("phase", "workshop"); $strphase = get_string("phase", "workshop");
$strdeadline = get_string("deadline", "workshop"); $strdeadline = get_string("deadline", "workshop");
$strsubmitted = get_string("submitted", "assignment"); $strsubmitted = get_string("submitted", "assignment");
print_header("$course->shortname: $strworkshops", "$course->fullname", "$navigation $strworkshops", "", "", true, "", navmenu($course)); print_header_simple("$strworkshops", "", "$strworkshops", "", "", true, "", navmenu($course));
if (! $workshops = get_all_instances_in_course("workshop", $course)) { if (! $workshops = get_all_instances_in_course("workshop", $course)) {
notice("There are no workshops", "../../course/view.php?id=$course->id"); notice("There are no workshops", "../../course/view.php?id=$course->id");
@ -63,34 +59,34 @@
break; break;
} }
if ($submissions = workshop_get_user_submissions($workshop, $USER)) { if ($submissions = workshop_get_user_submissions($workshop, $USER)) {
foreach ($submissions as $submission) { foreach ($submissions as $submission) {
if ($submission->timecreated <= $workshop->deadline) { if ($submission->timecreated <= $workshop->deadline) {
$submitted = userdate($submission->timecreated); $submitted = userdate($submission->timecreated);
} }
else { else {
$submitted = "<FONT COLOR=red>".userdate($submission->timecreated)."</FONT>"; $submitted = "<FONT COLOR=red>".userdate($submission->timecreated)."</FONT>";
} }
$due = userdate($workshop->deadline); $due = userdate($workshop->deadline);
if (!$workshop->visible) { if (!$workshop->visible) {
//Show dimmed if the mod is hidden //Show dimmed if the mod is hidden
$link = "<A class=\"dimmed\" HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A><br />". $link = "<A class=\"dimmed\" HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A><br />".
"($submission->title)"; "($submission->title)";
} else { } else {
//Show normal if the mod is visible //Show normal if the mod is visible
$link = "<A HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A><br />". $link = "<A HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A><br />".
"($submission->title)"; "($submission->title)";
} }
if ($course->format == "weeks" or $course->format == "topics") { if ($course->format == "weeks" or $course->format == "topics") {
$table->data[] = array ($workshop->section, $link, $phase, $submitted, $due); $table->data[] = array ($workshop->section, $link, $phase, $submitted, $due);
} }
else { else {
$table->data[] = array ($link, $phase, $submitted, $due); $table->data[] = array ($link, $phase, $submitted, $due);
} }
} }
} }
else { else {
$submitted = get_string("no"); $submitted = get_string("no");
$due = userdate($workshop->deadline); $due = userdate($workshop->deadline);
if (!$workshop->visible) { if (!$workshop->visible) {
//Show dimmed if the mod is hidden //Show dimmed if the mod is hidden
$link = "<A class=\"dimmed\" HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A>"; $link = "<A class=\"dimmed\" HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A>";
@ -98,14 +94,14 @@
//Show normal if the mod is visible //Show normal if the mod is visible
$link = "<A HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A>"; $link = "<A HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A>";
} }
if ($course->format == "weeks" or $course->format == "topics") { if ($course->format == "weeks" or $course->format == "topics") {
$table->data[] = array ($workshop->section, $link, $phase, $submitted, $due); $table->data[] = array ($workshop->section, $link, $phase, $submitted, $due);
} }
else { else {
$table->data[] = array ($link, $phase, $submitted, $due); $table->data[] = array ($link, $phase, $submitted, $due);
} }
} }
} }
echo "<br />"; echo "<br />";
print_table($table); print_table($table);

View file

@ -55,17 +55,13 @@
require_login($course->id); require_login($course->id);
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strworkshops = get_string("modulenameplural", "workshop"); $strworkshops = get_string("modulenameplural", "workshop");
$strworkshop = get_string("modulename", "workshop"); $strworkshop = get_string("modulename", "workshop");
$strsubmissions = get_string("submissions", "workshop"); $strsubmissions = get_string("submissions", "workshop");
// ... print the header and... // ... print the header and...
print_header("$course->shortname: $workshop->name", "$course->fullname", print_header_simple("$workshop->name", "",
"$navigation <A HREF=index.php?id=$course->id>$strworkshops</A> -> "<A HREF=index.php?id=$course->id>$strworkshops</A> ->
<A HREF=\"view.php?a=$workshop->id\">$workshop->name</A> -> $strsubmissions", <A HREF=\"view.php?a=$workshop->id\">$workshop->name</A> -> $strsubmissions",
"", "", true); "", "", true);

View file

@ -22,15 +22,12 @@
require_login($course->id); require_login($course->id);
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strworkshops = get_string("modulenameplural", "workshop"); $strworkshops = get_string("modulenameplural", "workshop");
$strworkshop = get_string("modulename", "workshop"); $strworkshop = get_string("modulename", "workshop");
$strupload = get_string("upload"); $strupload = get_string("upload");
print_header("$course->shortname: $workshop->name : $strupload", "$course->fullname", print_header_simple("$workshop->name : $strupload", "",
"$navigation <A HREF=index.php?id=$course->id>$strworkshops</A> -> "<A HREF=index.php?id=$course->id>$strworkshops</A> ->
<A HREF=\"view.php?a=$workshop->id\">$workshop->name</A> -> $strupload", <A HREF=\"view.php?a=$workshop->id\">$workshop->name</A> -> $strupload",
"", "", true); "", "", true);
/**** /****
@ -41,27 +38,27 @@
} }
****/ ****/
$timenow = time(); $timenow = time();
if (!$title = $_POST['title']) { if (!$title = $_POST['title']) {
notify(get_string("notitlegiven", "workshop") ); notify(get_string("notitlegiven", "workshop") );
} }
else { else {
if (is_uploaded_file($newfile['tmp_name']) and $newfile['size'] > 0) { if (is_uploaded_file($newfile['tmp_name']) and $newfile['size'] > 0) {
if ($newfile['size'] > $workshop->maxbytes) { if ($newfile['size'] > $workshop->maxbytes) {
notify(get_string("uploadfiletoobig", "assignment", $workshop->maxbytes)); notify(get_string("uploadfiletoobig", "assignment", $workshop->maxbytes));
} }
else { else {
$newfile_name = clean_filename($newfile['name']); $newfile_name = clean_filename($newfile['name']);
if ($newfile_name) { if ($newfile_name) {
// get the current set of submissions // get the current set of submissions
$submissions = workshop_get_user_submissions($workshop, $USER); $submissions = workshop_get_user_submissions($workshop, $USER);
// add new submission record // add new submission record
$newsubmission->workshopid = $workshop->id; $newsubmission->workshopid = $workshop->id;
$newsubmission->userid = $USER->id; $newsubmission->userid = $USER->id;
$newsubmission->title = $title; $newsubmission->title = $title;
$newsubmission->timecreated = time(); $newsubmission->timecreated = time();
if (!$newsubmission->id = insert_record("workshop_submissions", $newsubmission)) { if (!$newsubmission->id = insert_record("workshop_submissions", $newsubmission)) {
error("Workshop upload: Failure to create new submission record!"); error("Workshop upload: Failure to create new submission record!");
} }
// see if this is a resubmission by looking at the previous submissions... // see if this is a resubmission by looking at the previous submissions...
if ($submissions and ($workshop->phase >1)) { // ...but not teacher submissions if ($submissions and ($workshop->phase >1)) { // ...but not teacher submissions
// find the last submission // find the last submission
@ -92,17 +89,17 @@
add_to_log($course->id, "workshop", "resubmit", "view.php?id=$cm->id", add_to_log($course->id, "workshop", "resubmit", "view.php?id=$cm->id",
"$workshop->id","$cm->id"); "$workshop->id","$cm->id");
} }
if (! $dir = workshop_file_area($workshop, $newsubmission)) { if (! $dir = workshop_file_area($workshop, $newsubmission)) {
error("Sorry, an error in the system prevents you from uploading files: contact your teacher or system administrator"); error("Sorry, an error in the system prevents you from uploading files: contact your teacher or system administrator");
}
if (move_uploaded_file($newfile['tmp_name'], "$dir/$newfile_name")) {
print_heading(get_string("uploadsuccess", "assignment", $newfile_name) );
add_to_log($course->id, "workshop", "submit", "view.php?id=$cm->id", "$workshop->id", "$cm->id");
} }
else { if (move_uploaded_file($newfile['tmp_name'], "$dir/$newfile_name")) {
notify(get_string("uploaderror", "assignment") ); print_heading(get_string("uploadsuccess", "assignment", $newfile_name) );
} add_to_log($course->id, "workshop", "submit", "view.php?id=$cm->id", "$workshop->id", "$cm->id");
} }
else {
notify(get_string("uploaderror", "assignment") );
}
}
} }
} }
elseif (!is_uploaded_file($newfile['tmp_name']) and !$newfile['size'] > 0 and $newfile['name']) { elseif (!is_uploaded_file($newfile['tmp_name']) and !$newfile['size'] > 0 and $newfile['name']) {
@ -111,7 +108,7 @@
else { else {
notify(get_string("uploadnofilefound", "assignment")); notify(get_string("uploadnofilefound", "assignment"));
} }
} }
print_continue("view.php?a=$workshop->id"); print_continue("view.php?a=$workshop->id");
print_footer($course); print_footer($course);

View file

@ -1,30 +1,30 @@
<?PHP // $Id: view.php, v1.1 23 Aug 2003 <?PHP // $Id: view.php, v1.1 23 Aug 2003
/************************************************* /*************************************************
ACTIONS handled are: ACTIONS handled are:
allowassessments (for teachers) allowassessments (for teachers)
allowboth (for teachers) allowboth (for teachers)
allowsubmissions (for teachers) allowsubmissions (for teachers)
close workshop( for teachers) close workshop( for teachers)
displayfinalgrade (for students) displayfinalgrade (for students)
notavailable (for students) notavailable (for students)
setupassignment (for teachers) setupassignment (for teachers)
studentsview studentsview
submitassignment submitassignment
teachersview teachersview
************************************************/ ************************************************/
require("../../config.php"); require("../../config.php");
require("lib.php"); require("lib.php");
require("locallib.php"); require("locallib.php");
optional_variable($id); // Course Module ID optional_variable($id); // Course Module ID
optional_variable($a); // workshop ID optional_variable($a); // workshop ID
// get some useful stuff... // get some useful stuff...
if ($id) { if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) { if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect"); error("Course Module ID was incorrect");
} }
@ -52,329 +52,325 @@
require_login($course->id); require_login($course->id);
// ...log activity... // ...log activity...
add_to_log($course->id, "workshop", "view", "view.php?id=$cm->id", $workshop->id, $cm->id); add_to_log($course->id, "workshop", "view", "view.php?id=$cm->id", $workshop->id, $cm->id);
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strworkshops = get_string("modulenameplural", "workshop"); $strworkshops = get_string("modulenameplural", "workshop");
$strworkshop = get_string("modulename", "workshop"); $strworkshop = get_string("modulename", "workshop");
// ...display header... // ...display header...
print_header("$course->shortname: $workshop->name", "$course->fullname", print_header_simple("$workshop->name", "",
"$navigation <A HREF=index.php?id=$course->id>$strworkshops</A> -> $workshop->name", "<A HREF=index.php?id=$course->id>$strworkshops</A> -> $workshop->name",
"", "", true, update_module_button($cm->id, $course->id, $strworkshop), navmenu($course, $cm)); "", "", true, update_module_button($cm->id, $course->id, $strworkshop), navmenu($course, $cm));
// ...and if necessary set default action // ...and if necessary set default action
optional_variable($action); optional_variable($action);
if (isteacher($course->id)) { if (isteacher($course->id)) {
if (empty($action)) { // no action specified, either go straight to elements page else the admin page if (empty($action)) { // no action specified, either go straight to elements page else the admin page
// has the assignment any elements // has the assignment any elements
if (count_records("workshop_elements", "workshopid", $workshop->id) >= $workshop->nelements) { if (count_records("workshop_elements", "workshopid", $workshop->id) >= $workshop->nelements) {
$action = "teachersview"; $action = "teachersview";
} }
else { else {
redirect("assessments.php?action=editelements&id=$cm->id"); redirect("assessments.php?action=editelements&id=$cm->id");
} }
} }
} }
elseif (!isguest()) { // it's a student then elseif (!isguest()) { // it's a student then
if (!$cm->visible) { if (!$cm->visible) {
notice(get_string("activityiscurrentlyhidden")); notice(get_string("activityiscurrentlyhidden"));
} }
switch ($workshop->phase) { switch ($workshop->phase) {
case 0 : case 0 :
case 1 : $action = 'notavailable'; break; case 1 : $action = 'notavailable'; break;
case 2 : case 2 :
case 3 : case 3 :
case 4 : $action = 'studentsview'; break; case 4 : $action = 'studentsview'; break;
case 5 : $action = 'notavailable'; break; case 5 : $action = 'notavailable'; break;
case 6 : $action = 'displayfinalgrade'; case 6 : $action = 'displayfinalgrade';
} }
} }
else { // it's a guest, oh no! else { // it's a guest, oh no!
$action = 'notavailable'; $action = 'notavailable';
} }
/************** allow (peer) assessments only (move to phase 4) (for teachers)**/ /************** allow (peer) assessments only (move to phase 4) (for teachers)**/
if ($action == 'allowassessments') { if ($action == 'allowassessments') {
if (!isteacher($course->id)) { if (!isteacher($course->id)) {
error("Only teachers can look at this page"); error("Only teachers can look at this page");
} }
// move to phase 4 // move to phase 4
set_field("workshop", "phase", 4, "id", "$workshop->id"); set_field("workshop", "phase", 4, "id", "$workshop->id");
add_to_log($course->id, "workshop", "assessments only", "view.php?id=$cm->id", "$workshop->id", $cm->id); add_to_log($course->id, "workshop", "assessments only", "view.php?id=$cm->id", "$workshop->id", $cm->id);
redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 4)); redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 4));
} }
/************** allow both (submissions and assessments) (move to phase 3) (for teachers)**/ /************** allow both (submissions and assessments) (move to phase 3) (for teachers)**/
if ($action == 'allowboth') { if ($action == 'allowboth') {
if (!isteacher($course->id)) { if (!isteacher($course->id)) {
error("Only teachers can look at this page"); error("Only teachers can look at this page");
} }
// move to phase 3 // move to phase 3
set_field("workshop", "phase", 3, "id", "$workshop->id"); set_field("workshop", "phase", 3, "id", "$workshop->id");
add_to_log($course->id, "workshop", "allow both", "view.php?id=$cm->id", "$workshop->id", $cm->id); add_to_log($course->id, "workshop", "allow both", "view.php?id=$cm->id", "$workshop->id", $cm->id);
redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 3)); redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 3));
} }
/************** allow submissions only (move to phase 2) (for teachers)**/ /************** allow submissions only (move to phase 2) (for teachers)**/
if ($action == 'allowsubmissions') { if ($action == 'allowsubmissions') {
if (!isteacher($course->id)) { if (!isteacher($course->id)) {
error("Only teachers can look at this page"); error("Only teachers can look at this page");
} }
// move to phase 2, check that teacher has made enough submissions // move to phase 2, check that teacher has made enough submissions
if (workshop_count_teacher_submissions($workshop) < $workshop->ntassessments) { if (workshop_count_teacher_submissions($workshop) < $workshop->ntassessments) {
redirect("view.php?id=$cm->id", get_string("notenoughexamplessubmitted", "workshop", redirect("view.php?id=$cm->id", get_string("notenoughexamplessubmitted", "workshop",
$course->teacher)); $course->teacher));
} }
else { else {
set_field("workshop", "phase", 2, "id", "$workshop->id"); set_field("workshop", "phase", 2, "id", "$workshop->id");
add_to_log($course->id, "workshop", "submissions", "view.php?id=$cm->id", "$workshop->id", $cm->id); add_to_log($course->id, "workshop", "submissions", "view.php?id=$cm->id", "$workshop->id", $cm->id);
redirect("view.php?id=$cm->id", get_string("movingtophase", "workshop", 2)); redirect("view.php?id=$cm->id", get_string("movingtophase", "workshop", 2));
} }
} }
/****************** close workshop for student assessments/submissions (move to phase 5) (for teachers)**/ /****************** close workshop for student assessments/submissions (move to phase 5) (for teachers)**/
elseif ($action == 'closeworkshop') { elseif ($action == 'closeworkshop') {
if (!isteacher($course->id)) { if (!isteacher($course->id)) {
error("Only teachers can look at this page"); error("Only teachers can look at this page");
} }
// move to phase 5 // move to phase 5
set_field("workshop", "phase", 5, "id", "$workshop->id"); set_field("workshop", "phase", 5, "id", "$workshop->id");
add_to_log($course->id, "workshop", "close", "view.php?id=$cm->id", "$workshop->id", $cm->id); add_to_log($course->id, "workshop", "close", "view.php?id=$cm->id", "$workshop->id", $cm->id);
redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 5)); redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 5));
} }
/****************** display final grade (for students) ************************************/ /****************** display final grade (for students) ************************************/
elseif ($action == 'displayfinalgrade' ) { elseif ($action == 'displayfinalgrade' ) {
// get the final weights from the database // get the final weights from the database
$teacherweight = get_field("workshop","teacherweight", "id", $workshop->id); $teacherweight = get_field("workshop","teacherweight", "id", $workshop->id);
$peerweight = get_field("workshop","peerweight", "id", $workshop->id); $peerweight = get_field("workshop","peerweight", "id", $workshop->id);
$includeteachersgrade = get_field("workshop","includeteachersgrade", "id", $workshop->id); $includeteachersgrade = get_field("workshop","includeteachersgrade", "id", $workshop->id);
$biasweight = get_field("workshop","biasweight", "id", $workshop->id); $biasweight = get_field("workshop","biasweight", "id", $workshop->id);
$reliabilityweight = get_field("workshop","reliabilityweight", "id", $workshop->id); $reliabilityweight = get_field("workshop","reliabilityweight", "id", $workshop->id);
$gradingweight = get_field("workshop","gradingweight", "id", $workshop->id); $gradingweight = get_field("workshop","gradingweight", "id", $workshop->id);
// work out what to show in the final grades tables and what to include in the calculation of the final grade // work out what to show in the final grades tables and what to include in the calculation of the final grade
// teacher grades? // teacher grades?
if ($workshop->gradingstrategy and $teacherweight) { if ($workshop->gradingstrategy and $teacherweight) {
$useteachersgrades = 1; $useteachersgrades = 1;
} }
else { else {
$useteachersgrades = 0; $useteachersgrades = 0;
} }
// peergrades? // peergrades?
if ($workshop->gradingstrategy and $workshop->nsassessments and $peerweight) { if ($workshop->gradingstrategy and $workshop->nsassessments and $peerweight) {
$usepeergrades = 1; $usepeergrades = 1;
} }
else { else {
$usepeergrades = 0; $usepeergrades = 0;
} }
// bias grades? // bias grades?
if ((($workshop->ntassessments >= 3) or ($workshop->nsassessments >= 3)) and $biasweight ) { if ((($workshop->ntassessments >= 3) or ($workshop->nsassessments >= 3)) and $biasweight ) {
$usebiasgrades = 1; $usebiasgrades = 1;
} }
else { else {
$usebiasgrades = 0; $usebiasgrades = 0;
} }
// reliability grades? // reliability grades?
if ((($workshop->ntassessments >= 3) or ($workshop->nsassessments >= 3)) and $reliabilityweight ) { if ((($workshop->ntassessments >= 3) or ($workshop->nsassessments >= 3)) and $reliabilityweight ) {
$usereliabilitygrades = 1; $usereliabilitygrades = 1;
} }
else { else {
$usereliabilitygrades = 0; $usereliabilitygrades = 0;
} }
// grading grades? // grading grades?
if (($workshop->ntassessments or $workshop->nsassessments) and $gradingweight ) { if (($workshop->ntassessments or $workshop->nsassessments) and $gradingweight ) {
$usegradinggrades = 1; $usegradinggrades = 1;
} }
else { else {
$usegradinggrades = 0; $usegradinggrades = 0;
} }
// show the final grades as stored in the tables... // show the final grades as stored in the tables...
print_heading_with_help(get_string("displayoffinalgrades", "workshop"), "finalgrades", "workshop"); print_heading_with_help(get_string("displayoffinalgrades", "workshop"), "finalgrades", "workshop");
if ($submissions = workshop_get_user_submissions($workshop, $USER)) { // any submissions from user? if ($submissions = workshop_get_user_submissions($workshop, $USER)) { // any submissions from user?
echo "<center><table border=\"1\" width=\"90%\"><tr>"; echo "<center><table border=\"1\" width=\"90%\"><tr>";
echo "<td><b>".get_string("submissions", "workshop")."</b></td>"; echo "<td><b>".get_string("submissions", "workshop")."</b></td>";
if ($useteachersgrades) { if ($useteachersgrades) {
echo "<td align=\"center\"><b>".get_string("teacherassessments", "workshop", echo "<td align=\"center\"><b>".get_string("teacherassessments", "workshop",
$course->teacher)."</b></td>"; $course->teacher)."</b></td>";
} }
if ($usepeergrades) { if ($usepeergrades) {
echo "<td align=\"center\"><b>".get_string("studentassessments", "workshop", echo "<td align=\"center\"><b>".get_string("studentassessments", "workshop",
$course->student)."</b></td>"; $course->student)."</b></td>";
} }
echo "<td align=\"center\"><b>".get_string("assessmentsdone", "workshop")."</b></td>"; echo "<td align=\"center\"><b>".get_string("assessmentsdone", "workshop")."</b></td>";
if ($usebiasgrades) { if ($usebiasgrades) {
echo "<td align=\"center\"><b>".get_string("gradeforbias", "workshop")."</b></td>"; echo "<td align=\"center\"><b>".get_string("gradeforbias", "workshop")."</b></td>";
} }
if ($usereliabilitygrades) { if ($usereliabilitygrades) {
echo "<td align=\"center\"><b>".get_string("gradeforreliability", "workshop")."</b></td>"; echo "<td align=\"center\"><b>".get_string("gradeforreliability", "workshop")."</b></td>";
} }
if ($usegradinggrades) { if ($usegradinggrades) {
echo "<td align=\"center\"><b>".get_string("gradeforassessments", "workshop")."</b></td>"; echo "<td align=\"center\"><b>".get_string("gradeforassessments", "workshop")."</b></td>";
} }
echo "<td align=\"center\"><b>".get_string("overallgrade", "workshop")."</b></td></TR>\n"; echo "<td align=\"center\"><b>".get_string("overallgrade", "workshop")."</b></td></TR>\n";
// now the weights // now the weights
echo "<TR><td><b>".get_string("weights", "workshop")."</b></td>"; echo "<TR><td><b>".get_string("weights", "workshop")."</b></td>";
if ($useteachersgrades) { if ($useteachersgrades) {
echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$teacherweight]</b></td>\n"; echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$teacherweight]</b></td>\n";
} }
if ($usepeergrades) { if ($usepeergrades) {
echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$peerweight]</b></td>\n"; echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$peerweight]</b></td>\n";
} }
echo "<td><b>&nbsp;</b></td>\n"; echo "<td><b>&nbsp;</b></td>\n";
if ($usebiasgrades) { if ($usebiasgrades) {
echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$biasweight]</b></td>\n"; echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$biasweight]</b></td>\n";
} }
if ($usereliabilitygrades) { if ($usereliabilitygrades) {
echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$reliabilityweight]</b></td>\n"; echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$reliabilityweight]</b></td>\n";
} }
if ($usegradinggrades) { if ($usegradinggrades) {
echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$gradingweight]</b></td>\n"; echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$gradingweight]</b></td>\n";
} }
echo "<td><b>&nbsp;</b></td></TR>\n"; echo "<td><b>&nbsp;</b></td></TR>\n";
foreach ($submissions as $submission) { foreach ($submissions as $submission) {
echo "<TR><td>".workshop_print_submission_title($workshop, $submission)."</td>\n"; echo "<TR><td>".workshop_print_submission_title($workshop, $submission)."</td>\n";
if ($useteachersgrades) { if ($useteachersgrades) {
echo "<td align=\"center\">".workshop_print_submission_assessments($workshop, echo "<td align=\"center\">".workshop_print_submission_assessments($workshop,
$submission, "teacher")."</td>"; $submission, "teacher")."</td>";
} }
if ($usepeergrades) { if ($usepeergrades) {
echo "<td align=\"center\">".workshop_print_submission_assessments($workshop, echo "<td align=\"center\">".workshop_print_submission_assessments($workshop,
$submission, "student")."</td>"; $submission, "student")."</td>";
} }
echo "<td align=\"center\">".workshop_print_user_assessments($workshop, $USER)."</td>"; echo "<td align=\"center\">".workshop_print_user_assessments($workshop, $USER)."</td>";
if ($usebiasgrades) { if ($usebiasgrades) {
echo "<td align=\"center\">$submission->biasgrade</td>"; echo "<td align=\"center\">$submission->biasgrade</td>";
} }
if ($usereliabilitygrades) { if ($usereliabilitygrades) {
echo "<td align=\"center\">$submission->reliabilitygrade</td>"; echo "<td align=\"center\">$submission->reliabilitygrade</td>";
} }
if ($usegradinggrades) { if ($usegradinggrades) {
echo "<td align=\"center\">$submission->gradinggrade</td>"; echo "<td align=\"center\">$submission->gradinggrade</td>";
} }
echo "<td align=\"center\">$submission->finalgrade</td></TR>\n"; echo "<td align=\"center\">$submission->finalgrade</td></TR>\n";
} }
} }
echo "</TABLE><BR CLEAR=ALL>\n"; echo "</TABLE><BR CLEAR=ALL>\n";
echo "<p>&lt; &gt; ".get_string("assessmentdropped", "workshop")."</p>\n"; echo "<p>&lt; &gt; ".get_string("assessmentdropped", "workshop")."</p>\n";
if ($workshop->showleaguetable) { if ($workshop->showleaguetable) {
workshop_print_league_table($workshop); workshop_print_league_table($workshop);
} }
echo "<br />".get_string("allgradeshaveamaximumof", "workshop", $workshop->grade); echo "<br />".get_string("allgradeshaveamaximumof", "workshop", $workshop->grade);
} }
/****************** make final grades available (go to phase 6) (for teachers only)********/ /****************** make final grades available (go to phase 6) (for teachers only)********/
elseif ($action == 'makefinalgradesavailable') { elseif ($action == 'makefinalgradesavailable') {
if (!isteacher($course->id)) { if (!isteacher($course->id)) {
error("Only teachers can look at this page"); error("Only teachers can look at this page");
} }
set_field("workshop", "phase", 6, "id", "$workshop->id"); set_field("workshop", "phase", 6, "id", "$workshop->id");
add_to_log($course->id, "workshop", "display grades", "view.php?id=$cm->id", "$workshop->id", $cm->id); add_to_log($course->id, "workshop", "display grades", "view.php?id=$cm->id", "$workshop->id", $cm->id);
redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 6)); redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 6));
} }
/****************** assignment not available (for students)***********************/ /****************** assignment not available (for students)***********************/
elseif ($action == 'notavailable') { elseif ($action == 'notavailable') {
print_heading(get_string("notavailable", "workshop")); print_heading(get_string("notavailable", "workshop"));
} }
/****************** set up assignment (move back to phase 1) (for teachers)***********************/ /****************** set up assignment (move back to phase 1) (for teachers)***********************/
elseif ($action == 'setupassignment') { elseif ($action == 'setupassignment') {
if (!isteacher($course->id)) { if (!isteacher($course->id)) {
error("Only teachers can look at this page"); error("Only teachers can look at this page");
} }
set_field("workshop", "phase", 1, "id", "$workshop->id"); set_field("workshop", "phase", 1, "id", "$workshop->id");
add_to_log($course->id, "workshop", "set up", "view.php?id=$cm->id", "$workshop->id", $cm->id); add_to_log($course->id, "workshop", "set up", "view.php?id=$cm->id", "$workshop->id", $cm->id);
redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 1)); redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 1));
} }
/****************** student's view could be in 1 of 4 stages ***********************/ /****************** student's view could be in 1 of 4 stages ***********************/
elseif ($action == 'studentsview') { elseif ($action == 'studentsview') {
workshop_print_assignment_info($workshop); workshop_print_assignment_info($workshop);
// in Stage 1? - are there any teacher's submissions? and... // in Stage 1? - are there any teacher's submissions? and...
// ...has student assessed the required number of the teacher's submissions // ...has student assessed the required number of the teacher's submissions
if ($workshop->ntassessments and (!workshop_test_user_assessments($workshop, $USER))) { if ($workshop->ntassessments and (!workshop_test_user_assessments($workshop, $USER))) {
print_heading(get_string("pleaseassesstheseexamplesfromtheteacher", "workshop", print_heading(get_string("pleaseassesstheseexamplesfromtheteacher", "workshop",
$course->teacher)); $course->teacher));
workshop_list_teacher_submissions($workshop, $USER); workshop_list_teacher_submissions($workshop, $USER);
} }
// in stage 2? - submit own first attempt // in stage 2? - submit own first attempt
else { else {
if ($workshop->ntassessments) { if ($workshop->ntassessments) {
// show assessment the teacher's examples, there may be feedback from teacher // show assessment the teacher's examples, there may be feedback from teacher
print_heading(get_string("yourassessmentsofexamplesfromtheteacher", "workshop", print_heading(get_string("yourassessmentsofexamplesfromtheteacher", "workshop",
$course->teacher)); $course->teacher));
workshop_list_teacher_submissions($workshop, $USER); workshop_list_teacher_submissions($workshop, $USER);
} }
// has user submitted anything yet? (only allowed in phases 2 and 3) // has user submitted anything yet? (only allowed in phases 2 and 3)
if (!workshop_get_user_submissions($workshop, $USER)) { if (!workshop_get_user_submissions($workshop, $USER)) {
if ($workshop->phase < 4) { if ($workshop->phase < 4) {
// print upload form // print upload form
print_heading(get_string("submitassignmentusingform", "workshop").":"); print_heading(get_string("submitassignmentusingform", "workshop").":");
workshop_print_upload_form($workshop); workshop_print_upload_form($workshop);
} else { } else {
print_heading(get_string("submissionsnolongerallowed", "workshop")); print_heading(get_string("submissionsnolongerallowed", "workshop"));
} }
} }
// in stage 3? - grade other student's submissions, resubmit and list all submissions // in stage 3? - grade other student's submissions, resubmit and list all submissions
else { else {
// list any assessments by teachers // list any assessments by teachers
if (workshop_count_teacher_assessments($workshop, $USER)) { if (workshop_count_teacher_assessments($workshop, $USER)) {
print_heading(get_string("assessmentsby", "workshop", $course->teachers)); print_heading(get_string("assessmentsby", "workshop", $course->teachers));
workshop_list_teacher_assessments($workshop, $USER); workshop_list_teacher_assessments($workshop, $USER);
} }
// is self assessment used in this workshop? // is self assessment used in this workshop?
if ($workshop->includeself) { if ($workshop->includeself) {
// prints a table if there are any submissions which have not been self assessed yet // prints a table if there are any submissions which have not been self assessed yet
workshop_list_self_assessments($workshop, $USER); workshop_list_self_assessments($workshop, $USER);
} }
// if peer assessments are being done and workshop is in phase 3 then show some to assess... // if peer assessments are being done and workshop is in phase 3 then show some to assess...
if ($workshop->nsassessments and ($workshop->phase > 2)) { if ($workshop->nsassessments and ($workshop->phase > 2)) {
workshop_list_student_submissions($workshop, $USER); workshop_list_student_submissions($workshop, $USER);
} }
// ..and any they have already done (and have gone cold)... // ..and any they have already done (and have gone cold)...
if (workshop_count_user_assessments($workshop, $USER, "student")) { if (workshop_count_user_assessments($workshop, $USER, "student")) {
print_heading(get_string("yourassessments", "workshop")); print_heading(get_string("yourassessments", "workshop"));
workshop_list_assessed_submissions($workshop, $USER); workshop_list_assessed_submissions($workshop, $USER);
} }
// ... and show peer assessments // ... and show peer assessments
if (workshop_count_peer_assessments($workshop, $USER)) { if (workshop_count_peer_assessments($workshop, $USER)) {
print_heading(get_string("assessmentsby", "workshop", $course->students)); print_heading(get_string("assessmentsby", "workshop", $course->students));
workshop_list_peer_assessments($workshop, $USER); workshop_list_peer_assessments($workshop, $USER);
} }
// list previous submissions // list previous submissions
print_heading(get_string("submissions", "workshop")); print_heading(get_string("submissions", "workshop"));
workshop_list_user_submissions($workshop, $USER); workshop_list_user_submissions($workshop, $USER);
// are resubmissions allowed and the workshop is in submission phases (2 and 3)? // are resubmissions allowed and the workshop is in submission phases (2 and 3)?
if ($workshop->resubmit and ($workshop->phase < 4)) { if ($workshop->resubmit and ($workshop->phase < 4)) {
// see if there are any cold (warm included as well) assessments of the last submission // see if there are any cold (warm included as well) assessments of the last submission
// if there are then print upload form // if there are then print upload form
if ($submissions = workshop_get_user_submissions($workshop, $USER)) { if ($submissions = workshop_get_user_submissions($workshop, $USER)) {
foreach ($submissions as $submission) { foreach ($submissions as $submission) {
@ -382,160 +378,160 @@
break; break;
} }
if (workshop_count_assessments($lastsubmission)) { if (workshop_count_assessments($lastsubmission)) {
echo "<hr size=\"1\" noshade>"; echo "<hr size=\"1\" noshade>";
print_heading(get_string("submitrevisedassignment", "workshop").":"); print_heading(get_string("submitrevisedassignment", "workshop").":");
workshop_print_upload_form($workshop); workshop_print_upload_form($workshop);
echo "<hr size=\"1\" noshade>"; echo "<hr size=\"1\" noshade>";
} }
} }
} }
// allow user to list their submissions and assessments in a general way???? // allow user to list their submissions and assessments in a general way????
// print_heading("<A HREF=\"submissions.php?action=listallsubmissions&id=$cm->id\">". // print_heading("<A HREF=\"submissions.php?action=listallsubmissions&id=$cm->id\">".
// get_string("listofallsubmissions", "workshop")); // get_string("listofallsubmissions", "workshop"));
} }
} }
} }
/****************** submission of assignment by teacher only***********************/ /****************** submission of assignment by teacher only***********************/
elseif ($action == 'submitassignment') { elseif ($action == 'submitassignment') {
if (!isteacher($course->id)) { if (!isteacher($course->id)) {
error("Only teachers can look at this page"); error("Only teachers can look at this page");
} }
$strdifference = format_time($workshop->deadline - time()); $strdifference = format_time($workshop->deadline - time());
if (($workshop->deadline - time()) < 0) { if (($workshop->deadline - time()) < 0) {
$strdifference = "<FONT COLOR=RED>$strdifference</FONT>"; $strdifference = "<FONT COLOR=RED>$strdifference</FONT>";
} }
$strduedate = userdate($workshop->deadline)." ($strdifference)"; $strduedate = userdate($workshop->deadline)." ($strdifference)";
workshop_print_assignment_info($workshop); workshop_print_assignment_info($workshop);
// list previous submissions from teacher // list previous submissions from teacher
workshop_list_user_submissions($workshop, $USER); workshop_list_user_submissions($workshop, $USER);
echo "<HR SIZE=1 NOSHADE>"; echo "<HR SIZE=1 NOSHADE>";
// print upload form // print upload form
print_heading(get_string("submitassignment", "assignment").":"); print_heading(get_string("submitassignment", "assignment").":");
workshop_print_upload_form($workshop); workshop_print_upload_form($workshop);
} }
/****************** teacher's view - display admin page (current phase options) ************/ /****************** teacher's view - display admin page (current phase options) ************/
elseif ($action == 'teachersview') { elseif ($action == 'teachersview') {
if (!isteacher($course->id)) { if (!isteacher($course->id)) {
error("Only teachers can look at this page"); error("Only teachers can look at this page");
} }
print_heading_with_help(get_string("managingassignment", "workshop"), "managing", "workshop"); print_heading_with_help(get_string("managingassignment", "workshop"), "managing", "workshop");
workshop_print_assignment_info($workshop); workshop_print_assignment_info($workshop);
$tabs->names = array("1. ".get_string("phase1", "workshop"), $tabs->names = array("1. ".get_string("phase1", "workshop"),
"2. ".get_string("phase2", "workshop", $course->student), "2. ".get_string("phase2", "workshop", $course->student),
"3. ".get_string("phase3", "workshop", $course->student), "3. ".get_string("phase3", "workshop", $course->student),
"4. ".get_string("phase4", "workshop", $course->student), "4. ".get_string("phase4", "workshop", $course->student),
"5. ".get_string("phase5", "workshop"), "5. ".get_string("phase5", "workshop"),
"6. ".get_string("phase6", "workshop")); "6. ".get_string("phase6", "workshop"));
$tabs->urls = array("view.php?id=$cm->id&action=setupassignment", $tabs->urls = array("view.php?id=$cm->id&action=setupassignment",
"view.php?id=$cm->id&action=allowsubmissions", "view.php?id=$cm->id&action=allowsubmissions",
"view.php?id=$cm->id&action=allowboth", "view.php?id=$cm->id&action=allowboth",
"view.php?id=$cm->id&action=allowassessments", "view.php?id=$cm->id&action=allowassessments",
"view.php?id=$cm->id&action=closeworkshop", "view.php?id=$cm->id&action=closeworkshop",
"view.php?id=$cm->id&action=makefinalgradesavailable"); "view.php?id=$cm->id&action=makefinalgradesavailable");
if ($workshop->phase) { // phase 1 or more if ($workshop->phase) { // phase 1 or more
$tabs->highlight = $workshop->phase - 1; $tabs->highlight = $workshop->phase - 1;
} else { } else {
$tabs->highlight = 0; // phase is zero $tabs->highlight = 0; // phase is zero
} }
workshop_print_tabbed_heading($tabs); workshop_print_tabbed_heading($tabs);
echo "<center>\n"; echo "<center>\n";
switch ($workshop->phase) { switch ($workshop->phase) {
case 0: case 0:
case 1: // set up assignment case 1: // set up assignment
if ($workshop->nelements) { if ($workshop->nelements) {
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=editelements\">". echo "<p><b><a href=\"assessments.php?id=$cm->id&action=editelements\">".
get_string("amendassessmentelements", "workshop")."</a></b> \n"; get_string("amendassessmentelements", "workshop")."</a></b> \n";
helpbutton("elements", get_string("amendassessmentelements", "workshop"), "workshop"); helpbutton("elements", get_string("amendassessmentelements", "workshop"), "workshop");
} }
if ($workshop->ntassessments) { if ($workshop->ntassessments) {
// if teacher examples show submission and assessment links // if teacher examples show submission and assessment links
echo "<p><b><a href=\"view.php?id=$cm->id&action=submitassignment\">". echo "<p><b><a href=\"view.php?id=$cm->id&action=submitassignment\">".
get_string("submitexampleassignment", "workshop")."</a></b> \n"; get_string("submitexampleassignment", "workshop")."</a></b> \n";
helpbutton("submissionofexamples", get_string("submitexampleassignment", "workshop"), helpbutton("submissionofexamples", get_string("submitexampleassignment", "workshop"),
"workshop"); "workshop");
echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentteacher\">". echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentteacher\">".
get_string("teachersubmissionsforassessment", "workshop", get_string("teachersubmissionsforassessment", "workshop",
workshop_count_teacher_submissions_for_assessment($workshop, $USER)). workshop_count_teacher_submissions_for_assessment($workshop, $USER)).
"</a></b> \n"; "</a></b> \n";
helpbutton("assessmentofexamples", get_string("teachersubmissionsforassessment", helpbutton("assessmentofexamples", get_string("teachersubmissionsforassessment",
"workshop"), "workshop"); "workshop"), "workshop");
} }
break; break;
case 2: // submissions and assessments case 2: // submissions and assessments
case 3: case 3:
case 4: case 4:
if ($workshop->ntassessments) { // if teacher example show student assessments link if ($workshop->ntassessments) { // if teacher example show student assessments link
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedteachersubmissions\">". echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedteachersubmissions\">".
get_string("ungradedassessmentsofteachersubmissions", "workshop", get_string("ungradedassessmentsofteachersubmissions", "workshop",
workshop_count_ungraded_assessments_teacher($workshop))."</a></b> \n"; workshop_count_ungraded_assessments_teacher($workshop))."</a></b> \n";
helpbutton("ungradedassessments_teacher", helpbutton("ungradedassessments_teacher",
get_string("ungradedassessmentsofteachersubmissions", "workshop"), "workshop"); get_string("ungradedassessmentsofteachersubmissions", "workshop"), "workshop");
} }
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedstudentsubmissions\">". echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedstudentsubmissions\">".
get_string("ungradedassessmentsofstudentsubmissions", "workshop", get_string("ungradedassessmentsofstudentsubmissions", "workshop",
workshop_count_ungraded_assessments_student($workshop))."</a></b> \n"; workshop_count_ungraded_assessments_student($workshop))."</a></b> \n";
helpbutton("ungradedassessments_student", helpbutton("ungradedassessments_student",
get_string("ungradedassessmentsofstudentsubmissions", "workshop"), "workshop"); get_string("ungradedassessmentsofstudentsubmissions", "workshop"), "workshop");
echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">". echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">".
get_string("studentsubmissionsforassessment", "workshop", get_string("studentsubmissionsforassessment", "workshop",
workshop_count_student_submissions_for_assessment($workshop, $USER))."</a></b> \n"; workshop_count_student_submissions_for_assessment($workshop, $USER))."</a></b> \n";
helpbutton("gradingsubmissions", helpbutton("gradingsubmissions",
get_string("studentsubmissionsforassessment", "workshop"), "workshop"); get_string("studentsubmissionsforassessment", "workshop"), "workshop");
break; break;
case 5: // calculate final grades case 5: // calculate final grades
if ($workshop->ntassessments) { // if teacher example show student assessments link if ($workshop->ntassessments) { // if teacher example show student assessments link
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedteachersubmissions\">". echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedteachersubmissions\">".
get_string("ungradedassessmentsofteachersubmissions", "workshop", get_string("ungradedassessmentsofteachersubmissions", "workshop",
workshop_count_ungraded_assessments_teacher($workshop))."</a></b> \n"; workshop_count_ungraded_assessments_teacher($workshop))."</a></b> \n";
helpbutton("ungradedassessments_teacher", helpbutton("ungradedassessments_teacher",
get_string("ungradedassessmentsofteachersubmissions", "workshop"), "workshop"); get_string("ungradedassessmentsofteachersubmissions", "workshop"), "workshop");
} }
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedstudentsubmissions\">". echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedstudentsubmissions\">".
get_string("ungradedassessmentsofstudentsubmissions", "workshop", get_string("ungradedassessmentsofstudentsubmissions", "workshop",
workshop_count_ungraded_assessments_student($workshop))."</a></b> \n"; workshop_count_ungraded_assessments_student($workshop))."</a></b> \n";
helpbutton("ungradedassessments_student", helpbutton("ungradedassessments_student",
get_string("ungradedassessmentsofstudentsubmissions", "workshop"), "workshop"); get_string("ungradedassessmentsofstudentsubmissions", "workshop"), "workshop");
echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">". echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">".
get_string("studentsubmissionsforassessment", "workshop", get_string("studentsubmissionsforassessment", "workshop",
workshop_count_student_submissions_for_assessment($workshop, $USER))."</a></b> \n"; workshop_count_student_submissions_for_assessment($workshop, $USER))."</a></b> \n";
helpbutton("gradingsubmissions", helpbutton("gradingsubmissions",
get_string("studentsubmissionsforassessment", "workshop"), "workshop"); get_string("studentsubmissionsforassessment", "workshop"), "workshop");
print_heading("<a href=\"submissions.php?id=$cm->id&action=displayfinalweights\">". print_heading("<a href=\"submissions.php?id=$cm->id&action=displayfinalweights\">".
get_string("calculationoffinalgrades", "workshop")."</a>"); get_string("calculationoffinalgrades", "workshop")."</a>");
print_heading("<a href=\"submissions.php?id=$cm->id&action=analysisofassessments\">". print_heading("<a href=\"submissions.php?id=$cm->id&action=analysisofassessments\">".
get_string("analysisofassessments", "workshop")."</a>"); get_string("analysisofassessments", "workshop")."</a>");
break; break;
case 6: // show final grades case 6: // show final grades
print_heading("<A HREF=\"submissions.php?id=$cm->id&action=displayfinalgrades\">". print_heading("<A HREF=\"submissions.php?id=$cm->id&action=displayfinalgrades\">".
get_string("displayoffinalgrades", "workshop")."</A>"); get_string("displayoffinalgrades", "workshop")."</A>");
} }
print_heading("<A HREF=\"submissions.php?id=$cm->id&action=adminlist\">". print_heading("<A HREF=\"submissions.php?id=$cm->id&action=adminlist\">".
get_string("administration")."</A>"); get_string("administration")."</A>");
} }
/*************** no man's land **************************************/ /*************** no man's land **************************************/
else { else {
error("Fatal Error: Unknown Action: ".$action."\n"); error("Fatal Error: Unknown Action: ".$action."\n");
} }
print_footer($course); print_footer($course);
?> ?>