jilo-web/app/templates/widget.php

83 lines
5.3 KiB
PHP
Raw Normal View History

2024-07-26 08:55:58 +00:00
2024-08-07 08:13:55 +00:00
<div class="row">
2024-07-28 10:35:09 +00:00
<?php if ($widget['collapsible'] === true) { ?>
2024-08-07 08:13:55 +00:00
<a style="text-decoration: none;" data-toggle="collapse" href="#collapse<?= $widget['name'] ?>" role="button" aria-expanded="true" aria-controls="collapse<?= $widget['name'] ?>">
<div class="card w-auto bg-light card-body" style="flex-direction: row;"><?= $widget['title'] ?></div>
2024-07-29 13:10:35 +00:00
<?php } else { ?>
2024-08-07 08:13:55 +00:00
<div class="card w-auto bg-light border-light card-body" style="flex-direction: row;"><?= $widget['title'] ?></div>
2024-07-28 10:35:09 +00:00
<?php } ?>
<?php if ($widget['filter'] === true) {
2024-09-06 16:34:03 +00:00
include '../app/templates/block-results-filter.php'; } ?>
2024-07-28 10:35:09 +00:00
<?php if ($widget['collapsible'] === true) { ?>
2024-08-07 08:13:55 +00:00
</a>
2024-07-28 10:35:09 +00:00
<?php } ?>
2024-08-07 08:13:55 +00:00
</div>
2024-07-28 10:35:09 +00:00
2024-08-07 08:13:55 +00:00
<!-- widget "<?= $widget['name']; ?>" -->
<div class="collapse show" id="collapse<?= $widget['name'] ?>">
2024-07-27 09:36:49 +00:00
<?php if ($time_range_specified) { ?>
2024-08-07 08:13:55 +00:00
<p class="m-3">time period: <strong><?= $from_time ?> - <?= $until_time ?></strong></p>
2024-07-27 09:36:49 +00:00
<?php } ?>
2024-08-07 08:13:55 +00:00
<div class="mb-5">
2024-07-28 10:35:09 +00:00
<?php if ($widget['full'] === true) { ?>
2024-08-07 08:13:55 +00:00
<table class="table table-striped table-hover table-bordered">
<thead class="thead-dark">
<tr>
2024-07-27 09:29:28 +00:00
<?php foreach ($widget['table_headers'] as $header) { ?>
2024-10-04 08:36:45 +00:00
<th scope="col"><?= $header ?></th>
2024-07-27 09:29:28 +00:00
<?php } ?>
2024-08-07 08:13:55 +00:00
</tr>
</thead>
<tbody>
2024-07-27 09:29:28 +00:00
<?php foreach ($widget['table_records'] as $row) { ?>
2024-08-07 08:13:55 +00:00
<tr>
2024-07-29 12:56:08 +00:00
<?php $stats_id = false;
$participant_ip = false;
if (isset($row['event']) && $row['event'] === 'stats_id') $stats_id = true;
if (isset($row['event']) && $row['event'] === 'pair selected') $participant_ip = true;
foreach ($row as $key => $column) {
if ($key === 'conference ID' && isset($conferenceId) && $conferenceId === $column) { ?>
2024-10-04 08:36:45 +00:00
<td><strong><?= $column ?? '' ?></strong></td>
2024-07-29 12:56:08 +00:00
<?php } elseif ($key === 'conference ID') { ?>
2024-10-04 08:36:45 +00:00
<td><a href="<?= $app_root ?>?platform=<?= $platform_id?>&page=conferences&id=<?= htmlspecialchars($column ?? '') ?>"><?= $column ?? '' ?></a></td>
2024-07-29 12:56:08 +00:00
<?php } elseif ($key === 'conference name' && isset($conferenceName) && $conferenceName === $column) { ?>
2024-10-04 08:36:45 +00:00
<td><strong><?= $column ?? '' ?></strong></td>
2024-07-27 09:29:28 +00:00
<?php } elseif ($key === 'conference name') { ?>
2024-10-04 08:36:45 +00:00
<td><a href="<?= $app_root ?>?platform=<?= $platform_id?>&page=conferences&name=<?= htmlspecialchars($column ?? '') ?>"><?= $column ?? '' ?></a></td>
2024-07-29 13:38:44 +00:00
<?php } elseif ($key === 'participant ID' && isset($participantId) && $participantId === $column) { ?>
2024-10-04 08:36:45 +00:00
<td><strong><?= $column ?? '' ?></strong></td>
2024-07-29 13:38:44 +00:00
<?php } elseif ($key === 'participant ID') { ?>
2024-10-04 08:36:45 +00:00
<td><a href="<?= $app_root ?>?platform=<?= $platform_id?>&page=participants&id=<?= htmlspecialchars($column ?? '') ?>"><?= $column ?? '' ?></a></td>
2024-07-28 10:35:09 +00:00
<?php } elseif ($key === 'component ID') { ?>
2024-10-04 08:36:45 +00:00
<td><a href="<?= $app_root ?>?platform=<?= $platform_id?>&page=components&id=<?= htmlspecialchars($column ?? '') ?>"><?= $column ?? '' ?></a></td>
2024-07-29 13:38:44 +00:00
<?php } elseif ($stats_id && $key === 'parameter' && isset($participantName) && $participantName === $column) { ?>
2024-10-04 08:36:45 +00:00
<td><strong><?= $column ?? '' ?></strong></td>
2024-07-29 12:56:08 +00:00
<?php } elseif ($stats_id && $key === 'parameter') { ?>
2024-10-04 08:36:45 +00:00
<td><a href="<?= $app_root ?>?platform=<?= $platform_id?>&page=participants&name=<?= htmlspecialchars($column ?? '') ?>"><?= $column ?? '' ?></a></td>
2024-07-29 13:38:44 +00:00
<?php } elseif ($participant_ip && $key === 'parameter' && isset($participantIp) && $participantIp === $column) { ?>
2024-10-04 08:36:45 +00:00
<td><strong><?= $column ?? '' ?></strong></td>
2024-07-29 12:56:08 +00:00
<?php } elseif ($participant_ip && $key === 'parameter') { ?>
2024-10-04 08:36:45 +00:00
<td><a href="<?= $app_root ?>?platform=<?= $platform_id?>&page=participants&ip=<?= htmlspecialchars($column ?? '') ?>"><?= $column ?? '' ?></a></td>
2024-07-28 10:35:09 +00:00
<?php } elseif ($key === 'component') { ?>
2024-10-04 08:36:45 +00:00
<td><a href="<?= $app_root ?>?platform=<?= $platform_id?>&page=components&name=<?= htmlspecialchars($column ?? '') ?>"><?= $column ?? '' ?></a></td>
2024-07-27 09:29:28 +00:00
<?php } else { ?>
2024-10-04 08:36:45 +00:00
<td><?= $column ?? '' ?></td>
2024-07-27 09:29:28 +00:00
<?php }
} ?>
2024-08-07 08:13:55 +00:00
</tr>
2024-07-27 09:29:28 +00:00
<?php } ?>
2024-08-07 08:13:55 +00:00
</tbody>
</table>
2024-09-15 18:42:47 +00:00
<?php
if ($widget['pagination'] && $item_count > $items_per_page) {
$url = "$app_root?platform=$platform_id&page=$page";
include '../app/helpers/pagination.php';
}
?>
2024-07-27 09:29:28 +00:00
<?php } else { ?>
2024-08-07 08:13:55 +00:00
<p class="m-3">No matching records found.</p>
2024-07-27 09:29:28 +00:00
<?php } ?>
2024-08-07 08:13:55 +00:00
</div>
</div>
<!-- /widget "<?= $widget['name']; ?>" -->