| Línea 129... |
Línea 129... |
| 129 |
|
129 |
|
| 130 |
if ($user = $DB->get_record('user', array('id'=>$suspend, 'mnethostid'=>$CFG->mnet_localhost_id, 'deleted'=>0))) {
|
130 |
if ($user = $DB->get_record('user', array('id'=>$suspend, 'mnethostid'=>$CFG->mnet_localhost_id, 'deleted'=>0))) {
|
| 131 |
if (!is_siteadmin($user) and $USER->id != $user->id and $user->suspended != 1) {
|
131 |
if (!is_siteadmin($user) and $USER->id != $user->id and $user->suspended != 1) {
|
| 132 |
$user->suspended = 1;
|
132 |
$user->suspended = 1;
|
| 133 |
// Force logout.
|
133 |
// Force logout.
|
| 134 |
\core\session\manager::kill_user_sessions($user->id);
|
134 |
\core\session\manager::destroy_user_sessions($user->id);
|
| 135 |
user_update_user($user, false);
|
135 |
user_update_user($user, false);
|
| 136 |
}
|
136 |
}
|
| 137 |
}
|
137 |
}
|
| Línea 157... |
Línea 157... |
| 157 |
redirect($returnurl);
|
157 |
redirect($returnurl);
|
| 158 |
}
|
158 |
}
|
| Línea 159... |
Línea 159... |
| 159 |
|
159 |
|
| Línea 160... |
Línea -... |
| 160 |
echo $OUTPUT->header();
|
- |
|
| 161 |
|
- |
|
| 162 |
if (has_capability('moodle/user:create', $sitecontext)) {
|
- |
|
| 163 |
echo html_writer::start_div('d-flex mb-2');
|
- |
|
| 164 |
$url = new moodle_url('/user/editadvanced.php', ['id' => -1]);
|
- |
|
| 165 |
echo html_writer::link($url, get_string('addnewuser', 'moodle'), [
|
- |
|
| 166 |
'class' => 'btn btn-primary ml-auto',
|
- |
|
| 167 |
'data-action' => 'add-user',
|
- |
|
| 168 |
]);
|
- |
|
| 169 |
echo html_writer::end_div();
|
- |
|
| 170 |
}
|
160 |
echo $OUTPUT->header();
|
| Línea 171... |
Línea 161... |
| 171 |
|
161 |
|
| 172 |
echo html_writer::start_div('', ['data-region' => 'report-user-list-wrapper']);
|
162 |
echo html_writer::start_div('', ['data-region' => 'report-user-list-wrapper']);
|
| 173 |
|
163 |
|
| 174 |
$bulkactions = new user_bulk_action_form(new moodle_url('/admin/user/user_bulk.php'),
|
164 |
$bulkactions = new user_bulk_action_form(new moodle_url('/admin/user/user_bulk.php'),
|
| 175 |
['excludeactions' => ['displayonpage', 'download'], 'passuserids' => true, 'hidesubmit' => true],
|
165 |
['excludeactions' => ['displayonpage', 'download'], 'passuserids' => true, 'hidesubmit' => true],
|
| Línea 176... |
Línea 166... |
| 176 |
'post', '',
|
166 |
'post', '',
|
| 177 |
['id' => 'user-bulk-action-form']);
|
167 |
['id' => 'user-bulk-action-form']);
|
| - |
|
168 |
$bulkactions->set_data(['returnurl' => $PAGE->url->out_as_local_url(false)]);
|
| - |
|
169 |
|
| - |
|
170 |
$report = \core_reportbuilder\system_report_factory::create(\core_admin\reportbuilder\local\systemreports\users::class,
|
| - |
|
171 |
context_system::instance(), parameters: ['withcheckboxes' => $bulkactions->has_bulk_actions()]);
|
| - |
|
172 |
if (has_capability('moodle/user:create', $sitecontext)) {
|
| - |
|
173 |
$url = new moodle_url('/user/editadvanced.php', ['id' => -1]);
|
| - |
|
174 |
$report->set_report_action(new \core_reportbuilder\output\report_action(
|
| - |
|
175 |
get_string('addnewuser', 'moodle'),
|
| - |
|
176 |
['class' => 'btn btn-primary ms-auto', 'data-action' => 'add-user', 'href' => (string) $url],
|
| 178 |
$bulkactions->set_data(['returnurl' => $PAGE->url->out_as_local_url(false)]);
|
177 |
'a',
|
| Línea 179... |
Línea 178... |
| 179 |
|
178 |
));
|
| 180 |
$report = \core_reportbuilder\system_report_factory::create(\core_admin\reportbuilder\local\systemreports\users::class,
|
179 |
}
|
| 181 |
context_system::instance(), parameters: ['withcheckboxes' => $bulkactions->has_bulk_actions()]);
|
180 |
|