mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Version 2004111000 of workshop.
This commit is contained in:
parent
647da475de
commit
9a21768212
@ -4,7 +4,8 @@
|
||||
ACTIONS handled are:
|
||||
|
||||
addcomment
|
||||
adminconfirmdelete
|
||||
addstockcomment
|
||||
adminconfirmdelete
|
||||
admindelete
|
||||
adminlist
|
||||
agreeassessment
|
||||
@ -107,6 +108,206 @@
|
||||
|
||||
|
||||
|
||||
/*************** add stock comment (by teacher ) ***************************/
|
||||
elseif ($action == 'addstockcomment') {
|
||||
|
||||
require_variable($aid);
|
||||
require_variable($elementno);
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
if (!$assessment = get_record("workshop_assessments", "id", $aid)) {
|
||||
error("workshop assessment is misconfigured");
|
||||
}
|
||||
$form = data_submitted("nomatch"); // probably always come from the same page, change this statement
|
||||
|
||||
// store the comment in the stock comments table
|
||||
if ($elementno == 99) { // it's the general comment
|
||||
$form->feedback_99 = $form->generalcomment;
|
||||
}
|
||||
$comment->workshopid = $workshop->id;
|
||||
$comment->elementno = $elementno;
|
||||
$comment->comments = $form->{"feedback_$elementno"};
|
||||
if (!(trim($comment->comments))) {
|
||||
// no comment given - just redisplay assessment form
|
||||
workshop_print_assessment($workshop, $assessment, true, true, $form->returnto);
|
||||
print_footer($course);
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!$element->id = insert_record("workshop_stockcomments", $comment)) {
|
||||
error("Could not insert comment into comment bank");
|
||||
}
|
||||
|
||||
// now upate the assessment (just the elements, the assessment itself is not updated)
|
||||
|
||||
// first get the assignment elements for maxscores and weights...
|
||||
$elementsraw = get_records("workshop_elements", "workshopid", $workshop->id, "elementno ASC");
|
||||
if (count($elementsraw) < $workshop->nelements) {
|
||||
print_string("noteonassignmentelements", "workshop");
|
||||
}
|
||||
if ($elementsraw) {
|
||||
foreach ($elementsraw as $element) {
|
||||
$elements[] = $element; // to renumber index 0,1,2...
|
||||
}
|
||||
} else {
|
||||
$elements = null;
|
||||
}
|
||||
|
||||
$timenow = time();
|
||||
// don't fiddle about, delete all the old and add the new!
|
||||
delete_records("workshop_grades", "assessmentid", $assessment->id);
|
||||
|
||||
|
||||
//determine what kind of grading we have
|
||||
switch ($workshop->gradingstrategy) {
|
||||
case 0: // no grading
|
||||
// Insert all the elements that contain something
|
||||
for ($i = 0; $i < $workshop->nelements; $i++) {
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $i;
|
||||
$element->feedback = $form->{"feedback_$i"};
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
}
|
||||
$grade = 0; // set to satisfy save to db
|
||||
break;
|
||||
|
||||
case 1: // accumulative grading
|
||||
// Insert all the elements that contain something
|
||||
foreach ($form->grade as $key => $thegrade) {
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $key;
|
||||
$element->feedback = $form->{"feedback_$key"};
|
||||
$element->grade = $thegrade;
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
}
|
||||
// now work out the grade...
|
||||
$rawgrade=0;
|
||||
$totalweight=0;
|
||||
foreach ($form->grade as $key => $grade) {
|
||||
$maxscore = $elements[$key]->maxscore;
|
||||
$weight = $WORKSHOP_EWEIGHTS[$elements[$key]->weight];
|
||||
if ($weight > 0) {
|
||||
$totalweight += $weight;
|
||||
}
|
||||
$rawgrade += ($grade / $maxscore) * $weight;
|
||||
// echo "\$key, \$maxscore, \$weight, \$totalweight, \$grade, \$rawgrade : $key, $maxscore, $weight, $totalweight, $grade, $rawgrade<br />";
|
||||
}
|
||||
$grade = 100.0 * ($rawgrade / $totalweight);
|
||||
break;
|
||||
|
||||
case 2: // error banded graded
|
||||
// Insert all the elements that contain something
|
||||
$error = 0.0;
|
||||
for ($i =0; $i < $workshop->nelements; $i++) {
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $i;
|
||||
$element->feedback = $form->{"feedback_$i"};
|
||||
$element->grade = $form->grade[$i];
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
if (empty($form->grade[$i])){
|
||||
$error += $WORKSHOP_EWEIGHTS[$elements[$i]->weight];
|
||||
}
|
||||
}
|
||||
// now save the adjustment
|
||||
unset($element);
|
||||
$i = $workshop->nelements;
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $i;
|
||||
$element->grade = $form->grade[$i];
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
$grade = ($elements[intval($error + 0.5)]->maxscore + $form->grade[$i]) * 100 / $workshop->grade;
|
||||
// do sanity check
|
||||
if ($grade < 0) {
|
||||
$grade = 0;
|
||||
} elseif ($grade > 100) {
|
||||
$grade = 100;
|
||||
}
|
||||
echo "<p><b>".get_string("weightederrorcount", "workshop", intval($error + 0.5))."</b>\n";
|
||||
break;
|
||||
|
||||
case 3: // criteria grading
|
||||
// save in the selected criteria value in element zero,
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = 0;
|
||||
$element->grade = $form->grade[0];
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
// now save the adjustment in element one
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = 1;
|
||||
$element->grade = $form->grade[1];
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
$grade = ($elements[$form->grade[0]]->maxscore + $form->grade[1]);
|
||||
break;
|
||||
|
||||
case 4: // rubric grading (identical to accumulative grading)
|
||||
// Insert all the elements that contain something
|
||||
foreach ($form->grade as $key => $thegrade) {
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $key;
|
||||
$element->feedback = $form->{"feedback_$key"};
|
||||
$element->grade = $thegrade;
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
}
|
||||
// now work out the grade...
|
||||
$rawgrade=0;
|
||||
$totalweight=0;
|
||||
foreach ($form->grade as $key => $grade) {
|
||||
$maxscore = $elements[$key]->maxscore;
|
||||
$weight = $WORKSHOP_EWEIGHTS[$elements[$key]->weight];
|
||||
if ($weight > 0) {
|
||||
$totalweight += $weight;
|
||||
}
|
||||
$rawgrade += ($grade / $maxscore) * $weight;
|
||||
}
|
||||
$grade = 100.0 * ($rawgrade / $totalweight);
|
||||
break;
|
||||
|
||||
} // end of switch
|
||||
|
||||
|
||||
// any comment?
|
||||
if (!empty($form->generalcomment)) { // update the object (no need to update the db record)
|
||||
$assessment->generalcomment = $form->generalcomment;
|
||||
}
|
||||
|
||||
// redisplay form, going back to original returnto address
|
||||
workshop_print_assessment($workshop, $assessment, true, true, $form->returnto);
|
||||
|
||||
// add_to_log($course->id, "workshop", "assess", "assessments.php?action=viewassessment&id=$cm->id&aid=$assessment->id", "$assessment->id", "$cm->id");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/******************* admin confirm delete ************************************/
|
||||
elseif ($action == 'adminconfirmdelete' ) {
|
||||
|
||||
@ -210,7 +411,7 @@
|
||||
if (!$assessment = get_record("workshop_assessments", "submissionid", $submission->id, "userid",
|
||||
$USER->id)) {
|
||||
// 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",
|
||||
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
|
||||
@ -232,6 +433,30 @@
|
||||
if (!$assessment->id = insert_record("workshop_assessments", $assessment)) {
|
||||
error("Could not insert workshop assessment!");
|
||||
}
|
||||
// if it's the teacher and the workshop is error banded set all the elements to Yes
|
||||
if (isteacher($course->id) and ($workshop->gradingstrategy == 2)) {
|
||||
for ($i =0; $i < $workshop->nelements; $i++) {
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $i;
|
||||
$element->feedback = '';
|
||||
$element->grade = 1;
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
}
|
||||
// now set the adjustment
|
||||
unset($element);
|
||||
$i = $workshop->nelements;
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $i;
|
||||
$element->grade = 0;
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -728,36 +953,43 @@
|
||||
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");
|
||||
// get all the submissions...
|
||||
if ($submissions = get_records("workshop_submissions", "workshopid", $workshop->id)) {
|
||||
foreach ($submissions as $submission) {
|
||||
// ...if cold...
|
||||
if (($submission->timecreated + $CFG->maxeditingtime) < $timenow) {
|
||||
// ...clear assessment count so workshop_grade_assessments() can do its thing
|
||||
set_field("workshop_submissions", "nassessments", 0, "id", $submission->id);
|
||||
}
|
||||
// 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");
|
||||
echo "<pre>";
|
||||
workshop_grade_assessments($workshop);
|
||||
print_continue("submissions.php?id=$cm->id&action=adminlist");
|
||||
}
|
||||
|
||||
|
||||
/*************** update assessment (by teacher or student) ***************************/
|
||||
elseif ($action == 'updateassessment') {
|
||||
/*************** remove stock comment (by teacher ) ***************************/
|
||||
elseif ($action == 'removestockcomment') {
|
||||
|
||||
require_variable($aid);
|
||||
if (! $assessment = get_record("workshop_assessments", "id", $aid)) {
|
||||
require_variable($stockcommentid);
|
||||
|
||||
if (!isteacher($course->id)) {
|
||||
error("Only teachers can look at this page");
|
||||
}
|
||||
|
||||
if (!$assessment = get_record("workshop_assessments", "id", $aid)) {
|
||||
error("workshop assessment is misconfigured");
|
||||
}
|
||||
$form = data_submitted("nomatch"); // probably always come from the same page, change this statement
|
||||
|
||||
// delete the comment from the stock comments table
|
||||
if (!delete_records("workshop_stockcomments", "id", $stockcommentid)) {
|
||||
error("Could not remove comment from the comment bank");
|
||||
}
|
||||
|
||||
// now upate the assessment (just the elements, the assessment itself is not updated)
|
||||
|
||||
// first get the assignment elements for maxscores and weights...
|
||||
$elementsraw = get_records("workshop_elements", "workshopid", $workshop->id, "elementno ASC");
|
||||
@ -776,18 +1008,17 @@
|
||||
// don't fiddle about, delete all the old and add the new!
|
||||
delete_records("workshop_grades", "assessmentid", $assessment->id);
|
||||
|
||||
$form = data_submitted("nomatch"); // probably always come from the same page, change this statement
|
||||
|
||||
|
||||
//determine what kind of grading we have
|
||||
switch ($workshop->gradingstrategy) {
|
||||
case 0: // no grading
|
||||
// Insert all the elements that contain something
|
||||
foreach ($form->feedback as $key => $thefeedback) {
|
||||
for ($i =0; $i < $workshop->nelements; $i++) {
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $key;
|
||||
$element->feedback = $thefeedback;
|
||||
$element->elementno = $i;
|
||||
$element->feedback = $form->{"feedback_$i"};
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
@ -802,7 +1033,7 @@
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $key;
|
||||
$element->feedback = $form->feedback[$key];
|
||||
$element->feedback = $form->{"feedback_$key"};
|
||||
$element->grade = $thegrade;
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
@ -831,7 +1062,7 @@
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $i;
|
||||
$element->feedback = $form->feedback[$i];
|
||||
$element->feedback = $form->{"feedback_$i"};
|
||||
$element->grade = $form->grade[$i];
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
@ -889,7 +1120,181 @@
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $key;
|
||||
$element->feedback = $form->feedback[$key];
|
||||
$element->feedback = $form->{"feedback_$key"};
|
||||
$element->grade = $thegrade;
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
}
|
||||
// now work out the grade...
|
||||
$rawgrade=0;
|
||||
$totalweight=0;
|
||||
foreach ($form->grade as $key => $grade) {
|
||||
$maxscore = $elements[$key]->maxscore;
|
||||
$weight = $WORKSHOP_EWEIGHTS[$elements[$key]->weight];
|
||||
if ($weight > 0) {
|
||||
$totalweight += $weight;
|
||||
}
|
||||
$rawgrade += ($grade / $maxscore) * $weight;
|
||||
}
|
||||
$grade = 100.0 * ($rawgrade / $totalweight);
|
||||
break;
|
||||
|
||||
} // end of switch
|
||||
|
||||
|
||||
// any comment?
|
||||
if (!empty($form->generalcomment)) { // update the object (no need to update the db record)
|
||||
$assessment->generalcomment = $form->generalcomment;
|
||||
}
|
||||
|
||||
// redisplay form, going back to original returnto address
|
||||
workshop_print_assessment($workshop, $assessment, true, true, $form->returnto);
|
||||
|
||||
// add_to_log($course->id, "workshop", "assess", "assessments.php?action=viewassessment&id=$cm->id&aid=$assessment->id", "$assessment->id", "$cm->id");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*************** update assessment (by teacher or student) ***************************/
|
||||
elseif ($action == 'updateassessment') {
|
||||
|
||||
require_variable($aid);
|
||||
if (! $assessment = get_record("workshop_assessments", "id", $aid)) {
|
||||
error("workshop assessment is misconfigured");
|
||||
}
|
||||
|
||||
// first get the assignment elements for maxscores and weights...
|
||||
$elementsraw = get_records("workshop_elements", "workshopid", $workshop->id, "elementno ASC");
|
||||
if (count($elementsraw) < $workshop->nelements) {
|
||||
print_string("noteonassignmentelements", "workshop");
|
||||
}
|
||||
if ($elementsraw) {
|
||||
foreach ($elementsraw as $element) {
|
||||
$elements[] = $element; // to renumber index 0,1,2...
|
||||
}
|
||||
} else {
|
||||
$elements = null;
|
||||
}
|
||||
|
||||
$timenow = time();
|
||||
// don't fiddle about, delete all the old and add the new!
|
||||
delete_records("workshop_grades", "assessmentid", $assessment->id);
|
||||
|
||||
$form = data_submitted("nomatch"); // probably always come from the same page, change this statement
|
||||
|
||||
//determine what kind of grading we have
|
||||
switch ($workshop->gradingstrategy) {
|
||||
case 0: // no grading
|
||||
// Insert all the elements that contain something
|
||||
for ($i = 0; $i < $workshop->nelements; $i++) {
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $i;
|
||||
$element->feedback = $form->{"feedback_$i"};
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
}
|
||||
$grade = 0; // set to satisfy save to db
|
||||
break;
|
||||
|
||||
case 1: // accumulative grading
|
||||
// Insert all the elements that contain something
|
||||
foreach ($form->grade as $key => $thegrade) {
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $key;
|
||||
$element->feedback = $form->{"feedback_$key"};
|
||||
$element->grade = $thegrade;
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
}
|
||||
// now work out the grade...
|
||||
$rawgrade=0;
|
||||
$totalweight=0;
|
||||
foreach ($form->grade as $key => $grade) {
|
||||
$maxscore = $elements[$key]->maxscore;
|
||||
$weight = $WORKSHOP_EWEIGHTS[$elements[$key]->weight];
|
||||
if ($weight > 0) {
|
||||
$totalweight += $weight;
|
||||
}
|
||||
$rawgrade += ($grade / $maxscore) * $weight;
|
||||
// echo "\$key, \$maxscore, \$weight, \$totalweight, \$grade, \$rawgrade : $key, $maxscore, $weight, $totalweight, $grade, $rawgrade<br />";
|
||||
}
|
||||
$grade = 100.0 * ($rawgrade / $totalweight);
|
||||
break;
|
||||
|
||||
case 2: // error banded graded
|
||||
// Insert all the elements that contain something
|
||||
$error = 0.0;
|
||||
for ($i =0; $i < $workshop->nelements; $i++) {
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $i;
|
||||
$element->feedback = $form->{"feedback_$i"};
|
||||
$element->grade = $form->grade[$i];
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
if (empty($form->grade[$i])){
|
||||
$error += $WORKSHOP_EWEIGHTS[$elements[$i]->weight];
|
||||
}
|
||||
}
|
||||
// now save the adjustment
|
||||
unset($element);
|
||||
$i = $workshop->nelements;
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $i;
|
||||
$element->grade = $form->grade[$i];
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
$grade = ($elements[intval($error + 0.5)]->maxscore + $form->grade[$i]) * 100 / $workshop->grade;
|
||||
// do sanity check
|
||||
if ($grade < 0) {
|
||||
$grade = 0;
|
||||
} elseif ($grade > 100) {
|
||||
$grade = 100;
|
||||
}
|
||||
echo "<p><b>".get_string("weightederrorcount", "workshop", intval($error + 0.5))."</b>\n";
|
||||
break;
|
||||
|
||||
case 3: // criteria grading
|
||||
// save in the selected criteria value in element zero,
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = 0;
|
||||
$element->grade = $form->grade[0];
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
// now save the adjustment in element one
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = 1;
|
||||
$element->grade = $form->grade[1];
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
}
|
||||
$grade = ($elements[$form->grade[0]]->maxscore + $form->grade[1]);
|
||||
break;
|
||||
|
||||
case 4: // rubric grading (identical to accumulative grading)
|
||||
// Insert all the elements that contain something
|
||||
foreach ($form->grade as $key => $thegrade) {
|
||||
unset($element);
|
||||
$element->workshopid = $workshop->id;
|
||||
$element->assessmentid = $assessment->id;
|
||||
$element->elementno = $key;
|
||||
$element->feedback = $form->{"feedback_$key"};
|
||||
$element->grade = $thegrade;
|
||||
if (!$element->id = insert_record("workshop_grades", $element)) {
|
||||
error("Could not insert workshop element!");
|
||||
@ -931,8 +1336,13 @@
|
||||
// ...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)) {
|
||||
// if there's examples or peer assessments clear the counter in the submission so that
|
||||
// the cron job will regrade this assessment (and the other assessments fo the submission)
|
||||
if ($workshop->ntassessments or $workshop->nsassessments) {
|
||||
set_field("workshop_submissions", "nassessments", 0, "id", $submission->id);
|
||||
} else { // it could be self assessment....
|
||||
// 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) {
|
||||
@ -941,18 +1351,19 @@
|
||||
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);
|
||||
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
|
||||
} 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +66,7 @@
|
||||
fwrite ($bf,full_tag("INCLUDESELF",4,false,$workshop->includeself));
|
||||
fwrite ($bf,full_tag("MAXBYTES",4,false,$workshop->maxbytes));
|
||||
fwrite ($bf,full_tag("DEADLINE",4,false,$workshop->deadline));
|
||||
fwrite ($bf,full_tag("RELEASEGRADES",4,false,$workshop->releasegrades));
|
||||
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));
|
||||
@ -118,8 +119,12 @@
|
||||
fwrite ($bf,full_tag("SCALE",6,false,$wor_ele->scale));
|
||||
fwrite ($bf,full_tag("MAXSCORE",6,false,$wor_ele->maxscore));
|
||||
fwrite ($bf,full_tag("WEIGHT",6,false,$wor_ele->weight));
|
||||
fwrite ($bf,full_tag("STDDEV",6,false,$wor_ele->stddev));
|
||||
fwrite ($bf,full_tag("TOTALASSESSMENTS",6,false,$wor_ele->totalassessments));
|
||||
//Now we backup workshop rubrics
|
||||
$status = backup_workshop_rubrics($bf,$preferences,$workshop,$wor_ele->elementno);
|
||||
//Now we backup element's stock comments
|
||||
$status = backup_workshop_stockcomments($bf,$preferences,$workshop,$wor_ele->elementno);
|
||||
//End element
|
||||
$status =fwrite ($bf,end_tag("ELEMENT",5,true));
|
||||
}
|
||||
@ -160,6 +165,36 @@
|
||||
return $status;
|
||||
}
|
||||
|
||||
//Backup workshop_stockcomments contents (executed from backup_workshop_elements)
|
||||
function backup_workshop_stockcomments ($bf,$preferences,$workshop,$elementid) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = true;
|
||||
|
||||
$workshop_stockcomments = get_records_sql("SELECT * from {$CFG->prefix}workshop_stockcomments c
|
||||
WHERE c.workshopid = '$workshop' and c.elementno = '$elementno'
|
||||
ORDER BY c.id");
|
||||
|
||||
//If there is workshop_stockcomments
|
||||
if ($workshop_stockcomments) {
|
||||
//Write start tag
|
||||
$status =fwrite ($bf,start_tag("STOCKCOMMENTS",8,true));
|
||||
//Iterate over each comment
|
||||
foreach ($workshop_stockcomments as $wor_com) {
|
||||
//Start comment
|
||||
$status =fwrite ($bf,start_tag("STOCKCOMMENT",9,true));
|
||||
//Print comment contents
|
||||
fwrite ($bf,full_tag("COMMENT_TEXT",10,false,$wor_com->comments));
|
||||
//End comment
|
||||
$status =fwrite ($bf,end_tag("STOCKCOMMENT",9,true));
|
||||
}
|
||||
//Write end tag
|
||||
$status =fwrite ($bf,end_tag("STOCKCOMMENTS",8,true));
|
||||
}
|
||||
return $status;
|
||||
}
|
||||
|
||||
//Backup workshop_submissions contents (executed from workshop_backup_mods)
|
||||
function backup_workshop_submissions ($bf,$preferences,$workshop) {
|
||||
|
||||
@ -183,13 +218,10 @@
|
||||
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));
|
||||
fwrite ($bf,full_tag("RELIABILITYGRADE",6,false,$wor_sub->reliabilitygrade));
|
||||
fwrite ($bf,full_tag("GRADINGGRADE",6,false,$wor_sub->gradinggrade));
|
||||
fwrite ($bf,full_tag("FINALGRADE",6,false,$wor_sub->finalgrade));
|
||||
fwrite ($bf,full_tag("LATE",6,false,$wor_sub->late));
|
||||
fwrite ($bf,full_tag("NASSESSMENTS",6,false,$wor_sub->nassessments));
|
||||
//Now we backup workshop assessments
|
||||
$status = backup_workshop_assessments($bf,$preferences,$workshop,$wor_sub->id);
|
||||
//End submission
|
||||
|
@ -119,6 +119,29 @@ function workshop_upgrade($oldversion) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($oldversion < 2004102800) {
|
||||
table_column("workshop", "", "releasegrades", "INTEGER", "10", "UNSIGNED", "0", "NOT NULL", "deadline");
|
||||
execute_sql("
|
||||
CREATE TABLE `{$CFG->prefix}workshop_stockcomments` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`workshopid` int(10) unsigned NOT NULL default '0',
|
||||
`elementno` int(10) unsigned NOT NULL default '0',
|
||||
`comments` text NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) COMMENT='Defines stockcomments, the teacher comment bank'
|
||||
");
|
||||
}
|
||||
|
||||
if ($oldversion < 2004111000) {
|
||||
table_column("workshop_elements", "", "stddev", "FLOAT", "", "", "0", "NOT NULL");
|
||||
table_column("workshop_elements", "", "totalassessments", "INTEGER", "10", "", "0", "NOT NULL");
|
||||
execute_sql(" ALTER TABLE `{$CFG->prefix}workshop_elements` CHANGE `weight` `weight` INT(4) UNSIGNED NOT NULL DEFAULT '11'");
|
||||
table_column("workshop_submissions", "", "nassessments", "INTEGER", "10", "", "0", "NOT NULL");
|
||||
execute_sql("ALTER TABLE `{$CFG->prefix}workshop_submissions` DROP COLUMN `teachergrade`");
|
||||
execute_sql("ALTER TABLE `{$CFG->prefix}workshop_submissions` DROP COLUMN `peergrade`");
|
||||
execute_sql("ALTER TABLE `{$CFG->prefix}workshop_submissions` DROP COLUMN `biasgrade`");
|
||||
execute_sql("ALTER TABLE `{$CFG->prefix}workshop_submissions` DROP COLUMN `reliabilitygrade`");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ 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',
|
||||
`releasegrades` int(10) unsigned 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',
|
||||
@ -47,13 +48,10 @@ CREATE TABLE `prefix_workshop_submissions` (
|
||||
`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',
|
||||
`reliabilitygrade` int(3) unsigned NOT NULL default '0',
|
||||
`gradinggrade` int(3) unsigned NOT NULL default '0',
|
||||
`finalgrade` int(3) unsigned NOT NULL default '0',
|
||||
`late` int(3) unsigned NOT NULL default '0',
|
||||
`nassessments` int(10) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `userid` (`userid`)
|
||||
) COMMENT='Info about submitted work from teacher and students';
|
||||
@ -95,7 +93,9 @@ CREATE TABLE `prefix_workshop_elements` (
|
||||
`description` text NOT NULL,
|
||||
`scale` tinyint(3) unsigned NOT NULL default '0',
|
||||
`maxscore` tinyint(3) unsigned NOT NULL default '1',
|
||||
`weight` float NOT NULL default '1.0',
|
||||
`weight` tinyint(3) unsigned NOT NULL default '11',
|
||||
`stddev` float NOT NULL default '0.0',
|
||||
`totalassessments` int(10) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) COMMENT='Info about marking scheme of assignment';
|
||||
# --------------------------------------------------------
|
||||
@ -131,6 +131,20 @@ CREATE TABLE `prefix_workshop_grades` (
|
||||
) COMMENT='Info about individual grades given to each element';
|
||||
# --------------------------------------------------------
|
||||
|
||||
|
||||
#
|
||||
# Table structure for table `workshop_stockcomments`
|
||||
#
|
||||
|
||||
CREATE TABLE `prefix_workshop_stockcomments` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`workshopid` int(10) unsigned NOT NULL default '0',
|
||||
`elementno` int(10) unsigned NOT NULL default '0',
|
||||
`comments` text NOT NULL default '',
|
||||
PRIMARY KEY (`id`),
|
||||
) COMMENT='Info about the teacher comment bank';
|
||||
# --------------------------------------------------------
|
||||
|
||||
#
|
||||
# Table structure for table `workshop_comments`
|
||||
#
|
||||
|
@ -47,19 +47,27 @@
|
||||
}
|
||||
|
||||
foreach ($workshops as $workshop) {
|
||||
switch ($workshop->phase) {
|
||||
case 0:
|
||||
case 1: $info = get_string("phase1short", "workshop");
|
||||
break;
|
||||
case 2: $info = get_string("phase2short", "workshop");
|
||||
break;
|
||||
case 3: $info = get_string("phase3short", "workshop");
|
||||
break;
|
||||
case 4: $info = get_string("phase4short", "workshop");
|
||||
break;
|
||||
case 5: $info = get_string("phase5short", "workshop");
|
||||
break;
|
||||
if (isteacher($course->id, $USER->id)) { // teacher see info (students see grade)
|
||||
switch ($workshop->phase) {
|
||||
case 0:
|
||||
case 1: $info = get_string("phase1short", "workshop");
|
||||
break;
|
||||
case 2: $info = get_string("phase2short", "workshop");
|
||||
break;
|
||||
case 3: $info = get_string("phase3short", "workshop");
|
||||
break;
|
||||
case 4: $info = get_string("phase4short", "workshop");
|
||||
break;
|
||||
case 5: $info = get_string("phase5short", "workshop");
|
||||
break;
|
||||
}
|
||||
if ($workshop->phase > 1) {
|
||||
if ($num = workshop_count_student_submissions_for_assessment($workshop, $USER)) {
|
||||
$info .= " [".get_string("unassessed", "workshop", $num)."]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($submissions = workshop_get_user_submissions($workshop, $USER)) {
|
||||
foreach ($submissions as $submission) {
|
||||
if ($submission->timecreated <= $workshop->deadline) {
|
||||
|
@ -88,6 +88,10 @@ function workshop_add_instance($workshop) {
|
||||
$workshop->deadlinemonth, $workshop->deadlineday, $workshop->deadlinehour,
|
||||
$workshop->deadlineminute);
|
||||
|
||||
$workshop->releasegrades = make_timestamp($workshop->releaseyear,
|
||||
$workshop->releasemonth, $workshop->releaseday, $workshop->releasehour,
|
||||
$workshop->releaseminute);
|
||||
|
||||
if ($returnid = insert_record("workshop", $workshop)) {
|
||||
|
||||
$event = NULL;
|
||||
@ -119,21 +123,18 @@ function workshop_cron () {
|
||||
if ($workshops = get_records("workshop")) {
|
||||
foreach ($workshops as $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);
|
||||
}
|
||||
if ($workshop->gradingstrategy and ($workshop->ntassessments or $workshop->nsassessments)) {
|
||||
workshop_grade_assessments($workshop);
|
||||
}
|
||||
}
|
||||
}
|
||||
$timenow = time();
|
||||
|
||||
// Find all workshop notifications that have yet to be mailed out, and mails them
|
||||
$cutofftime = time() - $CFG->maxeditingtime;
|
||||
$cutofftime = $timenow - $CFG->maxeditingtime;
|
||||
|
||||
// look for new assessments
|
||||
if ($assessments = workshop_get_unmailed_assessments($cutofftime)) {
|
||||
$timenow = time();
|
||||
|
||||
foreach ($assessments as $assessment) {
|
||||
|
||||
echo "Processing workshop assessment $assessment->id\n";
|
||||
@ -472,8 +473,6 @@ function workshop_cron () {
|
||||
|
||||
// look for new gradings
|
||||
if ($assessments = workshop_get_unmailed_graded_assessments($cutofftime)) {
|
||||
$timenow = time();
|
||||
|
||||
foreach ($assessments as $assessment) {
|
||||
|
||||
echo "Processing workshop assessment $assessment->id (graded)\n";
|
||||
@ -581,6 +580,10 @@ function workshop_delete_instance($id) {
|
||||
$result = false;
|
||||
}
|
||||
|
||||
if (! delete_records("workshop_stockcomments", "workshopid", "$workshop->id")) {
|
||||
$result = false;
|
||||
}
|
||||
|
||||
if (! delete_records("workshop_grades", "workshopid", "$workshop->id")) {
|
||||
$result = false;
|
||||
}
|
||||
@ -618,7 +621,7 @@ function workshop_grades($workshopid) {
|
||||
|
||||
$return = null;
|
||||
if ($workshop = get_record("workshop", "id", $workshopid)) {
|
||||
if ($workshop->phase > 1 and $workshop->gradingstrategy) {
|
||||
if (($workshop->phase > 1) and $workshop->gradingstrategy) {
|
||||
if ($students = get_course_students($workshop->course)) {
|
||||
foreach ($students as $student) {
|
||||
if ($workshop->wtype) {
|
||||
@ -933,6 +936,10 @@ function workshop_update_instance($workshop) {
|
||||
$workshop->deadlinemonth, $workshop->deadlineday, $workshop->deadlinehour,
|
||||
$workshop->deadlineminute);
|
||||
|
||||
$workshop->releasegrades = make_timestamp($workshop->releaseyear,
|
||||
$workshop->releasemonth, $workshop->releaseday, $workshop->releasehour,
|
||||
$workshop->releaseminute);
|
||||
|
||||
// set the workshop's type
|
||||
$wtype = 0; // 3 phases, no grading grades
|
||||
if ($workshop->includeself or $workshop->ntassessments) $wtype = 1; // 3 phases with grading grades
|
||||
@ -1214,6 +1221,15 @@ function workshop_compare_assessments($workshop, $assessment1, $assessment2) {
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_count_assessments($submission) {
|
||||
// Return the (real) assessments for this submission,
|
||||
$timenow = time();
|
||||
return count_records_select("workshop_assessments",
|
||||
"submissionid = $submission->id AND timecreated < $timenow");
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_count_ungraded_assessments($workshop) {
|
||||
// function returns the number of ungraded assessments by students
|
||||
@ -1501,193 +1517,245 @@ function workshop_grade_assessments($workshop) {
|
||||
// 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++) {
|
||||
if ($n > 1) {
|
||||
$sd[$i] = sqrt($var[$i] / ($n - 1));
|
||||
} else {
|
||||
$sd[$i] = 0;
|
||||
}
|
||||
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 is only one or two assessments they
|
||||
// are not altered by this routine.)
|
||||
foreach ($submissions as $submission) {
|
||||
if ($nassessments[$submission->id] > 2) {
|
||||
// check when the standard deviations were calculated
|
||||
$oldtotalassessments = get_field("workshop_elements", "totalassessments", "workshopid", $workshop->id,
|
||||
"elementno", 0);
|
||||
$totalassessments = count_records("workshop_assessments", "workshopid", $workshop->id);
|
||||
// calculate the std. devs every 10 assessments for low numbers of assessments, thereafter every 100 new assessments
|
||||
if ((($totalassessments < 100) and (($totalassessments - $oldtotalassessments) > 10)) or
|
||||
(($totalassessments - $oldtotalassessments) > 100)) {
|
||||
// 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) {
|
||||
if ($workshop->agreeassessments and !$assessment->timeagreed) {
|
||||
// ignore assessments that have not been agreed
|
||||
// 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;
|
||||
}
|
||||
$var = 0;
|
||||
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 ($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;
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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) { // 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");
|
||||
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) {
|
||||
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);
|
||||
$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++) {
|
||||
if ($n > 1) {
|
||||
$sd[$i] = sqrt($var[$i] / ($n - 1));
|
||||
} else {
|
||||
$sd[$i] = 0;
|
||||
}
|
||||
set_field("workshop_elements", "stddev", $sd[$i], "workshopid", $workshop->id, "elementno", $i);
|
||||
set_field("workshop_elements", "totalassessments", $totalassessments, "workshopid", $workshop->id,
|
||||
"elementno", $i);
|
||||
echo get_string("standarddeviationofelement", "workshop", $i+1)." $sd[$i]<br />";
|
||||
if ($sd[$i] <= $minvar) {
|
||||
print_string("standarddeviationnote", "workshop")."<br />\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this section looks at each submission if the number of assessments made has increased it recalculates the
|
||||
// grading grades for those assessments
|
||||
// first get the assignment elements for the weights and the stddevs...
|
||||
$elementsraw = get_records("workshop_elements", "workshopid", $workshop->id, "elementno ASC");
|
||||
foreach ($elementsraw as $element) {
|
||||
$weight[] = $element->weight; // to renumber index 0,1,2...
|
||||
$sd[] = $element->stddev; // to renumber index 0,1,2...
|
||||
}
|
||||
|
||||
unset($num); // may have been used in calculating stddevs
|
||||
unset($sum); // ditto
|
||||
if ($submissions = get_records("workshop_submissions", "workshopid", $workshop->id)) {
|
||||
foreach ($submissions as $submission) {
|
||||
// see if the number of assessments has changed
|
||||
$nassessments = workshop_count_assessments($submission);
|
||||
if ($submission->nassessments <> $nassessments) {
|
||||
// ...if there are three or more assessments calculate the variance of each assessment.
|
||||
// Use the variance to find the "best" assessment. (When there is only one or two assessments they
|
||||
// are not altered by this routine.)
|
||||
echo "Processing submission $submission->id ($nassessments asessments)...\n";
|
||||
if ($nassessments > 2) {
|
||||
$num = 0; // weighted number of assessments
|
||||
for ($i = 0; $i < $workshop->nelements; $i++) {
|
||||
$sum[$i] = 0; // weighted sum of grades
|
||||
}
|
||||
if ($assessments = workshop_get_assessments($submission)) {
|
||||
// first calculate the mean grades for each element
|
||||
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 (isteacher($workshop->course, $assessment->userid)) {
|
||||
$num += $workshop->teacherweight; // weight teacher's assessment
|
||||
} else {
|
||||
$num++; // student assessment just add one
|
||||
}
|
||||
for ($i = 0; $i < $workshop->nelements; $i++) {
|
||||
$grade = get_field("workshop_grades", "grade",
|
||||
"assessmentid", $assessment->id, "elementno", $i);
|
||||
if (isteacher($workshop->course, $assessment->userid)) {
|
||||
$sum[$i] += $workshop->teacherweight * $grade; // teacher's grade
|
||||
} else {
|
||||
$sum[$i] += $grade; // student's grade
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($num) { // could all the assessments be duff?
|
||||
for ($i = 0; $i < $workshop->nelements; $i++) {
|
||||
$mean[$i] = $sum[$i] / $num;
|
||||
echo "Submission: $submission->id; Element: $i; Mean: {$mean[$i]}\n";
|
||||
}
|
||||
} 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++;
|
||||
continue; // move to the next submission
|
||||
}
|
||||
// run through the assessments again to see which is the "best" one (the one
|
||||
// closest to the mean)
|
||||
$lowest = 10e9;
|
||||
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[$i] - $grade) *
|
||||
$WORKSHOP_EWEIGHTS[$weight[$i]] / $sd[$i];
|
||||
} else {
|
||||
$temp = 0;
|
||||
}
|
||||
$var += $temp * $temp;
|
||||
}
|
||||
// find the "best" assessment of this submission
|
||||
if ($lowest > $var) {
|
||||
$lowest = $var;
|
||||
$bestassessmentid = $assessment->id;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$best = get_record("workshop_assessments", "id", $bestassessmentid)) {
|
||||
error("Workshop grade assessments: cannot find best assessment");
|
||||
}
|
||||
echo "Best assessment is $bestassessmentid;\n";
|
||||
foreach ($assessments as $assessment) {
|
||||
if ($assessment->id == $bestassessmentid) {
|
||||
// it's the best one, set the grading grade to the maximum
|
||||
set_field("workshop_assessments", "gradinggrade", 100, "id", $assessment->id);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// there are less 3 assessments for this submission
|
||||
foreach ($assessments as $assessment) {
|
||||
if (!$assessment->timegraded) {
|
||||
// set the grading grade to the maximum and say it's been graded
|
||||
set_field("workshop_assessments", "gradinggrade", 100, "id", $assessment->id);
|
||||
set_field("workshop_assessments", "timegraded", $timenow, "id", $assessment->id);
|
||||
// there are less than 3 assessments for this submission
|
||||
if ($assessments = workshop_get_assessments($submission)) {
|
||||
foreach ($assessments as $assessment) {
|
||||
if (!$assessment->timegraded) {
|
||||
// set the grading grade to the maximum and say it's been graded
|
||||
set_field("workshop_assessments", "gradinggrade", 100, "id", $assessment->id);
|
||||
set_field("workshop_assessments", "timegraded", $timenow, "id", $assessment->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// set the number of assessments for this submission
|
||||
set_field("workshop_submissions", "nassessments", $nassessments, "id", $submission->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "<p align=\"center\">".get_string("numberofassessmentsdropped", "workshop", $ndrop)."</p>\n";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1729,8 +1797,12 @@ function workshop_submission_grade($workshop, $submission) {
|
||||
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;
|
||||
$timenow = time();
|
||||
if ($timenow > $workshop->releasegrades) {
|
||||
// teacher's grade is available
|
||||
$grade += $workshop->teacherweight * $assessment->grade;
|
||||
$n += $workshop->teacherweight;
|
||||
}
|
||||
} else {
|
||||
$grade += $assessment->grade;
|
||||
$n++;
|
||||
|
@ -11,13 +11,14 @@ workshop_choose_from_menu ($options, $name, $selected="", $nothing="choose", $sc
|
||||
|
||||
workshop_compare_assessments($workshop, $assessment1, $assessment2) { ---> in lib.php
|
||||
workshop_count_all_submissions_for_assessment($workshop, $user) {
|
||||
workshop_count_assessments($submission) {
|
||||
workshop_count_assessments($submission) { ---> in lib.php
|
||||
workshop_count_comments($assessment) {
|
||||
workshop_count_peer_assessments($workshop, $user) {
|
||||
workshop_count_self_assessments($workshop, $user) {
|
||||
workshop_count_student_submissions($workshop) {
|
||||
workshop_count_student_submissions_for_assessment($workshop, $user) {
|
||||
workshop_count_teacher_assessments($workshop, $user) {
|
||||
workshop_count_teacher_assessments($courseid, $submission) {
|
||||
workshop_count_teacher_assessments_by_user($workshop, $user) {
|
||||
workshop_count_teacher_submissions($workshop) {
|
||||
workshop_count_teacher_submissions_for_assessment($workshop, $user) {
|
||||
workshop_count_ungraded_assessments($workshop) { --->in lib.php
|
||||
@ -32,6 +33,7 @@ workshop_delete_user_files($workshop, $user, $exception) {
|
||||
workshop_file_area($workshop, $submission) { ---> in lib.php
|
||||
workshop_file_area_name($workshop, $submission) { ---> in lib.php
|
||||
|
||||
workshop_get_all_teacher_assessments($workshop) {
|
||||
workshop_get_assessments($submission, $all = '') { ---> in lib.php
|
||||
workshop_get_comments($assessment) {
|
||||
workshop_get_participants($workshopid) {
|
||||
@ -40,7 +42,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_assessments($courseid, $submission) {
|
||||
workshop_get_teacher_submission_assessments($workshop) {
|
||||
workshop_get_teacher_submissions($workshop) {
|
||||
workshop_get_ungraded_assessments($workshop) {
|
||||
@ -58,7 +60,7 @@ workshop_list_assessed_submissions($workshop, $user) {
|
||||
workshop_list_peer_assessments($workshop, $user) {
|
||||
workshop_list_student_submissions($workshop, $user) {
|
||||
workshop_list_submissions_for_admin($workshop, $order) {
|
||||
workshop_list_teacher_assessments($workshop, $user) {
|
||||
workshop_list_teacher_assessments_by_user($workshop, $user) {
|
||||
workshop_list_teacher_submissions($workshop) {
|
||||
workshop_list_unassessed_student_submissions($workshop, $user) {
|
||||
workshop_list_unassessed_teacher_submissions($workshop, $user) {
|
||||
@ -197,15 +199,6 @@ function workshop_count_all_submissions_for_assessment($workshop, $user) {
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_count_assessments($submission) {
|
||||
// Return the (real) assessments for this submission,
|
||||
$timenow = time();
|
||||
return count_records_select("workshop_assessments",
|
||||
"submissionid = $submission->id AND timecreated < $timenow");
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_count_comments($assessment) {
|
||||
// Return the number of comments for this assessment provided they are newer than the assessment,
|
||||
@ -302,9 +295,8 @@ function workshop_count_student_submissions_for_assessment($workshop, $user) {
|
||||
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")) {
|
||||
// has any teacher assessed this submission?
|
||||
if (!workshop_count_teacher_assessments($course->id, $submission)) {
|
||||
$n++;
|
||||
}
|
||||
}
|
||||
@ -314,7 +306,22 @@ function workshop_count_student_submissions_for_assessment($workshop, $user) {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_count_teacher_assessments($workshop, $user) {
|
||||
function workshop_count_teacher_assessments($courseid, $submission) {
|
||||
// Return count of (cold) teacher assessments of a submission
|
||||
global $CFG;
|
||||
|
||||
$timenow = time();
|
||||
return count_records_sql("SELECT count(*) FROM {$CFG->prefix}workshop_assessments a,
|
||||
{$CFG->prefix}user_teachers u
|
||||
WHERE u.course = $courseid
|
||||
AND a.userid = u.userid
|
||||
AND a.submissionid = $submission->id
|
||||
AND $timenow > (a.timecreated + $CFG->maxeditingtime)");
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_count_teacher_assessments_by_user($workshop, $user) {
|
||||
// returns the number of assessments made by teachers on user's submissions
|
||||
|
||||
$n = 0;
|
||||
@ -513,6 +520,20 @@ function workshop_delete_user_files($workshop, $user, $exception) {
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_get_all_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_comments($assessment) {
|
||||
// Return all comments for this assessment provided they are newer than the assessment,
|
||||
@ -576,15 +597,15 @@ function workshop_get_submission_assessment($submission, $user) {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_get_teacher_assessments($workshop) {
|
||||
// Return all teacher assessments, ordered by timecreated, oldest first
|
||||
function workshop_get_teacher_assessments($courseid, $submission) {
|
||||
// Return teacher assessments of a submission, 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
|
||||
WHERE u.course = $courseid
|
||||
AND a.userid = u.userid
|
||||
AND a.workshopid = $workshop->id
|
||||
AND a.submissionid = $submission->id
|
||||
ORDER BY a.timecreated");
|
||||
}
|
||||
|
||||
@ -1270,6 +1291,7 @@ function workshop_list_submissions_for_admin($workshop, $order) {
|
||||
$table->size = array ("*", "*", "*");
|
||||
$table->cellpadding = 2;
|
||||
$table->cellspacing = 0;
|
||||
$nassessments = 0;
|
||||
foreach ($users as $user) {
|
||||
// check group membership, if necessary
|
||||
if ($groupid) {
|
||||
@ -1312,11 +1334,12 @@ function workshop_list_submissions_for_admin($workshop, $order) {
|
||||
$action ="";
|
||||
}
|
||||
}
|
||||
$nassessments++;
|
||||
$table->data[] = array(fullname($user), $title, $action);
|
||||
}
|
||||
}
|
||||
if (isset($table->data)) {
|
||||
print_heading(get_string("studentassessments", "workshop", $course->student));
|
||||
print_heading(get_string("studentassessments", "workshop", $course->student)." [$nassessments]");
|
||||
print_table($table);
|
||||
workshop_print_key($workshop);
|
||||
// grading grade analysis
|
||||
@ -1372,7 +1395,8 @@ function workshop_list_submissions_for_admin($workshop, $order) {
|
||||
$table->size = array ("*", "*", "*", "*");
|
||||
$table->cellpadding = 2;
|
||||
$table->cellspacing = 0;
|
||||
|
||||
|
||||
$nsubmissions = 0;
|
||||
if ($submissions = workshop_get_student_submissions($workshop, $order)) {
|
||||
foreach ($submissions as $submission) {
|
||||
if (!$user = get_record("user", "id", $submission->userid)) {
|
||||
@ -1418,13 +1442,14 @@ function workshop_list_submissions_for_admin($workshop, $order) {
|
||||
}
|
||||
$action .= " | <a href=\"submissions.php?action=adminconfirmdelete&id=$cm->id&sid=$submission->id\">".
|
||||
get_string("delete", "workshop")."</a>";
|
||||
$nsubmissions++;
|
||||
$table->data[] = array("$user->firstname $user->lastname", $submission->title.
|
||||
" (".get_string("grade").": ".workshop_submission_grade($workshop, $submission)." ".
|
||||
workshop_print_submission_assessments($workshop, $submission, "teacher").
|
||||
" ".workshop_print_submission_assessments($workshop, $submission, "student").")", $datesubmitted,
|
||||
$action);
|
||||
}
|
||||
print_heading(get_string("studentsubmissions", "workshop", $course->student), "center");
|
||||
print_heading(get_string("studentsubmissions", "workshop", $course->student)." [$nsubmissions]", "center");
|
||||
print_table($table);
|
||||
workshop_print_key($workshop);
|
||||
}
|
||||
@ -1432,7 +1457,7 @@ function workshop_list_submissions_for_admin($workshop, $order) {
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_list_teacher_assessments($workshop, $user) {
|
||||
function workshop_list_teacher_assessments_by_user($workshop, $user) {
|
||||
global $CFG;
|
||||
|
||||
$timenow = time();
|
||||
@ -1637,12 +1662,15 @@ function workshop_list_unassessed_student_submissions($workshop, $user) {
|
||||
fullname($submissionowner), $timegap, $action, $comment);
|
||||
}
|
||||
}
|
||||
else { // no assessment
|
||||
$submissionowner = get_record("user", "id", $submission->userid);
|
||||
$action = "<a href=\"assessments.php?action=assesssubmission&id=$cm->id&sid=$submission->id\">".
|
||||
get_string("assess", "workshop")."</a>";
|
||||
$table->data[] = array(workshop_print_submission_title($workshop, $submission),
|
||||
fullname($submissionowner), $timegap, $action, $comment);
|
||||
else {
|
||||
// no assessment by this user, if no other teacher has assessed submission then list it
|
||||
if (!workshop_count_teacher_assessments($course->id, $submission)) {
|
||||
$submissionowner = get_record("user", "id", $submission->userid);
|
||||
$action = "<a href=\"assessments.php?action=assesssubmission&id=$cm->id&sid=$submission->id\">".
|
||||
get_string("assess", "workshop")."</a>";
|
||||
$table->data[] = array(workshop_print_submission_title($workshop, $submission),
|
||||
fullname($submissionowner), $timegap, $action, $comment);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($table->data)) {
|
||||
@ -1902,6 +1930,8 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
|
||||
<input type="hidden" name="aid" value="<?php echo $assessment->id ?>" />
|
||||
<input type="hidden" name="action" value="updateassessment" />
|
||||
<input type="hidden" name="returnto" value="<?php echo $returnto ?>" />
|
||||
<input type="hidden" name="elementno" value="" />
|
||||
<input type="hidden" name="stockcommentid" value="" />
|
||||
<center>
|
||||
<table cellpadding="2" border="1">
|
||||
<?php
|
||||
@ -1953,7 +1983,7 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
|
||||
echo " <td align=\"right\"><p><b>". get_string("feedback").":</b></p></td>\n";
|
||||
echo " <td>\n";
|
||||
if ($allowchanges) {
|
||||
echo " <textarea name=\"feedback[]\" rows=\"3\" cols=\"75\" wrap=\"virtual\">\n";
|
||||
echo " <textarea name=\"feedback_$i\" rows=\"3\" cols=\"75\" wrap=\"virtual\">\n";
|
||||
if (isset($grades[$i]->feedback)) {
|
||||
echo $grades[$i]->feedback;
|
||||
}
|
||||
@ -1964,6 +1994,28 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
// if active and the teacher show stock comments...
|
||||
if ($allowchanges and isteacher($course->id, $USER->id)) {
|
||||
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
|
||||
get_string("addcomment", "workshop")."\"
|
||||
onclick=\"document.assessmentform.action.value='addstockcomment';
|
||||
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n";
|
||||
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
|
||||
echo "</td><td>\n";
|
||||
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
|
||||
AND elementno = $i", "id")) { // show comments in fixed order (oldest first)
|
||||
foreach ($stockcomments as $stockcomment) {
|
||||
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'$stockcomment->comments';\"><<$stockcomment->comments>></a>\n";
|
||||
if (isteacheredit($course->id, $USER->id)) {
|
||||
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i><--".get_string("delete","workshop")."</i></small></a>\n";
|
||||
}
|
||||
echo "<br />\n";
|
||||
}
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo " <td colspan=\"2\" bgcolor=\"$THEME->cellheading2\"> </td>\n";
|
||||
echo "</tr>\n";
|
||||
@ -2034,7 +2086,7 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
|
||||
echo " <td align=\"right\"><p><b>". get_string("feedback").":</b></p></td>\n";
|
||||
echo " <td>\n";
|
||||
if ($allowchanges) {
|
||||
echo " <textarea name=\"feedback[]\" rows=\"3\" cols=\"75\" wrap=\"virtual\">\n";
|
||||
echo " <textarea name=\"feedback_$i\" rows=\"3\" cols=\"75\" wrap=\"virtual\">\n";
|
||||
if (isset($grades[$i]->feedback)) {
|
||||
echo $grades[$i]->feedback;
|
||||
}
|
||||
@ -2045,6 +2097,28 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
// if active and the teacher show stock comments...
|
||||
if ($allowchanges and isteacher($course->id, $USER->id)) {
|
||||
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
|
||||
get_string("addcomment", "workshop")."\"
|
||||
onclick=\"document.assessmentform.action.value='addstockcomment';
|
||||
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n";
|
||||
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
|
||||
echo "</td><td>\n";
|
||||
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
|
||||
AND elementno = $i", "id")) { // get comments in a fixed order - oldest first
|
||||
foreach ($stockcomments as $stockcomment) {
|
||||
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'$stockcomment->comments';\"><<$stockcomment->comments>></a>\n";
|
||||
if (isteacheredit($course->id, $USER->id)) {
|
||||
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i><--".get_string("delete","workshop")."</i></small></a>\n";
|
||||
}
|
||||
echo "<br />\n";
|
||||
}
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo " <td colspan=\"2\" bgcolor=\"$THEME->cellheading2\"> </td>\n";
|
||||
echo "</tr>\n";
|
||||
@ -2113,7 +2187,7 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
|
||||
echo " <td align=\"right\"><p><b>". get_string("feedback").":</b></p></td>\n";
|
||||
echo " <td>\n";
|
||||
if ($allowchanges) {
|
||||
echo " <textarea name=\"feedback[$i]\" rows=\"3\" cols=\"75\" wrap=\"virtual\">\n";
|
||||
echo " <textarea name=\"feedback_$i\" rows=\"3\" cols=\"75\" wrap=\"virtual\">\n";
|
||||
if (isset($grades[$i]->feedback)) {
|
||||
echo $grades[$i]->feedback;
|
||||
}
|
||||
@ -2126,6 +2200,27 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
// if active and the teacher show stock comments...
|
||||
if ($allowchanges and isteacher($course->id, $USER->id)) {
|
||||
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
|
||||
get_string("addcomment", "workshop")."\"
|
||||
onclick=\"document.assessmentform.action.value='addstockcomment';
|
||||
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n";
|
||||
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
|
||||
echo "</td><td>\n";
|
||||
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
|
||||
AND elementno = $i", "id")) { // get comments in a fixed order - oldest first
|
||||
foreach ($stockcomments as $stockcomment) {
|
||||
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'$stockcomment->comments';\"><<$stockcomment->comments>></a>\n";
|
||||
if (isteacheredit($course->id, $USER->id)) {
|
||||
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i><--".get_string("delete","workshop")."</i></small></a>\n";
|
||||
}
|
||||
echo "<br />\n";
|
||||
}
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo " <td colspan=\"2\" bgcolor=\"$THEME->cellheading2\"> </td>\n";
|
||||
echo "</tr>\n";
|
||||
@ -2222,86 +2317,130 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
|
||||
"<p align=\"right\"><font size=\"1\">".get_string("weight", "workshop").": ".
|
||||
number_format($WORKSHOP_EWEIGHTS[$elements[$i]->weight], 2)."</font></td></tr>\n";
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo " <td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("select", "workshop")."</b></td>\n";
|
||||
echo " <td bgcolor=\"$THEME->cellheading2\"><b>". get_string("criterion","workshop")."</b></td></tr>\n";
|
||||
echo " <td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("select", "workshop").
|
||||
"</b></td>\n";
|
||||
echo " <td bgcolor=\"$THEME->cellheading2\"><b>". get_string("criterion","workshop").
|
||||
"</b></td></tr>\n";
|
||||
if (isset($grades[$i])) {
|
||||
$selection = $grades[$i]->grade;
|
||||
} else {
|
||||
} else {
|
||||
$selection = 0;
|
||||
}
|
||||
}
|
||||
// ...and the rubrics
|
||||
if ($rubricsraw = get_records_select("workshop_rubrics", "workshopid = $workshop->id AND
|
||||
elementno = $i", "rubricno ASC")) {
|
||||
unset($rubrics);
|
||||
foreach ($rubricsraw as $rubic) {
|
||||
$rubrics[] = $rubic; // to renumber index 0,1,2...
|
||||
}
|
||||
}
|
||||
for ($j=0; $j<5; $j++) {
|
||||
if (empty($rubrics[$j]->description)) {
|
||||
break; // out of inner for loop
|
||||
}
|
||||
}
|
||||
echo "<tr valign=\"top\">\n";
|
||||
if ($selection == $j) {
|
||||
echo " <td align=\"center\"><input type=\"RADIO\" name=\"grade[$i]\" value=\"$j\" checked=\"checked\" /></td>\n";
|
||||
}else {
|
||||
echo " <td align=\"center\"><input type=\"RADIO\" name=\"grade[$i]\" value=\"$j\" /></td>\n";
|
||||
}
|
||||
echo "<td>".text_to_html($rubrics[$j]->description)."</td>\n";
|
||||
echo " <td align=\"center\"><input type=\"RADIO\" name=\"grade[$i]\" value=\"$j\"
|
||||
checked=\"checked\" /></td>\n";
|
||||
} else {
|
||||
echo " <td align=\"center\"><input type=\"RADIO\" name=\"grade[$i]\" value=\"$j\"
|
||||
/></td>\n";
|
||||
}
|
||||
echo "<td>".text_to_html($rubrics[$j]->description)."</td>\n";
|
||||
}
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo " <td align=\"right\"><p><b>". get_string("feedback").":</b></p></td>\n";
|
||||
echo " <td>\n";
|
||||
if ($allowchanges) {
|
||||
echo " <textarea name=\"feedback[]\" rows=\"3\" cols=\"75\" wrap=\"virtual\">\n";
|
||||
echo " <textarea name=\"feedback_$i\" rows=\"3\" cols=\"75\" wrap=\"virtual\">\n";
|
||||
if (isset($grades[$i]->feedback)) {
|
||||
echo $grades[$i]->feedback;
|
||||
}
|
||||
}
|
||||
echo "</textarea>\n";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
echo text_to_html($grades[$i]->feedback);
|
||||
}
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
// if active and the teacher show stock comments...
|
||||
if ($allowchanges and isteacher($course->id, $USER->id)) {
|
||||
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
|
||||
get_string("addcomment", "workshop")."\"
|
||||
onclick=\"document.assessmentform.action.value='addstockcomment';
|
||||
document.assessmentform.elementno.value=$i;document.assessmentform.submit();\" /> \n";
|
||||
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
|
||||
echo "</td><td>\n";
|
||||
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
|
||||
AND elementno = $i", "id")) { // show comments in fixed (creation) order
|
||||
foreach ($stockcomments as $stockcomment) {
|
||||
echo "<a onclick=\"document.assessmentform.feedback_$i.value+=' '+'$stockcomment->comments';\"><<$stockcomment->comments>></a>\n";
|
||||
if (isteacheredit($course->id, $USER->id)) {
|
||||
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i><--".get_string("delete","workshop")."</i></small></a>\n";
|
||||
}
|
||||
echo "<br />\n";
|
||||
}
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo " <td colspan=\"2\" bgcolor=\"$THEME->cellheading2\"> </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
} // end of outer switch
|
||||
|
||||
// now get the general comment (present in all types)
|
||||
echo "<tr valign=\"top\">\n";
|
||||
switch ($workshop->gradingstrategy) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 4 : // no grading, accumulative and rubic
|
||||
echo " <td align=\"right\"><p><b>". get_string("generalcomment", "workshop").":</b></p></td>\n";
|
||||
break;
|
||||
default :
|
||||
echo " <td align=\"right\"><p><b>". get_string("reasonforadjustment", "workshop").":</b></p></td>\n";
|
||||
// now get the general comment (present in all types)
|
||||
echo "<tr valign=\"top\">\n";
|
||||
switch ($workshop->gradingstrategy) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 4 : // no grading, accumulative and rubic
|
||||
echo " <td align=\"right\"><p><b>". get_string("generalcomment", "workshop").":</b></p></td>\n";
|
||||
break;
|
||||
default :
|
||||
echo " <td align=\"right\"><p><b>".get_string("generalcomment", "workshop")."/<br />".
|
||||
get_string("reasonforadjustment", "workshop").":</b></p></td>\n";
|
||||
}
|
||||
echo " <td>\n";
|
||||
if ($allowchanges) {
|
||||
echo " <textarea name=\"generalcomment\" rows=\"5\" cols=\"75\" wrap=\"virtual\">\n";
|
||||
if (isset($assessment->generalcomment)) {
|
||||
echo $assessment->generalcomment;
|
||||
echo " <td>\n";
|
||||
if ($allowchanges) {
|
||||
echo " <textarea name=\"generalcomment\" rows=\"5\" cols=\"75\" wrap=\"virtual\">\n";
|
||||
if (isset($assessment->generalcomment)) {
|
||||
echo $assessment->generalcomment;
|
||||
}
|
||||
echo "</textarea>\n";
|
||||
}
|
||||
else {
|
||||
echo "</textarea>\n";
|
||||
} else {
|
||||
if ($assessment) {
|
||||
if (isset($assessment->generalcomment)) {
|
||||
echo text_to_html($assessment->generalcomment);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
print_string("yourfeedbackgoeshere", "workshop");
|
||||
}
|
||||
}
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo "</tr>\n";
|
||||
// if active and the teacher show stock comments...
|
||||
if ($allowchanges and isteacher($course->id, $USER->id)) {
|
||||
echo "<tr><td valign=\"top\" align=\"right\"><input type=\"button\" value=\"".
|
||||
get_string("addcomment", "workshop")."\"
|
||||
onclick=\"document.assessmentform.action.value='addstockcomment';
|
||||
document.assessmentform.elementno.value=99;document.assessmentform.submit();\" /> \n";
|
||||
helpbutton("addcommenttobank", get_string("addcomment", "workshop"), "workshop");
|
||||
echo "</td><td>\n";
|
||||
if ($stockcomments = get_records_select("workshop_stockcomments", "workshopid = $workshop->id
|
||||
AND elementno = 99", "id")) { // show in the same order (oldest at the top)
|
||||
foreach ($stockcomments as $stockcomment) {
|
||||
echo "<a onclick=\"document.assessmentform.generalcomment.value+=' '+'$stockcomment->comments';\"><<$stockcomment->comments>></a>\n";
|
||||
if (isteacheredit($course->id, $USER->id)) {
|
||||
echo " <a onclick=\"document.assessmentform.action.value='removestockcomment';document.assessmentform.stockcommentid.value=$stockcomment->id;document.assessmentform.submit();\"> <small><i><--".get_string("delete","workshop")."</i></small></a>\n";
|
||||
}
|
||||
echo "<br />\n";
|
||||
}
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo " <td colspan=\"2\" bgcolor=\"$THEME->cellheading2\"> </td>\n";
|
||||
echo "</tr>\n";
|
||||
@ -2323,14 +2462,14 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
|
||||
echo "<tr valign=\"top\">\n";
|
||||
echo "<td colspan=\"2\" bgcolor=\"$THEME->cellheading2\"> </td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
// ...and close the table, show submit button if needed...
|
||||
echo "</table>\n";
|
||||
if ($assessment) {
|
||||
if ($allowchanges) {
|
||||
echo "<input type=\"submit\" value=\"".get_string("savemyassessment", "workshop")."\" />\n";
|
||||
}
|
||||
}
|
||||
// ...if user is author, assessment not agreed, there's no comments, the showcommentlinks flag is set and
|
||||
// it's not self assessment then show some buttons!
|
||||
if (($submission->userid == $USER->id) and !$assessment->timeagreed and !$comments and $showcommentlinks and
|
||||
@ -2339,11 +2478,11 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
|
||||
onclick=\"document.assessmentform.action.value='agreeassessment';document.assessmentform.submit();\" />\n";
|
||||
echo "<input type=\"submit\" value=\"".get_string("disagreewiththisassessment", "workshop")."\"
|
||||
onclick=\"document.assessmentform.action.value='addcomment';document.assessmentform.submit();\" />\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</center>";
|
||||
echo "</form>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -2600,6 +2739,7 @@ function workshop_print_submission($workshop, $submission) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
function workshop_print_submission_assessments($workshop, $submission, $type) {
|
||||
global $USER;
|
||||
// Returns the teacher or peer grade and a hyperlinked list of grades for this submission
|
||||
|
||||
if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $workshop->course)) {
|
||||
@ -2609,26 +2749,30 @@ function workshop_print_submission_assessments($workshop, $submission, $type) {
|
||||
$str = '';
|
||||
if ($assessments = workshop_get_assessments($submission)) {
|
||||
switch ($type) {
|
||||
case "teacher" :
|
||||
foreach ($assessments as $assessment) {
|
||||
if (isteacher($workshop->course, $assessment->userid)) {
|
||||
$str .= "<a href=\"assessments.php?action=viewassessment&id=$cm->id&aid=$assessment->id\">";
|
||||
if ($assessment->timegraded) {
|
||||
if ($assessment->gradinggrade) {
|
||||
$str .= "[".number_format($assessment->grade * $workshop->grade / 100, 0)." (".
|
||||
number_format($assessment->gradinggrade * $workshop->gradinggrade / 100, 0).
|
||||
")]</a> ";
|
||||
case "teacher" :
|
||||
// students can see teacher assessments only if the release date has passed
|
||||
$timenow = time();
|
||||
if (isteacher($workshop->course, $USER->id) or ($timenow > $workshop->releasegrades)) {
|
||||
foreach ($assessments as $assessment) {
|
||||
if (isteacher($workshop->course, $assessment->userid)) {
|
||||
$str .= "<a href=\"assessments.php?action=viewassessment&id=$cm->id&aid=$assessment->id\">";
|
||||
if ($assessment->timegraded) {
|
||||
if ($assessment->gradinggrade) {
|
||||
$str .= "[".number_format($assessment->grade * $workshop->grade / 100, 0)." (".
|
||||
number_format($assessment->gradinggrade * $workshop->gradinggrade / 100, 0).
|
||||
")]</a> ";
|
||||
} else {
|
||||
$str .= "<".number_format($assessment->grade * $workshop->grade / 100, 0).
|
||||
" (0)></a> ";
|
||||
}
|
||||
} else {
|
||||
$str .= "<".number_format($assessment->grade * $workshop->grade / 100, 0).
|
||||
" (0)></a> ";
|
||||
$str .= "[".number_format($assessment->grade *$workshop->grade / 100, 0);
|
||||
if ($workshop->wtype) { // print null grade if there are student assessments
|
||||
$str .= " ((".number_format($assessment->gradinggrade * $workshop->gradinggrade / 100,
|
||||
0)."))";
|
||||
}
|
||||
$str .= "]</a> ";
|
||||
}
|
||||
} else {
|
||||
$str .= "[".number_format($assessment->grade *$workshop->grade / 100, 0);
|
||||
if ($workshop->wtype) { // print null grade if there are student assessments
|
||||
$str .= " ((".number_format($assessment->gradinggrade * $workshop->gradinggrade / 100,
|
||||
0)."))";
|
||||
}
|
||||
$str .= "]</a> ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -367,6 +367,16 @@
|
||||
?></td>
|
||||
</tr>
|
||||
|
||||
<tr valign="top">
|
||||
<td align="right"><p><b><?php print_string("releaseteachergrades", "workshop") ?>:</b></td>
|
||||
<td><?php
|
||||
print_date_selector("releaseday", "releasemonth", "releaseyear", $form->releasegrades);
|
||||
echo " - ";
|
||||
print_time_selector("releasehour", "releaseminute", $form->releasegrades);
|
||||
helpbutton("releasegrades", get_string("releaseteachergrades", "workshop"), "workshop");
|
||||
?></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<br />
|
||||
<center>
|
||||
|
@ -69,6 +69,7 @@
|
||||
$workshop->includeself = backup_todb($info['MOD']['#']['INCLUDESELF']['0']['#']);
|
||||
$workshop->maxbytes = backup_todb($info['MOD']['#']['MAXBYTES']['0']['#']);
|
||||
$workshop->deadline = backup_todb($info['MOD']['#']['DEADLINE']['0']['#']);
|
||||
$workshop->releasegrades = backup_todb($info['MOD']['#']['RELEASEGRADES']['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']['#']);
|
||||
@ -137,6 +138,8 @@
|
||||
$element->scale = backup_todb($ele_info['#']['SCALE']['0']['#']);
|
||||
$element->maxscore = backup_todb($ele_info['#']['MAXSCORE']['0']['#']);
|
||||
$element->weight = backup_todb($ele_info['#']['WEIGHT']['0']['#']);
|
||||
$element->stddev = backup_todb($ele_info['#']['STDDEV']['0']['#']);
|
||||
$element->totalassessments = backup_todb($ele_info['#']['TOTALASSESSMENTS']['0']['#']);
|
||||
|
||||
//The structure is equal to the db, so insert the workshop_elements
|
||||
$newid = insert_record ("workshop_elements",$element);
|
||||
@ -153,6 +156,8 @@
|
||||
if ($newid) {
|
||||
//We have to restore the workshop_rubrics table now (course level table)
|
||||
$status = workshop_rubrics_restore_mods($workshop_id,$element->elementno,$ele_info,$restore);
|
||||
//We have to restore the workshop_stockcomment table now (course level table)
|
||||
$status = workshop_stockcomments_restore_mods($workshop_id,$element->elementno,$ele_info,$restore);
|
||||
} else {
|
||||
$status = false;
|
||||
}
|
||||
@ -207,6 +212,50 @@
|
||||
}
|
||||
|
||||
|
||||
//This function restores the workshop_stockcomments
|
||||
function workshop_stockcomments_restore_mods($new_workshop_id, $elementno, $info, $restore) {
|
||||
|
||||
global $CFG;
|
||||
|
||||
$status = true;
|
||||
|
||||
//Get the stockcomments array (optional)
|
||||
if (isset($info['#']['STOCKCOMMENTS']['0']['#']['STOCKCOMMENT'])) {
|
||||
$stockcomments = $info['#']['STOCKCOMMENTS']['0']['#']['STOCKCOMMENT'];
|
||||
|
||||
//Iterate over stock comments
|
||||
for($i = 0; $i < sizeof($stockcomments); $i++) {
|
||||
$com_info = $stockcomments[$i];
|
||||
//traverse_xmlize($com_info); //Debug
|
||||
//print_object ($GLOBALS['traverse_array']); //Debug
|
||||
//$GLOBALS['traverse_array']=""; //Debug
|
||||
|
||||
//Now, build the WORKSHOP_STOCKCOMMENTS record structure
|
||||
$stockcomment->workshopid = $new_workshop_id;
|
||||
$stockcomment->elementno = $elementno;
|
||||
$stockcomment->comments = backup_todb($com_info['#']['COMMENT_TEXT']['0']['#']);
|
||||
|
||||
//The structure is equal to the db, so insert the workshop_comment
|
||||
$newid = insert_record ("workshop_stockcomments",$stockcomment);
|
||||
|
||||
//Do some output
|
||||
if (($i+1) % 50 == 0) {
|
||||
echo ".";
|
||||
if (($i+1) % 1000 == 0) {
|
||||
echo "<br />";
|
||||
}
|
||||
backup_flush(300);
|
||||
}
|
||||
|
||||
if (!$newid) {
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
//This function restores the workshop_submissions
|
||||
function workshop_submissions_restore_mods($old_workshop_id, $new_workshop_id,$info,$restore) {
|
||||
|
||||
@ -235,13 +284,10 @@
|
||||
$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']['#']);
|
||||
$submission->reliabilitygrade = backup_todb($sub_info['#']['RELIABILITYGRADE']['0']['#']);
|
||||
$submission->gradinggrade = backup_todb($sub_info['#']['GRADINGGRADE']['0']['#']);
|
||||
$submission->finalgrade = backup_todb($sub_info['#']['FINALGRADE']['0']['#']);
|
||||
$submission->late = backup_todb($sub_info['#']['LATE']['0']['#']);
|
||||
$submission->nassessments = backup_todb($sub_info['#']['NASSESSMENTS']['0']['#']);
|
||||
|
||||
//We have to recode the userid field
|
||||
$user = backup_getid($restore->backup_unique_code,"user",$olduserid);
|
||||
|
@ -309,6 +309,100 @@
|
||||
}
|
||||
|
||||
|
||||
/*************** display current grades (by teacher) ***************************/
|
||||
elseif ($action == 'displaycurrentgrades') {
|
||||
|
||||
if (groupmode($course, $cm) == SEPARATEGROUPS) {
|
||||
$groupid = get_current_group($course->id);
|
||||
} else {
|
||||
$groupid = 0;
|
||||
}
|
||||
print_heading_with_help(get_string("displayofcurrentgrades", "workshop"), "finalgrades", "workshop");
|
||||
|
||||
if ($workshop->ntassessments) {
|
||||
// display the teacher's submissions
|
||||
echo "<center><table border=\"1\" width=\"90%\"><tr>\n";
|
||||
echo "<td bgcolor=\"$THEME->cellheading2\"><b>$course->teacher ".get_string("submission", "workshop").
|
||||
"</b></td>";
|
||||
echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("assessmentsby", "workshop",
|
||||
$course->teachers)."</b></td>";
|
||||
echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("assessmentsby", "workshop",
|
||||
$course->students)."</b></td></tr>";
|
||||
if ($submissions = workshop_get_teacher_submissions($workshop)) {
|
||||
foreach ($submissions as $submission) {
|
||||
echo "<tr><td>".workshop_print_submission_title($workshop, $submission)."</td>\n";
|
||||
echo "<td align=\"center\">".workshop_print_submission_assessments($workshop, $submission,
|
||||
"teacher")."</td>";
|
||||
echo "<td align=\"center\">".workshop_print_submission_assessments($workshop, $submission,
|
||||
"student")."</td></tr>";
|
||||
}
|
||||
}
|
||||
echo "</table><br clear=\"all\" />\n";
|
||||
workshop_print_key($workshop);
|
||||
}
|
||||
|
||||
// Get all the students
|
||||
if (!$users = get_course_students($course->id, "u.lastname, u.firstname")) {
|
||||
print_heading(get_string("nostudentsyet"));
|
||||
print_footer($course);
|
||||
exit;
|
||||
}
|
||||
|
||||
// show the current grades as stored in the tables...
|
||||
echo "<center><table border=\"1\" width=\"90%\"><tr>
|
||||
<td bgcolor=\"$THEME->cellheading2\"><b>".$course->student."</b></td>";
|
||||
echo "<td bgcolor=\"$THEME->cellheading2\"><b>".get_string("submission", "workshop")."</b></td>";
|
||||
if ($workshop->wtype) {
|
||||
echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("assessmentsdone", "workshop").
|
||||
"</b></td>";
|
||||
echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("gradeforassessments",
|
||||
"workshop")."</b></td>";
|
||||
}
|
||||
echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("assessmentsby", "workshop",
|
||||
$course->teachers)."</b></td>";
|
||||
if ($workshop->wtype) {
|
||||
echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("assessmentsby", "workshop",
|
||||
$course->students)."</b></td>";
|
||||
}
|
||||
echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("gradeforsubmission",
|
||||
"workshop")."</b></td>";
|
||||
echo "<td bgcolor=\"$THEME->cellheading2\" align=\"center\"><b>".get_string("overallgrade", "workshop").
|
||||
"</b></td></tr>\n";
|
||||
|
||||
foreach ($users as $user) {
|
||||
// skip if student not in group
|
||||
if ($groupid) {
|
||||
if (!ismember($groupid, $user->id)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ($submissions = workshop_get_user_submissions($workshop, $user)) {
|
||||
$gradinggrade = workshop_gradinggrade($workshop, $user);
|
||||
foreach ($submissions as $submission) {
|
||||
$grade = workshop_submission_grade($workshop, $submission);
|
||||
echo "<tr><td>$user->firstname $user->lastname</td>";
|
||||
echo "<td>".workshop_print_submission_title($workshop, $submission)."</td>\n";
|
||||
if ($workshop->wtype) {
|
||||
echo "<td align=\"center\">".workshop_print_user_assessments($workshop, $user)."</td>";
|
||||
echo "<td align=\"center\">$gradinggrade</td>";
|
||||
}
|
||||
echo "<td align=\"center\">".workshop_print_submission_assessments($workshop, $submission,
|
||||
"teacher")."</td>";
|
||||
if ($workshop->wtype) {
|
||||
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";
|
||||
workshop_print_key($workshop);
|
||||
print_continue("view.php?id=$cm->id");
|
||||
}
|
||||
|
||||
|
||||
/******************* edit submission ************************************/
|
||||
elseif ($action == 'editsubmission' ) {
|
||||
|
||||
|
@ -35,7 +35,23 @@
|
||||
if (!$title = $form->title) {
|
||||
$title = get_string("notitle", "workshop");
|
||||
}
|
||||
|
||||
|
||||
// check that this is not a "rapid" second submission, caused by using the back button
|
||||
// only check if a student, teachers may want to submit a set of workshop examples rapidly
|
||||
if (isstudent($course->id)) {
|
||||
if ($submissions = workshop_get_user_submissions($exercise, $USER)) {
|
||||
// returns all submissions, newest on first
|
||||
foreach ($submissions as $submission) {
|
||||
if ($submission->timecreated > $timenow - $CFG->maxeditingtime) {
|
||||
// ignore this new submission
|
||||
redirect("view.php?id=$cm->id");
|
||||
print_footer($course);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get the current set of submissions
|
||||
$submissions = workshop_get_user_submissions($workshop, $USER);
|
||||
// add new submission record
|
||||
@ -101,3 +117,4 @@
|
||||
print_footer($course);
|
||||
|
||||
?>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
// This fragment is called by /admin/index.php
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$module->version = 2004092700;
|
||||
$module->version = 2004111000;
|
||||
$module->requires = 2004091700; // Requires this Moodle version
|
||||
$module->cron = 60;
|
||||
|
||||
|
@ -289,9 +289,10 @@
|
||||
workshop_list_assessed_submissions($workshop, $USER);
|
||||
}
|
||||
// list any assessments by teachers
|
||||
if (workshop_count_teacher_assessments($workshop, $USER)) {
|
||||
$timenow = time();
|
||||
if (workshop_count_teacher_assessments_by_user($workshop, $USER) and ($timenow > $workshop->releasegrades)) {
|
||||
print_heading(get_string("assessmentsby", "workshop", $course->teachers));
|
||||
workshop_list_teacher_assessments($workshop, $USER);
|
||||
workshop_list_teacher_assessments_by_user($workshop, $USER);
|
||||
}
|
||||
// ... and show peer assessments
|
||||
if (workshop_count_peer_assessments($workshop, $USER)) {
|
||||
@ -462,6 +463,8 @@
|
||||
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=displaycurrentgrades\">".
|
||||
get_string("displayofcurrentgrades", "workshop")."</a>");
|
||||
break;
|
||||
|
||||
case 5: // Show "Final" Grades
|
||||
|
Loading…
x
Reference in New Issue
Block a user