Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Addition of teacher admin features

  • Loading branch information...
commit 16a0e6f05c784309ae411878944dfdad54ebc32c 1 parent e9d3eca
rkingdon authored
View
55 mod/workshop/assessments.php
@@ -5,6 +5,7 @@
ACTIONS handled are:
addcomment
+ adminlist
agreeassessment
assesssubmission
displaygradingform
@@ -110,6 +111,58 @@
}
+ /******************* admin confirm delete ************************************/
+ if ($action == 'adminconfirmdelete' ) {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can look at this page");
+ }
+ if (empty($_GET['aid'])) {
+ error("Admin confirm delete: assessment id missing");
+ }
+
+ notice_yesno(get_string("confirmdeletionofthisitem","workshop"),
+ "assessments.php?action=admindelete&id=$cm->id&aid=$_GET[aid]", "submissions.php?action=adminlist&id=$cm->id");
+ }
+
+
+ /******************* admin delete ************************************/
+ elseif ($action == 'admindelete' ) {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can look at this page");
+ }
+ if (empty($_GET['aid'])) {
+ error("Admin delete: submission id missing");
+ }
+
+ print_string("deleting", "workshop");
+ // first delete all the associated records...
+ delete_records("workshop_comments", "assessmentid", $_GET['aid']);
+ delete_records("workshop_grades", "assessmentid", $_GET['aid']);
+ // ...now delete the assessment...
+ delete_records("workshop_assessments", "id", $_GET['aid']);
+
+ print_continue("submissions.php?id=$cm->id&action=adminlist");
+ }
+
+
+ /*********************** admin list of asssessments (by teachers)***********************/
+ elseif ($action == 'adminlist') {
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can look at this page");
+ }
+
+ if (empty($_GET['sid'])) {
+ error ("Workshop asssessments: adminlist called with no sid");
+ }
+ $submission = get_record("workshop_submissions", "id", $_GET['sid']);
+ workshop_print_assessments_for_admin($workshop, $submission);
+ print_continue("submissions.php?action=adminlist&a=$workshop->id");
+ }
+
+
/*************** agree (to) assessment (by student) ***************************/
elseif ($action == 'agreeassessment') {
$timenow = time();
@@ -159,7 +212,7 @@
/*************** display grading form (viewed by student) *********************************/
elseif ($action == 'displaygradingform') {
- print_heading_with_help(get_string("specimengradingform", "workshop"), "specimen", "workshop");
+ print_heading_with_help(get_string("specimenassessmentform", "workshop"), "specimen", "workshop");
workshop_print_assessment($workshop); // called with no assessment
print_continue("view.php?a=$workshop->id");
View
56 mod/workshop/lib.php
@@ -684,6 +684,7 @@ function workshop_list_all_ungraded_assessments($workshop) {
function workshop_list_assessed_submissions($workshop, $user) {
function workshop_list_peer_assessments($workshop, $user) {
function workshop_list_student_submissions($workshop, $user) {
+function workshop_list_submissions_for_admin($workshop, $order) {
function workshop_list_teacher_assessments($workshop, $user) {
function workshop_list_teacher_submissions($workshop) {
function workshop_list_unassessed_student_submissions($workshop, $user) {
@@ -1513,7 +1514,7 @@ function workshop_list_submissions_for_admin($workshop, $order) {
if (!$user = get_record("user", "id", $submission->userid)) {
error("workshop_list_submissions_for_admin: failure to get user record");
}
- // has teacherer already assessed this submission
+ // has teacher already assessed this submission
if ($assessment = get_record_select("workshop_assessments", "submissionid = $submission->id
AND userid = $USER->id")) {
$curtime = time();
@@ -1536,7 +1537,7 @@ function workshop_list_submissions_for_admin($workshop, $order) {
}
$action .= " | <a href=\"submissions.php?action=adminconfirmdelete&a=$workshop->id&sid=$submission->id\">".
get_string("delete", "workshop")."</a>";
- $table->data[] = array(workshop_print_submission_title($workshop, $submission), "$user-firstname $user->lastname", $action);
+ $table->data[] = array(workshop_print_submission_title($workshop, $submission), "$user->firstname $user->lastname", $action);
}
print_table($table);
}
@@ -1631,29 +1632,32 @@ function workshop_list_teacher_submissions($workshop, $user) {
}
}
}
- // now list user's assessments
+ // now list user's assessments (but only list those which come from teacher submissions)
if ($assessments = workshop_get_user_assessments($workshop, $user)) {
$timenow = time();
foreach ($assessments as $assessment) {
if (!$submission = get_record("workshop_submissions", "id", $assessment->submissionid)) {
error ("workshop_list_teacher_submissions: unable to get submission");
}
- $comment = '';
- if (($timenow - $assessment->timecreated) > $CFG->maxeditingtime) {
- $action = "<A HREF=\"assessments.php?action=viewassessment&a=$workshop->id&aid=$assessment->id\">"
- .get_string("view", "workshop")."</A>";
- // has teacher graded user's assessment?
- if ($assessment->timegraded) {
- if (($timenow - $assessment->timegraded) > $CFG->maxeditingtime) {
- $comment .= get_string("gradedbyteacher", "workshop", $course->teacher);
+ // submission from a teacher?
+ if (isteacher($workshop->course, $submission->userid)) {
+ $comment = '';
+ if (($timenow - $assessment->timecreated) > $CFG->maxeditingtime) {
+ $action = "<A HREF=\"assessments.php?action=viewassessment&a=$workshop->id&aid=$assessment->id\">"
+ .get_string("view", "workshop")."</A>";
+ // has teacher graded user's assessment?
+ if ($assessment->timegraded) {
+ if (($timenow - $assessment->timegraded) > $CFG->maxeditingtime) {
+ $comment .= get_string("gradedbyteacher", "workshop", $course->teacher);
+ }
}
}
+ else { // there's still time left to edit...
+ $action = "<A HREF=\"assessments.php?action=assesssubmission&a=$workshop->id&sid=$submission->id\">".
+ get_string("edit", "workshop")."</A>";
+ }
+ $table->data[] = array(workshop_print_submission_title($workshop, $submission), $action, $comment);
}
- else { // there's still time left to edit...
- $action = "<A HREF=\"assessments.php?action=assesssubmission&a=$workshop->id&sid=$submission->id\">".
- get_string("edit", "workshop")."</A>";
- }
- $table->data[] = array(workshop_print_submission_title($workshop, $submission), $action, $comment);
}
}
print_table($table);
@@ -1816,8 +1820,8 @@ function workshop_print_assessment($workshop, $assessment = FALSE, $showcommentl
if ($assessment) {
// set the internal flag is necessary
- if (($assessment->userid == $USER->id) and (($timenow - $assessment->timecreated) < $CFG->maxeditingtime) or
- !$assessment->timeagreed) {
+ if (($assessment->userid == $USER->id) and ((($timenow - $assessment->timecreated) < $CFG->maxeditingtime) or
+ !$assessment->timeagreed)) {
$allowchanges = true;
}
if ($allowchanges or !$workshop->agreeassessments or !$workshop->hidegrades or $assessment->timeagreed) {
@@ -2271,6 +2275,22 @@ function workshop_print_assessment($workshop, $assessment = FALSE, $showcommentl
}
+function workshop_print_assessments_for_admin($workshop, $submission) {
+
+ if ($assessments =workshop_get_assessments($submission)) {
+ foreach ($assessments as $assessment) {
+ if (!$user = get_record("user", "id", $assessment->userid)) {
+ error (" workshop_print_assessments_for_admin: unable to get user record");
+ }
+ echo "<p><center><b>".get_string("assessmentby", "workshop", $user->firstname." ".$user->lastname)."</b></center></p>\n";
+ workshop_print_assessment($workshop, $assessment);
+ echo "<p align=\"right\"><a href=\"assessments.php?action=adminconfirmdelete&a=$workshop->id&aid=$assessment->id\">".
+ get_string("delete", "workshop")."</a></p><hr>\n";
+ }
+ }
+ }
+
+
function workshop_print_difference($time) {
if ($time < 0) {
$timetext = get_string("late", "assignment", format_time($time));
View
7 mod/workshop/submissions.php
@@ -78,7 +78,7 @@
if (!isteacher($course->id)) {
error("Only teachers can look at this page");
}
- if (!isset($_GET['sid'])) {
+ if (empty($_GET['sid'])) {
error("Admin confirm delete: submission id missing");
}
@@ -93,10 +93,11 @@
if (!isteacher($course->id)) {
error("Only teachers can look at this page");
}
- if (!$sid = isset($_GET['sid'])) {
+ if (empty($_GET['sid'])) {
error("Admin delete: submission id missing");
}
- if (!$submission = get_record("workshop_submissions", "id", $sid)) {
+
+ if (!$submission = get_record("workshop_submissions", "id", $_GET['sid'])) {
error("Admin delete: can not get submission record");
}
print_string("deleting", "workshop");
View
5 mod/workshop/todo.txt
@@ -11,7 +11,10 @@ Comments are seen by a third party, is this standard Moodle behaviour?
Cron function should email something to the assessor when an assessment is
agreed.
+Self assessments may need special handling, remove duplication in student
+ view
+
Ray Kingdon
-8 May 2003
+13 May 2003
Please sign in to comment.
Something went wrong with that request. Please try again.