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

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

View file

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

View file

@ -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 = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strexercises = get_string("modulenameplural", "exercise");
$strexercise = get_string("modulename", "exercise");
$strweek = get_string("week");
$strtopic = get_string("topic");
$strname = get_string("name");
$strtitle = get_string("title", "exercise");
$strtitle = get_string("title", "exercise");
$strphase = get_string("phase", "exercise");
$strgrade = get_string("grade");
$strdeadline = get_string("deadline", "exercise");
$strsubmitted = get_string("submitted", "assignment");
$strsubmitted = get_string("submitted", "assignment");
print_header("$course->shortname: $strexercises", "$course->fullname", "$navigation $strexercises", "", "", true, "", navmenu($course));
print_header_simple("$strexercises", "", "$strexercises", "", "", true, "", navmenu($course));
if (! $exercises = get_all_instances_in_course("exercise", $course)) {
notice("There are no exercises", "../../course/view.php?id=$course->id");
@ -57,22 +53,22 @@
}
foreach ($exercises as $exercise) {
if ($exercise->deadline > $timenow) {
if ($exercise->deadline > $timenow) {
$due = userdate($exercise->deadline);
} else {
$due = "<FONT COLOR=\"red\">".userdate($exercise->deadline)."</FONT>";
}
if ($submissions = exercise_get_user_submissions($exercise, $USER)) {
foreach ($submissions as $submission) {
if ($submission->late) {
$submitted = "<FONT COLOR=\"red\">".userdate($submission->timecreated)."</FONT>";
}
else {
$submitted = userdate($submission->timecreated);
}
$link = "<A HREF=\"view.php?id=$exercise->coursemodule\">$exercise->name</A>";
$title = $submission->title;
if ($course->format == "weeks" or $course->format == "topics") {
if ($submission->late) {
$submitted = "<FONT COLOR=\"red\">".userdate($submission->timecreated)."</FONT>";
}
else {
$submitted = userdate($submission->timecreated);
}
$link = "<A HREF=\"view.php?id=$exercise->coursemodule\">$exercise->name</A>";
$title = $submission->title;
if ($course->format == "weeks" or $course->format == "topics") {
if (isteacher($course->id)) {
$phase = '';
switch ($exercise->phase) {
@ -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 = "<A HREF=\"view.php?id=$exercise->coursemodule\">$exercise->name</A>";
if ($course->format == "weeks" or $course->format == "topics") {
$title = '';
$link = "<A HREF=\"view.php?id=$exercise->coursemodule\">$exercise->name</A>";
if ($course->format == "weeks" or $course->format == "topics") {
if (isteacher($course->id)) {
$table->data[] = array ($exercise->section, $link, $title, $exercise->phase,
$table->data[] = array ($exercise->section, $link, $title, $exercise->phase,
$submitted, $due);
} else {
$table->data[] = array ($exercise->section, $link, $title, "-", $submitted, $due);
}
$table->data[] = array ($exercise->section, $link, $title, "-", $submitted, $due);
}
} else {
$table->data[] = array ($link, $submitted, $due);
}
}
}
$table->data[] = array ($link, $submitted, $due);
}
}
}
echo "<BR>";
print_table($table);

View file

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

View file

@ -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 = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
$strexercises = get_string("modulenameplural", "exercise");
$strexercise = get_string("modulename", "exercise");
$strupload = get_string("upload");
print_header("$course->shortname: $exercise->name : $strupload", "$course->fullname",
"$navigation <A HREF=index.php?id=$course->id>$strexercises</A> ->
print_header_simple("$exercise->name : $strupload", "",
"<A HREF=index.php?id=$course->id>$strexercises</A> ->
<A HREF=\"view.php?id=$cm->id\">$exercise->name</A> -> $strupload",
"", "", true);
@ -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");

View file

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