jilo-web/app/classes/component.php

51 lines
1.4 KiB
PHP
Raw Normal View History

2024-07-08 09:17:35 +00:00
<?php
class Component {
private $db;
private $queries;
public function __construct($database) {
$this->db = $database->getConnection();
2024-08-22 08:59:48 +00:00
// $this->queries = include('queries.php');
2024-07-08 09:17:35 +00:00
}
// list of component events
public function jitsiComponents($jitsi_component, $component_id, $from_time, $until_time) {
// time period drill-down
// FIXME make it similar to the bash version
if (empty($from_time)) {
$from_time = '0000-01-01';
}
if (empty($until_time)) {
$until_time = '9999-12-31';
}
$from_time = htmlspecialchars(strip_tags($from_time));
$until_time = htmlspecialchars(strip_tags($until_time));
2024-08-21 19:11:28 +00:00
// list of jitsi component events
2024-08-22 08:59:48 +00:00
$sql = "SELECT jitsi_component, loglevel, time, component_id, event_type, event_param
2024-08-21 19:11:28 +00:00
FROM
jitsi_components
WHERE
2024-08-22 08:59:48 +00:00
jitsi_component = %s
2024-08-21 19:11:28 +00:00
AND
2024-08-22 08:59:48 +00:00
component_id = %s
2024-08-21 19:11:28 +00:00
AND
2024-08-22 08:59:48 +00:00
(time >= '%s 00:00:00' AND time <= '%s 23:59:59')
2024-08-21 19:11:28 +00:00
ORDER BY
2024-08-22 08:59:48 +00:00
time";
$sql = sprintf($sql, $jitsi_component, $component_id, $from_time, $until_time);
2024-07-08 09:17:35 +00:00
$query = $this->db->prepare($sql);
2024-08-22 08:59:48 +00:00
$query->execute();
2024-07-08 09:17:35 +00:00
return $query->fetchAll(PDO::FETCH_ASSOC);
}
}
?>