Elgg  Version master
bulk_actions.php
Go to the documentation of this file.
1 <?php
10 elgg_require_css('forms/admin/users/bulk_actions');
11 elgg_import_esm('forms/admin/users/bulk_actions');
12 
13 // did we search
15 $getter = $query ? 'elgg_search' : 'elgg_get_entities';
16 
17 // make selection options
19  'type' => 'user',
20  'subtype' => null,
21  'full_view' => false,
22  'list_type' => 'table',
23  'limit' => max(25, elgg_get_config('default_limit'), (int) get_input('limit', 0)),
24  'columns' => [
25  elgg()->table_columns->checkbox(elgg_view('input/checkbox', [
26  'name' => 'user_guids',
27  'title' => elgg_echo('table_columns:fromView:checkbox'),
28  ]), [
29  'name' => 'user_guids[]',
30  ]),
31  elgg()->table_columns->icon(null, [
32  'use_hover' => false,
33  ]),
34  elgg()->table_columns->user(null, [
35  'item_view' => 'user/default/admin_column',
36  ]),
37  elgg()->table_columns->email(),
38  elgg()->table_columns->time_created(null, [
39  'format' => 'friendly',
40  ]),
41  elgg()->table_columns->entity_menu(null, [
42  'add_user_hover_admin_section' => true,
43  'admin_listing' => elgg_extract('filter', $vars, 'all'),
44  ]),
45  ],
46  'list_class' => 'elgg-admin-users',
47  'query' => $query,
48 ];
49 
50 // merge additional options
51 $options = (array) elgg_extract('options', $vars, []);
52 $options = array_merge($default_options, $options);
53 
56 });
57 if (empty($users)) {
58  echo elgg_view('page/components/no_results', [
59  'no_results' => elgg_extract('no_results', $vars, true),
60  ]);
61  return;
62 }
63 
64 // draw a menu for bulk actions
65 // the menu items will be shown as submit buttons with a custom formaction
67  'class' => ['elgg-menu-hz', 'elgg-admin-users-bulkactions-buttons'],
68  'item_contents_view' => 'navigation/menu/elements/item/submit',
69  'filter_value' => elgg_extract('filter', $vars, 'all'),
70  // @see \Elgg\Menus\AdminUsersBulk::registerActions()
71  'show_ban' => true,
72  'show_unban' => true,
73  'show_delete' => true,
74  'show_validate' => false,
75 ];
76 $menu_vars = (array) elgg_extract('menu_vars', $vars, []);
78 echo elgg_view_menu('admin:users:bulk', $menu_vars);
79 
80 echo $users;
elgg_call(int $flags, Closure $closure)
Calls a callable autowiring the arguments using public DI services and applying logic based on flags...
Definition: elgglib.php:304
elgg
Definition: install.js:27
elgg_require_css(string $view)
Register a CSS view name to be included in the HTML head.
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
if(empty($users)) $default_menu_vars
$users
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
elgg_view_menu($menu, array $vars=[])
Render a menu.
Definition: views.php:441
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:156
const ELGG_SHOW_DISABLED_ENTITIES
Definition: constants.php:123
elgg_import_esm(string $name)
Helper functions for external files like css/js.
$getter
elgg_list_entities(array $options=[], callable $getter=null, callable $viewer=null)
Returns a string of rendered entities.
Definition: entities.php:551
$vars
Definition: theme.php:5
$default_options
$query
if(empty($users)) $menu_vars
$options