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

« back to all changes in this revision

Viewing changes to mod/quiz/index.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: index.php,v 1.46.2.12 2009/01/14 07:03:11 tjhunt Exp $
 
1
<?php // $Id: index.php,v 1.46.2.16 2009/12/16 00:51:28 andyjdavis Exp $
2
2
/**
3
3
 * This page lists all the instances of quiz in a particular course
4
4
 *
43
43
        die;
44
44
    }
45
45
 
 
46
// Check if we need the closing date header
 
47
    $showclosingheader = false;
 
48
    $showfeedback = false;
 
49
    foreach ($quizzes as $quiz) {
 
50
        if ($quiz->timeclose!=0) {
 
51
            $showclosingheader=true;
 
52
        }
 
53
        if (quiz_has_feedback($quiz->id)) {
 
54
            $showfeedback=true;
 
55
        }
 
56
        if($showclosingheader && $showfeedback) {
 
57
            break;
 
58
        }
 
59
    }
 
60
 
46
61
// Configure table for displaying the list of instances.
47
 
    $headings = array(get_string('name'), get_string('quizcloses', 'quiz'));
48
 
    $align = array('left', 'left');
 
62
    $headings = array(get_string('name'));
 
63
    $align = array('left');
 
64
 
 
65
    if ($showclosingheader) {
 
66
        array_push($headings, get_string('quizcloses', 'quiz'));
 
67
        array_push($align, 'left');
 
68
    }
 
69
 
49
70
    if ($course->format == 'weeks' or $course->format == 'weekscss') {
50
71
        array_unshift($headings, get_string('week'));
51
72
    } else {
60
81
        array_push($align, 'left');
61
82
        $showing = 'stats';
62
83
    } else if (has_any_capability(array('mod/quiz:reviewmyattempts', 'mod/quiz:attempt'), $coursecontext)) {
63
 
        array_push($headings, get_string('bestgrade', 'quiz'), get_string('feedback', 'quiz'));
64
 
        array_push($align, 'left', 'left');
 
84
        array_push($headings, get_string('grade', 'quiz'));
 
85
        array_push($align, 'left');
 
86
        if ($showfeedback) {
 
87
            array_push($headings, get_string('feedback', 'quiz'));
 
88
            array_push($align, 'left');
 
89
        }
65
90
        $showing = 'scores';  // default
66
91
    }
67
92
 
98
123
        // Close date.
99
124
        if ($quiz->timeclose) {
100
125
            $data[] = userdate($quiz->timeclose);
101
 
        } else {
 
126
        } else if ($showclosingheader) {
102
127
            $data[] = '';
103
128
        }
104
129
 
129
154
                }
130
155
            }
131
156
            $data[] = $grade;
132
 
            $data[] = $feedback;
 
157
            if ($showfeedback) {
 
158
                $data[] = $feedback;
 
159
            }
133
160
        }
134
161
 
135
162
        $table->data[] = $data;