diff --git a/jilo-web.conf.php b/jilo-web.conf.php index 65d1fe9..1cc859e 100644 --- a/jilo-web.conf.php +++ b/jilo-web.conf.php @@ -4,6 +4,7 @@ $config = [ 'domain' => 'localhost', 'folder' => '/jilo-web/', 'database' => '/home/yasen/work/code/git/lindeas-code/jilo-web/jilo-web.db', + 'jilo_database' => '/home/yasen/work/code/git/lindeas-code/jilo/jilo.db', ]; ?> diff --git a/public_html/classes/conference.php b/public_html/classes/conference.php new file mode 100644 index 0000000..12cac0f --- /dev/null +++ b/public_html/classes/conference.php @@ -0,0 +1,32 @@ +db = $database->getConnection(); + $this->queries = include('queries.php'); + } + + // list of all conferences + public function conferences_all_formatted() { + $sql = $this->queries['conferences_all_formatted']; + $query = $this->db->prepare($sql); + $query->execute(); + + return $query; + } + +} + +?> diff --git a/public_html/classes/queries.php b/public_html/classes/queries.php new file mode 100644 index 0000000..6926e1d --- /dev/null +++ b/public_html/classes/queries.php @@ -0,0 +1,102 @@ + " +SELECT DISTINCT + c.jitsi_component, + (SELECT ce.time + FROM conference_events ce + WHERE + ce.conference_id = c.conference_id + AND + ce.conference_event = 'conference expired') + AS start, + (SELECT ce.time + FROM conference_events ce + WHERE + ce.conference_id = c.conference_id + AND + ce.conference_event = 'conference created') + AS end, + c.conference_id, + c.conference_name, + (SELECT COUNT(pe.participant_id) AS participants + FROM participant_events pe + WHERE + pe.event_type = 'participant joining' + AND + pe.event_param = c.conference_id), + name_counts.name_count, + c.conference_host +FROM + conferences c +JOIN ( + SELECT + conference_name, + COUNT(*) AS name_count + FROM + conferences + GROUP BY + conference_name +) AS name_counts ON c.conference_name = name_counts.conference_name +JOIN + conference_events ce ON c.conference_id = ce.conference_id +WHERE (ce.time >= '%s 00:00:00' AND ce.time <= '%s 23:59:59') +ORDER BY + c.id;", + + + // search for a conference by its ID for a time period (if given) + 'conference_by_id' => " +SELECT + pe.time, + c.conference_id, + c.conference_name, + c.conference_host, + pe.loglevel, + pe.event_type, + p.endpoint_id AS participant_id, + pe.event_param +FROM + conferences c +LEFT JOIN + conference_events ce ON c.conference_id = ce.conference_id +LEFT JOIN + participants p ON c.conference_id = p.conference_id +LEFT JOIN + participant_events pe ON p.endpoint_id = pe.participant_id +WHERE + c.conference_id = '%s' +AND (pe.time >= '%s 00:00:00' AND pe.time <= '%s 23:59:59') + +UNION + +SELECT + ce.time AS event_time, + c.conference_id, + c.conference_name, + c.conference_host, + ce.loglevel, + ce.conference_event AS event_type, + NULL AS participant_id, + ce.conference_param AS event_param +FROM + conferences c +LEFT JOIN + conference_events ce ON c.conference_id = ce.conference_id +WHERE + c.conference_id = '%s' +AND (event_time >= '%s 00:00:00' AND event_time <= '%s 23:59:59') + +ORDER BY + pe.time;" + + +]; + +?> diff --git a/public_html/index.php b/public_html/index.php index 9c5c549..b04a1a6 100644 --- a/public_html/index.php +++ b/public_html/index.php @@ -20,6 +20,7 @@ $allowed_urls = [ 'register', 'profile', 'config', + 'conferences', ]; // cnfig file diff --git a/public_html/pages/conferences.php b/public_html/pages/conferences.php new file mode 100644 index 0000000..7ea0790 --- /dev/null +++ b/public_html/pages/conferences.php @@ -0,0 +1,43 @@ +conferences_all_formatted(); + + if ($search->rowCount() > 0) { + $conferences = array(); + $conferences['records'] = array(); + + while ($row = $search->fetch(PDO::FETCH_ASSOC)) { + extract($row); + $conference_record = array( + 'jitsi_component' => $jitsi_component, + 'start' => $start, + 'end' => $end, + 'conference_id' => $conference_id, + 'conference_name' => $conference_name, + 'participants' => $participants, + 'name_count' => $name_count, + 'conference_host' => $conference_host + ); + array_push($conferences['records'], $conference_record); + } + + // FIXME format this better + echo json_encode($conferences); + + } else { + echo 'No matching conferences found'; + } + +} catch (Exception $e) { + $error = $e->getMessage(); +} + +?> diff --git a/public_html/pages/config.php b/public_html/pages/config.php index 7ccbe49..418fbc1 100644 --- a/public_html/pages/config.php +++ b/public_html/pages/config.php @@ -1 +1,13 @@ + +
+ +

Jilo web configuration

+ + + +
diff --git a/public_html/pages/profile.php b/public_html/pages/profile.php index 5a5e5f5..1481fdc 100644 --- a/public_html/pages/profile.php +++ b/public_html/pages/profile.php @@ -1,3 +1,11 @@ -profile of \ No newline at end of file +
+ +

Profile of

+ + + +
diff --git a/public_html/templates/menu.php b/public_html/templates/menu.php index 65d8428..f1cad74 100644 --- a/public_html/templates/menu.php +++ b/public_html/templates/menu.php @@ -4,6 +4,7 @@
  • home
  • config
  • +
  • conferences