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

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

View file

@ -34,16 +34,12 @@
/// Print the page header
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strattendances = get_string("modulenameplural", "attendance");
$strattendance = get_string("modulename", "attendance");
$strteacheredit = get_string("teacheredit", "attendance");
print_header("$course->shortname: $attendance->name", "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strattendances</A> -> $attendance->name",
print_header_simple($attendance->name, "",
"<A HREF=index.php?id=$course->id>$strattendances</A> -> $attendance->name",
"", "", true, update_module_button($cm->id, $course->id, $strattendance),
navmenu($course, $cm));
@ -72,9 +68,9 @@
// 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
$strviewall = get_string("viewall", "attendance");
$strviewweek = get_string("viewweek", "attendance");
echo "<p align=\"right\">";
$strviewall = get_string("viewall", "attendance");
$strviewweek = get_string("viewweek", "attendance");
echo "<p align=\"right\">";
if (isteacher($course->id)) {
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\" ".
"cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">";
// print the date headings at the top of the table
echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">".
"&nbsp;</th>\n";
echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">".
"&nbsp;</th>\n";
// put notes for the date in the date heading
$notes = ($form->notes != "") ? ":<br />".$form->notes : "";
echo "<th valign=\"top\" align=\"left\" colspan=\"" .$form->hours. "\" nowrap class=\"generaltableheader\">".
userdate($form->day,get_string("strftimedateshort")).$notes."</th>\n";
echo "<th valign=\"top\" align=\"left\" colspan=\"" .$form->hours. "\" nowrap class=\"generaltableheader\">".
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 "</tr>\n";
// 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 "<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 "<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\">ID</th>\n";
// generate the headers for the attendance hours
if ($form->hours > 1) {
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\">total</td>";
} else { echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">&nbsp;</th>\n"; }
echo "</tr>\n";
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\">total</td>";
} else { echo "<th valign=\"top\" align=\"center\" nowrap class=\"generaltableheader\">&nbsp;</th>\n"; }
echo "</tr>\n";
// get the list of students along with student ID field
// get back array of stdclass objects in sorted order, with members:
// id, username,firstname,lastname,maildisplay,mailformat,email,city,country,
@ -116,7 +112,7 @@
if (isteacher($course->id)){
$students = attendance_get_course_students($form->course, "u.lastname ASC");
} 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;
$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";
$studentid=(($student->idnumber != "") ? $student->idnumber : "&nbsp");
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$studentid."</td>\n";
$abs=$tar=0;
for($j=1;$j<=$form->hours;$j++) {
$abs=$tar=0;
for($j=1;$j<=$form->hours;$j++) {
// set the attendance defaults for each student
if ($sroll[$student->id][$j]->status == 1) {$status=$T;$tar++;}
elseif ($sroll[$student->id][$j]->status == 2) {$status=$A;$abs++;}
else {$status=$P;}
if ($sroll[$student->id][$j]->status == 1) {$status=$T;$tar++;}
elseif ($sroll[$student->id][$j]->status == 2) {$status=$A;$abs++;}
else {$status=$P;}
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) {
$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";
}
}
@ -154,22 +150,22 @@
echo "<table width=\"100%\" border=\"0\" valign=\"top\" align=\"center\" ".
"cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">";
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\">".
(($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\">".
get_string("autoattendshort","attendance").":</th>\n";
get_string("autoattendshort","attendance").":</th>\n";
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\">".
get_string("gradeshort","attendance").":</th>\n";
get_string("gradeshort","attendance").":</th>\n";
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") {
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\">".
$form->maxgrade."</th></tr>\n";
$form->maxgrade."</th></tr>\n";
}
echo "</table></td></table>\n";

View file

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

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