| 
									
										
										
										
											2024-07-08 09:17:35 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-12 11:12:24 +00:00
										 |  |  | require_once '../app/classes/database.php'; | 
					
						
							|  |  |  | require '../app/classes/component.php'; | 
					
						
							| 
									
										
										
										
											2024-07-08 09:17:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-10 18:42:44 +00:00
										 |  |  | // connect to database
 | 
					
						
							| 
									
										
										
										
											2024-08-12 11:12:24 +00:00
										 |  |  | require '../app/helpers/database.php'; | 
					
						
							| 
									
										
										
										
											2024-08-17 08:20:08 +00:00
										 |  |  | $db = connectDB($config, 'jilo', $platform_id); | 
					
						
							| 
									
										
										
										
											2024-08-10 18:42:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-11 10:13:59 +00:00
										 |  |  | // specify time range
 | 
					
						
							| 
									
										
										
										
											2024-08-12 11:12:24 +00:00
										 |  |  | include '../app/helpers/time_range.php'; | 
					
						
							| 
									
										
										
										
											2024-07-08 09:17:35 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | // jitsi component events list
 | 
					
						
							|  |  |  | // we use $_REQUEST, so that both links and forms work
 | 
					
						
							|  |  |  | if (isset($_REQUEST['name']) && $_REQUEST['name'] != '') { | 
					
						
							|  |  |  |     $jitsi_component = "'" . $_REQUEST['name'] . "'"; | 
					
						
							|  |  |  |     $component_id = 'component_id'; | 
					
						
							|  |  |  | } elseif (isset($_REQUEST['id']) && $_REQUEST['id'] != '') { | 
					
						
							|  |  |  |     $component_id = "'" . $_REQUEST['id'] . "'"; | 
					
						
							|  |  |  |     $jitsi_component = 'jitsi_component'; | 
					
						
							|  |  |  | } else { | 
					
						
							|  |  |  |     // we need the variables to use them later in sql for columnname = columnname
 | 
					
						
							|  |  |  |     $jitsi_component = 'jitsi_component'; | 
					
						
							|  |  |  |     $component_id = 'component_id'; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // Component events listings
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // list of all component events (default)
 | 
					
						
							| 
									
										
										
										
											2024-07-28 10:35:09 +00:00
										 |  |  | $component = new Component($db); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // prepare the result
 | 
					
						
							|  |  |  | $search = $component->jitsiComponents($jitsi_component, $component_id, $from_time, $until_time); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if (!empty($search)) { | 
					
						
							|  |  |  |     $components = array(); | 
					
						
							|  |  |  |     $components['records'] = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     foreach ($search as $item) { | 
					
						
							|  |  |  |         extract($item); | 
					
						
							|  |  |  |         $component_record = array( | 
					
						
							|  |  |  |             // assign title to the field in the array record
 | 
					
						
							|  |  |  |             'component'		=> $jitsi_component, | 
					
						
							|  |  |  |             'loglevel'		=> $loglevel, | 
					
						
							|  |  |  |             'time'		=> $time, | 
					
						
							|  |  |  |             'component ID'	=> $component_id, | 
					
						
							|  |  |  |             'event'		=> $event_type, | 
					
						
							|  |  |  |             'param'		=> $event_param, | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |         // populate the result array
 | 
					
						
							|  |  |  |         array_push($components['records'], $component_record); | 
					
						
							| 
									
										
										
										
											2024-07-08 09:17:35 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-07-28 10:35:09 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2024-07-08 09:17:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-28 10:35:09 +00:00
										 |  |  | // prepare the widget
 | 
					
						
							|  |  |  | $widget['full'] = false; | 
					
						
							|  |  |  | $widget['name'] = 'AllComponents'; | 
					
						
							|  |  |  | $widget['collapsible'] = false; | 
					
						
							|  |  |  | $widget['collapsed'] = false; | 
					
						
							|  |  |  | $widget['filter'] = true; | 
					
						
							| 
									
										
										
										
											2024-07-08 09:17:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-28 10:35:09 +00:00
										 |  |  | // widget title
 | 
					
						
							|  |  |  | if (isset($_REQUEST['name']) && $_REQUEST['name'] != '') { | 
					
						
							| 
									
										
										
										
											2024-07-29 13:10:35 +00:00
										 |  |  |     $widget['title'] = 'Jitsi events for component <strong>' . $_REQUEST['name'] . '</strong>'; | 
					
						
							| 
									
										
										
										
											2024-07-28 10:35:09 +00:00
										 |  |  | } elseif (isset($_REQUEST['id']) && $_REQUEST['id'] != '') { | 
					
						
							| 
									
										
										
										
											2024-07-29 13:10:35 +00:00
										 |  |  |     $widget['title'] = 'Jitsi events for component ID <strong>' . $_REQUEST['id'] . '</strong>'; | 
					
						
							| 
									
										
										
										
											2024-07-28 10:35:09 +00:00
										 |  |  | } else { | 
					
						
							| 
									
										
										
										
											2024-07-29 13:10:35 +00:00
										 |  |  |     $widget['title'] = 'Jitsi events for <strong>all components</strong>'; | 
					
						
							| 
									
										
										
										
											2024-07-28 10:35:09 +00:00
										 |  |  | } | 
					
						
							|  |  |  | // widget records
 | 
					
						
							|  |  |  | if (!empty($components['records'])) { | 
					
						
							|  |  |  |     $widget['full'] = true; | 
					
						
							|  |  |  |     $widget['table_headers'] = array_keys($components['records'][0]); | 
					
						
							|  |  |  |     $widget['table_records'] = $components['records']; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2024-07-08 09:17:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-28 10:35:09 +00:00
										 |  |  | // display the widget
 | 
					
						
							| 
									
										
										
										
											2024-08-12 11:12:24 +00:00
										 |  |  | include('../app/templates/widget.php'); | 
					
						
							| 
									
										
										
										
											2024-07-08 09:17:35 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | ?>
 |