You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sessioncommunities.online/sites/+components/tbl_communities.php

79 lines
2.4 KiB
PHTML

<?php
require_once "$PROJECT_ROOT/php/utils/utils.php";
require_once "$PROJECT_ROOT/php/utils/servers-rooms.php";
/**
* @var CommunityRoom[] $rooms
*/
// Once handlers are attached in JS, this check ceases to be useful.
function column_sortable($id) {
return $id != "qr";
}
function sort_onclick($colno) {
global $TABLE_COLUMNS;
$column = $TABLE_COLUMNS[$colno];
if (!column_sortable($column['id'])) return "";
return " onclick='sortTable($colno)'";
}
$TABLE_COLUMNS = [
['id' => "identifier", 'name' => "Identifier"],
['id' => "language", 'name' => "L"],
['id' => "name", 'name' => "Name"],
['id' => "description", 'name' => "Description"],
['id' => "users", 'name' => "Users"],
['id' => "preview", 'name' => "Preview"],
['id' => "qr", 'name' => "QR"],
['id' => "join_url", 'name' => "Join URL"],
];
?>
<table id="tbl_communities">
<tr>
<?php foreach ($TABLE_COLUMNS as $colno => $column): ?>
<th<?=sort_onclick($colno)?> id="th_<?=$column['id']?>">
<?=$column['name']?>
</th>
<?php endforeach; ?>
</tr>
<?php foreach ($rooms as $room): ?>
<tr id="<?=$room->get_room_identifier()?>">
<td class="td_identifier"><?=$room->get_room_identifier()?></td>
<td class="td_language"><?=$room->language_flag?></td>
<td class="td_name"><?=$room->name?></td>
<td class="td_description"
><?=$room->description?></td>
<td class="td_users"><?=$room->active_users?></td>
<td class="td_preview">
<a href="<?=$room->get_preview_url()?>" target="_blank" rel="noopener noreferrer">
<?php if (str_starts_with($room->get_preview_url(), 'http://')): ?>
<span class="protocol-indicator protocol-http">HTTP</span>
<?php endif; ?>
<?php if (str_starts_with($room->get_preview_url(), 'https://')): ?>
<span class="protocol-indicator protocol-https">HTTPS</span>
<?php endif; ?>
</a>
</td>
<td class="td_qr_code">
<img
class="qr-code-icon"
src="qrcode-solid.svg"
onclick='displayQRModal("<?=$room->get_room_identifier()?>")'
alt="Pictogram of a QR code"
>
</td>
<td class="td_join_url">
<div class="join_url_container" data-url="<?=$room->get_join_url()?>">
<a class="join_url show-from-w5" title="<?=$room->get_join_url()?>"
><?=truncate($room->get_join_url(), 32)?></a>
<a class="noscript" href="<?=$room->get_join_url()?>"
>Copy link</a>
</div>
</td>
</tr>
<?php endforeach; ?>
</table>