2018-04-22

This commit is contained in:
Visman 2018-04-22 21:35:39 +07:00
parent a12aa57e26
commit 45029b445a
4 changed files with 31 additions and 9 deletions

View file

@ -58,9 +58,11 @@ class Users extends Admin
$filters['group_id'] = ['=', $data['user_group']];
}
unset($data['order_by'], $data['direction'], $data['user_group']);
foreach ($data as $field => $value) {
if ('order_by' === $field || 'direction' === $field || 'user_group' === $field) {
continue;
}
$key = 1;
$type = '=';
@ -80,7 +82,22 @@ class Users extends Admin
$filters[$field][$key] = $value;
}
$ids = $this->c->users->filter($filters, $order);
$ids = $this->c->users->filter($filters, $order);
$number = \count($ids);
if (0 == $number) {
$this->fIswev = ['i', \ForkBB\__('No users found')];
return $this->view([], 'GET', $data);
}
$page = isset($args['page']) ? (int) $args['page'] : 1;
$pages = (int) \ceil($number / $this->c->config->o_disp_users);
if ($page > $pages) {
return $this->c->Message->message('Bad request');
}
exit(var_dump($ids, $order, $filters));
}
@ -90,15 +107,14 @@ class Users extends Admin
*
* @param array $args
* @param string $method
* @param array $data
*
* @return Page
*/
public function view(array $args, $method)
public function view(array $args, $method, array $data = [])
{
$this->c->Lang->load('admin_users');
$data = [];
if ('POST' === $method) {
$v = $this->c->Validator->reset()
->addRules([

View file

@ -76,9 +76,9 @@ class Userlist extends Page
} else {
$filters['group_id'] = ['=', $v->group];
}
# if (null !== $v->name && '*' !== $v->name) {
# $filters['username'] = ['LIKE', $v->name];
# }
if (null !== $v->name) {
$filters['username'] = ['LIKE', $v->name];
}
$order = $v->sort ? [$v->sort => $v->dir] : [];

View file

@ -329,3 +329,6 @@ msgstr "No match"
msgid "Search results legend"
msgstr "Select how to view search results"
msgid "No users found"
msgstr "No users were found matching your criteria."

View file

@ -329,3 +329,6 @@ msgstr "Ничего"
msgid "Search results legend"
msgstr "Настройка параметров вывода результатов"
msgid "No users found"
msgstr "По вашему запросу ничего не найдено."