-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathevents.php
58 lines (54 loc) · 2.05 KB
/
events.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
<?php
/*
+----------------------------------------------------------------------+
| APM stands for Alternative PHP Monitor |
+----------------------------------------------------------------------+
| Copyright (c) 2008-2015 Davide Mendolia, Patrick Allaert |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Patrick Allaert <[email protected]> |
+----------------------------------------------------------------------+
*/
$repository = require "model/repository.php";
$eventService = $repository->getEventService();
$records = $eventService->getEventsCount($_GET["id"]);
$rows = (int) $_GET["rows"];
$page = (int) $_GET["page"];
switch ($_GET["sidx"]) {
case "time":
$order = APM\ORDER_TIMESTAMP;
break;
case "type":
$order = APM\ORDER_TYPE;
break;
case "file":
$order = APM\ORDER_FILE;
break;
case "message":
$order = APM\ORDER_MESSAGE;
break;
case "line":
case "id":
default:
$order = APM\ORDER_ID;
}
$data = $eventService->loadEvents(
$_GET["id"],
($page - 1) * $rows,
$rows,
$order,
($_GET["sord"] === "desc") ? APM\ORDER_DESC : APM\ORDER_ASC
);
foreach ($data as &$event) {
$event = (array) $event;
$event["timestamp"] = $event["timestamp"]->format("Y-m-d H:i:s");
$event["type"] = APM\getErrorCodeFromID($event["type"]);
}
require "views/json/data.php";