Permalink
Browse files

Removal teacher assessment of student assessments; addition of Groups,

various improvements.
  • Loading branch information...
1 parent 852a821 commit 94cc7ed0f1051d34162cbed4e42c56d58adc2af3 rkingdon committed Aug 6, 2004
View
144 mod/exercise/assessments.php
@@ -3,7 +3,8 @@
/*************************************************
ACTIONS handled are:
- adminconfirmdelete
+ adminamendgradinggrading
+ adminconfirmdelete
admindelete
adminedit
adminlist
@@ -19,7 +20,7 @@
teacherassessment (for teachers)
teachertable
updateassessment
- updatedualassessment
+ updateteacherassessment
userconfirmdelete
userdelete
viewassessment
@@ -45,6 +46,7 @@
error("Course module is incorrect");
}
+ exercise_add_custom_scales($exercise);
require_login($course->id);
@@ -67,42 +69,6 @@
require_variable($action);
- /******************* 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","exercise", get_string("assessment", "exercise")),
- "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", "exercise");
- // first delete all the associated records...
- delete_records("exercise_grades", "assessmentid", $_GET['aid']);
- // ...now delete the assessment...
- delete_records("exercise_assessments", "id", $_GET['aid']);
-
- print_continue("submissions.php?id=$cm->id&action=adminlist");
- }
-
-
/******************* admin amend Grading Grade ************************************/
if ($action == 'adminamendgradinggrade' ) {
@@ -126,21 +92,55 @@
echo "<tr><td align=\"right\"><b>".get_string("gradeforstudentsassessment", "exercise",
$course->student)." :</td><td>\n";
// set up coment scale
- for ($i=COMMENTSCALE; $i>=0; $i--) {
+ for ($i=$exercise->gradinggrade; $i>=0; $i--) {
$num[$i] = $i;
}
- choose_from_menu($num, "gradinggrade", $assessment->gradinggrade, "");
+ choose_from_menu($num, "gradinggrade",
+ number_format($exercise->gradinggrade * $assessment->gradinggrade / 100, 0), "");
echo "</td></tr>\n";
echo "<tr><td colspan=\"2\" align=\"center\">";
echo "<INPUT TYPE=submit VALUE=\"".get_string("amend", "exercise")."\">\n";
echo "</td></tr>\n";
echo "</table>\n";
echo "</CENTER>";
echo "</FORM>\n";
+ }
+
+ /******************* admin confirm delete ************************************/
+ elseif ($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","exercise", get_string("assessment", "exercise")),
+ "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", "exercise");
+ // first delete all the associated records...
+ delete_records("exercise_grades", "assessmentid", $_GET['aid']);
+ // ...now delete the assessment...
+ delete_records("exercise_assessments", "id", $_GET['aid']);
+
+ print_continue("submissions.php?id=$cm->id&action=adminlist");
+ }
/*********************** admin list of asssessments (of a submission) (by teachers)**************/
@@ -258,7 +258,7 @@
if (!isteacher($course->id)) {
error("Only teachers can look at this page");
}
-
+
$count = count_records("exercise_grades", "exerciseid", $exercise->id);
if ($exercise->phase > 1 and $count) {
notify(get_string("warningonamendingelements", "exercise"));
@@ -308,6 +308,7 @@
foreach ($EXERCISE_SCALES as $KEY => $SCALE) {
$SCALES[] = $SCALE['name'];
}
+
for ($i=0; $i<$exercise->nelements; $i++) {
$iplus1 = $i+1;
echo "<TR valign=top>\n";
@@ -455,7 +456,7 @@
// let's not fool around here, dump the junk!
delete_records("exercise_elements", "exerciseid", $exercise->id);
-
+
// determine wich type of grading
switch ($exercise->gradingstrategy) {
case 0: // no grading
@@ -607,7 +608,7 @@
if (!$submission = get_record("exercise_submissions", "id", $sid)) {
error("Teacher assessment: User's submission record not found");
}
- exercise_print_dual_assessment_form($exercise, $assessment, $submission, $_SERVER["HTTP_REFERER"]);
+ exercise_print_teacher_assessment_form($exercise, $assessment, $submission, $_SERVER["HTTP_REFERER"]);
}
@@ -835,37 +836,23 @@
}
- /****************** update dual assessment (by teacher only) ***************************/
- elseif ($action == 'updatedualassessment') {
+ /****************** update teacher assessment (by teacher only) ***************************/
+ elseif ($action == 'updateteacherassessment') {
if (!isteacher($course->id)) {
error("Only teachers can look at this page");
- }
+ }
$timenow = time();
$form = (object)$HTTP_POST_VARS;
- // first do the teacher's comments and grading grade of the user's assessment
- if (!$assessment = get_record("exercise_assessments", "id", $form->aid)) {
- error("Update dual assessment: user's assessment record not found");
- }
- //save the comment and grade for the assessment
- if (isset($form->teachercomment)) {
- set_field("exercise_assessments", "teachercomment", $form->teachercomment, "id", $assessment->id);
- set_field("exercise_assessments", "gradinggrade", $form->gradinggrade, "id", $assessment->id);
- set_field("exercise_assessments", "timegraded", $timenow, "id", $assessment->id);
- set_field("exercise_assessments", "mailed", 0, "id", $assessment->id);
- echo "<CENTRE><B>".get_string("savedok", "exercise")."</B></CENTRE><BR>\n";
-
- add_to_log($course->id, "exercise", "grade", "view.php?id=$cm->id", "$assessment->id");
- }
-
- // now do the assessment of a user's submission
+
+ // first do the (teacher's) assessment of the student's submission
if (! $submission = get_record("exercise_submissions", "id", $form->sid)) {
- error("Update dual assessment: user's submission record not found");
+ error("Update teacher assessment: student's submission record not found");
}
if (!$assessment = exercise_get_submission_assessment($submission, $USER)) {
- error("Update dual assessment: teacher's assessment record not found");
+ error("Update teacher assessment: teacher's assessment record not found");
}
// first get the assignment elements for maxscores and weights...
@@ -1020,7 +1007,20 @@
set_field("exercise_assessments", "generalcomment", $form->generalcomment, "id", $assessment->id);
}
- // is user allowed to resubmit?
+ // now calculate the (grading) grade of the student's assessment...
+ if (!$stassessment = get_record("exercise_assessments", "id", $form->said)) {
+ error("Update teacher assessment: student's assessment record not found");
+ }
+ $gradinggrade = exercise_compare_assessments($exercise, $assessment, $stassessment);
+ // ...and save the grade for the assessment
+ set_field("exercise_assessments", "gradinggrade", $gradinggrade, "id", $stassessment->id);
+ set_field("exercise_assessments", "timegraded", $timenow, "id", $stassessment->id);
+ set_field("exercise_assessments", "mailed", 0, "id", $stassessment->id);
+ echo "<CENTRE><B>".get_string("savedok", "exercise")."</B></CENTRE><BR>\n";
+
+ add_to_log($course->id, "exercise", "grade", "view.php?id=$cm->id", "$stassessment->id");
+
+ // is user allowed to resubmit?
if ($form->resubmit == 1) {
set_field("exercise_submissions", "resubmit", 1, "id", $submission->id);
}
@@ -1038,9 +1038,11 @@
// show grade if grading strategy is not zero
if ($exercise->gradingstrategy) {
- redirect($returnto, "<p align=\"center\"><b>".get_string("thegradeis", "exercise").": ".
- number_format($grade * $exercise->grade / 100.0, 1)." (".get_string("maximumgrade").
- " ".number_format($exercise->grade).")</b></p>", 1);
+ redirect($returnto, "<p align=\"center\"><b>".get_string("gradeforstudentsassessment",
+ "exercise", $course->student).": ".number_format($gradinggrade * $exercise->gradinggrade / 100.0, 1).
+ " (".get_string("maximumgrade")." ".number_format($exercise->gradinggrade, 1).")</b></p><p><b>".
+ get_string("thegradeis", "exercise").": ".number_format($grade * $exercise->grade / 100.0, 1).
+ " (".get_string("maximumgrade")." ".number_format($exercise->grade, 1).")</b></p>");
}
else {
redirect($returnto);
@@ -1056,7 +1058,9 @@
}
require_variable($aid);
- if (!set_field("exercise_assessments", "gradinggrade", $_POST['gradinggrade'], "id",
+ // normalise gradinggrade
+ $gradinggrade = $_POST['gradinggrade'] * 100 / $exercise->gradinggrade;
+ if (!set_field("exercise_assessments", "gradinggrade", $gradinggrade, "id",
$_POST['aid'])) {
error("Update grading grade: asseesment not updated");
}
View
9 mod/exercise/db/mysql.php
@@ -17,7 +17,14 @@ function exercise_upgrade($oldversion) {
if ($oldversion < 2003121000) {
execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD `late` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0'");
}
-
+
+ if ($oldversion < 2004062300) {
+ table_column("exercise", "", "gradinggrade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
+ table_column("exercise", "", "assessmentcomps", "INTEGER", "4", "UNSIGNED", "2", "NOT NULL", "usemaximum");
+ execute_sql("ALTER TABLE `{$CFG->prefix}exercise` DROP COLUMN `teacherweight`");
+ execute_sql("ALTER TABLE `{$CFG->prefix}exercise` DROP COLUMN `gradingweight`");
+ }
+
return true;
}
View
8 mod/exercise/db/mysql.sql
@@ -10,13 +10,13 @@ CREATE TABLE `prefix_exercise` (
`phase` tinyint(3) unsigned NOT NULL default '0',
`gradingstrategy` tinyint(3) unsigned NOT NULL default '1',
`usemaximum` tinyint(3) unsigned NOT NULL default '0',
- `anonymous` tinyint(3) unsigned NOT NULL default '0',
+ `assessmentcomps` tinyint(3) unsigned NOT NULL default '2',
+ `anonymous` tinyint(3) unsigned NOT NULL default '1',
`maxbytes` int(10) unsigned NOT NULL default '100000',
`deadline` int(10) unsigned NOT NULL default '0',
- `grade` tinyint(3) NOT NULL default '0',
`timemodified` int(10) unsigned NOT NULL default '0',
- `teacherweight` tinyint(3) unsigned NOT NULL default '5',
- `gradingweight` tinyint(3) unsigned NOT NULL default '5',
+ `grade` tinyint(3) NOT NULL default '0',
+ `gradinggrade` tinyint(3) NOT NULL default '0',
`showleaguetable` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) COMMENT='Defines exercise';
View
1 mod/exercise/db/oci8po.sql
@@ -11,6 +11,7 @@ CREATE TABLE prefix_exercise (
phase number(3) default '0' not null,
gradingstrategy number(3) default '1' not null,
usemaximum number(3) default '0' not null,
+ assessmentcomps number(3) default '2' not null,
anonymous number(3) default '0' not null,
maxbytes number(10) default '100000' not null,
deadline number(10) default '0' not null,
View
9 mod/exercise/db/postgres7.php
@@ -6,6 +6,15 @@ function exercise_upgrade($oldversion) {
global $CFG;
+ if ($oldversion < 2003121000) {
+ execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD `late` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0'");
+ }
+
+ if ($oldversion < 2004062300) {
+ table_column("exercise", "", "gradinggrade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
+ table_column("exercise", "", "assessmentcomps", "INTEGER", "4", "UNSIGNED", "2", "NOT NULL", "usemaximum");
+ }
+
return true;
}
View
6 mod/exercise/db/postgres7.sql
@@ -10,13 +10,13 @@ CREATE TABLE prefix_exercise (
phase INT NOT NULL default '0',
gradingstrategy INT NOT NULL default '1',
usemaximum INT NOT NULL default '0',
+ assessmentcomps INT NOT NULL default '2',
anonymous INT NOT NULL default '0',
maxbytes INT8 NOT NULL default '100000',
deadline INT8 NOT NULL default '0',
- grade INT NOT NULL default '0',
timemodified INT8 NOT NULL default '0',
- teacherweight INT NOT NULL default '5',
- gradingweight INT NOT NULL default '5',
+ grade INT NOT NULL default '0',
+ gradinggrade INT NOT NULL default '0',
showleaguetable INT NOT NULL default '0'
);
# --------------------------------------------------------
View
56 mod/exercise/index.php
@@ -78,48 +78,46 @@
switch ($exercise->phase) {
case 1: $phase = get_string("phase1short", "exercise");
break;
- case 2: $phase = get_string("phase2short", "exercise");
+ case 2: $phase = get_string("phase2short", "exercise")." [".
+ get_string("unassessed", "exercise",
+ exercise_count_unassessed_student_submissions($exercise))."]";
break;
- case 3: $phase = get_string("phase3short", "exercise");
+ case 3: $phase = get_string("phase3short", "exercise")." [".
+ get_string("unassessed", "exercise",
+ exercise_count_unassessed_student_submissions($exercise))."]";
break;
}
$table->data[] = array ($exercise->section, $link, $title, $phase,
$submitted, $due);
- } else {
- $assessed = false;
- if ($exercise->usemaximum) {
- $maximum = exercise_get_best_grade($submission);
- if (isset($maximum)) {
- $grade = $maximum->grade;
- $assessed = true;
+ } else { // it's a student
+ if ($assessments = exercise_get_user_assessments($exercise, $USER)) { // should be only one...
+ foreach ($assessments as $studentassessment) {
+ break;
}
- }else { // use mean value
- $mean = exercise_get_mean_grade($submission);
- if (isset($mean->grade)) {
- $grade = $mean->grade;
- $assessed = true;
- }
- }
- if ($assessed) {
- $actualgrade = number_format($grade * $exercise->grade / 100.0, 1);
- if ($submission->late) {
- $actualgrade = "<font color=\"red\">(".$actualgrade.")<font color=\"red\">";
+ if ($studentassessment->timegraded) { // it's been assessed
+ if ($teacherassessment = exercise_get_submission_assessment($submission)) {
+ $actualgrade = number_format(($studentassessment->gradinggrade *
+ $exercise->gradinggrade / 100.0) + ($teacherassessment->grade *
+ $exercise->grade / 100.0), 1);
+ if ($submission->late) {
+ $actualgrade = "<font color=\"red\">(".$actualgrade.")<font color=\"red\">";
+ }
+ $actualgrade .= " (".get_string("maximumshort").": ".
+ number_format($exercise->gradinggrade + $exercise->grade, 0).")";
+ $table->data[] = array ($exercise->section, $link, $title, $actualgrade,
+ $submitted, $due);
+ }
} else {
- }
- $table->data[] = array ($exercise->section, $link, $title,
- $actualgrade, $submitted, $due);
- } else {
- $table->data[] = array ($exercise->section, $link, $title,
+ $table->data[] = array ($exercise->section, $link, $title,
"-", $submitted, $due);
+ }
}
}
- }
- else {
+ } else {
$table->data[] = array ($link, $submitted, $due);
}
}
- }
- else {
+ } else {
$submitted = get_string("no");
$title = '';
$link = "<A HREF=\"view.php?id=$exercise->coursemodule\">$exercise->name</A>";
View
147 mod/exercise/lib.php
@@ -26,14 +26,14 @@
9 => array( 'name' => get_string("scale100", "exercise"), 'type' => 'selection', 'size' => 100));
$EXERCISE_EWEIGHTS = array( 0 => -4.0, 1 => -2.0, 2 => -1.5, 3 => -1.0, 4 => -0.75, 5 => -0.5, 6 => -0.25,
- 7 => 0.0, 8 => 0.25, 9 => 0.5, 10 => 0.75, 11=> 1.0, 12 => 1.5, 13=> 2.0, 14 => 4.0);
+ 7 => 0.0, 8 => 0.25, 9 => 0.5, 10 => 0.75, 11=> 1.0, 12 => 1.5, 13=> 2.0, 14 => 4.0);
-$EXERCISE_FWEIGHTS = array( 0 => 0, 1 => 0.1, 2 => 0.25, 3 => 0.5, 4 => 0.75, 5 => 1.0, 6 => 1.5,
- 7 => 2.0, 8 => 3.0, 9 => 5.0, 10 => 7.5, 11=> 10.0);
-
-if (!defined("COMMENTSCALE")) {
- define("COMMENTSCALE", 20);
- }
+$EXERCISE_ASSESSMENT_COMPS = array (
+ 0 => array('name' => get_string("verylax", "exercise"), 'value' => 1),
+ 1 => array('name' => get_string("lax", "exercise"), 'value' => 0.6),
+ 2 => array('name' => get_string("fair", "exercise"), 'value' => 0.4),
+ 3 => array('name' => get_string("strict", "exercise"), 'value' => 0.33),
+ 4 => array('name' => get_string("verystrict", "exercise"), 'value' => 0.2) );
/*** Standard Moodle functions ******************
function exercise_add_instance($exercise)
@@ -114,7 +114,7 @@ function exercise_choose_from_menu ($options, $name, $selected="", $nothing="cho
/*******************************************************************/
-function exercise_cron () {
+function exercise_cron() {
// Function to be run periodically according to the moodle cron
// Finds all exercise notifications that have yet to be mailed out, and mails them
@@ -127,8 +127,11 @@ function exercise_cron () {
$timenow = time();
foreach ($assessments as $assessment) {
-
echo "Processing exercise assessment $assessment->id\n";
+ // switch on mailed
+ if (! set_field("exercise_assessments", "mailed", "1", "id", "$assessment->id")) {
+ echo "Could not update the mailed field for id $assessment->id\n";
+ }
if (! $submission = get_record("exercise_submissions", "id", "$assessment->submissionid")) {
echo "Could not find submission $assessment->submissionid\n";
continue;
@@ -160,6 +163,11 @@ function exercise_cron () {
continue; // Not an active participant
}
+ // if the submission belongs to a teacher it's a student assessment. No need to email anything.
+ if (isteacher($course->id, $submissionowner->id)) {
+ continue;
+ }
+
$strexercises = get_string("modulenameplural", "exercise");
$strexercise = get_string("modulename", "exercise");
@@ -194,93 +202,11 @@ function exercise_cron () {
if (!$teacher = get_teacher($course->id)) {
echo "Error: can not find teacher for course $course->id!\n";
- }
-
- if (! email_to_user($sendto, $teacher, $postsubject, $posttext, $posthtml)) {
- echo "Error: exercise cron: Could not send out mail for id $submission->id to user $sendto->id ($sendto->email)\n";
- }
- if (! set_field("exercise_assessments", "mailed", "1", "id", "$assessment->id")) {
- echo "Could not update the mailed field for id $assessment->id\n";
- }
- }
- }
-
- // look for new gradings
- if ($assessments = exercise_get_unmailed_graded_assessments($cutofftime)) {
- $timenow = time();
-
- foreach ($assessments as $assessment) {
-
- echo "Processing exercise assessment $assessment->id (graded)\n";
-
- if (! $submission = get_record("exercise_submissions", "id", "$assessment->submissionid")) {
- echo "Could not find submission $assessment->submissionid\n";
- continue;
- }
- if (! $exercise = get_record("exercise", "id", $submission->exerciseid)) {
- echo "Could not find exercise record for id $submission->exerciseid\n";
- continue;
- }
- if (! $course = get_record("course", "id", "$exercise->course")) {
- echo "Could not find course $exercise->course\n";
- continue;
}
- if (! $cm = get_coursemodule_from_instance("exercise", $exercise->id, $course->id)) {
- error("Course Module ID was incorrect");
- continue;
- }
-
- if (! $assessmentowner = get_record("user", "id", "$assessment->userid")) {
- echo "Could not find user $assessment->userid\n";
- continue;
- }
-
- if (! isstudent($course->id, $assessmentowner->id) and !isteacher($course->id, $assessmentowner->id)) {
- continue; // Not an active participant
- }
-
- $strexercises = get_string("modulenameplural", "exercise");
- $strexercise = get_string("modulename", "exercise");
-
- // it's a grading tell the assessment owner
- $USER->lang = $assessmentowner->lang;
- $sendto = $assessmentowner;
- // Your assessment of the assignment \"$submission->title\" has by reviewed
- $msg = get_string("mail6", "exercise", $submission->title).".\n";
- // The comments given by the $course->teacher can be seen in the exercise Assignment
- $msg .= get_string("mail7", "exercise", $course->teacher)." '$exercise->name'.\n\n";
-
- $postsubject = "$course->shortname: $strexercises: $exercise->name";
- $posttext = "$course->shortname -> $strexercises -> $exercise->name\n";
- $posttext .= "---------------------------------------------------------------------\n";
- $posttext .= $msg;
- // "You can see it in your exercise assignment"
- $posttext .= get_string("mail3", "exercise").":\n";
- $posttext .= " $CFG->wwwroot/mod/exercise/view.php?id=$cm->id\n";
- $posttext .= "---------------------------------------------------------------------\n";
- if ($sendto->mailformat == 1) { // HTML
- $posthtml = "<P><FONT FACE=sans-serif>".
- "<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> ->".
- "<A HREF=\"$CFG->wwwroot/mod/exercise/index.php?id=$cm->id\">$strexercises</A> ->".
- "<A HREF=\"$CFG->wwwroot/mod/exercise/view.php?a=$exercise->id\">$exercise->name</A></FONT></P>";
- $posthtml .= "<HR><FONT FACE=sans-serif>";
- $posthtml .= "<P>$msg</P>";
- $posthtml .= "<P>".get_string("mail3", "exercise").
- " <A HREF=\"$CFG->wwwroot/mod/exercise/view.php?id=$cm->id\">$exercise->name</A>.</P></FONT><HR>";
- } else {
- $posthtml = "";
- }
-
- if (!$teacher = get_teacher($course->id)) {
- echo "Error: can not find teacher for course $course->id!\n";
- }
if (! email_to_user($sendto, $teacher, $postsubject, $posttext, $posthtml)) {
echo "Error: exercise cron: Could not send out mail for id $submission->id to user $sendto->id ($sendto->email)\n";
}
- if (! set_field("exercise_assessments", "mailed", "1", "id", "$assessment->id")) {
- echo "Could not update the mailed field for id $assessment->id\n";
- }
}
}
return true;
@@ -331,36 +257,30 @@ function exercise_delete_instance($id) {
/*******************************************************************/
function exercise_grades($exerciseid) {
/// Must return an array of grades, indexed by user, and a max grade.
-global $EXERCISE_FWEIGHTS;
if (!$exercise = get_record("exercise", "id", $exerciseid)) {
error("Exercise record not found");
}
if (! $course = get_record("course", "id", $exercise->course)) {
error("Course is misconfigured");
}
- if (!$return->maxgrade = $exercise->grade) {
+ if (!$return->maxgrade = ($exercise->grade + $exercise->gradinggrade)) {
return NULL;
}
- // calculate scaling factor
- $scaling = $exercise->grade / (100.0 * ($EXERCISE_FWEIGHTS[$exercise->gradingweight] +
- $EXERCISE_FWEIGHTS[$exercise->teacherweight]));
// how to handle multiple submissions?
if ($exercise->usemaximum) {
// first get the teacher's grade for the best submission
if ($bestgrades = exercise_get_best_submission_grades($exercise)) {
foreach ($bestgrades as $grade) {
- $usergrade[$grade->userid] = $grade->grade *
- $EXERCISE_FWEIGHTS[$exercise->teacherweight] * $scaling;
+ $usergrade[$grade->userid] = $grade->grade * $exercise->grade / 100.0;
}
}
}
else { // use mean values
if ($meangrades = exercise_get_mean_submission_grades($exercise)) {
foreach ($meangrades as $grade) {
- $usergrade[$grade->userid] = $grade->grade *
- $EXERCISE_FWEIGHTS[$exercise->teacherweight] * $scaling;
+ $usergrade[$grade->userid] = $grade->grade * $exercise->grade / 100.0;
}
}
}
@@ -369,8 +289,7 @@ function exercise_grades($exerciseid) {
foreach ($assessments as $assessment) {
// add the grading grade if the student's work has been assessed
if (isset($usergrade[$assessment->userid])) {
- $usergrade[$assessment->userid] += $assessment->gradinggrade *
- $EXERCISE_FWEIGHTS[$exercise->gradingweight] * $scaling * 100.0 / COMMENTSCALE;
+ $usergrade[$assessment->userid] += $assessment->gradinggrade * $exercise->gradinggrade / 100.0;
}
}
}
@@ -650,7 +569,7 @@ function exercise_get_best_grade($submission) {
// Returns the best grade of students' submission (there may, occassionally be more than one assessment)
global $CFG;
- return get_record_sql("SELECT MAX(a.grade) grade FROM
+ return get_record_sql("SELECT MAX(a.grade) AS grade FROM
{$CFG->prefix}exercise_assessments a
WHERE a.submissionid = $submission->id
GROUP BY a.submissionid");
@@ -686,7 +605,7 @@ function exercise_get_mean_submission_grades($exercise) {
global $CFG;
$timenow = time();
- $grades = get_records_sql("SELECT DISTINCT u.userid, AVG(a.grade) grade FROM
+ $grades = get_records_sql("SELECT DISTINCT u.userid, AVG(a.grade) AS grade FROM
{$CFG->prefix}exercise_submissions s,
{$CFG->prefix}exercise_assessments a, {$CFG->prefix}user_students u
WHERE u.course = $exercise->course
@@ -735,25 +654,11 @@ function exercise_get_teacher_submission_assessments($exercise) {
function exercise_get_unmailed_assessments($cutofftime) {
/// Return list of (ungraded) assessments that have not been mailed out
global $CFG;
- return get_records_sql("SELECT a.*, g.course, g.name
- FROM {$CFG->prefix}exercise_assessments a, {$CFG->prefix}exercise g
+ return get_records_sql("SELECT a.*, e.course, e.name
+ FROM {$CFG->prefix}exercise_assessments a, {$CFG->prefix}exercise e
WHERE a.mailed = 0
- AND a.timegraded = 0
AND a.timecreated < $cutofftime
- AND g.id = a.exerciseid");
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-function exercise_get_unmailed_graded_assessments($cutofftime) {
- /// Return list of graded assessments that have not been mailed out
- global $CFG;
- return get_records_sql("SELECT a.*, g.course, g.name
- FROM {$CFG->prefix}exercise_assessments a, {$CFG->prefix}exercise g
- WHERE a.mailed = 0
- AND a.timegraded < $cutofftime
- AND a.timegraded > 0
- AND g.id = a.exerciseid");
+ AND e.id = a.exerciseid");
}
View
1,516 mod/exercise/locallib.php
@@ -6,6 +6,8 @@
/*** Functions for the exercise module ******
+function exercise_add_custom_scales($exercise) {
+function exercise_compare_assessments($exercise, $assessment1, $assessment2) {
function exercise_copy_assessment($assessment, $submission, $withfeedback = false) {
function exercise_count_all_submissions_for_assessment($exercise, $user) {
function exercise_count_assessments($submission) {
@@ -59,12 +61,12 @@ function exercise_print_assessments_by_user_for_admin($exercise, $user) {
function exercise_print_assessments_for_admin($exercise, $submission) {
function exercise_print_assignment_info($exercise) {
function exercise_print_difference($time) {
-function exercise_print_dual_assessment_form($exercise, $assessment, $submission, $returnto)
function exercise_print_feedback($course, $submission) {
function exercise_print_league_table($exercise) {
function exercise_print_submission_assessments($exercise, $submission, $type) {
function exercise_print_submission_title($exercise, $submission) { <--- in lib.php
function exercise_print_tabbed_table($table) {
+function exercise_print_teacher_assessment_form($exercise, $assessment, $submission, $returnto)
function exercise_print_teacher_table($course) {
function exercise_print_time_to_deadline($time) {
function exercise_print_upload_form($exercise) {
@@ -74,8 +76,61 @@ function exercise_test_for_resubmission($exercise, $user) {
function exercise_test_user_assessments($exercise, $user) {
***************************************/
+///////////////////////////////////////////////////////////////////////////////////////////////
+function exercise_add_custom_scales($exercise) {
+ global $EXERCISE_SCALES;
+
+ if (! $course = get_record("course", "id", $exercise->course)) {
+ error("Course is misconfigured");
+ }
+
+ if ($scales = get_records("scale", "courseid", $course->id, "name ASC")) {
+ foreach ($scales as $scale) {
+ $labels = explode(",", $scale->scale);
+ $EXERCISE_SCALES[] = array('name' => $scale->name, 'type' => 'radio', 'size' => count($labels),
+ 'start' => trim($labels[0]), 'end' => trim($labels[count($labels) - 1]));
+ }
+ }
+ return;
+}
///////////////////////////////////////////////////////////////////////////////////////////////
+function exercise_compare_assessments($exercise, $assessment1, $assessment2) {
+ global $EXERCISE_ASSESSMENT_COMPS, $EXERCISE_EWEIGHTS;
+ // first get the assignment elements for maxscores...
+ $elementsraw = get_records("exercise_elements", "exerciseid", $exercise->id, "elementno ASC");
+ foreach ($elementsraw as $element) {
+ $maxscore[] = $element->maxscore; // to renumber index 0,1,2...
+ $weight[] = $EXERCISE_EWEIGHTS[$element->weight]; // get real value and renumber index 0,1,2...
+ }
+ for ($i = 0; $i < 2; $i++) {
+ if ($i) {
+ $rawgrades = get_records("exercise_grades", "assessmentid", $assessment1->id, "elementno ASC");
+ } else {
+ $rawgrades = get_records("exercise_grades", "assessmentid", $assessment2->id, "elementno ASC");
+ }
+ foreach ($rawgrades as $grade) {
+ $grades[$i][] = $grade->grade;
+ }
+ }
+ $sumdiffs = 0;
+ $sumweights = 0;
+ for ($i=0; $i < $exercise->nelements; $i++) {
+ $diff = ($grades[0][$i] - $grades[1][$i]) * $weight[$i] / $maxscore[$i];
+ $sumdiffs += $diff * $diff; // use squared distances
+ $sumweights += $weight[$i];
+ }
+ // convert to a sensible grade (always out of 100)
+ $COMP = (object)$EXERCISE_ASSESSMENT_COMPS[$exercise->assessmentcomps];
+ $factor = $COMP->value;
+ $gradinggrade = (($factor - ($sumdiffs / $sumweights)) / $factor) *100;
+ if ($gradinggrade < 0) {
+ $gradinggrade = 0;
+ }
+ return $gradinggrade;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////
function exercise_copy_assessment($assessment, $submission, $withfeedback = false) {
// adds a copy of the given assessment for the submission specified to the exercise_assessemnts table.
// The grades and optionally the comments are added to the exercise_grades table. Returns the new
@@ -223,7 +278,9 @@ function exercise_count_unassessed_student_submissions($exercise) {
}
$timenow = time();
$n = 0;
- if ($submissions = exercise_get_student_submissions($exercise)) {
+ // look at all the student submissions, exercise_get_student_submissions is group aware
+ $groupid = get_current_group($course->id);
+ if ($submissions = exercise_get_student_submissions($exercise, "time", $groupid)) {
foreach ($submissions as $submission) {
// only look at "cold" submissions
if ($submission->timecreated < $timenow - $CFG->maxeditingtime) {
@@ -248,10 +305,11 @@ function exercise_count_unassessed_student_submissions($exercise) {
///////////////////////////////////////////////////////////////////////////////////////////////
-function exercise_count_ungraded_assessments_student($exercise) {
+function exercise_count_ungraded_assessments_student($exercise, $groupid = 0) {
// function returns the number of ungraded assessments by students of STUDENT submissions
+
$n = 0;
- if ($submissions = exercise_get_student_submissions($exercise)) {
+ if ($submissions = exercise_get_student_submissions($exercise, $groupid)) {
foreach ($submissions as $submission) {
if ($assessments = exercise_get_assessments($submission)) {
foreach ($assessments as $assessment) {
@@ -404,7 +462,7 @@ function exercise_get_best_submission_grades($exercise) {
// Returns the grades of students' best submissions
global $CFG;
- return get_records_sql("SELECT DISTINCT u.userid, MAX(a.grade) grade FROM
+ return get_records_sql("SELECT DISTINCT u.userid, MAX(a.grade) AS grade FROM
{$CFG->prefix}exercise_submissions s,
{$CFG->prefix}exercise_assessments a, {$CFG->prefix}user_students u
WHERE u.course = $exercise->course
@@ -421,7 +479,7 @@ function exercise_get_mean_grade($submission) {
// Returns the mean grade of students' submission (may, very occassionally, be more than one assessment)
global $CFG;
- return get_record_sql("SELECT AVG(a.grade) grade FROM
+ return get_record_sql("SELECT AVG(a.grade) AS grade FROM
{$CFG->prefix}exercise_assessments a
WHERE a.submissionid = $submission->id
GROUP BY a.submissionid");
@@ -442,45 +500,87 @@ function exercise_get_student_submission($exercise, $user) {
///////////////////////////////////////////////////////////////////////////////////////////////
-function exercise_get_student_submissions($exercise, $order = "") {
+function exercise_get_student_submissions($exercise, $order = "time", $groupid = 0) {
// Return all ENROLLED student submissions
// if order can grade|title|name|nothing, nothing is oldest first, youngest last
global $CFG;
- if ($order == "grade") {
- // allow for multiple assessments of submissions (coming from different teachers)
- return get_records_sql("SELECT s.*, AVG(a.grade) grade FROM {$CFG->prefix}exercise_submissions s,
- {$CFG->prefix}user_students u, {$CFG->prefix}exercise_assessments a
- WHERE u.course = $exercise->course
- AND s.userid = u.userid
- AND s.exerciseid = $exercise->id
- AND a.submissionid = s.id
- GROUP BY s.id
- ORDER BY a.grade DESC");
- }
-
- if ($order == "title") {
- $order = "s.title";
- } elseif ($order == "name") {
- $order = "n.firstname, n.lastname, s.timecreated DESC";
- } else {
- $order = "s.timecreated";
+ if ($groupid) {
+ // just look at a single group
+ if ($order == "grade") {
+ // allow for multiple assessments of submissions (coming from different teachers)
+ return get_records_sql("SELECT s.*, AVG(a.grade) AS grade FROM {$CFG->prefix}user_students u,
+ {$CFG->prefix}groups_members g, {$CFG->prefix}exercise_submissions s,
+ {$CFG->prefix}exercise_assessments a
+ WHERE u.course = $exercise->course
+ AND g.groupid = $groupid
+ AND u.userid = g.userid
+ AND s.userid = u.userid
+ AND s.exerciseid = $exercise->id
+ AND a.submissionid = s.id
+ GROUP BY s.id
+ ORDER BY a.grade DESC");
+ }
+
+ if ($order == "title") {
+ $order = "s.title";
+ } elseif ($order == "name") {
+ $order = "n.firstname, n.lastname, s.timecreated DESC";
+ } elseif ($order == "time") {
+ $order = "s.timecreated";
+ }
+
+ return get_records_sql("SELECT s.* FROM {$CFG->prefix}user_students u, {$CFG->prefix}user n,
+ {$CFG->prefix}groups_members g, {$CFG->prefix}exercise_submissions s
+ WHERE u.course = $exercise->course
+ AND g.groupid = $groupid
+ AND u.userid = g.userid
+ AND s.userid = u.userid
+ AND n.id = u.userid
+ AND s.exerciseid = $exercise->id
+ ORDER BY $order");
+
+ }
+ else { // no group - all users
+ if ($order == "grade") {
+ // allow for multiple assessments of submissions (coming from different teachers)
+ return get_records_sql("SELECT s.*, AVG(a.grade) AS grade FROM {$CFG->prefix}exercise_submissions s,
+ {$CFG->prefix}user_students u, {$CFG->prefix}exercise_assessments a
+ WHERE u.course = $exercise->course
+ AND s.userid = u.userid
+ AND s.exerciseid = $exercise->id
+ AND a.submissionid = s.id
+ GROUP BY s.id
+ ORDER BY a.grade DESC");
+ }
+
+ if ($order == "title") {
+ $order = "s.title";
+ } elseif ($order == "name") {
+ $order = "n.firstname, n.lastname, s.timecreated DESC";
+ } elseif ($order == "time") {
+ $order = "s.timecreated";
+ }
+
+ return get_records_sql("SELECT s.* FROM {$CFG->prefix}exercise_submissions s,
+ {$CFG->prefix}user_students u, {$CFG->prefix}user n
+ WHERE u.course = $exercise->course
+ AND s.userid = u.userid
+ AND n.id = u.userid
+ AND s.exerciseid = $exercise->id
+ ORDER BY $order");
}
-
- return get_records_sql("SELECT s.* FROM {$CFG->prefix}exercise_submissions s,
- {$CFG->prefix}user_students u, {$CFG->prefix}user n
- WHERE u.course = $exercise->course
- AND s.userid = u.userid
- AND n.id = u.userid
- AND s.exerciseid = $exercise->id
- ORDER BY $order");
}
///////////////////////////////////////////////////////////////////////////////////////////////
-function exercise_get_submission_assessment($submission, $user) {
- // Return the user's assessment for this submission
- return get_record("exercise_assessments", "submissionid", $submission->id, "userid", $user->id);
+function exercise_get_submission_assessment($submission, $user = null) {
+ // Return a user's assessment for this submission
+ if ($user) {
+ return get_record("exercise_assessments", "submissionid", $submission->id, "userid", $user->id);
+ } else { // likely to be the teacher's assessment
+ return get_record("exercise_assessments", "submissionid", $submission->id);
+ }
}
@@ -543,6 +643,7 @@ function exercise_get_ungraded_assessments_teacher($exercise) {
///////////////////////////////////////////////////////////////////////////////////////////////
function exercise_get_user_assessments($exercise, $user) {
// Return all the user's assessments, newest first, oldest last
+ // students will have only one, teachers will have more...
return get_records_select("exercise_assessments", "exerciseid = $exercise->id AND userid = $user->id",
"timecreated DESC");
}
@@ -586,91 +687,26 @@ function exercise_list_all_ungraded_assessments($exercise) {
///////////////////////////////////////////////////////////////////////////////////////////////
function exercise_list_submissions_for_admin($exercise) {
// list the teacher sublmissions first
- global $CFG, $EXERCISE_FWEIGHTS, $THEME, $USER;
+ global $CFG, $THEME, $USER;
if (! $course = get_record("course", "id", $exercise->course)) {
error("Course is misconfigured");
}
if (! $cm = get_coursemodule_from_instance("exercise", $exercise->id, $course->id)) {
error("Course Module ID was incorrect");
}
-
+ $groupid = get_current_group($course->id);
+
exercise_print_assignment_info($exercise);
print_heading_with_help(get_string("administration"), "administration", "exercise");
echo"<p align=\"center\"><b><a href=\"assessments.php?action=teachertable&id=$cm->id\">".
get_string("teacherassessmenttable", "exercise", $course->teacher)."</a></b></p>\n";
if (isteacheredit($course->id)) {
- ?>
- <form name="weightsform" method="post" action="submissions.php">
- <INPUT TYPE="hidden" NAME="id" VALUE="<?PHP echo $cm->id ?>">
- <input type="hidden" name="action" value="saveweights">
- <CENTER>
- <?PHP
-
- // get the final weights from the database
- $teacherweight = get_field("exercise","teacherweight", "id", $exercise->id);
- $gradingweight = get_field("exercise","gradingweight", "id", $exercise->id);
-
- // now show the weights used in the grades
- echo "<TABLE WIDTH=\"50%\" BORDER=\"1\">\n";
- echo "<tr><td colspan=\"2\" bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".
- get_string("weightsusedforoverallgrade", "exercise")."</b></td></tr>\n";
- echo "<TR><TD ALIGN=\"right\">".get_string("weightforgradingofassessments", "exercise").":</TD>\n";
- echo "<TD>";
- exercise_choose_from_menu($EXERCISE_FWEIGHTS, "gradingweight", $gradingweight, "");
- echo "</td></tr>\n";
- echo "<tr><td align=\"right\">".get_string("weightforteacherassessments", "exercise",
- $course->teacher).":</td>\n";
- echo "<td>";
- exercise_choose_from_menu($EXERCISE_FWEIGHTS, "teacherweight", $teacherweight, "");
- echo "</td></tr>\n";
- echo "<tr><td colspan=\"2\" align=\"center\">";
- echo "<INPUT TYPE=submit VALUE=\"".get_string("saveweights", "exercise")."\">\n";
- echo "</td></tr>\n";
- echo "</TABLE>\n";
- echo "</CENTER><br />";
- echo "</FORM>\n";
-
- ?>
- <form name="leagueform" method="post" action="submissions.php">
- <INPUT TYPE="hidden" NAME="id" VALUE="<?PHP echo $cm->id ?>">
- <input type="hidden" name="action" value="saveleaguetable">
- <CENTER>
- <?PHP
-
- echo "<TABLE WIDTH=\"50%\" BORDER=\"1\">\n";
- echo "<tr><td align=\"center\" colspan=\"2\" bgcolor=\"$THEME->cellheading2\"><b>".
- get_string("leaguetable", "exercise")."</b></td></tr>\n";
- echo "<tr><td align=\"right\">".get_string("numberofentries", "exercise").":</td>\n";
- echo "<TD>";
- $numbers[22] = 'All';
- $numbers[21] = 50;
- for ($i=20; $i>=0; $i--) {
- $numbers[$i] = $i;
- }
- $nentries = $exercise->showleaguetable;
- if ($nentries == 99) {
- $nentries = 'All';
- }
- choose_from_menu($numbers, "nentries", "$nentries", "");
- echo "</td></tr>\n";
- echo "<tr><td align=\"right\">".get_string("hidenamesfromstudents", "exercise",
- $course->students)."</td><td>\n";
- $options[0] = get_string("no"); $options[1] = get_string("yes");
- choose_from_menu($options, "anonymous", $exercise->anonymous, "");
- echo "</td></tr>\n";
- echo "<tr><td colspan=\"2\" align=\"center\">";
- echo "<INPUT TYPE=submit VALUE=\"".get_string("saveentries", "exercise")."\">\n";
- echo "</td></tr>\n";
- echo "</table>\n";
- echo "</CENTER>";
- echo "</FORM>\n";
-
-
// list any teacher submissions
- $table->head = array (get_string("title", "exercise"), get_string("submitted", "exercise"), get_string("action", "exercise"));
+ $table->head = array (get_string("title", "exercise"), get_string("submitted", "exercise"),
+ get_string("action", "exercise"));
$table->align = array ("left", "left", "left");
$table->size = array ("*", "*", "*");
$table->cellpadding = 2;
@@ -703,6 +739,13 @@ function exercise_list_submissions_for_admin($exercise) {
$table->cellspacing = 0;
$nassessments = 0;
foreach ($users as $user) {
+ // check group membership, if necessary
+ if ($groupid) {
+ // check user's group
+ if (!ismember($groupid, $user->id)) {
+ continue; // skip this user
+ }
+ }
if ($assessments = exercise_get_user_assessments($exercise, $user)) {
$title ='';
foreach ($assessments as $assessment) {
@@ -715,8 +758,7 @@ function exercise_list_submissions_for_admin($exercise) {
// show only warm or cold assessments
$title .= " {".number_format($assessment->grade * $exercise->grade / 100.0, 0);
if ($assessment->timegraded) {
- $title .= "/".number_format($assessment->gradinggrade * $exercise->grade /
- COMMENTSCALE, 0);
+ $title .= "/".number_format($assessment->gradinggrade * $exercise->gradinggrade / 100.0, 0);
}
$title .= "} ";
if ($realassessments = exercise_count_user_assessments_done($exercise, $user)) {
@@ -736,7 +778,9 @@ function exercise_list_submissions_for_admin($exercise) {
if (isset($table->data)) {
print_heading(get_string("studentassessments", "exercise", $course->student)." [$nassessments]");
print_table($table);
- echo "<p align=\"center\">".get_string("noteonstudentassessments", "exercise")."</p>\n";
+ echo "<p align=\"center\">".get_string("noteonstudentassessments", "exercise");
+ echo "<br />{".get_string("maximumgrade").": $exercise->grade / ".
+ get_string("maximumgrade").": $exercise->gradinggrade}</p>\n";
}
}
@@ -752,6 +796,13 @@ function exercise_list_submissions_for_admin($exercise) {
$nsubmissions = 0;
foreach ($users as $user) {
+ // check group membership, if necessary
+ if ($groupid) {
+ // check user's group
+ if (!ismember($groupid, $user->id)) {
+ continue; // skip this user
+ }
+ }
if ($submissions = exercise_get_user_submissions($exercise, $user)) {
foreach ($submissions as $submission) {
$action = "<a href=\"submissions.php?action=adminamendtitle&id=$cm->id&sid=$submission->id\">".
@@ -802,10 +853,10 @@ function exercise_list_submissions_for_admin($exercise) {
print_heading(get_string("studentsubmissions", "exercise", $course->student)." [$nsubmissions]",
"center");
print_table($table);
+ echo "<p align=\"center\">[] - ".get_string("gradeforsubmission", "exercise");
+ echo "<br />".get_string("maximumgrade").": $exercise->grade</p>\n";
echo "<p align=\"center\">".get_string("resubmitnote", "exercise", $course->student)."</p>\n";
}
- echo "<p align=\"center\">".get_string("allgradeshaveamaximumof", "exercise", $exercise->grade).
- "</p></center>\n";
}
}
@@ -876,7 +927,7 @@ function exercise_list_teacher_submissions($exercise, $user, $reassess = false)
// the user has not yet assessed this exercise, set up a hot assessment record for this user for one
// of the teacher submissions, first count the number of assessments for each teacher submission...
if ($submissions = exercise_get_teacher_submissions($exercise)) {
- mt_srand ((float)microtime()*1000000); // initialise random number generator
+ // mt_srand ((float)microtime()*1000000); // initialise random number generator, assume php>=4.2.0
foreach ($submissions as $submission) {
$n = count_records("exercise_assessments", "submissionid", $submission->id);
// ...OK to have zero, we add a small random number to randomise things...
@@ -896,6 +947,7 @@ function exercise_list_teacher_submissions($exercise, $user, $reassess = false)
$assessment->userid = $user->id;
$assessment->grade = -1; // set impossible grade
$assessment->timecreated = $yearfromnow;
+ $assessment->mailed = 1; // no need to email to the teacher!
if (!$assessment->id = insert_record("exercise_assessments", $assessment)) {
error("Could not insert exercise assessment!");
}
@@ -927,6 +979,7 @@ function exercise_list_teacher_submissions($exercise, $user, $reassess = false)
// now list user's assessments (but only list those which come from teacher submissions)
print_heading(get_string("yourassessment", "exercise"));
+ $assessed = false;
if ($assessments = exercise_get_user_assessments($exercise, $user)) {
$timenow = time();
foreach ($assessments as $assessment) {
@@ -965,17 +1018,23 @@ function exercise_list_teacher_submissions($exercise, $user, $reassess = false)
// if user has submitted work, see if teacher has graded assessment
if (exercise_count_user_submissions($exercise, $user) > 0) {
if ($assessment->timegraded and (($timenow - $assessment->timegraded) > $CFG->maxeditingtime)) {
- $comment .= get_string("thereisfeedbackfromthe", "exercise", $course->teacher);
+ $comment .= get_string("gradeforassessment", "exercise").": ".
+ number_format($assessment->gradinggrade * $exercise->gradinggrade / 100.0, 1).
+ " (".get_string("maximumgrade")." ".number_format($exercise->gradinggrade, 0).")";
+ $assessed = true;
}
else {
- $comment .= get_string("awaitingfeedbackfromthe", "exercise", $course->teacher);
+ $comment .= get_string("awaitingassessmentbythe", "exercise", $course->teacher);
}
}
}
$table->data[] = array($action, $assessmentdate, $comment);
}
}
print_table($table);
+ if ($assessed) {
+ echo "<p align=\"center\">".get_string("noteongradinggrade", "exercise", $course->teacher)."</p>\n";
+ }
}
}
@@ -1003,7 +1062,9 @@ function exercise_list_unassessed_student_submissions($exercise, $user) {
$table->cellspacing = 0;
// get all the submissions, oldest first, youngest last
- if ($submissions = exercise_get_student_submissions($exercise)) {
+ // exercise_get_student_submissions is group aware
+ $groupid = get_current_group($course->id);
+ if ($submissions = exercise_get_student_submissions($exercise, "time", $groupid)) {
foreach ($submissions as $submission) {
// only consider "cold" submissions
if ($submission->timecreated < $timenow - $CFG->maxeditingtime) {
@@ -1256,7 +1317,7 @@ function exercise_list_user_submissions($exercise, $user) {
$action = "<a href=\"submissions.php?action=userconfirmdelete&id=$cm->id&sid=$submission->id\">".
get_string("delete", "exercise")."</a>";
}
- // if this is a teacher's submission (an exercise descrription) ignore any assessments
+ // if this is a teacher's submission (an exercise description) ignore any assessments
if (!$submission->isexercise) {
// get the teacher assessments (could be more than one, if unlikely, when multiple teachers)
if ($assessments = get_records_select("exercise_assessments", "exerciseid = $exercise->id AND
@@ -1268,17 +1329,13 @@ function exercise_list_user_submissions($exercise, $user) {
$action .= " | ";
}
$action .= "<a href=\"assessments.php?action=viewassessment&id=$cm->id&aid=$assessment->id\">".
- get_string("viewassessment", "exercise")."</a>";
+ get_string("viewteacherassessment", "exercise", $course->teacher)."</a>";
if ($comment) {
- $action .= " | ";
- }
- $grade = number_format($assessment->grade * $exercise->grade / 100.0, 1);
- if ($submission->late) {
- $comment .= get_string("grade").
- ": <font color=\"red\">($grade)</font>";
- } else {
- $comment .= get_string("grade").": $grade";
+ $comment .= " | ";
}
+ $comment .= get_string("teacherassessment", "exercise", $course->teacher).": ".
+ number_format($assessment->grade * $exercise->grade / 100.0, 1).
+ " (".get_string("maximumgrade")." ".number_format($exercise->grade, 0).")";
}
}
}
@@ -1806,39 +1863,13 @@ function exercise_print_assessment_form($exercise, $assessment = false, $allowch
echo "</tr>\n";
$timenow = time();
- // the teacher's comment on the assessment
- // always allow the teacher to change their comment and grade if it's not their assessment!
- if (isteacher($course->id) and ($assessment->userid != $USER->id)) {
+
+ // always show the teacher the grading grade if it's not their assessment!
+ if (isteacher($course->id) and ($assessment->userid != $USER->id) and $exercise->gradinggrade) {
echo "<tr><td align=\"right\"><b>".get_string("gradeforstudentsassessment", "exercise", $course->student).
"</td><td>\n";
- // set up coment scale
- for ($i=COMMENTSCALE; $i>=0; $i--) {
- $num[$i] = $i;
- }
- choose_from_menu($num, "gradinggrade", $assessment->gradinggrade, "");
+ echo number_format($exercise->gradinggrade * $assessment->gradinggrade / 100.0, 0);
echo "</td></tr>\n";
- echo "<tr valign=\"top\">\n";
- echo " <td align=\"right\"><p><b>". get_string("teacherscomment", "exercise").":</b></p></td>\n";
- echo " <td>\n";
- echo "<textarea name=\"teachercomment\" rows=\"5\" cols=\"75\" wrap=\"virtual\">\n";
- if (isset($assessment->teachercomment)) {
- echo $assessment->teachercomment;
- }
- echo "</textarea>\n";
- echo " </td>\n";
- echo "</tr>\n";
- }
- elseif ($assessment->timegraded and ($assessment->timegraded < ($timenow - $CFG->maxeditingtime))) {
- // now show the teacher's comment (but not the grade) to the student if available...
- echo "<tr valign=top>\n";
- echo " <td align=\"right\"><p><b>". get_string("teacherscomment", "exercise").":</b></p></td>\n";
- echo " <td>\n";
- echo text_to_html($assessment->teachercomment);
- echo "&nbsp;</td>\n";
- echo "</tr>\n";
- echo "<tr valign=\"top\">\n";
- echo "<td colspan=\"2\" bgcolor=\"$THEME->cellheading2\">&nbsp;</td>\n";
- echo "</tr>\n";
}
// ...and close the table, show buttons if needed...
@@ -1895,7 +1926,7 @@ function exercise_print_assessments_for_admin($exercise, $submission) {
error("Course Module ID was incorrect");
}
- if ($assessments =exercise_get_assessments($submission)) {
+ if ($assessments = exercise_get_assessments($submission)) {
foreach ($assessments as $assessment) {
if (!$user = get_record("user", "id", $assessment->userid)) {
error (" exercise_print_assessments_for_admin: unable to get user record");
@@ -1928,7 +1959,8 @@ function exercise_print_assignment_info($exercise) {
print_heading($exercise->name, "center");
print_simple_box_start("center");
echo "<b>".get_string("duedate", "exercise")."</b>: $strduedate<br />";
- echo "<b>".get_string("maximumgrade")."</b>: $exercise->grade<br />";
+ $maxgrade = $exercise->grade + $exercise->gradinggrade;
+ echo "<b>".get_string("maximumgrade")."</b>: $maxgrade<br />";
echo "<b>".get_string("handlingofmultiplesubmissions", "exercise")."</b>:";
if ($exercise->usemaximum) {
echo get_string("usemaximum", "exercise")."<br />\n";
@@ -1958,9 +1990,99 @@ function exercise_print_difference($time) {
///////////////////////////////////////////////////////////////////////////////////////////////
-function exercise_print_dual_assessment_form($exercise, $assessment, $submission, $returnto = '') {
- // prints the user's assessment and a blank form for the user's submission (for teachers only)
- global $CFG, $THEME, $USER, $EXERCISE_SCALES, $EXERCISE_EWEIGHTS;
+function exercise_print_feedback($course, $submission) {
+ global $CFG, $THEME, $RATING;
+
+ if (! $teacher = get_record("user", "id", $submission->teacher)) {
+ error("Weird exercise error");
+ }
+
+ echo "\n<TABLE BORDER=0 CELLPADDING=1 CELLSPACING=1 ALIGN=CENTER><TR><TD BGCOLOR=#888888>";
+ echo "\n<TABLE BORDER=0 CELLPADDING=3 CELLSPACING=0 VALIGN=TOP>";
+
+ echo "\n<TR>";
+ echo "\n<TD ROWSPAN=3 BGCOLOR=\"$THEME->body\" WIDTH=35 VALIGN=TOP>";
+ print_user_picture($teacher->id, $course->id, $teacher->picture);
+ echo "</TD>";
+ echo "<TD NOWRAP WIDTH=100% BGCOLOR=\"$THEME->cellheading\">$teacher->firstname $teacher->lastname";
+ echo "&nbsp;&nbsp;<FONT SIZE=2><I>".userdate($submission->timemarked)."</I>";
+ echo "</TR>";
+
+ echo "\n<TR><TD WIDTH=100% BGCOLOR=\"$THEME->cellcontent\">";
+
+ echo "<P ALIGN=RIGHT><FONT SIZE=-1><I>";
+ if ($submission->grade) {
+ echo get_string("grade").": $submission->grade";
+ } else {
+ echo get_string("nograde");
+ }
+ echo "</I></FONT></P>";
+
+ echo text_to_html($submission->assessorcomment);
+ echo "</TD></TR></TABLE>";
+ echo "</TD></TR></TABLE>";
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+function exercise_print_league_table($exercise) {
+ // print an order table of (student) submissions in grade order, only print the student's best submission when
+ // there are multiple submissions
+ if (! $course = get_record("course", "id", $exercise->course)) {
+ error("Print league table: Course is misconfigured");
+ }
+ $groupid = get_current_group($course->id);
+ $nentries = $exercise->showleaguetable;
+ if ($nentries == 99) {
+ $nentries = 999999; // a large number
+ }
+
+ if ($exercise->anonymous and isstudent($course->id)) {
+ $table->head = array (get_string("title", "exercise"), get_string("grade"));
+ $table->align = array ("left", "center");
+ $table->size = array ("*", "*");
+ } else { // show names
+ $table->head = array (get_string("title", "exercise"), get_string("name"), get_string("grade"));
+ $table->align = array ("left", "left", "center");
+ $table->size = array ("*", "*", "*");
+ }
+ $table->cellpadding = 2;
+ $table->cellspacing = 0;
+
+ if ($submissions = exercise_get_student_submissions($exercise, "grade", $groupid)) {
+ $n = 1;
+ foreach ($submissions as $submission) {
+ if (empty($done[$submission->userid])) {
+ if ($submission->late) {
+ continue;
+ }
+ if (!$user = get_record("user", "id", $submission->userid)) {
+ error("Print league table: user not found");
+ }
+ if ($exercise->anonymous and isstudent($course->id)) {
+ $table->data[] = array(exercise_print_submission_title($exercise, $submission),
+ number_format($submission->grade * $exercise->grade / 100.0, 1));
+ } else {
+ $table->data[] = array(exercise_print_submission_title($exercise, $submission),
+ $user->firstname." ".$user->lastname,
+ number_format($submission->grade * $exercise->grade / 100.0, 1));
+ }
+ $n++;
+ if ($n > $nentries) {
+ break;
+ }
+ $done[$submission->userid] = 'ok';
+ }
+ }
+ print_heading(get_string("leaguetable", "exercise"));
+ print_table($table);
+ }
+ }
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+function exercise_print_submission_assessments($exercise, $submission) {
+ // Returns a list of grades for this submission
if (! $course = get_record("course", "id", $exercise->course)) {
error("Course is misconfigured");
@@ -1969,78 +2091,196 @@ function exercise_print_dual_assessment_form($exercise, $assessment, $submission
error("Course Module ID was incorrect");
}
- $timenow = time();
-
- if(!$submissionowner = get_record("user", "id", $submission->userid)) {
- error("Print dual assessment form: User record not found");
+ $str = '';
+ if ($assessments = exercise_get_assessments($submission)) {
+ foreach ($assessments as $assessment) {
+ if (isteacher($exercise->course, $assessment->userid)) {
+ $str .= "[".number_format($assessment->grade * $exercise->grade / 100.0, 0)."] ";
+ }
+ else { // assessment by student - shouldn't happen!
+ $str .= "{".number_format($assessment->grade * $exercise->grade / 100.0, 0)."} ";
+ }
+ }
}
-
- echo "<CENTER><TABLE BORDER=\"1\" WIDTH=\"30%\"><TR>
- <TD ALIGN=CENTER BGCOLOR=\"$THEME->cellcontent\">\n";
- if (!$teachersubmission = get_record("exercise_submissions", "id", $assessment->submissionid)) {
- error ("exercise_print_assessment_form: Submission record not found");
+ if (!$str) {
+ $str = "&nbsp;"; // be kind to Mozilla browsers!
}
- echo exercise_print_submission_title($exercise, $teachersubmission);
- echo "</TD></TR></TABLE><BR CLEAR=ALL>\n";
-
- print_heading_with_help(get_string("pleasegradetheassessment", "exercise",
- "$submissionowner->firstname $submissionowner->lastname"), "gradinggrade", "exercise");
-
- echo "<CENTER><TABLE BORDER=\"1\" WIDTH=\"30%\"><TR>
- <TD ALIGN=CENTER BGCOLOR=\"$THEME->cellcontent\">\n";
- echo exercise_print_submission_title($exercise, $submission);
- echo "</TD></TR></TABLE></center><BR CLEAR=ALL>\n";
+ return $str;
+}
- // only show the grade if grading strategy > 0 and the grade is positive
- if ($exercise->gradingstrategy and $assessment->grade >= 0) {
- echo "<CENTER><B>".get_string("thegradeis", "exercise").": ".
- number_format($assessment->grade * $exercise->grade / 100.0, 2)." (".
- get_string("maximumgrade")." ".number_format($exercise->grade, 0).")</B></CENTER><BR CLEAR=ALL>\n";
- }
-
- // now print the student's assessment form with the teacher's comments if any
- // in this (first) form only allow teachers to change their comment and the grading grade
- // the other "active" elements in thie form are suffixed with "_0" to stop conflicts with the teacher's
- // assessment form
- $allowchanges = false;
-
- // FORM is needed for Mozilla browsers, else radio bttons are not checked
- ?>
- <form name="assessmentform" method="post" action="assessments.php">
- <INPUT TYPE="hidden" NAME="id" VALUE="<?PHP echo $cm->id ?>">
- <input type="hidden" name="aid" value="<?PHP echo $assessment->id ?>">
- <input type="hidden" name="sid" value="<?PHP echo $submission->id ?>">
- <input type="hidden" name="action" value="updatedualassessment">
- <input type="hidden" name="resubmit" value="0">
- <input type="hidden" name="returnto" value="<?PHP echo $returnto ?>">
- <?PHP
- if (!$assessmentowner = get_record("user", "id", $assessment->userid)) {
- error("Exercise_print_dual_assessment_form: could not find user record");
- }
- echo "<center><table cellpadding=\"2\" border=\"1\">\n";
- echo "<tr valign=top>\n";
- echo " <td colspan=\"2\" bgcolor=\"$THEME->cellheading2\"><center><B>".get_string("assessmentby",
- "exercise", "$assessmentowner->firstname $assessmentowner->lastname")."</b></center></td>\n";
- echo "</tr>\n";
- // get the assignment elements...
- if (!$elementsraw = get_records("exercise_elements", "exerciseid", $exercise->id, "elementno ASC")) {
- print_string("noteonassignmentelements", "exercise");
- }
- else {
- foreach ($elementsraw as $element) {
- $elements[] = $element; // to renumber index 0,1,2...
+//////////////////////////////////////////////////////////////////////////////////////
+function exercise_print_tabbed_heading($tabs) {
+// Prints a tabbed heading where one of the tabs highlighted.
+// $tabs is an object with several properties.
+// $tabs->names is an array of tab names
+// $tabs->urls is an array of links
+// $tabs->align is an array of column alignments (defaults to "center")
+// $tabs->size is an array of column sizes
+// $tabs->wrap is an array of "nowrap"s or nothing
+// $tabs->highlight is an index (zero based) of "active" heading .
+// $tabs->width is an percentage of the page (defualts to 80%)
+// $tabs->cellpadding padding on each cell (defaults to 5)
+
+ global $CFG, $THEME;
+
+ if (isset($tabs->names)) {
+ foreach ($tabs->names as $key => $name) {
+ if (!empty($tabs->urls[$key])) {
+ $url =$tabs->urls[$key];
+ if ($tabs->highlight == $key) {
+ $tabcontents[$key] = "<b>$name</b>";
+ } else {
+ $tabcontents[$key] = "<a class= \"dimmed\" href=\"$url\"><b>$name</b></a>";
+ }
+ } else {
+ $tabcontents[$key] = "<b>$name</b>";
}
}
+ }
- // get any previous grades...
- if ($gradesraw = get_records_select("exercise_grades", "assessmentid = $assessment->id", "elementno")) {
- foreach ($gradesraw as $grade) {
- $grades[] = $grade; // to renumber index 0,1,2...
+ if (empty($tabs->width)) {
+ $tabs->width = "80%";
+ }
+
+ if (empty($tabs->cellpadding)) {
+ $tabs->cellpadding = "5";
+ }
+
+ // print_simple_box_start("center", "$table->width", "#ffffff", 0);
+ echo "<table width=\"$tabs-width\" border=\"0\" valign=\"top\" align=\"center\" ";
+ echo " cellpadding=\"$tabs->cellpadding\" cellspacing=\"0\" class=\"generaltable\">\n";
+
+ if (!empty($tabs->names)) {
+ echo "<tr>";
+ echo "<td class=\"generaltablecell\">".
+ "<img width=\"10\" src=\"$CFG->wwwroot/pix/spacer.gif\" alt=\"\"></td>\n";
+ foreach ($tabcontents as $key => $tab) {
+ if (isset($align[$key])) {
+ $alignment = "align=\"$align[$key]\"";
+ } else {
+ $alignment = "align=\"center\"";
}
- }
-
- // determine what sort of grading
+ if (isset($size[$key])) {
+ $width = "width=\"$size[$key]\"";
+ } else {
+ $width = "";
+ }
+ if (isset($wrap[$key])) {
+ $wrapping = "no wrap";
+ } else {
+ $wrapping = "";
+ }
+ if ($key == $tabs->highlight) {
+ echo "<td valign=top class=\"generaltabselected\" $alignment $width $wrapping bgcolor=\"$THEME->cellheading2\">$tab</td>\n";
+ } else {
+ echo "<td valign=top class=\"generaltab\" $alignment $width $wrapping bgcolor=\"$THEME->cellheading\">$tab</td>\n";
+ }
+ echo "<td class=\"generaltablecell\">".
+ "<img width=\"10\" src=\"$CFG->wwwroot/pix/spacer.gif\" alt=\"\"></td>\n";
+ }
+ echo "</tr>\n";
+ } else {
+ echo "<tr><td>No names specified</td></tr>\n";
+ }
+ // bottom stripe
+ $ncells = count($tabs->names)*2 +1;
+ $height = 2;
+ echo "<tr><td colspan=\"$ncells\" bgcolor=\"$THEME->cellheading2\">".
+ "<img height=\"$height\" src=\"$CFG->wwwroot/pix/spacer.gif\" alt=\"\"></td></tr>\n";
+ echo "</table>\n";
+ // print_simple_box_end();
+
+ return true;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+function exercise_print_teacher_assessment_form($exercise, $assessment, $submission, $returnto = '') {
+ // prints an assessment form based on the student's assessment
+ // if the teacher is re-assessing a submission they would use exercise_print_assessment_form()
+ // (for teachers only)
+ global $CFG, $THEME, $USER, $EXERCISE_SCALES, $EXERCISE_EWEIGHTS;
+
+ if (! $course = get_record("course", "id", $exercise->course)) {
+ error("Course is misconfigured");
+ }
+ if (! $cm = get_coursemodule_from_instance("exercise", $exercise->id, $course->id)) {
+ error("Course Module ID was incorrect");
+ }
+
+ $timenow = time();
+
+ if(!$submissionowner = get_record("user", "id", $submission->userid)) {
+ error("Print teacher assessment form: User record not found");
+ }
+
+ echo "<CENTER><TABLE BORDER=\"1\" WIDTH=\"30%\"><TR>
+ <TD ALIGN=CENTER BGCOLOR=\"$THEME->cellcontent\">\n";
+ if (!$teachersubmission = get_record("exercise_submissions", "id", $assessment->submissionid)) {
+ error ("Print teacher assessment form: Submission record not found");
+ }
+ echo exercise_print_submission_title($exercise, $teachersubmission);
+ echo "</TD></TR></TABLE><BR CLEAR=ALL>\n";
+
+ echo "<CENTER><TABLE BORDER=\"1\" WIDTH=\"30%\"><TR>
+ <TD ALIGN=CENTER BGCOLOR=\"$THEME->cellcontent\">\n";
+ echo exercise_print_submission_title($exercise, $submission);
+ echo "</TD></TR></TABLE></center><BR CLEAR=ALL>\n";
+
+ ?>
+ <form name="assessmentform" method="post" action="assessments.php">
+ <INPUT TYPE="hidden" NAME="id" VALUE="<?PHP echo $cm->id ?>">
+ <input type="hidden" name="said" value="<?PHP echo $assessment->id ?>">
+ <input type="hidden" name="sid" value="<?PHP echo $submission->id ?>">
+ <input type="hidden" name="action" value="updateteacherassessment">
+ <input type="hidden" name="resubmit" value="0">
+ <input type="hidden" name="returnto" value="<?PHP echo $returnto ?>">
+ <?PHP
+
+ // now print a normal assessment form based on the student's assessment for this submission
+ // and allow the teacher to grade and add comments
+ $studentassessment = $assessment;
+ $allowchanges = true;
+
+ print_heading_with_help(get_string("pleasemakeyourownassessment", "exercise",
+ "$submissionowner->firstname $submissionowner->lastname"), "grading", "exercise");
+
+ // is there an existing assessment for the submission
+ if (!$assessment = exercise_get_submission_assessment($submission, $USER)) {
+ // copy student's assessment without the comments for the student's submission
+ $assessment = exercise_copy_assessment($studentassessment, $submission);
+ }
+
+ // only show the grade if grading strategy > 0 and the grade is positive
+ if ($exercise->gradingstrategy and $assessment->grade >= 0) {
+ echo "<CENTER><B>".get_string("thegradeis", "exercise").": ".
+ number_format($assessment->grade * $exercise->grade / 100.0, 2)." (".
+ get_string("maximumgrade")." ".number_format($exercise->grade, 0).")</B></CENTER><BR CLEAR=ALL>\n";
+ }
+
+ echo "<center><table cellpadding=\"2\" border=\"1\">\n";
+ echo "<tr valign=top>\n";
+ echo " <td colspan=\"2\" bgcolor=\"$THEME->cellheading2\"><center><b>".get_string("yourassessment", "exercise").
+ "</b></center></td>\n";
+ echo "</tr>\n";
+
+ // get the assignment elements...
+ if (!$elementsraw = get_records("exercise_elements", "exerciseid", $exercise->id, "elementno ASC")) {
+ error("Teacher assessment form: Elements not found");
+ }
+ foreach ($elementsraw as $element) {
+ $elements[] = $element; // to renumber index 0,1,2...
+ }
+
+ // ...and get any previous grades...
+ if ($gradesraw = get_records_select("exercise_grades", "assessmentid = $assessment->id", "elementno")) {
+ foreach ($gradesraw as $grade) {
+ $grades[] = $grade; // to renumber index 0,1,2...
+ }
+ }
+
+ // determine what sort of grading
switch ($exercise->gradingstrategy) {
case 0: // no grading
// now print the form
@@ -2057,18 +2297,18 @@ function exercise_print_dual_assessment_form($exercise, $assessment, $submission
echo " <textarea name=\"feedback[]\" rows=3 cols=75 wrap=\"virtual\">\n";
if (isset($grades[$i]->feedback)) {
echo $grades[$i]->feedback;
- }
- echo "</textarea>\n";
}
+ echo "</textarea>\n";
+ }
else {
echo text_to_html($grades[$i]->feedback);
- }
+ }
echo " </TD>\n";
echo "</TR>\n";
echo "<TR valign=top>\n";
echo " <TD COLSPAN=2 BGCOLOR=\"$THEME->cellheading2\">&nbsp;</TD>\n";
echo "</TR>\n";
- }
+ }
break;
case 1: // accumulative grading
@@ -2097,57 +2337,57 @@ function exercise_print_dual_assessment_form($exercise, $assessment, $submission
if (isset($grades[$i]->grade)) {
if ($j == $grades[$i]->grade) {
$checked = true;
- }
}
+ }
else { // there's no previous grade so check the lowest option
if ($j == 0) {
$checked = true;
- }
}
+ }
if ($checked) {
- echo " <INPUT TYPE=\"RADIO\" NAME=\"grade_0[$i]\" VALUE=\"$j\" CHECKED> &nbsp;&nbsp;&nbsp;\n";
- }
+ echo " <INPUT TYPE=\"RADIO\" NAME=\"grade[$i]\" VALUE=\"$j\" CHECKED> &nbsp;&nbsp;&nbsp;\n";
+ }
else {
- echo " <INPUT TYPE=\"RADIO\" NAME=\"grade_0[$i]\" VALUE=\"$j\"> &nbsp;&nbsp;&nbsp;\n";
- }
+ echo " <INPUT TYPE=\"RADIO\" NAME=\"grade[$i]\" VALUE=\"$j\"> &nbsp;&nbsp;&nbsp;\n";
}
+ }
echo "&nbsp;&nbsp;&nbsp;<B>$SCALE->end</B></CENTER>\n";
break;
case 'selection' :
unset($numbers);
for ($j = $SCALE->size; $j >= 0; $j--) {
$numbers[$j] = $j;
- }
+ }
if (isset($grades[$i]->grade)) {
- choose_from_menu($numbers, "grade2_0[$i]", $grades[$i]->grade, "");
- }
+ choose_from_menu($numbers, "grade[$i]", $grades[$i]->grade, "");
+ }
else {
- choose_from_menu($numbers, "grade2_0[$i]", 0, "");
- }
+ choose_from_menu($numbers, "grade[$i]", 0, "");
+ }
break;
-
+
echo " </TD>\n";
echo "</TR>\n";
- }
+ }
echo "<TR valign=top>\n";
echo " <TD align=right><P><B>". get_string("feedback").":</B></P></TD>\n";
echo " <TD>\n";
if ($allowchanges) {
echo " <textarea name=\"feedback[]\" rows=3 cols=75 wrap=\"virtual\">\n";
if (isset($grades[$i]->feedback)) {
echo $grades[$i]->feedback;
- }
- echo "</textarea>\n";