forked from tgc-dk/Musikteam
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sidebar.php
187 lines (147 loc) · 7.59 KB
/
sidebar.php
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
<?php
if (isset($_SESSION['logget_ind'])) {
global $DB_TYPE;
$query = "SELECT Email,BrugerId FROM Bruger WHERE Brugerid = '".$_SESSION['brugerid']."'";
$result = doSQLQuery($query);
$line = db_fetch_array($result);
$brugernavn = $_SESSION['brugernavn'];
$email = $line["Email"];
$brugerid = $line["BrugerId"];
?>
<div class="block_2">
<div class="sidebar_header">
Du er logget ind som: <strong><?php echo $_SESSION['brugernavn'] ?> </strong>
<div class="log_help"><a href="logout.php">Log af</a>
<span id="help"><a href="help.html" onclick="NewWindow(this.href,'help_win','yes');return false;">Hjælp!</a></span></div>
</div>
<div id="sidebar">
<?php
$now = time();
$today = date('d', $now);
$curmonth = date('m', $now);
$curyear = date('Y', $now);
$page = isset($_GET['page']) ? $_GET['page'] : '';
if ($page == 'sange' || $page == '') {
?>
<div class="sidebar_top">
Sang top-ti:
</div>
<div class="sidebar_bg">
<?php
if ($DB_TYPE == "mysql") {
$query = "SELECT Count(Sang.SangID) AS SongCount,Sang.SangID,Sang.Titel
FROM (Sang
INNER JOIN ProgramPunkt ON Sang.SangId = ProgramPunkt.SangID)
INNER JOIN Program ON Program.ProgramID = ProgramPunkt.ProgramID
WHERE DateDiff('$curyear-$curmonth-$today', Program.Dato) < 365
GROUP BY Sang.SangID,Sang.Titel
ORDER BY Count(Sang.SangID) DESC LIMIT 10";
} else if ($DB_TYPE == "odbc") {
$query = "SELECT TOP 10 Count(Sang.SangID) AS SongCount,Sang.SangID,Sang.Titel
FROM (Sang
INNER JOIN ProgramPunkt ON Sang.SangId = ProgramPunkt.SangID)
INNER JOIN Program ON Program.ProgramID = ProgramPunkt.ProgramID
WHERE DateDiff('d', Program.Dato, '$curyear-$curmonth-$today') < 365
GROUP BY Sang.SangID,Sang.Titel
ORDER BY Count(Sang.SangID) DESC ";
}
$result = doSQLQuery($query);
$lines = 0;
while ($lines < 10 && ($line = db_fetch_array($result))) {
$lines++;
$count = $line["SongCount"];
$songid = $line["SangID"];
$songtitle = $line["Titel"];
$songtitle = substr($songtitle,0,25);
echo " <a href=\"editSong.php?song=".$songid."\" onclick=\"NewWindow(this.href,'song_win','yes');return false;\">".$songtitle."...</a> (".$count.")<br />\n";
}
?>
</div>
<div class="sidebar_bund"></div>
<?php
} else if ($page == 'program') {
?>
<div class="sidebar_top">Kalender</div>
<div class="sidebar_bg">
<?php
//<div class="sidebar_bg"><img src="img/kalender_img.gif" width="160" height="165" /><br /></div>
include('calendar.php');
?>
</div>
<div class="sidebar_bund"></div>
<?php
}
$now = time();
$today = date('d', $now);
$curmonth = date('m', $now);
$curyear = date('Y', $now);
?>
<div class="sidebar_top">
Senest tilføjet:
</div>
<div class="sidebar_bg">
<?php
if ($DB_TYPE == "mysql") {
$query = "SELECT SangId,Titel FROM Sang ORDER BY SangId DESC LIMIT 6;";
} else if ($DB_TYPE == "odbc") {
$query = "SELECT TOP 6 SangId,Titel FROM Sang ORDER BY SangId DESC;";
}
$result = doSQLQuery($query);
while ($line = db_fetch_array($result)) {
echo " <a href=\"editSong.php?song=".$line["SangId"]."\" onclick=\"NewWindow(this.href,'song_win','yes');return false;\">".$line["Titel"]."</a><br />\n";
}
?>
</div>
<div class="sidebar_bund"></div>
<div class="sidebar_top">
Setlister hvor jeg er på:
</div>
<div class="sidebar_bg">
<?php
if ($DB_TYPE == "mysql") {
$query = "SELECT Program.Dato,Program.ProgramId,Program.Arrangement FROM Program INNER JOIN ProgramBruger ON ProgramBruger.ProgramID=Program.ProgramID WHERE ProgramBruger.BrugerID=".$brugerid." AND DateDiff(Dato, '$curyear-$curmonth-$today') > -1 ORDER BY Dato LIMIT 3;";
} else if ($DB_TYPE == "odbc") {
$query = "SELECT TOP 3 Program.Dato,Program.ProgramId,Program.Arrangement FROM Program INNER JOIN ProgramBruger ON ProgramBruger.ProgramID=Program.ProgramID WHERE ProgramBruger.BrugerID=".$brugerid." AND DateDiff('s', Dato, '$curyear-$curmonth-$today') < 1 ORDER BY Dato;";
}
$result = doSQLQuery($query);
while ($line = db_fetch_array($result)) {
$tmp = $line["Dato"];
$eventDate = substr($tmp,8,2)."/".substr($tmp,5,2)."/".substr($tmp,0,4);
echo " <a href=\"main.php?page=program&eventId=".$line["ProgramId"]."\">".$line["Arrangement"]." d. ".$eventDate."</a><br />\n";
}
?>
<?php
echo " <div class=\"sealle\"> <a href=\"main.php?page=mypage\">Se alle</a></div>\n";
?>
</div>
<div class="sidebar_bund"></div>
<div class="sidebar_top">
Kommende setlister:
</div>
<div class="sidebar_bg">
<?php
if ($DB_TYPE == "mysql") {
$query = "SELECT Dato,ProgramId,Arrangement FROM Program WHERE DateDiff(Dato, '$curyear-$curmonth-$today') > -1 ORDER BY Dato LIMIT 5;";
} else if ($DB_TYPE == "odbc") {
$query = "SELECT TOP 5 Dato,ProgramId,Arrangement FROM Program WHERE DateDiff('s', Dato, '$curyear-$curmonth-$today') < 1 ORDER BY Dato;";
}
$result = doSQLQuery($query);
while ($line = db_fetch_array($result)) {
$tmp = $line["Dato"];
$eventid = $line["ProgramId"];
$eventtitle = $line["Arrangement"];
$eventtitle = substr($eventtitle,0,22);
$eventDate = substr($tmp,8,2)."/".substr($tmp,5,2);
echo " <a href=\"main.php?page=program&eventId=".$eventid."\">".$eventtitle." d. ".$eventDate."</a><br />\n";
}
?>
<?php
echo " <div class=\"sealle\"> <a href=\"main.php?page=program\">Se alle</a></div>\n";
?>
</div>
<div class="sidebar_bund"></div>
</div>
</div>
<?php
} // Session
?>