]>
Commit | Line | Data |
---|---|---|
90dc8f2b | 1 | <?php |
c06c1713 BM |
2 | require_once "../inc/common.php"; |
3 | require_once "../inc/connection.php"; | |
4 | require_once "../inc/header.php"; | |
90dc8f2b VP |
5 | |
6 | if (!empty($_POST)) | |
7 | { | |
8 | do_log($_POST); | |
9 | ||
10 | /* Nothing being posted yet */ | |
11 | ||
12 | } | |
13 | ||
14 | $channels = $rpc->channel()->getAll(); | |
15 | ||
16 | ?> | |
0d846731 | 17 | <h4>Channels Overview</h4><br> |
f41baac8 | 18 | <table class="container-xxl table table-sm table-responsive caption-top table-striped"> |
d1d9caa9 | 19 | <thead class="table-primary"> |
90dc8f2b | 20 | <th>Name</th> |
f2a87326 | 21 | <th>Users</th> |
638559e7 BM |
22 | <th class="modescol">Modes</th> |
23 | <th class="topiccol">Topic</th> | |
24 | <th class="createdcol">Created</th> | |
def32bb1 BM |
25 | </thead> |
26 | <tbody> | |
90dc8f2b | 27 | <?php |
5a054690 M |
28 | $columns = array_column($channels, 'num_users'); |
29 | array_multisort($columns, SORT_DESC, $channels); | |
30 | ||
90dc8f2b VP |
31 | foreach($channels as $channel) |
32 | { | |
33 | echo "<tr>"; | |
d9a581b9 | 34 | echo "<td><a href=\"details.php?chan=".urlencode(htmlspecialchars($channel->name))."\">".htmlspecialchars($channel->name)."</a></td>"; |
973aa0cb VP |
35 | $s = ($channel->num_users) ? "success" : "danger"; |
36 | echo "<td><span class=\"badge rounded-pill badge-$s\">".$channel->num_users."</span></td>"; | |
cf1f19ea BM |
37 | $modes = (isset($channel->modes)) ? "+" . explode(" ",$channel->modes)[0] : "<none>"; |
38 | echo "<td class=\"modescol\">". | |
39 | "<span data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"+".htmlspecialchars($channel->modes)."\">". | |
40 | htmlspecialchars($modes)."</span></td>"; | |
11b7f7e4 | 41 | $topic = (isset($channel->topic)) ? htmlspecialchars($channel->topic) : ""; |
638559e7 BM |
42 | echo "<td class=\"topiccol\" style=\"overflow:hidden;\">".$topic."</td>"; |
43 | $date = explode("T", $channel->creation_time)[0]; | |
6e68abfa | 44 | echo "<td class=\"createdcol\" style=\"white-space:nowrap\">". |
638559e7 | 45 | "<span data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"".$channel->creation_time."\">". |
cf1f19ea | 46 | "$date</span></td>"; |
f41baac8 | 47 | echo "</tr>"; |
90dc8f2b | 48 | } |
809f7483 | 49 | |
c06c1713 | 50 | require_once("../inc/footer.php"); |
def32bb1 BM |
51 | ?> |
52 | </tbody> | |
53 | </table> | |
638559e7 BM |
54 | <script> |
55 | function resize_check() | |
56 | { | |
57 | var width = window.innerWidth; | |
58 | var show_elements = ''; | |
59 | var hide_elements = ''; | |
60 | if (width < 500) | |
61 | { | |
62 | show_elements = '.createdcol'; | |
63 | hide_elements = '.modescol, .topiccol'; | |
64 | } else | |
65 | if (width < 800) | |
66 | { | |
67 | show_elements = '.createdcol, .topiccol'; | |
68 | hide_elements = '.modescol'; | |
69 | } else | |
70 | { | |
450b842f | 71 | show_elements = '.createdcol, .modescol, .topiccol'; |
638559e7 BM |
72 | hide_elements = ''; |
73 | } | |
74 | ||
75 | if (show_elements != '') | |
76 | { | |
77 | show_elements=document.querySelectorAll(show_elements); | |
78 | for (let i = 0; i < show_elements.length; i++) | |
79 | show_elements[i].style.display = ''; | |
80 | } | |
81 | ||
82 | if (hide_elements != '') | |
83 | { | |
84 | hide_elements=document.querySelectorAll(hide_elements); | |
85 | for (let i = 0; i < hide_elements.length; i++) | |
86 | hide_elements[i].style.display = 'none'; | |
87 | } | |
88 | } | |
89 | resize_check(); | |
90 | window.addEventListener('resize', function() { | |
91 | resize_check(); | |
92 | }); | |
93 | </script> |