1<?php
2/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
3/**
4 *
5 * LICENSE: GNU Affero General Public License, version 3 (AGPL-3.0-or-later)
6 * Copyright 2001 - 2020 Ampache.org
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 *
21 */
22
23use Ampache\Config\AmpConfig;
24use Ampache\Repository\Model\User;
25use Ampache\Module\Authorization\Access;
26use Ampache\Module\Api\Ajax;
27use Ampache\Module\User\Following\UserFollowStateRendererInterface;
28use Ampache\Module\Util\Ui;
29
30$web_path = AmpConfig::get('web_path'); ?>
31<?php if ($browse->is_show_header()) {
32    require Ui::find_template('list_header.inc.php');
33} ?>
34<table class="tabledata striped-rows <?php echo $browse->get_css_class() ?>" data-objecttype="user">
35<colgroup>
36  <col id="col_username" />
37  <col id="col_lastseen" />
38  <col id="col_registrationdate" />
39<?php if (Access::check('interface', 50)) { ?>
40  <col id="col_activity" />
41<?php if (AmpConfig::get('track_user_ip')) { ?>
42  <col id="col_lastip" />
43<?php
44    } ?>
45<?php
46} ?>
47  <col id="col_action" />
48  <col id="col_online" />
49</colgroup>
50<thead>
51    <tr class="th-top">
52      <th class="cel_username essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=username', T_('Username'), 'users_sort_username1');?><?php echo " ( " . Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=fullname', T_('Full Name'), 'users_sort_fullname1') . ")";?></th>
53      <th class="cel_lastseen"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=last_seen', T_('Last Seen'), 'users_sort_lastseen'); ?></th>
54      <th class="cel_registrationdate"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=create_date', T_('Registration Date'), 'users_sort_createdate'); ?></th>
55      <?php if (Access::check('interface', 50)) { ?>
56      <th class="cel_activity"><?php echo T_('Activity'); ?></th>
57      <?php if (AmpConfig::get('track_user_ip')) { ?>
58      <th class="cel_lastip"><?php echo T_('Last IP'); ?></th>
59      <?php
60        } ?>
61      <?php
62    } ?>
63      <?php if (Access::check('interface', 25) && AmpConfig::get('sociable')) { ?>
64      <th class="cel_follow essential"><?php echo T_('Following'); ?></th>
65      <?php
66    } ?>
67      <th class="cel_action essential"><?php echo T_('Action'); ?></th>
68      <th class="cel_online"><?php echo T_('Online'); ?></th>
69    </tr>
70</thead>
71<tbody>
72<?php
73
74global $dic;
75$userFollowStateRenderer = $dic->get(UserFollowStateRendererInterface::class);
76
77foreach ($object_ids as $user_id) {
78    $libitem = new User($user_id);
79    $libitem->format();
80    $last_seen      = $libitem->last_seen ? get_datetime($libitem->last_seen) : T_('Never');
81    $create_date    = $libitem->create_date ? get_datetime($libitem->create_date) : T_('Unknown'); ?>
82<tr id="admin_user_<?php echo $libitem->id; ?>">
83    <?php require Ui::find_template('show_user_row.inc.php'); ?>
84</tr>
85<?php
86} //end foreach users?>
87</tbody>
88<tfoot>
89    <tr class="th-bottom">
90      <th class="cel_username"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=username', T_('Username'), 'users_sort_username1');?><?php echo " ( " . Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=fullname', T_('Full Name'), 'users_sort_fullname1') . ")";?></th>
91      <th class="cel_lastseen"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=last_seen', T_('Last Seen'), 'users_sort_lastseen1'); ?></th>
92      <th class="cel_registrationdate"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=user&sort=create_date', T_('Registration Date'), 'users_sort_createdate1'); ?></th>
93      <?php if (Access::check('interface', 50)) { ?>
94      <th class="cel_activity"><?php echo T_('Activity'); ?></th>
95      <?php if (AmpConfig::get('track_user_ip')) { ?>
96      <th class="cel_lastip"><?php echo T_('Last IP'); ?></th>
97      <?php
98        } ?>
99      <?php
100    } ?>
101      <?php if (Access::check('interface', 25) && AmpConfig::get('sociable')) { ?>
102      <th class="cel_follow"><?php echo T_('Following'); ?></th>
103      <?php
104    } ?>
105      <th class="cel_action"><?php echo T_('Action'); ?></th>
106      <th class="cel_online"><?php echo T_('Online'); ?></th>
107    </tr>
108</tfoot>
109</table>
110<?php if ($browse->is_show_header()) {
111        require Ui::find_template('list_header.inc.php');
112    } ?>
113