Some minor improvements, see Workshop Forum.

This commit is contained in:
rkingdon
2003-11-13 16:22:27 +00:00
parent 8d8deea21a
commit a50f447b04
3 changed files with 220 additions and 182 deletions
+51 -53
View File
@@ -214,7 +214,7 @@
}
// there can be an assessment record (for teacher submissions), if there isn't...
if (!$assessment = workshop_get_submission_assessment($submission, $USER)) {
if (!get_record("workshop_assessments", "submissionid", $submission->id, "userid", $USER->id)) {
$yearfromnow = time() + 365 * 86400;
// ...create one and set timecreated way in the future, this is reset when record is updated
$assessment->workshopid = $workshop->id;
@@ -271,19 +271,19 @@
<?PHP
// now show the comment
echo "<TR valign=top>\n";
echo " <TD align=right><P><B>". get_string("comment", "workshop").":</B></P></TD>\n";
echo " <TD>\n";
echo "<TR valign=top>\n";
echo " <TD align=right><P><B>". get_string("comment", "workshop").":</B></P></TD>\n";
echo " <TD>\n";
echo " <textarea name=\"comments\" rows=5 cols=75 wrap=\"virtual\">\n";
if (isset($comment->comments)) {
echo $comment->comments;
}
echo " </textarea>\n";
echo " </textarea>\n";
echo " </TD></TR></TABLE>\n";
echo "<INPUT TYPE=submit VALUE=\"".get_string("savemycomment", "workshop")."\">\n";
echo "</CENTER></FORM>\n";
workshop_print_assessment($workshop, $assessment);
}
}
/*********************** edit assessment elements (for teachers) ***********************/
@@ -321,16 +321,17 @@
$elements[$i]->weight = 11;
}
}
switch ($workshop->gradingstrategy) {
case 0: // no grading
for ($i=0; $i<$workshop->nelements; $i++) {
$iplus1 = $i+1;
echo "<TR valign=top>\n";
echo " <TD ALIGN=RIGHT><P><B>". get_string("element","workshop")." $iplus1:</B></TD>\n";
echo "<TD><textarea name=\"description[]\" rows=3 cols=75 wrap=\"virtual\">".$elements[$i]->description."</textarea>\n";
echo "<TR valign=top>\n";
echo " <TD ALIGN=RIGHT><P><B>". get_string("element","workshop")." $iplus1:</B></TD>\n";
echo "<TD><textarea name=\"description[]\" rows=3 cols=75 wrap=\"virtual\">".$elements[$i]->description."</textarea>\n";
echo " </TD></TR>\n";
echo "<TR valign=top>\n";
echo " <TD colspan=2 BGCOLOR=\"$THEME->cellheading2\">&nbsp;</TD>\n";
echo "<TR valign=top>\n";
echo " <TD colspan=2 BGCOLOR=\"$THEME->cellheading2\">&nbsp;</TD>\n";
echo "</TR>\n";
}
break;
@@ -342,9 +343,9 @@
}
for ($i=0; $i<$workshop->nelements; $i++) {
$iplus1 = $i+1;
echo "<TR valign=top>\n";
echo " <TD ALIGN=RIGHT><P><B>". get_string("element","workshop")." $iplus1:</B></TD>\n";
echo "<TD><textarea name=\"description[]\" rows=3 cols=75 wrap=\"virtual\">".$elements[$i]->description."</textarea>\n";
echo "<TR valign=top>\n";
echo " <TD ALIGN=RIGHT><P><B>". get_string("element","workshop")." $iplus1:</B></TD>\n";
echo "<TD><textarea name=\"description[]\" rows=3 cols=75 wrap=\"virtual\">".$elements[$i]->description."</textarea>\n";
echo " </TD></TR>\n";
echo "<TR valign=top>\n";
echo " <TD align=right><P><B>". get_string("typeofscale", "workshop"). ":</B></P></TD>\n";
@@ -358,8 +359,8 @@
workshop_choose_from_menu($WORKSHOP_EWEIGHTS, "weight[]", $elements[$i]->weight, "");
echo " </TD>\n";
echo "</TR>\n";
echo "<TR valign=top>\n";
echo " <TD colspan=2 BGCOLOR=\"$THEME->cellheading2\">&nbsp;</TD>\n";
echo "<TR valign=top>\n";
echo " <TD colspan=2 BGCOLOR=\"$THEME->cellheading2\">&nbsp;</TD>\n";
echo "</TR>\n";
}
break;
@@ -367,9 +368,9 @@
case 2: // error banded grading
for ($i=0; $i<$workshop->nelements; $i++) {
$iplus1 = $i+1;
echo "<TR valign=top>\n";
echo " <TD ALIGN=RIGHT><P><B>". get_string("element","workshop")." $iplus1:</B></TD>\n";
echo "<TD><textarea name=\"description[$i]\" rows=3 cols=75 wrap=\"virtual\">".$elements[$i]->description."</textarea>\n";
echo "<TR valign=top>\n";
echo " <TD ALIGN=RIGHT><P><B>". get_string("element","workshop")." $iplus1:</B></TD>\n";
echo "<TD><textarea name=\"description[$i]\" rows=3 cols=75 wrap=\"virtual\">".$elements[$i]->description."</textarea>\n";
echo " </TD></TR>\n";
if ($elements[$i]->weight == '') { // not set
$elements[$i]->weight = 11; // unity
@@ -379,8 +380,8 @@
workshop_choose_from_menu($WORKSHOP_EWEIGHTS, "weight[]", $elements[$i]->weight, "");
echo " </TD>\n";
echo "</TR>\n";
echo "<TR valign=top>\n";
echo " <TD colspan=2 BGCOLOR=\"$THEME->cellheading2\">&nbsp;</TD>\n";
echo "<TR valign=top>\n";
echo " <TD colspan=2 BGCOLOR=\"$THEME->cellheading2\">&nbsp;</TD>\n";
echo "</TR>\n";
}
echo "</CENTER></TABLE><BR>\n";
@@ -388,7 +389,7 @@
echo "<CENTER><TABLE cellpadding=5 border=1><TR><TD ALIGN=\"CENTER\">".
get_string("numberofnegativeresponses", "workshop");
echo "</TD><TD>". get_string("suggestedgrade", "workshop")."</TD></TR>\n";
for ($j = 100; $j >= 0; $j--) {
for ($j = $workshop->grade; $j >= 0; $j--) {
$numbers[$j] = $j;
}
for ($i=0; $i<=$workshop->nelements; $i++) {
@@ -409,15 +410,15 @@
}
for ($i=0; $i<$workshop->nelements; $i++) {
$iplus1 = $i+1;
echo "<TR valign=top>\n";
echo " <TD ALIGN=RIGHT><P><B>". get_string("criterion","workshop")." $iplus1:</B></TD>\n";
echo "<TD><textarea name=\"description[$i]\" rows=3 cols=75 wrap=\"virtual\">".$elements[$i]->description."</textarea>\n";
echo "<TR valign=top>\n";
echo " <TD ALIGN=RIGHT><P><B>". get_string("criterion","workshop")." $iplus1:</B></TD>\n";
echo "<TD><textarea name=\"description[$i]\" rows=3 cols=75 wrap=\"virtual\">".$elements[$i]->description."</textarea>\n";
echo " </TD></TR>\n";
echo "<TR><TD><B>". get_string("suggestedgrade", "workshop").":</B></TD><TD>\n";
choose_from_menu($numbers, "maxscore[$i]", $elements[$i]->maxscore, "");
echo "</TD></TR>\n";
echo "<TR valign=top>\n";
echo " <TD colspan=2 BGCOLOR=\"$THEME->cellheading2\">&nbsp;</TD>\n";
echo "<TR valign=top>\n";
echo " <TD colspan=2 BGCOLOR=\"$THEME->cellheading2\">&nbsp;</TD>\n";
echo "</TR>\n";
}
break;
@@ -433,7 +434,7 @@
}
for ($i=0; $i<$workshop->nelements; $i++) {
$iplus1 = $i+1;
echo "<TR valign=top>\n";
echo "<TR valign=top>\n";
echo " <TD ALIGN=RIGHT><P><B>". get_string("element","workshop")." $iplus1:</B></TD>\n";
echo "<TD><textarea name=\"description[$i]\" rows=3 cols=75 wrap=\"virtual\">".$elements[$i]->description."</textarea>\n";
echo " </TD></TR>\n";
@@ -511,7 +512,7 @@
<?PHP
// now get the teacher's comment
echo "<TR valign=top>\n";
echo "<TR valign=top>\n";
echo " <TD align=right><P><B>". get_string("teacherscomment", "workshop").":</B></P></TD>\n";
echo " <TD>\n";
echo " <textarea name=\"teachercomment\" rows=5 cols=75 wrap=\"virtual\">\n";
@@ -559,7 +560,7 @@
if (!isteacher($course->id)) {
error("Only teachers can look at this page");
}
}
$form = (object)$HTTP_POST_VARS;
@@ -578,9 +579,9 @@
$element->elementno = $key;
if (!$element->id = insert_record("workshop_elements", $element)) {
error("Could not insert workshop element!");
}
}
}
}
break;
case 1: // accumulative grading
@@ -598,16 +599,16 @@
break;
case 'selection' : $element->maxscore = $WORKSHOP_SCALES[$form->scale[$key]]['size'];
break;
}
}
if (isset($form->weight[$key])) {
$element->weight = $form->weight[$key];
}
if (!$element->id = insert_record("workshop_elements", $element)) {
error("Could not insert workshop element!");
}
}
if (isset($form->weight[$key])) {
$element->weight = $form->weight[$key];
}
if (!$element->id = insert_record("workshop_elements", $element)) {
error("Could not insert workshop element!");
}
}
}
break;
case 2: // error banded grading...
@@ -620,14 +621,14 @@
$element->maxscore = $themaxscore;
if (isset($form->description[$key])) {
$element->description = $form->description[$key];
}
}
if (isset($form->weight[$key])) {
$element->weight = $form->weight[$key];
}
}
if (!$element->id = insert_record("workshop_elements", $element)) {
error("Could not insert workshop element!");
}
}
}
break;
case 4: // ...and criteria grading
@@ -641,12 +642,12 @@
for ($j=0;$j<5;$j++) {
if (empty($form->rubric[$key][$j]))
break;
}
}
$element->maxscore = $j - 1;
if (!$element->id = insert_record("workshop_elements", $element)) {
error("Could not insert workshop element!");
}
}
}
// let's not fool around here, dump the junk!
delete_records("workshop_rubrics", "workshopid", $workshop->id);
for ($i=0;$i<$workshop->nelements;$i++) {
@@ -654,23 +655,21 @@
unset($element);
if (empty($form->rubric[$i][$j])) { // OK to have an element with fewer than 5 items
break;
}
}
$element->workshopid = $workshop->id;
$element->elementno = $i;
$element->rubricno = $j;
$element->description = $form->rubric[$i][$j];
if (!$element->id = insert_record("workshop_rubrics", $element)) {
error("Could not insert workshop element!");
}
}
}
}
break;
} // end of switch
} // end of switch
echo "<P>\n";
notice_yesno(get_string("amendassessmentelements","workshop")." ".get_string("again"),
"assessments.php?id=$cm->id&action=editelements", "view.php?id=$cm->id");
}
redirect("view.php?id=$cm->id", get_string("savedok","workshop"));
}
/*********************** list assessments for grading (Student submissions)(by teachers)***********************/
@@ -799,8 +798,7 @@
if (!$element->id = insert_record("workshop_grades", $element)) {
error("Could not insert workshop element!");
}
$grade = ($elements[intval($error + 0.5)]->maxscore + $form->grade[$i]) *
$workshop->grade / 100;
$grade = ($elements[intval($error + 0.5)]->maxscore + $form->grade[$i]);
echo "<P><B>".get_string("weightederrorcount", "workshop", intval($error + 0.5))."</B>\n";
break;
@@ -890,7 +888,7 @@
// show grade if grading strategy is not zero
if ($workshop->gradingstrategy) {
redirect($returnto, get_string("thegradeis", "workshop").": ".number_format($grade, 2).
"% (".get_string("maximumgrade")." ".number_format($workshop->grade)."%)");
" (".get_string("maximumgrade")." ".number_format($workshop->grade).")");
}
else {
redirect($returnto);
+76 -42
View File
@@ -97,7 +97,13 @@ function workshop_cron () {
foreach ($assessments as $assessment) {
echo "Processing workshop assessment $assessment->id\n";
if (! $submission = get_record("workshop_submissions", "id", "$assessment->submissionid")) {
// only process the entry once
if (! set_field("workshop_assessments", "mailed", "1", "id", "$assessment->id")) {
echo "Could not update the mailed field for id $assessment->id\n";
}
if (! $submission = get_record("workshop_submissions", "id", "$assessment->submissionid")) {
echo "Could not find submission $assessment->submissionid\n";
continue;
}
@@ -129,7 +135,10 @@ function workshop_cron () {
$assessmentowner->id)) {
continue; // Not an active participant
}
// don't sent self assessment
if ($submissionowner->id == $assessmentowner->id) {
continue;
}
$strworkshops = get_string("modulenameplural", "workshop");
$strworkshop = get_string("modulename", "workshop");
@@ -139,11 +148,11 @@ function workshop_cron () {
// "Your assignment \"$submission->title\" has been assessed by"
if (isstudent($course->id, $assessmentowner->id)) {
$msg = get_string("mail1", "workshop", $submission->title)." a $course->student.\n";
}
}
else {
$msg = get_string("mail1", "workshop", $submission->title).
" $assessmentowner->firstname $assessmentowner->lastname.\n";
}
}
// "The comments and grade can be seen in the workshop assignment '$workshop->name'
$msg .= get_string("mail2", "workshop", $workshop->name)."\n\n";
@@ -156,31 +165,28 @@ function workshop_cron () {
$posttext .= " $CFG->wwwroot/mod/workshop/view.php?id=$cm->id\n";
$posttext .= "---------------------------------------------------------------------\n";
if ($sendto->mailformat == 1) { // HTML
$posthtml = "<P><FONT FACE=sans-serif>".
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> ->".
"<A HREF=\"$CFG->wwwroot/mod/workshop/index.php?id=$course->id\">$strworkshops</A> ->".
"<A HREF=\"$CFG->wwwroot/mod/workshop/view.php?id=$cm->id\">$workshop->name</A></FONT></P>";
$posthtml .= "<HR><FONT FACE=sans-serif>";
$posthtml .= "<P>$msg</P>";
$posthtml .= "<P>".get_string("mail3", "workshop").
" <A HREF=\"$CFG->wwwroot/mod/workshop/view.php?id=$cm->id\">$workshop->name</A>.</P></FONT><HR>";
$posthtml = "<P><FONT FACE=sans-serif>".
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> ->".
"<A HREF=\"$CFG->wwwroot/mod/workshop/index.php?id=$course->id\">$strworkshops</A> ->".
"<A HREF=\"$CFG->wwwroot/mod/workshop/view.php?id=$cm->id\">$workshop->name</A></FONT></P>";
$posthtml .= "<HR><FONT FACE=sans-serif>";
$posthtml .= "<P>$msg</P>";
$posthtml .= "<P>".get_string("mail3", "workshop").
" <A HREF=\"$CFG->wwwroot/mod/workshop/view.php?id=$cm->id\">$workshop->name</A>.</P></FONT><HR>";
} else {
$posthtml = "";
$posthtml = "";
}
if (!$teacher = get_teacher($course->id)) {
echo "Error: can not find teacher for course $course->id!\n";
}
}
if (! email_to_user($sendto, $teacher, $postsubject, $posttext, $posthtml)) {
echo "Error: workshop cron: Could not send out mail for id $submission->id to
user $sendto->id ($sendto->email)\n";
}
if (! set_field("workshop_assessments", "mailed", "1", "id", "$assessment->id")) {
echo "Could not update the mailed field for id $assessment->id\n";
}
}
}
}
// look for new assessments of resubmissions
if ($assessments = workshop_get_unmailed_resubmissions($cutofftime)) {
@@ -189,7 +195,13 @@ function workshop_cron () {
foreach ($assessments as $assessment) {
echo "Processing workshop assessment $assessment->id\n";
if (! $submission = get_record("workshop_submissions", "id", "$assessment->submissionid")) {
// only process the entry once
if (! set_field("workshop_assessments", "mailed", "1", "id", "$assessment->id")) {
echo "Could not update the mailed field for id $assessment->id\n";
}
if (! $submission = get_record("workshop_submissions", "id", "$assessment->submissionid")) {
echo "Could not find submission $assessment->submissionid\n";
continue;
}
@@ -263,9 +275,6 @@ function workshop_cron () {
echo "Error: workshop cron: Could not send out mail for id $submission->id to
user $sendto->id ($sendto->email)\n";
}
if (! set_field("workshop_assessments", "mailed", "1", "id", "$assessment->id")) {
echo "Could not update the mailed field for id $assessment->id\n";
}
}
}
@@ -276,7 +285,13 @@ function workshop_cron () {
foreach ($comments as $comment) {
echo "Processing workshop comment $comment->id\n";
if (! $assessment = get_record("workshop_assessments", "id", "$comment->assessmentid")) {
// only process the entry once
if (! set_field("workshop_comments", "mailed", "1", "id", "$comment->id")) {
echo "Could not update the mailed field for comment id $comment->id\n";
}
if (! $assessment = get_record("workshop_assessments", "id", "$comment->assessmentid")) {
echo "Could not find assessment $comment->assessmentid\n";
continue;
}
@@ -361,9 +376,6 @@ function workshop_cron () {
echo "Error: workshop cron: Could not send out mail for id $submission->id to user
$sendto->id ($sendto->email)\n";
}
if (! set_field("workshop_comments", "mailed", "1", "id", "$comment->id")) {
echo "Could not update the mailed field for comment id $comment->id\n";
}
}
// see if the assessor needs to to told
if ($comment->userid != $assessment->userid) {
@@ -425,6 +437,11 @@ function workshop_cron () {
foreach ($assessments as $assessment) {
echo "Processing workshop assessment $assessment->id (graded)\n";
// only process the entry once
if (! set_field("workshop_assessments", "mailed", "1", "id", "$assessment->id")) {
echo "Could not update the mailed field for id $assessment->id\n";
}
if (! $submission = get_record("workshop_submissions", "id", "$assessment->submissionid")) {
echo "Could not find submission $assessment->submissionid\n";
@@ -500,9 +517,6 @@ function workshop_cron () {
echo "Error: workshop cron: Could not send out mail for id $submission->id to user
$sendto->id ($sendto->email)\n";
}
if (! set_field("workshop_assessments", "mailed", "1", "id", "$assessment->id")) {
echo "Could not update the mailed field for id $assessment->id\n";
}
}
}
@@ -1541,8 +1555,11 @@ function workshop_get_student_submissions($workshop, $order = "title") {
//////////////////////////////////////////////////////////////////////////////////////
function workshop_get_submission_assessment($submission, $user) {
// Return the user's assessment for this submission
return get_record("workshop_assessments", "submissionid", $submission->id, "userid", $user->id);
// Return the user's assessment for this submission (cold or warm, not hot)
$timenow = time();
return get_record_select("workshop_assessments", "submissionid = $submission->id AND
userid = $user->id AND timecreated < $timenow");
}
@@ -2046,6 +2063,7 @@ function workshop_list_student_submissions($workshop, $user) {
// of assessments are show first
global $CFG;
$timenow = time();
if (! $course = get_record("course", "id", $workshop->course)) {
error("Course is misconfigured");
}
@@ -2066,8 +2084,12 @@ function workshop_list_student_submissions($workshop, $user) {
if ($nassessed < $workshop->nsassessments) {
// count the number of assessments for each student submission
if ($submissions = workshop_get_student_submissions($workshop)) {
srand ((float)microtime()*1000000); // initialise random number generator
// srand ((float)microtime()*1000000); // now done automatically in PHP 4.2.0->
foreach ($submissions as $submission) {
// process only cold submissions
if (($submission->timecreated + $CFG->maxeditingtime) > $timenow) {
continue;
}
$n = count_records("workshop_assessments", "submissionid", $submission->id);
// ...OK to have zero, we add a small random number to randomise things
$nassessments[$submission->id] = $n + rand(0, 98) / 100;
@@ -2085,7 +2107,8 @@ function workshop_list_student_submissions($workshop, $user) {
// skip submission if it belongs to this user
if ($submission->userid != $user->id) {
// add a "hot" assessment record if user has NOT already assessed this submission
if (!$assessment = workshop_get_submission_assessment($submission, $user)) {
if (!get_record("workshop_assessments", "submissionid", $submission->id, "userid",
$user->id)) {
$yearfromnow = time() + 365 * 86400;
// ...create one and set timecreated way in the future, this is reset when record is updated
$assessment->workshopid = $workshop->id;
@@ -2246,7 +2269,7 @@ function workshop_list_submissions_for_admin($workshop, $order) {
$title .= $submission->title;
// test for allocated assesments which have not been done
if ($assessment->timecreated < $timenow) {
$title .= " {".number_format($assessment->grade, 0)."%";
$title .= " {".number_format($assessment->grade, 0);
}
else { // assessment record created but user has not yet assessed this submission
$title .= " {-";
@@ -2406,7 +2429,8 @@ function workshop_list_teacher_submissions($workshop, $user) {
foreach ($nassessments as $submissionid => $n) { // break out of loop when we allocated enough assessments...
$submission = get_record("workshop_submissions", "id", $submissionid);
// ... provided the user has NOT already assessed that submission...
if (!$assessment = workshop_get_submission_assessment($submission, $user)) {
if (!get_record("workshop_assessments", "submissionid", $submission->id, "userid",
$user->id)) {
$yearfromnow = time() + 365 * 86400;
// ...create one and set timecreated way in the future, this is reset when record is updated
$assessment->workshopid = $workshop->id;
@@ -2723,8 +2747,8 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
// only show the grade if grading strategy > 0 and the grade is positive
if ($showgrades and $assessment->grade >= 0) {
echo "<CENTER><B>".get_string("thegradeis", "workshop").": ".number_format($assessment->grade, 2)."% (".
get_string("maximumgrade")." ".number_format($workshop->grade, 0)."%)</B></CENTER><BR CLEAR=ALL>\n";
echo "<CENTER><B>".get_string("thegradeis", "workshop").": ".number_format($assessment->grade, 2)." (".
get_string("maximumgrade")." ".number_format($workshop->grade, 0).")</B></CENTER><BR CLEAR=ALL>\n";
}
}
@@ -2986,7 +3010,8 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
}
}
echo "</TABLE></CENTER>\n";
echo "<P><CENTER><TABLE cellpadding=5 border=1><TR><TD>".get_string("adjustment", "workshop")."</TD><TD>\n";
echo "<P><CENTER><TABLE cellpadding=5 border=1><TR><TD><b>".get_string("optionaladjustment",
"workshop")."</b></TD><TD>\n";
unset($numbers);
for ($j = 20; $j >= -20; $j--) {
$numbers[$j] = $j;
@@ -3027,7 +3052,8 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
echo "<TD align=center>{$elements[$i]->maxscore}</TD></TR>\n";
}
echo "</TABLE></CENTER>\n";
echo "<P><CENTER><TABLE cellpadding=5 border=1><TR><TD>".get_string("adjustment", "workshop")."</TD><TD>\n";
echo "<P><CENTER><TABLE cellpadding=5 border=1><TR><TD><b>".get_string("optionaladjustment",
"workshop")."</b></TD><TD>\n";
unset($numbers);
for ($j = 20; $j >= -20; $j--) {
$numbers[$j] = $j;
@@ -3102,7 +3128,15 @@ function workshop_print_assessment($workshop, $assessment = false, $allowchanges
// now get the general comment (present in all types)
echo "<tr valign=\"top\">\n";
echo " <td align=\"right\"><P><B>". get_string("generalcomment", "workshop").":</B></P></TD>\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";
}
echo " <td>\n";
if ($allowchanges) {
echo " <textarea name=\"generalcomment\" rows=5 cols=75 wrap=\"virtual\">\n";
@@ -3354,7 +3388,7 @@ function workshop_print_submission_assessments($workshop, $submission, $type) {
foreach ($assessments as $assessment) {
if (isteacher($workshop->course, $assessment->userid)) {
$str .= "<A HREF=\"assessments.php?action=viewassessment&a=$workshop->id&aid=$assessment->id\">[";
$str .= number_format($assessment->grade, 0)."%";
$str .= number_format($assessment->grade, 0);
if ($assessment->gradinggrade) { // funny, teacher is grading self!
$str .= "/".number_format($assessment->gradinggrade*100/COMMENTSCALE, 0)."%";
}
@@ -3369,7 +3403,7 @@ function workshop_print_submission_assessments($workshop, $submission, $type) {
foreach ($assessments as $assessment) {
if (isstudent($workshop->course, $assessment->userid)) {
$str .= "<A HREF=\"assessments.php?action=viewassessment&a=$workshop->id&aid=$assessment->id\">{";
$str .= number_format($assessment->grade, 0)."%";
$str .= number_format($assessment->grade, 0);
if ($assessment->gradinggrade) {
$str .= "/".number_format($assessment->gradinggrade*100/COMMENTSCALE, 0)."%";
}
+93 -87
View File
@@ -169,36 +169,38 @@
$status = true;
//Get the workshop_rubrics array
$rubrics = $info['#']['RUBRICS']['0']['#']['RUBRIC'];
//Get the workshop_rubrics array (optional)
if (isset($info['#']['RUBRICS']['0']['#']['RUBRIC'])) {
$rubrics = $info['#']['RUBRICS']['0']['#']['RUBRIC'];
//Iterate over workshop_rubrics
for($i = 0; $i < sizeof($rubrics); $i++) {
$rub_info = $rubrics[$i];
//traverse_xmlize($rub_info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//Iterate over workshop_rubrics
for($i = 0; $i < sizeof($rubrics); $i++) {
$rub_info = $rubrics[$i];
//traverse_xmlize($rub_info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//Now, build the WORKSHOP_RUBRICS record structure
$rubric->workshopid = $workshop_id;
$rubric->elementno = $elementno;
$rubric->rubricno = backup_todb($rub_info['#']['RUBRICNO']['0']['#']);
$rubric->description = backup_todb($rub_info['#']['DESCRIPTION']['0']['#']);
//Now, build the WORKSHOP_RUBRICS record structure
$rubric->workshopid = $workshop_id;
$rubric->elementno = $elementno;
$rubric->rubricno = backup_todb($rub_info['#']['RUBRICNO']['0']['#']);
$rubric->description = backup_todb($rub_info['#']['DESCRIPTION']['0']['#']);
//The structure is equal to the db, so insert the workshop_rubrics
$newid = insert_record ("workshop_rubrics",$rubric);
//The structure is equal to the db, so insert the workshop_rubrics
$newid = insert_record ("workshop_rubrics",$rubric);
//Do some output
if (($i+1) % 10 == 0) {
echo ".";
if (($i+1) % 200 == 0) {
echo "<br>";
//Do some output
if (($i+1) % 10 == 0) {
echo ".";
if (($i+1) % 200 == 0) {
echo "<br>";
}
backup_flush(300);
}
backup_flush(300);
}
if (!$newid) {
$status = false;
if (!$newid) {
$status = false;
}
}
}
return $status;
@@ -218,9 +220,9 @@
//Iterate over submissions
for($i = 0; $i < sizeof($submissions); $i++) {
$sub_info = $submissions[$i];
//traverse_xmlize($sub_info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//traverse_xmlize($sub_info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//We'll need this later!!
$oldid = backup_todb($sub_info['#']['ID']['0']['#']);
@@ -357,47 +359,49 @@
$status = true;
//Get the comments array
$comments = $info['#']['COMMENTS']['0']['#']['COMMENT'];
//Get the comments array (optional)
if (isset($info['#']['COMMENTS']['0']['#']['COMMENT'])) {
$comments = $info['#']['COMMENTS']['0']['#']['COMMENT'];
//Iterate over comments
for($i = 0; $i < sizeof($comments); $i++) {
$com_info = $comments[$i];
//traverse_xmlize($com_info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//Iterate over comments
for($i = 0; $i < sizeof($comments); $i++) {
$com_info = $comments[$i];
//traverse_xmlize($com_info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//We'll need this later!!
$olduserid = backup_todb($com_info['#']['USERID']['0']['#']);
//We'll need this later!!
$olduserid = backup_todb($com_info['#']['USERID']['0']['#']);
//Now, build the WORKSHOP_COMMENTS record structure
$comment->workshopid = $new_workshop_id;
$comment->assessmentid = $new_assessment_id;
$comment->userid = backup_todb($com_info['#']['USERID']['0']['#']);
$comment->timecreated = backup_todb($com_info['#']['TIMECREATED']['0']['#']);
$comment->mailed = backup_todb($com_info['#']['MAILED']['0']['#']);
$comment->comments = backup_todb($com_info['#']['COMMENT_TEXT']['0']['#']);
//Now, build the WORKSHOP_COMMENTS record structure
$comment->workshopid = $new_workshop_id;
$comment->assessmentid = $new_assessment_id;
$comment->userid = backup_todb($com_info['#']['USERID']['0']['#']);
$comment->timecreated = backup_todb($com_info['#']['TIMECREATED']['0']['#']);
$comment->mailed = backup_todb($com_info['#']['MAILED']['0']['#']);
$comment->comments = backup_todb($com_info['#']['COMMENT_TEXT']['0']['#']);
//We have to recode the userid field
$user = backup_getid($restore->backup_unique_code,"user",$olduserid);
if ($user) {
$comment->userid = $user->new_id;
}
//The structure is equal to the db, so insert the workshop_comment
$newid = insert_record ("workshop_comments",$comment);
//Do some output
if (($i+1) % 50 == 0) {
echo ".";
if (($i+1) % 1000 == 0) {
echo "<br>";
//We have to recode the userid field
$user = backup_getid($restore->backup_unique_code,"user",$olduserid);
if ($user) {
$comment->userid = $user->new_id;
}
backup_flush(300);
}
if (!$newid) {
$status = false;
//The structure is equal to the db, so insert the workshop_comment
$newid = insert_record ("workshop_comments",$comment);
//Do some output
if (($i+1) % 50 == 0) {
echo ".";
if (($i+1) % 1000 == 0) {
echo "<br>";
}
backup_flush(300);
}
if (!$newid) {
$status = false;
}
}
}
@@ -411,37 +415,39 @@
$status = true;
//Get the grades array
$grades = $info['#']['GRADES']['0']['#']['GRADE'];
//Get the grades array (optional)
if (isset($info['#']['GRADES']['0']['#']['GRADE'])) {
$grades = $info['#']['GRADES']['0']['#']['GRADE'];
//Iterate over grades
for($i = 0; $i < sizeof($grades); $i++) {
$gra_info = $grades[$i];
//traverse_xmlize($gra_info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//Iterate over grades
for($i = 0; $i < sizeof($grades); $i++) {
$gra_info = $grades[$i];
//traverse_xmlize($gra_info); //Debug
//print_object ($GLOBALS['traverse_array']); //Debug
//$GLOBALS['traverse_array']=""; //Debug
//Now, build the WORKSHOP_GRADES record structure
$grade->workshopid = $new_workshop_id;
$grade->assessmentid = $new_assessment_id;
$grade->elementno = backup_todb($gra_info['#']['ELEMENTNO']['0']['#']);
$grade->feedback = backup_todb($gra_info['#']['FEEDBACK']['0']['#']);
$grade->grade = backup_todb($gra_info['#']['GRADE_VALUE']['0']['#']);
//Now, build the WORKSHOP_GRADES record structure
$grade->workshopid = $new_workshop_id;
$grade->assessmentid = $new_assessment_id;
$grade->elementno = backup_todb($gra_info['#']['ELEMENTNO']['0']['#']);
$grade->feedback = backup_todb($gra_info['#']['FEEDBACK']['0']['#']);
$grade->grade = backup_todb($gra_info['#']['GRADE_VALUE']['0']['#']);
//The structure is equal to the db, so insert the workshop_grade
$newid = insert_record ("workshop_grades",$grade);
//The structure is equal to the db, so insert the workshop_grade
$newid = insert_record ("workshop_grades",$grade);
//Do some output
if (($i+1) % 50 == 0) {
echo ".";
if (($i+1) % 1000 == 0) {
echo "<br>";
//Do some output
if (($i+1) % 50 == 0) {
echo ".";
if (($i+1) % 1000 == 0) {
echo "<br>";
}
backup_flush(300);
}
backup_flush(300);
}
if (!$newid) {
$status = false;
if (!$newid) {
$status = false;
}
}
}