2018-04-22

This commit is contained in:
Visman 2018-04-22 23:11:28 +07:00
parent 45029b445a
commit bc04fc1640
3 changed files with 97 additions and 2 deletions

View file

@ -98,8 +98,16 @@ class Users extends Admin
return $this->c->Message->message('Bad request'); return $this->c->Message->message('Bad request');
} }
$startNum = ($page - 1) * $this->c->config->o_disp_users;
$ids = \array_slice($ids, $this->startNum, $this->c->config->o_disp_users);
$userList = $this->c->users->load($ids);
exit(var_dump($ids, $order, $filters)); $this->nameTpl = 'admin/users_result';
$this->aIndex = 'users';
$this->titles = \ForkBB\__('Users');
$this->formResult = $this->formUsers($userList, $startNum);
return $this;
} }
/** /**
@ -469,4 +477,82 @@ class Users extends Admin
return $form; return $form;
} }
/**
* Создает массив данных для формы найденных по фильтру пользователей
*
* @param array $users
* @param int $number
*
* @return array
*/
protected function formUsers(array $users, $number)
{
$form = [
'action' => $this->c->Router->link(''),
'hidden' => [
'token' => $this->c->Csrf->create(''),
],
'sets' => [],
'btns' => [
'find1' => [
'type' => 'submit',
'value' => \ForkBB\__('???'),
'accesskey' => 's',
],
],
];
foreach ($users as $user) {
++$number;
$fields = [];
$fields["l{$number}-username"] = [
# 'class' => 'pline',
'type' => 'link',
'caption' => \ForkBB\__('Results username head'),
'value' => $user->username,
'href' => $user->link,
# 'title' => \ForkBB\__('Show posts'),
];
$fields["l{$number}-email"] = [
# 'class' => 'pline',
'type' => 'link',
'caption' => \ForkBB\__('Results e-mail head'),
'value' => $user->email,
'href' => 'mailto:' . $user->email,
# 'title' => \ForkBB\__('Show posts'),
];
$fields["l{$number}-title"] = [
# 'class' => 'pline',
'type' => 'str',
'caption' => \ForkBB\__('Results title head'),
'value' => $user->title(),
];
$fields["l{$number}-posts"] = [
# 'class' => 'pline',
'type' => $user->num_posts ? 'link' : 'str',
'caption' => \ForkBB\__('Results posts head'),
'value' => \ForkBB\num($user->num_posts),
'href' => $this->c->Router->link('SearchAction', ['action' => 'posts', 'uid' => $user->id]),
'title' => \ForkBB\__('Results show posts link'),
];
$fields["l{$number}-note"] = [
# 'class' => 'pline',
'type' => 'str',
'caption' => \ForkBB\__('Примечание админа'),
'value' => $user->admin_note,
];
$form['sets']["l{$number}"] = [
'legend' => $number,
'fields' => $fields,
];
}
return $form;
}
} }

View file

@ -316,7 +316,7 @@ msgid "Results view IP link"
msgstr "IP статистика" msgstr "IP статистика"
msgid "Results show posts link" msgid "Results show posts link"
msgstr "Сообщения" msgstr "Показать сообщения"
msgid "Results guest" msgid "Results guest"
msgstr "Гость" msgstr "Гость"

View file

@ -0,0 +1,9 @@
@extends ('layouts/admin')
<section class="f-admin f-search-user-form">
<h2>{!! __('User search head') !!}</h2>
<div class="f-fdiv">
@if ($form = $p->formResult)
@include ('layouts/form')
@endif
</div>
</section>