| 
									
										
										
										
											2024-07-07 09:10:41 +00:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-28 14:46:13 +00:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Participants information | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2024-11-29 16:07:47 +00:00
										 |  |  |  * This page ("participants") retrieves and displays participant information for conferences. | 
					
						
							|  |  |  |  * Allows filtering by participant ID, name, or IP address, and listing within a specified time range. | 
					
						
							|  |  |  |  * Supports pagination. | 
					
						
							| 
									
										
										
										
											2024-11-28 14:46:13 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-13 08:45:31 +00:00
										 |  |  | // Get any new messages
 | 
					
						
							|  |  |  | include '../app/includes/messages.php'; | 
					
						
							|  |  |  | include '../app/includes/messages-show.php'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-12 11:12:24 +00:00
										 |  |  | require '../app/classes/participant.php'; | 
					
						
							| 
									
										
										
										
											2024-07-07 09:10:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-10 18:42:44 +00:00
										 |  |  | // connect to database
 | 
					
						
							| 
									
										
										
										
											2024-11-13 10:56:24 +00:00
										 |  |  | $response = connectDB($config, 'jilo', $platformDetails[0]['jilo_database'], $platform_id); | 
					
						
							| 
									
										
										
										
											2024-11-16 11:08:56 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | // if DB connection has error, display it and stop here
 | 
					
						
							| 
									
										
										
										
											2024-11-13 10:56:24 +00:00
										 |  |  | if ($response['db'] === null) { | 
					
						
							| 
									
										
										
										
											2025-01-15 16:52:15 +00:00
										 |  |  |     Messages::flash('ERROR', 'DEFAULT', $response['error']); | 
					
						
							| 
									
										
										
										
											2024-11-16 11:08:56 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | // otherwise if DB connection is OK, go on
 | 
					
						
							| 
									
										
										
										
											2024-11-13 10:56:24 +00:00
										 |  |  | } else { | 
					
						
							|  |  |  |     $db = $response['db']; | 
					
						
							| 
									
										
										
										
											2024-08-10 18:42:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-29 13:47:10 +00:00
										 |  |  |     // Get current page for pagination
 | 
					
						
							|  |  |  |     $currentPage = $_REQUEST['page_num'] ?? 1; | 
					
						
							|  |  |  |     $currentPage = (int)$currentPage; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-16 11:08:56 +00:00
										 |  |  |     // specify time range
 | 
					
						
							|  |  |  |     include '../app/helpers/time_range.php'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-29 13:47:10 +00:00
										 |  |  |     // Build params for pagination
 | 
					
						
							|  |  |  |     $params = ''; | 
					
						
							|  |  |  |     if (!empty($_REQUEST['from_time'])) { | 
					
						
							|  |  |  |         $params .= '&from_time=' . urlencode($_REQUEST['from_time']); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!empty($_REQUEST['until_time'])) { | 
					
						
							|  |  |  |         $params .= '&until_time=' . urlencode($_REQUEST['until_time']); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!empty($_REQUEST['name'])) { | 
					
						
							|  |  |  |         $params .= '&name=' . urlencode($_REQUEST['name']); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!empty($_REQUEST['id'])) { | 
					
						
							|  |  |  |         $params .= '&id=' . urlencode($_REQUEST['id']); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (isset($_REQUEST['event'])) { | 
					
						
							|  |  |  |         $params .= '&ip=' . urlencode($_REQUEST['ip']); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-16 11:08:56 +00:00
										 |  |  |     // participant id/name/IP are specified when searching specific participant(s)
 | 
					
						
							|  |  |  |     // participant name - this is 'stats_id' in the db
 | 
					
						
							|  |  |  |     // either id, name, OR IP - in that order
 | 
					
						
							|  |  |  |     // we use $_REQUEST, so that both links and forms work
 | 
					
						
							|  |  |  |     if (isset($_REQUEST['id']) && $_REQUEST['id'] != '') { | 
					
						
							|  |  |  |         $participantId = $_REQUEST['id']; | 
					
						
							|  |  |  |         unset($_REQUEST['name']); | 
					
						
							|  |  |  |         unset($participantName); | 
					
						
							|  |  |  |     } elseif (isset($_REQUEST['name']) && $_REQUEST['name'] != '') { | 
					
						
							|  |  |  |         unset($participantId); | 
					
						
							|  |  |  |         $participantName = $_REQUEST['name']; | 
					
						
							|  |  |  |     } elseif (isset($_REQUEST['ip']) && $_REQUEST['ip'] != '') { | 
					
						
							|  |  |  |         unset($participantId); | 
					
						
							|  |  |  |         $participantIp = $_REQUEST['ip']; | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |         unset($participantId); | 
					
						
							|  |  |  |         unset($participantName); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-07-07 09:10:41 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-16 11:08:56 +00:00
										 |  |  |     //
 | 
					
						
							|  |  |  |     // Participant listings
 | 
					
						
							|  |  |  |     //
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $participantObject = new Participant($db); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // pagination variables
 | 
					
						
							|  |  |  |     $items_per_page = 15; | 
					
						
							| 
									
										
										
										
											2025-01-29 13:47:10 +00:00
										 |  |  |     $offset = ($currentPage -1) * $items_per_page; | 
					
						
							| 
									
										
										
										
											2024-11-16 11:08:56 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // search and list specific participant ID
 | 
					
						
							|  |  |  |     if (isset($participantId)) { | 
					
						
							|  |  |  |         $search = $participantObject->conferenceByParticipantId($participantId, $from_time, $until_time, $offset, $items_per_page); | 
					
						
							|  |  |  |         $search_all = $participantObject->conferenceByParticipantId($participantId, $from_time, $until_time); | 
					
						
							|  |  |  |     // search and list specific participant name (stats_id)
 | 
					
						
							|  |  |  |     } elseif (isset($participantName)) { | 
					
						
							|  |  |  |         $search = $participantObject->conferenceByParticipantName($participantName, $from_time, $until_time, $offset, $items_per_page); | 
					
						
							|  |  |  |         $search_all = $participantObject->conferenceByParticipantName($participantName, $from_time, $until_time); | 
					
						
							|  |  |  |     // search and list specific participant IP
 | 
					
						
							|  |  |  |     } elseif (isset($participantIp)) { | 
					
						
							|  |  |  |         $search = $participantObject->conferenceByParticipantIP($participantIp, $from_time, $until_time, $offset, $items_per_page); | 
					
						
							|  |  |  |         $search_all = $participantObject->conferenceByParticipantIP($participantIp, $from_time, $until_time); | 
					
						
							|  |  |  |     // list of all participants (default)
 | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |     // prepare the result
 | 
					
						
							|  |  |  |         $search = $participantObject->participantsAll($from_time, $until_time, $offset, $items_per_page); | 
					
						
							|  |  |  |         $search_all = $participantObject->participantsAll($from_time, $until_time); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-07-07 09:10:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-16 11:08:56 +00:00
										 |  |  |     if (!empty($search)) { | 
					
						
							|  |  |  |         // we get total items and number of pages
 | 
					
						
							|  |  |  |         $item_count = count($search_all); | 
					
						
							| 
									
										
										
										
											2025-01-29 13:47:10 +00:00
										 |  |  |         $totalPages = ceil($item_count / $items_per_page); | 
					
						
							| 
									
										
										
										
											2024-11-16 11:08:56 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         $participants = array(); | 
					
						
							|  |  |  |         $participants['records'] = array(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         foreach ($search as $item) { | 
					
						
							|  |  |  |             extract($item); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // search and list specific participant ID
 | 
					
						
							|  |  |  |             if (isset($participantId)) { | 
					
						
							|  |  |  |                 $participant_record = array( | 
					
						
							|  |  |  |                     // assign title to the field in the array record
 | 
					
						
							|  |  |  |                     'time'			=> $time, | 
					
						
							|  |  |  |                     'conference ID'		=> $conference_id, | 
					
						
							|  |  |  |                     'conference name'	=> $conference_name, | 
					
						
							|  |  |  |                     'conference host'	=> $conference_host, | 
					
						
							|  |  |  |                     'loglevel'		=> $loglevel, | 
					
						
							|  |  |  |                     'participant ID'	=> $participant_id, | 
					
						
							|  |  |  |                     'event'			=> $event_type, | 
					
						
							|  |  |  |                     'parameter'		=> $event_param | 
					
						
							|  |  |  |                 ); | 
					
						
							|  |  |  |             // search and list specific participant name (stats_id)
 | 
					
						
							|  |  |  |             } elseif (isset($participantName)) { | 
					
						
							|  |  |  |                 $participant_record = array( | 
					
						
							|  |  |  |                     // assign title to the field in the array record
 | 
					
						
							|  |  |  |                     'time'			=> $time, | 
					
						
							|  |  |  |                     'conference ID'		=> $conference_id, | 
					
						
							|  |  |  |                     'conference name'	=> $conference_name, | 
					
						
							|  |  |  |                     'conference host'	=> $conference_host, | 
					
						
							|  |  |  |                     'loglevel'		=> $loglevel, | 
					
						
							|  |  |  |                     'participant ID'	=> $participant_id, | 
					
						
							|  |  |  |                     'event'			=> $event_type, | 
					
						
							|  |  |  |                     'parameter'		=> $event_param | 
					
						
							|  |  |  |                 ); | 
					
						
							|  |  |  |             // search and list specific participant IP
 | 
					
						
							|  |  |  |             } elseif (isset($participantIp)) { | 
					
						
							|  |  |  |                 $participant_record = array( | 
					
						
							|  |  |  |                     // assign title to the field in the array record
 | 
					
						
							|  |  |  |                     'time'			=> $time, | 
					
						
							|  |  |  |                     'conference ID'		=> $conference_id, | 
					
						
							|  |  |  |                     'conference name'	=> $conference_name, | 
					
						
							|  |  |  |                     'conference host'	=> $conference_host, | 
					
						
							|  |  |  |                     'loglevel'		=> $loglevel, | 
					
						
							|  |  |  |                     'participant ID'	=> $participant_id, | 
					
						
							|  |  |  |                     'event'			=> $event_type, | 
					
						
							|  |  |  |                     'parameter'		=> $event_param | 
					
						
							|  |  |  |                 ); | 
					
						
							|  |  |  |             // list of all participants (default)
 | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 $participant_record = array( | 
					
						
							|  |  |  |                     // assign title to the field in the array record
 | 
					
						
							|  |  |  |                     'component'		=> $jitsi_component, | 
					
						
							|  |  |  |                     'participant ID'	=> $endpoint_id, | 
					
						
							|  |  |  |                     'conference ID'		=> $conference_id | 
					
						
							|  |  |  |                 ); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // populate the result array
 | 
					
						
							|  |  |  |             array_push($participants['records'], $participant_record); | 
					
						
							| 
									
										
										
										
											2024-07-07 09:10:41 +00:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-11-16 11:08:56 +00:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2024-07-07 09:10:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-01-29 13:47:10 +00:00
										 |  |  |     // filter message
 | 
					
						
							|  |  |  |     $filterMessage = array(); | 
					
						
							| 
									
										
										
										
											2024-11-16 11:08:56 +00:00
										 |  |  |     if (isset($_REQUEST['name']) && $_REQUEST['name'] != '') { | 
					
						
							| 
									
										
										
										
											2025-01-29 13:47:10 +00:00
										 |  |  |         array_push($filterMessage, 'Conferences with participant name (stats_id) matching "<strong>' . $_REQUEST['name'] . '"</strong>'); | 
					
						
							| 
									
										
										
										
											2024-11-16 11:08:56 +00:00
										 |  |  |     } elseif (isset($_REQUEST['id']) && $_REQUEST['id'] != '') { | 
					
						
							| 
									
										
										
										
											2025-01-29 13:47:10 +00:00
										 |  |  |         array_push($filterMessage, 'Conferences with participant ID matching "<strong>' . $_REQUEST['id'] . '"</strong>'); | 
					
						
							| 
									
										
										
										
											2024-11-16 11:08:56 +00:00
										 |  |  |     } elseif (isset($participantIp)) { | 
					
						
							| 
									
										
										
										
											2025-01-29 13:47:10 +00:00
										 |  |  |         array_push($filterMessage, 'Conferences with participant IP matching "<strong>' . $participantIp . '"</strong>'); | 
					
						
							| 
									
										
										
										
											2024-07-07 09:10:41 +00:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-16 11:08:56 +00:00
										 |  |  |     // display the widget
 | 
					
						
							| 
									
										
										
										
											2025-01-29 13:47:10 +00:00
										 |  |  |     include '../app/templates/participants.php'; | 
					
						
							| 
									
										
										
										
											2024-07-07 09:10:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-11-16 11:08:56 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2024-07-29 13:38:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-07 09:10:41 +00:00
										 |  |  | ?>
 |