Skip to content

Commit a266b06

Browse files
committed
sort admin pages
1 parent c25553a commit a266b06

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

webroot/admin/pi-mgmt.php

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -115,26 +115,30 @@
115115
<?php
116116
$accounts = $LDAP->getAllPIGroups($SQL, $MAILER);
117117

118-
foreach ($accounts as $pi_group) {
119-
$pi_user = $pi_group->getOwner();
120-
121-
echo "<tr class='expandable'>";
122-
echo "<td><button class='btnExpand'>&#9654;</button>" . $pi_user->getFirstname() .
123-
" " . $pi_user->getLastname() . "</td>";
124-
echo "<td>" . $pi_group->getPIUID() . "</td>";
125-
echo "<td><a href='mailto:" . $pi_user->getMail() . "'>" . $pi_user->getMail() . "</a></td>";
126-
echo "<td>";
127-
echo
128-
"<form action='' method='POST'
118+
usort($accounts, function ($a, $b) {
119+
return strcmp($a->getPIUID(), $b->getPIUID());
120+
});
121+
122+
foreach ($accounts as $pi_group) {
123+
$pi_user = $pi_group->getOwner();
124+
125+
echo "<tr class='expandable'>";
126+
echo "<td><button class='btnExpand'>&#9654;</button>" . $pi_user->getFirstname() .
127+
" " . $pi_user->getLastname() . "</td>";
128+
echo "<td>" . $pi_group->getPIUID() . "</td>";
129+
echo "<td><a href='mailto:" . $pi_user->getMail() . "'>" . $pi_user->getMail() . "</a></td>";
130+
echo "<td>";
131+
echo
132+
"<form action='' method='POST'
129133
onsubmit='return confirm(\"Are you sure you want to remove " . $pi_group->getPIUID() . "?\")'>
130134
<input type='hidden' name='form_name' value='remGroup'>
131135
<input type='hidden' name='pi' value='" . $pi_group->getPIUID() . "'>
132136
<input type='submit' value='Remove'>
133137
</form>";
134-
echo "</td>";
135-
echo "</tr>";
136-
}
137-
?>
138+
echo "</td>";
139+
echo "</tr>";
140+
}
141+
?>
138142
</table>
139143

140144
<script>

webroot/admin/user-mgmt.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
<?php
3939
$users = $LDAP->getAllUsers($SQL, $MAILER);
4040

41+
usort($users, function ($a, $b) {
42+
return strcmp($a->getUID(), $b->getUID());
43+
});
44+
4145
foreach ($users as $user) {
4246
echo "<tr>";
4347
echo "<td>" . $user->getFirstname() . " " . $user->getLastname() . "</td>";

0 commit comments

Comments
 (0)