File: index.php

package info (click to toggle)
moodle 1.4.4.dfsg.1-3sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 57,876 kB
  • ctags: 29,496
  • sloc: php: 271,617; sql: 5,084; xml: 702; perl: 638; sh: 403; java: 283; makefile: 42; pascal: 21
file content (110 lines) | stat: -rw-r--r-- 4,597 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?PHP // $Id: index.php,v 1.10 2004/08/21 20:20:58 gustav_delius Exp $

    require("../../config.php");
   require("lib.php");
   require("locallib.php");

    require_variable($id);   // course

    if (! $course = get_record("course", "id", $id)) {
        error("Course ID is incorrect");
    }

    require_login($course->id);
    add_to_log($course->id, "workshop", "view all", "index.php?id=$course->id", "");

    $strworkshops = get_string("modulenameplural", "workshop");
    $strworkshop = get_string("modulename", "workshop");
    $strweek = get_string("week");
    $strtopic = get_string("topic");
    $strname = get_string("name");
    $strphase = get_string("phase", "workshop");
    $strdeadline = get_string("deadline", "workshop");
    $strsubmitted = get_string("submitted", "assignment");

    print_header_simple("$strworkshops", "", "$strworkshops", "", "", true, "", navmenu($course));

    if (! $workshops = get_all_instances_in_course("workshop", $course)) {
        notice("There are no workshops", "../../course/view.php?id=$course->id");
        die;
    }

    $timenow = time();

    if ($course->format == "weeks") {
        $table->head  = array ($strweek, $strname, $strphase, $strsubmitted, $strdeadline);
        $table->align = array ("CENTER", "LEFT", "LEFT", "LEFT", "LEFT");
    } elseif ($course->format == "topics") {
        $table->head  = array ($strtopic, $strname, $strphase, $strsubmitted, $strdeadline);
        $table->align = array ("CENTER", "LEFT", "left", "LEFT", "LEFT");
    } else {
        $table->head  = array ($strname, $strphase, $strsubmitted, $strdeadline);
        $table->align = array ("LEFT", "LEFT", "LEFT", "LEFT");
    }

    foreach ($workshops as $workshop) {
        switch ($workshop->phase) {
            case 0:
            case 1: $phase = get_string("phase1short", "workshop");
                    break;
            case 2: $phase = get_string("phase2short", "workshop");
                    break;
            case 3: $phase = get_string("phase3short", "workshop");
                    break;
            case 4: $phase = get_string("phase4short", "workshop");
                    break;
            case 5: $phase = get_string("phase5short", "workshop");
                    break;
            case 6: $phase = get_string("phase6short", "workshop");
                    break;
        }
        if ($submissions = workshop_get_user_submissions($workshop, $USER)) {
            foreach ($submissions as $submission) {
                if ($submission->timecreated <= $workshop->deadline) {
                    $submitted = userdate($submission->timecreated);
                } 
                else {
                    $submitted = "<FONT COLOR=red>".userdate($submission->timecreated)."</FONT>";
                }
                $due = userdate($workshop->deadline);
                if (!$workshop->visible) {
                    //Show dimmed if the mod is hidden
                    $link = "<A class=\"dimmed\" HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A><br />".
                        "($submission->title)";
                    } else {
                    //Show normal if the mod is visible
                    $link = "<A HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A><br />".
                        "($submission->title)";
                }
                if ($course->format == "weeks" or $course->format == "topics") {
                    $table->data[] = array ($workshop->section, $link, $phase, $submitted, $due);
                } 
                else {
                    $table->data[] = array ($link, $phase, $submitted, $due);
                }
            }
        }
        else {
            $submitted = get_string("no");
            $due = userdate($workshop->deadline);
            if (!$workshop->visible) {
                //Show dimmed if the mod is hidden
                $link = "<A class=\"dimmed\" HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A>";
            } else {
                //Show normal if the mod is visible
                $link = "<A HREF=\"view.php?id=$workshop->coursemodule\">$workshop->name</A>";
            }
            if ($course->format == "weeks" or $course->format == "topics") {
                    $table->data[] = array ($workshop->section, $link, $phase, $submitted, $due);
            } 
            else {
                $table->data[] = array ($link, $phase, $submitted, $due);
            }
        }
    }
    echo "<br />";

    print_table($table);

    print_footer($course);
?>