Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minor mods to phase 3 display for students..

  • Loading branch information...
commit 563f6067318b6a12360358919bbee1a6e7dd92d0 1 parent d69e279
rkingdon authored
Showing with 50 additions and 6 deletions.
  1. +6 −5 mod/exercise/lib.php
  2. +44 −1 mod/exercise/view.php
View
11 mod/exercise/lib.php
@@ -1016,12 +1016,13 @@ function exercise_get_assess_logs($course, $timestart) {
///////////////////////////////////////////////////////////////////////////////////////////////
function exercise_get_assessments($submission) {
- // Return all assessments for this submission provided they are after the editing time, ordered oldest first, newest last
+ // Return all assessments for this submission provided they are after the editing time,
+ // ordered oldest first, newest last
global $CFG;
$timenow = time();
return get_records_select("exercise_assessments", "(submissionid = $submission->id) AND
- (timecreated < $timenow - $CFG->maxeditingtime)", "timecreated DESC");
+ (timecreated < $timenow - $CFG->maxeditingtime)", "timecreated ASC");
}
@@ -1279,17 +1280,17 @@ function exercise_get_user_assessments($exercise, $user) {
///////////////////////////////////////////////////////////////////////////////////////////////
function exercise_get_user_submissions($exercise, $user) {
- // return submission of user newest first, oldest last
+ // return submission of user oldest first, newest last
// teachers submit "exercises"
if (! $course = get_record("course", "id", $exercise->course)) {
error("Course is misconfigured");
}
if (isteacher($course->id, $user->id)) {
return get_records_select("exercise_submissions ",
- "exerciseid = $exercise->id AND isexercise = 1", "timecreated DESC" );
+ "exerciseid = $exercise->id AND isexercise = 1", "timecreated" );
}
return get_records_select("exercise_submissions ",
- "exerciseid = $exercise->id AND userid = $user->id", "timecreated DESC" );
+ "exerciseid = $exercise->id AND userid = $user->id", "timecreated" );
}
View
45 mod/exercise/view.php
@@ -9,6 +9,7 @@
notavailable (for students)
openexercise (for teachers)
setupassignment (for teachers)
+ showsubmissions (for students)
studentsview
submitassignment
teachersview
@@ -72,7 +73,7 @@
case 0 :
case 1 : $action = 'notavailable'; break;
case 2 : $action = 'studentsview'; break;
- case 3 : $action = 'notavailable'; break;
+ case 3 : $action = 'showsubmissions'; break;
case 4 : $action = 'displayfinalgrade';
}
}
@@ -233,6 +234,48 @@
}
+ /****************** 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>";
+ if ($submissions = exercise_get_user_submissions($exercise, $USER)) {
+ 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"));
+ $table->width = "100%";
+ $table->align = array ("left", "left", "left", "center");
+ $table->size = array ("*", "*", "*", "*");
+ $table->cellpadding = 2;
+ $table->cellspacing = 0;
+
+ foreach ($submissions as $submission) {
+ if ($assessments = exercise_get_assessments($submission)) {
+ // should only be one but we'll loop anyway
+ foreach ($assessments as $assessment) {
+ $table->data[] = array(exercise_print_submission_title($exercise, $submission),
+ userdate($submission->timecreated), userdate($assessment->timecreated),
+ "<a href=\"assessments.php?action=viewassessment&id=$cm->id&aid=$assessment->id\">".$assessment->grade * $exercise->grade / 100.0."</a>");
+ }
+ } else {
+ // submission not yet assessed (by teacher)
+ $table->data[] = array(exercise_print_submission_title($exercise, $submission),
+ userdate($submission->timecreated), get_string("notassessedyet", "exercise"), 0);
+ }
+ }
+ print_table($table);
+ print_simple_box_end();
+ } else {
+ print_heading(get_string("nosubmissions", "exercise"));
+ }
+ echo "<hr size=\"1\" noshade>";
+ }
+
+
/****************** submission of assignment by teacher only***********************/
elseif ($action == 'submitassignment') {
Please sign in to comment.
Something went wrong with that request. Please try again.