From 90fcc576ea55fdd5b21a8c0d82ac5fb21b9f565c Mon Sep 17 00:00:00 2001 From: gustav_delius Date: Sat, 21 Aug 2004 20:20:58 +0000 Subject: [PATCH] Removed notices by introducing new function print_header_simple() which works on site as well as in courses without extra logic. --- lib/weblib.php | 20 + mod/assignment/index.php | 6 +- mod/assignment/submissions.php | 8 +- mod/assignment/upload.php | 7 +- mod/assignment/view.php | 8 +- mod/attendance/index.php | 6 +- mod/attendance/view.php | 72 ++- mod/attendance/viewall.php | 281 +++++----- mod/attendance/viewweek.php | 285 +++++----- mod/chat/index.php | 6 +- mod/chat/report.php | 14 +- mod/chat/view.php | 8 +- mod/choice/index.php | 10 +- mod/choice/view.php | 9 +- mod/dialogue/dialogues.php | 311 ++++++----- mod/dialogue/index.php | 8 +- mod/dialogue/view.php | 116 ++--- mod/exercise/assessments.php | 9 +- mod/exercise/index.php | 64 ++- mod/exercise/submissions.php | 8 +- mod/exercise/upload.php | 119 +++-- mod/exercise/view.php | 524 ++++++++++--------- mod/forum/subscribers.php | 10 +- mod/forum/view.php | 9 +- mod/glossary/comment.php | 13 +- mod/glossary/comments.php | 18 +- mod/glossary/deleteentry.php | 14 +- mod/glossary/editcategories.php | 70 ++- mod/glossary/exportentry.php | 138 +++-- mod/glossary/import.php | 8 +- mod/glossary/index.php | 6 +- mod/journal/index.php | 6 +- mod/journal/view.php | 8 +- mod/lesson/index.php | 6 +- mod/lesson/view.php | 8 +- mod/quiz/attempt.php | 8 +- mod/quiz/index.php | 6 +- mod/quiz/report.php | 8 +- mod/quiz/review.php | 8 +- mod/quiz/view.php | 8 +- mod/survey/index.php | 6 +- mod/survey/view.php | 8 +- mod/wiki/admin.php | 14 +- mod/wiki/index.php | 6 +- mod/wiki/view.php | 7 +- mod/workshop/index.php | 68 ++- mod/workshop/submissions.php | 8 +- mod/workshop/upload.php | 65 ++- mod/workshop/view.php | 894 ++++++++++++++++---------------- 49 files changed, 1574 insertions(+), 1753 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index e0d60315ac..44c3f415a3 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1153,6 +1153,26 @@ function print_header ($title="", $heading="", $navigation="", $focus="", $meta= 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 = "id\">$course->shortname ->"; + } + + 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 diff --git a/mod/assignment/index.php b/mod/assignment/index.php index 3956110ddb..f288c48ec9 100644 --- a/mod/assignment/index.php +++ b/mod/assignment/index.php @@ -12,10 +12,6 @@ require_login($course->id); add_to_log($course->id, "assignment", "view all", "index.php?id=$course->id", ""); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strassignments = get_string("modulenameplural", "assignment"); $strassignment = get_string("modulename", "assignment"); $strweek = get_string("week"); @@ -25,7 +21,7 @@ $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"); diff --git a/mod/assignment/submissions.php b/mod/assignment/submissions.php index 2a6205c356..2a24577234 100644 --- a/mod/assignment/submissions.php +++ b/mod/assignment/submissions.php @@ -27,17 +27,13 @@ error("Only teachers can look at this page"); } - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $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 id\">$strassignments -> + print_header_simple($assignment->name, "", + "id\">$strassignments -> id\">$assignment->name -> $strsubmissions", "", "", true, update_module_button($cm->id, $course->id, $strassignment), navmenu($course, $cm)); diff --git a/mod/assignment/upload.php b/mod/assignment/upload.php index 83d61b8393..ad9a6b4a2e 100644 --- a/mod/assignment/upload.php +++ b/mod/assignment/upload.php @@ -25,15 +25,12 @@ add_to_log($course->id, "assignment", "upload", "view.php?a=$assignment->id", "$assignment->id", $cm->id); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } $strassignments = get_string("modulenameplural", "assignment"); $strassignment = get_string("modulename", "assignment"); $strupload = get_string("upload"); - print_header("$course->shortname: $assignment->name : $strupload", "$course->fullname", - "$navigation id>$strassignments -> + print_header_simple("$assignment->name : $strupload", "", + "id>$strassignments -> id\">$assignment->name -> $strupload", "", "", true); diff --git a/mod/assignment/view.php b/mod/assignment/view.php index 0aaf8bb9cf..d2125115e0 100644 --- a/mod/assignment/view.php +++ b/mod/assignment/view.php @@ -35,15 +35,11 @@ add_to_log($course->id, "assignment", "view", "view.php?id=$cm->id", $assignment->id, $cm->id); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strassignments = get_string("modulenameplural", "assignment"); $strassignment = get_string("modulename", "assignment"); - print_header("$course->shortname: $assignment->name", "$course->fullname", - "$navigation id>$strassignments -> $assignment->name", + print_header_simple($assignment->name, "", + "id>$strassignments -> $assignment->name", "", "", true, update_module_button($cm->id, $course->id, $strassignment), navmenu($course, $cm)); if (isteacher($course->id)) { diff --git a/mod/attendance/index.php b/mod/attendance/index.php index a3787d1e13..2055f4113c 100644 --- a/mod/attendance/index.php +++ b/mod/attendance/index.php @@ -26,11 +26,7 @@ /// Print the header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - - 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 diff --git a/mod/attendance/view.php b/mod/attendance/view.php index c27dea4edb..d5f7b25ab0 100644 --- a/mod/attendance/view.php +++ b/mod/attendance/view.php @@ -34,16 +34,12 @@ /// Print the page header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strattendances = get_string("modulenameplural", "attendance"); $strattendance = get_string("modulename", "attendance"); $strteacheredit = get_string("teacheredit", "attendance"); - print_header("$course->shortname: $attendance->name", "$course->fullname", - "$navigation id>$strattendances -> $attendance->name", + print_header_simple($attendance->name, "", + "id>$strattendances -> $attendance->name", "", "", true, update_module_button($cm->id, $course->id, $strattendance), navmenu($course, $cm)); @@ -72,9 +68,9 @@ // get the list of attendance records for all hours of the given day and // put it in the array for use in the attendance table - $strviewall = get_string("viewall", "attendance"); - $strviewweek = get_string("viewweek", "attendance"); - echo "

"; + $strviewall = get_string("viewall", "attendance"); + $strviewweek = get_string("viewweek", "attendance"); + echo "

"; if (isteacher($course->id)) { echo "id."&return=true\">$strteacheredit
"; } @@ -89,26 +85,26 @@ echo ""; // print the date headings at the top of the table - echo "\n"; + echo "\n"; // put notes for the date in the date heading $notes = ($form->notes != "") ? ":
".$form->notes : ""; - echo "\n"; + echo "\n"; echo (($form->hours > 1) ? "\n" : ""); echo "\n"; // print the second level headings with name and possibly hour numbers - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; // generate the headers for the attendance hours if ($form->hours > 1) { - for($i=1;$i<=$form->hours;$i++) { - echo "\n"; - } - echo "\n"; } - echo "\n"; + for($i=1;$i<=$form->hours;$i++) { + echo "\n"; + } + echo "\n"; } + echo "\n"; // get the list of students along with student ID field // get back array of stdclass objects in sorted order, with members: // id, username,firstname,lastname,maildisplay,mailformat,email,city,country, @@ -116,7 +112,7 @@ if (isteacher($course->id)){ $students = attendance_get_course_students($form->course, "u.lastname ASC"); } else { // must be a student - $students[0] = get_user_info_from_db("id", $USER->id); + $students[0] = get_user_info_from_db("id", $USER->id); } $i=0; $A = get_string("absentshort","attendance"); @@ -129,16 +125,16 @@ echo "\n"; $studentid=(($student->idnumber != "") ? $student->idnumber : " "); echo "\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 "\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 "\n"; } } @@ -154,22 +150,22 @@ echo "
". - " 
". + " hours. "\" nowrap class=\"generaltableheader\">". - userdate($form->day,get_string("strftimedateshort")).$notes."hours. "\" nowrap class=\"generaltableheader\">". + userdate($form->day,get_string("strftimedateshort")).$notes." 
Last NameFirst NameID
Last NameFirst NameID".$i."total"; - } else { echo " 
".$i."total"; + } else { echo " 
".$student->firstname."".$studentid."".$status."".$tot."
"; echo"\n"; + get_string("dynsectionshort","attendance").":\n"; echo"\n"; + (($form->dynsection=="1")?"Yes":"No")."\n"; echo"\n"; + get_string("autoattendshort","attendance").":\n"; echo"\n"; + (($form->autoattend=="1")?"Yes":"No")."\n"; echo"\n"; + get_string("gradeshort","attendance").":\n"; echo"\n"; + (($form->grade=="1")?"Yes":"No")."\n"; if ($form->grade == "1") { echo"\n"; + get_string("maxgradeshort","attendance").":\n"; echo"\n"; + $form->maxgrade."\n"; } echo "
". - get_string("dynsectionshort","attendance").":". - (($form->dynsection=="1")?"Yes":"No")."
". - get_string("autoattendshort","attendance").":". - (($form->autoattend=="1")?"Yes":"No")."
". - get_string("gradeshort","attendance").":". - (($form->grade=="1")?"Yes":"No")."
". - get_string("maxgradeshort","attendance").":". - $form->maxgrade."
\n"; diff --git a/mod/attendance/viewall.php b/mod/attendance/viewall.php index 73903d2b54..bba4108817 100644 --- a/mod/attendance/viewall.php +++ b/mod/attendance/viewall.php @@ -40,7 +40,7 @@ /// Print the main part of the page if ($attendances) { if ( isstudent($course->id) && !isteacher($course->id)) { - attendance_print_header(); + attendance_print_header(); notice(get_string("noviews", "attendance")); print_footer($course); exit; } @@ -61,13 +61,13 @@ if ($attendances) { if (isstudent($course->id) && !isteacher($course->id)) { $rolls = get_records("attendance_roll", "dayid", $form->id, "userid", $USER->id); } else { // must be a teacher - $rolls = get_records("attendance_roll", "dayid", $attendance->id); + $rolls = get_records("attendance_roll", "dayid", $attendance->id); } if ($rolls) { - foreach ($rolls as $roll) { - $atts[$numatt]->sroll[$roll->userid][$roll->hour]->status=$roll->status; - $atts[$numatt]->sroll[$roll->userid][$roll->hour]->notes=$roll->notes; - } + foreach ($rolls as $roll) { + $atts[$numatt]->sroll[$roll->userid][$roll->hour]->status=$roll->status; + $atts[$numatt]->sroll[$roll->userid][$roll->hour]->notes=$roll->notes; + } } $numatt++; } @@ -98,22 +98,22 @@ if ($download == "xls") { if ($dlsub== "all") { for($k=0;$k<$numatt;$k++) { // put notes for the date in the date heading - $myxls->write_string(1,$pos,userdate($atts[$k]->attendance->day,"%m/%0d")); - $myxls->set_column($pos,$pos,5); - $myxls->write_string(2,$pos,$atts[$k]->attendance->notes); - for ($i=1;$i<=$atts[$k]->attendance->hours;$i++) { - $myxls->write_number(3,$pos,$i); - $myxls->set_column($pos,$pos,1); - $pos++; - } + $myxls->write_string(1,$pos,userdate($atts[$k]->attendance->day,"%m/%0d")); + $myxls->set_column($pos,$pos,5); + $myxls->write_string(2,$pos,$atts[$k]->attendance->notes); + for ($i=1;$i<=$atts[$k]->attendance->hours;$i++) { + $myxls->write_number(3,$pos,$i); + $myxls->set_column($pos,$pos,1); + $pos++; + } } } // if dlsub==all - $myxls->write_string(3,$pos,get_string("total")); - $myxls->set_column($pos,$pos,5); - + $myxls->write_string(3,$pos,get_string("total")); + $myxls->set_column($pos,$pos,5); + /// generate the attendance rolls for the body of the spreadsheet if (isstudent($course->id) && !isteacher($course->id)) { - $students[0] = get_user_info_from_db("id", $USER->id); + $students[0] = get_user_info_from_db("id", $USER->id); } else { // must be a teacher $students = attendance_get_course_students($attendance->course, "u.lastname ASC"); } @@ -129,28 +129,28 @@ if ($dlsub== "all") { $myxls->write_string($row,2,$studentid); $pos=3; if ($dlsub== "all") { - for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student - for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { - // set the attendance defaults for each student - if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;} - elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;} - else {$status=$P;} - $myxls->write_string($row,$pos,$status); - $pos++; - } /// for loop - } + for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student + for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { + // set the attendance defaults for each student + if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;} + elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;} + else {$status=$P;} + $myxls->write_string($row,$pos,$status); + $pos++; + } /// for loop + } } - $abs=$tar=0; + $abs=$tar=0; for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student - for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { - // set the attendance defaults for each student - if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;} - elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;} - } /// for loop - } // outer for for each day of attendance + for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { + // set the attendance defaults for each student + if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;} + elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;} + } /// for loop + } // outer for for each day of attendance $tot=attendance_tally_overall_absences_decimal($abs,$tar); $myxls->write_number($row,$pos,$tot); - $row++; + $row++; } $workbook->close(); @@ -170,16 +170,16 @@ if ($download == "txt") { if ($dlsub== "all") { for($k=0;$k<$numatt;$k++) { // put notes for the date in the date heading - echo "\t" . userdate($atts[$k]->attendance->day,"%m/%0d"); - echo (($atts[$k]->attendance->notes != "")?" ".$atts[$k]->attendance->notes:""); - for ($i=2;$i<=$atts[$k]->attendance->hours;$i++) { echo "\t$i"; } + echo "\t" . userdate($atts[$k]->attendance->day,"%m/%0d"); + echo (($atts[$k]->attendance->notes != "")?" ".$atts[$k]->attendance->notes:""); + for ($i=2;$i<=$atts[$k]->attendance->hours;$i++) { echo "\t$i"; } } } // if dlsub==all - echo "\t". get_string("total") . "\n"; - + echo "\t". get_string("total") . "\n"; + /// generate the attendance rolls for the body of the spreadsheet if (isstudent($course->id) && !isteacher($course->id)) { - $students[0] = get_user_info_from_db("id", $USER->id); + $students[0] = get_user_info_from_db("id", $USER->id); } else { // must be a teacher $students = attendance_get_course_students($attendance->course, "u.lastname ASC"); } @@ -194,27 +194,27 @@ if ($dlsub== "all") { $studentid=(($student->idnumber != "") ? $student->idnumber : " "); echo "\t". $studentid; if ($dlsub== "all") { - for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student - for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { - // set the attendance defaults for each student - if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;} - elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;} - else {$status=$P;} - echo "\t".$status; - } /// for loop - } + for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student + for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { + // set the attendance defaults for each student + if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;} + elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;} + else {$status=$P;} + echo "\t".$status; + } /// for loop + } } - $abs=$tar=0; + $abs=$tar=0; for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student - for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { - // set the attendance defaults for each student - if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;} - elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;} - } /// for loop - } // outer for for each day of attendance + for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { + // set the attendance defaults for each student + if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;} + elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;} + } /// for loop + } // outer for for each day of attendance $tot=attendance_tally_overall_absences_decimal($abs,$tar); echo "\t".$tot."\n"; - $row++; + $row++; } exit; } @@ -237,7 +237,7 @@ if ($dlsub== "all") { } else if ($onepage) { $multipage=false; } else { // if onepage is set to false - $multilpage=true; + $multilpage=true; } // adjust the width for the report for students @@ -248,39 +248,39 @@ if ($dlsub== "all") { $hoursinreport = $CFG->attendance_hours_in_full_report + 15; } else { $hoursinreport = $CFG->attendance_hours_in_full_report; - } + } while (($multipage || $onepage) && (!$endonepage)) { // this makes for a one iteration loop for multipage - if ($multipage) {$onepage = false; $multipage = false; $endonepage=false;} - - + if ($multipage) {$onepage = false; $multipage = false; $endonepage=false;} + + if ($numhours>=$hoursinreport) { - if (!isset($pagereport)) { - // $pagereport is used to determine whether the report needs to be paged at all - $pagereport=true; - $endatt=0; - $page=1; - } - // find the last hour to have on this page of the report - // go to the next (or first) page -// $endatt++; -// $startatt=$endatt; - $curpage=1; - $endatt=0; + if (!isset($pagereport)) { + // $pagereport is used to determine whether the report needs to be paged at all + $pagereport=true; + $endatt=0; + $page=1; + } + // find the last hour to have on this page of the report + // go to the next (or first) page +// $endatt++; +// $startatt=$endatt; + $curpage=1; + $endatt=0; for($curpage=1;true;$curpage++) { // the for loop is broken from the inside - $pagehours=$atts[$endatt]->attendance->hours; - $startatt=$endatt; - while(($pagehours<=$hoursinreport)) { - if ($endatt>=$numatt) { break 2; } // end the page number calculations and trigger the end of a multi-page report! - $endatt++; - $pagehours=$pagehours+$atts[$endatt]->attendance->hours; - } - // if this is the page we're on, save the info - if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; } + $pagehours=$atts[$endatt]->attendance->hours; + $startatt=$endatt; + while(($pagehours<=$hoursinreport)) { + if ($endatt>=$numatt) { break 2; } // end the page number calculations and trigger the end of a multi-page report! + $endatt++; + $pagehours=$pagehours+$atts[$endatt]->attendance->hours; + } + // if this is the page we're on, save the info + if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; } } // hopefully at this point, startatt and endatt are set correctly for the current page - if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; } else { - $endatt=$endatt_target; $startatt=$startatt_target; } - $maxpages = $curpage; + if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; } else { + $endatt=$endatt_target; $startatt=$startatt_target; } + $maxpages = $curpage; } else {$pagereport=false;} $minatt=($pagereport ? $startatt : 0); @@ -301,10 +301,10 @@ while (($multipage || $onepage) && (!$endonepage)) { attendance_print_header(); // print other links at top of page - $strviewone = get_string("viewone", "attendance"); - $strviewtable = get_string("viewtable", "attendance"); - $strviewmulti = get_string("viewmulti", "attendance"); - $strviewweek = get_string("viewweek", "attendance"); + $strviewone = get_string("viewone", "attendance"); + $strviewtable = get_string("viewtable", "attendance"); + $strviewmulti = get_string("viewmulti", "attendance"); + $strviewweek = get_string("viewweek", "attendance"); if ($onepage) { // one page for all tables echo "

id."\">"; echo "$strviewmulti
"; @@ -343,7 +343,7 @@ while (($multipage || $onepage) && (!$endonepage)) { "cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">"; if (isteacher($course->id)) { echo "". - " \n"; + " \n"; } // $minpage=0;$maxpage=$numatt; // print the date headings at the top of the table @@ -352,9 +352,9 @@ while (($multipage || $onepage) && (!$endonepage)) { // put notes for the date in the date heading $notes = ($atts[$k]->attendance->notes != "") ? ":
".$atts[$k]->attendance->notes : ""; $auto = ($atts[$k]->attendance->autoattend == 1) ? "(".get_string("auto","attendance").")" : ""; - echo "attendance->hours. "\" nowrap class=\"generaltableheader\">". - "attendance->cmid."\">".userdate($atts[$k]->attendance->day,"%m/%0d")."".$auto. - $notes."\n"; + echo "attendance->hours. "\" nowrap class=\"generaltableheader\">". + "attendance->cmid."\">".userdate($atts[$k]->attendance->day,"%m/%0d")."".$auto. + $notes."\n"; } // if we're at the end of the report if ($maxatt==$numatt || !$pagereport) { @@ -363,23 +363,23 @@ while (($multipage || $onepage) && (!$endonepage)) { echo "\n"; // print the second level headings with name and possibly hour numbers if (isteacher($course->id)) { - echo "Last Name\n"; - echo "First Name\n"; - echo "ID\n"; + echo "Last Name\n"; + echo "First Name\n"; + echo "ID\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 "".$i."\n"; - } - } else { echo " \n"; } + for($i=1;$i<=$atts[$k]->attendance->hours;$i++) { + echo "".$i."\n"; + } + } else { echo " \n"; } } // if we're at the end of the report if ($maxatt==$numatt || !$pagereport) { echo "total"; } - echo "\n"; + echo "\n"; // get the list of students along with student ID field // get back array of stdclass objects in sorted order, with members: @@ -388,7 +388,7 @@ while (($multipage || $onepage) && (!$endonepage)) { if (isstudent($course->id) && !isteacher($course->id)) { - $students[0] = get_user_info_from_db("id", $USER->id); + $students[0] = get_user_info_from_db("id", $USER->id); } else { // must be a teacher $students = attendance_get_course_students($attendance->course, "u.lastname ASC"); } @@ -404,24 +404,24 @@ while (($multipage || $onepage) && (!$endonepage)) { echo "".$studentid."\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 "".$status."\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 "".$tot."\n"; } @@ -440,9 +440,9 @@ if ($onepage) {$page++; echo "

\n"; } echo "

"; echo "
"; if (($numhours-4) > 255) { - echo "
"; + echo "
"; } else { $options["id"] = "$course->id"; $options["download"] = "xls"; @@ -473,50 +473,47 @@ if ($onepage) {$page++; echo "

\n"; } function attendance_print_header() { global $course, $cm; - /// Print the page header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } + /// 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 id>$strattendances -> $strallattendance", + print_header_simple("$strallattendance", "", + "id>$strattendances -> $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 "
". "
"; // this is the main table echo ""; echo ""; - if ($minatt!=0) { + if ($minatt!=0) { echo "\n"; - } else { + "id ."&pagereport=1&page=1\"><< \n". + "id ."&pagereport=1&page=".($page-1)."\"><\n"; + } else { echo "\n"; - } + } echo "\n"; - if ($maxatt!=$numatt) { + "$pg $page $of $maxpages\n"; + if ($maxatt!=$numatt) { echo ""; - } else { + } else { echo "\n"; - } - echo "
". - "id ."&pagereport=1&page=1\"><< \n". - "id ."&pagereport=1&page=".($page-1)."\"><<< <". - "$pg $page $of $maxpages". "id ."&pagereport=1&page=". ($page+1)."\">> ". "id ."&pagereport=1&page=$maxpages\">>>> >>
\n"; + } + echo "
\n"; } } diff --git a/mod/attendance/viewweek.php b/mod/attendance/viewweek.php index 537ec7e6a5..798e8d82a3 100644 --- a/mod/attendance/viewweek.php +++ b/mod/attendance/viewweek.php @@ -27,7 +27,7 @@ } else { if (! $attendances = get_attendance_for_week($attendance->id, $course->id)) { error("Course module is incorrect"); - } + } } } @@ -38,7 +38,7 @@ if ($attendances) { if ( !(isteacher($course->id) || isstudent($course->id)) ) { - attendance_print_header(); + attendance_print_header(); notice(get_string("noviews", "attendance")); print_footer($course); exit; } @@ -61,13 +61,13 @@ if ($attendances) { if (isstudent($course->id)) { $rolls = get_records("attendance_roll", "dayid", $form->id, "userid", $USER->id); } else { // must be a teacher - $rolls = get_records("attendance_roll", "dayid", $attendance->id); + $rolls = get_records("attendance_roll", "dayid", $attendance->id); } if ($rolls) { - foreach ($rolls as $roll) { - $atts[$numatt]->sroll[$roll->userid][$roll->hour]->status=$roll->status; - $atts[$numatt]->sroll[$roll->userid][$roll->hour]->notes=$roll->notes; - } + foreach ($rolls as $roll) { + $atts[$numatt]->sroll[$roll->userid][$roll->hour]->status=$roll->status; + $atts[$numatt]->sroll[$roll->userid][$roll->hour]->notes=$roll->notes; + } } $numatt++; } @@ -99,22 +99,22 @@ if ($download == "xls") { if ($dlsub== "all") { for($k=0;$k<$numatt;$k++) { // put notes for the date in the date heading - $myxls->write_string(1,$pos,userdate($atts[$k]->attendance->day,"%m/%0d")); - $myxls->set_column($pos,$pos,5); - $myxls->write_string(2,$pos,$atts[$k]->attendance->notes); - for ($i=1;$i<=$atts[$k]->attendance->hours;$i++) { - $myxls->write_number(3,$pos,$i); - $myxls->set_column($pos,$pos,1); - $pos++; - } + $myxls->write_string(1,$pos,userdate($atts[$k]->attendance->day,"%m/%0d")); + $myxls->set_column($pos,$pos,5); + $myxls->write_string(2,$pos,$atts[$k]->attendance->notes); + for ($i=1;$i<=$atts[$k]->attendance->hours;$i++) { + $myxls->write_number(3,$pos,$i); + $myxls->set_column($pos,$pos,1); + $pos++; + } } } // if dlsub==all - $myxls->write_string(3,$pos,get_string("total")); - $myxls->set_column($pos,$pos,5); - + $myxls->write_string(3,$pos,get_string("total")); + $myxls->set_column($pos,$pos,5); + /// generate the attendance rolls for the body of the spreadsheet if (isstudent($course->id)) { - $students[0] = get_user_info_from_db("id", $USER->id); + $students[0] = get_user_info_from_db("id", $USER->id); } else { // must be a teacher $students = attendance_get_course_students($attendance->course, "u.lastname ASC"); } @@ -130,28 +130,28 @@ if ($dlsub== "all") { $myxls->write_string($row,2,$studentid); $pos=3; if ($dlsub== "all") { - for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student - for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { - // set the attendance defaults for each student - if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;} - elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;} - else {$status=$P;} - $myxls->write_string($row,$pos,$status); - $pos++; - } /// for loop - } + for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student + for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { + // set the attendance defaults for each student + if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;} + elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;} + else {$status=$P;} + $myxls->write_string($row,$pos,$status); + $pos++; + } /// for loop + } } - $abs=$tar=0; + $abs=$tar=0; for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student - for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { - // set the attendance defaults for each student - if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;} - elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;} - } /// for loop - } // outer for for each day of attendance + for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { + // set the attendance defaults for each student + if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;} + elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;} + } /// for loop + } // outer for for each day of attendance $tot=attendance_tally_overall_absences_decimal($abs,$tar); $myxls->write_number($row,$pos,$tot); - $row++; + $row++; } $workbook->close(); @@ -170,16 +170,16 @@ if ($download == "txt") { if ($dlsub== "all") { for($k=0;$k<$numatt;$k++) { // put notes for the date in the date heading - echo "\t" . userdate($atts[$k]->attendance->day,"%m/%0d"); - echo (($atts[$k]->attendance->notes != "")?" ".$atts[$k]->attendance->notes:""); - for ($i=2;$i<=$atts[$k]->attendance->hours;$i++) { echo "\t$i"; } + echo "\t" . userdate($atts[$k]->attendance->day,"%m/%0d"); + echo (($atts[$k]->attendance->notes != "")?" ".$atts[$k]->attendance->notes:""); + for ($i=2;$i<=$atts[$k]->attendance->hours;$i++) { echo "\t$i"; } } } // if dlsub==all - echo "\t". get_string("total") . "\n"; - + echo "\t". get_string("total") . "\n"; + /// generate the attendance rolls for the body of the spreadsheet if (isstudent($course->id)) { - $students[0] = get_user_info_from_db("id", $USER->id); + $students[0] = get_user_info_from_db("id", $USER->id); } else { // must be a teacher $students = attendance_get_course_students($attendance->course, "u.lastname ASC"); } @@ -194,27 +194,27 @@ if ($dlsub== "all") { $studentid=(($student->idnumber != "") ? $student->idnumber : " "); echo "\t". $studentid; if ($dlsub== "all") { - for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student - for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { - // set the attendance defaults for each student - if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;} - elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;} - else {$status=$P;} - echo "\t".$status; - } /// for loop - } + for($k=0;$k<$numatt;$k++) { // for each day of attendance for the student + for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { + // set the attendance defaults for each student + if ($atts[$k]->sroll[$student->id][$j]->status == 1) {$status=$T;} + elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {$status=$A;} + else {$status=$P;} + echo "\t".$status; + } /// for loop + } } - $abs=$tar=0; + $abs=$tar=0; for($k=0;$k<$numatt;$k++) { // for eacj day of attendance for the student - for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { - // set the attendance defaults for each student - if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;} - elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;} - } /// for loop - } // outer for for each day of attendance + for($j=1;$j<=$atts[$k]->attendance->hours;$j++) { + // set the attendance defaults for each student + if ($atts[$k]->sroll[$student->id][$j]->status == 1) {;$tar++;} + elseif ($atts[$k]->sroll[$student->id][$j]->status == 2) {;$abs++;} + } /// for loop + } // outer for for each day of attendance $tot=attendance_tally_overall_absences_decimal($abs,$tar); echo "\t".$tot."\n"; - $row++; + $row++; } exit; } @@ -238,7 +238,7 @@ if ($dlsub== "all") { } else if ($onepage) { $multipage=false; } else { // if onepage is set to false - $multilpage=true; + $multilpage=true; } // adjust the width for the report for students @@ -249,39 +249,39 @@ if ($dlsub== "all") { $hoursinreport = $CFG->attendance_hours_in_full_report + 15; } else { $hoursinreport = $CFG->attendance_hours_in_full_report; - } + } while (($multipage || $onepage) && (!$endonepage)) { // this makes for a one iteration loop for multipage - $multipage = false; - - + $multipage = false; + + if ($numhours>=$hoursinreport) { - if (!isset($pagereport)) { - // $pagereport is used to determine whether the report needs to be paged at all - $pagereport=true; - $endatt=0; - $page=1; - } - // find the last hour to have on this page of the report - // go to the next (or first) page -// $endatt++; -// $startatt=$endatt; - $curpage=1; - $endatt=0; + if (!isset($pagereport)) { + // $pagereport is used to determine whether the report needs to be paged at all + $pagereport=true; + $endatt=0; + $page=1; + } + // find the last hour to have on this page of the report + // go to the next (or first) page +// $endatt++; +// $startatt=$endatt; + $curpage=1; + $endatt=0; for($curpage=1;true;$curpage++) { // the for loop is broken from the inside - $pagehours=$atts[$endatt]->attendance->hours; - $startatt=$endatt; - while(($pagehours<$hoursinreport)) { - if ($endatt>=$numatt) { break 2; } // end the page number calculations and trigger the end of a multi-page report! - $endatt++; - $pagehours=$pagehours+$atts[$endatt]->attendance->hours; - } - // if this is the page we're on, save the info - if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; } + $pagehours=$atts[$endatt]->attendance->hours; + $startatt=$endatt; + while(($pagehours<$hoursinreport)) { + if ($endatt>=$numatt) { break 2; } // end the page number calculations and trigger the end of a multi-page report! + $endatt++; + $pagehours=$pagehours+$atts[$endatt]->attendance->hours; + } + // if this is the page we're on, save the info + if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; } } // hopefully at this point, startatt and endatt are set correctly for the current page - if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; } else { - $endatt=$endatt_target; $startatt=$startatt_target; } - $maxpages = $curpage; + if ($curpage == $page) {$endatt_target = $endatt; $startatt_target = $startatt; } else { + $endatt=$endatt_target; $startatt=$startatt_target; } + $maxpages = $curpage; } else {$pagereport=false;} $minatt=($pagereport ? $startatt : 0); @@ -298,12 +298,12 @@ while (($multipage || $onepage) && (!$endonepage)) { // print other links at top of page - $strviewsection = get_string("viewsection", "attendance"); - $strviewweek = get_string("viewweek", "attendance"); - $strviewall = get_string("viewall", "attendance"); - $strviewone = get_string("viewone", "attendance"); - $strviewtable = get_string("viewtable", "attendance"); - $strviewmulti = get_string("viewmulti", "attendance"); + $strviewsection = get_string("viewsection", "attendance"); + $strviewweek = get_string("viewweek", "attendance"); + $strviewall = get_string("viewall", "attendance"); + $strviewone = get_string("viewone", "attendance"); + $strviewtable = get_string("viewtable", "attendance"); + $strviewmulti = get_string("viewmulti", "attendance"); echo "

id."\">"; @@ -350,7 +350,7 @@ while (($multipage || $onepage) && (!$endonepage)) { "cellpadding=\"5\" cellspacing=\"1\" class=\"generaltable\">"; if (isteacher($course->id)) { echo "". - " \n"; + " \n"; } // $minpage=0;$maxpage=$numatt; // print the date headings at the top of the table @@ -359,9 +359,9 @@ while (($multipage || $onepage) && (!$endonepage)) { // put notes for the date in the date heading $notes = ($atts[$k]->attendance->notes != "") ? ":
".$atts[$k]->attendance->notes : ""; $auto = ($atts[$k]->attendance->autoattend == 1) ? "(".get_string("auto","attendance").")" : ""; - echo "attendance->hours. "\" nowrap class=\"generaltableheader\">". - "
attendance->cmid."\">".userdate($atts[$k]->attendance->day,"%m/%0d")."".$auto. - $notes."\n"; + echo "attendance->hours. "\" nowrap class=\"generaltableheader\">". + "attendance->cmid."\">".userdate($atts[$k]->attendance->day,"%m/%0d")."".$auto. + $notes."\n"; } // if we're at the end of the report if ($maxatt==$numatt || !$pagereport) { @@ -370,23 +370,23 @@ while (($multipage || $onepage) && (!$endonepage)) { echo "\n"; // print the second level headings with name and possibly hour numbers if (isteacher($course->id)) { - echo "Last Name\n"; - echo "First Name\n"; - echo "ID\n"; + echo "Last Name\n"; + echo "First Name\n"; + echo "ID\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 "".$i."\n"; - } - } else { echo " \n"; } + for($i=1;$i<=$atts[$k]->attendance->hours;$i++) { + echo "".$i."\n"; + } + } else { echo " \n"; } } // if we're at the end of the report if ($maxatt==$numatt || !$pagereport) { echo "total"; } - echo "\n"; + echo "\n"; // get the list of students along with student ID field // get back array of stdclass objects in sorted order, with members: @@ -395,7 +395,7 @@ while (($multipage || $onepage) && (!$endonepage)) { if (isstudent($course->id)) { - $students[0] = get_user_info_from_db("id", $USER->id); + $students[0] = get_user_info_from_db("id", $USER->id); } else { // must be a teacher $students = attendance_get_course_students($attendance->course, "u.lastname ASC"); } @@ -411,24 +411,24 @@ while (($multipage || $onepage) && (!$endonepage)) { echo "".$studentid."\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 "".$status."\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 "".$tot."\n"; } @@ -447,9 +447,9 @@ if ($onepage) {$page++; echo "

\n"; } echo "

"; echo "
"; if (($numhours-4) > 255) { - echo "
"; + echo "
"; } else { $options["id"] = "$id"; $options["download"] = "xls"; @@ -480,34 +480,34 @@ if ($onepage) {$page++; echo "

\n"; } function attendance_print_pagenav() { global $pagereport, $minatt, $maxatt, $course, $page, $numatt, $maxpages, $attendance,$scope,$id; - if ($pagereport) { - $of = get_string('of','attendance'); - $pg = get_string('page'); + if ($pagereport) { + $of = get_string('of','attendance'); + $pg = get_string('page'); - echo "
". "
"; // this is the main table echo ""; echo ""; - if ($minatt!=0) { + if ($minatt!=0) { echo "\n"; - } else { + "< \n"; + "<<\n"; + } else { echo "\n"; - } + } echo "\n"; - if ($maxatt!=$numatt) { + "$pg $page $of $maxpages\n"; + if ($maxatt!=$numatt) { echo ""; - } else { + } else { echo "\n"; - } - echo "
". - "< \n"; - "<<<< <". - "$pg $page $of $maxpages". "> ". ">>> >>
\n"; + } + echo "
\n"; } } @@ -516,15 +516,12 @@ function attendance_print_header() { /// Print the page header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } $strattendances = get_string("modulenameplural", "attendance"); $strattendance = get_string("modulename", "attendance"); $strweekattendance = get_string("weekmodulename", "attendance"); - print_header("$course->shortname: $strallattendance", "$course->fullname", - "$navigation id>$strattendances -> $strweekattendance", + print_header_simple("$strallattendance", "", + "id>$strattendances -> $strweekattendance", "", "", true, " ", navmenu($course, $cm)); } diff --git a/mod/chat/index.php b/mod/chat/index.php index 794510425e..d5490644af 100644 --- a/mod/chat/index.php +++ b/mod/chat/index.php @@ -22,11 +22,7 @@ /// Print the header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - - 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 diff --git a/mod/chat/report.php b/mod/chat/report.php index d6991e7178..c58aca4f6c 100644 --- a/mod/chat/report.php +++ b/mod/chat/report.php @@ -33,12 +33,6 @@ add_to_log($course->id, "chat", "report", "report.php?id=$cm->id", "$chat->id", "$cm->id"); -/// Print the page header - - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strchats = get_string("modulenameplural", "chat"); $strchat = get_string("modulename", "chat"); $strchatreport = get_string("chatreport", "chat"); @@ -58,8 +52,8 @@ $groupparam = ""; } - print_header("$course->shortname: $chat->name: $strchatreport", "$course->fullname", - "$navigation id\">$strchats -> + print_header_simple("$chat->name: $strchatreport", "", + "id\">$strchats -> id\">$chat->name -> id\">$strchatreport", "", "", true, "", navmenu($course, $cm)); @@ -97,8 +91,8 @@ /// Print the Sessions display - print_header("$course->shortname: $chat->name: $strchatreport", "$course->fullname", - "$navigation id\">$strchats -> + print_header_simple("$chat->name: $strchatreport", "", + "id\">$strchats -> id\">$chat->name -> $strchatreport", "", "", true, "", navmenu($course, $cm)); diff --git a/mod/chat/view.php b/mod/chat/view.php index a314457f14..36fe25b776 100644 --- a/mod/chat/view.php +++ b/mod/chat/view.php @@ -43,10 +43,6 @@ /// Print the page header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strchats = get_string("modulenameplural", "chat"); $strchat = get_string("modulename", "chat"); $strenterchat = get_string("enterchat", "chat"); @@ -54,8 +50,8 @@ $strcurrentusers = get_string("currentusers", "chat"); $strnextsession = get_string("nextsession", "chat"); - print_header("$course->shortname: $chat->name", "$course->fullname", - "$navigation id>$strchats -> $chat->name", + print_header_simple("$chat->name", "", + "id>$strchats -> $chat->name", "", "", true, update_module_button($cm->id, $course->id, $strchat), navmenu($course, $cm)); diff --git a/mod/choice/index.php b/mod/choice/index.php index 94cf5f370b..378ab7c0b4 100644 --- a/mod/choice/index.php +++ b/mod/choice/index.php @@ -13,17 +13,11 @@ add_to_log($course->id, "choice", "view all", "index?id=$course->id", ""); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } 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)) { diff --git a/mod/choice/view.php b/mod/choice/view.php index 1d4b8dc49e..c33c86f92f 100644 --- a/mod/choice/view.php +++ b/mod/choice/view.php @@ -61,13 +61,8 @@ add_to_log($course->id, "choice", "view", "view.php?id=$cm->id", $choice->id, $cm->id); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } else { - $navigation = ""; - } - print_header("$course->shortname: $choice->name", "$course->fullname", - "$navigation id>$strchoices -> $choice->name", "", "", true, + print_header_simple("$choice->name", "", + "id>$strchoices -> $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 diff --git a/mod/dialogue/dialogues.php b/mod/dialogue/dialogues.php index 1cf3731440..7611826281 100644 --- a/mod/dialogue/dialogues.php +++ b/mod/dialogue/dialogues.php @@ -1,17 +1,17 @@ id); - + require_login($course->id); + // set up some general variables $usehtmleditor = can_use_html_editor(); - - $navigation = ""; - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } $strdialogues = get_string("modulenameplural", "dialogue"); $strdialogue = get_string("modulename", "dialogue"); - // ... print the header and... - print_header("$course->shortname: $dialogue->name", "$course->fullname", - "$navigation id>$strdialogues -> + // ... print the header and... + print_header_simple("$dialogue->name", "", + "id>$strdialogues -> id\">$dialogue->name", "", "", 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 "
\n"; echo "\n"; @@ -119,70 +114,70 @@ echo "\n"; echo "
\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 "
\n"; - print_simple_box( text_to_html($dialogue->intro) , "center"); - echo "
"; - - dialogue_list_closed_conversations($dialogue); - } - - /****************** open conversation ************************************/ - elseif ($action == 'openconversation' ) { + } + + /****************** list closed conversations *********************************/ + elseif ($action == 'listclosed') { + + echo "
\n"; + print_simple_box( text_to_html($dialogue->intro) , "center"); + echo "
"; + + 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 @@ -256,61 +251,61 @@ } 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 "
\n"; - print_simple_box( text_to_html($dialogue->intro) , "center"); - echo "
"; - - 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 "
\n"; + print_simple_box( text_to_html($dialogue->intro) , "center"); + echo "
"; + + 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 "
\n"; - print_simple_box( text_to_html($dialogue->intro) , "center"); - echo "
"; - - 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 "
\n"; + print_simple_box( text_to_html($dialogue->intro) , "center"); + echo "
"; + + 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); diff --git a/mod/dialogue/index.php b/mod/dialogue/index.php index ad9e4af5b5..a7606af8fd 100644 --- a/mod/dialogue/index.php +++ b/mod/dialogue/index.php @@ -13,17 +13,13 @@ require_login($course->id); add_to_log($course->id, "dialogue", "view all", "index.php?id=$course->id", ""); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $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)); @@ -42,7 +38,7 @@ if (!$cm = get_coursemodule_from_instance("dialogue", $dialogue->id, $course->id)) { error("Course Module ID was incorrect"); } - $table->data[] = array ("id\">$dialogue->name", + $table->data[] = array ("id\">$dialogue->name", dialogue_count_open($dialogue, $USER), dialogue_count_closed($dialogue, $USER)); } echo "
"; diff --git a/mod/dialogue/view.php b/mod/dialogue/view.php index 679ac162bf..5aa5718735 100644 --- a/mod/dialogue/view.php +++ b/mod/dialogue/view.php @@ -28,49 +28,45 @@ // set up some general variables $usehtmleditor = can_use_html_editor(); - - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } $strdialogue = get_string("modulename", "dialogue"); $strdialogues = get_string("modulenameplural", "dialogue"); - print_header("$course->shortname: $dialogue->name", "$course->fullname", - "$navigation id\">$strdialogues -> $dialogue->name", + print_header_simple("$dialogue->name", "", + "id\">$strdialogues -> $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 "
"; - // get some stats + /************ view **************************************************/ + elseif ($action == 'view') { + + print_simple_box( format_text($dialogue->intro) , "center"); + echo "
"; + // 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); @@ -121,7 +117,7 @@ echo "
\n"; - switch ($pane) { + switch ($pane) { case 0: if (isteacher($course->id)) { /// Check to see if groups are being used in this dialogue @@ -139,57 +135,57 @@ } if ($names = dialogue_get_available_users($dialogue)) { - print_simple_box_start("center"); - echo "
"; - echo "
\n"; - echo "id\">\n"; - echo "\n"; - echo "\n"; + print_simple_box_start("center"); + echo "
"; + echo "\n"; + echo "id\">\n"; + echo "\n"; + echo "
\n"; echo "\n"; - echo "\n"; echo "\n"; echo "\n"; - echo "\n"; - echo ""; - echo ""; + echo "\n"; - echo "
".get_string("openadialoguewith", "dialogue"). " : "; + echo ""; choose_from_menu($names, "recipientid"); echo "
".get_string("subject", "dialogue")." :
". + echo "
". get_string("typefirstentry", "dialogue")."
\n"; - helpbutton("writing", get_string("helpwriting"), "moodle", true, true); - echo "
"; - echo "
\n"; + echo "
\n"; + helpbutton("writing", get_string("helpwriting"), "moodle", true, true); + echo "
"; + echo "
\n"; print_textarea($usehtmleditor, 20, 75, 630, 300, "firstentry"); use_html_editor(); - echo "
\n"; - echo "
"; - print_simple_box_end(); - } else { + echo "\n"; + echo "
"; + 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); diff --git a/mod/exercise/assessments.php b/mod/exercise/assessments.php index de7d499ab0..18954a2367 100644 --- a/mod/exercise/assessments.php +++ b/mod/exercise/assessments.php @@ -50,19 +50,14 @@ exercise_add_custom_scales($exercise); require_login($course->id); - - $navigation = ""; - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } $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 id>$strexercises -> + print_header_simple("$exercise->name", "", + "id>$strexercises -> id\">$exercise->name -> $strassessments", "", "", true); diff --git a/mod/exercise/index.php b/mod/exercise/index.php index 1a834fd3d0..2c6602a7c5 100644 --- a/mod/exercise/index.php +++ b/mod/exercise/index.php @@ -13,22 +13,18 @@ require_login($course->id); add_to_log($course->id, "exercise", "view all", "index.php?id=$course->id", ""); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $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"); @@ -57,22 +53,22 @@ } foreach ($exercises as $exercise) { - if ($exercise->deadline > $timenow) { + if ($exercise->deadline > $timenow) { $due = userdate($exercise->deadline); } else { $due = "".userdate($exercise->deadline).""; } if ($submissions = exercise_get_user_submissions($exercise, $USER)) { foreach ($submissions as $submission) { - if ($submission->late) { - $submitted = "".userdate($submission->timecreated).""; - } - else { - $submitted = userdate($submission->timecreated); - } - $link = "coursemodule\">$exercise->name"; - $title = $submission->title; - if ($course->format == "weeks" or $course->format == "topics") { + if ($submission->late) { + $submitted = "".userdate($submission->timecreated).""; + } + else { + $submitted = userdate($submission->timecreated); + } + $link = "coursemodule\">$exercise->name"; + $title = $submission->title; + if ($course->format == "weeks" or $course->format == "topics") { if (isteacher($course->id)) { $phase = ''; switch ($exercise->phase) { @@ -89,7 +85,7 @@ } 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... @@ -110,31 +106,31 @@ $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 = "coursemodule\">$exercise->name"; - if ($course->format == "weeks" or $course->format == "topics") { + $title = ''; + $link = "coursemodule\">$exercise->name"; + 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 "
"; print_table($table); diff --git a/mod/exercise/submissions.php b/mod/exercise/submissions.php index 12998931fc..d2f0af4090 100644 --- a/mod/exercise/submissions.php +++ b/mod/exercise/submissions.php @@ -41,17 +41,13 @@ require_login($course->id); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $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 id>$strexercises -> + print_header_simple("$exercise->name", "", + "$id>$strexercises -> id\">$exercise->name -> $strsubmissions", "", "", true); diff --git a/mod/exercise/upload.php b/mod/exercise/upload.php index aba68ec7a1..83b0b00682 100644 --- a/mod/exercise/upload.php +++ b/mod/exercise/upload.php @@ -10,29 +10,26 @@ $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 = "id\">$course->shortname ->"; - } $strexercises = get_string("modulenameplural", "exercise"); $strexercise = get_string("modulename", "exercise"); $strupload = get_string("upload"); - print_header("$course->shortname: $exercise->name : $strupload", "$course->fullname", - "$navigation id>$strexercises -> + print_header_simple("$exercise->name : $strupload", "", + "id>$strexercises -> id\">$exercise->name -> $strupload", "", "", true); @@ -54,58 +51,58 @@ // 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"); diff --git a/mod/exercise/view.php b/mod/exercise/view.php index 2413e49d6e..4031b102d9 100644 --- a/mod/exercise/view.php +++ b/mod/exercise/view.php @@ -1,114 +1,110 @@ 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 = "id\">$course->shortname ->"; - } + 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 id>$strexercises -> $exercise->name", + print_header_simple("$exercise->name", "", + "id>$strexercises -> $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 "
"; - echo ""; - echo ""; - echo ""; - echo "\n"; - // now the weights - echo ""; - echo "\n"; - echo "\n"; - echo "\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 "
cellheading2\">".get_string("submissions", "exercise")."cellheading2\" align=\"center\">".get_string("gradeforassessment", "exercise")."cellheading2\" align=\"center\">".get_string("gradeforsubmission", "exercise", $course->teacher)."cellheading2\" align=\"center\">".get_string("overallgrade", "exercise")."
cellheading2\">".get_string("maximumgrade")."cellheading2\" align=\"center\">$exercise->gradinggradecellheading2\" align=\"center\">$exercise->gradecellheading2\"> 
"; + echo ""; + echo ""; + echo ""; + echo "\n"; + // now the weights + echo ""; + echo "\n"; + echo "\n"; + echo "\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); @@ -118,86 +114,86 @@ $grade = "(".$grade.")"; $overallgrade = "(".$overallgrade.")"; } - echo "\n"; - echo ""; - echo ""; - echo "\n"; - } - } - } - } - echo "
cellheading2\">".get_string("submissions", "exercise")."cellheading2\" align=\"center\">".get_string("gradeforassessment", "exercise")."cellheading2\" align=\"center\">".get_string("gradeforsubmission", "exercise", $course->teacher)."cellheading2\" align=\"center\">".get_string("overallgrade", "exercise")."
cellheading2\">".get_string("maximumgrade")."cellheading2\" align=\"center\">$exercise->gradinggradecellheading2\" align=\"center\">$exercise->gradecellheading2\"> 
".exercise_print_submission_title($exercise, $submission)."$gradinggrade$grade$overallgrade

\n"; - if ($exercise->showleaguetable) { + echo "".exercise_print_submission_title($exercise, $submission)."\n"; + echo "$gradinggrade"; + echo "$grade"; + echo "$overallgrade\n"; + } + } + } + } + echo "
\n"; + if ($exercise->showleaguetable) { exercise_print_league_table($exercise); } - echo "
".get_string("maximumgrade").": $exercise->grade
\n"; - } + echo "
".get_string("maximumgrade").": $exercise->grade
\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 "
"; + // show student's assessment (linked to the teacher's exercise/submission + print_heading(get_string("yourassessment", "exercise")); + exercise_list_teacher_submissions($exercise, $USER); + echo "
"; 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")); @@ -233,73 +229,73 @@ print_heading(get_string("pleasesubmityourwork", "exercise").":"); exercise_print_upload_form($exercise); } - echo "
"; - } - - - /****************** 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 "
"; + } + + + /****************** 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 "
"; - 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 "
"; - print_heading(get_string("pleasesubmityourwork", "exercise").":"); - exercise_print_upload_form($exercise); - echo "
"; - } - } - } - } - - - /****************** 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 "
"; - - // 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 "
"; + 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 "
"; + print_heading(get_string("pleasesubmityourwork", "exercise").":"); + exercise_print_upload_form($exercise); + echo "
"; + } + } + } + } + + + /****************** 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 "
"; + + // 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 @@ -313,27 +309,27 @@ 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 "
\n"; - switch ($exercise->phase) { - case 0: - case 1: // set up assignment + echo "
\n"; + switch ($exercise->phase) { + case 0: + case 1: // set up assignment if (isteacheredit($course->id)) { echo "

id&action=editelements\">". get_string("amendassessmentelements", "exercise")." \n"; @@ -342,37 +338,37 @@ get_string("submitexercisedescription", "exercise")." \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 "

id&action=listforassessmentstudent\">". - get_string("studentsubmissionsforassessment", "exercise", - exercise_count_unassessed_student_submissions($exercise))." \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 "

id&action=listforassessmentstudent\">". + get_string("studentsubmissionsforassessment", "exercise", + exercise_count_unassessed_student_submissions($exercise))." \n"; + helpbutton("grading", get_string("studentsubmissionsforassessment", "exercise"), "exercise"); - break; - - case 3: // show final grades - echo "

id&action=listforassessmentstudent\">". - get_string("studentsubmissionsforassessment", "exercise", - exercise_count_unassessed_student_submissions($exercise))." \n"; - helpbutton("grading", get_string("studentsubmissionsforassessment", "exercise"), + break; + + case 3: // show final grades + echo "

id&action=listforassessmentstudent\">". + get_string("studentsubmissionsforassessment", "exercise", + exercise_count_unassessed_student_submissions($exercise))." \n"; + helpbutton("grading", get_string("studentsubmissionsforassessment", "exercise"), "exercise"); - print_heading("id&action=displayfinalgrades\">". - get_string("displayoffinalgrades", "exercise").""); - } - print_heading("id&action=adminlist\">". - get_string("administration").""); - } - - - /*************** no man's land **************************************/ - else { - error("Fatal Error: Unknown Action: ".$action."\n"); - } - - print_footer($course); - + print_heading("id&action=displayfinalgrades\">". + get_string("displayoffinalgrades", "exercise").""); + } + print_heading("id&action=adminlist\">". + get_string("administration").""); + } + + + /*************** no man's land **************************************/ + else { + error("Fatal Error: Unknown Action: ".$action."\n"); + } + + print_footer($course); + ?> diff --git a/mod/forum/subscribers.php b/mod/forum/subscribers.php index 0699b12c58..d1d5a56519 100644 --- a/mod/forum/subscribers.php +++ b/mod/forum/subscribers.php @@ -43,16 +43,10 @@ $strsubscribers = get_string("subscribers", "forum"); $strforums = get_string("forums", "forum"); - if ($course->category) { - $navigation = "id\">$course->shortname -> - id\">$strforums -> + $navigation = "id\">$strforums -> id\">$forum->name -> $strsubscribers"; - } else { - $navigation = "id\">$strforums -> - id\">$forum->name -> $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 diff --git a/mod/forum/view.php b/mod/forum/view.php index 2835afa33c..4f33c9acae 100644 --- a/mod/forum/view.php +++ b/mod/forum/view.php @@ -60,11 +60,8 @@ if ($course->category) { require_login($course->id); - $navigation = "id\">$course->shortname -> - id\">$strforums ->"; - } else { - $navigation = "id\">$strforums ->"; - } + } + $navigation = "id\">$strforums ->"; if ($forum->type == "teacher") { if (!isteacher($course->id)) { @@ -78,7 +75,7 @@ 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)) { diff --git a/mod/glossary/comment.php b/mod/glossary/comment.php index 2c4e8dd916..f80912dfc3 100644 --- a/mod/glossary/comment.php +++ b/mod/glossary/comment.php @@ -46,11 +46,6 @@ } add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id",$cm->id); - /// Printing the page header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - switch ( $action ){ case "add": $straction = get_string("addingcomment","glossary"); @@ -66,8 +61,8 @@ $strglossary = get_string("modulename", "glossary"); $strcomments = get_string("comments", "glossary"); - print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname", - "$navigation id>$strglossaries -> id>$glossary->name -> id&eid=$entry->id>$strcomments -> " . $straction, + print_header_simple(strip_tags("$glossary->name"), "", + "id>$strglossaries -> id>$glossary->name -> id&eid=$entry->id>$strcomments -> " . $straction, "", "", true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm)); @@ -77,7 +72,7 @@ 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 "

" . get_string("commentdeleted","glossary") . "
"; @@ -89,7 +84,7 @@ } 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 "

" . get_string("areyousuredeletecomment","glossary"); diff --git a/mod/glossary/comments.php b/mod/glossary/comments.php index 43c756414c..d69eb54b85 100644 --- a/mod/glossary/comments.php +++ b/mod/glossary/comments.php @@ -6,8 +6,8 @@ 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"); @@ -33,12 +33,6 @@ add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id",$cm->id); - -/// Printing the page header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strglossaries = get_string("modulenameplural", "glossary"); $strglossary = get_string("modulename", "glossary"); $strallcategories = get_string("allcategories", "glossary"); @@ -50,8 +44,8 @@ $strcomments = get_string("comments", "glossary"); $straddcomment = get_string("addcomment", "glossary"); - print_header(strip_tags("$course->shortname: $strcomments: $entry->concept"), "$course->fullname", - "$navigation id>$strglossaries -> id>$glossary->name -> $strcomments", + print_header_simple(strip_tags("$strcomments: $entry->concept"), "", + "id>$strglossaries -> id>$glossary->name -> $strcomments", "", "", true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm)); @@ -65,13 +59,13 @@ print_heading(get_string('commentson','glossary')." \"$entry->concept\""); - if ($glossary->allowcomments) { + if ($glossary->allowcomments) { print_heading("id&eid=$entry->id\">$straddcomment "); } 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 '
'; } } else { diff --git a/mod/glossary/deleteentry.php b/mod/glossary/deleteentry.php index 2ffa4f4a1b..30f355c6cd 100644 --- a/mod/glossary/deleteentry.php +++ b/mod/glossary/deleteentry.php @@ -40,18 +40,14 @@ $entryfields = get_record("glossary_entries", "id", $entry); $strareyousuredelete = get_string("areyousuredelete","glossary"); - - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - print_header("$course->shortname: $glossary->name", "$course->fullname", - "$navigation id>$strglossaries -> $glossary->name", + print_header_simple("$glossary->name", "", + "id>$strglossaries -> $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); @@ -59,7 +55,7 @@ $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 { @@ -69,7 +65,7 @@ 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); diff --git a/mod/glossary/editcategories.php b/mod/glossary/editcategories.php index 6cd641ca3d..03a0168c5e 100644 --- a/mod/glossary/editcategories.php +++ b/mod/glossary/editcategories.php @@ -15,7 +15,7 @@ optional_variable($name); // confirm the action $action = strtolower($action); - + if (! $cm = get_record("course_modules", "id", $id)) { error("Course Module ID was incorrect"); } @@ -36,15 +36,11 @@ // add_to_log($course->id, "glossary", "edit categories", "view.php?id=$cm->id", "$glossary->id", $cm->id); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strglossaries = get_string("modulenameplural", "glossary"); $strglossary = get_string("modulename", "glossary"); - print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname", - "$navigation id>$strglossaries -> id&tab=GLOSSARY_CATEGORY_VIEW>$glossary->name -> " . get_string("categories","glossary"), + print_header_simple(strip_tags("$glossary->name"), "", + "id>$strglossaries -> id&tab=GLOSSARY_CATEGORY_VIEW>$glossary->name -> " . get_string("categories","glossary"), "", "", true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm)); @@ -59,8 +55,8 @@ $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); } @@ -76,26 +72,26 @@ } 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 "
" . get_string("categorydeleted","glossary") ."
"; - echo "
"; - print_simple_box_end(); - - print_footer($course); + + print_simple_box_start("center","40%", "#FFBBBB"); + echo "
" . get_string("categorydeleted","glossary") ."
"; + echo "
"; + 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 "

" . get_string("delete"). " " . get_string("category","glossary") . ""; - print_simple_box_start("center","40%", "#FFBBBB"); - echo "

$category->name
"; - - $num_entries = count_records("glossary_entries_categories","categoryid",$category->id); + print_simple_box_start("center","40%", "#FFBBBB"); + echo "
$category->name
"; + + $num_entries = count_records("glossary_entries_categories","categoryid",$category->id); if ( $num_entries ) { print_string("deletingnoneemptycategory","glossary"); } @@ -105,7 +101,7 @@ ?>
- + @@ -119,8 +115,8 @@ $options = array ("id" => $id); print_single_button("editcategories.php", $options, get_string("no") ); echo ""; - echo "
"; - print_simple_box_end(); + echo "
"; + print_simple_box_end(); } } } elseif ( $action == "add" ) { @@ -129,14 +125,14 @@ if ( $dupcategory ) { echo "

" . get_string("add"). " " . get_string("category","glossary") . ""; - print_simple_box_start("center","40%", "#FFBBBB"); - echo "

" . get_string("duplicatedcategory","glossary") ."
"; - echo "
"; - print_simple_box_end(); - - print_footer($course); + print_simple_box_start("center","40%", "#FFBBBB"); + echo "
" . get_string("duplicatedcategory","glossary") ."
"; + echo "
"; + 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 = ""; @@ -145,9 +141,9 @@ $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); } @@ -195,8 +191,8 @@ id&action=delete&mode=cat&hook=$category->id\">\"" "; - echo "id&action=edit&mode=cat&hook=$category->id\">\"""; + echo "id&action=delete&mode=cat&hook=$category->id\">\"" "; + echo "id&action=edit&mode=cat&hook=$category->id\">\"""; ?> diff --git a/mod/glossary/exportentry.php b/mod/glossary/exportentry.php index 9df524cbe8..93809a5b00 100644 --- a/mod/glossary/exportentry.php +++ b/mod/glossary/exportentry.php @@ -1,31 +1,31 @@ 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"); @@ -39,69 +39,65 @@ $entryalreadyexist = get_string("entryalreadyexist","glossary"); $entryexported = get_string("entryexported","glossary"); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - - print_header("$course->shortname: $glossary->name", "$course->fullname", - "$navigation id>$strglossaries -> $glossary->name", + print_header_simple("$glossary->name", "", + "id>$strglossaries -> $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 "
"; + if ( !$confirm ) { + echo "
"; $areyousure = get_string("areyousureexport","glossary"); - notice_yesno ("

$entry->concept

$areyousure
$mainglossary->name?", - "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 ("

$entry->concept

$areyousure
$mainglossary->name?", + "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 "

$entryexported

"; 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 "

$entryalreadyexist

"; - echo "

"; + redirect("view.php?id=$cm->id&mode=entry&hook=".$entry->id); + die; + } + } else { + print_simple_box_start("center", "60%", "#FFBBBB"); + echo "

$entryalreadyexist

"; + echo "

"; - 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(); ?> diff --git a/mod/glossary/import.php b/mod/glossary/import.php index e9c35a264d..94695ec3c5 100644 --- a/mod/glossary/import.php +++ b/mod/glossary/import.php @@ -32,10 +32,6 @@ error("You must be a teacher to use this page."); } - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - if ($dest != 'new' and $dest != 'current') { $dest = 'current'; } @@ -48,8 +44,8 @@ $strsearchindefinition = get_string("searchindefinition", "glossary"); $strsearch = get_string("search"); - print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname", - "$navigation id>$strglossaries -> $glossary->name", + print_header_simple(strip_tags("$glossary->name"), "", + "id>$strglossaries -> $glossary->name", "", "", true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm)); diff --git a/mod/glossary/index.php b/mod/glossary/index.php index 8c5364e3ff..ea43d6b9b3 100644 --- a/mod/glossary/index.php +++ b/mod/glossary/index.php @@ -27,11 +27,7 @@ /// Print the header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - - 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 diff --git a/mod/journal/index.php b/mod/journal/index.php index da91a117ad..90a503c9cd 100644 --- a/mod/journal/index.php +++ b/mod/journal/index.php @@ -12,16 +12,12 @@ require_login($course->id); add_to_log($course->id, "journal", "view all", "index.php?id=$course->id", ""); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $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)); diff --git a/mod/journal/view.php b/mod/journal/view.php index 7b472d51d0..040b354047 100644 --- a/mod/journal/view.php +++ b/mod/journal/view.php @@ -25,15 +25,11 @@ error("Course module is incorrect"); } - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strjournal = get_string("modulename", "journal"); $strjournals = get_string("modulenameplural", "journal"); - print_header("$course->shortname: $journal->name", "$course->fullname", - "$navigation id>$strjournals -> $journal->name", "", "", true, + print_header_simple("$journal->name", "", + "id>$strjournals -> $journal->name", "", "", true, update_module_button($cm->id, $course->id, $strjournal), navmenu($course, $cm)); if (isteacher($course->id)) { diff --git a/mod/lesson/index.php b/mod/lesson/index.php index 7faafa8058..5dcba6df65 100644 --- a/mod/lesson/index.php +++ b/mod/lesson/index.php @@ -24,11 +24,7 @@ /// Print the header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - - 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 diff --git a/mod/lesson/view.php b/mod/lesson/view.php index c758dfc6ab..f03e3fa18e 100644 --- a/mod/lesson/view.php +++ b/mod/lesson/view.php @@ -26,15 +26,11 @@ /// Print the page header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strlessons = get_string("modulenameplural", "lesson"); $strlesson = get_string("modulename", "lesson"); - print_header("$course->shortname: $lesson->name", "$course->fullname", - "$navigation id>$strlessons -> id\">$lesson->name", + print_header_simple("$lesson->name", "", + "id>$strlessons -> id\">$lesson->name", "", "", true, update_module_button($cm->id, $course->id, $strlesson), navmenu($course, $cm)); diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index a93239ce35..19af16c31d 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -54,15 +54,11 @@ // Print the page header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strquizzes = get_string("modulenameplural", "quiz"); $strquiz = get_string("modulename", "quiz"); - print_header("$course->shortname: $quiz->name", "$course->fullname", - "$navigation id>$strquizzes -> + print_header_simple("$quiz->name", "", + "id>$strquizzes -> id\">$quiz->name -> $strattemptnum", "", "", true); diff --git a/mod/quiz/index.php b/mod/quiz/index.php index c6b18eacd5..1cd1c82753 100644 --- a/mod/quiz/index.php +++ b/mod/quiz/index.php @@ -30,11 +30,7 @@ : ""; $strquiz = get_string("modulename", "quiz"); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - - print_header("$course->shortname: $strquizzes", "$course->fullname", "$navigation $strquizzes", + print_header_simple("$strquizzes", "", "$strquizzes", "", "", true, $streditquestions, navmenu($course)); // Get all the appropriate data diff --git a/mod/quiz/report.php b/mod/quiz/report.php index 68ee8d3f19..c7c1053a4d 100644 --- a/mod/quiz/report.php +++ b/mod/quiz/report.php @@ -45,17 +45,13 @@ /// Print the page header if (empty($noheader)) { - - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } $strquizzes = get_string("modulenameplural", "quiz"); $strquiz = get_string("modulename", "quiz"); $strreport = get_string("report", "quiz"); - print_header("$course->shortname: $quiz->name", "$course->fullname", - "$navigation id>$strquizzes + print_header_simple("$quiz->name", "", + "id>$strquizzes -> id\">$quiz->name -> $strreport", "", "", true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm)); diff --git a/mod/quiz/review.php b/mod/quiz/review.php index 4a0a50031f..e5ba48552c 100644 --- a/mod/quiz/review.php +++ b/mod/quiz/review.php @@ -59,10 +59,6 @@ // Print the page header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strquizzes = get_string("modulenameplural", "quiz"); $strquiz = get_string("modulename", "quiz"); $strreport = get_string("report", "quiz"); @@ -76,8 +72,8 @@ $strtimecompleted = get_string("timecompleted", "quiz"); $stroverdue = get_string("overdue", "quiz"); - print_header("$course->shortname: $quiz->name", "$course->fullname", - "$navigation id>$strquizzes + print_header_simple("$quiz->name", "", + "id>$strquizzes -> id\">$quiz->name -> $strreview", "", "", true); diff --git a/mod/quiz/view.php b/mod/quiz/view.php index da2337969e..3250630892 100644 --- a/mod/quiz/view.php +++ b/mod/quiz/view.php @@ -42,15 +42,11 @@ // Print the page header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strquizzes = get_string("modulenameplural", "quiz"); $strquiz = get_string("modulename", "quiz"); - print_header("$course->shortname: $quiz->name", "$course->fullname", - "$navigation id>$strquizzes -> $quiz->name", + print_header_simple("$quiz->name", "", + "id>$strquizzes -> $quiz->name", "", "", true, update_module_button($cm->id, $course->id, $strquiz), navmenu($course, $cm)); if (isteacher($course->id)) { diff --git a/mod/survey/index.php b/mod/survey/index.php index 7f56297b2d..87f7887a24 100644 --- a/mod/survey/index.php +++ b/mod/survey/index.php @@ -13,10 +13,6 @@ add_to_log($course->id, "survey", "view all", "index.php?id=$course->id", ""); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strsurveys = get_string("modulenameplural", "survey"); $strweek = get_string("week"); $strtopic = get_string("topic"); @@ -25,7 +21,7 @@ $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)) { diff --git a/mod/survey/view.php b/mod/survey/view.php index a734920ea8..2054db176c 100644 --- a/mod/survey/view.php +++ b/mod/survey/view.php @@ -24,16 +24,12 @@ } $showscales = ($template->name != 'ciqname'); - - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } $strsurveys = get_string("modulenameplural", "survey"); $strsurvey = get_string("modulename", "survey"); - print_header("$course->shortname: $survey->name", "$course->fullname", - "$navigation id>$strsurveys -> $survey->name", "", "", true, + print_header_simple("$survey->name", "", + "id>$strsurveys -> $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 diff --git a/mod/wiki/admin.php b/mod/wiki/admin.php index f5adaecd40..cd7026f260 100644 --- a/mod/wiki/admin.php +++ b/mod/wiki/admin.php @@ -41,7 +41,7 @@ error("Course Module ID was incorrect"); } } - + /// Build the ewsiki script constant $ewbase = 'view.php?id='.$id; if (isset($userid)) $ewbase .= '&userid='.$userid; @@ -91,12 +91,6 @@ # The mighty Wiki itself include_once($CFG->dirroot."/mod/wiki/ewiki/ewiki.php"); -/// Print the page header - - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strwikis = get_string("modulenameplural", "wiki"); $strwiki = get_string("modulename", "wiki"); @@ -121,8 +115,8 @@ } } - print_header("$course->shortname: $wiki_entry->pagename", "$course->fullname", - "$navigation id\">$strwikis -> $wiki->name ->". + print_header_simple("$wiki_entry->pagename", "", + "id\">$strwikis -> $wiki->name ->". get_string("administration","wiki"), $focus, "", true, update_module_button($cm->id, $course->id, $strwiki), navmenu($course, $cm)); @@ -348,4 +342,4 @@ print_footer($course); exit; -?> \ No newline at end of file +?> \ No newline at end of file diff --git a/mod/wiki/index.php b/mod/wiki/index.php index 41e9859c13..d98ab64bc3 100644 --- a/mod/wiki/index.php +++ b/mod/wiki/index.php @@ -25,11 +25,7 @@ /// Print the header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - - 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 diff --git a/mod/wiki/view.php b/mod/wiki/view.php index 97ce42607b..b11ad4f9d3 100644 --- a/mod/wiki/view.php +++ b/mod/wiki/view.php @@ -215,15 +215,12 @@ /// Print the page header - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } $strwikis = get_string("modulenameplural", "wiki"); $strwiki = get_string("modulename", "wiki"); - print_header("$course->shortname: ".($ewiki_title?$ewiki_title:$wiki->name), "$course->fullname", - "$navigation id\">$strwikis -> $wiki->name".($ewiki_title?" -> $ewiki_title":""), + print_header_simple(($ewiki_title?$ewiki_title:$wiki->name), "", + "id\">$strwikis -> $wiki->name".($ewiki_title?" -> $ewiki_title":""), "", "", true, update_module_button($cm->id, $course->id, $strwiki), navmenu($course, $cm)); diff --git a/mod/workshop/index.php b/mod/workshop/index.php index 8f8fad3d0b..a50e7acec5 100644 --- a/mod/workshop/index.php +++ b/mod/workshop/index.php @@ -13,10 +13,6 @@ require_login($course->id); add_to_log($course->id, "workshop", "view all", "index.php?id=$course->id", ""); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $strworkshops = get_string("modulenameplural", "workshop"); $strworkshop = get_string("modulename", "workshop"); $strweek = get_string("week"); @@ -24,9 +20,9 @@ $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"); @@ -63,34 +59,34 @@ break; } if ($submissions = workshop_get_user_submissions($workshop, $USER)) { - foreach ($submissions as $submission) { - if ($submission->timecreated <= $workshop->deadline) { - $submitted = userdate($submission->timecreated); - } - else { - $submitted = "".userdate($submission->timecreated).""; - } - $due = userdate($workshop->deadline); + foreach ($submissions as $submission) { + if ($submission->timecreated <= $workshop->deadline) { + $submitted = userdate($submission->timecreated); + } + else { + $submitted = "".userdate($submission->timecreated).""; + } + $due = userdate($workshop->deadline); if (!$workshop->visible) { //Show dimmed if the mod is hidden - $link = "coursemodule\">$workshop->name
". - "($submission->title)"; + $link = "coursemodule\">$workshop->name
". + "($submission->title)"; } else { //Show normal if the mod is visible - $link = "coursemodule\">$workshop->name
". - "($submission->title)"; + $link = "coursemodule\">$workshop->name
". + "($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 = "coursemodule\">$workshop->name"; @@ -98,14 +94,14 @@ //Show normal if the mod is visible $link = "coursemodule\">$workshop->name"; } - 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 "
"; print_table($table); diff --git a/mod/workshop/submissions.php b/mod/workshop/submissions.php index a1dead0718..d616e54745 100644 --- a/mod/workshop/submissions.php +++ b/mod/workshop/submissions.php @@ -55,17 +55,13 @@ require_login($course->id); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } - $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 id>$strworkshops -> + print_header_simple("$workshop->name", "", + "id>$strworkshops -> id\">$workshop->name -> $strsubmissions", "", "", true); diff --git a/mod/workshop/upload.php b/mod/workshop/upload.php index 94eefde238..29fb776110 100644 --- a/mod/workshop/upload.php +++ b/mod/workshop/upload.php @@ -22,15 +22,12 @@ require_login($course->id); - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } $strworkshops = get_string("modulenameplural", "workshop"); $strworkshop = get_string("modulename", "workshop"); $strupload = get_string("upload"); - print_header("$course->shortname: $workshop->name : $strupload", "$course->fullname", - "$navigation id>$strworkshops -> + print_header_simple("$workshop->name : $strupload", "", + "id>$strworkshops -> id\">$workshop->name -> $strupload", "", "", true); /**** @@ -41,27 +38,27 @@ } ****/ $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 @@ -92,17 +89,17 @@ 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']) { @@ -111,7 +108,7 @@ else { notify(get_string("uploadnofilefound", "assignment")); } - } + } print_continue("view.php?a=$workshop->id"); print_footer($course); diff --git a/mod/workshop/view.php b/mod/workshop/view.php index eeaa0a6b7a..d6dcc523a0 100644 --- a/mod/workshop/view.php +++ b/mod/workshop/view.php @@ -1,30 +1,30 @@ id); // ...log activity... - add_to_log($course->id, "workshop", "view", "view.php?id=$cm->id", $workshop->id, $cm->id); - - if ($course->category) { - $navigation = "id\">$course->shortname ->"; - } + 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 id>$strworkshops -> $workshop->name", + print_header_simple("$workshop->name", "", + "id>$strworkshops -> $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 "

"; - echo ""; - if ($useteachersgrades) { - echo ""; + if ($usebiasgrades) { + echo ""; + } + if ($usereliabilitygrades) { + echo ""; + } + if ($usegradinggrades) { + echo ""; + } + echo "\n"; + } + } + echo "
".get_string("submissions", "workshop")."".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 "
"; + echo ""; + if ($useteachersgrades) { + echo ""; - } - if ($usepeergrades) { - echo ""; - } - echo ""; - if ($usebiasgrades) { - echo ""; - } - if ($usereliabilitygrades) { - echo ""; - } - if ($usegradinggrades) { - echo ""; - } - echo "\n"; - // now the weights - echo ""; - if ($useteachersgrades) { - echo "\n"; - } - if ($usepeergrades) { - echo "\n"; - } - echo "\n"; - if ($usebiasgrades) { - echo "\n"; - } - if ($usereliabilitygrades) { - echo "\n"; - } - if ($usegradinggrades) { - echo "\n"; - } - echo "\n"; - foreach ($submissions as $submission) { - echo "\n"; - if ($useteachersgrades) { - echo ""; + if ($usebiasgrades) { + echo ""; + } + if ($usereliabilitygrades) { + echo ""; + } + if ($usegradinggrades) { + echo ""; + } + echo "\n"; + // now the weights + echo ""; + if ($useteachersgrades) { + echo "\n"; + } + if ($usepeergrades) { + echo "\n"; + } + echo "\n"; + if ($usebiasgrades) { + echo "\n"; + } + if ($usereliabilitygrades) { + echo "\n"; + } + if ($usegradinggrades) { + echo "\n"; + } + echo "\n"; + foreach ($submissions as $submission) { + echo "\n"; + if ($useteachersgrades) { + echo ""; - } - if ($usepeergrades) { - echo ""; - } - echo ""; - if ($usebiasgrades) { - echo ""; - } - if ($usereliabilitygrades) { - echo ""; - } - if ($usegradinggrades) { - echo ""; - } - echo "\n"; - } - } - echo "
".get_string("submissions", "workshop")."".get_string("teacherassessments", "workshop", $course->teacher)."".get_string("studentassessments", "workshop", + } + if ($usepeergrades) { + echo "".get_string("studentassessments", "workshop", $course->student)."".get_string("assessmentsdone", "workshop")."".get_string("gradeforbias", "workshop")."".get_string("gradeforreliability", "workshop")."".get_string("gradeforassessments", "workshop")."".get_string("overallgrade", "workshop")."
".get_string("weights", "workshop")."$WORKSHOP_FWEIGHTS[$teacherweight]$WORKSHOP_FWEIGHTS[$peerweight] $WORKSHOP_FWEIGHTS[$biasweight]$WORKSHOP_FWEIGHTS[$reliabilityweight]$WORKSHOP_FWEIGHTS[$gradingweight] 
".workshop_print_submission_title($workshop, $submission)."".workshop_print_submission_assessments($workshop, + } + echo "".get_string("assessmentsdone", "workshop")."".get_string("gradeforbias", "workshop")."".get_string("gradeforreliability", "workshop")."".get_string("gradeforassessments", "workshop")."".get_string("overallgrade", "workshop")."
".get_string("weights", "workshop")."$WORKSHOP_FWEIGHTS[$teacherweight]$WORKSHOP_FWEIGHTS[$peerweight] $WORKSHOP_FWEIGHTS[$biasweight]$WORKSHOP_FWEIGHTS[$reliabilityweight]$WORKSHOP_FWEIGHTS[$gradingweight] 
".workshop_print_submission_title($workshop, $submission)."".workshop_print_submission_assessments($workshop, $submission, "teacher")."".workshop_print_submission_assessments($workshop, + } + if ($usepeergrades) { + echo "".workshop_print_submission_assessments($workshop, $submission, "student")."".workshop_print_user_assessments($workshop, $USER)."$submission->biasgrade$submission->reliabilitygrade$submission->gradinggrade$submission->finalgrade

\n"; + } + echo "
".workshop_print_user_assessments($workshop, $USER)."$submission->biasgrade$submission->reliabilitygrade$submission->gradinggrade$submission->finalgrade

\n"; echo "

< > ".get_string("assessmentdropped", "workshop")."

\n"; - if ($workshop->showleaguetable) { - workshop_print_league_table($workshop); - } - echo "
".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 "
".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) { @@ -382,160 +378,160 @@ break; } if (workshop_count_assessments($lastsubmission)) { - echo "
"; - print_heading(get_string("submitrevisedassignment", "workshop").":"); - workshop_print_upload_form($workshop); - echo "
"; + echo "
"; + print_heading(get_string("submitrevisedassignment", "workshop").":"); + workshop_print_upload_form($workshop); + echo "
"; } } - } - // allow user to list their submissions and assessments in a general way???? - // print_heading("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 = "$strdifference"; - } - $strduedate = userdate($workshop->deadline)." ($strdifference)"; - - workshop_print_assignment_info($workshop); - - // list previous submissions from teacher - workshop_list_user_submissions($workshop, $USER); - - echo "
"; - - // 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("
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 = "$strdifference"; + } + $strduedate = userdate($workshop->deadline)." ($strdifference)"; + + workshop_print_assignment_info($workshop); + + // list previous submissions from teacher + workshop_list_user_submissions($workshop, $USER); + + echo "
"; + + // 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 "
\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 "
\n"; + switch ($workshop->phase) { + case 0: + case 1: // set up assignment if ($workshop->nelements) { - echo "

id&action=editelements\">". - get_string("amendassessmentelements", "workshop")." \n"; - helpbutton("elements", get_string("amendassessmentelements", "workshop"), "workshop"); + echo "

id&action=editelements\">". + get_string("amendassessmentelements", "workshop")." \n"; + helpbutton("elements", get_string("amendassessmentelements", "workshop"), "workshop"); } - if ($workshop->ntassessments) { + if ($workshop->ntassessments) { // if teacher examples show submission and assessment links - echo "

id&action=submitassignment\">". - get_string("submitexampleassignment", "workshop")." \n"; - helpbutton("submissionofexamples", get_string("submitexampleassignment", "workshop"), + echo "

id&action=submitassignment\">". + get_string("submitexampleassignment", "workshop")." \n"; + helpbutton("submissionofexamples", get_string("submitexampleassignment", "workshop"), "workshop"); - echo "

id&action=listforassessmentteacher\">". - get_string("teachersubmissionsforassessment", "workshop", - workshop_count_teacher_submissions_for_assessment($workshop, $USER)). - " \n"; - helpbutton("assessmentofexamples", get_string("teachersubmissionsforassessment", + echo "

id&action=listforassessmentteacher\">". + get_string("teachersubmissionsforassessment", "workshop", + workshop_count_teacher_submissions_for_assessment($workshop, $USER)). + " \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 "

id&action=listungradedteachersubmissions\">". - get_string("ungradedassessmentsofteachersubmissions", "workshop", - workshop_count_ungraded_assessments_teacher($workshop))." \n"; - helpbutton("ungradedassessments_teacher", + if ($workshop->ntassessments) { // if teacher example show student assessments link + echo "

id&action=listungradedteachersubmissions\">". + get_string("ungradedassessmentsofteachersubmissions", "workshop", + workshop_count_ungraded_assessments_teacher($workshop))." \n"; + helpbutton("ungradedassessments_teacher", get_string("ungradedassessmentsofteachersubmissions", "workshop"), "workshop"); - } - echo "

id&action=listungradedstudentsubmissions\">". - get_string("ungradedassessmentsofstudentsubmissions", "workshop", - workshop_count_ungraded_assessments_student($workshop))." \n"; - helpbutton("ungradedassessments_student", + } + echo "

id&action=listungradedstudentsubmissions\">". + get_string("ungradedassessmentsofstudentsubmissions", "workshop", + workshop_count_ungraded_assessments_student($workshop))." \n"; + helpbutton("ungradedassessments_student", get_string("ungradedassessmentsofstudentsubmissions", "workshop"), "workshop"); - echo "

id&action=listforassessmentstudent\">". - get_string("studentsubmissionsforassessment", "workshop", - workshop_count_student_submissions_for_assessment($workshop, $USER))." \n"; - helpbutton("gradingsubmissions", + echo "

id&action=listforassessmentstudent\">". + get_string("studentsubmissionsforassessment", "workshop", + workshop_count_student_submissions_for_assessment($workshop, $USER))." \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 "

id&action=listungradedteachersubmissions\">". - get_string("ungradedassessmentsofteachersubmissions", "workshop", - workshop_count_ungraded_assessments_teacher($workshop))." \n"; - helpbutton("ungradedassessments_teacher", + break; + + case 5: // calculate final grades + if ($workshop->ntassessments) { // if teacher example show student assessments link + echo "

id&action=listungradedteachersubmissions\">". + get_string("ungradedassessmentsofteachersubmissions", "workshop", + workshop_count_ungraded_assessments_teacher($workshop))." \n"; + helpbutton("ungradedassessments_teacher", get_string("ungradedassessmentsofteachersubmissions", "workshop"), "workshop"); - } - echo "

id&action=listungradedstudentsubmissions\">". - get_string("ungradedassessmentsofstudentsubmissions", "workshop", - workshop_count_ungraded_assessments_student($workshop))." \n"; - helpbutton("ungradedassessments_student", + } + echo "

id&action=listungradedstudentsubmissions\">". + get_string("ungradedassessmentsofstudentsubmissions", "workshop", + workshop_count_ungraded_assessments_student($workshop))." \n"; + helpbutton("ungradedassessments_student", get_string("ungradedassessmentsofstudentsubmissions", "workshop"), "workshop"); - echo "

id&action=listforassessmentstudent\">". - get_string("studentsubmissionsforassessment", "workshop", - workshop_count_student_submissions_for_assessment($workshop, $USER))." \n"; - helpbutton("gradingsubmissions", + echo "

id&action=listforassessmentstudent\">". + get_string("studentsubmissionsforassessment", "workshop", + workshop_count_student_submissions_for_assessment($workshop, $USER))." \n"; + helpbutton("gradingsubmissions", get_string("studentsubmissionsforassessment", "workshop"), "workshop"); - print_heading("id&action=displayfinalweights\">". - get_string("calculationoffinalgrades", "workshop").""); - print_heading("id&action=analysisofassessments\">". - get_string("analysisofassessments", "workshop").""); - break; - - case 6: // show final grades - print_heading("id&action=displayfinalgrades\">". - get_string("displayoffinalgrades", "workshop").""); - } - print_heading("id&action=adminlist\">". - get_string("administration").""); - } - - - /*************** no man's land **************************************/ - else { - error("Fatal Error: Unknown Action: ".$action."\n"); - } - - print_footer($course); - + print_heading("id&action=displayfinalweights\">". + get_string("calculationoffinalgrades", "workshop").""); + print_heading("id&action=analysisofassessments\">". + get_string("analysisofassessments", "workshop").""); + break; + + case 6: // show final grades + print_heading("id&action=displayfinalgrades\">". + get_string("displayoffinalgrades", "workshop").""); + } + print_heading("id&action=adminlist\">". + get_string("administration").""); + } + + + /*************** no man's land **************************************/ + else { + error("Fatal Error: Unknown Action: ".$action."\n"); + } + + print_footer($course); + ?> -- 2.39.5