From a557e354edd66fd0d504975edf457e3b32055a3d Mon Sep 17 00:00:00 2001 From: rkingdon Date: Mon, 27 Sep 2004 14:41:17 +0000 Subject: [PATCH] Version 2004092400 - in line student submission (plus attachments); addition of on-the-fly grading of assessments; some bugs cleared. --- mod/workshop/assessments.php | 108 ++++++++++++++--- mod/workshop/backuplib.php | 2 + mod/workshop/db/mysql.php | 8 ++ mod/workshop/db/mysql.sql | 11 +- mod/workshop/index.php | 5 +- mod/workshop/lib.php | 45 +++++--- mod/workshop/locallib.php | 217 +++++++++++++++++++++++++---------- mod/workshop/mod.html | 17 +++ mod/workshop/restorelib.php | 2 + mod/workshop/submissions.php | 127 +++++++++++++++++++- mod/workshop/upload.php | 117 ++++++++++--------- mod/workshop/version.php | 2 +- mod/workshop/view.php | 15 ++- 13 files changed, 505 insertions(+), 171 deletions(-) diff --git a/mod/workshop/assessments.php b/mod/workshop/assessments.php index 9893f461b7..908929b5ba 100644 --- a/mod/workshop/assessments.php +++ b/mod/workshop/assessments.php @@ -19,6 +19,7 @@ listungradedstudentsubmissions (for teachers) listungradedteachersubmissions (for teachers) listteachersubmissions + regradestudentassessments (for teachers) updateassessment updatecomment updategrading @@ -204,30 +205,41 @@ if (! $submission = get_record("workshop_submissions", "id", $sid)) { error("Assess submission is misconfigured - no submission record!"); } - + // there can be an assessment record (for teacher submissions), if there isn't... if (!$assessment = get_record("workshop_assessments", "submissionid", $submission->id, "userid", $USER->id)) { - $yearfromnow = time() + 365 * 86400; - // ...create one and set timecreated way in the future, this is reset when record is updated - $assessment->workshopid = $workshop->id; - $assessment->submissionid = $submission->id; - $assessment->userid = $USER->id; - $assessment->grade = -1; // set impossible grade - $assessment->timecreated = $yearfromnow; - $assessment->timegraded = 0; - $assessment->timeagreed = 0; - $assessment->resubmission = 0; - if (!$assessment->id = insert_record("workshop_assessments", $assessment)) { - error("Could not insert workshop assessment!"); - } - } + // if it's the teacher see if the user has done a self assessment if so copy it + if (isteacher($course->id) and ($assessment = get_record("workshop_assessments", "submissionid", + $submission->id, "userid", $submission->userid))) { + $assessment = workshop_copy_assessment($assessment, $submission, true); + // need to set owner of assessment + set_field("workshop_assessments", "userid", $USER->id, "id", $assessment->id); + $assessment->resubmission = 0; // not set by workshop_copy_assessment + $assessment->timegraded = 0; // not set by workshop_copy_assessment + $assessment->timeagreed = 0; // not set by workshop_copy_assessment + } else { + $yearfromnow = time() + 365 * 86400; + // ...create one and set timecreated way in the future, this is reset when record is updated + $assessment->workshopid = $workshop->id; + $assessment->submissionid = $submission->id; + $assessment->userid = $USER->id; + $assessment->timecreated = $yearfromnow; + $assessment->grade = -1; // set impossible grade + $assessment->timegraded = 0; + $assessment->timeagreed = 0; + $assessment->resubmission = 0; + if (!$assessment->id = insert_record("workshop_assessments", $assessment)) { + error("Could not insert workshop assessment!"); + } + } + } print_heading_with_help(get_string("assessthissubmission", "workshop"), "grading", "workshop"); // show assessment and allow changes workshop_print_assessment($workshop, $assessment, true, $allowcomments, $_SERVER["HTTP_REFERER"]); - } + } /*************** display grading form (viewed by student) *********************************/ @@ -709,6 +721,36 @@ } + /******************* regrade student assessments ************************************/ + elseif ($action == 'regradestudentassessments' ) { + + $timenow = time(); + if (!isteacher($course->id)) { + error("Only teachers can look at this page"); + } + // get all the teacher assessments + if ($assessments = workshop_get_teacher_assessments($workshop)) { + foreach ($assessments as $teacherassessment) { + if (!$submission = get_record("workshop_submissions", "id", $teacherassessment->submissionid)) { + error("Regrade student assessments: submission not found"); + } + // run through the student assessments of this submission + if ($studentassessments = get_records("workshop_assessments", "submissionid", $submission->id)) { + foreach ($studentassessments as $studentassessment) { + if (!isstudent($course->id, $studentassessment->userid)) { + continue; // not a student assessment - skip + } + $newgrade = workshop_compare_assessments($workshop, $studentassessment, $teacherassessment); + set_field("workshop_assessments", "gradinggrade", $newgrade, "id", $studentassessment->id); + set_field("workshop_assessments", "timegraded", $timenow, "id", $studentassessment->id); + } + } + } + } + redirect("submissions.php?id=$cm->id&action=adminlist"); + } + + /*************** update assessment (by teacher or student) ***************************/ elseif ($action == 'updateassessment') { @@ -734,7 +776,7 @@ // don't fiddle about, delete all the old and add the new! delete_records("workshop_grades", "assessmentid", $assessment->id); - $form = (object)$HTTP_POST_VARS; + $form = data_submitted("nomatch"); // probably always come from the same page, change this statement //determine what kind of grading we have switch ($workshop->gradingstrategy) { @@ -881,12 +923,40 @@ set_field("workshop_assessments", "timeagreed", $timenow, "id", $assessment->id); } + // set grade... set_field("workshop_assessments", "grade", $grade, "id", $assessment->id); - // ...and clear any grading of this assessment... + // ...and clear the timegraded but set the graddinggrade to maximum, may to reduced subsequently... set_field("workshop_assessments", "timegraded", 0, "id", $assessment->id); - set_field("workshop_assessments", "gradinggrade", 0, "id", $assessment->id); + set_field("workshop_assessments", "gradinggrade", 100, "id", $assessment->id); // ...and the resubmission flag set_field("workshop_assessments", "resubmission", 0, "id", $assessment->id); + + // now see if there's a corresponding assessment so that the gradinggrade can be set + if (isteacher($course->id)) { + // see if there's are student assessments, if so set their gradinggrade + if ($assessments = workshop_get_assessments($submission)) { + foreach($assessments as $studentassessment) { + // skip if it's not a student assessment + if (!isstudent($course->id, $studentassessment->userid)) { + continue; + } + $gradinggrade = workshop_compare_assessments($workshop, $assessment, $studentassessment); + set_field("workshop_assessments", "timegraded", $timenow, "id", $studentassessment->id); + set_field("workshop_assessments", "gradinggrade", $gradinggrade, "id", $studentassessment->id); + } + } + } else { //it's a student assessment, see if there's a corresponding teacher's assessment + if ($assessments = workshop_get_assessments($submission)) { + foreach($assessments as $teacherassessment) { + if (isteacher($course->id, $teacherassessment->userid)) { + $gradinggrade = workshop_compare_assessments($workshop, $assessment, $teacherassessment); + set_field("workshop_assessments", "timegraded", $timenow, "id", $assessment->id); + set_field("workshop_assessments", "gradinggrade", $gradinggrade, "id", $assessment->id); + break; // only look for the first teacher assessment + } + } + } + } // any comment? if (!empty($form->generalcomment)) { diff --git a/mod/workshop/backuplib.php b/mod/workshop/backuplib.php index 19794b0d79..b9c3178339 100644 --- a/mod/workshop/backuplib.php +++ b/mod/workshop/backuplib.php @@ -54,6 +54,7 @@ fwrite ($bf,full_tag("NAME",4,false,$workshop->name)); fwrite ($bf,full_tag("DESCRIPTION",4,false,$workshop->description)); fwrite ($bf,full_tag("NELEMENTS",4,false,$workshop->nelements)); + fwrite ($bf,full_tag("NATTACHMENTS",4,false,$workshop->nattachments)); fwrite ($bf,full_tag("PHASE",4,false,$workshop->phase)); fwrite ($bf,full_tag("FORMAT",4,false,$workshop->format)); fwrite ($bf,full_tag("GRADINGSTRATEGY",4,false,$workshop->gradingstrategy)); @@ -178,6 +179,7 @@ fwrite ($bf,full_tag("TITLE",6,false,$wor_sub->title)); fwrite ($bf,full_tag("TIMECREATED",6,false,$wor_sub->timecreated)); fwrite ($bf,full_tag("MAILED",6,false,$wor_sub->mailed)); + fwrite ($bf,full_tag("DESCRIPTION",6,false,$wor_sub->description)); fwrite ($bf,full_tag("TEACHERGRADE",6,false,$wor_sub->teachergrade)); fwrite ($bf,full_tag("PEERGRADE",6,false,$wor_sub->peergrade)); fwrite ($bf,full_tag("BIASGRADE",6,false,$wor_sub->biasgrade)); diff --git a/mod/workshop/db/mysql.php b/mod/workshop/db/mysql.php index 8300fc42fd..8cf9eeeb4c 100644 --- a/mod/workshop/db/mysql.php +++ b/mod/workshop/db/mysql.php @@ -94,6 +94,14 @@ function workshop_upgrade($oldversion) { execute_sql("ALTER TABLE `{$CFG->prefix}workshop` DROP COLUMN `assessmentstodrop`"); } + if ($oldversion < 2004092400) { + table_column("workshop", "", "nattachments", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "nelements"); + table_column("workshop_submissions", "", "description", "TEXT", "", "", "", "", "mailed"); + execute_sql("ALTER TABLE `{$CFG->prefix}workshop_submissions` ADD INDEX (`userid`)"); + execute_sql("ALTER TABLE `{$CFG->prefix}workshop_assessments` ADD INDEX (`submissionid`)"); + execute_sql("ALTER TABLE `{$CFG->prefix}workshop_assessments` ADD INDEX (`userid`)"); + } + return true; } diff --git a/mod/workshop/db/mysql.sql b/mod/workshop/db/mysql.sql index bc1633a646..bb2fe4d385 100644 --- a/mod/workshop/db/mysql.sql +++ b/mod/workshop/db/mysql.sql @@ -8,6 +8,7 @@ CREATE TABLE `prefix_workshop` ( `name` varchar(255) NOT NULL default '', `description` text NOT NULL, `nelements` tinyint(3) unsigned NOT NULL default '1', + `nattachments` tinyint(3) unsigned NOT NULL default '0', `phase` tinyint(2) unsigned NOT NULL default '0', `format` tinyint(2) unsigned NOT NULL default '0', `gradingstrategy` tinyint(2) unsigned NOT NULL default '1', @@ -42,6 +43,7 @@ CREATE TABLE `prefix_workshop_submissions` ( `title` varchar(100) NOT NULL default '', `timecreated` int(10) unsigned NOT NULL default '0', `mailed` tinyint(2) unsigned NOT NULL default '0', + `description` text NOT NULL, `teachergrade` int(3) unsigned NOT NULL default '0', `peergrade` int(3) unsigned NOT NULL default '0', `biasgrade` int(3) unsigned NOT NULL default '0', @@ -49,7 +51,7 @@ CREATE TABLE `prefix_workshop_submissions` ( `gradinggrade` int(3) unsigned NOT NULL default '0', `finalgrade` int(3) unsigned NOT NULL default '0', PRIMARY KEY (`id`), - INDEX `title` (`title`) + INDEX `userid` (`userid`) ) COMMENT='Info about submitted work from teacher and students'; # -------------------------------------------------------- @@ -72,7 +74,9 @@ CREATE TABLE `prefix_workshop_assessments` ( `donotuse` tinyint(3) unsigned NOT NULL default '0', `generalcomment` text NOT NULL, `teachercomment` text NOT NULL, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + INDEX (`submissionid`), + INDEX (`userid`) ) COMMENT='Info about assessments by teacher and students'; # -------------------------------------------------------- @@ -118,7 +122,8 @@ CREATE TABLE `prefix_workshop_grades` ( `elementno` int(10) unsigned NOT NULL default '0', `feedback` text NOT NULL default '', `grade` tinyint(3) NOT NULL default '0', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + INDEX (`assessmentid`) ) COMMENT='Info about individual grades given to each element'; # -------------------------------------------------------- diff --git a/mod/workshop/index.php b/mod/workshop/index.php index 0c7b565f3e..d6bc2b311b 100644 --- a/mod/workshop/index.php +++ b/mod/workshop/index.php @@ -95,7 +95,7 @@ } } } - else { + else { // no submission $submitted = get_string("no"); $due = userdate($workshop->deadline); if (!$workshop->visible) { @@ -105,6 +105,9 @@ //Show normal if the mod is visible $link = "coursemodule\">$workshop->name"; } + if (isstudent($course->id)) { + $info = '0'; + } if ($course->format == "weeks" or $course->format == "topics") { $table->data[] = array ($workshop->section, $link, $info, $submitted, $due); } diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php index 90d5b47654..e3acd03be0 100644 --- a/mod/workshop/lib.php +++ b/mod/workshop/lib.php @@ -118,8 +118,11 @@ function workshop_cron () { // if there any ungraded assessments run the grading routine if ($workshops = get_records("workshop")) { foreach ($workshops as $workshop) { - if (workshop_count_ungraded_assessments($workshop)) { - workshop_grade_assessments($workshop); + // automatically grade assessments if workshop has examples and/or peer assessments + if ($workshop->ntassessments or $workshop->nsassessments) { + if (workshop_count_ungraded_assessments($workshop)) { + workshop_grade_assessments($workshop); + } } } } @@ -617,8 +620,8 @@ global $CFG; if ($students = get_course_students($workshop->course)) { foreach ($students as $student) { $gradinggrade = workshop_gradinggrade($workshop, $student); + $bestgrade = 0; if ($submissions = workshop_get_user_submissions($workshop, $student)) { - $bestgrade = 0; foreach ($submissions as $submission) { $grade = workshop_submission_grade($workshop, $submission); if ($grade > $bestgrade) { @@ -1183,12 +1186,19 @@ function workshop_compare_assessments($workshop, $assessment1, $assessment2) { ////////////////////////////////////////////////////////////////////////////////////// function workshop_count_ungraded_assessments($workshop) { - // function returns the number of ungraded assessments (assessments must be warm or cold) + // function returns the number of ungraded assessments by students - $timenow = time(); - return count_records_select("workshop_assessments", "workshopid = $workshop->id AND - timecreated < $timenow AND timegraded = 0") ; + $n = 0; + if ($assessments = get_records_select("workshop_assessments", "workshopid = $workshop->id AND + timegraded = 0")) { + foreach ($assessments as $assessment) { + if (isstudent($workshop->course, $assessment->userid)) { + $n++; + } + } } + return $n; +} ////////////////////////////////////////////////////////////////////////////////////// @@ -1341,7 +1351,9 @@ function workshop_get_student_submissions($workshop, $order = "title") { if ($order == "name") { $order = "a.lastname, a.firstname"; } - + if ($order == "time") { + $order = "s.timecreated ASC"; + } // make sure it works on the site course $select = "u.course = '$workshop->course' AND"; $site = get_site(); @@ -1548,7 +1560,11 @@ function workshop_grade_assessments($workshop) { } } for ($i = 0; $i < $workshop->nelements; $i++) { - $sd[$i] = sqrt($var[$i] / ($n - 1)); + if ($n > 1) { + $sd[$i] = sqrt($var[$i] / ($n - 1)); + } else { + $sd[$i] = 0; + } echo "

".get_string("standarddeviationofelement", "workshop", $i+1)." $sd[$i]
"; if ($sd[$i] <= $minvar) { print_string("standarddeviationnote", "workshop")."
\n"; @@ -1564,8 +1580,8 @@ function workshop_grade_assessments($workshop) { } // ...if there are three or more assessments calculate the variance of each assessment. - // Use the variance to find the "best" assessment. (When there are two assessments they - // are both "best", we cannot distinguish between them.) + // Use the variance to find the "best" assessment. (When there is only one or two assessments they + // are not altered by this routine.) foreach ($submissions as $submission) { if ($nassessments[$submission->id] > 2) { if ($assessments = workshop_get_assessments($submission)) { @@ -1605,7 +1621,7 @@ function workshop_grade_assessments($workshop) { $ndrop = 0; foreach ($submissions as $submission) { if ($assessments = workshop_get_assessments($submission)) { - if ($nassessments[$submission->id] > 2) { + if ($nassessments[$submission->id] > 2) { // only alter if there are three or more assessments if (!$best = get_record("workshop_assessments", "id", $bestassessment[$submission->id])) { error("Workshop assessment analysis: cannot find best assessment"); } @@ -1625,11 +1641,6 @@ function workshop_grade_assessments($workshop) { } } } - } else { // only one or two assessments, set it/both as "best" - foreach ($assessments as $assessment) { - 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 7c18bf94c8..c1b6586f0e 100644 --- a/mod/workshop/locallib.php +++ b/mod/workshop/locallib.php @@ -40,6 +40,7 @@ workshop_get_student_submission($workshop, $user) { ---> in lib.php workshop_get_student_submission_assessments($workshop) { workshop_get_student_submissions($workshop) { ---> in lib.php workshop_get_submission_assessment($submission, $user) { +workshop_get_teacher_assessments($workshop) { workshop_get_teacher_submission_assessments($workshop) { workshop_get_teacher_submissions($workshop) { workshop_get_ungraded_assessments($workshop) { @@ -297,6 +298,10 @@ function workshop_count_student_submissions_for_assessment($workshop, $user) { continue; // skip this user } } + // check if submission is cold + if (($submission->timecreated + $CFG->maxeditingtime) > $timenow) { + continue; // skip this submission + } // teacher assessed this submission if (! count_records_select("workshop_assessments", "submissionid = $submission->id AND userid = $user->id AND timecreated < $timenow - $CFG->maxeditingtime")) { @@ -570,6 +575,20 @@ function workshop_get_submission_assessment($submission, $user) { } +////////////////////////////////////////////////////////////////////////////////////// +function workshop_get_teacher_assessments($workshop) { +// Return all teacher assessments, ordered by timecreated, oldest first + global $CFG; + + return get_records_sql("SELECT a.* FROM {$CFG->prefix}workshop_assessments a, + {$CFG->prefix}user_teachers u + WHERE u.course = $workshop->course + AND a.userid = u.userid + AND a.workshopid = $workshop->id + ORDER BY a.timecreated"); +} + + ////////////////////////////////////////////////////////////////////////////////////// function workshop_get_teacher_submission_assessments($workshop) { // Return all assessments on the teacher submissions, order by youngest first, oldest last @@ -603,7 +622,7 @@ function workshop_get_teacher_submissions($workshop) { function workshop_get_ungraded_assessments($workshop) { global $CFG; // Return all assessments which have not been graded or just graded - $cutofftime =time() - $CFG->maxeditingtime; + $cutofftime = time() - $CFG->maxeditingtime; return get_records_select("workshop_assessments", "workshopid = $workshop->id AND (timegraded = 0 OR timegraded > $cutofftime)", "timecreated"); } @@ -831,8 +850,9 @@ function workshop_list_all_ungraded_assessments($workshop) { ////////////////////////////////////////////////////////////////////////////////////// function workshop_list_assessed_submissions($workshop, $user) { // list the submissions that have been assessed by this user and are COLD - global $CFG; + global $CFG, $USER; + $timenow = time(); if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $workshop->course)) { error("Course Module ID was incorrect"); } @@ -847,7 +867,6 @@ function workshop_list_assessed_submissions($workshop, $user) { $table->cellspacing = 0; if ($assessments = workshop_get_student_assessments($workshop, $user)) { - $timenow = time(); foreach ($assessments as $assessment) { $comment = ""; $submission = get_record("workshop_submissions", "id", $assessment->submissionid); @@ -865,10 +884,12 @@ function workshop_list_assessed_submissions($workshop, $user) { $action .= " | id&sid=$submission->id\">". get_string("reassess", "workshop").""; } else { - $action = ""; + $action = "id&aid=$assessment->id&". + "allowcomments=false\">".get_string("view", "workshop").""; } } else { - if ($assessment->timegraded) { + // if it been graded allow student to re-assess, except if it's a self assessment + if ($assessment->timegraded and !($USER->id == $assessment->userid)) { $action = "id&sid=$submission->id\">". get_string("reassess", "workshop").""; } else { @@ -891,7 +912,7 @@ function workshop_list_assessed_submissions($workshop, $user) { number_format($assessment->gradinggrade * $workshop->gradinggrade / 100, 0)). " / $workshop->gradinggrade"; } - // if peer agrrements show whether agreement has been reached + // if peer agreements show whether agreement has been reached if ($workshop->agreeassessments) { if ($assessment->timeagreed) { $comment .= "; ".get_string("assessmentwasagreedon", "workshop", @@ -992,6 +1013,7 @@ function workshop_list_self_assessments($workshop, $user) { // list user's submissions for the user to assess global $CFG; + $timenow = time(); if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $workshop->course)) { error("Course Module ID was incorrect"); } @@ -1008,24 +1030,29 @@ function workshop_list_self_assessments($workshop, $user) { // get the user's submissions if ($submissions = workshop_get_user_submissions($workshop, $user)) { foreach ($submissions as $submission) { - $comment = ""; + $comment = get_string("ownwork", "workshop"); // just in case they don't know! if (!$assessment = get_record_select("workshop_assessments", "submissionid = $submission->id AND userid = $user->id")) { - if ($submission->userid == $user->id) { // this will always be true - $comment = get_string("ownwork", "workshop"); // just in case they don't know! - } $action = "id&sid=$submission->id\">". get_string("assess", "workshop").""; $table->data[] = array(workshop_print_submission_title($workshop, $submission), $action, $comment); + } else { + // may still be warm + if (($assessment->timecreated + $CFG->maxeditingtime) > $timenow) { + $action = "id&sid=$submission->id\">". + get_string("reassess", "workshop").""; + $table->data[] = array(workshop_print_submission_title($workshop, $submission), $action, $comment); } } + } + } if (isset($table->data)) { echo "

".get_string("pleaseassessyoursubmissions", "workshop", $course->student). "

\n"; print_table($table); - } } +} ////////////////////////////////////////////////////////////////////////////////////// @@ -1253,19 +1280,24 @@ function workshop_list_submissions_for_admin($workshop, $order) { error("Workshop_list_submissions_for_admin: Submission record not found!"); } $title .= $submission->title; - if ($assessment->timegraded) { + if ($workshop->agreeassessments and !$assessment->timeagreed and + isstudent($workshop->course, $submission->userid)) { // agreements for student work only + $title .= " <<".number_format($assessment->grade * $workshop->grade / 100, 0)." (". + number_format($assessment->gradinggrade * $workshop->gradinggrade / 100, 0).")>> "; + } elseif ($assessment->timegraded) { if ($assessment->gradinggrade) { // a good assessment $title .= " {".number_format($assessment->grade * $workshop->grade / 100, 0)." (". number_format($assessment->gradinggrade * $workshop->gradinggrade / 100, 0).")} "; } else { // a poor assessment - $title .= " <".number_format($assessment->grade * $workshop->grade / 100, 0)." (". - number_format($assessment->gradinggrade * $workshop->gradinggrade / 100, 0).")> "; + $title .= " <".number_format($assessment->grade * $workshop->grade / 100, 0)." (". + number_format($assessment->gradinggrade * $workshop->gradinggrade / 100, 0).")> "; } } else { // not yet graded - $title .= " {".number_format($assessment->grade * $workshop->grade / 100, 0)." (-)} "; + $title .= " {".number_format($assessment->grade * $workshop->grade / 100, 0)." ((". + number_format($assessment->gradinggrade * $workshop->gradinggrade / 100, 0)."))} "; } if ($realassessments = workshop_count_user_assessments_done($workshop, $user)) { $action = "id&userid=$user->id\">". @@ -1308,6 +1340,10 @@ function workshop_list_submissions_for_admin($workshop, $order) { number_format($stats->min* $workshop->gradinggrade / 100, 1)); print_heading(get_string("gradinggrade", "workshop")." ".get_string("analysis", "workshop")); print_table($table); + echo "

id&action=regradestudentassessments\">". + get_string("regradestudentassessments", "workshop")." "; + helpbutton("regrading", get_string("regradestudentassessments", "workshop"), "workshop"); + echo "

\n"; } } @@ -1431,6 +1467,9 @@ function workshop_list_teacher_assessments($workshop, $user) { ////////////////////////////////////////////////////////////////////////////////////// function workshop_list_teacher_submissions($workshop, $user) { global $CFG; + + // set threshold on re-assessments + $reassessthreshold = 80; if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $workshop->course)) { error("Course Module ID was incorrect"); @@ -1500,12 +1539,12 @@ function workshop_list_teacher_submissions($workshop, $user) { $action = "id&sid=$submission->id\">". get_string("assess", "workshop").""; } - elseif ($assessment->timegraded) { - // allow student to improve on their assessment once it's been graded + elseif ($assessment->timegraded and ($assessment->gradinggrade < $reassessthreshold)) { + // allow student to improve on their assessment once it's been graded and is below threshold $action = "id&sid=$submission->id\">". get_string("reassess", "workshop").""; } else { - // allow student just to see their assessment if it hasn't been graded + // allow student just to see their assessment if it hasn't been graded (or above threshold) $action = "id&aid=$assessment->id\">". get_string("view", "workshop").""; } @@ -1531,6 +1570,7 @@ function workshop_list_unassessed_student_submissions($workshop, $user) { // list the student submissions not assessed by this user global $CFG; + $timenow = time(); if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $workshop->course)) { error("Course Module ID was incorrect"); } @@ -1545,13 +1585,13 @@ function workshop_list_unassessed_student_submissions($workshop, $user) { } $table->head = array (get_string("title", "workshop"), get_string("submittedby", "workshop"), - get_string("action", "workshop"), get_string("comment", "workshop")); - $table->align = array ("LEFT", "LEFT", "LEFT", "LEFT"); - $table->size = array ("*", "*", "*", "*"); + get_string("submitted", "workshop"), get_string("action", "workshop"), get_string("comment", "workshop")); + $table->align = array ("left", "left", "left", "left", "left"); + $table->size = array ("*", "*", "*", "*", "*"); $table->cellpadding = 2; $table->cellspacing = 0; - if ($submissions = workshop_get_student_submissions($workshop)) { + if ($submissions = workshop_get_student_submissions($workshop, 'time')) { // oldest first foreach ($submissions as $submission) { // check group membership, if necessary if ($groupid) { @@ -1560,18 +1600,22 @@ function workshop_list_unassessed_student_submissions($workshop, $user) { continue; // skip this user } } + // see if submission is cold + if (($submission->timecreated +$CFG->maxeditingtime) > $timenow) { + continue; // skip this submission + } $comment = ""; + $timegap = get_string("ago", "workshop", format_time($submission->timecreated - $timenow)); // see if user already graded this assessment if ($assessment = get_record_select("workshop_assessments", "submissionid = $submission->id AND userid = $user->id")) { - $timenow = time(); if (($timenow - $assessment->timecreated < $CFG->maxeditingtime)) { // last chance salon $submissionowner = get_record("user", "id", $submission->userid); $action = "id&sid=$submission->id\">". get_string("edit", "workshop").""; $table->data[] = array(workshop_print_submission_title($workshop, $submission), - fullname($submissionowner), $action, $comment); + fullname($submissionowner), $timegap, $action, $comment); } } else { // no assessment @@ -1579,7 +1623,7 @@ function workshop_list_unassessed_student_submissions($workshop, $user) { $action = "id&sid=$submission->id\">". get_string("assess", "workshop").""; $table->data[] = array(workshop_print_submission_title($workshop, $submission), - fullname($submissionowner), $action, $comment); + fullname($submissionowner), $timegap, $action, $comment); } } if (isset($table->data)) { @@ -1702,7 +1746,9 @@ function workshop_list_user_submissions($workshop, $user) { foreach ($submissions as $submission) { // allow user to delete a submission if it's warm if ($submission->timecreated > ($timenow - $CFG->maxeditingtime)) { - $action = "id&sid=$submission->id\">". + $action = "id&sid=$submission->id\">". + get_string("edit", "workshop")." | ". + "id&sid=$submission->id\">". get_string("delete", "workshop").""; } else { @@ -1754,7 +1800,7 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges if (!$submission = get_record("workshop_submissions", "id", $assessment->submissionid)) { error ("Workshop_print_assessment: Submission record not found"); } - echo workshop_print_submission_title($workshop, $submission); + echo workshop_print_submission($workshop, $submission); echo "
\n"; // see if this is a pre-filled assessment for a re-submission... @@ -2402,18 +2448,16 @@ function workshop_print_key($workshop) { if (!$course = get_record("course", "id", $workshop->course)) { error("Print key: course not found"); } - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "
{}".get_string("assessmentby", "workshop", $course->student). - ";   []".get_string("assessmentby", "workshop", $course->teacher). - ";   <>".get_string("assessmentdropped", "workshop"). - ";   ()".get_string("gradegiventoassessment", "workshop"). - ".
".get_string("gradesforsubmissionsare", "workshop", $workshop->grade)."; ". - get_string("gradesforassessmentsare", "workshop", $workshop->gradinggrade).".

\n"; + echo "
\n"; + echo "

{} ".get_string("assessmentby", "workshop", $course->student).";  \n"; + echo "[] ".get_string("assessmentby", "workshop", $course->teacher).";  \n"; + echo "<> ".get_string("assessmentdropped", "workshop").";\n"; + if ($workshop->agreeassessments) echo "<<>> ".get_string("assessmentnotyetagreed", "workshop").";\n"; + echo "
() ".get_string("gradegiventoassessment", "workshop").";  \n"; + echo "(()) ".get_string("assessmentnotyetgraded", "workshop").".\n"; + echo "
".get_string("gradesforsubmissionsare", "workshop", $workshop->grade).";  \n"; + echo get_string("gradesforassessmentsare", "workshop", $workshop->gradinggrade).".

\n"; + echo "
\n"; return; } @@ -2495,6 +2539,42 @@ function workshop_print_league_table($workshop) { } +////////////////////////////////////////////////////////////////////////////////////// +function workshop_print_submission($workshop, $submission) { + // prints the submission with optional attachments + global $CFG; + + if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $workshop->course)) { + error("Course Module ID was incorrect"); + } + print_simple_box(format_text($submission->description), 'center'); + if ($workshop->nattachments) { + $n = 1; + echo "\n"; + $filearea = workshop_file_area_name($workshop, $submission); + if ($basedir = workshop_file_area($workshop, $submission)) { + if ($files = get_directory_list($basedir)) { + foreach ($files as $file) { + $icon = mimeinfo("icon", $file); + if ($CFG->slasharguments) { + $ffurl = "file.php/$filearea/$file"; + } else { + $ffurl = "file.php?file=/$filearea/$file"; + } + echo ""; + $n++; + } + } + } + echo "
".get_string("attachment", "workshop")." $n: \n"; + echo "pixpath/f/$icon\" height=\"16\" width=\"16\" + border=\"0\" alt=\"File\" />". + " wwwroot/$ffurl\">$file
\n"; + } + return; +} + + ////////////////////////////////////////////////////////////////////////////////////// function workshop_print_submission_assessments($workshop, $submission, $type) { // Returns the teacher or peer grade and a hyperlinked list of grades for this submission @@ -2519,7 +2599,9 @@ function workshop_print_submission_assessments($workshop, $submission, $type) { $str .= "<".number_format($assessment->grade, 0)." (0)> "; } } else { - $str .= "[".number_format($assessment->grade, 0)." (-)] "; + $str .= "[".number_format($assessment->grade, 0)." ((". + number_format($assessment->gradinggrade * $workshop->gradinggrade / 100, 0). + "))] "; } } } @@ -2528,7 +2610,12 @@ function workshop_print_submission_assessments($workshop, $submission, $type) { foreach ($assessments as $assessment) { if (isstudent($workshop->course, $assessment->userid)) { $str .= "id&aid=$assessment->id\">"; - if ($assessment->timegraded) { + if ($workshop->agreeassessments and !$assessment->timeagreed and + isstudent($workshop->course, $submission->userid)) { // agreement on student work only + $str .= "<<".number_format($assessment->grade * $workshop->grade / 100, 0)." (". + number_format($assessment->gradinggrade * $workshop->gradinggrade / 100, 0). + ")>> "; + } elseif ($assessment->timegraded) { if ($assessment->gradinggrade) { $str .= "{".number_format($assessment->grade * $workshop->grade / 100, 0)." (". number_format($assessment->gradinggrade * $workshop->gradinggrade / 100, 0). @@ -2538,7 +2625,8 @@ function workshop_print_submission_assessments($workshop, $submission, $type) { " (0)> "; } } else { - $str .= "{".number_format($assessment->grade * $workshop->grade / 100, 0)." (-)} "; + $str .= "{".number_format($assessment->grade * $workshop->grade / 100, 0)." ((". + number_format($assessment->gradinggrade * $workshop->gradinggrade / 100, 0)."))} "; } } } @@ -2556,26 +2644,14 @@ function workshop_print_submission_assessments($workshop, $submission, $type) { function workshop_print_submission_title($workshop, $submission) { // Arguments are objects - global $CFG; + if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $workshop->course)) { + error("Course Module ID was incorrect"); + } if (!$submission->timecreated) { // a "no submission" return $submission->title; } - - require_once("$CFG->dirroot/files/mimetypes.php"); - $filearea = workshop_file_area_name($workshop, $submission); - if ($basedir = workshop_file_area($workshop, $submission)) { - if (list($file) = get_directory_list($basedir)) { - $icon = mimeinfo("icon", $file); - if ($CFG->slasharguments) { - $ffurl = "file.php/$filearea/$file"; - } else { - $ffurl = "file.php?file=/$filearea/$file"; - } - return "pixpath/f/$icon\" height=\"16\" width=\"16\" border=\"0\" alt=\"File\" />". - " id\" href=\"$CFG->wwwroot/$ffurl\">$submission->title"; - } - } + return "id&action=showsubmission&sid=$submission->id\">$submission->title"; } @@ -2677,8 +2753,6 @@ function workshop_print_time_to_deadline($time) { ////////////////////////////////////////////////////////////////////////////////////// function workshop_print_upload_form($workshop) { -// Arguments are objects, needs title coming in - global $CFG; if (! $course = get_record("course", "id", $workshop->course)) { @@ -2687,13 +2761,30 @@ function workshop_print_upload_form($workshop) { if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $course->id)) { error("Course Module ID was incorrect"); } + $usehtmleditor = can_use_html_editor(); echo "
"; echo "
"; echo " id\" />"; - require_once($CFG->dirroot.'/lib/uploadlib.php'); - upload_print_form_fragment(1,array('newfile'),null,true,array('title'),$course->maxbytes,$workshop->maxbytes,false); - echo " "; + echo "\n"; + // now get the submission + echo "
". get_string("title", "workshop").":\n"; + echo "\n"; + echo "
".get_string("submission", "workshop").":
\n"; + print_textarea($usehtmleditor, 25,70, 630, 400, "description"); + use_html_editor("description"); + echo "
\n"; + if ($workshop->nattachments) { + require_once($CFG->dirroot.'/lib/uploadlib.php'); + for ($i=0; $i < $workshop->nattachments; $i++) { + $iplus1 = $i + 1; + $tag[$i] = get_string("attachment", "workshop")." $iplus1:"; + } + upload_print_form_fragment($workshop->nattachments,null,$tag,false,null,$course->maxbytes, + $workshop->maxbytes,false); + } + echo "
\n"; + echo " "; echo "
"; echo "
"; } diff --git a/mod/workshop/mod.html b/mod/workshop/mod.html index e03142e0ef..75ce0b2343 100644 --- a/mod/workshop/mod.html +++ b/mod/workshop/mod.html @@ -22,6 +22,9 @@ if (!isset($form->nelements)) { $form->nelements = 1; } + if (!isset($form->nattachments)) { + $form->nattachments = 0; + } if (empty($form->resubmit)) { $form->resubmit = ""; } @@ -155,6 +158,20 @@ + +

:

+ + =0; $i--) { + $numbers[$i] = $i; + } + choose_from_menu($numbers, "nattachments", "$form->nattachments", ""); + helpbutton("nattachments", get_string("numberofaattachments", "workshop"), "workshop"); + ?> + + +

:

diff --git a/mod/workshop/restorelib.php b/mod/workshop/restorelib.php index d0234a7ef7..085a2a9e0c 100644 --- a/mod/workshop/restorelib.php +++ b/mod/workshop/restorelib.php @@ -57,6 +57,7 @@ $workshop->name = backup_todb($info['MOD']['#']['NAME']['0']['#']); $workshop->description = backup_todb($info['MOD']['#']['DESCRIPTION']['0']['#']); $workshop->nelements = backup_todb($info['MOD']['#']['NELEMENTS']['0']['#']); + $workshop->nattachments = backup_todb($info['MOD']['#']['NATTACHMENTS']['0']['#']); $workshop->phase = backup_todb($info['MOD']['#']['PHASE']['0']['#']); $workshop->format = backup_todb($info['MOD']['#']['FORMAT']['0']['#']); $workshop->gradingstrategy = backup_todb($info['MOD']['#']['GRADINGSTRATEGY']['0']['#']); @@ -230,6 +231,7 @@ $submission->title = backup_todb($sub_info['#']['TITLE']['0']['#']); $submission->timecreated = backup_todb($sub_info['#']['TIMECREATED']['0']['#']); $submission->mailed = backup_todb($sub_info['#']['MAILED']['0']['#']); + $submission->description = backup_todb($sub_info['#']['DESCRIPTION']['0']['#']); $submission->teachergrade = backup_todb($sub_info['#']['TEACHERGRADE']['0']['#']); $submission->peergrade = backup_todb($sub_info['#']['PEERGRADE']['0']['#']); $submission->biasgrade = backup_todb($sub_info['#']['BIASGRADE']['0']['#']); diff --git a/mod/workshop/submissions.php b/mod/workshop/submissions.php index 680f98e9ab..3e88311b89 100644 --- a/mod/workshop/submissions.php +++ b/mod/workshop/submissions.php @@ -3,14 +3,17 @@ /************************************************* ACTIONS handled are: - adminamendtitle + dminamendtitle adminconfirmdelete admindelete adminlist displayfinalgrades (teachers only) + editsubmission listallsubmissions listforassessmentstudent listforassessmentteacher + showsubmission + updatesubmission userconfirmdelete userdelete @@ -53,8 +56,8 @@ } - /******************* admin amend title ************************************/ - if ($action == 'adminamendtitle' ) { +/******************* admin amend title ************************************/ + elseif ($action == 'adminamendtitle' ) { if (!isteacher($course->id)) { error("Only teachers can look at this page"); @@ -236,11 +239,78 @@ echo "

".get_string("namesnotshowntostudents", "workshop", $course->students)."

\n"; } } - echo "

".get_string("allgradeshaveamaximumof", "workshop", $workshop->grade)."

\n"; print_continue("view.php?id=$cm->id"); } + /******************* edit submission ************************************/ + elseif ($action == 'editsubmission' ) { + + if (empty($_GET['sid'])) { + error("Edit submission: submission id missing"); + } + $usehtmleditor = can_use_html_editor(); + + $submission = get_record("workshop_submissions", "id", $_GET['sid']); + print_heading(get_string("editsubmission", "workshop")); + if ($submission->userid <> $USER->id) { + error("Edit submission: Userids do not match"); + } + ?> +
+ + + +
+ + \n"; + if ($workshop->nattachments) { + $filearea = workshop_file_area_name($workshop, $submission); + if ($basedir = workshop_file_area($workshop, $submission)) { + if ($files = get_directory_list($basedir)) { + echo "\n"; + $n = 1; + foreach ($files as $file) { + $icon = mimeinfo("icon", $file); + if ($CFG->slasharguments) { + $ffurl = "file.php/$filearea/$file"; + } else { + $ffurl = "file.php?file=/$filearea/$file"; + } + echo "\n"; + } + } else { + echo "\n"; + } + } + echo "\n"; + } + + echo "
". get_string("title", "workshop").":\n"; + echo "title\" />\n"; + echo "
".get_string("submission", "workshop").":
\n"; + print_textarea($usehtmleditor, 25,70, 630, 400, "description", $submission->description); + use_html_editor("description"); + echo "
".get_string("attachments", "workshop"). + "
".get_string("attachment", "workshop")." $n: pixpath/f/$icon\" + height=\"16\" width=\"16\" border=\"0\" alt=\"File\" />". + " wwwroot/$ffurl\">$file
".get_string("noattachments", "workshop")."
\n"; + require_once($CFG->dirroot.'/lib/uploadlib.php'); + for ($i=0; $i < $workshop->nattachments; $i++) { + $iplus1 = $i + 1; + $tag[$i] = get_string("newattachment", "workshop")." $iplus1:"; + } + upload_print_form_fragment($workshop->nattachments,null,$tag,false,null,$course->maxbytes, + $workshop->maxbytes,false); + echo "
\n"; + echo "\n"; + echo "
\n"; + } + + /******************* list all submissions ************************************/ elseif ($action == 'listallsubmissions' ) { if (!$users = get_course_students($course->id)) { @@ -281,6 +351,19 @@ } + /******************* show submission ************************************/ + elseif ($action == 'showsubmission' ) { + + if (empty($_GET['sid'])) { + error("Edit submission: submission id missing"); + } + + $submission = get_record("workshop_submissions", "id", $_GET['sid']); + workshop_print_submission($workshop, $submission); + print_continue("view.php?id=$cm->id"); + } + + /*************** update (league table options teacher) ***************************/ elseif ($action == 'updateleaguetable') { @@ -304,7 +387,41 @@ } - /******************* user confirm delete ************************************/ + /*************** update submission ***************************/ + elseif ($action == 'updatesubmission') { + + $timenow = time(); + $form = data_submitted(); + + if (empty($form->sid)) { + error("Update submission: submission id missing"); + } + $submission = get_record("workshop_submissions", "id", $form->sid); + // check existence of title + if (empty($form->title)) { + $title = get_string("notitle", "workshop"); + } + set_field("workshop_submissions", "title", $form->title, "id", $submission->id); + set_field("workshop_submissions", "description", trim($form->description), "id", $submission->id); + set_field("workshop_submissions", "timecreated", $timenow, "id", $submission->id); + if ($workshop->nattachments) { + require_once($CFG->dirroot.'/lib/uploadlib.php'); + $um = new upload_manager(null,false,false,$course,false,$workshop->maxbytes); + if ($um->preprocess_files()) { + $dir = workshop_file_area_name($workshop, $submission); + if ($um->save_files($dir)) { + add_to_log($course->id, "workshop", "newattachment", "view.php?id=$cm->id", "$workshop->id"); + print_heading(get_string("uploadsuccess", "workshop")); + } + // upload manager will print errors. + } + print_continue("view.php?id=$cm->id"); + } else { + redirect("view.php?id=$cm->id"); + } + } + + /******************* user confirm delete ************************************/ elseif ($action == 'userconfirmdelete' ) { if (empty($_GET['sid'])) { diff --git a/mod/workshop/upload.php b/mod/workshop/upload.php index 28862b59b4..6c5bb8a0af 100644 --- a/mod/workshop/upload.php +++ b/mod/workshop/upload.php @@ -20,78 +20,81 @@ require_login($course->id); $strworkshops = get_string("modulenameplural", "workshop"); - $strworkshop = get_string("modulename", "workshop"); - $strupload = get_string("upload"); + $strworkshop = get_string("modulename", "workshop"); + $strupload = get_string("upload"); print_header_simple("$workshop->name : $strupload", "", "id\">$strworkshops -> id\">$workshop->name -> $strupload", "", "", true); - /**** - if ($submissions = workshop_get_submissions($workshop, $USER)) { - if ($submission->grade and !$workshop->resubmit) { - error("You've already been graded - there's no point in uploading anything"); - } - } -****/ $timenow = time(); - if (!$title = $_POST['title']) { - notify(get_string("notitlegiven", "workshop") ); + + $form = data_submitted("nomatch"); // POST may come from two forms + + // don't be picky about not having a title + if (!$title = $form->title) { + $title = get_string("notitle", "workshop"); } - else { - require_once($CFG->dirroot.'/lib/uploadlib.php'); - $um = new upload_manager('newfile',false,false,$course,false,$exercise->maxbytes); - if ($um->preprocess_files()) { - // get the current set of submissions - $submissions = workshop_get_user_submissions($workshop, $USER); - // add new submission record - $newsubmission->workshopid = $workshop->id; - $newsubmission->userid = $USER->id; - $newsubmission->title = $title; - $newsubmission->timecreated = time(); - if (!$newsubmission->id = insert_record("workshop_submissions", $newsubmission)) { - error("Workshop upload: Failure to create new submission record!"); - } - // see if this is a resubmission by looking at the previous submissions... - if ($submissions and ($workshop->phase >1)) { // ...but not teacher submissions - // find the last submission - foreach ($submissions as $submission) { - $lastsubmission = $submission; - break; - } - // find all the possible assessments of this submission - // ...and if they have been assessed give the assessor a new assessment - // based on their old assessment, if the assessment has not be made - // just delete it! - if ($assessments = workshop_get_assessments($submission, 'ALL')) { - foreach ($assessments as $assessment) { - if ($assessment->timecreated < $timenow) { - // a Cold or Warm assessment - copy it with feedback.. - $newassessment = workshop_copy_assessment($assessment, $newsubmission, - true); - // set the resubmission flag so student can be emailed/told about - // this assessment - set_field("workshop_assessments", "resubmission", 1, "id", - $newassessment->id); - } else { - // a hot assessment, was not used, just dump it - delete_records("workshop_assessments", "id", $assessment->id); - } + + // get the current set of submissions + $submissions = workshop_get_user_submissions($workshop, $USER); + // add new submission record + $newsubmission->workshopid = $workshop->id; + $newsubmission->userid = $USER->id; + $newsubmission->title = $title; + $newsubmission->description = trim($form->description); + $newsubmission->timecreated = time(); + if (!$newsubmission->id = insert_record("workshop_submissions", $newsubmission)) { + error("Workshop upload: Failure to create new submission record!"); + } + // see if this is a resubmission by looking at the previous submissions... + if ($submissions and ($workshop->phase >1)) { // ...but not teacher submissions + // find the last submission + foreach ($submissions as $submission) { + $lastsubmission = $submission; + break; + } + // find all the possible assessments of this submission + // ...and if they have been assessed give the assessor a new assessment + // based on their old assessment, if the assessment has not be made + // just delete it! + if ($assessments = workshop_get_assessments($submission, 'ALL')) { + foreach ($assessments as $assessment) { + if ($assessment->timecreated < $timenow) { + // a Cold or Warm assessment... + if ($assessment->userid <> $USER->id) { + // only copy other students assessment not the self assessment (if present) + // copy it with feedback.. + $newassessment = workshop_copy_assessment($assessment, $newsubmission, true); + // set the resubmission flag so student can be emailed/told about + // this assessment + set_field("workshop_assessments", "resubmission", 1, "id", $newassessment->id); } + } else { + // a hot assessment, was not used, just dump it + delete_records("workshop_assessments", "id", $assessment->id); } - add_to_log($course->id, "workshop", "resubmit", "view.php?id=$cm->id", - "$workshop->id","$cm->id"); } + } + add_to_log($course->id, "workshop", "resubmit", "view.php?id=$cm->id", "$workshop->id","$cm->id"); + } + // do something about the attachments, if there are any + if ($workshop->nattachments) { + require_once($CFG->dirroot.'/lib/uploadlib.php'); + $um = new upload_manager(null,false,false,$course,false,$workshop->maxbytes); + if ($um->preprocess_files()) { $dir = workshop_file_area_name($workshop, $newsubmission); if ($um->save_files($dir)) { - print_heading(get_string("uploadsuccess", "assignment", $um->get_new_filename()) ); - add_to_log($course->id, "workshop", "submit", "view.php?id=$cm->id", "$workshop->id", "$cm->id"); + print_heading(get_string("uploadsuccess", "workshop")); } - // um will take care of printing errors. + // um will take care of printing errors. } - } + } + if (!$workshop->nattachments) { + print_heading(get_string("submitted", "workshop")." ".get_string("ok")); + } + add_to_log($course->id, "workshop", "submit", "view.php?id=$cm->id", "$workshop->id", "$cm->id"); print_continue("view.php?id=$cm->id"); - print_footer($course); ?> diff --git a/mod/workshop/version.php b/mod/workshop/version.php index 31647ad7ea..1b4aa4080a 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 = 2004091700; +$module->version = 2004092400; $module->requires = 2004091700; // Requires this Moodle version $module->cron = 60; diff --git a/mod/workshop/view.php b/mod/workshop/view.php index 69fcfb8fc5..0cf69e2a0d 100644 --- a/mod/workshop/view.php +++ b/mod/workshop/view.php @@ -259,14 +259,22 @@ workshop_list_user_submissions($workshop, $USER); // are resubmissions allowed and the workshop is in submission phases (2 and 3)? if ($workshop->resubmit and ($workshop->phase < 4)) { - // see if there are any cold (warm included as well) assessments of the last submission + // 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)) { foreach ($submissions as $submission) { $lastsubmission = $submission; break; } - if (workshop_count_assessments($lastsubmission)) { + $n = 0; // number of cold assessments (not include self assessments) + if ($assessments = workshop_get_assessments($lastsubmission)) { + foreach ($assessments as $assessment) { + if ($assessment->userid <> $USER->id) { + $n++; + } + } + } + if ($n) { echo "
"; print_heading(get_string("submitrevisedassignment", "workshop").":"); workshop_print_upload_form($workshop); @@ -274,9 +282,6 @@ } } } - // allow user to list their submissions and assessments in a general way???? - // print_heading("id\">". - // get_string("listofallsubmissions", "workshop")); } } } -- 2.39.5