~ubuntu-branches/ubuntu/hoary/moodle/hoary

« back to all changes in this revision

Viewing changes to mod/lesson/index.php

  • Committer: Bazaar Package Importer
  • Author(s): Isaac Clerencia
  • Date: 2004-12-29 00:49:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041229004952-gliyqzpj2w3e7clx
Tags: 1.4.3-1
* Urgency high as upstream release fixes several security bugs
* New upstream release
* Write database creation errors and warn the user about it, 
closes: #285842, #285842

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?PHP // $Id: index.php,v 1.3 2004/03/27 04:15:29 rkingdon Exp $
 
1
<?PHP // $Id: index.php,v 1.5 2004/08/22 14:38:43 gustav_delius Exp $
2
2
 
3
3
/// This page lists all the instances of lesson in a particular course
4
4
 
11
11
        error("Course ID is incorrect");
12
12
    }
13
13
 
14
 
    require_login($course->id);
 
14
    require_course_login($course);
15
15
 
16
16
    add_to_log($course->id, "lesson", "view all", "index.php?id=$course->id", "");
17
17
 
24
24
 
25
25
/// Print the header
26
26
 
27
 
    if ($course->category) {
28
 
        $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
29
 
    }
30
 
 
31
 
    print_header("$course->shortname: $strlessons", "$course->fullname", "$navigation $strlessons", "", "", true, "", navmenu($course));
 
27
    print_header_simple("$strlessons", "", "$strlessons", "", "", true, "", navmenu($course));
32
28
 
33
29
/// Get all the appropriate data
34
30
 
72
68
            $due = "<FONT COLOR=\"red\">".userdate($lesson->deadline)."</FONT>";
73
69
        }
74
70
 
 
71
        $grade_value = '';
75
72
        if ($course->format == "weeks" or $course->format == "topics") {
76
73
            if (isteacher($course->id)) {
77
74
                $grade_value = $lesson->grade;
78
 
            } else {
 
75
            } elseif (isstudent($course->id)) {
79
76
                // it's a student, show their mean or maximum grade
80
77
                if ($lesson->usemaxgrade) {
81
78
                    $grade = get_record_sql("SELECT MAX(grade) as grade FROM {$CFG->prefix}lesson_grades 
87
84
                if ($grade) {
88
85
                    // grades are stored as percentages
89
86
                    $grade_value = number_format($grade->grade * $lesson->grade / 100, 1);
90
 
                } else {
91
 
                    $grade_value = 0;
92
87
                }
93
88
            }
94
89
            $table->data[] = array ($lesson->section, $link, $grade_value, $due);