course)) { error("Course is misconfigured"); } if (! $workshop = get_record("workshop", "id", $cm->instance)) { error("Course module is incorrect"); } } else { if (! $workshop = get_record("workshop", "id", $a)) { error("Course module is incorrect"); } if (! $course = get_record("course", "id", $workshop->course)) { error("Course is misconfigured"); } if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id, $course->id)) { error("Course Module ID was incorrect"); } } require_login($course->id); // ...log activity... add_to_log($course->id, "workshop", "view", "view.php?id=$cm->id", "$workshop->id"); if ($course->category) { $navigation = "id\">$course->shortname ->"; } $strworkshops = get_string("modulenameplural", "workshop"); $strworkshop = get_string("modulename", "workshop"); // ...display header... print_header("$course->shortname: $workshop->name", "$course->fullname", "$navigation id>$strworkshops -> $workshop->name", "", "", true, update_module_button($cm->id, $course->id, $strworkshop), navmenu($course, $cm)); // ...and if necessary set default action optional_variable($action); if (isteacher($course->id)) { if (empty($action)) { // no action specified, either go straight to elements page else the admin page // has the assignment any elements if (count_records("workshop_elements", "workshopid", $workshop->id)) { $action = "teachersview"; } else { redirect("assessments.php?action=editelements&id=$cm->id"); } } } elseif (!isguest()) { // it's a student then if (!$cm->visible) { notice(get_string("activityiscurrentlyhidden")); } switch ($workshop->phase) { case 0 : case 1 : $action = 'notavailable'; break; case 2 : $action = 'studentsview'; break; case 3 : $action = 'notavailable'; break; case 4 : $action = 'displayfinalgrade'; } } else { // it's a guest, oh no! $action = 'notavailable'; } /*********************** close workshop for student assessments and submissions (move to phase 3) (for teachers)**/ if ($action == 'closeworkshop') { if (!isteacher($course->id)) { error("Only teachers can look at this page"); } // move tp phase 3 set_field("workshop", "phase", 3, "id", "$workshop->id"); redirect("view.php?a=$workshop->id", get_string("movingtophase", "workshop", 3)); } /******************* display final grade (for students) ************************************/ elseif ($action == 'displayfinalgrade' ) { // get the final weights from the database $teacherweight = get_field("workshop","teacherweight", "id", $workshop->id); $peerweight = get_field("workshop","peerweight", "id", $workshop->id); $includeteachersgrade = get_field("workshop","includeteachersgrade", "id", $workshop->id); $biasweight = get_field("workshop","biasweight", "id", $workshop->id); $reliabilityweight = get_field("workshop","reliabilityweight", "id", $workshop->id); $gradingweight = get_field("workshop","gradingweight", "id", $workshop->id); // work out what to show in the final grades tables and what to include in the calculation of the final grade // teacher grades? if ($workshop->gradingstrategy and $teacherweight) { $useteachersgrades = 1; } else { $useteachersgrades = 0; } // peergrades? if ($workshop->gradingstrategy and $workshop->nsassessments and $peerweight) { $usepeergrades = 1; } else { $usepeergrades = 0; } // bias grades? if ((($workshop->ntassessments >= 3) or ($workshop->nsassessments >= 3)) and $biasweight ) { $usebiasgrades = 1; } else { $usebiasgrades = 0; } // reliability grades? if ((($workshop->ntassessments >= 3) or ($workshop->nsassessments >= 3)) and $reliabilityweight ) { $usereliabilitygrades = 1; } else { $usereliabilitygrades = 0; } // grading grades? if (($workshop->ntassessments or $workshop->nsassessments) and $gradingweight ) { $usegradinggrades = 1; } else { $usegradinggrades = 0; } // show the final grades as stored in the tables... print_heading_with_help(get_string("displayoffinalgrades", "workshop"), "finalgrades", "workshop"); if ($submissions = workshop_get_user_submissions($workshop, $USER)) { // any submissions from user? echo "
".get_string("submissions", "workshop")." | "; if ($useteachersgrades) { echo "".get_string("teacherassessments", "workshop", $course->teacher)." | "; } if ($usepeergrades) { echo "".get_string("studentassessments", "workshop", $course->student)." | "; } echo "".get_string("assessmentsdone", "workshop")." | "; if ($usebiasgrades) { echo "".get_string("gradeforbias", "workshop")." | "; } if ($usereliabilitygrades) { echo "".get_string("gradeforreliability", "workshop")." | "; } if ($usegradinggrades) { echo "".get_string("gradeforassessments", "workshop")." | "; } echo "".get_string("overallgrade", "workshop")." |
".get_string("weights", "workshop")." | "; if ($useteachersgrades) { echo "$WORKSHOP_FWEIGHTS[$teacherweight] | \n"; } if ($usepeergrades) { echo "$WORKSHOP_FWEIGHTS[$peerweight] | \n"; } echo "\n"; if ($usebiasgrades) { echo " | $WORKSHOP_FWEIGHTS[$biasweight] | \n"; } if ($usereliabilitygrades) { echo "$WORKSHOP_FWEIGHTS[$reliabilityweight] | \n"; } if ($usegradinggrades) { echo "$WORKSHOP_FWEIGHTS[$gradingweight] | \n"; } echo "|
".workshop_print_submission_title($workshop, $submission)." | \n"; if ($useteachersgrades) { echo "".workshop_print_submission_assessments($workshop, $submission, "teacher")." | "; } if ($usepeergrades) { echo "".workshop_print_submission_assessments($workshop, $submission, "student")." | "; } echo "".workshop_print_user_assessments($workshop, $USER)." | "; if ($usebiasgrades) { echo "$submission->biasgrade | "; } if ($usereliabilitygrades) { echo "$submission->reliabilitygrade | "; } if ($usegradinggrades) { echo "$submission->gradinggrade | "; } echo "$submission->finalgrade |
id&action=editelements\">". get_string("amendassessmentelements", "workshop")." \n"; helpbutton("elements", get_string("amendassessmentelements", "workshop"), "workshop"); if ($workshop->ntassessments) { // if teacher examples show submission and assessment links echo "
id&action=submitassignment\">". get_string("submitexampleassignment", "workshop")." \n"; helpbutton("submissionofexamples", get_string("submitexampleassignment", "workshop"), "workshop"); echo "
id&action=listforassessmentteacher\">". get_string("teachersubmissionsforassessment", "workshop", workshop_count_teacher_submissions_for_assessment($workshop, $USER)). " \n"; helpbutton("assessmentofexamples", get_string("teachersubmissionsforassessment", "workshop"), "workshop"); } break; case 2: // submissions and assessments if ($workshop->ntassessments) { // if teacher example show student assessments link echo "
id&action=listungradedteachersubmissions\">". get_string("ungradedassessmentsofteachersubmissions", "workshop", workshop_count_ungraded_assessments_teacher($workshop))." \n"; helpbutton("ungradedassessments_teacher", get_string("ungradedassessmentsofteachersubmissions", "workshop"), "workshop"); } echo "
id&action=listungradedstudentsubmissions\">". get_string("ungradedassessmentsofstudentsubmissions", "workshop", workshop_count_ungraded_assessments_student($workshop))." \n"; helpbutton("ungradedassessments_student", get_string("ungradedassessmentsofstudentsubmissions", "workshop"), "workshop"); echo "
id&action=listforassessmentstudent\">". get_string("studentsubmissionsforassessment", "workshop", workshop_count_student_submissions_for_assessment($workshop, $USER))." \n"; helpbutton("gradingsubmissions", get_string("studentsubmissionsforassessment", "workshop"), "workshop"); break; case 3: // calculate final grades if ($workshop->ntassessments) { // if teacher example show student assessments link echo "
id&action=listungradedteachersubmissions\">". get_string("ungradedassessmentsofteachersubmissions", "workshop", workshop_count_ungraded_assessments_teacher($workshop))." \n"; helpbutton("ungradedassessments_teacher", get_string("ungradedassessmentsofteachersubmissions", "workshop"), "workshop"); } echo "
id&action=listungradedstudentsubmissions\">". get_string("ungradedassessmentsofstudentsubmissions", "workshop", workshop_count_ungraded_assessments_student($workshop))." \n"; helpbutton("ungradedassessments_student", get_string("ungradedassessmentsofstudentsubmissions", "workshop"), "workshop"); echo "
id&action=listforassessmentstudent\">". get_string("studentsubmissionsforassessment", "workshop", workshop_count_student_submissions_for_assessment($workshop, $USER))." \n"; helpbutton("gradingsubmissions", get_string("studentsubmissionsforassessment", "workshop"), "workshop"); print_heading("id&action=displayfinalweights\">". get_string("calculationoffinalgrades", "workshop").""); break; case 4: // show final grades print_heading("id&action=displayfinalgrades\">". get_string("displayoffinalgrades", "workshop").""); } print_heading("id&action=adminlist\">". get_string("administration").""); } /*************** no man's land **************************************/ else { error("Fatal Error: Unknown Action: ".$action."\n"); } print_footer($course); ?>