~ubuntu-branches/ubuntu/natty/moodle/natty

« back to all changes in this revision

Viewing changes to mod/quiz/review.php

  • Committer: Bazaar Package Importer
  • Author(s): Tomasz Muras
  • Date: 2010-10-30 12:19:28 UTC
  • mfrom: (1.1.12 upstream) (3.1.10 squeeze)
  • Revision ID: james.westby@ubuntu.com-20101030121928-qzobi6mctpnk4dif
Tags: 1.9.9.dfsg2-2
* Added Romanian translation
* Updated Japanese translation (closes: #596820)
* Backporting security fixes from Moodle 1.9.10 (closes: #601384)
   - Updated embedded CAS to 1.1.3
   - Added patch for MDL-24523:
     clean_text() not filtering text in markdown format
   - Added patch for MDL-24810 and upgraded customized HTML Purifier to 4.2.0 
   - Added patch for MDL-24258:
     students can delete their forum posts later than $CFG->maxeditingtime 
     under certain conditions
   - Added patch for MDL-23377:
     Can't delete quiz attempts in course without enrolled students

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php  // $Id: review.php,v 1.59.2.10 2009/01/16 04:47:35 tjhunt Exp $
 
1
<?php  // $Id: review.php,v 1.59.2.12 2009/11/04 14:07:13 tjhunt Exp $
2
2
/**
3
3
 * This page prints a review of a particular quiz attempt
4
4
 *
38
38
    require_login($course->id, false, $cm);
39
39
    $context = get_context_instance(CONTEXT_MODULE, $cm->id);
40
40
    $coursecontext = get_context_instance(CONTEXT_COURSE, $cm->course);
41
 
    $isteacher = has_capability('mod/quiz:preview', get_context_instance(CONTEXT_MODULE, $cm->id));
 
41
    $isteacher = has_capability('mod/quiz:preview', $context);
42
42
    $options = quiz_get_reviewoptions($quiz, $attempt, $context);
43
 
    $popup = $isteacher ? 0 : $quiz->popup; // Controls whether this is shown in a javascript-protected window.
 
43
    $popup = $isteacher ? 0 : $quiz->popup; // Controls whether this is shown in a javascript-protected window or with a safe browser.
44
44
 
45
45
    $timenow = time();
46
46
    if (!has_capability('mod/quiz:viewreports', $context)) {
68
68
            } else {
69
69
                $message = get_string('noreview', 'quiz');
70
70
            }
71
 
            if (empty($popup)) {
72
 
                redirect('view.php?q=' . $quiz->id, $message);
73
 
            } else {
 
71
            if (!empty($popup) && $popup == 1) {
74
72
                ?><script type="text/javascript">
75
73
                opener.document.location.reload();
76
74
                self.close();
77
75
                </script><?php
78
76
                die();
79
 
            }
 
77
            } else {
 
78
                redirect('view.php?q=' . $quiz->id, $message);
 
79
            } 
80
80
        }
81
81
    }
82
82
 
124
124
/// Print the page header
125
125
    $pagequestions = explode(',', $pagelist);
126
126
    $headtags = get_html_head_contributions($pagequestions, $questions, $states);
127
 
    if (!empty($popup)) {
 
127
    if (!$isteacher && $quiz->popup) {
128
128
        define('MESSAGE_WINDOW', true);  // This prevents the message window coming up
129
129
        print_header($course->shortname.': '.format_string($quiz->name), '', '', '', $headtags, false, '', '', false, '');
130
 
        /// Include Javascript protection for this page
131
 
        include('protect_js.php');
 
130
        if ($quiz->popup == 1) {
 
131
            include('protect_js.php');
 
132
        }
132
133
    } else {
133
134
        $strupdatemodule = has_capability('moodle/course:manageactivities', $coursecontext)
134
135
                    ? update_module_button($cm->id, $course->id, get_string('modulename', 'quiz'))
140
141
    echo '<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>'; // for overlib
141
142
 
142
143
/// Print heading and tabs if this is part of a preview
143
 
    if (has_capability('mod/quiz:preview', $context)) {
 
144
    if ($isteacher) {
144
145
        if ($attempt->userid == $USER->id) { // this is the report on a preview
145
146
            $currenttab = 'preview';
146
147
        } else {