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) {
// 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
require_login($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");
$strassignment = get_string("modulename", "assignment");
$strweek = get_string("week");
$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)) {
notice("There are no assignments", "../../course/view.php?id=$course->id");
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");
$strassignment = get_string("modulename", "assignment");
$strsubmissions = get_string("submissions", "assignment");
$strsaveallfeedback = get_string("saveallfeedback", "assignment");
- print_header("$course->shortname: $assignment->name", "$course->fullname",
- "$navigation <a href=\"index.php?id=$course->id\">$strassignments</a> ->
+ print_header_simple($assignment->name, "",
+ "<a href=\"index.php?id=$course->id\">$strassignments</a> ->
<a href=\"view.php?a=$assignment->id\">$assignment->name</a> -> $strsubmissions",
"", "", true, update_module_button($cm->id, $course->id, $strassignment), navmenu($course, $cm));
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");
$strassignment = get_string("modulename", "assignment");
$strupload = get_string("upload");
- print_header("$course->shortname: $assignment->name : $strupload", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strassignments</A> ->
+ print_header_simple("$assignment->name : $strupload", "",
+ "<A HREF=index.php?id=$course->id>$strassignments</A> ->
<A HREF=\"view.php?a=$assignment->id\">$assignment->name</A> -> $strupload",
"", "", true);
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");
$strassignment = get_string("modulename", "assignment");
- print_header("$course->shortname: $assignment->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strassignments</A> -> $assignment->name",
+ print_header_simple($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));
if (isteacher($course->id)) {
/// 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
/// 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));
// 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/>";
}
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\">".
- " </th>\n";
+ echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">".
+ " </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\"> </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\"> </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\"> </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,
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");
echo "<td align=\"left\" nowrap class=\"generaltablecell\" style=\"border-top: 1px solid;\">".$student->firstname."</td>\n";
$studentid=(($student->idnumber != "") ? $student->idnumber : " ");
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";
}
}
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";
/// 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;
}
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++;
}
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");
}
$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();
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");
}
$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;
}
} else if ($onepage) {
$multipage=false;
} else { // if onepage is set to false
- $multilpage=true;
+ $multilpage=true;
}
// adjust the width for the report for students
$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);
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 />";
"cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">";
if (isteacher($course->id)) {
echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">".
- " </th>\n";
+ " </th>\n";
}
// $minpage=0;$maxpage=$numatt;
// print the date headings at the top of the table
// 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) {
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\"> </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\"> </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:
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");
}
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";
}
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";
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, " ",
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\"><<</a> \n".
- "<a href=\"viewall.php?id=".$course->id ."&pagereport=1&page=".($page-1)."\"><</a></th>\n";
- } else {
+ "<a href=\"viewall.php?id=".$course->id ."&pagereport=1&page=1\"><<</a> \n".
+ "<a href=\"viewall.php?id=".$course->id ."&pagereport=1&page=".($page-1)."\"><</a></th>\n";
+ } else {
echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\"><< <</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)."\">></a> ".
"<a href=\"viewall.php?id=".$course->id ."&pagereport=1&page=$maxpages\">>></a></th>";
- } else {
+ } else {
echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">> >></th>\n";
- }
- echo "</tr></table></td></tr></table></center>\n";
+ }
+ echo "</tr></table></td></tr></table></center>\n";
}
}
} else {
if (! $attendances = get_attendance_for_week($attendance->id, $course->id)) {
error("Course module is incorrect");
- }
+ }
}
}
if ($attendances) {
if ( !(isteacher($course->id) || isstudent($course->id)) ) {
- attendance_print_header();
+ attendance_print_header();
notice(get_string("noviews", "attendance"));
print_footer($course); exit;
}
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++;
}
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");
}
$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();
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");
}
$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;
}
} else if ($onepage) {
$multipage=false;
} else { // if onepage is set to false
- $multilpage=true;
+ $multilpage=true;
}
// adjust the width for the report for students
$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);
// 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."\">";
"cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">";
if (isteacher($course->id)) {
echo "<tr><th valign=\"top\" align=\"right\" colspan=\"3\" nowrap class=\"generaltableheader\">".
- " </th>\n";
+ " </th>\n";
}
// $minpage=0;$maxpage=$numatt;
// print the date headings at the top of the table
// 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) {
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\"> </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\"> </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:
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");
}
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";
}
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";
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)."\"><</a> \n";
- "<a href=\"viewweek.php?scope=".$scope."&id=".$id ."&pagereport=1&page=1\"><<</a></th>\n";
- } else {
+ "<a href=\"viewweek.php?scope=".$scope."&id=".$id ."&pagereport=1&page=".($page-1)."\"><</a> \n";
+ "<a href=\"viewweek.php?scope=".$scope."&id=".$id ."&pagereport=1&page=1\"><<</a></th>\n";
+ } else {
echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\"><< <</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)."\">></a> ".
"<a href=\"viewweek.php?scope=".$scope."&id=".$id ."&pagereport=1&page=$maxpages\">>></a></th>";
- } else {
+ } else {
echo "<th valign=\"top\" align=\"right\" nowrap class=\"generaltableheader\">> >></th>\n";
- }
- echo "</tr></table></td></tr></table></center>\n";
+ }
+ echo "</tr></table></td></tr></table></center>\n";
}
}
/// 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, " ",
navmenu($course, $cm));
}
/// Print the header
- if ($course->category) {
- $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
- }
-
- print_header("$course->shortname: $strchats", "$course->fullname", "$navigation $strchats", "", "", true, "", navmenu($course));
+ print_header_simple($strchats, "", $strchats, "", "", true, "", navmenu($course));
/// Get all the appropriate data
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");
$strchat = get_string("modulename", "chat");
$strchatreport = get_string("chatreport", "chat");
$groupparam = "";
}
- print_header("$course->shortname: $chat->name: $strchatreport", "$course->fullname",
- "$navigation <a href=\"index.php?id=$course->id\">$strchats</a> ->
+ print_header_simple("$chat->name: $strchatreport", "",
+ "<a href=\"index.php?id=$course->id\">$strchats</a> ->
<a href=\"view.php?id=$cm->id\">$chat->name</a> ->
<a href=\"report.php?id=$cm->id\">$strchatreport</a>",
"", "", true, "", navmenu($course, $cm));
/// Print the Sessions display
- print_header("$course->shortname: $chat->name: $strchatreport", "$course->fullname",
- "$navigation <a href=\"index.php?id=$course->id\">$strchats</a> ->
+ print_header_simple("$chat->name: $strchatreport", "",
+ "<a href=\"index.php?id=$course->id\">$strchats</a> ->
<a href=\"view.php?id=$cm->id\">$chat->name</a> -> $strchatreport",
"", "", true, "", navmenu($course, $cm));
/// Print the page header
- if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
- }
-
$strchats = get_string("modulenameplural", "chat");
$strchat = get_string("modulename", "chat");
$strenterchat = get_string("enterchat", "chat");
$strcurrentusers = get_string("currentusers", "chat");
$strnextsession = get_string("nextsession", "chat");
- print_header("$course->shortname: $chat->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strchats</A> -> $chat->name",
+ print_header_simple("$chat->name", "",
+ "<A HREF=index.php?id=$course->id>$strchats</A> -> $chat->name",
"", "", true, update_module_button($cm->id, $course->id, $strchat),
navmenu($course, $cm));
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");
$strchoices = get_string("modulenameplural", "choice");
- print_header("$course->shortname: $strchoices", "$course->fullname",
- "$navigation $strchoices", "", "", true, "", navmenu($course));
+ print_header_simple("$strchoices", "",
+ "$strchoices", "", "", true, "", navmenu($course));
if (! $choices = get_all_instances_in_course("choice", $course)) {
add_to_log($course->id, "choice", "view", "view.php?id=$cm->id", $choice->id, $cm->id);
- if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
- } else {
- $navigation = "";
- }
- print_header("$course->shortname: $choice->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strchoices</A> -> $choice->name", "", "", true,
+ print_header_simple("$choice->name", "",
+ "<A HREF=index.php?id=$course->id>$strchoices</A> -> $choice->name", "", "", true,
update_module_button($cm->id, $course->id, $strchoice), navmenu($course, $cm));
/// Check to see if groups are being used in this choice
<?PHP // $Id$
/*************************************************
- ACTIONS handled are:
+ ACTIONS handled are:
closeconversation
- confirmclose
+ confirmclose
getsubject
- insertentries
- openconversation
+ insertentries
+ openconversation
printdialogue
showdialogues
updatesubject
-
+
************************************************/
require_once("../../config.php");
error("Course module dialogue is incorrect");
}
- require_login($course->id);
-
+ require_login($course->id);
+
// set up some general variables
$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");
$strdialogue = get_string("modulename", "dialogue");
- // ... print the header and...
- print_header("$course->shortname: $dialogue->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strdialogues</A> ->
+ // ... print the header and...
+ print_header_simple("$dialogue->name", "",
+ "<A HREF=index.php?id=$course->id>$strdialogues</A> ->
<A HREF=\"view.php?id=$cm->id\">$dialogue->name</A>",
"", "", true);
- require_variable($action); // need something to do!
-
- /************** close conversation ************************************/
- if ($action == 'closeconversation') {
- if (empty($_GET['cid'])) {
- error("Close dialogue: Missing conversation id");
- }
- else {
- $conversationid = $_GET['cid'];
- }
- if (!set_field("dialogue_conversations", "closed", 1, "id", $conversationid)) {
- error("Close dialogue: unable to set closed");
- }
- if (!set_field("dialogue_conversations", "lastid", $USER->id, "id", $conversationid)) {
- error("Close dialogue: unable to set lastid");
- }
+ require_variable($action); // need something to do!
+
+ /************** close conversation ************************************/
+ if ($action == 'closeconversation') {
+ if (empty($_GET['cid'])) {
+ error("Close dialogue: Missing conversation id");
+ }
+ else {
+ $conversationid = $_GET['cid'];
+ }
+ if (!set_field("dialogue_conversations", "closed", 1, "id", $conversationid)) {
+ error("Close dialogue: unable to set closed");
+ }
+ if (!set_field("dialogue_conversations", "lastid", $USER->id, "id", $conversationid)) {
+ error("Close dialogue: unable to set lastid");
+ }
$pane=$_GET['pane'];
- 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"));
- }
-
-
- /****************** confirm close ************************************/
- elseif ($action == 'confirmclose' ) {
+ 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"));
+ }
+
+
+ /****************** confirm close ************************************/
+ elseif ($action == 'confirmclose' ) {
- if (empty($_GET['cid'])) {
- error("Confirm Close: conversation id missing");
- }
- if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) {
- error("Confirm close: cannot get conversation record");
- }
- if ($conversation->userid == $USER->id) {
- if (!$user = get_record("user", "id", $conversation->recipientid)) {
- error("Confirm Close: cannot get recipient record");
- }
- }
- else {
- if (!$user = get_record("user", "id", $conversation->userid)) {
- error("Confirm Close: cannot get user record");
- }
- }
+ if (empty($_GET['cid'])) {
+ error("Confirm Close: conversation id missing");
+ }
+ if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) {
+ error("Confirm close: cannot get conversation record");
+ }
+ if ($conversation->userid == $USER->id) {
+ if (!$user = get_record("user", "id", $conversation->recipientid)) {
+ error("Confirm Close: cannot get recipient record");
+ }
+ }
+ else {
+ if (!$user = get_record("user", "id", $conversation->userid)) {
+ error("Confirm Close: cannot get user record");
+ }
+ }
$pane = $_GET['pane'];
- notice_yesno(get_string("confirmclosure", "dialogue", fullname($user)),
- "dialogues.php?action=closeconversation&id=$cm->id&cid=$conversation->id&pane=$pane",
- "view.php?id=$cm->id&pane=$pane");
- }
-
- /****************** get subject ************************************/
- elseif ($action == 'getsubject' ) {
+ notice_yesno(get_string("confirmclosure", "dialogue", fullname($user)),
+ "dialogues.php?action=closeconversation&id=$cm->id&cid=$conversation->id&pane=$pane",
+ "view.php?id=$cm->id&pane=$pane");
+ }
+
+ /****************** get subject ************************************/
+ elseif ($action == 'getsubject' ) {
- if (empty($_GET['cid'])) {
- error("Confirm Close: conversation id missing");
- }
+ if (empty($_GET['cid'])) {
+ error("Confirm Close: conversation id missing");
+ }
print_heading(get_string("addsubject", "dialogue"));
echo "<form name=\"getsubjectform\" method=\"post\" action=\"dialogues.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"updatesubject\">\n";
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"".
get_string("addsubject", "dialogue")."\"></td></tr>\n";
echo "</table></center></form>\n";
- }
-
-
- /****************** insert conversation entries ******************************/
- elseif ($action == 'insertentries' ) {
+ }
+
+
+ /****************** insert conversation entries ******************************/
+ elseif ($action == 'insertentries' ) {
- $timenow = time();
- $n = 0;
- // get all the open conversations for this user
- if ($conversations = dialogue_get_conversations($dialogue, $USER, "closed = 0")) {
- foreach ($conversations as $conversation) {
- $textarea_name = "reply$conversation->id";
+ $timenow = time();
+ $n = 0;
+ // get all the open conversations for this user
+ if ($conversations = dialogue_get_conversations($dialogue, $USER, "closed = 0")) {
+ foreach ($conversations as $conversation) {
+ $textarea_name = "reply$conversation->id";
$stripped_text = '';
if (isset($_POST[$textarea_name])) {
$stripped_text = strip_tags(trim($_POST[$textarea_name]));
}
- if ($stripped_text) {
+ if ($stripped_text) {
unset($item);
- $item->dialogueid = $dialogue->id;
- $item->conversationid = $conversation->id;
- $item->userid = $USER->id;
- $item->timecreated = time();
+ $item->dialogueid = $dialogue->id;
+ $item->conversationid = $conversation->id;
+ $item->userid = $USER->id;
+ $item->timecreated = time();
// reverse the dialogue mail default
- $item->mailed = !$dialogue->maildefault;
- $item->text = $_POST[$textarea_name];
- if (!$item->id = insert_record("dialogue_entries", $item)) {
- error("Insert Entries: Could not insert dialogue record!");
- }
- if (!set_field("dialogue_conversations", "lastid", $USER->id, "id", $conversation->id)) {
- error("Insert Dialogue Entries: could not set lastid");
- }
- if (!set_field("dialogue_conversations", "timemodified", $timenow, "id",
+ $item->mailed = !$dialogue->maildefault;
+ $item->text = $_POST[$textarea_name];
+ if (!$item->id = insert_record("dialogue_entries", $item)) {
+ error("Insert Entries: Could not insert dialogue record!");
+ }
+ if (!set_field("dialogue_conversations", "lastid", $USER->id, "id", $conversation->id)) {
+ error("Insert Dialogue Entries: could not set lastid");
+ }
+ if (!set_field("dialogue_conversations", "timemodified", $timenow, "id",
$conversation->id)) {
- error("Insert Dialogue Entries: could not set lastid");
- }
+ error("Insert Dialogue Entries: could not set lastid");
+ }
// reset seenon time
- if (!set_field("dialogue_conversations", "seenon", 0, "id",
+ if (!set_field("dialogue_conversations", "seenon", 0, "id",
$conversation->id)) {
- error("Insert Dialogue Entries: could not reset seenon");
- }
- add_to_log($course->id, "dialogue", "add entry", "view.php?id=$cm->id", "$item->id");
- $n++;
- }
- }
- }
- redirect("view.php?id=$cm->id&pane={$_POST['pane']}", get_string("numberofentriesadded",
+ error("Insert Dialogue Entries: could not reset seenon");
+ }
+ add_to_log($course->id, "dialogue", "add entry", "view.php?id=$cm->id", "$item->id");
+ $n++;
+ }
+ }
+ }
+ redirect("view.php?id=$cm->id&pane={$_POST['pane']}", get_string("numberofentriesadded",
"dialogue", $n));
- }
-
- /****************** list closed conversations *********************************/
- elseif ($action == 'listclosed') {
-
- echo "<center>\n";
- print_simple_box( text_to_html($dialogue->intro) , "center");
- echo "<br />";
-
- dialogue_list_closed_conversations($dialogue);
- }
-
- /****************** open conversation ************************************/
- elseif ($action == 'openconversation' ) {
+ }
+
+ /****************** list closed conversations *********************************/
+ elseif ($action == 'listclosed') {
+
+ echo "<center>\n";
+ print_simple_box( text_to_html($dialogue->intro) , "center");
+ echo "<br />";
+
+ dialogue_list_closed_conversations($dialogue);
+ }
+
+ /****************** open conversation ************************************/
+ elseif ($action == 'openconversation' ) {
- if (empty($_POST['recipientid'])) {
- redirect("view.php?id=$cm->id", get_string("nopersonchosen", "dialogue"));
+ if (empty($_POST['recipientid'])) {
+ redirect("view.php?id=$cm->id", get_string("nopersonchosen", "dialogue"));
} else {
$recipientid = $_POST['recipientid'];
if (substr($recipientid, 0, 1) == 'g') { // it's a group
}
redirect("view.php?id=$cm->id", get_string("dialogueopened", "dialogue", fullname($user) ));
}
- }
- }
-
+ }
+ }
+
/****************** print dialogue (allowing new entry)********************/
- elseif ($action == 'printdialogue') {
-
- if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) {
- error("Print Dialogue: can not get conversation record");
- }
-
- echo "<center>\n";
- print_simple_box( text_to_html($dialogue->intro) , "center");
- echo "<br />";
-
- dialogue_print_conversation($dialogue, $conversation);
- }
-
+ elseif ($action == 'printdialogue') {
+
+ if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) {
+ error("Print Dialogue: can not get conversation record");
+ }
+
+ echo "<center>\n";
+ print_simple_box( text_to_html($dialogue->intro) , "center");
+ echo "<br />";
+
+ dialogue_print_conversation($dialogue, $conversation);
+ }
+
/****************** show dialogues ****************************************/
- elseif ($action == 'showdialogues') {
-
- if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) {
- error("Show Dialogue: can not get conversation record");
- }
-
- echo "<center>\n";
- print_simple_box( text_to_html($dialogue->intro) , "center");
- echo "<br />";
-
- dialogue_show_conversation($dialogue, $conversation);
- dialogue_show_other_conversations($dialogue, $conversation);
- }
-
+ elseif ($action == 'showdialogues') {
+
+ if (!$conversation = get_record("dialogue_conversations", "id", $_GET['cid'])) {
+ error("Show Dialogue: can not get conversation record");
+ }
+
+ echo "<center>\n";
+ print_simple_box( text_to_html($dialogue->intro) , "center");
+ echo "<br />";
+
+ dialogue_show_conversation($dialogue, $conversation);
+ dialogue_show_other_conversations($dialogue, $conversation);
+ }
+
/****************** update subject ****************************************/
- elseif ($action == 'updatesubject') {
-
- if (!$conversation = get_record("dialogue_conversations", "id", $_POST['cid'])) {
- error("Update Subject: can not get conversation record");
- }
-
+ elseif ($action == 'updatesubject') {
+
+ if (!$conversation = get_record("dialogue_conversations", "id", $_POST['cid'])) {
+ error("Update Subject: can not get conversation record");
+ }
+
if (!$_POST['subject']) {
redirect("view.php?id=$cm->id&pane=$_POST[pane]", get_string("nosubject", "dialogue"));
} elseif (!set_field("dialogue_conversations", "subject", $_POST['subject'], "id", $_POST['cid'])) {
error("Update subject: could not update conversation record");
}
redirect("view.php?id=$cm->id&pane=$_POST[pane]", get_string("subjectadded", "dialogue"));
- }
-
+ }
+
- /*************** no man's land **************************************/
- else {
- error("Fatal Error: Unknown Action: ".$action."\n");
- }
+ /*************** no man's land **************************************/
+ else {
+ error("Fatal Error: Unknown Action: ".$action."\n");
+ }
print_footer($course);
require_login($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");
$strdialogues = get_string("modulenameplural", "dialogue");
$strname = get_string("name");
$stropendialogues = get_string("open", "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));
if (!$cm = get_coursemodule_from_instance("dialogue", $dialogue->id, $course->id)) {
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));
}
echo "<br />";
// set up some general variables
$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");
$strdialogues = get_string("modulenameplural", "dialogue");
- print_header("$course->shortname: $dialogue->name", "$course->fullname",
- "$navigation <a href=\"index.php?id=$course->id\">$strdialogues</a> -> $dialogue->name",
+ print_header_simple("$dialogue->name", "",
+ "<a href=\"index.php?id=$course->id\">$strdialogues</a> -> $dialogue->name",
"", "", true,
update_module_button($cm->id, $course->id, $strdialogue), navmenu($course, $cm));
- // ...and if necessary set default action
-
- optional_variable($action);
-
- if (!isguest()) { // it's a teacher or student
- if (!$cm->visible and isstudent($course->id)) {
- $action = 'notavailable';
- }
- if (empty($action)) {
- $action = 'view';
- }
- }
- else { // it's a guest, oh no!
- $action = 'notavailable';
- }
-
+ // ...and if necessary set default action
+
+ optional_variable($action);
+
+ if (!isguest()) { // it's a teacher or student
+ if (!$cm->visible and isstudent($course->id)) {
+ $action = 'notavailable';
+ }
+ if (empty($action)) {
+ $action = 'view';
+ }
+ }
+ else { // it's a guest, oh no!
+ $action = 'notavailable';
+ }
+
/*********************** dialogue not available (for gusets mainly)***********************/
- if ($action == 'notavailable') {
- print_heading(get_string("notavailable", "dialogue"));
- }
+ if ($action == 'notavailable') {
+ print_heading(get_string("notavailable", "dialogue"));
+ }
- /************ view **************************************************/
- elseif ($action == 'view') {
-
- print_simple_box( format_text($dialogue->intro) , "center");
- echo "<br />";
- // get some stats
+ /************ view **************************************************/
+ elseif ($action == 'view') {
+
+ print_simple_box( format_text($dialogue->intro) , "center");
+ echo "<br />";
+ // get some stats
$countneedingrepliesself = dialogue_count_needing_replies_self($dialogue, $USER);
$countneedingrepliesother = dialogue_count_needing_replies_other($dialogue, $USER);
$countclosed = dialogue_count_closed($dialogue, $USER);
echo "<br/><center>\n";
- switch ($pane) {
+ switch ($pane) {
case 0:
if (isteacher($course->id)) {
/// Check to see if groups are being used in this dialogue
}
if ($names = dialogue_get_available_users($dialogue)) {
- print_simple_box_start("center");
- echo "<center>";
- 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=\"action\" value=\"openconversation\">\n";
- echo "<table border=\"0\"><tr>\n";
+ print_simple_box_start("center");
+ echo "<center>";
+ 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=\"action\" value=\"openconversation\">\n";
+ echo "<table border=\"0\"><tr>\n";
echo "<td align=\"right\"><b>".get_string("openadialoguewith", "dialogue").
" : </b></td>\n";
- echo "<td>";
+ echo "<td>";
choose_from_menu($names, "recipientid");
echo "</td></tr>\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\"
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";
- echo "<tr><td valign=\"top\" align=\"right\">\n";
- helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
- echo "<br />";
- echo "</td><td>\n";
+ echo "<tr><td valign=\"top\" align=\"right\">\n";
+ helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
+ echo "<br />";
+ echo "</td><td>\n";
print_textarea($usehtmleditor, 20, 75, 630, 300, "firstentry");
use_html_editor();
- echo "</td></tr>";
- echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"".
+ echo "</td></tr>";
+ echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"".
get_string("opendialogue","dialogue")."\"></td></tr>\n";
- echo "</table></form>\n";
- echo "</center>";
- print_simple_box_end();
- } else {
+ echo "</table></form>\n";
+ echo "</center>";
+ print_simple_box_end();
+ } else {
print_heading(get_string("noavailablepeople", "dialogue"));
print_continue("view.php?id=$cm->id");
}
break;
case 1:
// print active conversations requiring a reply
- dialogue_list_conversations_self($dialogue, $USER);
+ dialogue_list_conversations_self($dialogue, $USER);
break;
case 2:
// print active conversations requiring a reply from the other person.
- dialogue_list_conversations_other($dialogue, $USER);
+ dialogue_list_conversations_other($dialogue, $USER);
break;
case 3:
- dialogue_list_conversations_closed($dialogue, $USER);
- }
- }
-
- /*************** no man's land **************************************/
- else {
- error("Fatal Error: Unknown Action: ".$action."\n");
- }
+ dialogue_list_conversations_closed($dialogue, $USER);
+ }
+ }
+
+ /*************** no man's land **************************************/
+ else {
+ error("Fatal Error: Unknown Action: ".$action."\n");
+ }
print_footer($course);
exercise_add_custom_scales($exercise);
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");
$strexercise = get_string("modulename", "exercise");
$strassessments = get_string("assessments", "exercise");
// ... print the header and...
- print_header("$course->shortname: $exercise->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strexercises</A> ->
+ print_header_simple("$exercise->name", "",
+ "<A HREF=index.php?id=$course->id>$strexercises</A> ->
<A HREF=\"view.php?id=$cm->id\">$exercise->name</A> -> $strassessments",
"", "", true);
require_login($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");
$strexercise = get_string("modulename", "exercise");
$strweek = get_string("week");
$strtopic = get_string("topic");
$strname = get_string("name");
- $strtitle = get_string("title", "exercise");
+ $strtitle = get_string("title", "exercise");
$strphase = get_string("phase", "exercise");
$strgrade = get_string("grade");
$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)) {
notice("There are no exercises", "../../course/view.php?id=$course->id");
}
foreach ($exercises as $exercise) {
- if ($exercise->deadline > $timenow) {
+ if ($exercise->deadline > $timenow) {
$due = userdate($exercise->deadline);
} else {
$due = "<FONT COLOR=\"red\">".userdate($exercise->deadline)."</FONT>";
}
if ($submissions = exercise_get_user_submissions($exercise, $USER)) {
foreach ($submissions as $submission) {
- if ($submission->late) {
- $submitted = "<FONT COLOR=\"red\">".userdate($submission->timecreated)."</FONT>";
- }
- else {
- $submitted = userdate($submission->timecreated);
- }
- $link = "<A HREF=\"view.php?id=$exercise->coursemodule\">$exercise->name</A>";
- $title = $submission->title;
- if ($course->format == "weeks" or $course->format == "topics") {
+ if ($submission->late) {
+ $submitted = "<FONT COLOR=\"red\">".userdate($submission->timecreated)."</FONT>";
+ }
+ else {
+ $submitted = userdate($submission->timecreated);
+ }
+ $link = "<A HREF=\"view.php?id=$exercise->coursemodule\">$exercise->name</A>";
+ $title = $submission->title;
+ if ($course->format == "weeks" or $course->format == "topics") {
if (isteacher($course->id)) {
$phase = '';
switch ($exercise->phase) {
}
break;
}
- $table->data[] = array ($exercise->section, $link, $title, $phase,
+ $table->data[] = array ($exercise->section, $link, $title, $phase,
$submitted, $due);
} else { // it's a student
if ($assessments = exercise_get_user_assessments($exercise, $USER)) { // should be only one...
$submitted, $due);
}
} else {
- $table->data[] = array ($exercise->section, $link, $title,
+ $table->data[] = array ($exercise->section, $link, $title,
"-", $submitted, $due);
}
}
- }
+ }
} else {
- $table->data[] = array ($link, $submitted, $due);
- }
- }
- } else {
+ $table->data[] = array ($link, $submitted, $due);
+ }
+ }
+ } else {
$submitted = get_string("no");
- $title = '';
- $link = "<A HREF=\"view.php?id=$exercise->coursemodule\">$exercise->name</A>";
- if ($course->format == "weeks" or $course->format == "topics") {
+ $title = '';
+ $link = "<A HREF=\"view.php?id=$exercise->coursemodule\">$exercise->name</A>";
+ if ($course->format == "weeks" or $course->format == "topics") {
if (isteacher($course->id)) {
- $table->data[] = array ($exercise->section, $link, $title, $exercise->phase,
+ $table->data[] = array ($exercise->section, $link, $title, $exercise->phase,
$submitted, $due);
} else {
- $table->data[] = array ($exercise->section, $link, $title, "-", $submitted, $due);
- }
+ $table->data[] = array ($exercise->section, $link, $title, "-", $submitted, $due);
+ }
} else {
- $table->data[] = array ($link, $submitted, $due);
- }
- }
- }
+ $table->data[] = array ($link, $submitted, $due);
+ }
+ }
+ }
echo "<BR>";
print_table($table);
require_login($course->id);
- if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
- }
-
$strexercises = get_string("modulenameplural", "exercise");
$strexercise = get_string("modulename", "exercise");
$strsubmissions = get_string("submissions", "exercise");
// ... print the header and...
- print_header("$course->shortname: $exercise->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strexercises</A> ->
+ print_header_simple("$exercise->name", "",
+ "$<A HREF=index.php?id=$course->id>$strexercises</A> ->
<A HREF=\"view.php?id=$cm->id\">$exercise->name</A> -> $strsubmissions",
"", "", true);
$newfile = $HTTP_POST_FILES["newfile"];
// get some esential stuff...
- if (! $cm = get_record("course_modules", "id", $id)) {
- error("Course Module ID was incorrect");
- }
+ if (! $cm = get_record("course_modules", "id", $id)) {
+ error("Course Module ID was incorrect");
+ }
- if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
- }
+ if (! $course = get_record("course", "id", $cm->course)) {
+ error("Course is misconfigured");
+ }
- if (! $exercise = get_record("exercise", "id", $cm->instance)) {
- error("Course module is incorrect");
- }
+ if (! $exercise = get_record("exercise", "id", $cm->instance)) {
+ error("Course module is incorrect");
+ }
require_login($course->id);
- if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
- }
$strexercises = get_string("modulenameplural", "exercise");
$strexercise = get_string("modulename", "exercise");
$strupload = get_string("upload");
- print_header("$course->shortname: $exercise->name : $strupload", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strexercises</A> ->
+ print_header_simple("$exercise->name : $strupload", "",
+ "<A HREF=index.php?id=$course->id>$strexercises</A> ->
<A HREF=\"view.php?id=$cm->id\">$exercise->name</A> -> $strupload",
"", "", true);
// check existence of title
if (!$title = $_POST['title']) {
- notify(get_string("notitlegiven", "exercise") );
- }
- else {
- if (is_uploaded_file($newfile['tmp_name']) and $newfile['size'] > 0) {
- if ($newfile['size'] > $exercise->maxbytes) {
- notify(get_string("uploadfiletoobig", "assignment", $exercise->maxbytes));
- }
- else {
- $newfile_name = clean_filename($newfile['name']);
- if ($newfile_name) {
- $newsubmission->exerciseid = $exercise->id;
- if (isteacher($course->id)) {
- // it's an exercise submission, flag it as such
- $newsubmission->userid = 0;
- $newsubmission->isexercise = 1; // it's a description of an exercise
- }
- else {
- $newsubmission->userid = $USER->id;
- }
- $newsubmission->title = $title;
- $newsubmission->timecreated = $timenow;
+ notify(get_string("notitlegiven", "exercise") );
+ }
+ else {
+ if (is_uploaded_file($newfile['tmp_name']) and $newfile['size'] > 0) {
+ if ($newfile['size'] > $exercise->maxbytes) {
+ notify(get_string("uploadfiletoobig", "assignment", $exercise->maxbytes));
+ }
+ else {
+ $newfile_name = clean_filename($newfile['name']);
+ if ($newfile_name) {
+ $newsubmission->exerciseid = $exercise->id;
+ if (isteacher($course->id)) {
+ // it's an exercise submission, flag it as such
+ $newsubmission->userid = 0;
+ $newsubmission->isexercise = 1; // it's a description of an exercise
+ }
+ else {
+ $newsubmission->userid = $USER->id;
+ }
+ $newsubmission->title = $title;
+ $newsubmission->timecreated = $timenow;
if ($timenow > $exercise->deadline) {
$newsubmission->late = 1;
}
- if (!$newsubmission->id = insert_record("exercise_submissions", $newsubmission)) {
- error("exercise upload: Failure to create new submission record!");
- }
- 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");
- }
- if (move_uploaded_file($newfile['tmp_name'], "$dir/$newfile_name")) {
+ if (!$newsubmission->id = insert_record("exercise_submissions", $newsubmission)) {
+ error("exercise upload: Failure to create new submission record!");
+ }
+ 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");
+ }
+ if (move_uploaded_file($newfile['tmp_name'], "$dir/$newfile_name")) {
add_to_log($course->id, "exercise", "submit", "view.php?id=$cm->id", "$exercise->id");
- print_heading(get_string("uploadsuccess", "assignment", $newfile_name) );
- }
- else {
- notify(get_string("uploaderror", "assignment") );
- }
- // clear resubmit flags
- if (!set_field("exercise_submissions", "resubmit", 0, "exerciseid", $exercise->id, "userid", $USER->id)) {
- error("Exercise Upload: unable to reset resubmit flag");
- }
- }
- else {
- notify(get_string("uploadbadname", "assignment") );
- }
- }
- }
- elseif (!is_uploaded_file($newfile['tmp_name']) and !$newfile['size'] > 0 and $newfile['name']) {
- notify(get_string("uploadfiletoobig", "assignment", $exercise->maxbytes));
+ print_heading(get_string("uploadsuccess", "assignment", $newfile_name) );
+ }
+ else {
+ notify(get_string("uploaderror", "assignment") );
+ }
+ // clear resubmit flags
+ if (!set_field("exercise_submissions", "resubmit", 0, "exerciseid", $exercise->id, "userid", $USER->id)) {
+ error("Exercise Upload: unable to reset resubmit flag");
+ }
+ }
+ else {
+ notify(get_string("uploadbadname", "assignment") );
+ }
+ }
+ }
+ elseif (!is_uploaded_file($newfile['tmp_name']) and !$newfile['size'] > 0 and $newfile['name']) {
+ notify(get_string("uploadfiletoobig", "assignment", $exercise->maxbytes));
} else {
- notify(get_string("uploadnofilefound", "assignment"));
- }
+ notify(get_string("uploadnofilefound", "assignment"));
+ }
}
print_continue("view.php?id=$cm->id");
<?PHP // $Id: view.php, v1.1 23 Aug 2003
/*************************************************
- ACTIONS handled are:
+ ACTIONS handled are:
- displayfinalgrade (for students)
- makeleaguetableavailable (for teachers)
- notavailable (for students)
- openexercise (for teachers)
- setupassignment (for teachers)
+ displayfinalgrade (for students)
+ makeleaguetableavailable (for teachers)
+ notavailable (for students)
+ openexercise (for teachers)
+ setupassignment (for teachers)
showsubmissions (for students)
- studentsview
- submitassignment
- teachersview
-
+ studentsview
+ submitassignment
+ teachersview
+
************************************************/
- require("../../config.php");
+ require("../../config.php");
require("lib.php");
require("locallib.php");
-
- require_variable($id); // Course Module ID
+
+ require_variable($id); // Course Module ID
// get some esential stuff...
- if (! $cm = get_record("course_modules", "id", $id)) {
- error("Course Module ID was incorrect");
- }
+ if (! $cm = get_record("course_modules", "id", $id)) {
+ error("Course Module ID was incorrect");
+ }
- if (! $course = get_record("course", "id", $cm->course)) {
- error("Course is misconfigured");
- }
+ if (! $course = get_record("course", "id", $cm->course)) {
+ error("Course is misconfigured");
+ }
- if (! $exercise = get_record("exercise", "id", $cm->instance)) {
- error("Course module is incorrect");
- }
+ if (! $exercise = get_record("exercise", "id", $cm->instance)) {
+ error("Course module is incorrect");
+ }
require_login($course->id);
// ...log activity...
- 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> ->";
- }
+ add_to_log($course->id, "exercise", "view", "view.php?id=$cm->id", $exercise->id, $cm->id);
$strexercises = get_string("modulenameplural", "exercise");
$strexercise = get_string("modulename", "exercise");
// ...display header...
- print_header("$course->shortname: $exercise->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strexercises</A> -> $exercise->name",
+ print_header_simple("$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));
- // ...and if necessary set default action
-
- optional_variable($action);
+ // ...and if necessary set default action
+
+ optional_variable($action);
if (isteacher($course->id)) {
- if (empty($action)) { // no action specified, either go straight to elements page else the admin page
- // has the assignment any elements
- if (count_records("exercise_elements", "exerciseid", $exercise->id)) {
- $action = "teachersview";
- }
- else {
- redirect("assessments.php?action=editelements&id=$cm->id");
- }
- }
- }
- elseif (!isguest()) { // it's a student then
- if (!$cm->visible) {
- notice(get_string("activityiscurrentlyhidden"));
- }
- switch ($exercise->phase) {
- case 0 :
- case 1 : $action = 'notavailable'; break;
- case 2 : $action = 'studentsview'; break;
- case 3 : $action = 'displayfinalgrade';
- }
- }
- else { // it's a guest, oh no!
- $action = 'notavailable';
- }
-
-
- /****************** display final grade (for students) ************************************/
+ if (empty($action)) { // no action specified, either go straight to elements page else the admin page
+ // has the assignment any elements
+ if (count_records("exercise_elements", "exerciseid", $exercise->id)) {
+ $action = "teachersview";
+ }
+ else {
+ redirect("assessments.php?action=editelements&id=$cm->id");
+ }
+ }
+ }
+ elseif (!isguest()) { // it's a student then
+ if (!$cm->visible) {
+ notice(get_string("activityiscurrentlyhidden"));
+ }
+ switch ($exercise->phase) {
+ case 0 :
+ case 1 : $action = 'notavailable'; break;
+ case 2 : $action = 'studentsview'; break;
+ case 3 : $action = 'displayfinalgrade';
+ }
+ }
+ else { // it's a guest, oh no!
+ $action = 'notavailable';
+ }
+
+
+ /****************** display final grade (for students) ************************************/
if ($action == 'displayfinalgrade' ) {
- // show the final grades as stored in the tables...
- print_heading(get_string("displayoffinalgrades", "exercise"));
- if ($submissions = exercise_get_user_submissions($exercise, $USER)) { // any submissions from user?
- 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\" 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("overallgrade", "exercise")."</b></td></TR>\n";
- // now the weights
- 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->grade</b></td>\n";
- echo "<td bgcolor=\"$THEME->cellheading2\"><b> </b></td></TR>\n";
- // first get user's own assessment reord, it should contain their grading grade
- if ($ownassessments = exercise_get_user_assessments($exercise, $USER)) {
- foreach ($ownassessments as $ownassessment) {
- break; // there should only be one
- }
- }
- else {
- $ownassessment->gradinggrade = 0;
- }
- foreach ($submissions as $submission) {
- if ($assessments = exercise_get_assessments($submission)) {
- foreach ($assessments as $assessment) { // (normally there should only be one
+ // show the final grades as stored in the tables...
+ print_heading(get_string("displayoffinalgrades", "exercise"));
+ if ($submissions = exercise_get_user_submissions($exercise, $USER)) { // any submissions from user?
+ 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\" 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("overallgrade", "exercise")."</b></td></TR>\n";
+ // now the weights
+ 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->grade</b></td>\n";
+ echo "<td bgcolor=\"$THEME->cellheading2\"><b> </b></td></TR>\n";
+ // first get user's own assessment reord, it should contain their grading grade
+ if ($ownassessments = exercise_get_user_assessments($exercise, $USER)) {
+ foreach ($ownassessments as $ownassessment) {
+ break; // there should only be one
+ }
+ }
+ else {
+ $ownassessment->gradinggrade = 0;
+ }
+ foreach ($submissions as $submission) {
+ if ($assessments = exercise_get_assessments($submission)) {
+ foreach ($assessments as $assessment) { // (normally there should only be one
$gradinggrade = number_format($ownassessment->gradinggrade * $exercise->gradinggrade / 100.0,
1);
$grade = number_format($assessment->grade * $exercise->grade / 100.0, 1);
$grade = "<font color=\"red\">(".$grade.")</font>";
$overallgrade = "<font color=\"red\">(".$overallgrade.")</font>";
}
- echo "<TR><td>".exercise_print_submission_title($exercise, $submission)."</td>\n";
- echo "<td align=\"center\">$gradinggrade</td>";
- echo "<td align=\"center\">$grade</td>";
- echo "<td align=\"center\">$overallgrade</td></TR>\n";
- }
- }
- }
- }
- echo "</TABLE><BR CLEAR=ALL>\n";
- if ($exercise->showleaguetable) {
+ echo "<TR><td>".exercise_print_submission_title($exercise, $submission)."</td>\n";
+ echo "<td align=\"center\">$gradinggrade</td>";
+ echo "<td align=\"center\">$grade</td>";
+ echo "<td align=\"center\">$overallgrade</td></TR>\n";
+ }
+ }
+ }
+ }
+ echo "</TABLE><BR CLEAR=ALL>\n";
+ if ($exercise->showleaguetable) {
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)**************/
- elseif ($action == 'makeleaguetableavailable') {
+ /****************** make final grades available (for teachers only)**************/
+ elseif ($action == 'makeleaguetableavailable') {
- if (!isteacheredit($course->id)) {
- error("Only teachers with editing permissions can do this.");
- }
+ if (!isteacheredit($course->id)) {
+ error("Only teachers with editing permissions can do this.");
+ }
- set_field("exercise", "phase", 3, "id", "$exercise->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));
- }
-
-
- /*********************** assignment not available (for students)***********************/
- elseif ($action == 'notavailable') {
- print_heading(get_string("notavailable", "exercise"));
- }
+ set_field("exercise", "phase", 3, "id", "$exercise->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));
+ }
+
+
+ /*********************** assignment not available (for students)***********************/
+ elseif ($action == 'notavailable') {
+ print_heading(get_string("notavailable", "exercise"));
+ }
- /****************** open exercise for student assessments and submissions (phase 2) (for teachers)**/
- elseif ($action == 'openexercise') {
+ /****************** open exercise for student assessments and submissions (phase 2) (for teachers)**/
+ elseif ($action == 'openexercise') {
- if (!isteacheredit($course->id)) {
- error("Only teachers with editing permissions can do this.");
- }
+ if (!isteacheredit($course->id)) {
+ error("Only teachers with editing permissions can do this.");
+ }
- // move to phase 2, check that teacher has made enough submissions
- if (exercise_count_teacher_submissions($exercise) == 0) {
- redirect("view.php?id=$cm->id", get_string("noexercisedescriptionssubmitted", "exercise"));
- }
- elseif (($exercise->gradingstrategy == 3) and ($exercise->nelements ==1 )) {
+ // move to phase 2, check that teacher has made enough submissions
+ if (exercise_count_teacher_submissions($exercise) == 0) {
+ redirect("view.php?id=$cm->id", get_string("noexercisedescriptionssubmitted", "exercise"));
+ }
+ elseif (($exercise->gradingstrategy == 3) and ($exercise->nelements ==1 )) {
// only one criterion specified
redirect("view.php?id=$cm->id", get_string("numberofcriterionelements", "exercise"));
} else {
- set_field("exercise", "phase", 2, "id", "$exercise->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));
- }
- }
-
-
- /****************** set up assignment (move back to phase 1) (for teachers)***********************/
- elseif ($action == 'setupassignment') {
-
- if (!isteacher($course->id)) {
- error("Only teachers with editing permissions can do this.");
- }
-
- 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);
- redirect("view.php?id=$cm->id", get_string("movingtophase", "exercise", 1));
- }
-
-
- /****************** showsubmissions (for students, in phase 3)***********************/
- elseif ($action == 'showsubmissions') {
- exercise_print_assignment_info($exercise);
+ set_field("exercise", "phase", 2, "id", "$exercise->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));
+ }
+ }
+
+
+ /****************** set up assignment (move back to phase 1) (for teachers)***********************/
+ elseif ($action == 'setupassignment') {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers with editing permissions can do this.");
+ }
+
+ 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);
+ redirect("view.php?id=$cm->id", get_string("movingtophase", "exercise", 1));
+ }
+
+
+ /****************** showsubmissions (for students, in phase 3)***********************/
+ elseif ($action == 'showsubmissions') {
+ exercise_print_assignment_info($exercise);
print_heading(get_string("submissionsnowclosed", "exercise"));
- // show student's assessment (linked to the teacher's exercise/submission
- print_heading(get_string("yourassessment", "exercise"));
- exercise_list_teacher_submissions($exercise, $USER);
- echo "<hr size=\"1\" noshade>";
+ // show student's assessment (linked to the teacher's exercise/submission
+ print_heading(get_string("yourassessment", "exercise"));
+ exercise_list_teacher_submissions($exercise, $USER);
+ echo "<hr size=\"1\" noshade>";
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");
$table->head = array (get_string("submission", "exercise"), get_string("submitted", "exercise"),
get_string("assessed", "exercise"), get_string("grade"));
print_heading(get_string("pleasesubmityourwork", "exercise").":");
exercise_print_upload_form($exercise);
}
- echo "<hr size=\"1\" noshade>";
- }
-
-
- /****************** student's view could be in 1 of 3 stages ***********************/
- elseif ($action == 'studentsview') {
- exercise_print_assignment_info($exercise);
- // in Stage 1 - the student must make an assessment (linked to the teacher's exercise/submission
- if (!exercise_test_user_assessments($exercise, $USER)) {
- print_heading(get_string("pleaseviewtheexercise", "exercise", $course->teacher));
- exercise_list_teacher_submissions($exercise, $USER);
- }
- // in stage 2? - submit own first attempt
- else {
- // show assessment the teacher's examples, there may be feedback from teacher
- if (exercise_count_user_submissions($exercise, $USER) == 0) {
- print_heading(get_string("atthisstageyou", "exercise", $course->teacher));
- exercise_list_teacher_submissions($exercise, $USER, true); // true = allow re-assessing
- // print upload form
- print_heading(get_string("pleasesubmityourwork", "exercise").":");
- exercise_print_upload_form($exercise);
- }
- // in stage 3? - awaiting grading of assessment and assessment of work by teacher,
+ echo "<hr size=\"1\" noshade>";
+ }
+
+
+ /****************** student's view could be in 1 of 3 stages ***********************/
+ elseif ($action == 'studentsview') {
+ exercise_print_assignment_info($exercise);
+ // in Stage 1 - the student must make an assessment (linked to the teacher's exercise/submission
+ if (!exercise_test_user_assessments($exercise, $USER)) {
+ print_heading(get_string("pleaseviewtheexercise", "exercise", $course->teacher));
+ exercise_list_teacher_submissions($exercise, $USER);
+ }
+ // in stage 2? - submit own first attempt
+ else {
+ // show assessment the teacher's examples, there may be feedback from teacher
+ if (exercise_count_user_submissions($exercise, $USER) == 0) {
+ print_heading(get_string("atthisstageyou", "exercise", $course->teacher));
+ exercise_list_teacher_submissions($exercise, $USER, true); // true = allow re-assessing
+ // print upload form
+ print_heading(get_string("pleasesubmityourwork", "exercise").":");
+ exercise_print_upload_form($exercise);
+ }
+ // in stage 3? - awaiting grading of assessment and assessment of work by teacher,
// may resubmit if allowed
- else {
- exercise_list_teacher_submissions($exercise, $USER);
- echo "<hr size=\"1\" noshade>";
- print_heading(get_string("yoursubmission", "exercise"));
- exercise_list_user_submissions($exercise, $USER);
- if (exercise_test_for_resubmission($exercise, $USER)) {
- // if resubmission requested print upload form
- echo "<hr size=\"1\" noshade>";
- print_heading(get_string("pleasesubmityourwork", "exercise").":");
- exercise_print_upload_form($exercise);
- echo "<hr size=\"1\" noshade>";
- }
- }
- }
- }
-
-
- /****************** submission of assignment by teacher only***********************/
- elseif ($action == 'submitassignment') {
-
- if (!isteacheredit($course->id)) {
- error("Only teachers with editing permissions can do this.");
- }
-
- exercise_print_assignment_info($exercise);
-
- // list previous submissions from this user
- exercise_list_user_submissions($exercise, $USER);
-
- echo "<HR SIZE=1 NOSHADE>";
-
- // print upload form
- print_heading(get_string("submitexercisedescription", "exercise").":");
- exercise_print_upload_form($exercise);
- }
-
-
- /****************** teacher's view - display admin page (current phase options) ************/
- elseif ($action == 'teachersview') {
-
- if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
- }
+ else {
+ exercise_list_teacher_submissions($exercise, $USER);
+ echo "<hr size=\"1\" noshade>";
+ print_heading(get_string("yoursubmission", "exercise"));
+ exercise_list_user_submissions($exercise, $USER);
+ if (exercise_test_for_resubmission($exercise, $USER)) {
+ // if resubmission requested print upload form
+ echo "<hr size=\"1\" noshade>";
+ print_heading(get_string("pleasesubmityourwork", "exercise").":");
+ exercise_print_upload_form($exercise);
+ echo "<hr size=\"1\" noshade>";
+ }
+ }
+ }
+ }
+
+
+ /****************** submission of assignment by teacher only***********************/
+ elseif ($action == 'submitassignment') {
+
+ if (!isteacheredit($course->id)) {
+ error("Only teachers with editing permissions can do this.");
+ }
+
+ exercise_print_assignment_info($exercise);
+
+ // list previous submissions from this user
+ exercise_list_user_submissions($exercise, $USER);
+
+ echo "<HR SIZE=1 NOSHADE>";
+
+ // print upload form
+ print_heading(get_string("submitexercisedescription", "exercise").":");
+ exercise_print_upload_form($exercise);
+ }
+
+
+ /****************** teacher's view - display admin page (current phase options) ************/
+ elseif ($action == 'teachersview') {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can look at this page");
+ }
/// Check to see if groups are being used in this exercise
/// and if so, set $currentgroup to reflect the current group
print_group_menu($groups, $groupmode, $currentgroup, "view.php?id=$cm->id");
}
}
-
+
print_heading_with_help(get_string("managingassignment", "exercise"), "managing", "exercise");
-
- exercise_print_assignment_info($exercise);
- $tabs->names = array("1. ".get_string("phase1", "exercise"),
+
+ exercise_print_assignment_info($exercise);
+ $tabs->names = array("1. ".get_string("phase1", "exercise"),
"2. ".get_string("phase2", "exercise", $course->student),
- "3. ".get_string("phase3", "exercise", $course->student));
- $tabs->urls = array("view.php?id=$cm->id&action=setupassignment",
- "view.php?id=$cm->id&action=openexercise",
- "view.php?id=$cm->id&action=makeleaguetableavailable");
- if ($exercise->phase) { // phase 1 or more
- $tabs->highlight = $exercise->phase - 1;
- } else {
- $tabs->highlight = 0; // phase is zero
- }
- exercise_print_tabbed_heading($tabs);
+ "3. ".get_string("phase3", "exercise", $course->student));
+ $tabs->urls = array("view.php?id=$cm->id&action=setupassignment",
+ "view.php?id=$cm->id&action=openexercise",
+ "view.php?id=$cm->id&action=makeleaguetableavailable");
+ if ($exercise->phase) { // phase 1 or more
+ $tabs->highlight = $exercise->phase - 1;
+ } else {
+ $tabs->highlight = 0; // phase is zero
+ }
+ exercise_print_tabbed_heading($tabs);
- echo "<center>\n";
- switch ($exercise->phase) {
- case 0:
- case 1: // set up assignment
+ echo "<center>\n";
+ switch ($exercise->phase) {
+ case 0:
+ case 1: // set up assignment
if (isteacheredit($course->id)) {
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=editelements\">".
get_string("amendassessmentelements", "exercise")."</a></b> \n";
get_string("submitexercisedescription", "exercise")."</a></b> \n";
helpbutton("submissionofdescriptions", get_string("submitexercisedescription", "exercise"), "exercise");
}
- break;
-
- case 2: // submissions and assessments
- // just show student submissions link, the (self) assessments are show above the assessment form for
- // the submissions
- echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">".
- get_string("studentsubmissionsforassessment", "exercise",
- exercise_count_unassessed_student_submissions($exercise))."</a></b> \n";
- helpbutton("grading", get_string("studentsubmissionsforassessment", "exercise"),
+ break;
+
+ case 2: // submissions and assessments
+ // just show student submissions link, the (self) assessments are show above the assessment form for
+ // the submissions
+ echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">".
+ get_string("studentsubmissionsforassessment", "exercise",
+ exercise_count_unassessed_student_submissions($exercise))."</a></b> \n";
+ helpbutton("grading", get_string("studentsubmissionsforassessment", "exercise"),
"exercise");
- break;
-
- case 3: // show final grades
- echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">".
- get_string("studentsubmissionsforassessment", "exercise",
- exercise_count_unassessed_student_submissions($exercise))."</a></b> \n";
- helpbutton("grading", get_string("studentsubmissionsforassessment", "exercise"),
+ break;
+
+ case 3: // show final grades
+ echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">".
+ get_string("studentsubmissionsforassessment", "exercise",
+ exercise_count_unassessed_student_submissions($exercise))."</a></b> \n";
+ helpbutton("grading", get_string("studentsubmissionsforassessment", "exercise"),
"exercise");
- print_heading("<A HREF=\"submissions.php?id=$cm->id&action=displayfinalgrades\">".
- get_string("displayoffinalgrades", "exercise")."</A>");
- }
- print_heading("<A HREF=\"submissions.php?id=$cm->id&action=adminlist\">".
- get_string("administration")."</A>");
- }
-
-
- /*************** no man's land **************************************/
- else {
- error("Fatal Error: Unknown Action: ".$action."\n");
- }
-
- print_footer($course);
-
+ print_heading("<A HREF=\"submissions.php?id=$cm->id&action=displayfinalgrades\">".
+ get_string("displayoffinalgrades", "exercise")."</A>");
+ }
+ print_heading("<A HREF=\"submissions.php?id=$cm->id&action=adminlist\">".
+ get_string("administration")."</A>");
+ }
+
+
+ /*************** no man's land **************************************/
+ else {
+ error("Fatal Error: Unknown Action: ".$action."\n");
+ }
+
+ print_footer($course);
+
?>
$strsubscribers = get_string("subscribers", "forum");
$strforums = get_string("forums", "forum");
- if ($course->category) {
- $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
- <a href=\"index.php?id=$course->id\">$strforums</a> ->
+ $navigation = "<a href=\"index.php?id=$course->id\">$strforums</a> ->
<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));
/// Check to see if groups are being used in this forum
if ($course->category) {
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 (!isteacher($course->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));
if (!$cm->visible and !isteacher($course->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 ){
case "add":
$straction = get_string("addingcomment","glossary");
$strglossary = get_string("modulename", "glossary");
$strcomments = get_string("comments", "glossary");
- print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname",
- "$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,
+ print_header_simple(strip_tags("$glossary->name"), "",
+ "<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),
navmenu($course, $cm));
if ( $action == "delete" ) {
if ( $confirm ) {
- delete_records("glossary_comments","id", $cid);
+ delete_records("glossary_comments","id", $cid);
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center>" . get_string("commentdeleted","glossary") . "</center>";
} else {
- glossary_print_comment($course, $cm, $glossary, $entry, $comment);
+ glossary_print_comment($course, $cm, $glossary, $entry, $comment);
print_simple_box_start("center","40%", "#FFBBBB");
echo "<center><br>" . get_string("areyousuredeletecomment","glossary");
require_variable($id); // Course Module ID
require_variable($eid); // Entry ID
-
- global $THEME, $USER, $CFG;
+
+ global $THEME, $USER, $CFG;
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
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");
$strglossary = get_string("modulename", "glossary");
$strallcategories = get_string("allcategories", "glossary");
$strcomments = get_string("comments", "glossary");
$straddcomment = get_string("addcomment", "glossary");
- print_header(strip_tags("$course->shortname: $strcomments: $entry->concept"), "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> <A HREF=view.php?id=$cm->id>$glossary->name</a> -> $strcomments",
+ print_header_simple(strip_tags("$strcomments: $entry->concept"), "",
+ "<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),
navmenu($course, $cm));
print_heading(get_string('commentson','glossary')." <b>\"$entry->concept\"</b>");
- if ($glossary->allowcomments) {
+ if ($glossary->allowcomments) {
print_heading("<a href=\"comment.php?id=$cm->id&eid=$entry->id\">$straddcomment</a> <img title=\"$straddcomment\" src=\"comment.gif\" height=11 width=11 border=0>");
}
if ($comments = get_records("glossary_comments","entryid",$entry->id,"timemodified ASC")) {
foreach ($comments as $comment) {
- glossary_print_comment($course, $cm, $glossary, $entry, $comment);
+ glossary_print_comment($course, $cm, $glossary, $entry, $comment);
echo '<br />';
}
} else {
$entryfields = get_record("glossary_entries", "id", $entry);
$strareyousuredelete = get_string("areyousuredelete","glossary");
-
- if ($course->category) {
- $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",
+ print_header_simple("$glossary->name", "",
+ "<A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
/// 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
$entry = get_record("glossary_entries","id", $entry);
$entry->glossaryid = $entry->sourceglossaryid;
$entry->sourceglossaryid = 0;
if (! update_record("glossary_entries", $entry)) {
- error("Could not update your glossary");
+ error("Could not update your glossary");
}
} else {
delete_records("glossary_comments", "entryid",$entry->id);
delete_records("glossary_alias", "entryid", $entry->id);
delete_records("glossary_ratings", "entryid", $entry->id);
- delete_records("glossary_entries","id", $entry->id);
+ delete_records("glossary_entries","id", $entry->id);
}
add_to_log($course->id, "glossary", "delete entry", "view.php?id=$cm->id&mode=$prevmode&hook=$hook", $entry,$cm->id);
optional_variable($name); // confirm the action
$action = strtolower($action);
-
+
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
}
// 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");
$strglossary = get_string("modulename", "glossary");
- print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname",
- "$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"),
+ print_header_simple(strip_tags("$glossary->name"), "",
+ "<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),
navmenu($course, $cm));
$cat->usedynalink = $usedynalink;
if ( !update_record("glossary_categories", $cat) ) {
- error("Weird error. The category was not updated.");
- redirect("editcategories.php?id=$cm->id");
+ error("Weird error. The category was not updated.");
+ redirect("editcategories.php?id=$cm->id");
} else {
add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $hook,$cm->id);
}
} elseif ( $action == "delete" ) {
if ( $confirm ) {
- delete_records("glossary_entries_categories","categoryid", $hook);
+ delete_records("glossary_entries_categories","categoryid", $hook);
delete_records("glossary_categories","id", $hook);
-
- print_simple_box_start("center","40%", "#FFBBBB");
- echo "<center>" . get_string("categorydeleted","glossary") ."</center>";
- echo "</center>";
- print_simple_box_end();
-
- print_footer($course);
+
+ print_simple_box_start("center","40%", "#FFBBBB");
+ echo "<center>" . get_string("categorydeleted","glossary") ."</center>";
+ echo "</center>";
+ print_simple_box_end();
+
+ print_footer($course);
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 {
echo "<p align=\"center\">" . get_string("delete"). " " . get_string("category","glossary") . "<font size=\"3\">";
- print_simple_box_start("center","40%", "#FFBBBB");
- echo "<center><b>$category->name</b><br>";
-
- $num_entries = count_records("glossary_entries_categories","categoryid",$category->id);
+ print_simple_box_start("center","40%", "#FFBBBB");
+ echo "<center><b>$category->name</b><br>";
+
+ $num_entries = count_records("glossary_entries_categories","categoryid",$category->id);
if ( $num_entries ) {
print_string("deletingnoneemptycategory","glossary");
}
?>
<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=confirm value="1">
<input type="hidden" name=mode value="<?php echo $mode ?>">
$options = array ("id" => $id);
print_single_button("editcategories.php", $options, get_string("no") );
echo "</td></tr></table>";
- echo "</center>";
- print_simple_box_end();
+ echo "</center>";
+ print_simple_box_end();
}
}
} elseif ( $action == "add" ) {
if ( $dupcategory ) {
echo "<p align=\"center\">" . get_string("add"). " " . get_string("category","glossary") . "<font size=\"3\">";
- print_simple_box_start("center","40%", "#FFBBBB");
- echo "<center>" . get_string("duplicatedcategory","glossary") ."</center>";
- echo "</center>";
- print_simple_box_end();
-
- print_footer($course);
+ print_simple_box_start("center","40%", "#FFBBBB");
+ echo "<center>" . get_string("duplicatedcategory","glossary") ."</center>";
+ echo "</center>";
+ print_simple_box_end();
+
+ print_footer($course);
- redirect("editcategories.php?id=$cm->id&action=add&&name=$name");
+ redirect("editcategories.php?id=$cm->id&action=add&&name=$name");
} else {
$action = "";
$cat->glossaryid = $glossary->id;
if ( ! $cat->id = insert_record("glossary_categories", $cat) ) {
- error("Weird error. The category was not inserted.");
-
- redirect("editcategories.php?id=$cm->id");
+ error("Weird error. The category was not inserted.");
+
+ redirect("editcategories.php?id=$cm->id");
} else {
add_to_log($course->id, "glossary", "add category", "editcategories.php?id=$cm->id", $cat->id,$cm->id);
}
</td>
<td width="10%" align="center"><b>
<?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=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=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>";
?>
</b></td>
</tr>
<?PHP // $Id$
- require_once("../../config.php");
- require_once("lib.php");
-
- require_variable($id); // course module ID
- require_variable($entry); // Entry ID
- optional_variable($confirm); // confirmation
- optional_variable($mode);
- optional_variable($hook);
-
- global $THEME, $USER, $CFG;
-
- $PermissionGranted = 1;
-
- $cm = get_record("course_modules","id",$id);
- if ( ! $cm ) {
- $PermissionGranted = 0;
- } else {
- $mainglossary = get_record("glossary","course",$cm->course, "mainglossary",1);
- if ( ! $mainglossary ) {
- $PermissionGranted = 0;
- }
- }
-
- if ( !isteacher($cm->course) ) {
- $PermissionGranted = 0;
- error("You must be a teacher to use this page.");
- }
+ require_once("../../config.php");
+ require_once("lib.php");
+
+ require_variable($id); // course module ID
+ require_variable($entry); // Entry ID
+ optional_variable($confirm); // confirmation
+ optional_variable($mode);
+ optional_variable($hook);
+
+ global $THEME, $USER, $CFG;
+
+ $PermissionGranted = 1;
+
+ $cm = get_record("course_modules","id",$id);
+ if ( ! $cm ) {
+ $PermissionGranted = 0;
+ } else {
+ $mainglossary = get_record("glossary","course",$cm->course, "mainglossary",1);
+ if ( ! $mainglossary ) {
+ $PermissionGranted = 0;
+ }
+ }
+
+ if ( !isteacher($cm->course) ) {
+ $PermissionGranted = 0;
+ error("You must be a teacher to use this page.");
+ }
if (! $course = get_record("course", "id", $cm->course)) {
error("Course is misconfigured");
$entryalreadyexist = get_string("entryalreadyexist","glossary");
$entryexported = get_string("entryexported","glossary");
- if ($course->category) {
- $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",
+ print_header_simple("$glossary->name", "",
+ "<A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
"", "", true, "",
navmenu($course, $cm));
- if ( $PermissionGranted ) {
- $entry = get_record("glossary_entries", "id", $entry);
+ if ( $PermissionGranted ) {
+ $entry = get_record("glossary_entries", "id", $entry);
- if ( !$confirm ) {
- echo "<center>";
+ if ( !$confirm ) {
+ echo "<center>";
$areyousure = get_string("areyousureexport","glossary");
- 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",
- "view.php?id=$cm->id&mode=$mode&hook=$hook" );
-
- } else {
- if ( ! $mainglossary->allowduplicatedentries ) {
- $dupentry = get_record("glossary_entries","glossaryid", $mainglossary->id, "UCASE(concept)",strtoupper($entry->concept));
- if ( $dupentry ) {
- $PermissionGranted = 0;
- }
- }
- if ( $PermissionGranted ) {
-
+ 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",
+ "view.php?id=$cm->id&mode=$mode&hook=$hook" );
+
+ } else {
+ if ( ! $mainglossary->allowduplicatedentries ) {
+ $dupentry = get_record("glossary_entries","glossaryid", $mainglossary->id, "UCASE(concept)",strtoupper($entry->concept));
+ if ( $dupentry ) {
+ $PermissionGranted = 0;
+ }
+ }
+ if ( $PermissionGranted ) {
+
$entry->glossaryid = $mainglossary->id;
$entry->sourceglossaryid = $glossary->id;
if (! update_record("glossary_entries", $entry)) {
- error("Could not export the entry to the main glossary");
- } else {
+ error("Could not export the entry to the main glossary");
+ } else {
print_simple_box_start("center", "60%", "$THEME->cellheading");
echo "<p align=center><font size=3>$entryexported</font></p></font>";
print_continue("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
print_simple_box_end();
- print_footer();
+ print_footer();
- redirect("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
- die;
- }
- } else {
- print_simple_box_start("center", "60%", "#FFBBBB");
- echo "<p align=center><font size=3>$entryalreadyexist</font></p></font>";
- echo "<p align=center>";
+ redirect("view.php?id=$cm->id&mode=entry&hook=".$entry->id);
+ die;
+ }
+ } else {
+ print_simple_box_start("center", "60%", "#FFBBBB");
+ echo "<p align=center><font size=3>$entryalreadyexist</font></p></font>";
+ 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();
- }
- }
- } else {
- print_simple_box_start("center", "60%", "#FFBBBB");
- notice("A weird error was found while trying to export this entry. Operation cancelled.");
+ print_simple_box_end();
+ }
+ }
+ } else {
+ print_simple_box_start("center", "60%", "#FFBBBB");
+ 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();
?>
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') {
$dest = 'current';
}
$strsearchindefinition = get_string("searchindefinition", "glossary");
$strsearch = get_string("search");
- print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
+ print_header_simple(strip_tags("$glossary->name"), "",
+ "<A HREF=index.php?id=$course->id>$strglossaries</A> -> $glossary->name",
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
navmenu($course, $cm));
/// Print the header
- if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
- }
-
- print_header("$course->shortname: $strglossarys", "$course->fullname", "$navigation $strglossarys", "", "", true, "", navmenu($course));
+ print_header_simple("$strglossarys", "", "$strglossarys", "", "", true, "", navmenu($course));
/// Get all the appropriate data
require_login($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");
$strjournals = get_string("modulenameplural", "journal");
$strweek = get_string("week");
$strtopic = get_string("topic");
- print_header("$course->shortname: $strjournals", "$course->fullname", "$navigation $strjournals",
+ print_header_simple("$strjournals", "", "$strjournals",
"", "", true, "", navmenu($course));
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");
$strjournals = get_string("modulenameplural", "journal");
- print_header("$course->shortname: $journal->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strjournals</A> -> $journal->name", "", "", true,
+ print_header_simple("$journal->name", "",
+ "<A HREF=index.php?id=$course->id>$strjournals</A> -> $journal->name", "", "", true,
update_module_button($cm->id, $course->id, $strjournal), navmenu($course, $cm));
if (isteacher($course->id)) {
/// Print the header
- if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
- }
-
- print_header("$course->shortname: $strlessons", "$course->fullname", "$navigation $strlessons", "", "", true, "", navmenu($course));
+ print_header_simple("$strlessons", "", "$strlessons", "", "", true, "", navmenu($course));
/// Get all the appropriate data
/// Print the page header
- if ($course->category) {
- $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
- }
-
$strlessons = get_string("modulenameplural", "lesson");
$strlesson = get_string("modulename", "lesson");
- print_header("$course->shortname: $lesson->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strlessons</A> -> <a href=\"view.php?id=$cm->id\">$lesson->name</a>",
+ print_header_simple("$lesson->name", "",
+ "<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),
navmenu($course, $cm));
// Print the page header
- if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
- }
-
$strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz");
- print_header("$course->shortname: $quiz->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strquizzes</A> ->
+ print_header_simple("$quiz->name", "",
+ "<A HREF=index.php?id=$course->id>$strquizzes</A> ->
<A HREF=\"view.php?id=$cm->id\">$quiz->name</A> -> $strattemptnum",
"", "", true);
: "";
$strquiz = get_string("modulename", "quiz");
- if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
- }
-
- print_header("$course->shortname: $strquizzes", "$course->fullname", "$navigation $strquizzes",
+ print_header_simple("$strquizzes", "", "$strquizzes",
"", "", true, $streditquestions, navmenu($course));
// Get all the appropriate data
/// Print the page header
if (empty($noheader)) {
-
- if ($course->category) {
- $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
- }
$strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz");
$strreport = get_string("report", "quiz");
- print_header("$course->shortname: $quiz->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strquizzes</A>
+ print_header_simple("$quiz->name", "",
+ "<A HREF=index.php?id=$course->id>$strquizzes</A>
-> <a href=\"view.php?id=$cm->id\">$quiz->name</a> -> $strreport",
"", "", true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm));
// Print the page header
- if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
- }
-
$strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz");
$strreport = get_string("report", "quiz");
$strtimecompleted = get_string("timecompleted", "quiz");
$stroverdue = get_string("overdue", "quiz");
- print_header("$course->shortname: $quiz->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strquizzes</A>
+ print_header_simple("$quiz->name", "",
+ "<A HREF=index.php?id=$course->id>$strquizzes</A>
-> <a href=\"view.php?id=$cm->id\">$quiz->name</a> -> $strreview",
"", "", true);
// Print the page header
- if ($course->category) {
- $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
- }
-
$strquizzes = get_string("modulenameplural", "quiz");
$strquiz = get_string("modulename", "quiz");
- print_header("$course->shortname: $quiz->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strquizzes</A> -> $quiz->name",
+ print_header_simple("$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));
if (isteacher($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");
$strweek = get_string("week");
$strtopic = get_string("topic");
$strdone = get_string("done", "survey");
$strnotdone = get_string("notdone", "survey");
- print_header("$course->shortname: $strsurveys", "$course->fullname", "$navigation $strsurveys",
+ print_header_simple("$strsurveys", "", "$strsurveys",
"", "", true, "", navmenu($course));
if (! $surveys = get_all_instances_in_course("survey", $course)) {
}
$showscales = ($template->name != 'ciqname');
-
- if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
- }
$strsurveys = get_string("modulenameplural", "survey");
$strsurvey = get_string("modulename", "survey");
- print_header("$course->shortname: $survey->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strsurveys</A> -> $survey->name", "", "", true,
+ print_header_simple("$survey->name", "",
+ "<A HREF=index.php?id=$course->id>$strsurveys</A> -> $survey->name", "", "", true,
update_module_button($cm->id, $course->id, $strsurvey), navmenu($course, $cm));
/// Check to see if groups are being used in this survey
error("Course Module ID was incorrect");
}
}
-
+
/// Build the ewsiki script constant
$ewbase = 'view.php?id='.$id;
if (isset($userid)) $ewbase .= '&userid='.$userid;
# The mighty Wiki itself
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");
$strwiki = get_string("modulename", "wiki");
}
}
- print_header("$course->shortname: $wiki_entry->pagename", "$course->fullname",
- "$navigation <A HREF=\"index.php?id=$course->id\">$strwikis</A> -> <A HREF=\"view.php?id=$id\">$wiki->name</a> ->".
+ print_header_simple("$wiki_entry->pagename", "",
+ "<A HREF=\"index.php?id=$course->id\">$strwikis</A> -> <A HREF=\"view.php?id=$id\">$wiki->name</a> ->".
get_string("administration","wiki"),
$focus, "", true, update_module_button($cm->id, $course->id, $strwiki),
navmenu($course, $cm));
print_footer($course);
exit;
-?>
\ No newline at end of file
+?>
\ No newline at end of file
/// Print the header
- if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
- }
-
- print_header("$course->shortname: $strwikis", "$course->fullname", "$navigation $strwikis", "", "", true, "", navmenu($course));
+ print_header_simple("$strwikis", "", "$strwikis", "", "", true, "", navmenu($course));
/// Get all the appropriate data
/// Print the page header
- if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
- }
$strwikis = get_string("modulenameplural", "wiki");
$strwiki = get_string("modulename", "wiki");
- print_header("$course->shortname: ".($ewiki_title?$ewiki_title:$wiki->name), "$course->fullname",
- "$navigation <A HREF=\"index.php?id=$course->id\">$strwikis</A> -> <A HREF=\"view.php?id=$moodleID\">$wiki->name</a>".($ewiki_title?" -> $ewiki_title":""),
+ print_header_simple(($ewiki_title?$ewiki_title:$wiki->name), "",
+ "<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),
navmenu($course, $cm));
require_login($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");
$strworkshop = get_string("modulename", "workshop");
$strweek = get_string("week");
$strname = get_string("name");
$strphase = get_string("phase", "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)) {
notice("There are no workshops", "../../course/view.php?id=$course->id");
break;
}
if ($submissions = workshop_get_user_submissions($workshop, $USER)) {
- foreach ($submissions as $submission) {
- if ($submission->timecreated <= $workshop->deadline) {
- $submitted = userdate($submission->timecreated);
- }
- else {
- $submitted = "<FONT COLOR=red>".userdate($submission->timecreated)."</FONT>";
- }
- $due = userdate($workshop->deadline);
+ foreach ($submissions as $submission) {
+ if ($submission->timecreated <= $workshop->deadline) {
+ $submitted = userdate($submission->timecreated);
+ }
+ else {
+ $submitted = "<FONT COLOR=red>".userdate($submission->timecreated)."</FONT>";
+ }
+ $due = userdate($workshop->deadline);
if (!$workshop->visible) {
//Show dimmed if the mod is hidden
- $link = "<A class=\"dimmed\" HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A><br />".
- "($submission->title)";
+ $link = "<A class=\"dimmed\" HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A><br />".
+ "($submission->title)";
} else {
//Show normal if the mod is visible
- $link = "<A HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A><br />".
- "($submission->title)";
+ $link = "<A HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A><br />".
+ "($submission->title)";
}
- if ($course->format == "weeks" or $course->format == "topics") {
- $table->data[] = array ($workshop->section, $link, $phase, $submitted, $due);
- }
- else {
- $table->data[] = array ($link, $phase, $submitted, $due);
- }
- }
- }
- else {
+ if ($course->format == "weeks" or $course->format == "topics") {
+ $table->data[] = array ($workshop->section, $link, $phase, $submitted, $due);
+ }
+ else {
+ $table->data[] = array ($link, $phase, $submitted, $due);
+ }
+ }
+ }
+ else {
$submitted = get_string("no");
- $due = userdate($workshop->deadline);
+ $due = userdate($workshop->deadline);
if (!$workshop->visible) {
//Show dimmed if the mod is hidden
$link = "<A class=\"dimmed\" HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A>";
//Show normal if the mod is visible
$link = "<A HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A>";
}
- if ($course->format == "weeks" or $course->format == "topics") {
- $table->data[] = array ($workshop->section, $link, $phase, $submitted, $due);
- }
- else {
- $table->data[] = array ($link, $phase, $submitted, $due);
- }
- }
- }
+ if ($course->format == "weeks" or $course->format == "topics") {
+ $table->data[] = array ($workshop->section, $link, $phase, $submitted, $due);
+ }
+ else {
+ $table->data[] = array ($link, $phase, $submitted, $due);
+ }
+ }
+ }
echo "<br />";
print_table($table);
require_login($course->id);
- if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
- }
-
$strworkshops = get_string("modulenameplural", "workshop");
$strworkshop = get_string("modulename", "workshop");
$strsubmissions = get_string("submissions", "workshop");
// ... print the header and...
- print_header("$course->shortname: $workshop->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strworkshops</A> ->
+ print_header_simple("$workshop->name", "",
+ "<A HREF=index.php?id=$course->id>$strworkshops</A> ->
<A HREF=\"view.php?a=$workshop->id\">$workshop->name</A> -> $strsubmissions",
"", "", true);
require_login($course->id);
- if ($course->category) {
- $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
- }
$strworkshops = get_string("modulenameplural", "workshop");
$strworkshop = get_string("modulename", "workshop");
$strupload = get_string("upload");
- print_header("$course->shortname: $workshop->name : $strupload", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strworkshops</A> ->
+ print_header_simple("$workshop->name : $strupload", "",
+ "<A HREF=index.php?id=$course->id>$strworkshops</A> ->
<A HREF=\"view.php?a=$workshop->id\">$workshop->name</A> -> $strupload",
"", "", true);
/****
}
****/
$timenow = time();
- if (!$title = $_POST['title']) {
- notify(get_string("notitlegiven", "workshop") );
- }
- else {
- if (is_uploaded_file($newfile['tmp_name']) and $newfile['size'] > 0) {
- if ($newfile['size'] > $workshop->maxbytes) {
- notify(get_string("uploadfiletoobig", "assignment", $workshop->maxbytes));
- }
- else {
- $newfile_name = clean_filename($newfile['name']);
- if ($newfile_name) {
+ if (!$title = $_POST['title']) {
+ notify(get_string("notitlegiven", "workshop") );
+ }
+ else {
+ if (is_uploaded_file($newfile['tmp_name']) and $newfile['size'] > 0) {
+ if ($newfile['size'] > $workshop->maxbytes) {
+ notify(get_string("uploadfiletoobig", "assignment", $workshop->maxbytes));
+ }
+ else {
+ $newfile_name = clean_filename($newfile['name']);
+ if ($newfile_name) {
// get the current set of submissions
$submissions = workshop_get_user_submissions($workshop, $USER);
// add new submission record
- $newsubmission->workshopid = $workshop->id;
- $newsubmission->userid = $USER->id;
- $newsubmission->title = $title;
- $newsubmission->timecreated = time();
- if (!$newsubmission->id = insert_record("workshop_submissions", $newsubmission)) {
- error("Workshop upload: Failure to create new submission record!");
- }
+ $newsubmission->workshopid = $workshop->id;
+ $newsubmission->userid = $USER->id;
+ $newsubmission->title = $title;
+ $newsubmission->timecreated = time();
+ if (!$newsubmission->id = insert_record("workshop_submissions", $newsubmission)) {
+ error("Workshop upload: Failure to create new submission record!");
+ }
// see if this is a resubmission by looking at the previous submissions...
if ($submissions and ($workshop->phase >1)) { // ...but not teacher submissions
// find the last submission
add_to_log($course->id, "workshop", "resubmit", "view.php?id=$cm->id",
"$workshop->id","$cm->id");
}
- 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");
- }
- 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");
+ 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");
}
- else {
- notify(get_string("uploaderror", "assignment") );
- }
- }
+ 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 {
+ notify(get_string("uploaderror", "assignment") );
+ }
+ }
}
}
elseif (!is_uploaded_file($newfile['tmp_name']) and !$newfile['size'] > 0 and $newfile['name']) {
else {
notify(get_string("uploadnofilefound", "assignment"));
}
- }
+ }
print_continue("view.php?a=$workshop->id");
print_footer($course);
<?PHP // $Id: view.php, v1.1 23 Aug 2003
/*************************************************
- ACTIONS handled are:
+ ACTIONS handled are:
- allowassessments (for teachers)
+ allowassessments (for teachers)
allowboth (for teachers)
allowsubmissions (for teachers)
close workshop( for teachers)
- displayfinalgrade (for students)
- notavailable (for students)
- setupassignment (for teachers)
- studentsview
- submitassignment
- teachersview
-
+ displayfinalgrade (for students)
+ notavailable (for students)
+ setupassignment (for teachers)
+ studentsview
+ submitassignment
+ teachersview
+
************************************************/
- require("../../config.php");
+ require("../../config.php");
require("lib.php");
require("locallib.php");
-
- optional_variable($id); // Course Module ID
+
+ optional_variable($id); // Course Module ID
optional_variable($a); // workshop ID
// get some useful stuff...
- if ($id) {
+ if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
error("Course Module ID was incorrect");
}
require_login($course->id);
// ...log activity...
- 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> ->";
- }
+ add_to_log($course->id, "workshop", "view", "view.php?id=$cm->id", $workshop->id, $cm->id);
$strworkshops = get_string("modulenameplural", "workshop");
$strworkshop = get_string("modulename", "workshop");
// ...display header...
- print_header("$course->shortname: $workshop->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>$strworkshops</A> -> $workshop->name",
+ print_header_simple("$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));
- // ...and if necessary set default action
-
- optional_variable($action);
+ // ...and if necessary set default action
+
+ optional_variable($action);
if (isteacher($course->id)) {
- if (empty($action)) { // no action specified, either go straight to elements page else the admin page
- // has the assignment any elements
- if (count_records("workshop_elements", "workshopid", $workshop->id) >= $workshop->nelements) {
- $action = "teachersview";
- }
- else {
- redirect("assessments.php?action=editelements&id=$cm->id");
- }
- }
- }
- elseif (!isguest()) { // it's a student then
- if (!$cm->visible) {
- notice(get_string("activityiscurrentlyhidden"));
- }
- switch ($workshop->phase) {
- case 0 :
- case 1 : $action = 'notavailable'; break;
- case 2 :
- case 3 :
- case 4 : $action = 'studentsview'; break;
- case 5 : $action = 'notavailable'; break;
- case 6 : $action = 'displayfinalgrade';
- }
- }
- else { // it's a guest, oh no!
- $action = 'notavailable';
- }
-
-
- /************** allow (peer) assessments only (move to phase 4) (for teachers)**/
- if ($action == 'allowassessments') {
-
- if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
- }
-
- // move to phase 4
- 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);
- redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 4));
- }
-
-
- /************** allow both (submissions and assessments) (move to phase 3) (for teachers)**/
- if ($action == 'allowboth') {
-
- if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
- }
-
- // move to phase 3
- 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);
- redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 3));
- }
-
-
- /************** allow submissions only (move to phase 2) (for teachers)**/
- if ($action == 'allowsubmissions') {
-
- if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
- }
+ if (empty($action)) { // no action specified, either go straight to elements page else the admin page
+ // has the assignment any elements
+ if (count_records("workshop_elements", "workshopid", $workshop->id) >= $workshop->nelements) {
+ $action = "teachersview";
+ }
+ else {
+ redirect("assessments.php?action=editelements&id=$cm->id");
+ }
+ }
+ }
+ elseif (!isguest()) { // it's a student then
+ if (!$cm->visible) {
+ notice(get_string("activityiscurrentlyhidden"));
+ }
+ switch ($workshop->phase) {
+ case 0 :
+ case 1 : $action = 'notavailable'; break;
+ case 2 :
+ case 3 :
+ case 4 : $action = 'studentsview'; break;
+ case 5 : $action = 'notavailable'; break;
+ case 6 : $action = 'displayfinalgrade';
+ }
+ }
+ else { // it's a guest, oh no!
+ $action = 'notavailable';
+ }
+
+
+ /************** allow (peer) assessments only (move to phase 4) (for teachers)**/
+ if ($action == 'allowassessments') {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can look at this page");
+ }
+
+ // move to phase 4
+ 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);
+ redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 4));
+ }
+
+
+ /************** allow both (submissions and assessments) (move to phase 3) (for teachers)**/
+ if ($action == 'allowboth') {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can look at this page");
+ }
+
+ // move to phase 3
+ 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);
+ redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 3));
+ }
+
+
+ /************** allow submissions only (move to phase 2) (for teachers)**/
+ if ($action == 'allowsubmissions') {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can look at this page");
+ }
// move to phase 2, check that teacher has made enough submissions
- if (workshop_count_teacher_submissions($workshop) < $workshop->ntassessments) {
- redirect("view.php?id=$cm->id", get_string("notenoughexamplessubmitted", "workshop",
+ if (workshop_count_teacher_submissions($workshop) < $workshop->ntassessments) {
+ redirect("view.php?id=$cm->id", get_string("notenoughexamplessubmitted", "workshop",
$course->teacher));
- }
- else {
- set_field("workshop", "phase", 2, "id", "$workshop->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));
- }
- }
-
-
- /****************** close workshop for student assessments/submissions (move to phase 5) (for teachers)**/
- elseif ($action == 'closeworkshop') {
-
- if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
- }
-
- // move to phase 5
- set_field("workshop", "phase", 5, "id", "$workshop->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));
- }
-
-
- /****************** display final grade (for students) ************************************/
- elseif ($action == 'displayfinalgrade' ) {
-
- // get the final weights from the database
- $teacherweight = get_field("workshop","teacherweight", "id", $workshop->id);
- $peerweight = get_field("workshop","peerweight", "id", $workshop->id);
- $includeteachersgrade = get_field("workshop","includeteachersgrade", "id", $workshop->id);
- $biasweight = get_field("workshop","biasweight", "id", $workshop->id);
- $reliabilityweight = get_field("workshop","reliabilityweight", "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
- // teacher grades?
- if ($workshop->gradingstrategy and $teacherweight) {
- $useteachersgrades = 1;
- }
- else {
- $useteachersgrades = 0;
- }
- // peergrades?
- if ($workshop->gradingstrategy and $workshop->nsassessments and $peerweight) {
- $usepeergrades = 1;
- }
- else {
- $usepeergrades = 0;
- }
- // bias grades?
- if ((($workshop->ntassessments >= 3) or ($workshop->nsassessments >= 3)) and $biasweight ) {
- $usebiasgrades = 1;
- }
- else {
- $usebiasgrades = 0;
- }
- // reliability grades?
- if ((($workshop->ntassessments >= 3) or ($workshop->nsassessments >= 3)) and $reliabilityweight ) {
- $usereliabilitygrades = 1;
- }
- else {
- $usereliabilitygrades = 0;
- }
- // grading grades?
- if (($workshop->ntassessments or $workshop->nsassessments) and $gradingweight ) {
- $usegradinggrades = 1;
- }
- else {
- $usegradinggrades = 0;
- }
-
- // show the final grades as stored in the tables...
- print_heading_with_help(get_string("displayoffinalgrades", "workshop"), "finalgrades", "workshop");
- if ($submissions = workshop_get_user_submissions($workshop, $USER)) { // any submissions from user?
- echo "<center><table border=\"1\" width=\"90%\"><tr>";
- echo "<td><b>".get_string("submissions", "workshop")."</b></td>";
- if ($useteachersgrades) {
- echo "<td align=\"center\"><b>".get_string("teacherassessments", "workshop",
+ }
+ else {
+ set_field("workshop", "phase", 2, "id", "$workshop->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));
+ }
+ }
+
+
+ /****************** close workshop for student assessments/submissions (move to phase 5) (for teachers)**/
+ elseif ($action == 'closeworkshop') {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can look at this page");
+ }
+
+ // move to phase 5
+ set_field("workshop", "phase", 5, "id", "$workshop->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));
+ }
+
+
+ /****************** display final grade (for students) ************************************/
+ elseif ($action == 'displayfinalgrade' ) {
+
+ // get the final weights from the database
+ $teacherweight = get_field("workshop","teacherweight", "id", $workshop->id);
+ $peerweight = get_field("workshop","peerweight", "id", $workshop->id);
+ $includeteachersgrade = get_field("workshop","includeteachersgrade", "id", $workshop->id);
+ $biasweight = get_field("workshop","biasweight", "id", $workshop->id);
+ $reliabilityweight = get_field("workshop","reliabilityweight", "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
+ // teacher grades?
+ if ($workshop->gradingstrategy and $teacherweight) {
+ $useteachersgrades = 1;
+ }
+ else {
+ $useteachersgrades = 0;
+ }
+ // peergrades?
+ if ($workshop->gradingstrategy and $workshop->nsassessments and $peerweight) {
+ $usepeergrades = 1;
+ }
+ else {
+ $usepeergrades = 0;
+ }
+ // bias grades?
+ if ((($workshop->ntassessments >= 3) or ($workshop->nsassessments >= 3)) and $biasweight ) {
+ $usebiasgrades = 1;
+ }
+ else {
+ $usebiasgrades = 0;
+ }
+ // reliability grades?
+ if ((($workshop->ntassessments >= 3) or ($workshop->nsassessments >= 3)) and $reliabilityweight ) {
+ $usereliabilitygrades = 1;
+ }
+ else {
+ $usereliabilitygrades = 0;
+ }
+ // grading grades?
+ if (($workshop->ntassessments or $workshop->nsassessments) and $gradingweight ) {
+ $usegradinggrades = 1;
+ }
+ else {
+ $usegradinggrades = 0;
+ }
+
+ // show the final grades as stored in the tables...
+ print_heading_with_help(get_string("displayoffinalgrades", "workshop"), "finalgrades", "workshop");
+ if ($submissions = workshop_get_user_submissions($workshop, $USER)) { // any submissions from user?
+ echo "<center><table border=\"1\" width=\"90%\"><tr>";
+ echo "<td><b>".get_string("submissions", "workshop")."</b></td>";
+ if ($useteachersgrades) {
+ echo "<td align=\"center\"><b>".get_string("teacherassessments", "workshop",
$course->teacher)."</b></td>";
- }
- if ($usepeergrades) {
- echo "<td align=\"center\"><b>".get_string("studentassessments", "workshop",
+ }
+ if ($usepeergrades) {
+ echo "<td align=\"center\"><b>".get_string("studentassessments", "workshop",
$course->student)."</b></td>";
- }
- echo "<td align=\"center\"><b>".get_string("assessmentsdone", "workshop")."</b></td>";
- if ($usebiasgrades) {
- echo "<td align=\"center\"><b>".get_string("gradeforbias", "workshop")."</b></td>";
- }
- if ($usereliabilitygrades) {
- echo "<td align=\"center\"><b>".get_string("gradeforreliability", "workshop")."</b></td>";
- }
- if ($usegradinggrades) {
- echo "<td align=\"center\"><b>".get_string("gradeforassessments", "workshop")."</b></td>";
- }
- echo "<td align=\"center\"><b>".get_string("overallgrade", "workshop")."</b></td></TR>\n";
- // now the weights
- echo "<TR><td><b>".get_string("weights", "workshop")."</b></td>";
- if ($useteachersgrades) {
- echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$teacherweight]</b></td>\n";
- }
- if ($usepeergrades) {
- echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$peerweight]</b></td>\n";
- }
- echo "<td><b> </b></td>\n";
- if ($usebiasgrades) {
- echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$biasweight]</b></td>\n";
- }
- if ($usereliabilitygrades) {
- echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$reliabilityweight]</b></td>\n";
- }
- if ($usegradinggrades) {
- echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$gradingweight]</b></td>\n";
- }
- echo "<td><b> </b></td></TR>\n";
- foreach ($submissions as $submission) {
- echo "<TR><td>".workshop_print_submission_title($workshop, $submission)."</td>\n";
- if ($useteachersgrades) {
- echo "<td align=\"center\">".workshop_print_submission_assessments($workshop,
+ }
+ echo "<td align=\"center\"><b>".get_string("assessmentsdone", "workshop")."</b></td>";
+ if ($usebiasgrades) {
+ echo "<td align=\"center\"><b>".get_string("gradeforbias", "workshop")."</b></td>";
+ }
+ if ($usereliabilitygrades) {
+ echo "<td align=\"center\"><b>".get_string("gradeforreliability", "workshop")."</b></td>";
+ }
+ if ($usegradinggrades) {
+ echo "<td align=\"center\"><b>".get_string("gradeforassessments", "workshop")."</b></td>";
+ }
+ echo "<td align=\"center\"><b>".get_string("overallgrade", "workshop")."</b></td></TR>\n";
+ // now the weights
+ echo "<TR><td><b>".get_string("weights", "workshop")."</b></td>";
+ if ($useteachersgrades) {
+ echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$teacherweight]</b></td>\n";
+ }
+ if ($usepeergrades) {
+ echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$peerweight]</b></td>\n";
+ }
+ echo "<td><b> </b></td>\n";
+ if ($usebiasgrades) {
+ echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$biasweight]</b></td>\n";
+ }
+ if ($usereliabilitygrades) {
+ echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$reliabilityweight]</b></td>\n";
+ }
+ if ($usegradinggrades) {
+ echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$gradingweight]</b></td>\n";
+ }
+ echo "<td><b> </b></td></TR>\n";
+ foreach ($submissions as $submission) {
+ echo "<TR><td>".workshop_print_submission_title($workshop, $submission)."</td>\n";
+ if ($useteachersgrades) {
+ echo "<td align=\"center\">".workshop_print_submission_assessments($workshop,
$submission, "teacher")."</td>";
- }
- if ($usepeergrades) {
- echo "<td align=\"center\">".workshop_print_submission_assessments($workshop,
+ }
+ if ($usepeergrades) {
+ echo "<td align=\"center\">".workshop_print_submission_assessments($workshop,
$submission, "student")."</td>";
- }
- echo "<td align=\"center\">".workshop_print_user_assessments($workshop, $USER)."</td>";
- if ($usebiasgrades) {
- echo "<td align=\"center\">$submission->biasgrade</td>";
- }
- if ($usereliabilitygrades) {
- echo "<td align=\"center\">$submission->reliabilitygrade</td>";
- }
- if ($usegradinggrades) {
- echo "<td align=\"center\">$submission->gradinggrade</td>";
- }
- echo "<td align=\"center\">$submission->finalgrade</td></TR>\n";
- }
- }
- echo "</TABLE><BR CLEAR=ALL>\n";
+ }
+ echo "<td align=\"center\">".workshop_print_user_assessments($workshop, $USER)."</td>";
+ if ($usebiasgrades) {
+ echo "<td align=\"center\">$submission->biasgrade</td>";
+ }
+ if ($usereliabilitygrades) {
+ echo "<td align=\"center\">$submission->reliabilitygrade</td>";
+ }
+ if ($usegradinggrades) {
+ echo "<td align=\"center\">$submission->gradinggrade</td>";
+ }
+ echo "<td align=\"center\">$submission->finalgrade</td></TR>\n";
+ }
+ }
+ echo "</TABLE><BR CLEAR=ALL>\n";
echo "<p>< > ".get_string("assessmentdropped", "workshop")."</p>\n";
- if ($workshop->showleaguetable) {
- workshop_print_league_table($workshop);
- }
- echo "<br />".get_string("allgradeshaveamaximumof", "workshop", $workshop->grade);
- }
-
-
- /****************** make final grades available (go to phase 6) (for teachers only)********/
- elseif ($action == 'makefinalgradesavailable') {
-
- if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
- }
-
- 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);
- redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 6));
- }
-
-
- /****************** assignment not available (for students)***********************/
- elseif ($action == 'notavailable') {
- print_heading(get_string("notavailable", "workshop"));
- }
-
-
- /****************** set up assignment (move back to phase 1) (for teachers)***********************/
- elseif ($action == 'setupassignment') {
-
- if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
- }
-
- 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);
- redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 1));
- }
-
-
- /****************** student's view could be in 1 of 4 stages ***********************/
- elseif ($action == 'studentsview') {
- workshop_print_assignment_info($workshop);
- // in Stage 1? - are there any teacher's submissions? and...
- // ...has student assessed the required number of the teacher's submissions
- if ($workshop->ntassessments and (!workshop_test_user_assessments($workshop, $USER))) {
- print_heading(get_string("pleaseassesstheseexamplesfromtheteacher", "workshop",
+ if ($workshop->showleaguetable) {
+ workshop_print_league_table($workshop);
+ }
+ echo "<br />".get_string("allgradeshaveamaximumof", "workshop", $workshop->grade);
+ }
+
+
+ /****************** make final grades available (go to phase 6) (for teachers only)********/
+ elseif ($action == 'makefinalgradesavailable') {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can look at this page");
+ }
+
+ 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);
+ redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 6));
+ }
+
+
+ /****************** assignment not available (for students)***********************/
+ elseif ($action == 'notavailable') {
+ print_heading(get_string("notavailable", "workshop"));
+ }
+
+
+ /****************** set up assignment (move back to phase 1) (for teachers)***********************/
+ elseif ($action == 'setupassignment') {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can look at this page");
+ }
+
+ 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);
+ redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 1));
+ }
+
+
+ /****************** student's view could be in 1 of 4 stages ***********************/
+ elseif ($action == 'studentsview') {
+ workshop_print_assignment_info($workshop);
+ // in Stage 1? - are there any teacher's submissions? and...
+ // ...has student assessed the required number of the teacher's submissions
+ if ($workshop->ntassessments and (!workshop_test_user_assessments($workshop, $USER))) {
+ print_heading(get_string("pleaseassesstheseexamplesfromtheteacher", "workshop",
$course->teacher));
- workshop_list_teacher_submissions($workshop, $USER);
- }
- // in stage 2? - submit own first attempt
- else {
- if ($workshop->ntassessments) {
+ workshop_list_teacher_submissions($workshop, $USER);
+ }
+ // in stage 2? - submit own first attempt
+ else {
+ if ($workshop->ntassessments) {
// 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));
- workshop_list_teacher_submissions($workshop, $USER);
- }
+ workshop_list_teacher_submissions($workshop, $USER);
+ }
// has user submitted anything yet? (only allowed in phases 2 and 3)
- if (!workshop_get_user_submissions($workshop, $USER)) {
- if ($workshop->phase < 4) {
+ if (!workshop_get_user_submissions($workshop, $USER)) {
+ if ($workshop->phase < 4) {
// print upload form
- print_heading(get_string("submitassignmentusingform", "workshop").":");
- workshop_print_upload_form($workshop);
- } else {
+ print_heading(get_string("submitassignmentusingform", "workshop").":");
+ workshop_print_upload_form($workshop);
+ } else {
print_heading(get_string("submissionsnolongerallowed", "workshop"));
}
}
- // in stage 3? - grade other student's submissions, resubmit and list all submissions
- else {
- // list any assessments by teachers
- if (workshop_count_teacher_assessments($workshop, $USER)) {
- print_heading(get_string("assessmentsby", "workshop", $course->teachers));
- workshop_list_teacher_assessments($workshop, $USER);
- }
- // is self assessment used in this workshop?
- if ($workshop->includeself) {
- // prints a table if there are any submissions which have not been self assessed yet
- workshop_list_self_assessments($workshop, $USER);
- }
- // if peer assessments are being done and workshop is in phase 3 then show some to assess...
- if ($workshop->nsassessments and ($workshop->phase > 2)) {
- workshop_list_student_submissions($workshop, $USER);
- }
- // ..and any they have already done (and have gone cold)...
- if (workshop_count_user_assessments($workshop, $USER, "student")) {
- print_heading(get_string("yourassessments", "workshop"));
- workshop_list_assessed_submissions($workshop, $USER);
- }
- // ... and show peer assessments
- if (workshop_count_peer_assessments($workshop, $USER)) {
- print_heading(get_string("assessmentsby", "workshop", $course->students));
- workshop_list_peer_assessments($workshop, $USER);
- }
- // list previous submissions
- print_heading(get_string("submissions", "workshop"));
- workshop_list_user_submissions($workshop, $USER);
- // are resubmissions allowed and the workshop is in submission phases (2 and 3)?
+ // in stage 3? - grade other student's submissions, resubmit and list all submissions
+ else {
+ // list any assessments by teachers
+ if (workshop_count_teacher_assessments($workshop, $USER)) {
+ print_heading(get_string("assessmentsby", "workshop", $course->teachers));
+ workshop_list_teacher_assessments($workshop, $USER);
+ }
+ // is self assessment used in this workshop?
+ if ($workshop->includeself) {
+ // prints a table if there are any submissions which have not been self assessed yet
+ workshop_list_self_assessments($workshop, $USER);
+ }
+ // if peer assessments are being done and workshop is in phase 3 then show some to assess...
+ if ($workshop->nsassessments and ($workshop->phase > 2)) {
+ workshop_list_student_submissions($workshop, $USER);
+ }
+ // ..and any they have already done (and have gone cold)...
+ if (workshop_count_user_assessments($workshop, $USER, "student")) {
+ print_heading(get_string("yourassessments", "workshop"));
+ workshop_list_assessed_submissions($workshop, $USER);
+ }
+ // ... and show peer assessments
+ if (workshop_count_peer_assessments($workshop, $USER)) {
+ print_heading(get_string("assessmentsby", "workshop", $course->students));
+ workshop_list_peer_assessments($workshop, $USER);
+ }
+ // list previous submissions
+ print_heading(get_string("submissions", "workshop"));
+ workshop_list_user_submissions($workshop, $USER);
+ // are resubmissions allowed and the workshop is in submission phases (2 and 3)?
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 ($submissions = workshop_get_user_submissions($workshop, $USER)) {
foreach ($submissions as $submission) {
break;
}
if (workshop_count_assessments($lastsubmission)) {
- echo "<hr size=\"1\" noshade>";
- print_heading(get_string("submitrevisedassignment", "workshop").":");
- workshop_print_upload_form($workshop);
- echo "<hr size=\"1\" noshade>";
+ echo "<hr size=\"1\" noshade>";
+ print_heading(get_string("submitrevisedassignment", "workshop").":");
+ workshop_print_upload_form($workshop);
+ echo "<hr size=\"1\" noshade>";
}
}
- }
- // allow user to list their submissions and assessments in a general way????
- // print_heading("<A HREF=\"submissions.php?action=listallsubmissions&id=$cm->id\">".
- // get_string("listofallsubmissions", "workshop"));
- }
- }
- }
-
-
- /****************** submission of assignment by teacher only***********************/
- elseif ($action == 'submitassignment') {
-
- if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
- }
-
- $strdifference = format_time($workshop->deadline - time());
- if (($workshop->deadline - time()) < 0) {
- $strdifference = "<FONT COLOR=RED>$strdifference</FONT>";
- }
- $strduedate = userdate($workshop->deadline)." ($strdifference)";
-
- workshop_print_assignment_info($workshop);
-
- // list previous submissions from teacher
- workshop_list_user_submissions($workshop, $USER);
-
- echo "<HR SIZE=1 NOSHADE>";
-
- // print upload form
- print_heading(get_string("submitassignment", "assignment").":");
- workshop_print_upload_form($workshop);
- }
-
-
- /****************** teacher's view - display admin page (current phase options) ************/
- elseif ($action == 'teachersview') {
-
- if (!isteacher($course->id)) {
- error("Only teachers can look at this page");
- }
-
- print_heading_with_help(get_string("managingassignment", "workshop"), "managing", "workshop");
-
- workshop_print_assignment_info($workshop);
-
- $tabs->names = array("1. ".get_string("phase1", "workshop"),
+ }
+ // allow user to list their submissions and assessments in a general way????
+ // print_heading("<A HREF=\"submissions.php?action=listallsubmissions&id=$cm->id\">".
+ // get_string("listofallsubmissions", "workshop"));
+ }
+ }
+ }
+
+
+ /****************** submission of assignment by teacher only***********************/
+ elseif ($action == 'submitassignment') {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can look at this page");
+ }
+
+ $strdifference = format_time($workshop->deadline - time());
+ if (($workshop->deadline - time()) < 0) {
+ $strdifference = "<FONT COLOR=RED>$strdifference</FONT>";
+ }
+ $strduedate = userdate($workshop->deadline)." ($strdifference)";
+
+ workshop_print_assignment_info($workshop);
+
+ // list previous submissions from teacher
+ workshop_list_user_submissions($workshop, $USER);
+
+ echo "<HR SIZE=1 NOSHADE>";
+
+ // print upload form
+ print_heading(get_string("submitassignment", "assignment").":");
+ workshop_print_upload_form($workshop);
+ }
+
+
+ /****************** teacher's view - display admin page (current phase options) ************/
+ elseif ($action == 'teachersview') {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can look at this page");
+ }
+
+ print_heading_with_help(get_string("managingassignment", "workshop"), "managing", "workshop");
+
+ workshop_print_assignment_info($workshop);
+
+ $tabs->names = array("1. ".get_string("phase1", "workshop"),
"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),
"5. ".get_string("phase5", "workshop"),
"6. ".get_string("phase6", "workshop"));
- $tabs->urls = array("view.php?id=$cm->id&action=setupassignment",
- "view.php?id=$cm->id&action=allowsubmissions",
- "view.php?id=$cm->id&action=allowboth",
- "view.php?id=$cm->id&action=allowassessments",
- "view.php?id=$cm->id&action=closeworkshop",
- "view.php?id=$cm->id&action=makefinalgradesavailable");
- if ($workshop->phase) { // phase 1 or more
- $tabs->highlight = $workshop->phase - 1;
- } else {
- $tabs->highlight = 0; // phase is zero
- }
- workshop_print_tabbed_heading($tabs);
- echo "<center>\n";
- switch ($workshop->phase) {
- case 0:
- case 1: // set up assignment
+ $tabs->urls = array("view.php?id=$cm->id&action=setupassignment",
+ "view.php?id=$cm->id&action=allowsubmissions",
+ "view.php?id=$cm->id&action=allowboth",
+ "view.php?id=$cm->id&action=allowassessments",
+ "view.php?id=$cm->id&action=closeworkshop",
+ "view.php?id=$cm->id&action=makefinalgradesavailable");
+ if ($workshop->phase) { // phase 1 or more
+ $tabs->highlight = $workshop->phase - 1;
+ } else {
+ $tabs->highlight = 0; // phase is zero
+ }
+ workshop_print_tabbed_heading($tabs);
+ echo "<center>\n";
+ switch ($workshop->phase) {
+ case 0:
+ case 1: // set up assignment
if ($workshop->nelements) {
- echo "<p><b><a href=\"assessments.php?id=$cm->id&action=editelements\">".
- get_string("amendassessmentelements", "workshop")."</a></b> \n";
- helpbutton("elements", get_string("amendassessmentelements", "workshop"), "workshop");
+ echo "<p><b><a href=\"assessments.php?id=$cm->id&action=editelements\">".
+ get_string("amendassessmentelements", "workshop")."</a></b> \n";
+ helpbutton("elements", get_string("amendassessmentelements", "workshop"), "workshop");
}
- if ($workshop->ntassessments) {
+ if ($workshop->ntassessments) {
// if teacher examples show submission and assessment links
- echo "<p><b><a href=\"view.php?id=$cm->id&action=submitassignment\">".
- get_string("submitexampleassignment", "workshop")."</a></b> \n";
- helpbutton("submissionofexamples", get_string("submitexampleassignment", "workshop"),
+ echo "<p><b><a href=\"view.php?id=$cm->id&action=submitassignment\">".
+ get_string("submitexampleassignment", "workshop")."</a></b> \n";
+ helpbutton("submissionofexamples", get_string("submitexampleassignment", "workshop"),
"workshop");
- echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentteacher\">".
- get_string("teachersubmissionsforassessment", "workshop",
- workshop_count_teacher_submissions_for_assessment($workshop, $USER)).
- "</a></b> \n";
- helpbutton("assessmentofexamples", get_string("teachersubmissionsforassessment",
+ echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentteacher\">".
+ get_string("teachersubmissionsforassessment", "workshop",
+ workshop_count_teacher_submissions_for_assessment($workshop, $USER)).
+ "</a></b> \n";
+ helpbutton("assessmentofexamples", get_string("teachersubmissionsforassessment",
"workshop"), "workshop");
- }
- break;
-
- case 2: // submissions and assessments
- case 3:
+ }
+ break;
+
+ case 2: // submissions and assessments
+ case 3:
case 4:
- if ($workshop->ntassessments) { // if teacher example show student assessments link
- echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedteachersubmissions\">".
- get_string("ungradedassessmentsofteachersubmissions", "workshop",
- workshop_count_ungraded_assessments_teacher($workshop))."</a></b> \n";
- helpbutton("ungradedassessments_teacher",
+ if ($workshop->ntassessments) { // if teacher example show student assessments link
+ echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedteachersubmissions\">".
+ get_string("ungradedassessmentsofteachersubmissions", "workshop",
+ workshop_count_ungraded_assessments_teacher($workshop))."</a></b> \n";
+ helpbutton("ungradedassessments_teacher",
get_string("ungradedassessmentsofteachersubmissions", "workshop"), "workshop");
- }
- echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedstudentsubmissions\">".
- get_string("ungradedassessmentsofstudentsubmissions", "workshop",
- workshop_count_ungraded_assessments_student($workshop))."</a></b> \n";
- helpbutton("ungradedassessments_student",
+ }
+ echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedstudentsubmissions\">".
+ get_string("ungradedassessmentsofstudentsubmissions", "workshop",
+ workshop_count_ungraded_assessments_student($workshop))."</a></b> \n";
+ helpbutton("ungradedassessments_student",
get_string("ungradedassessmentsofstudentsubmissions", "workshop"), "workshop");
- echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">".
- get_string("studentsubmissionsforassessment", "workshop",
- workshop_count_student_submissions_for_assessment($workshop, $USER))."</a></b> \n";
- helpbutton("gradingsubmissions",
+ echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">".
+ get_string("studentsubmissionsforassessment", "workshop",
+ workshop_count_student_submissions_for_assessment($workshop, $USER))."</a></b> \n";
+ helpbutton("gradingsubmissions",
get_string("studentsubmissionsforassessment", "workshop"), "workshop");
- break;
-
- case 5: // calculate final grades
- if ($workshop->ntassessments) { // if teacher example show student assessments link
- echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedteachersubmissions\">".
- get_string("ungradedassessmentsofteachersubmissions", "workshop",
- workshop_count_ungraded_assessments_teacher($workshop))."</a></b> \n";
- helpbutton("ungradedassessments_teacher",
+ break;
+
+ case 5: // calculate final grades
+ if ($workshop->ntassessments) { // if teacher example show student assessments link
+ echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedteachersubmissions\">".
+ get_string("ungradedassessmentsofteachersubmissions", "workshop",
+ workshop_count_ungraded_assessments_teacher($workshop))."</a></b> \n";
+ helpbutton("ungradedassessments_teacher",
get_string("ungradedassessmentsofteachersubmissions", "workshop"), "workshop");
- }
- echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedstudentsubmissions\">".
- get_string("ungradedassessmentsofstudentsubmissions", "workshop",
- workshop_count_ungraded_assessments_student($workshop))."</a></b> \n";
- helpbutton("ungradedassessments_student",
+ }
+ echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedstudentsubmissions\">".
+ get_string("ungradedassessmentsofstudentsubmissions", "workshop",
+ workshop_count_ungraded_assessments_student($workshop))."</a></b> \n";
+ helpbutton("ungradedassessments_student",
get_string("ungradedassessmentsofstudentsubmissions", "workshop"), "workshop");
- echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">".
- get_string("studentsubmissionsforassessment", "workshop",
- workshop_count_student_submissions_for_assessment($workshop, $USER))."</a></b> \n";
- helpbutton("gradingsubmissions",
+ echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">".
+ get_string("studentsubmissionsforassessment", "workshop",
+ workshop_count_student_submissions_for_assessment($workshop, $USER))."</a></b> \n";
+ helpbutton("gradingsubmissions",
get_string("studentsubmissionsforassessment", "workshop"), "workshop");
- print_heading("<a href=\"submissions.php?id=$cm->id&action=displayfinalweights\">".
- get_string("calculationoffinalgrades", "workshop")."</a>");
- print_heading("<a href=\"submissions.php?id=$cm->id&action=analysisofassessments\">".
- get_string("analysisofassessments", "workshop")."</a>");
- break;
-
- case 6: // show final grades
- print_heading("<A HREF=\"submissions.php?id=$cm->id&action=displayfinalgrades\">".
- get_string("displayoffinalgrades", "workshop")."</A>");
- }
- print_heading("<A HREF=\"submissions.php?id=$cm->id&action=adminlist\">".
- get_string("administration")."</A>");
- }
-
-
- /*************** no man's land **************************************/
- else {
- error("Fatal Error: Unknown Action: ".$action."\n");
- }
-
- print_footer($course);
-
+ print_heading("<a href=\"submissions.php?id=$cm->id&action=displayfinalweights\">".
+ get_string("calculationoffinalgrades", "workshop")."</a>");
+ print_heading("<a href=\"submissions.php?id=$cm->id&action=analysisofassessments\">".
+ get_string("analysisofassessments", "workshop")."</a>");
+ break;
+
+ case 6: // show final grades
+ print_heading("<A HREF=\"submissions.php?id=$cm->id&action=displayfinalgrades\">".
+ get_string("displayoffinalgrades", "workshop")."</A>");
+ }
+ print_heading("<A HREF=\"submissions.php?id=$cm->id&action=adminlist\">".
+ get_string("administration")."</A>");
+ }
+
+
+ /*************** no man's land **************************************/
+ else {
+ error("Fatal Error: Unknown Action: ".$action."\n");
+ }
+
+ print_footer($course);
+
?>