/
entry_list.php
executable file
·265 lines (234 loc) · 8.58 KB
/
entry_list.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
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
264
265
<?php
/*
JM-booking
Copyright (C) 2007-2010 Jaermuseet <http://www.jaermuseet.no>
Contact: <hn@jaermuseet.no>
Project: <http://github.com/hnJaermuseet/JM-booking>
Based on ARBS, Advanced Resource Booking System, copyright (C) 2005-2007
ITMC der TU Dortmund <http://sourceforge.net/projects/arbs/>. ARBS is based
on MRBS by Daniel Gardner <http://mrbs.sourceforge.net/>.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
require 'include/entry_list.php';
print_header($day, $month, $year, $area);
echo '<h1>'.$entry_list_heading.'</h1>'.chr(10);
echo $entry_list_ingress;
echo '<div class="hiddenprint">';
filterLink($filters, $return_to); echo '</div>'.chr(10);
filterPrint($filters); echo '<br>'.chr(10);
echo '<br>'.chr(10).chr(10);
$emaillist_entry = '';
$tamed_booking = true;
foreach($filters as $filter) {
if($filter[0] == 'tamed_booking')
{
$tamed_booking = $filter[1];
}
}
if(!$tamed_booking || $Q->rowCount() <= 0)
{
echo __('No entries found.');
}
else
{
echo $Q->rowCount().' '.__('entries found.');
//echo '<br><br>'.chr(10).chr(10);
echo '<table class="prettytable">'.chr(10);
echo ' <tr>'.chr(10);
if($listtype == 'customer_list')
{
echo ' <th style="vertical-align: bottom;">'.iconHTML('group').' Kundenavn</th>'.chr(10);
echo ' <th style="vertical-align: bottom;">'.iconHTML('user_small').' B / '.
iconHTML('user_suit').' V</th>'.chr(10);
echo ' <th style="vertical-align: bottom;">'.iconHTML('page_white').' Antall booking</th>'.chr(10);
$customer_list = array();
$customer_names = array();
}
else
{
echo ' <th style="vertical-align: bottom;">'.__('Starts').'</th>'.chr(10);
echo ' <th style="vertical-align: bottom;">'.__('Ends').'</th>'.chr(10);
echo ' <th style="vertical-align: bottom;">'.__('C/A').'</th>'.chr(10);
echo ' <th style="vertical-align: bottom;">'.__('Entry type').'</th>'.chr(10);
echo ' <th style="vertical-align: bottom;">'.__('Name').'</th>'.chr(10);
if($listtype == 'servering')
{
echo ' <th style="vertical-align: bottom;">Alkohol?</th>'.chr(10);
echo ' <th style="vertical-align: bottom;">'.__('Service description').'</th>'.chr(10);
}
echo ' <th style="vertical-align: bottom;">'.__('Room').'</th>'.chr(10);
}
echo ' </tr>'.chr(10);
while($R = $Q->fetch(PDO::FETCH_ASSOC))
{
$entry = getEntryParseDatabaseArray($R);
if($listtype == 'customer_list')
{
if(isset($customer_list[$entry['customer_id']]))
{
$customer_list[$entry['customer_id']]['c'] += $entry['num_person_child'];
$customer_list[$entry['customer_id']]['a'] += $entry['num_person_adult'];
$customer_list[$entry['customer_id']]['e']++;
}
else
{
$customer_list[$entry['customer_id']] = getCustomer($entry['customer_id']);
if(!count($customer_list[$entry['customer_id']]))
{
$customer_list[$entry['customer_id']]['customer_id'] = $entry['customer_id'];
if($entry['customer_id'] == 0)
$customer_list[$entry['customer_id']]['customer_name'] = 'Ingen kunde valgt';
else
$customer_list[$entry['customer_id']]['customer_name'] = 'KUNDE IKKE FUNNET I DATABASE';
$customer_names[$entry['customer_id']] = ''; // Sort the unknowns to the top
}
else
$customer_names[$entry['customer_id']] = $customer_list[$entry['customer_id']]['customer_name'];
$customer_list[$entry['customer_id']]['c'] = $entry['num_person_child'];
$customer_list[$entry['customer_id']]['a'] = $entry['num_person_adult'];
$customer_list[$entry['customer_id']]['e'] = 1;
}
}
else
{
echo ' <tr>'.chr(10);
// Starts
echo ' <td>';
echo date('H:i', $entry['time_start']).' ';
echo '<a href="day.php?year='.date('Y', $entry['time_start']).'&month='.date('m', $entry['time_start']).'&day='.date('d', $entry['time_start']).'&area='.$entry['area_id'].'">'.date('d',$entry['time_start']).'</a>-';
echo '<a href="month.php?year='.date('Y', $entry['time_start']).'&month='.date('m', $entry['time_start']).'&day='.date('d', $entry['time_start']).'&area='.$entry['area_id'].'">'.date('m',$entry['time_start']).'</a>-';
echo date('Y', $entry['time_start']);
echo '</td>'.chr(10);
// Ends
echo ' <td>';
echo date('H:i', $entry['time_end']).' ';
echo '<a href="day.php?year='.date('Y', $entry['time_end']).'&month='.date('m', $entry['time_end']).'&day='.date('d', $entry['time_end']).'&area='.$entry['area_id'].'">'.date('d',$entry['time_end']).'</a>-';
echo '<a href="month.php?year='.date('Y', $entry['time_end']).'&month='.date('m', $entry['time_end']).'&day='.date('d', $entry['time_end']).'&area='.$entry['area_id'].'">'.date('m',$entry['time_end']).'</a>-';
echo date('Y', $entry['time_end']);
echo '</td>'.chr(10);
// Child / adult
echo ' <td>';
echo '<font size="1">'.$entry['num_person_child'].' / '.$entry['num_person_adult'].'</font>';
echo '</td>';
// Type
$entrytype = getEntryType($entry['entry_type_id']);
echo ' <td>';
if(count($entrytype))
echo '<font size="1">'.$entrytype['entry_type_name'].'</font>';
echo '</td>';
// Name
echo ' <td><a href="entry.php?entry_id='.$entry['entry_id'].'">'.
$entry['entry_name'].'</a></td>'.chr(10);
// Serveringsbeskrivelse
if($listtype == 'servering')
{
echo ' <td>';
if($entry['service_alco'])
echo 'ja';
else
echo 'nei';
echo '</td>'.chr(10);
echo ' <td>'.nl2br($entry['service_description']).'</td>'.chr(10);
}
// Room
echo ' <td>';
$rooms = array();
if(!count($entry['room_id']))
$rooms[] = '<i>'.__('Whole area').'</i>';
elseif(count($entry['room_id']) == '1')
{
// Single room
foreach ($entry['room_id'] as $rid)
{
if ($rid == '0')
$rooms[] = '<i>'.__('Whole area').'</i>';
else
{
$room = getRoom($rid);
if(count($room))
$rooms[] = $room['room_name'];
else
$rooms[] = __('Can\'t find room');
}
}
}
else
{
$rooms = false;
foreach ($entry['room_id'] as $rid)
{
if($rid != '0')
{
$room = getRoom($rid);
if(count($room))
$rooms[] = $room['room_name'];
}
}
if(!$rooms)
$rooms[] = __('Whole area');
}
echo implode(', ', $rooms);
echo '</td>'.chr(10);
echo ' </tr>'.chr(10);
}
if(isset($_GET['emaillist']) && $_GET['emaillist'] == 1 && $entry['contact_person_email'] != '')
{
if($entry['customer_name'] != '')
$emaillist_entry[$entry['contact_person_email']] = $entry['contact_person_email'].' <'.trim($entry['contact_person_name']).' - '.trim($entry['customer_name']).'>';
else
$emaillist_entry[$entry['contact_person_email']] = $entry['contact_person_email'].' <'.trim($entry['contact_person_name']).'>';
}
}
if($listtype == 'customer_list')
{
// Sorting
natcasesort($customer_names);
foreach($customer_names as $customer_id => $customer_name)
{
$c = $customer_list[$customer_id];
echo ' <tr>'.chr(10);
echo ' <td>';
if($c['customer_id'] > 0)
echo '<a href="customer.php?customer_id='.$c['customer_id'].'">';
echo $c['customer_name'];
if($c['customer_id'] > 0)
echo '</a>';
echo '</td>';
echo ' <td style="text-align: center;">'.$c['c'].' / '.$c['a'].'</td>'.chr(10);
echo ' <td>';
$tmpfilter = $filters;
$tmpfilter = addFilter($tmpfilter, 'customer_id', $c['customer_id']);
echo '<a href="entry_list.php?filters='.filterSerialized($tmpfilter).'">';
echo $c['e'].' boooking';
if($c['e'] != '1')
echo 'er';
echo '</a>';
echo '</td>'.chr(10);
echo ' </tr>'.chr(10);
}
}
echo '</table>';
}
if(isset($_GET['emaillist']) && $_GET['emaillist'] == 1)
{
echo '<textarea rows="60" cols="150">';
echo implode("\n", $emaillist_entry);
echo '</textarea>';
$emaillist_entry2 = array();
foreach($emaillist_entry as $email)
$emaillist_entry2[] = strip_tags($email);
echo '<textarea rows="60" cols="150">';
echo implode("\n", $emaillist_entry2);
echo '</textarea>';
}
?>