mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-11 17:44:27 +02:00
Split admin/users into 6 separate modules
- They now feature working pagination
This commit is contained in:
parent
213716d44c
commit
388c0b69d6
31 changed files with 2312 additions and 1002 deletions
101
src/Module/Admin/Users/Deleted.php
Normal file
101
src/Module/Admin/Users/Deleted.php
Normal file
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2020, Friendica
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Module\Admin\Users;
|
||||
|
||||
use Friendica\Content\Pager;
|
||||
use Friendica\Core\Renderer;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Register;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\Admin\BaseUsers;
|
||||
use Friendica\Module\BaseAdmin;
|
||||
use Friendica\Util\Temporal;
|
||||
|
||||
class Deleted extends BaseUsers
|
||||
{
|
||||
public static function post(array $parameters = [])
|
||||
{
|
||||
self::checkAdminAccess();
|
||||
|
||||
self::checkFormSecurityTokenRedirectOnError('/admin/users/deleted', 'admin_users_deleted');
|
||||
|
||||
// @TODO: Implement user deletion cancellation
|
||||
|
||||
DI::baseUrl()->redirect('admin/users/deleted');
|
||||
}
|
||||
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
parent::content($parameters);
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), 100);
|
||||
|
||||
$valid_orders = [
|
||||
'name',
|
||||
'email',
|
||||
'register_date',
|
||||
'login_date',
|
||||
'last-item',
|
||||
'page-flags'
|
||||
];
|
||||
|
||||
$order = 'name';
|
||||
$order_direction = '+';
|
||||
if (!empty($_GET['o'])) {
|
||||
$new_order = $_GET['o'];
|
||||
if ($new_order[0] === '-') {
|
||||
$order_direction = '-';
|
||||
$new_order = substr($new_order, 1);
|
||||
}
|
||||
|
||||
if (in_array($new_order, $valid_orders)) {
|
||||
$order = $new_order;
|
||||
}
|
||||
}
|
||||
|
||||
$users = User::getList($pager->getStart(), $pager->getItemsPerPage(), 'removed', $order, ($order_direction == '-'));
|
||||
|
||||
$users = array_map(self::setupUserCallback(), $users);
|
||||
|
||||
$count = DBA::count('user', ['account_removed' => true]);
|
||||
|
||||
$t = Renderer::getMarkupTemplate('admin/users/deleted.tpl');
|
||||
return self::getTabsHTML('deleted') . Renderer::replaceMacros($t, [
|
||||
// strings //
|
||||
'$title' => DI::l10n()->t('Administration'),
|
||||
'$page' => DI::l10n()->t('Users awaiting permanent deletion'),
|
||||
|
||||
'$th_deleted' => [DI::l10n()->t('Name'), DI::l10n()->t('Email'), DI::l10n()->t('Register date'), DI::l10n()->t('Last login'), DI::l10n()->t('Last public item'), DI::l10n()->t('Permanent deletion')],
|
||||
|
||||
'$form_security_token' => self::getFormSecurityToken('admin_users_deleted'),
|
||||
|
||||
// values //
|
||||
'$baseurl' => DI::baseUrl()->get(true),
|
||||
'$query_string' => DI::args()->getQueryString(),
|
||||
|
||||
'$users' => $users,
|
||||
'$count' => $count,
|
||||
'$pager' => $pager->renderFull($count),
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue