From: gustav_delius
Date: Thu, 9 Dec 2004 09:34:43 +0000 (+0000)
Subject: Now teachers can again grade assessments. Also various tweaks of admin interface...
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=1c4e73b61483f1aa96a865af6f850781cb49ba27;p=moodle.git
Now teachers can again grade assessments. Also various tweaks of admin interface. This is work in progress. Heavy testing and further development will take place during the coming days, so consider this code as unstable.
---
diff --git a/lang/en/workshop.php b/lang/en/workshop.php
index 87c27b9ddf..6177113e20 100644
--- a/lang/en/workshop.php
+++ b/lang/en/workshop.php
@@ -27,11 +27,12 @@ $string['assessmentendevent'] = 'End of assessments for $a';
$string['assessmentgrade'] = 'Assessment Grade: $a';
$string['assessmentnotyetagreed'] = 'Assessment not yet agreed';
$string['assessmentnotyetgraded'] = 'Assessment not yet graded';
+$string['assessmentof'] = 'Assessment of $a';
$string['assessmentofresubmission'] = 'This is an Assessment of a revised piece of the work. The form here has been filled with your previous grades and comments. Please amend these after looking at the revised work.';
$string['assessmentofthissubmission'] = 'Assessment of this submission';
$string['assessments'] = 'Assessments';
$string['assessmentsareok'] = 'Assessments are OK';
-$string['assessmentsby'] = 'Assessments by $a';
+$string['assessmentsby'] = '$a Assessments';
$string['assessmentsdone'] = 'Assessments Done';
$string['assessmentsexcluded'] = 'Number of Assessments excluded for this $a';
$string['assessmentsmustbeagreed'] = 'Assessments must be agreed';
@@ -40,10 +41,12 @@ $string['assessmentstartevent'] = 'Start of assessments for $a';
$string['assessmentwasagreedon'] = 'Assessment was agreed on $a';
$string['assessor'] = 'Assessor';
$string['assessthissubmission'] = 'Assess this submission';
+$string['assessthisassessment'] = 'Grade this assessment';
$string['assignmentnotinthecorrectphase'] = 'Assignment not in the Correct Phase';
$string['attachment'] = 'Attachment';
$string['attachments'] = 'Attachments';
$string['authorofsubmission'] = 'Author of Submission';
+$string['automaticgradeforassessment'] = 'Automatic grade for assessment';
$string['averageerror'] = 'Average Error';
$string['awaitinggradingbyteacher'] = 'Awaiting Grading by $a';
$string['beforedeadline'] = 'Before Deadline: $a';
@@ -66,6 +69,7 @@ $string['deleting'] = 'Deleting';
$string['description'] = 'Description';
$string['detailsofassessment'] = 'Details of Assessment';
$string['disagreewiththisassessment'] = 'Disagree with this Assessment';
+$string['displayofgrades'] = 'Display of Grades';
$string['displayofcurrentgrades'] = 'Display of Current Grades';
$string['displayoffinalgrades'] = 'Display of Final Grades';
$string['dontshowgrades'] = 'Don\'t Show Grades';
@@ -228,6 +232,7 @@ $string['scaleyes'] = '2 point Yes/No scale';
$string['select'] = 'Select';
$string['selfassessment'] = 'Self Assessment';
$string['showgrades'] = 'Show Grades';
+$string['showsubmission'] = 'Show Submission: $a';
$string['specimenassessmentform'] = 'Specimen Assessment Form';
$string['standarddeviation'] = 'Standard Deviation';
$string['standarddeviationofelement'] = 'Standard deviation of Element $a:';
@@ -253,6 +258,7 @@ $string['submitted'] = 'Submitted';
$string['submittedby'] = 'Submitted by';
$string['suggestedgrade'] = 'Suggested Grade';
$string['teacherassessments'] = '$a Assessments';
+$string['teachergradeforassessment'] = '$a grade for assessment';
$string['teacherscomment'] = 'Teacher\'s Comment';
$string['teachersgrade'] = 'Teacher\'s Grade';
$string['teachersubmissionsforassessment'] = '$a Teacher Submissions for Assessment';
@@ -293,7 +299,8 @@ $string['workshopcomments'] = 'Workshop Comments';
$string['workshopfeedback'] = 'Workshop Feedback';
$string['workshopsubmissions'] = 'Workshop Submissions';
$string['wrongpassword'] = 'Incorrect password for this Workshop';
-$string['yourassessments'] = 'Your Assessments';
+$string['yourassessments'] = 'Your assessments of work by your peers';
+$string['yoursubmissions'] = 'Your Submissions';
$string['yourassessmentsofexamplesfromtheteacher'] = 'Your Assessments of Examples from the $a';
$string['yourfeedbackgoeshere'] = 'Your Feedback goes Here';
diff --git a/mod/workshop/assessment_grading_form.html b/mod/workshop/assessment_grading_form.html
new file mode 100644
index 0000000000..a912aed580
--- /dev/null
+++ b/mod/workshop/assessment_grading_form.html
@@ -0,0 +1,30 @@
+teachercomment)) {
+ $assessment->teachercomment = '';
+ }
+?>
+
\ No newline at end of file
diff --git a/mod/workshop/assessments.php b/mod/workshop/assessments.php
index 4a015cd9af..bcae00759e 100644
--- a/mod/workshop/assessments.php
+++ b/mod/workshop/assessments.php
@@ -716,16 +716,11 @@
/*************** grade (student's) assessment (by teacher) ***************************/
elseif ($action == 'gradeassessment') {
-
+
if (!isteacher($course->id)) {
error("Only teachers can look at this page");
}
- // set up coment scale
- for ($i=COMMENTSCALE; $i>=0; $i--) {
- $num[$i] = $i;
- }
-
print_heading_with_help(get_string("gradeassessment", "workshop"), "gradingassessments", "workshop");
// get assessment record
if (!$assessmentid = $_GET['aid']) {
@@ -745,32 +740,8 @@
echo "
\n";
workshop_print_assessment($workshop, $assessment);
- ?>
- \n";
+ include('assessment_grading_form.html');
+ die;
}
@@ -1442,6 +1413,7 @@
set_field("workshop_assessments", "gradinggrade", $form->gradinggrade, "id", $assessment->id);
set_field("workshop_assessments", "timegraded", $timenow, "id", $assessment->id);
set_field("workshop_assessments", "mailed", 0, "id", $assessment->id);
+ set_field("workshop_assessments", "teachergraded", 1, "id", $assessment->id);
echo "".get_string("savedok", "workshop")." \n";
add_to_log($course->id, "workshop", "grade",
@@ -1522,6 +1494,11 @@
// show assessment but don't allow changes
workshop_print_assessment($workshop, $assessment, false, $allowcomments);
+ if (isteacher($course->id) and !isteacher($course->id, $assessment->userid)) {
+ print_heading(''.
+ get_string('assessthisassessment', 'workshop').'');
+ }
+
print_continue("view.php?id=$cm->id");
}
diff --git a/mod/workshop/db/mysql.php b/mod/workshop/db/mysql.php
index b5f160dc93..1c2e9be141 100644
--- a/mod/workshop/db/mysql.php
+++ b/mod/workshop/db/mysql.php
@@ -196,6 +196,10 @@ function workshop_upgrade($oldversion) {
execute_sql("UPDATE {$CFG->prefix}event SET eventtype = 'submissionend' WHERE eventtype = 'deadline' AND modulename = 'workshop'", false);
}
+
+ if ($oldversion < 2004120900) {
+ table_column('workshop_assessments', '', 'teachergraded', 'INTEGER', '4', 'UNSIGNED', '0', 'NOT NULL', 'gradinggrade');
+ }
return true;
}
diff --git a/mod/workshop/db/postgres7.php b/mod/workshop/db/postgres7.php
index 980dceb438..63e5d8580c 100644
--- a/mod/workshop/db/postgres7.php
+++ b/mod/workshop/db/postgres7.php
@@ -189,6 +189,10 @@ function workshop_upgrade($oldversion) {
execute_sql("UPDATE {$CFG->prefix}event SET eventtype = 'submissionend' WHERE eventtype = 'deadline' AND modulename = 'workshop'", false);
}
+
+ if ($oldversion < 2004120900) {
+ table_column('workshop_assessments', '', 'teachergraded', 'INTEGER', '4', 'UNSIGNED', '0', 'NOT NULL', 'gradinggrade');
+ }
return true;
diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php
index fff656d80b..8f478a0531 100644
--- a/mod/workshop/lib.php
+++ b/mod/workshop/lib.php
@@ -1731,6 +1731,10 @@ function workshop_grade_assessments($workshop) {
}
echo "Best assessment is $bestassessmentid;\n";
foreach ($assessments as $assessment) {
+ // don't overwrite teacher's grade
+ if ($assessment->teachergraded) {
+ continue;
+ }
if ($assessment->id == $bestassessmentid) {
// it's the best one, set the grading grade to the maximum
set_field("workshop_assessments", "gradinggrade", 100, "id", $assessment->id);
@@ -1748,7 +1752,7 @@ function workshop_grade_assessments($workshop) {
// there are less than 3 assessments for this submission
if ($assessments = workshop_get_assessments($submission)) {
foreach ($assessments as $assessment) {
- if (!$assessment->timegraded) {
+ if (!$assessment->timegraded and !$assessment->teachergraded) {
// set the grading grade to the maximum and say it's been graded
set_field("workshop_assessments", "gradinggrade", 100, "id", $assessment->id);
set_field("workshop_assessments", "timegraded", $timenow, "id", $assessment->id);
diff --git a/mod/workshop/locallib.php b/mod/workshop/locallib.php
index 934d0804b4..13a0d1905b 100644
--- a/mod/workshop/locallib.php
+++ b/mod/workshop/locallib.php
@@ -918,7 +918,7 @@ function workshop_list_assessed_submissions($workshop, $user) {
get_string("view", "workshop")."";
}
}
- if ($assessment->timecreated < $timenow) { // only show the date if it's in the past (future dates cause confusion
+ if ($assessment->timecreated < $timenow) { // only show the date if it's in the past (future dates cause confusion)
$comment = get_string("assessedon", "workshop", userdate($assessment->timecreated));
}
else {
@@ -1134,7 +1134,7 @@ function workshop_list_student_submissions($workshop, $user) {
$nassessments[$submission->id] = $n + rand(0, 98) / 100;
}
- if (isset($nassessments)) { // make sure we end up with something to play with :-)
+ if (isset($nassessments)) { // make sure we end up with something to play with
// put the submissions with the lowest number of assessments first
asort($nassessments);
reset($nassessments);
@@ -1846,8 +1846,8 @@ function workshop_phase($workshop, $style='') {
//////////////////////////////////////////////////////////////////////////////////////
function workshop_print_assessment($workshop, $assessment = false, $allowchanges = false,
$showcommentlinks = false, $returnto = '') {
- // $allowchanges added 14/7/03
- // $returnto added 28/8/03
+ // $allowchanges added 14/7/03. The form is inactive unless allowchanges = true
+ // $returnto added 28/8/03. The page to go to after the assessment has been submitted
global $CFG, $THEME, $USER, $WORKSHOP_SCALES, $WORKSHOP_EWEIGHTS;
if (! $course = get_record("course", "id", $workshop->course)) {
@@ -1857,30 +1857,32 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
error("Course Module ID was incorrect");
}
+ if (!$submission = get_record("workshop_submissions", "id", $assessment->submissionid)) {
+ error ("Workshop_print_assessment: Submission record not found");
+ }
+
+ print_heading(get_string('assessmentof', 'workshop',
+ "id&action=showsubmission&sid=$submission->id\" target=\"submission\">".
+ $submission->title.''));
+
$timenow = time();
// reset the internal flags
if ($assessment) {
$showgrades = false;
- }
+ }
else { // if no assessment, i.e. specimen grade form always show grading scales
$showgrades = true;
- }
+ }
if ($assessment) {
- // set the internal flag is necessary
+ // set the internal flag if necessary
if ($allowchanges or !$workshop->agreeassessments or !$workshop->hidegrades or
$assessment->timeagreed) {
$showgrades = true;
- }
-
- echo "
-
cellcontent\">\n";
- if (!$submission = get_record("workshop_submissions", "id", $assessment->submissionid)) {
- error ("Workshop_print_assessment: Submission record not found");
- }
- echo workshop_print_submission($workshop, $submission);
- echo "
\n";
+ }
+
+ echo "
\n";
// see if this is a pre-filled assessment for a re-submission...
if ($assessment->resubmission) {
@@ -1891,7 +1893,7 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
// print agreement time if the workshop requires peer agreement
if ($workshop->agreeassessments and $assessment->timeagreed) {
echo "
".get_string("assessmentwasagreedon", "workshop", userdate($assessment->timeagreed));
- }
+ }
// first print any comments on this assessment
if ($comments = workshop_get_comments($assessment)) {
@@ -1902,13 +1904,13 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
get_string("commentby","workshop")." ";
if (isteacher($workshop->course, $comment->userid)) {
echo $course->teacher;
- }
+ }
elseif ($assessment->userid == $comment->userid) {
print_string("assessor", "workshop");
- }
+ }
else {
print_string("authorofsubmission", "workshop");
- }
+ }
echo " ".get_string("on", "workshop", userdate($comment->timecreated))."
\n";
echo format_text($comment->comments)." \n";
// add the links if needed
@@ -1918,15 +1920,15 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
if (isteacher($workshop->course, $USER->id) and ($comment->userid != $USER->id)) {
echo "
\n";
}
- echo "\n";
- }
-
- // only show the grade if grading strategy > 0 and the grade is positive
- if ($showgrades and $workshop->gradingstrategy and $assessment->grade >= 0) {
- echo "
\n";
+ echo "\n";
}
+ echo "\n";
}
+ }
// now print the grading form with the grading grade if any
// FORM is needed for Mozilla browsers, else radio bttons are not checked
@@ -1964,10 +1959,26 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
\n";
echo "\n";
-
+
+ // only show the grade if grading strategy > 0 and the grade is positive
+ if ($showgrades and $workshop->gradingstrategy and $assessment->grade >= 0) {
+ echo "
\n";
+ }
+ }
print_continue("view.php?id=$cm->id");
}
diff --git a/mod/workshop/upload.php b/mod/workshop/upload.php
index 9f9c79d760..c1a5d19035 100644
--- a/mod/workshop/upload.php
+++ b/mod/workshop/upload.php
@@ -19,13 +19,13 @@
require_login($course->id);
- $strworkshops = get_string("modulenameplural", "workshop");
- $strworkshop = get_string("modulename", "workshop");
- $strupload = get_string("upload");
+ $strworkshops = get_string('modulenameplural', 'workshop');
+ $strworkshop = get_string('modulename', 'workshop');
+ $strsubmission = get_string('submission', 'workshop');
- print_header_simple("$workshop->name : $strupload", "",
+ print_header_simple("$workshop->name : $strsubmission", "",
"id\">$strworkshops ->
- id\">$workshop->name -> $strupload",
+ id\">$workshop->name -> $strsubmission",
"", "", true);
$timenow = time();
@@ -64,7 +64,7 @@
$newsubmission->late = 1;
}
if (!$newsubmission->id = insert_record("workshop_submissions", $newsubmission)) {
- error("Workshop upload: Failure to create new submission record!");
+ error("Workshop submission: Failure to create new submission record!");
}
// see if this is a resubmission by looking at the previous submissions...
if ($submissions and ($workshop->submissionstart > time())) { // ...but not teacher submissions
diff --git a/mod/workshop/version.php b/mod/workshop/version.php
index ba58c24abc..fef985e89e 100644
--- a/mod/workshop/version.php
+++ b/mod/workshop/version.php
@@ -5,7 +5,7 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2004120402;
+$module->version = 2004120900;
$module->requires = 2004052505; // Requires this Moodle version
$module->cron = 60;
diff --git a/mod/workshop/view.php b/mod/workshop/view.php
index c53fbc8282..1454b51cf8 100644
--- a/mod/workshop/view.php
+++ b/mod/workshop/view.php
@@ -16,6 +16,8 @@
require("locallib.php");
require_variable($id); // Course Module ID
+
+ $timenow = time();
// get some useful stuff...
if (! $cm = get_record("course_modules", "id", $id)) {
@@ -59,9 +61,9 @@
if (!$cm->visible) {
notice(get_string("activityiscurrentlyhidden"));
}
- if (time() < $workshop->submissionstart) {
+ if ($timenow < $workshop->submissionstart) {
$action = 'notavailable';
- } else if (time() < $workshop->assessmentend) {
+ } else if ($timenow < $workshop->assessmentend) {
$action = 'studentsview';
} else {
$action = 'displayfinalgrade';
@@ -76,7 +78,7 @@
if ($action == 'displayfinalgrade' ) {
// show the final grades as stored in the tables...
- print_heading_with_help(get_string("displayoffinalgrades", "workshop"), "finalgrades", "workshop");
+ print_heading(get_string("displayoffinalgrades", "workshop"));
if ($submissions = workshop_get_user_submissions($workshop, $USER)) { // any submissions from user?
echo "
";
echo "
".get_string("submissions", "workshop")."
";
@@ -180,7 +182,7 @@
}
// has user submitted anything yet?
if (!workshop_get_user_submissions($workshop, $USER)) {
- if (time() < $workshop->submissionend) {
+ if ($timenow < $workshop->submissionend) {
// print upload form
print_heading(get_string("submitassignmentusingform", "workshop").":");
workshop_print_upload_form($workshop);
@@ -196,7 +198,7 @@
workshop_list_self_assessments($workshop, $USER);
}
// if peer assessments are being done then show some to assess...
- if ($workshop->nsassessments and ($workshop->assessmentstart > time() and $workshop->assessmentend < time())) {
+ if ($workshop->nsassessments and ($workshop->assessmentstart < $timenow and $workshop->assessmentend > $timenow)) {
workshop_list_student_submissions($workshop, $USER);
}
// ..and any they have already done (and have gone cold)...
@@ -205,7 +207,6 @@
workshop_list_assessed_submissions($workshop, $USER);
}
// list any assessments by teachers
- $timenow = time();
if (workshop_count_teacher_assessments_by_user($workshop, $USER) and ($timenow > $workshop->releasegrades)) {
print_heading(get_string("assessmentsby", "workshop", $course->teachers));
workshop_list_teacher_assessments_by_user($workshop, $USER);
@@ -216,10 +217,10 @@
workshop_list_peer_assessments($workshop, $USER);
}
// list previous submissions
- print_heading(get_string("submissions", "workshop"));
+ print_heading(get_string("yoursubmissions", "workshop"));
workshop_list_user_submissions($workshop, $USER);
// are resubmissions allowed and the workshop is in submission/assessment phase?
- if ($workshop->resubmit and (time() > $workshop->assessmentstart and time() < $workshop->submissionend)) {
+ if ($workshop->resubmit and ($timenow > $workshop->assessmentstart and $timenow < $workshop->submissionend)) {
// see if there are any cold assessments of the last submission
// if there are then print upload form
if ($submissions = workshop_get_user_submissions($workshop, $USER)) {
@@ -329,7 +330,7 @@
}
// Show link to student submissions for assessment only if assessment has started
- if (time() > $workshop->assessmentstart) {
+ if ($timenow > $workshop->assessmentstart) {
if ($numberofsubmissions = workshop_count_student_submissions_for_assessment($workshop, $USER)) {
echo " id&action=listforassessmentstudent\">".
get_string("studentsubmissionsforassessment", "workshop",
@@ -340,8 +341,8 @@
}
// Show link to current grades
- if (time() > $workshop->assessmentstart) {
- if (time() < $workshop->assessmentend) {
+ if ($timenow > $workshop->assessmentstart) {
+ if ($timenow < $workshop->assessmentend) {
echo " id&action=displaycurrentgrades\">".
get_string("displayofcurrentgrades", "workshop")." \n";
} else {