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 // removed <base target="_parent" /> as it does not validate
63 print_header_simple(format_string($workshop->name
), "",
64 "<a href=\"index.php?id=$course->id\">$strworkshops</a> ->
65 <a href=\"view.php?id=$cm->id\">".format_string($workshop->name
,true)."</a> -> $strassess",
68 // show assessment but don't allow changes
69 workshop_print_assessment($workshop, $assessment, false, $allowcomments);
71 if (workshop_is_teacher($workshop) and !workshop_is_teacher($workshop, $assessment->userid
)) {
72 print_heading_with_help(get_string("gradeassessment", "workshop"), "gradingassessments", "workshop");
73 include('assessment_grading_form.html');
75 print_continue($redirect);
76 print_footer($course);
80 /// print bottom frame with the submission
81 // removed <base target="_parent" /> as it does not validate
82 print_header('', '', '', '', '');
83 $title = '"'.$submission->title
.'" ';
84 if (workshop_is_teacher($workshop)) {
85 $title .= ' '.get_string('by', 'workshop').' '.workshop_fullname($submission->userid
, $course->id
);
87 print_heading($title);
88 workshop_print_submission($workshop, $submission);