aboutsummaryrefslogtreecommitdiff
path: root/lib/extern/modules/views/lecturedetails_preview.inc.php
blob: cbd48690f1c112fa4e8be3e94e47d2426696e573 (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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<?
# Lifter002: TODO
# Lifter007: TODO
# Lifter003: TODO
# Lifter010: TODO

require_once 'lib/dates.inc.php';

global $SEM_CLASS, $SEM_TYPE;

// 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;
        }
    }
}

$data_sem["name"] = _("Name der Veranstaltung");
$data_sem["subtitle"] = _("Untertitel der Veranstaltung");
switch ($this->config->getValue("Main", "nameformat")) {
    case "no_title_short" :
        $data_sem["lecturer"] = _("Meyer, P.");
        break;
    case "no_title" :
        $data_sem["lecturer"] = _("Peter Meyer");
        break;
    case "no_title_rev" :
        $data_sem["lecturer"] = _("Meyer Peter");
        break;
    case "full" :
        $data_sem["lecturer"] = _("Dr. Peter Meyer");
        break;
    case "full_rev" :
        $data_sem["lecturer"] = _("Meyer, Peter, Dr.");
        break;
    default :
        $data_sem["lecturer"] = _("Meyer, P.");
}
$data_sem["art"] = _("Testveranstaltung");
$data_sem["semtype"] = 1;
$data_sem["description"] = str_repeat(_("Beschreibung") . " ", 10);
$data_sem["location"] = _("A 123, 1. Stock");
$data_sem["semester"] = "WS 2003/2004";
$data_sem["time"] = _("Di. 8:30 - 13:30, Mi. 8:30 - 13:30, Do. 8:30 - 13:30");
$data_sem["number"] = "1234";
$data_sem["teilnehmer"] = str_repeat(_("Teilnehmende") . " ", 6);
$data_sem["requirements"] = str_repeat(_("Voraussetzungen") . " ", 6);
$data_sem["lernorga"] = str_repeat(_("Lernorganisation") . " ", 6);
$data_sem["leistung"] = str_repeat(_("Leistungsnachweis") . " ", 6);
$data_sem["range_path"] = _("Fakultät &gt; Studiengang &gt; Bereich");
$data_sem["misc"] = str_repeat(_("Sonstiges") . " ", 6);
$data_sem["ects"] = "4";


setlocale(LC_TIME, $this->config->getValue("Main", "timelocale"));
$order = $this->config->getValue("Main", "order");
$visible = $this->config->getValue("Main", "visible");
$aliases = $this->config->getValue("Main", "aliases");
$j = -1;

$data["name"] = $data_sem["name"];

if ($visible[++$j])
    $data["subtitle"] = $data_sem["subtitle"];

if ($visible[++$j]) {
    $data["lecturer"][] = sprintf("<a href=\"\"%s>%s</a>",
            $this->config->getAttributes("LinkInternSimple", "a"),
            $data_sem["lecturer"]);
    if (is_array($data["lecturer"]))
        $data["lecturer"] = implode(", ", $data["lecturer"]);
}

if ($visible[++$j])
    $data["art"] = $data_sem["art"];

if ($visible[++$j]) {
    $aliases_sem_type = $this->config->getValue("ReplaceTextSemType",
            "class_{$SEM_TYPE[$data_sem['semtype']]['class']}");
    if ($aliases_sem_type[$sem_types_position[$data_sem['semtype']] - 1])
        $data["status"] = $aliases_sem_type[$sem_types_position[$data_sem['semtype']] - 1];
    else {
        $data["status"] = htmlReady($SEM_TYPE[$data_sem['semtype']]["name"]
                ." (". $SEM_CLASS[$SEM_TYPE[$data_sem['semtype']]["class"]]["name"].")");
    }
}

if ($visible[++$j])
    $data["description"] = $data_sem["description"];

if ($visible[++$j])
    $data["location"] = $data_sem["location"];

if ($visible[++$j])
    $data["semester"] = $data_sem["semester"];

if ($visible[++$j])
    $data["time"] = $data_sem["time"];

if ($visible[++$j])
    $data["number"] = $data_sem["number"];

if ($visible[++$j])
    $data["teilnehmer"] = $data_sem["teilnehmer"];

if ($visible[++$j])
    $data["requirements"] = $data_sem["requirements"];

if ($visible[++$j])
    $data["lernorga"] = $data_sem["lernorga"];

if ($visible[++$j])
    $data["leistung"] = $data_sem["leistung"];

if ($visible[++$j]) {
    $pathes = [$data_sem["range_path"]];
    if (is_array($pathes)) {
        $pathes_values = array_values($pathes);
        if ($this->config->getValue("Main", "range") == "long")
            $data["range_path"] = $pathes_values;
        else {
            foreach ($pathes_values as $path) {
                $_paths = explode("&gt;", $path);
                $data["range_path"][] = array_pop($_paths);
            }
        }
        $data["range_path"] = array_filter($data["range_path"], "htmlReady");
        $data["range_path"] = implode("<br>", $data["range_path"]);
    }
}

if ($visible[++$j])
    $data["misc"] = $data_sem["misc"];

if ($visible[++$j])
    $data["ects"] = $data_sem["ects"];

if ($this->config->getValue("Main", "studiplink")) {
    echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" ";
    if ($studiplink_width = $this->config->getValue("TableHeader", "table_width"))
        echo " width=\"$studiplink_width\"";
    if ($studiplink_align = $this->config->getValue("TableHeader", "table_align"))
        echo " align=\"$studiplink_align\">\n";


    if ($this->config->getValue("Main", "studiplink") == "top") {
        $args = ["width" => "100%", "height" => "40", "link" => ""];
        echo "<tr><td width=\"100%\">\n";
        $this->elements["StudipLink"]->printout($args);
        echo "</td></tr>";
    }
    $table_attr = $this->config->getAttributes("TableHeader", "table");
    $pattern = ["/width=\"[0-9%]+\"/", "/align=\"[a-z]+\"/"];
    $replace = ["width=\"100%\"", ""];
    $table_attr = preg_replace($pattern, $replace, $table_attr);
    echo "<tr><td width=\"100%\">\n<table$table_attr>\n";
}
else
    echo "<table" . $this->config->getAttributes("TableHeader", "table") . ">\n";

echo "<tr" . $this->config->getAttributes("SemName", "tr") . ">";
echo "<td" . $this->config->getAttributes("SemName", "td") . ">";

if ($margin = $this->config->getValue("SemName", "margin"))
    echo "<div style=\"margin-left:{$margin}px;\">";
else
    echo "<div>";
echo "<font" . $this->config->getAttributes("SemName", "font") . ">";
echo $data["name"] . "</font></div></td></tr>\n";

$headline_tr = $this->config->getAttributes("Headline", "tr");
$headline_td = $this->config->getAttributes("Headline", "td");
$headline_font = $this->config->getAttributes("Headline", "font");
if ($headline_margin = $this->config->getValue("Headline", "margin")) {
    $headline_div = "<div style=\"margin-left:$headline_margin;\">";
    $headline_div_end = "</div>";
}
else {
    $headline_div = "";
    $headline_div_end = "";
}
$content_tr =$this->config->getAttributes("Content", "tr");
$content_td = $this->config->getAttributes("Content", "td");
$content_font = $this->config->getAttributes("Content", "font");
if ($content_margin = $this->config->getValue("Content", "margin")) {
    $content_div = "<div style=\"margin-left:$content_margin;\">";
    $content_div_end = "</div>";
}
else {
    $content_div = "";
    $content_div_end = "";
}

if ($this->config->getValue("Main", "headlinerow")) {
    foreach ($order as $position) {
        if ($visible[$position] && $data[$this->data_fields[$position]]) {
            echo "<tr$headline_tr><td$headline_td>$headline_div";
            echo "<font$headline_font>{$aliases[$position]}</font>$headline_div_end</td></tr>\n";
            echo "<tr$content_tr><td$content_td>$content_div";
            echo "<font$content_font>" . $data[$this->data_fields[$position]];
            echo "</font>$content_div_end</td></tr>\n";
        }
    }
}
else {
    foreach ($order as $position) {
        if ($visible[$position] && $data[$this->data_fields[$position]]) {
            echo "<tr$content_tr><td$content_td>$content_div";
            echo "<font$headline_font>{$aliases[$position]}</font>\n";
            echo "<font$content_font>" . $data[$this->data_fields[$position]];
            echo "</font>$content_div_end</td></tr>\n";
        }
    }
}

if ($this->config->getValue("Main", "studipinfo")) {
    echo "<tr$headline_tr><td$headline_td>$headline_div";
    echo "<font$headline_font>" . $this->config->getValue("StudipInfo", "headline");
    echo "<font>$headline_div_end</td></tr>\n";

    $pre_font = $this->config->getAttributes("StudipInfo", "font");
    echo "<tr$content_tr><td$content_td>$content_div";
    echo "<font$pre_font>" . $this->config->getValue("StudipInfo", "homeinst");
    echo "&nbsp;</font><font$content_font>";
    printf("<a href=\"\"%s>%s</a>",
            $this->config->getAttributes("LinkInternSimple", "a"),
            _("Heimatinstitut"));
    echo "<br></font>\n";

    echo "<font$pre_font>" . $this->config->getValue("StudipInfo", "involvedinst");
    echo "&nbsp;</font><font$content_font>";
    echo str_repeat(_("Beteiligte Institute") . " ", 5) . "<br></font>\n";

    echo "<font$pre_font>" . $this->config->getValue("StudipInfo", "countuser");
    echo "&nbsp;</font><font$content_font>";
    echo "23<br></font>\n";

    echo "<font$pre_font>" . $this->config->getValue("StudipInfo", "countpostings");
    echo "&nbsp;</font><font$content_font>";
    echo "42<br></font>\n";

    echo "<font$pre_font>" . $this->config->getValue("StudipInfo", "countdocuments");
    echo "&nbsp;</font><font$content_font>";
    echo "7<br></font>\n";
    echo "$content_div_end</td></tr>";
}

echo "</table>\n";

if ($this->config->getValue("Main", "studiplink")) {
    if ($this->config->getValue("Main", "studiplink") == "bottom") {
        $args = ["width" => "100%", "height" => "40", "link" => ""];
        echo "</td></tr>\n<tr><td width=\"100%\">\n";
        $this->elements["StudipLink"]->printout($args);
    }
    echo "</td></tr></table>\n";
}

?>