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") {
61 $navigation = build_navigation($strassess, $cm);
62 print_header_simple(format_string($workshop->name
), "", $navigation,
65 // show assessment but don't allow changes
66 workshop_print_assessment($workshop, $assessment, false, $allowcomments);
68 if (workshop_is_teacher($workshop) and !workshop_is_teacher($workshop, $assessment->userid
)) {
69 print_heading_with_help(get_string("gradeassessment", "workshop"), "gradingassessments", "workshop");
70 include('assessment_grading_form.html');
72 print_continue($redirect);
73 print_footer($course);
77 /// print bottom frame with the submission
78 // removed <base target="_parent" /> as it does not validate
79 print_header('', '', '', '', '');
80 $title = '"'.$submission->title
.'" ';
81 if (workshop_is_teacher($workshop)) {
82 $title .= ' '.get_string('by', 'workshop').' '.workshop_fullname($submission->userid
, $course->id
);
84 print_heading($title);
85 workshop_print_submission($workshop, $submission);