Version 2004081100: auto grading of assessments.
This commit is contained in:
+837
-855
File diff suppressed because it is too large
Load Diff
@@ -65,20 +65,14 @@
|
||||
fwrite ($bf,full_tag("MAXBYTES",4,false,$workshop->maxbytes));
|
||||
fwrite ($bf,full_tag("DEADLINE",4,false,$workshop->deadline));
|
||||
fwrite ($bf,full_tag("GRADE",4,false,$workshop->grade));
|
||||
fwrite ($bf,full_tag("GRADINGGRADE",4,false,$workshop->gradinggrade));
|
||||
fwrite ($bf,full_tag("NTASSESSMENTS",4,false,$workshop->ntassessments));
|
||||
fwrite ($bf,full_tag("ASSESSMENTCOMPS",4,false,$workshop->assessmentcomps));
|
||||
fwrite ($bf,full_tag("NSASSESSMENTS",4,false,$workshop->nsassessments));
|
||||
fwrite ($bf,full_tag("OVERALLOCATION",4,false,$workshop->overallocation));
|
||||
fwrite ($bf,full_tag("TIMEMODIFIED",4,false,$workshop->timemodified));
|
||||
fwrite ($bf,full_tag("MERGEGRADES",4,false,$workshop->mergegrades));
|
||||
fwrite ($bf,full_tag("TEACHERWEIGHT",4,false,$workshop->teacherweight));
|
||||
fwrite ($bf,full_tag("PEERWEIGHT",4,false,$workshop->peerweight));
|
||||
fwrite ($bf,full_tag("INCLUDETEACHERSGRADE",4,false,$workshop->includeteachersgrade));
|
||||
fwrite ($bf,full_tag("BIASWEIGHT",4,false,$workshop->biasweight));
|
||||
fwrite ($bf,full_tag("RELIABILITYWEIGHT",4,false,$workshop->reliabilityweight));
|
||||
fwrite ($bf,full_tag("GRADINGWEIGHT",4,false,$workshop->gradingweight));
|
||||
fwrite ($bf,full_tag("SHOWLEAGUETABLE",4,false,$workshop->showleaguetable));
|
||||
fwrite ($bf,full_tag("TEACHERLOADING",4,false,$workshop->teacherloading));
|
||||
fwrite ($bf,full_tag("ASSESSMENTSTODROP",4,false,$workshop->assessmentstodrop));
|
||||
//Now we backup workshop elements
|
||||
$status = backup_workshop_elements($bf,$preferences,$workshop->id);
|
||||
//if we've selected to backup users info, then execute backup_workshop_submisions
|
||||
|
||||
@@ -81,6 +81,19 @@ function workshop_upgrade($oldversion) {
|
||||
workshop_refresh_events();
|
||||
}
|
||||
|
||||
if ($oldversion < 2004081100) {
|
||||
table_column("workshop", "", "gradinggrade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
|
||||
table_column("workshop", "", "assessmentcomps", "INTEGER", "4", "UNSIGNED", "2", "NOT NULL", "ntassessments");
|
||||
execute_sql("ALTER TABLE `{$CFG->prefix}workshop` DROP COLUMN `gradingweight`");
|
||||
execute_sql("ALTER TABLE `{$CFG->prefix}workshop` DROP COLUMN `mergegrades`");
|
||||
execute_sql("ALTER TABLE `{$CFG->prefix}workshop` DROP COLUMN `peerweight`");
|
||||
execute_sql("ALTER TABLE `{$CFG->prefix}workshop` DROP COLUMN `includeteachersgrade`");
|
||||
execute_sql("ALTER TABLE `{$CFG->prefix}workshop` DROP COLUMN `biasweight`");
|
||||
execute_sql("ALTER TABLE `{$CFG->prefix}workshop` DROP COLUMN `reliabilityweight`");
|
||||
execute_sql("ALTER TABLE `{$CFG->prefix}workshop` DROP COLUMN `teacherloading`");
|
||||
execute_sql("ALTER TABLE `{$CFG->prefix}workshop` DROP COLUMN `assessmentstodrop`");
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -18,20 +18,14 @@ CREATE TABLE `prefix_workshop` (
|
||||
`includeself` tinyint(2) unsigned NOT NULL default '0',
|
||||
`maxbytes` int(10) unsigned NOT NULL default '100000',
|
||||
`deadline` int(10) unsigned NOT NULL default '0',
|
||||
`grade` int(10) NOT NULL default '0',
|
||||
`grade` tinyint(3) NOT NULL default '0',
|
||||
`gradinggrade` tinyint(3) NOT NULL default '0',
|
||||
`ntassessments` tinyint(3) unsigned NOT NULL default '0',
|
||||
`assessmentcomps` tinyint(3) unsigned NOT NULL default '2',
|
||||
`nsassessments` tinyint(3) unsigned NOT NULL default '0',
|
||||
`overallocation` tinyint(3) unsigned NOT NULL default '0',
|
||||
`timemodified` int(10) unsigned NOT NULL default '0',
|
||||
`mergegrades` tinyint(3) unsigned NOT NULL default '0',
|
||||
`teacherweight` tinyint(3) unsigned NOT NULL default '5',
|
||||
`peerweight` tinyint(3) unsigned NOT NULL default '5',
|
||||
`includeteachersgrade` tinyint(3) unsigned NOT NULL default '0',
|
||||
`biasweight` tinyint(3) unsigned NOT NULL default '5',
|
||||
`reliabilityweight` tinyint(3) unsigned NOT NULL default '5',
|
||||
`gradingweight` tinyint(3) unsigned NOT NULL default '5',
|
||||
`teacherloading` tinyint(3) unsigned NOT NULL default '5',
|
||||
`assessmentstodrop` tinyint(3) unsigned NOT NULL default '0',
|
||||
`teacherweight` tinyint(3) unsigned NOT NULL default '1',
|
||||
`showleaguetable` tinyint(3) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) COMMENT='Defines workshop';
|
||||
|
||||
+33
-22
@@ -1,8 +1,8 @@
|
||||
<?PHP // $Id$
|
||||
|
||||
require("../../config.php");
|
||||
require("lib.php");
|
||||
require("locallib.php");
|
||||
require("lib.php");
|
||||
require("locallib.php");
|
||||
|
||||
require_variable($id); // course
|
||||
|
||||
@@ -18,7 +18,11 @@
|
||||
$strweek = get_string("week");
|
||||
$strtopic = get_string("topic");
|
||||
$strname = get_string("name");
|
||||
$strphase = get_string("phase", "workshop");
|
||||
if (isstudent($course->id)) {
|
||||
$strinfo = get_string("grade");
|
||||
} else {
|
||||
$strinfo = get_string("phase", "workshop");
|
||||
}
|
||||
$strdeadline = get_string("deadline", "workshop");
|
||||
$strsubmitted = get_string("submitted", "assignment");
|
||||
|
||||
@@ -32,30 +36,28 @@
|
||||
$timenow = time();
|
||||
|
||||
if ($course->format == "weeks") {
|
||||
$table->head = array ($strweek, $strname, $strphase, $strsubmitted, $strdeadline);
|
||||
$table->head = array ($strweek, $strname, $strinfo, $strsubmitted, $strdeadline);
|
||||
$table->align = array ("CENTER", "LEFT", "LEFT", "LEFT", "LEFT");
|
||||
} elseif ($course->format == "topics") {
|
||||
$table->head = array ($strtopic, $strname, $strphase, $strsubmitted, $strdeadline);
|
||||
$table->head = array ($strtopic, $strname, $strinfo, $strsubmitted, $strdeadline);
|
||||
$table->align = array ("CENTER", "LEFT", "left", "LEFT", "LEFT");
|
||||
} else {
|
||||
$table->head = array ($strname, $strphase, $strsubmitted, $strdeadline);
|
||||
$table->head = array ($strname, $strinfo, $strsubmitted, $strdeadline);
|
||||
$table->align = array ("LEFT", "LEFT", "LEFT", "LEFT");
|
||||
}
|
||||
|
||||
foreach ($workshops as $workshop) {
|
||||
switch ($workshop->phase) {
|
||||
case 0:
|
||||
case 1: $phase = get_string("phase1short", "workshop");
|
||||
case 1: $info = get_string("phase1short", "workshop");
|
||||
break;
|
||||
case 2: $phase = get_string("phase2short", "workshop");
|
||||
case 2: $info = get_string("phase2short", "workshop");
|
||||
break;
|
||||
case 3: $phase = get_string("phase3short", "workshop");
|
||||
case 3: $info = get_string("phase3short", "workshop");
|
||||
break;
|
||||
case 4: $phase = get_string("phase4short", "workshop");
|
||||
case 4: $info = get_string("phase4short", "workshop");
|
||||
break;
|
||||
case 5: $phase = get_string("phase5short", "workshop");
|
||||
break;
|
||||
case 6: $phase = get_string("phase6short", "workshop");
|
||||
case 5: $info = get_string("phase5short", "workshop");
|
||||
break;
|
||||
}
|
||||
if ($submissions = workshop_get_user_submissions($workshop, $USER)) {
|
||||
@@ -69,18 +71,27 @@
|
||||
$due = userdate($workshop->deadline);
|
||||
if (!$workshop->visible) {
|
||||
//Show dimmed if the mod is hidden
|
||||
$link = "<A class=\"dimmed\" HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A><br />".
|
||||
"($submission->title)";
|
||||
} else {
|
||||
$link = "<A class=\"dimmed\" HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A><br />";
|
||||
} else {
|
||||
//Show normal if the mod is visible
|
||||
$link = "<A HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A><br />".
|
||||
"($submission->title)";
|
||||
$link = "<A HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A><br />";
|
||||
}
|
||||
if (isstudent($course->id)) {
|
||||
$link .= " ($submission->title)"; // show students the title of their submission(s)
|
||||
$gradinggrade = workshop_gradinggrade($workshop, $USER);
|
||||
$grade = workshop_submission_grade($workshop, $submission);
|
||||
$info = get_string("gradeforassessments", "workshop").": $gradinggrade/$workshop->gradinggrade; ".
|
||||
get_string("gradeforsubmission", "workshop").": $grade/$workshop->grade";
|
||||
}
|
||||
if ($course->format == "weeks" or $course->format == "topics") {
|
||||
$table->data[] = array ($workshop->section, $link, $phase, $submitted, $due);
|
||||
$table->data[] = array ($workshop->section, $link, $info, $submitted, $due);
|
||||
}
|
||||
else {
|
||||
$table->data[] = array ($link, $phase, $submitted, $due);
|
||||
$table->data[] = array ($link, $info, $submitted, $due);
|
||||
}
|
||||
if (isteacher($course->id)) {
|
||||
// teacher only needs to see one "submission"
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,10 +106,10 @@
|
||||
$link = "<A HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A>";
|
||||
}
|
||||
if ($course->format == "weeks" or $course->format == "topics") {
|
||||
$table->data[] = array ($workshop->section, $link, $phase, $submitted, $due);
|
||||
$table->data[] = array ($workshop->section, $link, $info, $submitted, $due);
|
||||
}
|
||||
else {
|
||||
$table->data[] = array ($link, $phase, $submitted, $due);
|
||||
$table->data[] = array ($link, $info, $submitted, $due);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+396
-38
@@ -53,9 +53,14 @@ $WORKSHOP_EWEIGHTS = array( 0 => -4.0, 1 => -2.0, 2 => -1.5, 3 => -1.0, 4 => -0
|
||||
$WORKSHOP_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, 12=>50.0);
|
||||
|
||||
if (!defined("COMMENTSCALE")) {
|
||||
define("COMMENTSCALE", 20);
|
||||
}
|
||||
|
||||
$WORKSHOP_ASSESSMENT_COMPS = array (
|
||||
0 => array('name' => get_string("verylax", "workshop"), 'value' => 1),
|
||||
1 => array('name' => get_string("lax", "workshop"), 'value' => 0.6),
|
||||
2 => array('name' => get_string("fair", "workshop"), 'value' => 0.4),
|
||||
3 => array('name' => get_string("strict", "workshop"), 'value' => 0.33),
|
||||
4 => array('name' => get_string("verystrict", "workshop"), 'value' => 0.2) );
|
||||
|
||||
|
||||
|
||||
/*** Standard Moodle functions ******************
|
||||
@@ -110,6 +115,15 @@ function workshop_cron () {
|
||||
|
||||
global $CFG, $USER;
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find all workshop notifications that have yet to be mailed out, and mails them
|
||||
$cutofftime = time() - $CFG->maxeditingtime;
|
||||
|
||||
@@ -595,24 +609,33 @@ function workshop_delete_instance($id) {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_grades($workshopid) {
|
||||
/// Must return an array of grades, indexed by user, and a max grade.
|
||||
/// only retruns grades in phase 6
|
||||
/// only retruns grades in phase 2 or greater
|
||||
global $CFG;
|
||||
|
||||
if ($workshop = get_record("workshop", "id", $workshopid)) {
|
||||
if ($workshop->phase == 6) {
|
||||
if ($bestsubmissions = get_records_sql("SELECT userid, max(finalgrade) finalgrade FROM
|
||||
{$CFG->prefix}workshop_submissions WHERE workshopid = $workshopid GROUP
|
||||
BY userid")) {
|
||||
foreach ($bestsubmissions as $bestgrade) {
|
||||
$return->grades[$bestgrade->userid] = $bestgrade->finalgrade;
|
||||
if ($workshop->phase > 1) {
|
||||
if ($students = get_course_students($workshop->course)) {
|
||||
foreach ($students as $student) {
|
||||
$gradinggrade = workshop_gradinggrade($workshop, $student);
|
||||
if ($submissions = workshop_get_user_submissions($workshop, $student)) {
|
||||
$bestgrade = 0;
|
||||
foreach ($submissions as $submission) {
|
||||
$grade = workshop_submission_grade($workshop, $submission);
|
||||
if ($grade > $bestgrade) {
|
||||
$bestgrade = $grade;
|
||||
}
|
||||
}
|
||||
}
|
||||
$return->grades[$student->id] = $gradinggrade + $bestgrade;
|
||||
}
|
||||
}
|
||||
}
|
||||
$return->maxgrade = $workshop->grade;
|
||||
$return->maxgrade = $workshop->grade + $workshop->gradinggrade;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_is_recent_activity($course, $isteacher, $timestart) {//jlw1 added for adding mark to courses with activity in My Moodle
|
||||
global $CFG;
|
||||
|
||||
@@ -999,6 +1022,70 @@ function workshop_get_participants($workshopid) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
// Non-standard workshop functions
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_compare_assessments($workshop, $assessment1, $assessment2) {
|
||||
global $WORKSHOP_ASSESSMENT_COMPS, $WORKSHOP_EWEIGHTS;
|
||||
// first get the assignment elements for maxscores...
|
||||
$elementsraw = get_records("workshop_elements", "workshopid", $workshop->id, "elementno ASC");
|
||||
foreach ($elementsraw as $element) {
|
||||
$maxscore[] = $element->maxscore; // to renumber index 0,1,2...
|
||||
$weight[] = $WORKSHOP_EWEIGHTS[$element->weight]; // get real value and renumber index 0,1,2...
|
||||
}
|
||||
for ($i = 0; $i < 2; $i++) {
|
||||
if ($i) {
|
||||
$rawgrades = get_records("workshop_grades", "assessmentid", $assessment1->id, "elementno ASC");
|
||||
} else {
|
||||
$rawgrades = get_records("workshop_grades", "assessmentid", $assessment2->id, "elementno ASC");
|
||||
}
|
||||
foreach ($rawgrades as $grade) {
|
||||
$grades[$i][] = $grade->grade;
|
||||
}
|
||||
}
|
||||
$sumdiffs = 0;
|
||||
$sumweights = 0;
|
||||
switch ($workshop->gradingstrategy) {
|
||||
case 1 : // accumulative grading and...
|
||||
case 4 : // ...rubic grading
|
||||
for ($i=0; $i < $workshop->nelements; $i++) {
|
||||
$diff = ($grades[0][$i] - $grades[1][$i]) * $weight[$i] / $maxscore[$i];
|
||||
$sumdiffs += $diff * $diff; // use squared distances
|
||||
$sumweights += $weight[$i];
|
||||
}
|
||||
break;
|
||||
case 2 : // error banded grading
|
||||
// ignore maxscores here, the grades are either 0 or 1,
|
||||
for ($i=0; $i < $workshop->nelements; $i++) {
|
||||
$diff = ($grades[0][$i] - $grades[1][$i]) * $weight[$i];
|
||||
$sumdiffs += $diff * $diff; // use squared distances
|
||||
$sumweights += $weight[$i];
|
||||
}
|
||||
break;
|
||||
case 3 : // criterion grading
|
||||
// here we only need to look at the difference between the "zero" grade elements
|
||||
$diff = ($grades[0][0] - $grades[1][0]) / (count($elementsraw) - 1);
|
||||
$sumdiffs = $diff * $diff;
|
||||
$sumweights = 1;
|
||||
break;
|
||||
}
|
||||
// convert to a sensible grade (always out of 100)
|
||||
$COMP = (object)$WORKSHOP_ASSESSMENT_COMPS[$workshop->assessmentcomps];
|
||||
$factor = $COMP->value;
|
||||
$gradinggrade = (($factor - ($sumdiffs / $sumweights)) / $factor) * 100;
|
||||
if ($gradinggrade < 0) {
|
||||
$gradinggrade = 0;
|
||||
}
|
||||
return $gradinggrade;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_count_ungraded_assessments($workshop) {
|
||||
// function returns the number of ungraded assessments (ANY assessments)
|
||||
|
||||
return count_records("workshop_assessments", "workshopid", $workshop->id, "timegraded", 0) ;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_file_area($workshop, $submission) {
|
||||
return make_upload_directory( workshop_file_area_name($workshop, $submission) );
|
||||
@@ -1059,6 +1146,24 @@ function workshop_get_assess_logs($course, $timestart) {
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_get_assessments($submission, $all = '') {
|
||||
// Return assessments for this submission ordered oldest first, newest last
|
||||
// new assessments made within the editing time are NOT returned unless the
|
||||
// second argument is set to ALL
|
||||
global $CFG;
|
||||
|
||||
if ($all != 'ALL') {
|
||||
$timenow = time();
|
||||
return get_records_select("workshop_assessments", "(submissionid = $submission->id) AND
|
||||
(timecreated < $timenow - $CFG->maxeditingtime)", "timecreated DESC");
|
||||
} else {
|
||||
return get_records_select("workshop_assessments", "submissionid = $submission->id",
|
||||
"timecreated DESC");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_get_comment_logs($course, $timestart) {
|
||||
// get the "comment" entries for this user and add the first and last names (which may not be used)...
|
||||
@@ -1120,6 +1225,35 @@ function workshop_get_student_submission($workshop, $user) {
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_get_student_submissions($workshop, $order = "title") {
|
||||
// Return all ENROLLED student submissions
|
||||
global $CFG;
|
||||
|
||||
if ($order == "title") {
|
||||
$order = "s.title";
|
||||
}
|
||||
if ($order == "name") {
|
||||
$order = "a.lastname, a.firstname";
|
||||
}
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$workshop->course' AND";
|
||||
$site = get_site();
|
||||
if ($workshop->course == $site->id) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT s.* FROM {$CFG->prefix}workshop_submissions s,
|
||||
{$CFG->prefix}user_students u, {$CFG->prefix}user a
|
||||
WHERE $select s.userid = u.userid
|
||||
AND a.id = u.userid
|
||||
AND s.workshopid = $workshop->id
|
||||
AND s.timecreated > 0
|
||||
ORDER BY $order");
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_get_submit_logs($course, $timestart) {
|
||||
// get the "submit" entries and add the first and last names...
|
||||
@@ -1189,33 +1323,10 @@ function workshop_get_unmailed_resubmissions($cutofftime) {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_get_student_submissions($workshop, $order = "title") {
|
||||
// Return all ENROLLED student submissions
|
||||
global $CFG;
|
||||
|
||||
if ($order == "title") {
|
||||
$order = "s.title";
|
||||
}
|
||||
if ($order == "name") {
|
||||
$order = "a.firstname, a.lastname";
|
||||
}
|
||||
if ($order == "grade") {
|
||||
$order = "$workshop->teacherweight * s.teachergrade + $workshop->peerweight * s.peergrade DESC";
|
||||
}
|
||||
|
||||
// make sure it works on the site course
|
||||
$select = "u.course = '$workshop->course' AND";
|
||||
if ($workshop->course == SITEID) {
|
||||
$select = '';
|
||||
}
|
||||
|
||||
return get_records_sql("SELECT s.* FROM {$CFG->prefix}workshop_submissions s,
|
||||
{$CFG->prefix}user_students u, {$CFG->prefix}user a
|
||||
WHERE $select s.userid = u.userid
|
||||
AND a.id = u.userid
|
||||
AND s.workshopid = $workshop->id
|
||||
AND s.timecreated > 0
|
||||
ORDER BY $order");
|
||||
function workshop_get_user_assessments($workshop, $user) {
|
||||
// Return all the user's assessments, newest first, oldest last (hot, warm and cold ones)
|
||||
return get_records_select("workshop_assessments", "workshopid = $workshop->id AND userid = $user->id",
|
||||
"timecreated DESC");
|
||||
}
|
||||
|
||||
|
||||
@@ -1228,4 +1339,251 @@ function workshop_get_user_submissions($workshop, $user) {
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_grade_assessments($workshop) {
|
||||
global $WORKSHOP_EWEIGHTS;
|
||||
|
||||
// timeout after 10 minutes
|
||||
@set_time_limit(600);
|
||||
|
||||
$timenow = time();
|
||||
|
||||
// set minumim value for the variance (of the elements)
|
||||
$minvar = 0.05;
|
||||
|
||||
// calculate the means for each submission using just the "good" assessments
|
||||
if ($submissions = get_records("workshop_submissions", "workshopid", $workshop->id)) {
|
||||
foreach ($submissions as $submission) {
|
||||
$nassessments[$submission->id] = 0;
|
||||
if ($assessments = workshop_get_assessments($submission)) {
|
||||
foreach ($assessments as $assessment) {
|
||||
// test if assessment is "good", a teacher assessment always "good", but may be weighted out
|
||||
if (isteacher($workshop->course, $assessment->userid)) {
|
||||
if (!$workshop->teacherweight) {
|
||||
// drop teacher's assessment as weight is zero
|
||||
continue;
|
||||
}
|
||||
} elseif ((!$assessment->gradinggrade and $assessment->timegraded) or
|
||||
($workshop->agreeassessments and !$assessment->timeagreed)) {
|
||||
// it's a duff assessment, or it's not been agreed
|
||||
continue;
|
||||
}
|
||||
if (isset($num[$submission->id])) {
|
||||
if (isteacher($workshop->course, $assessment->userid)) {
|
||||
$num[$submission->id] += $workshop->teacherweight; // weight teacher's assessment
|
||||
} else {
|
||||
$num[$submission->id]++; // number of assessments
|
||||
}
|
||||
$nassessments[$submission->id]++;
|
||||
} else {
|
||||
if (isteacher($workshop->course, $assessment->userid)) {
|
||||
$num[$submission->id] = $workshop->teacherweight;
|
||||
} else {
|
||||
$num[$submission->id] = 1;
|
||||
}
|
||||
$nassessments[$submission->id] = 1;
|
||||
}
|
||||
for ($i = 0; $i < $workshop->nelements; $i++) {
|
||||
$grade = get_field("workshop_grades", "grade",
|
||||
"assessmentid", $assessment->id, "elementno", $i);
|
||||
if (isset($sum[$submission->id][$i])) {
|
||||
if (isteacher($workshop->course, $assessment->userid)) {
|
||||
$sum[$submission->id][$i] += $workshop->teacherweight * $grade; // teacher's grade
|
||||
} else {
|
||||
$sum[$submission->id][$i] += $grade; // student's grade
|
||||
}
|
||||
} else {
|
||||
if (isteacher($workshop->course, $assessment->userid)) {
|
||||
$sum[$submission->id][$i] = $workshop->teacherweight * $grade; // teacher's grade
|
||||
} else {
|
||||
$sum[$submission->id][$i] = $grade; // students's grade
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($num)) {
|
||||
// no assessments yet
|
||||
return;
|
||||
}
|
||||
reset($num);
|
||||
// calculate the means for each submission
|
||||
$total = 0;
|
||||
foreach ($num as $submissionid => $n) {
|
||||
if ($n) { // stop division by zero
|
||||
for ($i = 0; $i < $workshop->nelements; $i++) {
|
||||
$mean[$submissionid][$i] = $sum[$submissionid][$i] / $n;
|
||||
// echo "Submission: $submissionid; Element: $i; Mean: {$mean[$submissionid][$i]}<br />\n";
|
||||
}
|
||||
$total += $n; // weighted total
|
||||
}
|
||||
}
|
||||
echo "<p align=\"center\">".get_string("numberofsubmissions", "workshop", count($num))."<br />\n";
|
||||
echo get_string("numberofassessmentsweighted", "workshop", $total)."</p>\n";
|
||||
|
||||
// now get an estimate of the standard deviation of each element in the assessment
|
||||
// this is just a rough measure, all assessments are included and teacher's assesments are not weighted
|
||||
$n = 0;
|
||||
for ($i = 0; $i < $workshop->nelements; $i++) {
|
||||
$var[$i] = 0;
|
||||
}
|
||||
foreach ($submissions as $submission) {
|
||||
if ($assessments = workshop_get_assessments($submission)) {
|
||||
foreach ($assessments as $assessment) {
|
||||
$n++;
|
||||
for ($i = 0; $i < $workshop->nelements; $i++) {
|
||||
$grade = get_field("workshop_grades", "grade",
|
||||
"assessmentid", $assessment->id, "elementno", $i);
|
||||
$temp = $mean[$submission->id][$i] - $grade;
|
||||
$var[$i] += $temp * $temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i < $workshop->nelements; $i++) {
|
||||
$sd[$i] = sqrt($var[$i] / ($n - 1));
|
||||
echo "<p align=\"center\">".get_string("standarddeviationofelement", "workshop", $i+1)." $sd[$i]<br />";
|
||||
if ($sd[$i] <= $minvar) {
|
||||
print_string("standarddeviationnote", "workshop")."<br />\n";
|
||||
}
|
||||
echo "</p>\n";
|
||||
}
|
||||
|
||||
// first get the assignment elements for maxscores (not used) and weights (used)...
|
||||
$elementsraw = get_records("workshop_elements", "workshopid", $workshop->id, "elementno ASC");
|
||||
foreach ($elementsraw as $element) {
|
||||
$maxscore[] = $element->maxscore; // to renumber index 0,1,2...
|
||||
$weight[] = $element->weight; // to renumber index 0,1,2...
|
||||
}
|
||||
|
||||
// ...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.)
|
||||
foreach ($submissions as $submission) {
|
||||
if ($nassessments[$submission->id] > 2) {
|
||||
if ($assessments = workshop_get_assessments($submission)) {
|
||||
foreach ($assessments as $assessment) {
|
||||
if ($workshop->agreeassessments and !$assessment->timeagreed) {
|
||||
// ignore assessments that have not been agreed
|
||||
continue;
|
||||
}
|
||||
$var = 0;
|
||||
for ($i = 0; $i < $workshop->nelements; $i++) {
|
||||
$grade = get_field("workshop_grades", "grade",
|
||||
"assessmentid", $assessment->id, "elementno", $i);
|
||||
if ($sd[$i] > $minvar) {
|
||||
$temp = ($mean[$submission->id][$i] - $grade) *
|
||||
$WORKSHOP_EWEIGHTS[$weight[$i]] / $sd[$i];
|
||||
} else {
|
||||
$temp = 0;
|
||||
}
|
||||
$var += $temp * $temp;
|
||||
}
|
||||
// find the "best" assessment of each submission
|
||||
if (!isset($lowest[$submission->id])) {
|
||||
$lowest[$submission->id] = $var;
|
||||
$bestassessment[$submission->id] = $assessment->id;
|
||||
} else {
|
||||
if ($lowest[$submission->id] > $var) {
|
||||
$lowest[$submission->id] = $var;
|
||||
$bestassessment[$submission->id] = $assessment->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// run thru the submissions again setting the grading grades using the "best" as the reference
|
||||
$ndrop = 0;
|
||||
foreach ($submissions as $submission) {
|
||||
if ($assessments = workshop_get_assessments($submission)) {
|
||||
if ($nassessments[$submission->id] > 2) {
|
||||
if (!$best = get_record("workshop_assessments", "id", $bestassessment[$submission->id])) {
|
||||
error("Workshop assessment analysis: cannot find best assessment");
|
||||
}
|
||||
foreach ($assessments as $assessment) {
|
||||
if ($assessment->id == $bestassessment->id) {
|
||||
// it's the best one, set the grading grade to the maximum
|
||||
set_field("workshop_assessments", "gradinggrade", 100, "id", $assessment->id);
|
||||
set_field("workshop_assessments", "timegraded", $timenow, "id", $assessment->id);
|
||||
} else {
|
||||
// it's one of the pack, compare with the best...
|
||||
$gradinggrade = workshop_compare_assessments($workshop, $best, $assessment);
|
||||
// ...and save the grade for the assessment
|
||||
set_field("workshop_assessments", "gradinggrade", $gradinggrade, "id", $assessment->id);
|
||||
set_field("workshop_assessments", "timegraded", $timenow, "id", $assessment->id);
|
||||
if (!$gradinggrade) {
|
||||
$ndrop++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "<p align=\"center\">".get_string("numberofassessmentsdropped", "workshop", $ndrop)."</p>\n";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_gradinggrade($workshop, $student) {
|
||||
// returns the current (external) grading grade of the based on their (cold) assessments
|
||||
// (needed as it's called by grade)
|
||||
|
||||
$gradinggrade = 0;
|
||||
if ($assessments = workshop_get_user_assessments($workshop, $student)) {
|
||||
$n = 0;
|
||||
foreach ($assessments as $assessment) {
|
||||
$gradinggrade += $assessment->gradinggrade;
|
||||
$n++;
|
||||
}
|
||||
if ($n < ($workshop->ntassessments + $workshop->nsassessments)) { // the minimum students should do
|
||||
$n = $workshop->ntassessments + $workshop->nsassessments;
|
||||
}
|
||||
$gradinggrade = $gradinggrade / $n;
|
||||
}
|
||||
return number_format($gradinggrade * $workshop->gradinggrade / 100, 1);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_submission_grade($workshop, $submission) {
|
||||
// returns the current (external) grade of the submission based on the "good" (cold) assessments
|
||||
// (needed as it's called by grade)
|
||||
|
||||
$grade = 0;
|
||||
if ($assessments = workshop_get_assessments($submission)) {
|
||||
$n = 0;
|
||||
foreach ($assessments as $assessment) {
|
||||
if ($workshop->agreeassessments and !$assessment->timeagreed) {
|
||||
// ignore assessments which have not been agreed
|
||||
continue;
|
||||
}
|
||||
if ($assessment->gradinggrade or !$assessment->timegraded) {
|
||||
// a good assessment (or one that has not been graded yet)
|
||||
if (isteacher($workshop->course, $assessment->userid)) {
|
||||
$grade += $workshop->teacherweight * $assessment->grade;
|
||||
$n += $workshop->teacherweight;
|
||||
} else {
|
||||
$grade += $assessment->grade;
|
||||
$n++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($n) { // stop division by zero
|
||||
$grade = $grade / $n;
|
||||
}
|
||||
}
|
||||
return number_format($grade * $workshop->grade / 100, 1);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
+455
-309
File diff suppressed because it is too large
Load Diff
+106
-9
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
// ...and fill the form if needed
|
||||
require("$CFG->dirroot/mod/workshop/lib.php"); // for parameter arrays
|
||||
// ...and fill the form if needed
|
||||
if (empty($form->name)) {
|
||||
$form->name = "";
|
||||
}
|
||||
@@ -9,9 +10,15 @@
|
||||
if (empty($form->format)) {
|
||||
$form->format = "";
|
||||
}
|
||||
if (!isset($form->gradinggrade)) {
|
||||
$form->gradinggrade = 100;
|
||||
}
|
||||
if (!isset($form->grade)) {
|
||||
$form->grade = 100;
|
||||
}
|
||||
if (!isset($form->gradingstrategy)) {
|
||||
$form->gradingstrategy = 1; // default is accumulative
|
||||
}
|
||||
if (!isset($form->nelements)) {
|
||||
$form->nelements = 1;
|
||||
}
|
||||
@@ -21,9 +28,18 @@
|
||||
if (!isset($form->ntassessments)) {
|
||||
$form->ntassessments = 0;
|
||||
}
|
||||
if (!isset($form->assessmentcomps)) {
|
||||
$form->assessmentcomps = 2;
|
||||
}
|
||||
if (!isset($form->nsassessments)) {
|
||||
$form->nsassessments = 0;
|
||||
}
|
||||
if (!isset($form->teacherweight)) {
|
||||
$form->teacherweight = 1;
|
||||
}
|
||||
if (!isset($form->overallocation)) {
|
||||
$form->overallocation = 0;
|
||||
}
|
||||
if (empty($form->includeself)) {
|
||||
$form->includeself = "";
|
||||
}
|
||||
@@ -33,6 +49,12 @@
|
||||
if (empty($form->hidegrades)) {
|
||||
$form->hidegrades = "";
|
||||
}
|
||||
if (empty($form->showleaguetable)) {
|
||||
$form->showleaguetable = 0;
|
||||
}
|
||||
if (empty($form->anonymous)) {
|
||||
$form->anonymous = 0;
|
||||
}
|
||||
if (empty($form->maxbytes)) {
|
||||
$form->maxbytes = "";
|
||||
}
|
||||
@@ -88,13 +110,24 @@
|
||||
</tr>
|
||||
|
||||
<tr valign=top>
|
||||
<td align=right><P><B><?php print_string("maximumgrade") ?>:</B></P></TD>
|
||||
<td align=right><P><B><?php print_string("gradeforassessments", "workshop") ?>:</B></P></TD>
|
||||
<td>
|
||||
<?php
|
||||
for ($i=100; $i>=0; $i--) {
|
||||
$grades[$i] = $i;
|
||||
}
|
||||
choose_from_menu($grades, "gradinggrade", "$form->gradinggrade", "");
|
||||
helpbutton("gradinggrade", get_string("gradeforassessments", "workshop"), "workshop");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign=top>
|
||||
<td align=right><P><B><?php print_string("gradeforsubmission", "workshop") ?>:</B></P></TD>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($grades, "grade", "$form->grade", "");
|
||||
helpbutton("grade", get_string("gradeforsubmission", "workshop"), "workshop");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -103,11 +136,7 @@
|
||||
<td align=right><P><B><?php print_string("gradingstrategy", "workshop") ?>:</B></P></TD>
|
||||
<td>
|
||||
<?PHP
|
||||
require("$CFG->dirroot/mod/workshop/lib.php");
|
||||
if (!isset($form->gradingstrategy)) {
|
||||
$form->gradingstrategy = 1; // default
|
||||
}
|
||||
choose_from_menu($WORKSHOP_TYPE, "gradingstrategy", $form->gradingstrategy, "");
|
||||
choose_from_menu($WORKSHOP_TYPE, "gradingstrategy", $form->gradingstrategy, "");
|
||||
helpbutton("gradingstrategy", get_string("gradingstrategy", "workshop"), "workshop");
|
||||
?>
|
||||
</td>
|
||||
@@ -141,6 +170,7 @@
|
||||
<td align=right><P><B><?php print_string("numberofassessmentsofteachersexamples", "workshop") ?>:</B></P></TD>
|
||||
<td>
|
||||
<?PHP
|
||||
unset($numbers);
|
||||
for ($i=20; $i>=0; $i--) {
|
||||
$numbers[$i] = $i;
|
||||
}
|
||||
@@ -150,10 +180,25 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align=right><P><B><?php print_string("comparisonofassessments", "workshop") ?>:</B></P></TD>
|
||||
<td>
|
||||
<?php
|
||||
// set up comparison names
|
||||
foreach ($WORKSHOP_ASSESSMENT_COMPS as $KEY => $COMPARISON) {
|
||||
$COMPARISONS[] = $COMPARISON['name'];
|
||||
}
|
||||
choose_from_menu($COMPARISONS, "assessmentcomps", $form->assessmentcomps, "");
|
||||
helpbutton("comparisonofassessments", get_string("comparisonofassessments", "workshop"), "workshop");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign=top>
|
||||
<td align=right><P><B><?php print_string("numberofassessmentsofstudentsubmissions", "workshop") ?>:</B></P></TD>
|
||||
<td>
|
||||
<?PHP
|
||||
unset($numbers);
|
||||
for ($i=20; $i>=0; $i--) {
|
||||
$numbers[$i] = $i;
|
||||
}
|
||||
@@ -163,6 +208,34 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign=top>
|
||||
<td align=right><P><B><?php print_string("weightforteacherassessments", "workshop") ?>:</B></P></TD>
|
||||
<td>
|
||||
<?PHP
|
||||
unset($numbers);
|
||||
for ($i=10; $i>=0; $i--) {
|
||||
$numbers[$i] = $i;
|
||||
}
|
||||
choose_from_menu($numbers, "teacherweight", $form->teacherweight, "");
|
||||
helpbutton("teacherweight", get_string("weightforteacherassessments", "workshop"), "workshop");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign=top>
|
||||
<td align=right><p><b><?php print_string("overallocation", "workshop") ?>:</b></p></td>
|
||||
<td>
|
||||
<?php
|
||||
unset($numbers);
|
||||
for ($i=2; $i>=0; $i--) {
|
||||
$numbers[$i] = $i;
|
||||
}
|
||||
choose_from_menu($numbers, "overallocation", "$form->overallocation", "");
|
||||
helpbutton("overallocation", get_string("overallocation", "workshop"), "workshop");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align=right><P><B><?php print_string("selfassessment", "workshop") ?>:</B></P></TD>
|
||||
<td>
|
||||
@@ -178,7 +251,6 @@
|
||||
<td align=right><P><B><?php print_string("assessmentsmustbeagreed", "workshop") ?>:</B></P></TD>
|
||||
<td>
|
||||
<?PHP
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "agreeassessments", $form->agreeassessments, "");
|
||||
helpbutton("agreeassessments", get_string("assessmentsmustbeagreed", "workshop"), "workshop");
|
||||
?>
|
||||
@@ -189,13 +261,38 @@
|
||||
<td align=right><P><B><?php print_string("hidegradesbeforeagreement", "workshop") ?>:</B></P></TD>
|
||||
<td>
|
||||
<?PHP
|
||||
$options[0] = get_string("no"); $options[1] = get_string("yes");
|
||||
choose_from_menu($options, "hidegrades", $form->hidegrades, "");
|
||||
helpbutton("showinggrades", get_string("hidegradesbeforeagreement", "workshop"), "workshop");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align=right><p><b><?php print_string("leaguetable", "workshop"); ?>:</b></p></td>
|
||||
<td>
|
||||
<?php
|
||||
unset($numbers);
|
||||
$numbers[22] = '100';
|
||||
$numbers[21] = 50;
|
||||
for ($i=20; $i>=0; $i--) {
|
||||
$numbers[$i] = $i;
|
||||
}
|
||||
choose_from_menu($numbers, "showleaguetable", $form->showleaguetable, "");
|
||||
helpbutton("leaguetable", get_string("showleaguetable", "workshop"), "workshop");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align=right><p><b><? print_string("hidenamesfromstudents", "workshop", $course->students) ?>:</b></p></td>
|
||||
<td>
|
||||
<?php
|
||||
choose_from_menu($options, "anonymous", $form->anonymous, "");
|
||||
helpbutton("anonymous", get_string("hidenamesfromstudents", "workshop", $course->students), "workshop");
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr valign=top>
|
||||
<td align=right><P><B><?php print_string("maximumsize", "workshop") ?>:</B></P></TD>
|
||||
<td>
|
||||
|
||||
@@ -68,20 +68,14 @@
|
||||
$workshop->maxbytes = backup_todb($info['MOD']['#']['MAXBYTES']['0']['#']);
|
||||
$workshop->deadline = backup_todb($info['MOD']['#']['DEADLINE']['0']['#']);
|
||||
$workshop->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']);
|
||||
$workshop->gradinggrade = backup_todb($info['MOD']['#']['GRADINGGRADE']['0']['#']);
|
||||
$workshop->ntassessments = backup_todb($info['MOD']['#']['NTASSESSMENTS']['0']['#']);
|
||||
$workshop->assessmentcomps = backup_todb($info['MOD']['#']['ASSESSMENTCOMPS']['0']['#']);
|
||||
$workshop->nsassessments = backup_todb($info['MOD']['#']['NSASSESSMENTS']['0']['#']);
|
||||
$workshop->overallocation = backup_todb($info['MOD']['#']['OVERALLOCATION']['0']['#']);
|
||||
$workshop->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
|
||||
$workshop->mergegrades = backup_todb($info['MOD']['#']['MERGEGRADES']['0']['#']);
|
||||
$workshop->teacherweight = backup_todb($info['MOD']['#']['TEACHERWEIGHT']['0']['#']);
|
||||
$workshop->peerweight = backup_todb($info['MOD']['#']['PEERWEIGHT']['0']['#']);
|
||||
$workshop->includeteachersgrade = backup_todb($info['MOD']['#']['INCLUDETEACHERSGRADE']['0']['#']);
|
||||
$workshop->biasweight = backup_todb($info['MOD']['#']['BIASWEIGHT']['0']['#']);
|
||||
$workshop->reliabilityweight = backup_todb($info['MOD']['#']['RELIABILITYWEIGHT']['0']['#']);
|
||||
$workshop->gradingweight = backup_todb($info['MOD']['#']['GRADINGWEIGHT']['0']['#']);
|
||||
$workshop->showleaguetable = backup_todb($info['MOD']['#']['SHOWLEAGUETABLE']['0']['#']);
|
||||
$workshop->teacherloading = backup_todb($info['MOD']['#']['TEACHERLOADING']['0']['#']);
|
||||
$workshop->assessmentstodrop = backup_todb($info['MOD']['#']['ASSESSMENTSTODROP']['0']['#']);
|
||||
|
||||
//The structure is equal to the db, so insert the workshop
|
||||
$newid = insert_record ("workshop",$workshop);
|
||||
|
||||
+111
-1221
File diff suppressed because it is too large
Load Diff
@@ -11,11 +11,9 @@
|
||||
if (! $cm = get_record("course_modules", "id", $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
|
||||
if (! $workshop = get_record("workshop", "id", $cm->instance)) {
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
@@ -108,8 +106,8 @@
|
||||
else {
|
||||
notify(get_string("uploadnofilefound", "assignment"));
|
||||
}
|
||||
}
|
||||
print_continue("view.php?a=$workshop->id");
|
||||
}
|
||||
print_continue("view.php?id=$cm->id");
|
||||
|
||||
print_footer($course);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// This fragment is called by /admin/index.php
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2004060400;
|
||||
$module->version = 2004081100;
|
||||
$module->requires = 2004052505; // Requires this Moodle version
|
||||
$module->cron = 60;
|
||||
|
||||
|
||||
+225
-331
@@ -19,34 +19,18 @@
|
||||
require("../../config.php");
|
||||
require("lib.php");
|
||||
require("locallib.php");
|
||||
|
||||
optional_variable($id); // Course Module ID
|
||||
optional_variable($a); // workshop ID
|
||||
|
||||
require_variable($id); // Course Module ID
|
||||
|
||||
// get some useful stuff...
|
||||
if ($id) {
|
||||
if (! $cm = get_record("course_modules", "id", $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
}
|
||||
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
|
||||
if (! $workshop = get_record("workshop", "id", $cm->instance)) {
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
|
||||
} else {
|
||||
if (! $workshop = get_record("workshop", "id", $a)) {
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
if (! $course = get_record("course", "id", $workshop->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $course->id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
}
|
||||
if (! $cm = get_record("course_modules", "id", $id)) {
|
||||
error("Course Module ID was incorrect");
|
||||
}
|
||||
if (! $course = get_record("course", "id", $cm->course)) {
|
||||
error("Course is misconfigured");
|
||||
}
|
||||
if (! $workshop = get_record("workshop", "id", $cm->instance)) {
|
||||
error("Course module is incorrect");
|
||||
}
|
||||
|
||||
require_login($course->id);
|
||||
@@ -66,258 +50,163 @@
|
||||
|
||||
optional_variable($action);
|
||||
if (isteacher($course->id)) {
|
||||
if (empty($action)) { // no action specified, either go straight to elements page else the admin page
|
||||
// has the assignment any elements
|
||||
if (count_records("workshop_elements", "workshopid", $workshop->id) >= $workshop->nelements) {
|
||||
$action = "teachersview";
|
||||
}
|
||||
else {
|
||||
redirect("assessments.php?action=editelements&id=$cm->id");
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (!isguest()) { // it's a student then
|
||||
if (!$cm->visible) {
|
||||
notice(get_string("activityiscurrentlyhidden"));
|
||||
}
|
||||
switch ($workshop->phase) {
|
||||
case 0 :
|
||||
case 1 : $action = 'notavailable'; break;
|
||||
case 2 :
|
||||
case 3 :
|
||||
case 4 : $action = 'studentsview'; break;
|
||||
case 5 : $action = 'notavailable'; break;
|
||||
case 6 : $action = 'displayfinalgrade';
|
||||
}
|
||||
}
|
||||
else { // it's a guest, oh no!
|
||||
$action = 'notavailable';
|
||||
}
|
||||
|
||||
|
||||
/************** allow (peer) assessments only (move to phase 4) (for teachers)**/
|
||||
if ($action == 'allowassessments') {
|
||||
if (empty($action)) { // no action specified, either go straight to elements page else the admin page
|
||||
// has the assignment any elements
|
||||
if (count_records("workshop_elements", "workshopid", $workshop->id) >= $workshop->nelements) {
|
||||
$action = "teachersview";
|
||||
}
|
||||
else {
|
||||
redirect("assessments.php?action=editelements&id=$cm->id");
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (!isguest()) { // it's a student then
|
||||
if (!$cm->visible) {
|
||||
notice(get_string("activityiscurrentlyhidden"));
|
||||
}
|
||||
switch ($workshop->phase) {
|
||||
case 0 :
|
||||
case 1 : $action = 'notavailable'; break;
|
||||
case 2 :
|
||||
case 3 :
|
||||
case 4 : $action = 'studentsview'; break;
|
||||
case 5 : $action = 'displayfinalgrade';
|
||||
}
|
||||
}
|
||||
else { // it's a guest, oh no!
|
||||
$action = 'notavailable';
|
||||
}
|
||||
|
||||
|
||||
/************** allow (peer) assessments only (move to phase 4) (for teachers)**/
|
||||
if ($action == 'allowassessments') {
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
// move to phase 4
|
||||
set_field("workshop", "phase", 4, "id", "$workshop->id");
|
||||
add_to_log($course->id, "workshop", "assessments only", "view.php?id=$cm->id", "$workshop->id", $cm->id);
|
||||
redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 4));
|
||||
}
|
||||
|
||||
// move to phase 4
|
||||
set_field("workshop", "phase", 4, "id", "$workshop->id");
|
||||
add_to_log($course->id, "workshop", "assessments only", "view.php?id=$cm->id", "$workshop->id", $cm->id);
|
||||
redirect("view.php?id=$cm->id", get_string("movingtophase", "workshop", 4));
|
||||
}
|
||||
|
||||
|
||||
/************** allow both (submissions and assessments) (move to phase 3) (for teachers)**/
|
||||
if ($action == 'allowboth') {
|
||||
/************** allow both (submissions and assessments) (move to phase 3) (for teachers)**/
|
||||
if ($action == 'allowboth') {
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
// move to phase 3
|
||||
set_field("workshop", "phase", 3, "id", "$workshop->id");
|
||||
add_to_log($course->id, "workshop", "allow both", "view.php?id=$cm->id", "$workshop->id", $cm->id);
|
||||
redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 3));
|
||||
}
|
||||
|
||||
// move to phase 3
|
||||
set_field("workshop", "phase", 3, "id", "$workshop->id");
|
||||
add_to_log($course->id, "workshop", "allow both", "view.php?id=$cm->id", "$workshop->id", $cm->id);
|
||||
redirect("view.php?id=$cm->id", get_string("movingtophase", "workshop", 3));
|
||||
}
|
||||
|
||||
|
||||
/************** allow submissions only (move to phase 2) (for teachers)**/
|
||||
if ($action == 'allowsubmissions') {
|
||||
/************** allow submissions only (move to phase 2) (for teachers)**/
|
||||
if ($action == 'allowsubmissions') {
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
// move to phase 2, check that teacher has made enough submissions
|
||||
if (workshop_count_teacher_submissions($workshop) < $workshop->ntassessments) {
|
||||
redirect("view.php?id=$cm->id", get_string("notenoughexamplessubmitted", "workshop",
|
||||
$course->teacher));
|
||||
}
|
||||
else {
|
||||
}
|
||||
else {
|
||||
if ($n = workshop_count_teacher_submissions_for_assessment($workshop, $USER)) {
|
||||
notify(get_string("teachersubmissionsforassessment", "workshop", $n));
|
||||
}
|
||||
set_field("workshop", "phase", 2, "id", "$workshop->id");
|
||||
add_to_log($course->id, "workshop", "submissions", "view.php?id=$cm->id", "$workshop->id", $cm->id);
|
||||
redirect("view.php?id=$cm->id", get_string("movingtophase", "workshop", 2));
|
||||
}
|
||||
}
|
||||
|
||||
add_to_log($course->id, "workshop", "submissions", "view.php?id=$cm->id", "$workshop->id", $cm->id);
|
||||
redirect("view.php?id=$cm->id", get_string("movingtophase", "workshop", 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************** close workshop for student assessments/submissions (move to phase 5) (for teachers)**/
|
||||
elseif ($action == 'closeworkshop') {
|
||||
/****************** display final grade (for students) ************************************/
|
||||
elseif ($action == 'displayfinalgrade' ) {
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
// move to phase 5
|
||||
set_field("workshop", "phase", 5, "id", "$workshop->id");
|
||||
add_to_log($course->id, "workshop", "close", "view.php?id=$cm->id", "$workshop->id", $cm->id);
|
||||
redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 5));
|
||||
}
|
||||
|
||||
|
||||
/****************** display final grade (for students) ************************************/
|
||||
elseif ($action == 'displayfinalgrade' ) {
|
||||
|
||||
// get the final weights from the database
|
||||
$teacherweight = get_field("workshop","teacherweight", "id", $workshop->id);
|
||||
$peerweight = get_field("workshop","peerweight", "id", $workshop->id);
|
||||
$includeteachersgrade = get_field("workshop","includeteachersgrade", "id", $workshop->id);
|
||||
$biasweight = get_field("workshop","biasweight", "id", $workshop->id);
|
||||
$reliabilityweight = get_field("workshop","reliabilityweight", "id", $workshop->id);
|
||||
$gradingweight = get_field("workshop","gradingweight", "id", $workshop->id);
|
||||
// work out what to show in the final grades tables and what to include in the calculation of the final grade
|
||||
// teacher grades?
|
||||
if ($workshop->gradingstrategy and $teacherweight) {
|
||||
$useteachersgrades = 1;
|
||||
}
|
||||
else {
|
||||
$useteachersgrades = 0;
|
||||
}
|
||||
// peergrades?
|
||||
if ($workshop->gradingstrategy and $workshop->nsassessments and $peerweight) {
|
||||
$usepeergrades = 1;
|
||||
}
|
||||
else {
|
||||
$usepeergrades = 0;
|
||||
}
|
||||
// bias grades?
|
||||
if ((($workshop->ntassessments >= 3) or ($workshop->nsassessments >= 3)) and $biasweight ) {
|
||||
$usebiasgrades = 1;
|
||||
}
|
||||
else {
|
||||
$usebiasgrades = 0;
|
||||
}
|
||||
// reliability grades?
|
||||
if ((($workshop->ntassessments >= 3) or ($workshop->nsassessments >= 3)) and $reliabilityweight ) {
|
||||
$usereliabilitygrades = 1;
|
||||
}
|
||||
else {
|
||||
$usereliabilitygrades = 0;
|
||||
}
|
||||
// grading grades?
|
||||
if (($workshop->ntassessments or $workshop->nsassessments) and $gradingweight ) {
|
||||
$usegradinggrades = 1;
|
||||
}
|
||||
else {
|
||||
$usegradinggrades = 0;
|
||||
}
|
||||
|
||||
// show the final grades as stored in the tables...
|
||||
print_heading_with_help(get_string("displayoffinalgrades", "workshop"), "finalgrades", "workshop");
|
||||
if ($submissions = workshop_get_user_submissions($workshop, $USER)) { // any submissions from user?
|
||||
echo "<center><table border=\"1\" width=\"90%\"><tr>";
|
||||
echo "<td><b>".get_string("submissions", "workshop")."</b></td>";
|
||||
if ($useteachersgrades) {
|
||||
echo "<td align=\"center\"><b>".get_string("teacherassessments", "workshop",
|
||||
$course->teacher)."</b></td>";
|
||||
}
|
||||
if ($usepeergrades) {
|
||||
echo "<td align=\"center\"><b>".get_string("studentassessments", "workshop",
|
||||
$course->student)."</b></td>";
|
||||
}
|
||||
|
||||
// show the final grades as stored in the tables...
|
||||
print_heading_with_help(get_string("displayoffinalgrades", "workshop"), "finalgrades", "workshop");
|
||||
if ($submissions = workshop_get_user_submissions($workshop, $USER)) { // any submissions from user?
|
||||
echo "<center><table border=\"1\" width=\"90%\"><tr>";
|
||||
echo "<td><b>".get_string("submissions", "workshop")."</b></td>";
|
||||
echo "<td align=\"center\"><b>".get_string("assessmentsdone", "workshop")."</b></td>";
|
||||
if ($usebiasgrades) {
|
||||
echo "<td align=\"center\"><b>".get_string("gradeforbias", "workshop")."</b></td>";
|
||||
}
|
||||
if ($usereliabilitygrades) {
|
||||
echo "<td align=\"center\"><b>".get_string("gradeforreliability", "workshop")."</b></td>";
|
||||
}
|
||||
if ($usegradinggrades) {
|
||||
echo "<td align=\"center\"><b>".get_string("gradeforassessments", "workshop")."</b></td>";
|
||||
}
|
||||
echo "<td align=\"center\"><b>".get_string("gradeforassessments", "workshop")."</b></td>";
|
||||
echo "<td align=\"center\"><b>".get_string("teacherassessments", "workshop",
|
||||
$course->teacher)."</b></td>";
|
||||
echo "<td align=\"center\"><b>".get_string("studentassessments", "workshop",
|
||||
$course->student)."</b></td>";
|
||||
echo "<td align=\"center\"><b>".get_string("gradeforsubmission", "workshop")."</b></td>";
|
||||
echo "<td align=\"center\"><b>".get_string("overallgrade", "workshop")."</b></td></TR>\n";
|
||||
// now the weights
|
||||
echo "<TR><td><b>".get_string("weights", "workshop")."</b></td>";
|
||||
if ($useteachersgrades) {
|
||||
echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$teacherweight]</b></td>\n";
|
||||
}
|
||||
if ($usepeergrades) {
|
||||
echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$peerweight]</b></td>\n";
|
||||
}
|
||||
echo "<td><b> </b></td>\n";
|
||||
if ($usebiasgrades) {
|
||||
echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$biasweight]</b></td>\n";
|
||||
}
|
||||
if ($usereliabilitygrades) {
|
||||
echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$reliabilityweight]</b></td>\n";
|
||||
}
|
||||
if ($usegradinggrades) {
|
||||
echo "<td align=\"center\"><b>$WORKSHOP_FWEIGHTS[$gradingweight]</b></td>\n";
|
||||
}
|
||||
echo "<td><b> </b></td></TR>\n";
|
||||
$gradinggrade = workshop_gradinggrade($workshop, $USER);
|
||||
foreach ($submissions as $submission) {
|
||||
$grade = workshop_submission_grade($workshop, $submission);
|
||||
echo "<TR><td>".workshop_print_submission_title($workshop, $submission)."</td>\n";
|
||||
if ($useteachersgrades) {
|
||||
echo "<td align=\"center\">".workshop_print_submission_assessments($workshop,
|
||||
$submission, "teacher")."</td>";
|
||||
}
|
||||
if ($usepeergrades) {
|
||||
echo "<td align=\"center\">".workshop_print_submission_assessments($workshop,
|
||||
$submission, "student")."</td>";
|
||||
}
|
||||
echo "<td align=\"center\">".workshop_print_user_assessments($workshop, $USER)."</td>";
|
||||
if ($usebiasgrades) {
|
||||
echo "<td align=\"center\">$submission->biasgrade</td>";
|
||||
}
|
||||
if ($usereliabilitygrades) {
|
||||
echo "<td align=\"center\">$submission->reliabilitygrade</td>";
|
||||
}
|
||||
if ($usegradinggrades) {
|
||||
echo "<td align=\"center\">$submission->gradinggrade</td>";
|
||||
}
|
||||
echo "<td align=\"center\">$submission->finalgrade</td></TR>\n";
|
||||
echo "<td align=\"center\">$gradinggrade</td>";
|
||||
echo "<td align=\"center\">".workshop_print_submission_assessments($workshop,
|
||||
$submission, "teacher")."</td>";
|
||||
echo "<td align=\"center\">".workshop_print_submission_assessments($workshop,
|
||||
$submission, "student")."</td>";
|
||||
echo "<td align=\"center\">$grade</td>";
|
||||
echo "<td align=\"center\">".number_format($gradinggrade + $grade, 1)."</td></TR>\n";
|
||||
}
|
||||
}
|
||||
echo "</TABLE><BR CLEAR=ALL>\n";
|
||||
echo "<p>< > ".get_string("assessmentdropped", "workshop")."</p>\n";
|
||||
workshop_print_key($workshop);
|
||||
if ($workshop->showleaguetable) {
|
||||
workshop_print_league_table($workshop);
|
||||
}
|
||||
echo "<br />".get_string("allgradeshaveamaximumof", "workshop", $workshop->grade);
|
||||
}
|
||||
workshop_print_league_table($workshop);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************** make final grades available (go to phase 6) (for teachers only)********/
|
||||
elseif ($action == 'makefinalgradesavailable') {
|
||||
/****************** make final grades available (go to phase 5) (for teachers only)********/
|
||||
elseif ($action == 'makefinalgradesavailable') {
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
set_field("workshop", "phase", 6, "id", "$workshop->id");
|
||||
add_to_log($course->id, "workshop", "display grades", "view.php?id=$cm->id", "$workshop->id", $cm->id);
|
||||
redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 6));
|
||||
}
|
||||
|
||||
|
||||
/****************** assignment not available (for students)***********************/
|
||||
elseif ($action == 'notavailable') {
|
||||
print_heading(get_string("notavailable", "workshop"));
|
||||
}
|
||||
set_field("workshop", "phase", 5, "id", "$workshop->id");
|
||||
add_to_log($course->id, "workshop", "display grades", "view.php?id=$cm->id", "$workshop->id", $cm->id);
|
||||
redirect("view.php?id=$cm->id", get_string("movingtophase", "workshop", 5));
|
||||
}
|
||||
|
||||
|
||||
/****************** assignment not available (for students)***********************/
|
||||
elseif ($action == 'notavailable') {
|
||||
print_heading(get_string("notavailable", "workshop"));
|
||||
}
|
||||
|
||||
|
||||
/****************** set up assignment (move back to phase 1) (for teachers)***********************/
|
||||
elseif ($action == 'setupassignment') {
|
||||
/****************** set up assignment (move back to phase 1) (for teachers)***********************/
|
||||
elseif ($action == 'setupassignment') {
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
set_field("workshop", "phase", 1, "id", "$workshop->id");
|
||||
add_to_log($course->id, "workshop", "set up", "view.php?id=$cm->id", "$workshop->id", $cm->id);
|
||||
redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 1));
|
||||
}
|
||||
|
||||
|
||||
/****************** student's view could be in 1 of 4 stages ***********************/
|
||||
elseif ($action == 'studentsview') {
|
||||
workshop_print_assignment_info($workshop);
|
||||
// in Stage 1? - are there any teacher's submissions? and...
|
||||
// ...has student assessed the required number of the teacher's submissions
|
||||
if ($workshop->ntassessments and (!workshop_test_user_assessments($workshop, $USER))) {
|
||||
print_heading(get_string("pleaseassesstheseexamplesfromtheteacher", "workshop",
|
||||
set_field("workshop", "phase", 1, "id", "$workshop->id");
|
||||
add_to_log($course->id, "workshop", "set up", "view.php?id=$cm->id", "$workshop->id", $cm->id);
|
||||
redirect("view.php?id=$cm->id", get_string("movingtophase", "workshop", 1));
|
||||
}
|
||||
|
||||
|
||||
/****************** student's view could be in 1 of 4 stages ***********************/
|
||||
elseif ($action == 'studentsview') {
|
||||
workshop_print_assignment_info($workshop);
|
||||
// in Stage 1? - are there any teacher's submissions? and...
|
||||
// ...has student assessed the required number of the teacher's submissions
|
||||
if ($workshop->ntassessments and (!workshop_test_user_assessments($workshop, $USER))) {
|
||||
print_heading(get_string("pleaseassesstheseexamplesfromtheteacher", "workshop",
|
||||
$course->teacher));
|
||||
workshop_list_teacher_submissions($workshop, $USER);
|
||||
}
|
||||
@@ -341,11 +230,6 @@
|
||||
}
|
||||
// in stage 3? - grade other student's submissions, resubmit and list all submissions
|
||||
else {
|
||||
// list any assessments by teachers
|
||||
if (workshop_count_teacher_assessments($workshop, $USER)) {
|
||||
print_heading(get_string("assessmentsby", "workshop", $course->teachers));
|
||||
workshop_list_teacher_assessments($workshop, $USER);
|
||||
}
|
||||
// is self assessment used in this workshop?
|
||||
if ($workshop->includeself) {
|
||||
// prints a table if there are any submissions which have not been self assessed yet
|
||||
@@ -360,6 +244,11 @@
|
||||
print_heading(get_string("yourassessments", "workshop"));
|
||||
workshop_list_assessed_submissions($workshop, $USER);
|
||||
}
|
||||
// list any assessments by teachers
|
||||
if (workshop_count_teacher_assessments($workshop, $USER)) {
|
||||
print_heading(get_string("assessmentsby", "workshop", $course->teachers));
|
||||
workshop_list_teacher_assessments($workshop, $USER);
|
||||
}
|
||||
// ... and show peer assessments
|
||||
if (workshop_count_peer_assessments($workshop, $USER)) {
|
||||
print_heading(get_string("assessmentsby", "workshop", $course->students));
|
||||
@@ -384,63 +273,74 @@
|
||||
echo "<hr size=\"1\" noshade>";
|
||||
}
|
||||
}
|
||||
}
|
||||
// allow user to list their submissions and assessments in a general way????
|
||||
// print_heading("<A HREF=\"submissions.php?action=listallsubmissions&id=$cm->id\">".
|
||||
// get_string("listofallsubmissions", "workshop"));
|
||||
}
|
||||
// allow user to list their submissions and assessments in a general way????
|
||||
// print_heading("<A HREF=\"submissions.php?action=listallsubmissions&id=$cm->id\">".
|
||||
// get_string("listofallsubmissions", "workshop"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************** submission of assignment by teacher only***********************/
|
||||
elseif ($action == 'submitassignment') {
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
$strdifference = format_time($workshop->deadline - time());
|
||||
if (($workshop->deadline - time()) < 0) {
|
||||
$strdifference = "<FONT COLOR=RED>$strdifference</FONT>";
|
||||
}
|
||||
$strduedate = userdate($workshop->deadline)." ($strdifference)";
|
||||
|
||||
workshop_print_assignment_info($workshop);
|
||||
|
||||
// list previous submissions from teacher
|
||||
workshop_list_user_submissions($workshop, $USER);
|
||||
|
||||
echo "<HR SIZE=1 NOSHADE>";
|
||||
|
||||
// print upload form
|
||||
print_heading(get_string("submitassignment", "assignment").":");
|
||||
workshop_print_upload_form($workshop);
|
||||
}
|
||||
|
||||
|
||||
/****************** teacher's view - display admin page (current phase options) ************/
|
||||
elseif ($action == 'teachersview') {
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
/// Check to see if groups are being used in this workshop
|
||||
/// and if so, set $currentgroup to reflect the current group
|
||||
$changegroup = isset($_GET['group']) ? $_GET['group'] : -1; // Group change requested?
|
||||
$groupmode = groupmode($course, $cm); // Groups are being used?
|
||||
$currentgroup = get_and_set_current_group($course, $groupmode, $changegroup);
|
||||
|
||||
/// Allow the teacher to change groups (for this session)
|
||||
if ($groupmode) {
|
||||
if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
|
||||
print_group_menu($groups, $groupmode, $currentgroup, "view.php?id=$cm->id");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************** submission of assignment by teacher only***********************/
|
||||
elseif ($action == 'submitassignment') {
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
$strdifference = format_time($workshop->deadline - time());
|
||||
if (($workshop->deadline - time()) < 0) {
|
||||
$strdifference = "<FONT COLOR=RED>$strdifference</FONT>";
|
||||
}
|
||||
$strduedate = userdate($workshop->deadline)." ($strdifference)";
|
||||
|
||||
workshop_print_assignment_info($workshop);
|
||||
|
||||
// list previous submissions from teacher
|
||||
workshop_list_user_submissions($workshop, $USER);
|
||||
|
||||
echo "<HR SIZE=1 NOSHADE>";
|
||||
|
||||
// print upload form
|
||||
print_heading(get_string("submitassignment", "assignment").":");
|
||||
workshop_print_upload_form($workshop);
|
||||
}
|
||||
|
||||
|
||||
/****************** teacher's view - display admin page (current phase options) ************/
|
||||
elseif ($action == 'teachersview') {
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
print_heading_with_help(get_string("managingassignment", "workshop"), "managing", "workshop");
|
||||
|
||||
workshop_print_assignment_info($workshop);
|
||||
|
||||
$tabs->names = array("1. ".get_string("phase1", "workshop"),
|
||||
|
||||
print_heading_with_help(get_string("managingassignment", "workshop"), "managing2", "workshop");
|
||||
|
||||
workshop_print_assignment_info($workshop);
|
||||
|
||||
$tabs->names = array("1. ".get_string("phase1", "workshop"),
|
||||
"2. ".get_string("phase2", "workshop", $course->student),
|
||||
"3. ".get_string("phase3", "workshop", $course->student),
|
||||
"4. ".get_string("phase4", "workshop", $course->student),
|
||||
"5. ".get_string("phase5", "workshop"),
|
||||
"6. ".get_string("phase6", "workshop"));
|
||||
"5. ".get_string("phase5", "workshop"));
|
||||
$tabs->urls = array("view.php?id=$cm->id&action=setupassignment",
|
||||
"view.php?id=$cm->id&action=allowsubmissions",
|
||||
"view.php?id=$cm->id&action=allowboth",
|
||||
"view.php?id=$cm->id&action=allowassessments",
|
||||
"view.php?id=$cm->id&action=closeworkshop",
|
||||
"view.php?id=$cm->id&action=makefinalgradesavailable");
|
||||
if ($workshop->phase) { // phase 1 or more
|
||||
$tabs->highlight = $workshop->phase - 1;
|
||||
@@ -475,18 +375,19 @@
|
||||
case 2: // submissions and assessments
|
||||
case 3:
|
||||
case 4:
|
||||
if ($workshop->ntassessments) { // if teacher example show student assessments link
|
||||
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedteachersubmissions\">".
|
||||
get_string("ungradedassessmentsofteachersubmissions", "workshop",
|
||||
workshop_count_ungraded_assessments_teacher($workshop))."</a></b> \n";
|
||||
helpbutton("ungradedassessments_teacher",
|
||||
get_string("ungradedassessmentsofteachersubmissions", "workshop"), "workshop");
|
||||
}
|
||||
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedstudentsubmissions\">".
|
||||
get_string("ungradedassessmentsofstudentsubmissions", "workshop",
|
||||
workshop_count_ungraded_assessments_student($workshop))."</a></b> \n";
|
||||
helpbutton("ungradedassessments_student",
|
||||
get_string("ungradedassessmentsofstudentsubmissions", "workshop"), "workshop");
|
||||
if ($workshop->ntassessments) { // if teacher examples show student assessments link
|
||||
if ($n = workshop_count_teacher_submissions_for_assessment($workshop, $USER)) {
|
||||
echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentteacher\">".
|
||||
get_string("teachersubmissionsforassessment", "workshop", $n)."</a></b> \n";
|
||||
helpbutton("assessmentofexamples", get_string("teachersubmissionsforassessment",
|
||||
"workshop"), "workshop");
|
||||
}
|
||||
}
|
||||
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=gradeallassessments\">".
|
||||
get_string("ungradedassessments", "workshop",
|
||||
workshop_count_ungraded_assessments($workshop))."</a></b> \n";
|
||||
helpbutton("ungradedassessments",
|
||||
get_string("ungradedassessments", "workshop"), "workshop");
|
||||
echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">".
|
||||
get_string("studentsubmissionsforassessment", "workshop",
|
||||
workshop_count_student_submissions_for_assessment($workshop, $USER))."</a></b> \n";
|
||||
@@ -494,31 +395,24 @@
|
||||
get_string("studentsubmissionsforassessment", "workshop"), "workshop");
|
||||
break;
|
||||
|
||||
case 5: // calculate final grades
|
||||
if ($workshop->ntassessments) { // if teacher example show student assessments link
|
||||
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedteachersubmissions\">".
|
||||
get_string("ungradedassessmentsofteachersubmissions", "workshop",
|
||||
workshop_count_ungraded_assessments_teacher($workshop))."</a></b> \n";
|
||||
helpbutton("ungradedassessments_teacher",
|
||||
get_string("ungradedassessmentsofteachersubmissions", "workshop"), "workshop");
|
||||
}
|
||||
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=listungradedstudentsubmissions\">".
|
||||
get_string("ungradedassessmentsofstudentsubmissions", "workshop",
|
||||
workshop_count_ungraded_assessments_student($workshop))."</a></b> \n";
|
||||
helpbutton("ungradedassessments_student",
|
||||
get_string("ungradedassessmentsofstudentsubmissions", "workshop"), "workshop");
|
||||
case 5: // Show "Final" Grades
|
||||
if ($workshop->ntassessments) { // if teacher examples show student assessments link
|
||||
if ($n = workshop_count_teacher_submissions_for_assessment($workshop, $USER)) {
|
||||
echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentteacher\">".
|
||||
get_string("teachersubmissionsforassessment", "workshop", $n)."</a></b> \n";
|
||||
helpbutton("assessmentofexamples", get_string("teachersubmissionsforassessment",
|
||||
"workshop"), "workshop");
|
||||
}
|
||||
}
|
||||
echo "<p><b><a href=\"assessments.php?id=$cm->id&action=gradeallassessments\">".
|
||||
get_string("ungradedassessments", "workshop",
|
||||
workshop_count_ungraded_assessments($workshop))."</a></b> \n";
|
||||
helpbutton("ungradedassessments", get_string("ungradedassessments", "workshop"), "workshop");
|
||||
echo "<p><b><a href=\"submissions.php?id=$cm->id&action=listforassessmentstudent\">".
|
||||
get_string("studentsubmissionsforassessment", "workshop",
|
||||
workshop_count_student_submissions_for_assessment($workshop, $USER))."</a></b> \n";
|
||||
helpbutton("gradingsubmissions",
|
||||
get_string("studentsubmissionsforassessment", "workshop"), "workshop");
|
||||
print_heading("<a href=\"submissions.php?id=$cm->id&action=displayfinalweights\">".
|
||||
get_string("calculationoffinalgrades", "workshop")."</a>");
|
||||
print_heading("<a href=\"submissions.php?id=$cm->id&action=analysisofassessments\">".
|
||||
get_string("analysisofassessments", "workshop")."</a>");
|
||||
break;
|
||||
|
||||
case 6: // show final grades
|
||||
print_heading("<A HREF=\"submissions.php?id=$cm->id&action=displayfinalgrades\">".
|
||||
get_string("displayoffinalgrades", "workshop")."</A>");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user