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);
    }
    if (!empty($search)) {
        // we get total items and number of pages
        $item_count = count($search_all);
        $totalPages = ceil($item_count / $items_per_page);
        $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);
        }
    }
    // filter message
    $filterMessage = array();
    if (isset($_REQUEST['name']) && $_REQUEST['name'] != '') {
        array_push($filterMessage, 'Conferences with participant name (stats_id) matching "' . $_REQUEST['name'] . '"');
    } elseif (isset($_REQUEST['id']) && $_REQUEST['id'] != '') {
        array_push($filterMessage, 'Conferences with participant ID matching "' . $_REQUEST['id'] . '"');
    } elseif (isset($participantIp)) {
        array_push($filterMessage, 'Conferences with participant IP matching "' . $participantIp . '"');
    }
    // Get any new feedback messages
    include '../app/helpers/feedback.php';
    // display the widget
    include '../app/templates/participants.php';
}
?>