-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathuser_bulk.php
81 lines (67 loc) · 2.34 KB
/
user_bulk.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
require_once('../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot.'/'.$CFG->admin.'/report/advuserbulk/lib.php');
require_once($CFG->dirroot.'/'.$CFG->admin.'/report/advuserbulk/user_bulk_forms.php');
admin_externalpage_setup('reportadvuserbulk');
if (!isset($SESSION->bulk_users)) {
$SESSION->bulk_users = array();
}
// create the user filter form
$ufiltering = new user_filtering();
// array of bulk operations
// create the bulk operations form
$action_form = new user_bulk_action_form();
if ($data = $action_form->get_data(false)) {
// check if an action should be performed and do so using plugin list
if ($data->action != '0') {
redirect($CFG->wwwroot.'/'.$CFG->admin.'/report/advuserbulk/actions/'.$data->action.'/index.php');
}
}
$user_bulk_form = new user_bulk_form(null, get_selection_data($ufiltering));
if ($data = $user_bulk_form->get_data(false)) {
if (!empty($data->addall)) {
add_selection_all($ufiltering);
} else if (!empty($data->addsel)) {
if (!empty($data->ausers)) {
if (in_array(0, $data->ausers)) {
add_selection_all($ufiltering);
} else {
foreach($data->ausers as $userid) {
if ($userid == -1) {
continue;
}
if (!isset($SESSION->bulk_users[$userid])) {
$SESSION->bulk_users[$userid] = $userid;
}
}
}
}
} else if (!empty($data->removeall)) {
$SESSION->bulk_users= array();
} else if (!empty($data->removesel)) {
if (!empty($data->susers)) {
if (in_array(0, $data->susers)) {
$SESSION->bulk_users= array();
} else {
foreach($data->susers as $userid) {
if ($userid == -1) {
continue;
}
unset($SESSION->bulk_users[$userid]);
}
}
}
}
// reset the form selections
unset($_POST);
$user_bulk_form = new user_bulk_form(null, get_selection_data($ufiltering));
}
// do output
echo $OUTPUT->header();
$ufiltering->display_add();
$ufiltering->display_active();
$user_bulk_form->display();
$action_form->display();
echo $OUTPUT->footer();
?>