// stuff under the "accounts" subcategory
$ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admin')));
$ADMIN->add('accounts', new admin_externalpage('editusers', get_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
+$ADMIN->add('accounts', new admin_externalpage('userbulk', get_string('userbulk','admin'), "$CFG->wwwroot/$CFG->admin/user_bulk.php", array('moodle/user:update', 'moodle/user:delete')));
$ADMIN->add('accounts', new admin_externalpage('addnewuser', get_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
$ADMIN->add('accounts', new admin_externalpage('uploadusers', get_string('uploadusers'), "$CFG->wwwroot/$CFG->admin/uploaduser.php", 'moodle/site:uploadusers'));
$ADMIN->add('accounts', new admin_externalpage('profilefields', get_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
$filters[] = new user_filter_select('country', get_string('country'), 'country', get_list_of_countries());
$filters[] = new user_filter_yesno('confirmed', get_string('confirm'), 'confirmed');
$filters[] = new user_filter_profilefield('profile', get_string('profile'));
- $filters[] = new user_filter_courserole('course', get_string('courserole', 'filters'));
- $filters[] = new user_filter_globalrole('system', get_string('globalrole', 'role'));
+ $filters[] = new user_filter_courserole('course', get_string('courserole', 'filters'));
+ $filters[] = new user_filter_globalrole('system', get_string('globalrole', 'role'));
// create the user filter form
$user_filter_form =& new user_filter_form(null, $filters);
// do output
- admin_externalpage_setup('editusers');
+ admin_externalpage_setup('userbulk');
admin_externalpage_print_header();
// put the user filter form first
$where =& $user_filter_form->getSQLFilter('id<>1 AND NOT deleted');
$ausercount = count_records_select('user', $where);
// limit the number of options
+ $comment = null;
if($ausercount <= MAX_USERS_PER_PAGE) {
$user_bulk_form->setAvailableUsersSQL($where);
} else {
- echo get_string('toomanytoshow');
+ $comment = get_string('toomanytoshow');
}
+ $user_bulk_form->setUserCount($ausercount, $comment);
// display the bulk user form
$user_bulk_form->display();
admin_externalpage_print_footer();
redirect($CFG->wwwroot . '/admin/user_bulk.php');
}
-admin_externalpage_setup('editusers');
+admin_externalpage_setup('userbulk');
admin_externalpage_print_header();
if (empty($confirm)) {
$usernames = array();
redirect($CFG->wwwroot . '/admin/user_bulk.php');
}
-admin_externalpage_setup('editusers');
+admin_externalpage_setup('userbulk');
admin_externalpage_print_header();
if (empty($confirm)) {
$usernames = array();
$mform =& $this->_form;
$mform->addElement('header', 'users', get_string('usersinlist', 'bulkusers'));
- $this->ausers =& $mform->createElement('select', 'ausers', get_string('filtered', 'bulkusers'), null, 'size="15"');
+ $this->ausers =& $mform->createElement('select', 'ausers', get_string('available', 'bulkusers'), null, 'size="15"');
$this->ausers->setMultiple(true);
$this->susers =& $mform->createElement('select', 'susers', get_string('selected', 'bulkusers'), null, 'size="15"');
$this->susers->setMultiple(true);
$objs[] = &$this->susers;
$mform->addElement('group', 'usersgrp', get_string('users'), $objs, ' ', false);
+ $mform->addElement('static', 'comment');
$objs = array();
$objs[] =& $mform->createElement('submit', 'addone', get_string('addsel', 'bulkusers'));
$objs = array();
$objs[] =& $mform->createElement('select', 'action', get_string('withselected'), @$this->_customdata);
$objs[] =& $mform->createElement('submit', 'doaction', get_string('go'));;
- $mform->addElement('group', 'actionsgrp', get_string('actions'), $objs, ' ', false);
+ $mform->addElement('group', 'actionsgrp', get_string('withselectedusers'), $objs, ' ', false);
$renderer =& $mform->defaultRenderer();
$template = '<label class="qflabel" style="vertical-align:top">{label}</label> {element}';
$renderer->setGroupElementTemplate($template, 'usersgrp');
}
+ function setUserCount($count=-1, $comment=null) {
+ global $SESSION;
+ if($count < 0) {
+ $count = count($SESSION->bulk_ausers);
+ }
+ $obj =& $this->_form->getElement('comment');
+ $obj->setLabel($comment);
+ $obj->setText(get_string('usersfound', 'bulkusers', $count));
+ }
+
function definition_after_data() {
global $SESSION;
$this->_updateSelection($this->get_data());
if(empty($SESSION->bulk_susers)) {
$this->_form->removeElement('actionsgrp');
}
+ //$this->setUserCount();
}
/**
}
return $data->action;
}
-}
+}
\ No newline at end of file
}
}
-admin_externalpage_setup('editusers');
+admin_externalpage_setup('userbulk');
admin_externalpage_print_header();
if ($noteform->is_submitted() && !empty($formdata->preview)) {
echo '<h3>'.get_string('previewhtml').'</h3>';
$string['upwards'] = 'upwards';
$string['usehtmleditor'] = 'Use HTML editor';
$string['useraccountupdated'] = 'User updated';
+$string['userbulk'] = 'Bulk user actions';
$string['userlist'] = 'Browse list of users';
$string['userpolicies'] = 'User policies';
$string['userrenamed'] = 'User renamed';
$string['usersinlist'] = 'Users in list';
$string['addall'] = 'Add all to selection';
$string['addsel'] = 'Add to selection';
-$string['removeall'] = 'Remove all from selection';
+$string['removeall'] = 'Clear selection';
$string['removesel'] = 'Remove from selection';
-$string['filtered'] = 'Filtered';
+$string['available'] = 'Available';
$string['selected'] = 'Selected';
-$string['action'] = 'Action';
+$string['usersfound'] = '$a user(s) found';
<?php //$Id$
-$string['actfilterhdr'] = 'Active filters';
+$string['actfilterhdr'] = 'Active filters (ORed together)';
$string['addfilter'] = 'Add filter';
$string['anyvalue'] = 'any value';
$string['anyrole'] = 'any role';