aboutsummaryrefslogtreecommitdiff
path: root/lib/extern/modules/views/lectures_preview.inc.php
blob: aab2de80d020d9f0f69a16bd6ca1ff976f243207 (plain)
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?
# Lifter002: TODO
# Lifter007: TODO
# Lifter003: TODO
# Lifter010: TODO


global $SEM_TYPE,$SEM_CLASS ;
$all_semester = Semester::findAllVisible(false);

// reorganize the $SEM_TYPE-array
foreach ($SEM_CLASS as $key_class => $class) {
    $i = 0;
    foreach ($SEM_TYPE as $key_type => $type) {
        if ($type["class"] == $key_class) {
            $i++;
            $sem_types_position[$key_type] = $i;
        }
    }
}

// current semester
$now = time();
foreach ($all_semester as $key => $sem) {
    if ($sem["beginn"] >= $now)
        break;
}

$data_sem[0]["group"] = 1;
$data_sem[1]["group"] = 1;
$data_sem[2]["group"] = 2;
$data_sem[0]["name"] = sprintf(_('Name der Veranstaltung %u'), 1);
$data_sem[1]["name"] = sprintf(_('Name der Veranstaltung %u'), 2);
$data_sem[2]["name"] = sprintf(_('Name der Veranstaltung %u'), 3);
$data_sem[0]["time"] = _("Di. 8:30 - 13:30, Mi. 8:30 - 13:30, Do. 8:30 - 13:30");
$data_sem[1]["time"] = _("Termine am 31.7. 14:00 - 16:00, 17.8. 11:00 - 14:30, 6.9. 14:00 - 16:00,...");
$data_sem[2]["time"] = _("Di. 8:30 - 13:30, Mi. 8:30 - 13:30, Do. 8:30 - 13:30");

switch ($this->config->getValue("Main", "nameformat")) {
    case "no_title_short" :
        $data_sem[0]["lecturer"] = _("Meyer, P.");
        break;
    case "no_title" :
        $data_sem[0]["lecturer"] = _("Peter Meyer");
        break;
    case "no_title_rev" :
        $data_sem[0]["lecturer"] = _("Meyer Peter");
        break;
    case "full" :
        $data_sem[0]["lecturer"] = _("Dr. Peter Meyer");
        break;
    case "full_rev" :
        $data_sem[0]["lecturer"] = _("Meyer, Peter, Dr.");
        break;
    default :
        $data_sem[0]["lecturer"] = _("Meyer, P.");
        break;
}
$data_sem[1]["lecturer"] = $data_sem[0]["lecturer"];
$data_sem[2]["lecturer"] = $data_sem[0]["lecturer"];

$show_time = $this->config->getValue("Main", "time");
$show_lecturer = $this->config->getValue("Main", "lecturer");
if ($show_time && $show_lecturer) {
    if (!$td2width = $this->config->getValue("LecturesInnerTable", "td2width"))
        $td2width = 50;
    $colspan = " colspan=\"2\"";
    $td_time = $this->config->getAttributes("LecturesInnerTable", "td2");
    $td_time .= " width=\"$td2width%\"";
    $td_lecturer = " align=\"" . $this->config->getValue("LecturesInnerTable", "td3_align");
    $td_lecturer .= "\" valign=\"" . $this->config->getValue("LecturesInnerTable", "td2_valign");
    $td_lecturer .= "\" width=\"" . (100 - $td2width) . "%\"";
}
else {
    $colspan = "";
    $td_time = $this->config->getAttributes("LecturesInnerTable", "td2") . " width=\"100%\"";
    $td_lecturer = " align=\"" . $this->config->getValue("LecturesInnerTable", "td3_align");
    $td_lecturer .= "\" valign=\"" . $this->config->getValue("LecturesInnerTable", "td2_valign");
    $td_lecturer .= " width=\"100%\"";
}

echo "\n<table" . $this->config->getAttributes("TableHeader", "table") . ">";
if ($this->config->getValue("Main", "addinfo")) {
    echo "\n<tr" . $this->config->getAttributes("InfoCountSem", "tr") . ">";
    echo "<td" . $this->config->getAttributes("InfoCountSem", "td") . ">";
    echo "<font" . $this->config->getAttributes("InfoCountSem", "font") . ">&nbsp;";
    echo "2";
    echo $this->config->getValue("Main", "textlectures");
    echo ", " . $this->config->getValue("Main", "textgrouping");
    $group_by_name = $this->config->getValue("Main", "aliasesgrouping");
    echo $group_by_name[3];
    echo "</font></td></tr>";
}
$i = 0;
$group = "";
foreach ($data_sem as $dat) {
    $aliases_sem_type = $this->config->getValue("ReplaceTextSemType",
            "class_{$SEM_TYPE[$dat['group']]['class']}");
    if ($aliases_sem_type[$sem_types_position[$dat['group']] - 1])
        $group2 = $aliases_sem_type[$sem_types_position[$dat['group']] - 1];
    else {
        $group2 = htmlReady($SEM_TYPE[$dat['group']]["name"]
                ." (". $SEM_CLASS[$SEM_TYPE[$dat['group']]["class"]]["name"].")");
    }

    if ($group != $group2) {
        echo "\n<tr" . $this->config->getAttributes("Grouping", "tr") . ">";
        echo "<td" . $this->config->getAttributes("Grouping", "td") . ">";
        echo "<font" . $this->config->getAttributes("Grouping", "font") . ">";
        echo $group2;
        echo "\n</td></tr>\n";
        $group = $group2;
    }

    echo "<tr" . $this->config->getAttributes("LecturesInnerTable", "tr").">";
    if ($i % 2 && $this->config->getValue("LecturesInnerTable", "td_bgcolor2_"))
        echo "<td width=\"100%\"".$this->config->getAttributes("LecturesInnerTable", "td", TRUE)."\">\n";
    else
        echo "<td width=\"100%\"".$this->config->getAttributes("LecturesInnerTable", "td")."\">\n";
    $i++;
    echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
    echo "<tr" . $this->config->getAttributes("LecturesInnerTable", "tr1") . ">";
    echo "<td$colspan" . $this->config->getAttributes("LecturesInnerTable", "td1") . ">";
    echo "<font" . $this->config->getAttributes("LecturesInnerTable", "font1") . ">";
    echo "<a href=\"\"";
    echo $this->config->getAttributes("SemLink", "a") . ">";
    echo $dat["name"] . "</a></font></td></tr>";

    if ($show_time || $show_lecturer) {
        echo "\n<tr" . $this->config->getAttributes("LecturesInnerTable", "tr2") . ">";
        if ($show_time) {
            echo "<td$td_time>";
            echo "<font" . $this->config->getAttributes("LecturesInnerTable", "font2") . ">";
            echo $dat["time"] . "</font>\n";
        }
        if ($show_lecturer) {
            echo "<td$td_lecturer>";
            echo "<font" . $this->config->getAttributes("LecturesInnerTable", "font2") . ">(";
            echo "<a href=\"\"";
            echo $this->config->getAttributes("LecturerLink", "a") . ">";
            echo $dat["lecturer"] . "</a>";
            echo ") </font></td>";
        }
        echo "</tr>\n";
    }
    echo "</table></td></tr>\n";
}
echo "</table>";

?>