diff --git a/app/pages/conferences.php b/app/pages/conferences.php index 60fa75d..9108bc0 100644 --- a/app/pages/conferences.php +++ b/app/pages/conferences.php @@ -8,12 +8,6 @@ * Supports pagination. */ -// Get any new messages -include '../app/includes/messages.php'; -include '../app/includes/messages-show.php'; - -require '../app/classes/conference.php'; - // connect to database $response = connectDB($config, 'jilo', $platformDetails[0]['jilo_database'], $platform_id); @@ -52,13 +46,31 @@ if ($response['db'] === null) { // Conference listings // + require '../app/classes/conference.php'; $conferenceObject = new Conference($db); + // get current page for pagination + $currentPage = $_REQUEST['page_num'] ?? 1; + $currentPage = (int)$currentPage; + // pagination variables - $items_per_page = 15; - $browse_page = $_REQUEST['p'] ?? 1; - $browse_page = (int)$browse_page; - $offset = ($browse_page -1) * $items_per_page; + $items_per_page = 20; + $offset = ($currentPage -1) * $items_per_page; + + // 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']); + } // search and list specific conference ID if (isset($conferenceId)) { @@ -77,7 +89,7 @@ if ($response['db'] === null) { if (!empty($search)) { // we get total items and number of pages $item_count = count($search_all); - $page_count = ceil($item_count / $items_per_page); + $totalPages = ceil($item_count / $items_per_page); $conferences = array(); $conferences['records'] = array(); @@ -139,31 +151,20 @@ if ($response['db'] === null) { } } - // prepare the widget - $widget['full'] = false; - $widget['name'] = 'Conferences'; - $widget['collapsible'] = false; - $widget['collapsed'] = false; - $widget['filter'] = true; - $widget['pagination'] = true; - - // widget title + // filter message + $filterMessage = array(); if (isset($_REQUEST['name']) && $_REQUEST['name'] != '') { - $widget['title'] = 'Conferences with name matching "' . $_REQUEST['name'] . '"'; + array_push($filterMessage, 'Conferences with name matching "' . $_REQUEST['name'] . '"'); } elseif (isset($_REQUEST['id']) && $_REQUEST['id'] != '') { - $widget['title'] = 'Conference with ID "' . $_REQUEST['id'] . '"'; - } else { - $widget['title'] = 'All conferences'; - } - // widget records - if (!empty($conferences['records'])) { - $widget['full'] = true; - $widget['table_headers'] = array_keys($conferences['records'][0]); - $widget['table_records'] = $conferences['records']; + array_push($filterMessage, 'Conferences with ID "' . $_REQUEST['id'] . '"'); } + // Get any new messages + include '../app/includes/messages.php'; + include '../app/includes/messages-show.php'; + // display the widget - include '../app/templates/event-list-conferences.php'; + include '../app/templates/conferences.php'; } diff --git a/app/pages/participants.php b/app/pages/participants.php index f505e2c..fa89401 100644 --- a/app/pages/participants.php +++ b/app/pages/participants.php @@ -19,31 +19,9 @@ if ($response['db'] === null) { } else { $db = $response['db']; - // Get current page for pagination - $currentPage = $_REQUEST['page_num'] ?? 1; - $currentPage = (int)$currentPage; - // specify time range include '../app/helpers/time_range.php'; - // 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']); - } - // 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 @@ -71,10 +49,32 @@ if ($response['db'] === null) { require '../app/classes/participant.php'; $participantObject = new Participant($db); + // get current page for pagination + $currentPage = $_REQUEST['page_num'] ?? 1; + $currentPage = (int)$currentPage; + // pagination variables $items_per_page = 20; $offset = ($currentPage -1) * $items_per_page; + // 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']); + } + // search and list specific participant ID if (isset($participantId)) { $search = $participantObject->conferenceByParticipantId($participantId, $from_time, $until_time, $offset, $items_per_page); diff --git a/app/templates/conferences.php b/app/templates/conferences.php new file mode 100644 index 0000000..1f2c954 --- /dev/null +++ b/app/templates/conferences.php @@ -0,0 +1,131 @@ + + +
Time period: = htmlspecialchars($from_time) ?> - = htmlspecialchars($until_time) ?>
+ + += $message ?>
+ + += htmlspecialchars($header) ?> | + +||||||
---|---|---|---|---|---|---|
+ 20) ? 'data-toggle="tooltip" title="' . htmlspecialchars($column) . '"' : '' ?>> + = htmlspecialchars(strlen($column ?? '') > 20 ? substr($column, 0, 20) . '...' : $column ?? '') ?> + + | + ++ 16) ? 'data-toggle="tooltip" title="' . htmlspecialchars($column) . '"' : '' ?>> + = htmlspecialchars(strlen($column ?? '') > 16 ? substr($column, 0, 16) . '...' : $column ?? '') ?> + + | + ++ 20) ? 'data-toggle="tooltip" title="' . htmlspecialchars($column) . '"' : '' ?>> + = htmlspecialchars(strlen($column ?? '') > 20 ? substr($column, 0, 20) . '...' : $column ?? '') ?> + + | + ++ 16) ? 'data-toggle="tooltip" title="' . htmlspecialchars($column) . '"' : '' ?>> + = htmlspecialchars(strlen($column ?? '') > 16 ? substr($column, 0, 16) . '...' : $column ?? '') ?> + + | + ++ 30) ? 'data-toggle="tooltip" title="' . htmlspecialchars($column) . '"' : '' ?>> + = htmlspecialchars(strlen($column ?? '') > 30 ? substr($column, 0, 30) . '...' : $column ?? '') ?> + + | + += !empty($column) ? date('d M Y H:i:s',strtotime($column)) : 'n/a' ?> | + += htmlspecialchars($column ?? '') ?> | + +
time period: = htmlspecialchars($from_time) ?> - = htmlspecialchars($until_time) ?>
- -= htmlspecialchars($header) ?> | - -||||||||
---|---|---|---|---|---|---|---|---|
= htmlspecialchars($column ?? '') ?> | - -= htmlspecialchars($column ?? '') ?> | - -= htmlspecialchars($column ?? '') ?> | - -= htmlspecialchars($column ?? '') ?> | - -= htmlspecialchars($column ?? '') ?> | - -= htmlspecialchars($column ?? '') ?> | - -= htmlspecialchars($column ?? '') ?> | - -= htmlspecialchars(substr($column ?? '', 0, -7)) ?> | - -= htmlspecialchars($column ?? '') ?> | - -
No matching records found.
- -