mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-10181, bulk user action and language pack fixes
This commit is contained in:
parent
379eaebde1
commit
68853d0dd3
@ -14,6 +14,7 @@ if(empty($CFG->loginhttps)) {
|
||||
// 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'));
|
||||
|
@ -46,14 +46,14 @@
|
||||
$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
|
||||
@ -62,11 +62,13 @@
|
||||
$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();
|
||||
|
@ -24,7 +24,7 @@ if (empty($userlist)) {
|
||||
redirect($CFG->wwwroot . '/admin/user_bulk.php');
|
||||
}
|
||||
|
||||
admin_externalpage_setup('editusers');
|
||||
admin_externalpage_setup('userbulk');
|
||||
admin_externalpage_print_header();
|
||||
if (empty($confirm)) {
|
||||
$usernames = array();
|
||||
|
@ -25,7 +25,7 @@ if (empty($userlist)) {
|
||||
redirect($CFG->wwwroot . '/admin/user_bulk.php');
|
||||
}
|
||||
|
||||
admin_externalpage_setup('editusers');
|
||||
admin_externalpage_setup('userbulk');
|
||||
admin_externalpage_print_header();
|
||||
if (empty($confirm)) {
|
||||
$usernames = array();
|
||||
|
@ -17,7 +17,7 @@ class user_bulk_form extends moodleform {
|
||||
$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);
|
||||
@ -27,6 +27,7 @@ class user_bulk_form extends moodleform {
|
||||
$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'));
|
||||
@ -38,13 +39,23 @@ class user_bulk_form extends moodleform {
|
||||
$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());
|
||||
@ -52,6 +63,7 @@ class user_bulk_form extends moodleform {
|
||||
if(empty($SESSION->bulk_susers)) {
|
||||
$this->_form->removeElement('actionsgrp');
|
||||
}
|
||||
//$this->setUserCount();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,4 +175,4 @@ class user_bulk_form extends moodleform {
|
||||
}
|
||||
return $data->action;
|
||||
}
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@ if ($noteform->is_submitted() && !empty($formdata->send)) {
|
||||
}
|
||||
}
|
||||
|
||||
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>';
|
||||
|
@ -616,6 +616,7 @@ $string['upgradinglogs'] = 'Upgrading logs';
|
||||
$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';
|
||||
|
@ -2,8 +2,8 @@
|
||||
$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';
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php //$Id$
|
||||
$string['actfilterhdr'] = 'Active filters';
|
||||
$string['actfilterhdr'] = 'Active filters (ORed together)';
|
||||
$string['addfilter'] = 'Add filter';
|
||||
$string['anyvalue'] = 'any value';
|
||||
$string['anyrole'] = 'any role';
|
||||
|
Loading…
x
Reference in New Issue
Block a user