Elgg  Version 6.3
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  'list_type' => 'table',
21  'limit' => max(25, elgg_get_config('default_limit'), (int) get_input('limit', 0)),
22  'columns' => [
23  elgg()->table_columns->checkbox(elgg_view('input/checkbox', [
24  'name' => 'user_guids',
25  'title' => elgg_echo('table_columns:fromView:checkbox'),
26  ]), [
27  'name' => 'user_guids[]',
28  ]),
29  elgg()->table_columns->icon(null, [
30  'use_hover' => false,
31  ]),
32  elgg()->table_columns->user(null, [
33  'item_view' => 'user/default/admin_column',
34  ]),
35  elgg()->table_columns->email(),
36  elgg()->table_columns->time_created(null, [
37  'format' => 'friendly',
38  ]),
39  elgg()->table_columns->entity_menu(null, [
40  'add_user_hover_admin_section' => true,
41  'admin_listing' => elgg_extract('filter', $vars, 'all'),
42  ]),
43  ],
44  'list_class' => 'elgg-admin-users',
45  'query' => $query,
46 ];
47 
48 // merge additional options
49 $options = (array) elgg_extract('options', $vars, []);
50 $options = array_merge($default_options, $options);
51 
54 });
55 if (empty($users)) {
56  echo elgg_view('page/components/no_results', [
57  'no_results' => elgg_extract('no_results', $vars, true),
58  ]);
59  return;
60 }
61 
62 // draw a menu for bulk actions
63 // the menu items will be shown as submit buttons with a custom formaction
65  'class' => ['elgg-menu-hz', 'elgg-admin-users-bulkactions-buttons'],
66  'item_contents_view' => 'navigation/menu/elements/item/submit',
67  'filter_value' => elgg_extract('filter', $vars, 'all'),
68  // @see \Elgg\Menus\AdminUsersBulk::registerActions()
69  'show_ban' => true,
70  'show_unban' => true,
71  'show_delete' => true,
72  'show_validate' => false,
73 ];
74 $menu_vars = (array) elgg_extract('menu_vars', $vars, []);
76 echo elgg_view_menu('admin:users:bulk', $menu_vars);
77 
78 echo $users;
$vars
Definition: theme.php:3
$options
if(empty($users)) $default_menu_vars
$users
$menu_vars
$default_options
$getter
$query
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
const ELGG_SHOW_DISABLED_ENTITIES
Definition: constants.php:123
elgg()
Bootstrapping and helper procedural code available for use in Elgg core and plugins.
Definition: elgglib.php:12
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:290
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:240
get_input(string $variable, $default=null, bool $filter_result=true)
Parameter input functions.
Definition: input.php:20
elgg_list_entities(array $options=[], ?callable $getter=null, ?callable $viewer=null)
Returns a string of rendered entities.
Definition: entities.php:551
elgg_import_esm(string $name)
Helper functions for external files like css/js.
elgg_require_css(string $view)
Register a CSS view name to be included in the HTML head.
elgg_echo(string $message_key, array $args=[], string $language='')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
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