-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
468 lines (427 loc) · 23.1 KB
/
index.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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
<?php include "../include/functions.php" ?>
<?php include "../include/db.php" ?>
<?php include "../include/params.php" ?>
<?php include "../include/dictionary2.php" ?>
<html>
<head>
<script type="application/javascript">
lang = '<?php echo $cLang?>';
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo dic("Settings.PanoramaGPS")?></title>
<link rel="stylesheet" type="text/css" href="../style.css">
<link rel="stylesheet" type="text/css" href="../rstyle.css">
<link rel="stylesheet" type="text/css" href="../css/ui-lightness/jquery-ui-1.8.14.custom.css">
<LINK REL="SHORTCUT ICON" HREF="../images/icon.ico">
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/share.js"></script>
<script type="text/javascript" src="../js/iScroll.js"></script>
<script type="text/javascript" src="../js/jquery-ui.js"></script>
<script type="text/javascript" src="../js/settings.js"></script>
<link href="../tracking/mlColorPicker.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../tracking/mlColorPicker.js" ></script>
<script type="text/javascript" src="../main/main.js"></script>
<script src="../js/jquery-ui-timepicker-addon.js" type="text/javascript"></script>
</head>
<?php
if (session('user_id') == "261" or session('user_id') == "779" or session('user_id') == "780" or session('user_id') == "781" or session('user_id') == "776" or session('user_id') == "777" or session('user_id') == "782" or session('user_id') == "778") echo header('Location: ../sessionexpired/?l='.$cLang);
if (is_numeric(nnull(session("user_id"))."") == false) echo header ('Location: ../sessionexpired/?l=' . $cLang);
opendb();
$sql_ = "";
$sqlV = "";
if ($_SESSION['role_id'] == "2") {
$sql_ = "select * from vehicles where id in (select id from vehicles where clientID=" . session("client_id") . ") order by code asc";
$sqlV = "select id from vehicles where clientID=" . session("client_id") ;
} else {
$sql_ = "select * from vehicles where id in (select vehicleid from uservehicles where userid=" . session("user_id") . ") order by code asc";
$sqlV = "select vehicleID from uservehicles where userID=" . session("user_id") . "" ;
}
$firstVehId = pg_fetch_result(query($sql_), 0, "id");
$Allow = getPriv("settings", session("user_id"));
if ($Allow == false) echo header ('Location: ../?l=' . $cLang . '&err=permission');
$AllowUSettings = true;//getPriv("UserSettings", session("user_id"));
$AllowCSettings = true;//getPriv("ClientSettings", session("user_id"));
$AllowPSettings = true;//getPriv("PrivilegesUser", session("user_id"));
$meni = 0;
if ($AllowUSettings == true) {
$meni = 1;
}
else {
if ($AllowCSettings == true) {
$meni = 2;
} else {
if ($AllowPSettings == true) {
$meni = 3;
} else {
echo 1;
echo header ('Location: ../?l=' . $cLang . '&err=permission') ;
}
}
}
$ds = query("select allowedrouting, allowedfm, allowedmess, allowedalarms from clients where id=" . session("client_id"));
$allowedrouting = pg_fetch_result($ds, 0, "allowedrouting");
$allowedFM = pg_fetch_result($ds, 0, "allowedfm");
$allowedMess = pg_fetch_result($ds, 0, "allowedmess");
$allowedAlarms = pg_fetch_result($ds, 0, "allowedalarms");
$fm = '';
$fm1 = '';
$routes = '';
$routes1 = '';
$mess = '';
$mess1 = '';
$al = '';
$al1 = '';
$tv = '';
$tv1 = '';
if(true)
{
$tv = 'return false;';
$tv1 = 'opacity: 0.4;';
}
if(!$allowedFM)
{
$fm = 'return false;';
$fm1 = 'opacity: 0.4;';
}
if(!$allowedrouting)
{
$routes = 'return false;';
$routes1 = 'opacity: 0.4;';
}
if(!$allowedMess)
{
$mess = 'return false;';
$mess1 = 'opacity: 0.4;';
}if(!$allowedAlarms)
{
$al = 'return false;';
$al1 = 'opacity: 0.4;';
}
$dsTraceSnooze = query("select snooze from users where id=" . session("user_id"));
$snooze = pg_fetch_result($dsTraceSnooze, 0, "snooze");
$LastDay = DatetimeFormat(addDay(-1), 'd-m-Y');
addlog(3);
?>
<script>
AllowUSettings = '<?php echo strtolower($AllowUSettings."")?>';
AllowCSettings = '<?php echo strtolower($AllowCSettings."")?>';
AllowPSettings = '<?php echo strtolower($AllowPSettings."")?>';
lang = '<?php echo $cLang?>';
(function ($) {
$.widget("ui.combobox", {
_create: function () {
var self = this,
select = this.element.hide(),
selected = select.children(":selected"),
value = selected.val() ? selected.text() : "";
var input = this.input = $("<input>")
.insertAfter(select)
.val(value)
.autocomplete({
delay: 0,
minLength: 0,
source: function (request, response) {
var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i");
response(select.children("option").map(function () {
var text = $(this).text();
if (this.value && (!request.term || matcher.test(text)))
return {
label: text.replace(
new RegExp(
"(?![^&;]+;)(?!<[^<>]*)(" +
$.ui.autocomplete.escapeRegex(request.term) +
")(?![^<>]*>)(?![^&;]+;)", "gi"
), "<strong>$1</strong>"),
value: text,
option: this
};
}));
},
select: function (event, ui) {
ui.item.option.selected = true;
self._trigger("selected", event, {
item: ui.item.option
});
},
change: function (event, ui) {
if (!ui.item) {
var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex($(this).val()) + "$", "i"),
valid = false;
select.children("option").each(function () {
if ($(this).text().match(matcher)) {
this.selected = valid = true;
return false;
}
});
if (!valid) {
// remove invalid value, as it didn't match anything
$(this).val("");
select.val("");
input.data("autocomplete").term = "";
return false;
}
}
}
})
.addClass("ui-widget ui-widget-content ui-corner-left");
input.data("autocomplete")._renderItem = function (ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a>" + item.label + "</a>")
.appendTo(ul);
};
this.button = $("<button type='button'> </button>")
.attr("tabIndex", -1)
.attr("title", "Show All Items")
.insertAfter(input)
.button({
icons: {
primary: "ui-icon-triangle-1-s"
},
text: false
})
.removeClass("ui-corner-all")
.addClass("ui-corner-right ui-button-icon")
.click(function () {
// close if already visible
if (input.autocomplete("widget").is(":visible")) {
input.autocomplete("close");
return;
}
// work around a bug (likely same cause as #5265)
$(this).blur();
// pass empty string as value to search for, displaying all results
input.autocomplete("search", "");
input.focus();
});
},
destroy: function () {
this.input.remove();
this.button.remove();
this.element.show();
$.Widget.prototype.destroy.call(this);
}
});
})(jQuery);
</script>
<script type="text/javascript">
$(document).ready(function () {
jQuery('body').bind('touchmove', function(e){e.preventDefault()});
});
</script>
<body onResize="SetHeightSettingsPetar()">
<div id="divaddCity" title="<?php echo dic("Admin.AddCity")?>" style="display:none"></div>
<div id="rep"></div>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="min-width: 717px;">
<tr>
<td class="resmenucol3" width="35%" height="32px" style="background-image:url(../images/traka.png); border-bottom:1px solid #999">
<span class="reslogo1"><img src="../images/tiniLogo.png" border="0" align="absmiddle" />
<img src="../images/sep.png" border="0" align="absmiddle" /> </span>
<a id="icon-home" href="../?l=<?php echo $cLang?>"><img src="../images/shome.png" border="0" align="absmiddle" /></a>
<a id="icon-live" href="../tracking/?l=<?php echo $cLang?>"><img src="../images/smap.png" border="0" align="absmiddle" /></a>
<a id="icon-rep" href="../report/?l=<?php echo $cLang?>#rep/menu_1_1" ><img src="../images/sdocument.png" border="0" align="absmiddle" /></a>
<a id="icon-route" onclick="<?php echo $routes?>" style="<?php echo $routes1?>" href="../routes/?l=<?php echo $cLang?>" ><img src="../images/srouting.png" border="0" align="absmiddle" /></a>
<a id="icon-tv" onclick="<?php echo $tv?>" style="<?php echo $tv1?>" href="../tv/?l=<?php echo $cLang?>#tv/menu_2_1" ><img src="../images/stv.png" border="0" align="absmiddle" /></a>
<img src="../images/sep.png" border="0" align="absmiddle" />
</td>
<td width="65%" height="32px" style="background-image:url(../images/traka.png); border-bottom:1px solid #999" align="right" class="text2 resmenucol4">
<span class="rescompany1"><?php echo dic("Settings.Company")?>: <strong><?php echo session("company")?></strong> <img src="../images/sep.png" border="0" align="absmiddle" /> </span>
<span class="resuser1"><?php echo dic("Settings.User")?>: <strong><?php echo session("user_fullname")?></strong>
<img src="../images/sep.png" border="0" align="absmiddle" /> </span>
<!--a>
<div id="alertsNew" class="corner5" style="background-color: Red; color: White; height: 13px; left: 0px; float: left; z-index: 134354; width: 13px; top: 0px; text-align: center;">1</div>
</a-->
<a id="icon-alert" style="position: relative; left: 15px; margin-left: -10px;<?php echo $al1?>">
<img src="../images/warning1.png" onclick="<?php echo $al?>ShowHideAlerts()" border="0" align="absmiddle" style="cursor: pointer;" />
<span id="alertsNew" class="notify corner5" style="visibility: hidden;" disabled onclick="<?php echo $al?>ShowHideAlerts()">0</span>
<!--input id="alertsNew" class="notify corner5" onclick="ShowHideAlerts()" style="visibility: hidden;" value="0" disabled /-->
</a>
<!--a>
<div id="alertsNew" class="corner5" style="background-color: Red; color: White; height: 13px; left: 0px; float: left; z-index: 134354; width: 13px; top: 0px; text-align: center;">1</div>
</a-->
<a id="icon-mail" style="position: relative; left: 15px; margin-left: -10px;<?php echo $mess1?>">
<img src="../images/mail.png" onclick="<?php echo $mess?>ShowHideMail()" border="0" align="absmiddle" style="cursor: pointer;" />
<span id="mailNew" class="notify corner5" style="visibility: hidden;" disabled onclick="<?php echo $mess?>ShowHideMail()">0</span>
<!--input id="mailNew" class="notify corner5" onclick="ShowHideMail()" style="visibility: hidden;" value="0" disabled /-->
</a>
<img src="../images/sep.png" border="0" align="absmiddle" />
<a id="icon-costs" style="position: relative; left: 15px; margin-left: -10px;<?php echo $fm1?>">
<img src="../images/cost24.png" onclick="<?php echo $fm?>costVehicle123('1', '<?php echo $firstVehId?>', 'SK-0001-AB')" border="0" align="absmiddle" style="cursor: pointer;" />
<input id="costNew" class="notify corner5" onclick="<?php echo $fm?>ShowHideMail()" style="visibility: hidden;" value="0" disabled />
</a>
<img src="../images/sep.png" border="0" align="absmiddle" />
<a id="icon-sett"><img src="../images/ssettings.png" border="0" align="absmiddle" style="opacity:0.4"/></a>
<a id="icon-help"><img src="../images/shelp.png" border="0" align="absmiddle" /></a>
<img src="../images/sep.png" border="0" align="absmiddle" />
<a id="icon-logout" href="../logout/?l=<?php echo $cLang?>"><img width="24px" src="../images/exitNew1.png" border="0" align="absmiddle" /></a>
</td>
</tr>
</table>
<audio id="soundHandle" loop="loop" style="display: none;"></audio>
<div id="div-costMain" style="display:none" title="<?php echo dic("Reports.AddingCost")?>"></div>
<div id="div-showMessage" style="display:none" title="<?php echo dic("Routes.ShowMessages")?>"></div>
<div id="div-costnewMain" style="display:none" title="<?php echo dic("Reports.AddingNewCost")?>"></div>
<div id="div-del-cost" style="display:none" title="Бришење на трошок"></div>
<div id="div-locMain" style="display:none" title="<?php echo dic("Reports.AddNewExecutor")?>"></div>
<div id="div-compMain" style="display:none" title="<?php echo dic("Reports.AddNewComponent")?>"></div>
<div id="div-mainalerts" onmouseover="clearTimeOutAlertView()" onmouseout="setTimeOutAlertView()" style="display:none; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; border: 0px; right: 35px; float: right; position: absolute; z-index: 9999; top: 43px; width: 315px; overflow-x: hidden; overflow-y: auto;"></div>
<div id="div-delComp" style="display:none" title="<?php echo dic("Reports.DelComp")?>"></div>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="td-menu" width="250px" style="background-color:#efefef;" valign="top">
<div id="div-menu" style="width:100%; overflow-y:auto; overflow-x:hidden">
<div id="menu-1" class="menu-container" style="">
<a id="menu-title-1" href="#" class="menu-title text3" onClick="OnMenuClick(1)"><?php echo dic("Settings.Settings")?></a>
<div id="menu-container-1" style="width:230px; padding-left:10px; padding-bottom:10px; padding-top:10px;">
<a id="menu_set_1" href="#settings/menu_set_1" class="repoMenu corner5 text2" onClick="SettingsMeni(1)">▪ <?php echo dic("Settings.GeneralSett")?></a>
<a id="menu_set_2" href="#settings/menu_set_2" class="repoMenu corner5 text2" onClick="SettingsMeni(2)">▪ <?php echo dic("Settings.UserSett")?></a>
<a id="menu_set_3" href="#settings/menu_set_3" class="repoMenu corner5 text2" onClick="SettingsMeni(3)">▪ <?php echo dic("Settings.Pois")?></a>
<a id="menu_set_4" href="#settings/menu_set_4" class="repoMenu corner5 text2" onClick="SettingsMeni(4)">▪ <?php echo dic("Settings.Vehicles")?></a>
<a id="menu_set_5" href="#settings/menu_set_5" class="repoMenu corner5 text2" onClick="SettingsMeni(5)">▪ <?php echo dic("Fm.OrgUnits")?></a>
<a id="menu_set_6" href="#settings/menu_set_6" class="repoMenu corner5 text2" onClick="SettingsMeni(6)">▪ <?php echo dic("Fm.Employees")?></a>
<a id="menu_set_7" href="#settings/menu_set_7" class="repoMenu corner5 text2" onClick="SettingsMeni(7)">▪ <?php echo dic("Settings.WorkTime")?></a>
<a id="menu_set_8" href="#settings/menu_set_8" class="repoMenu corner5 text2" onClick="SettingsMeni(8)">▪ <?php echo dic("Settings.Scheduler")?></a>
<a id="menu_set_9" href="#settings/menu_set_9" class="repoMenu corner5 text2" style="<?php echo $al1?>" onClick="<?php echo $al?>SettingsMeni(9)">▪ <?php echo dic("Settings.Alerts")?></a>
</div>
</div>
<?php
If ($_SESSION['role_id'] == 2) {
?>
<div id="menu-2" class="menu-container" style="">
<a id="menu-title-2" href="#" class="menu-title text3" onClick="OnMenuClick(2)"><?php echo dic("Settings.Reports")?></a>
<div id="menu-container-2" style="width:230px; padding-left:10px; padding-bottom:10px; padding-top:10px;">
<a id="menu_set_10" href="#settings/menu_set_10" class="repoMenu corner5 text2" onClick="SettingsMeni(10)">▪ <?php echo dic("Reports.Log")?></a>
<!--a id="menu_set_11" href="#settings/menu_set_11" class="repoMenu corner5 text2" style="<?php echo $mess1?>" onClick="<?php echo $mess?>SettingsMeni(11)">▪ <?php echo dic("Settings.MessagesNew")?></a-->
</div>
</div>
<?php } ?>
</div>
</td>
<td width="4px" style=" background-color:#efefef;"> </td>
<td id="race-td" width="9px" style="border-left:1px solid #cccccc;">
<div id="race-img" style="width:8px; height:50px; background-image:url(../images/race.png); background-position:-8px 0px; cursor:pointer" onClick="ShowHideLeftMenu()"></div>
</td>
<!--td height="100%" valign="top" >
<div style="width:100%; height:5px;"></div>
<div style="width:100%; height:5px;"></div>
<div id="report-content" style="width:98%; text-align:left; height:500px; margin-left:10px; border:1px solid #bbb; background-color:#fafafa; overflow-y:hidden" class="corner5">
<iframe id="ifrm-cont" src="USettings.php" width="100%" frameborder="0" scrolling="yes" style="overflow-x: hidden;overflow-y: scroll"></iframe>
</div>
</td-->
<td height="100%" valign="top" >
<div style="width:100%; height:5px;"></div>
<div id="vremence" style="display: none; width:98%; margin-left:10px; height:35px; border:1px solid #bbbbbb; background-color:#eee; padding-top:5px" class="corner5 text2">
<div style="display: inline; float: left; margin-left: 10px; margin-top: 7px;"><?php echo dic_("Reports.Period")?>:</div>
<div style="display: inline; float: left; margin-left: 10px; margin-top: 2px;">
<input id="txtNewDate" onclick="opencal()" type="text" width="180px" class="textboxCalender corner5 text2" style="width: 200px; height: 24px; cursor: pointer;" value="" />
</div>
<img id="imgkal" src="../images/cal.png" onclick="opencal()" style="display: inline; float: left; position: relative; margin-top: 2px; left: -25px; cursor: pointer" />
<span id="lbl-start-date" style="display: none"><input id="txtSDate" type="text" width="80px" class="textboxCalender corner5 text2" value="<?php echo $LastDay;?>" /></span>
<span id="lbl-end-date" style="display: none;"><input id="txtEDate" type="text" width="80px" class="textboxCalender corner5 text2" value="<?php echo $LastDay;?>" /></span>
<?php if($yourbrowser == "1") { ?> <?php } else { ?> <?php } ?><button style="<?php if($yourbrowser == "1") { ?>margin-left: -20px;<?php } ?>" id="showBtn" onClick="loadReport()"><?php dic("Reports.Show")?></button>
<div id="vehdiv" class="roundedMenu" style="z-index:99999999; background-color: #FAFAFA; border:1px solid #cccccc; width:175px; height:190px; overflow-y: auto; position: relative; display: none; max-height: 500px"></div>
</div>
<div style="width:100%; height:5px;"></div>
<div id="report-content" style="min-width: 560px; text-align:left; height:580px; margin-left:10px; border:1px solid #bbb; background-color:#fafafa; overflow-x:hidden ;overflow-y:auto; " class="corner5 resizberi">
<iframe id="ifrm-cont" src="USettings.php" width="100%" frameborder="0" scrolling="yes" style="overflow-x: hidden;overflow-y: auto"></iframe>
</div>
</td>
</tr>
</table>
<div id="kalendarM" style="display: none; width: 625px; height: 168px; background-color: White; position: absolute; left: 338px; top: 68px;" class="shadow">
<iframe id="ifrmkal" src="timeframe.php" style="width:100%; border: 0px; height: 100%" scrolling="no"></iframe>
</div>
<div id="dialog-message" title="<?php echo dic("Reports.Message")?>" style="display:none">
<p>
<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
<div id="div-msgbox" style="font-size:14px"></div>
</p>
</div>
<div id="dialog-message1" title="<?php dic("Reports.Warning")?>" style="display:none">
<p>
<span class="ui-icon ui-icon-circle-check" style="float:left; margin:0 7px 50px 0;"></span>
<div id="div-msgbox1" style="font-size:14px"></div>
</p>
</div>
<div id="div-loading" class="BlackText2 shadow"><img src="../images/loading.gif" border="0" align="absmiddle" width="16" height="16" /> <?php echo dic("Settings.Loading")?>...</div>
<div id="dialog-map" title="<?php echo dic("Reports.ViewOnMap")?>" style="display:none">
<p></p>
</div>
<div id="Loading-gif" style="display:none; width:200px; height:100px;" title="Loading...">
<img src="../images/loading_bar1.gif" style="width:150px"/>
</div>
</body>
</html>
<script>
var seluser = 0;
function opencal()
{
if($('#kalendarM').css('display') == 'none')
$('#kalendarM').css({display:'block'});
else
$('#kalendarM').css({display:'none'});
document.getElementById("txtNewDate").blur();
}
checkHash()
var allowedMess = '<?php echo $allowedMess?>';
var allowedAlarms = '<?php echo $allowedAlarms?>';
if(allowedAlarms == '1')
{
var snoozeTmp = 0;
snooze = '<?php echo $snooze?>';
$('#alertsNew').val('0');
$('#div-mainalerts').css({ height: (document.body.clientHeight - 75) + 'px' });
}
$(function () {
SetHeightSettingsPetar()
$("#radio").buttonset();
//$('#btnSave').button({ icons: { primary: "ui-icon-check"} });
});
//SettingsMeni(<?php echo $meni?>)
function test() {
}
$('#showBtn').button({ icons: { primary: "ui-icon-search"} })
if(allowedAlarms == '1')
{
//ShowHideAlerts();
//ShowHideMail();
snoozeAlarm();
AjaxNotify();
}
if(allowedMess == '1')
AjaxMessageNotify();
</script>
<?php
if($allowedAlarms)
{
$sqlAlarm = "";
$sqlAlarm .= "select ah.*, v.registration from alarmshistory ah left join vehicles v on v.id=ah.vehicleid ";
$sqlAlarm .= " where ah.vehicleid in (" . $sqlV . ") ";
$sqlAlarm .= " and ah.datetime > cast((select now()) as date) + cast('-1 day' as interval) ";
$sqlAlarm .= " order by read asc, datetime desc";
$dsAlarms = query($sqlAlarm);
$brojac = 1;
$brojac1 = dlookup("select count(*) from alarmshistory where vehicleid in (" . $sqlV . ") and datetime > cast((select now()) as date) + cast('-1 day' as interval) and read='0'");
while($row = pg_fetch_array($dsAlarms))
{
$tzDatetime = new DateTime($row["datetime"]);
list($d, $m, $y) = explode('-', $row["datetime"]);
$a = explode(" ", $y);
$d1 = explode(":", $a[1]);
$d2 = explode(".", $d1[2]);
$idCreate = $row["vehicleid"] . "_" . $d . "_" . $m . "_" . $a[0] . "_" . $d1[0] . "_" . $d1[1] . "_" . $d2[0] . "_" . $d2[1];
if($row["read"] == "0")
{
?>
<script>
AlertEventInit('<?php echo $row["datetime"]?>', '<?php echo $row["registration"]?>', '<?php echo $row["name"]?>', '<?php echo $row["vehicleid"]?>', '<?php echo $brojac1?>');
</script>
<?php
$brojac1--;
}
$brojac++;
}
}
closedb();
?>