3 require("../../config.php");
5 require("locallib.php");
7 $aid = required_param('aid', PARAM_INT
); // Assessment ID
8 $allowcomments = optional_param('allowcomments', false, PARAM_BOOL
);
9 $redirect = optional_param('redirect', '', PARAM_URL
);
10 $frameset = optional_param('frameset', '', PARAM_ALPHA
);
12 if (! $assessment = get_record("workshop_assessments", "id", $aid)) {
13 error("Assessment id is incorrect");
15 if (! $submission = get_record('workshop_submissions', 'id', $assessment->submissionid
)) {
16 error("Incorrect submission id");
18 if (! $workshop = get_record("workshop", "id", $submission->workshopid
)) {
19 error("Submission is incorrect");
21 if (! $course = get_record("course", "id", $workshop->course
)) {
22 error("Workshop is misconfigured");
24 if (! $cm = get_coursemodule_from_instance("workshop", $workshop->id
, $course->id
)) {
25 error("No coursemodule found");
29 $redirect = htmlentities($_SERVER["HTTP_REFERER"].'#sid='.$submission->id
);
32 require_login($course->id
, false, $cm);
34 $strworkshops = get_string("modulenameplural", "workshop");
35 $strworkshop = get_string("modulename", "workshop");
36 $strassess = get_string("viewassessment", "workshop");
38 /// Now check whether we need to display a frameset
40 if (empty($frameset)) {
41 if ( get_string('thisdirection') == 'rtl' ) {
42 $direction = ' dir="rtl"';
44 $direction = ' dir="ltr"';
46 echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n";
47 echo "<html $direction>\n";
48 echo "<head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n";
49 echo "<title>{$course->shortname}: ".format_string($workshop->name
,true)."</title></head>\n";
50 echo "<frameset rows=\"90%,*\" border=\"10\">";
51 echo " <frame src=\"viewassessment.php?id=$id&aid=$aid&allowcomments=$allowcomments&frameset=top&redirect=$redirect\" border=\"10\" />";
52 echo " <frame src=\"viewassessment.php?id=$id&aid=$aid&allowcomments=$allowcomments&frameset=bottom&redirect=$redirect\" />";
58 /// top frame with the navigation bar and the assessment form
60 if ($frameset == "top") {
62 $navlinks[] = array('name' => $strworkshops, 'link' => "index.php?id=$course->id", 'type' => 'activity');
63 $navlinks[] = array('name' => format_string($workshop->name
,true), 'link' => "view.php?id=$cm->id", 'type' => 'activityinstance');
64 $navlinks[] = array('name' => $strassess, 'link' => '', 'type' => 'title');
65 $navigation = build_navigation($navlinks);
67 // removed <base target="_parent" /> as it does not validate
68 print_header_simple(format_string($workshop->name
), "", $navigation,
71 // show assessment but don't allow changes
72 workshop_print_assessment($workshop, $assessment, false, $allowcomments);
74 if (workshop_is_teacher($workshop) and !workshop_is_teacher($workshop, $assessment->userid
)) {
75 print_heading_with_help(get_string("gradeassessment", "workshop"), "gradingassessments", "workshop");
76 include('assessment_grading_form.html');
78 print_continue($redirect);
79 print_footer($course);
83 /// print bottom frame with the submission
84 // removed <base target="_parent" /> as it does not validate
85 print_header('', '', '', '', '');
86 $title = '"'.$submission->title
.'" ';
87 if (workshop_is_teacher($workshop)) {
88 $title .= ' '.get_string('by', 'workshop').' '.workshop_fullname($submission->userid
, $course->id
);
90 print_heading($title);
91 workshop_print_submission($workshop, $submission);