mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 12:45:04 +01:00
MDL-29029 move user upload to admin tools
AMOS BEGIN MOV [uploadpictures,core_admin],[uploadpictures,tool_uploaduser] MOV [uploadpictures_help,core_admin],[uploadpictures_help,tool_uploaduser] MOV [uploadusers,core_admin],[uploadusers,tool_uploaduser] MOV [uploadusers_help,core_admin],[uploadusers_help,tool_uploaduser] MOV [uploaduserspreview,core_admin],[uploaduserspreview,tool_uploaduser] MOV [uploadusersresult,core_admin],[uploadusersresult,tool_uploaduser] MOV [uucsvline,core_admin],[uucsvline,tool_uploaduser] MOV [userrenamed,core_admin],[userrenamed,tool_uploaduser] MOV [useraccountupdated,core_admin],[useraccountupdated,tool_uploaduser] MOV [useraccountuptodate,core_admin],[useraccountuptodate,tool_uploaduser] MOV [userdeleted,core_admin],[userdeleted,tool_uploaduser] MOV [uupasswordcron,core_admin],[uupasswordcron,tool_uploaduser] MOV [userscreated,core_admin],[userscreated,tool_uploaduser] MOV [usersupdated,core_admin],[usersupdated,tool_uploaduser] MOV [usersdeleted,core_admin],[usersdeleted,tool_uploaduser] MOV [deleteerrors,core_admin],[deleteerrors,tool_uploaduser] MOV [usersrenamed,core_admin],[usersrenamed,tool_uploaduser] MOV [renameerrors,core_admin],[renameerrors,tool_uploaduser] MOV [usersskipped,core_admin],[usersskipped,tool_uploaduser] MOV [usersweakpassword,core_admin],[usersweakpassword,tool_uploaduser] MOV [errors,core_admin],[errors,tool_uploaduser] MOV [csvdelimiter,core_admin],[csvdelimiter,tool_uploaduser] MOV [encoding,core_admin],[encoding,tool_uploaduser] MOV [rowpreviewnum,core_admin],[rowpreviewnum,tool_uploaduser] MOV [uuoptype_addinc,core_admin],[uuoptype_addinc,tool_uploaduser] MOV [uuoptype_addnew,core_admin],[uuoptype_addnew,tool_uploaduser] MOV [uuoptype_addupdate,core_admin],[uuoptype_addupdate,tool_uploaduser] MOV [uuoptype_update,core_admin],[uuoptype_update,tool_uploaduser] MOV [uuoptype,core_admin],[uuoptype,tool_uploaduser] MOV [uupasswordnew,core_admin],[uupasswordnew,tool_uploaduser] MOV [uupasswordold,core_admin],[uupasswordold,tool_uploaduser] MOV [nochanges,core_admin],[nochanges,tool_uploaduser] MOV [uuupdateall,core_admin],[uuupdateall,tool_uploaduser] MOV [uuupdatefromfile,core_admin],[uuupdatefromfile,tool_uploaduser] MOV [uuupdatemissing,core_admin],[uuupdatemissing,tool_uploaduser] MOV [uuupdatetype,core_admin],[uuupdatetype,tool_uploaduser] MOV [allowrenames,core_admin],[allowrenames,tool_uploaduser] MOV [allowdeletes,core_admin],[allowdeletes,tool_uploaduser] MOV [uunoemailduplicates,core_admin],[uunoemailduplicates,tool_uploaduser] MOV [uustandardusernames,core_admin],[uustandardusernames,tool_uploaduser] MOV [uubulk,core_admin],[uubulk,tool_uploaduser] MOV [uubulkall,core_admin],[uubulkall,tool_uploaduser] MOV [uubulknew,core_admin],[uubulknew,tool_uploaduser] MOV [uubulkupdated,core_admin],[uubulkupdated,tool_uploaduser] MOV [uulegacy1role,core_admin],[uulegacy1role,tool_uploaduser] MOV [uulegacy2role,core_admin],[uulegacy2role,tool_uploaduser] MOV [uulegacy3role,core_admin],[uulegacy3role,tool_uploaduser] MOV [defaultvalues,core_admin],[defaultvalues,tool_uploaduser] MOV [uuusernametemplate,core_admin],[uuusernametemplate,tool_uploaduser] MOV [requiredtemplate,core_admin],[requiredtemplate,tool_uploaduser] MOV [uploadpicture_baduserfield,core_admin],[uploadpicture_baduserfield,tool_uploaduser] MOV [uploadpicture_cannotmovezip,core_admin],[uploadpicture_cannotmovezip,tool_uploaduser] MOV [uploadpicture_cannotprocessdir,core_admin],[uploadpicture_cannotprocessdir,tool_uploaduser] MOV [uploadpicture_cannotsave,core_admin],[uploadpicture_cannotsave,tool_uploaduser] MOV [uploadpicture_cannotunzip,core_admin],[uploadpicture_cannotunzip,tool_uploaduser] MOV [uploadpicture_invalidfilename,core_admin],[uploadpicture_invalidfilename,tool_uploaduser] MOV [uploadpicture_overwrite,core_admin],[uploadpicture_overwrite,tool_uploaduser] MOV [uploadpicture_userfield,core_admin],[uploadpicture_userfield,tool_uploaduser] MOV [uploadpicture_usernotfound,core_admin],[uploadpicture_usernotfound,tool_uploaduser] MOV [uploadpicture_userskipped,core_admin],[uploadpicture_userskipped,tool_uploaduser] MOV [uploadpicture_userupdated,core_admin],[uploadpicture_userupdated,tool_uploaduser] AMOS END
This commit is contained in:
parent
0715e3d938
commit
ce15d56ddb
@ -6,7 +6,6 @@ $ADMIN->add('users', new admin_category('accounts', get_string('accounts', 'admi
|
||||
$ADMIN->add('users', new admin_category('roles', get_string('permissions', 'role')));
|
||||
|
||||
if ($hassiteconfig
|
||||
or has_capability('moodle/site:uploadusers', $systemcontext)
|
||||
or has_capability('moodle/user:create', $systemcontext)
|
||||
or has_capability('moodle/user:update', $systemcontext)
|
||||
or has_capability('moodle/user:delete', $systemcontext)
|
||||
@ -25,8 +24,6 @@ if ($hassiteconfig
|
||||
$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/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', 'admin'), "$CFG->wwwroot/$CFG->admin/uploaduser.php", 'moodle/site:uploadusers'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('uploadpictures', get_string('uploadpictures','admin'), "$CFG->wwwroot/$CFG->admin/uploadpicture.php", 'moodle/site:uploadusers'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('profilefields', get_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('cohorts', get_string('cohorts', 'cohort'), $CFG->wwwroot . '/cohort/index.php', array('moodle/cohort:manage', 'moodle/cohort:view')));
|
||||
|
||||
|
@ -17,20 +17,20 @@
|
||||
/**
|
||||
* Bulk user registration script from a comma separated file
|
||||
*
|
||||
* @package core
|
||||
* @subpackage admin
|
||||
* @package tool
|
||||
* @subpackage uploaduser
|
||||
* @copyright 2004 onwards Martin Dougiamas (http://dougiamas.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require('../config.php');
|
||||
require('../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/csvlib.class.php');
|
||||
require_once($CFG->dirroot.'/user/profile/lib.php');
|
||||
require_once($CFG->dirroot.'/group/lib.php');
|
||||
require_once($CFG->dirroot.'/cohort/lib.php');
|
||||
require_once('uploaduserlib.php');
|
||||
require_once('uploaduser_form.php');
|
||||
require_once('locallib.php');
|
||||
require_once('user_form.php');
|
||||
|
||||
$iid = optional_param('iid', '', PARAM_INT);
|
||||
$previewrows = optional_param('previewrows', 10, PARAM_INT);
|
||||
@ -39,27 +39,27 @@ $previewrows = optional_param('previewrows', 10, PARAM_INT);
|
||||
raise_memory_limit(MEMORY_HUGE);
|
||||
|
||||
require_login();
|
||||
admin_externalpage_setup('uploadusers');
|
||||
admin_externalpage_setup('tooluploaduser');
|
||||
require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM));
|
||||
|
||||
$struserrenamed = get_string('userrenamed', 'admin');
|
||||
$struserrenamed = get_string('userrenamed', 'tool_uploaduser');
|
||||
$strusernotrenamedexists = get_string('usernotrenamedexists', 'error');
|
||||
$strusernotrenamedmissing = get_string('usernotrenamedmissing', 'error');
|
||||
$strusernotrenamedoff = get_string('usernotrenamedoff', 'error');
|
||||
$strusernotrenamedadmin = get_string('usernotrenamedadmin', 'error');
|
||||
|
||||
$struserupdated = get_string('useraccountupdated', 'admin');
|
||||
$struserupdated = get_string('useraccountupdated', 'tool_uploaduser');
|
||||
$strusernotupdated = get_string('usernotupdatederror', 'error');
|
||||
$strusernotupdatednotexists = get_string('usernotupdatednotexists', 'error');
|
||||
$strusernotupdatedadmin = get_string('usernotupdatedadmin', 'error');
|
||||
|
||||
$struseruptodate = get_string('useraccountuptodate', 'admin');
|
||||
$struseruptodate = get_string('useraccountuptodate', 'tool_uploaduser');
|
||||
|
||||
$struseradded = get_string('newuser');
|
||||
$strusernotadded = get_string('usernotaddedregistered', 'error');
|
||||
$strusernotaddederror = get_string('usernotaddederror', 'error');
|
||||
|
||||
$struserdeleted = get_string('userdeleted', 'admin');
|
||||
$struserdeleted = get_string('userdeleted', 'tool_uploaduser');
|
||||
$strusernotdeletederror = get_string('usernotdeletederror', 'error');
|
||||
$strusernotdeletedmissing = get_string('usernotdeletedmissing', 'error');
|
||||
$strusernotdeletedoff = get_string('usernotdeletedoff', 'error');
|
||||
@ -73,7 +73,7 @@ $stremailduplicate = get_string('useremailduplicate', 'error');
|
||||
$strinvalidpasswordpolicy = get_string('invalidpasswordpolicy', 'error');
|
||||
$errorstr = get_string('error');
|
||||
|
||||
$returnurl = new moodle_url('/admin/uploaduser.php');
|
||||
$returnurl = new moodle_url('/admin/tool/uploaduser/index.php');
|
||||
$bulknurl = new moodle_url('/admin/user/user_bulk.php');
|
||||
|
||||
$today = time();
|
||||
@ -124,7 +124,7 @@ if (empty($iid)) {
|
||||
} else {
|
||||
echo $OUTPUT->header();
|
||||
|
||||
echo $OUTPUT->heading_with_help(get_string('uploadusers', 'admin'), 'uploadusers', 'admin');
|
||||
echo $OUTPUT->heading_with_help(get_string('uploadusers', 'tool_uploaduser'), 'uploadusers', 'tool_uploaduser');
|
||||
|
||||
$mform1->display();
|
||||
echo $OUTPUT->footer();
|
||||
@ -145,7 +145,7 @@ if ($formdata = $mform2->is_cancelled()) {
|
||||
} else if ($formdata = $mform2->get_data()) {
|
||||
// Print the header
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('uploadusersresult', 'admin'));
|
||||
echo $OUTPUT->heading(get_string('uploadusersresult', 'tool_uploaduser'));
|
||||
|
||||
$optype = $formdata->uutype;
|
||||
|
||||
@ -647,7 +647,7 @@ if ($formdata = $mform2->is_cancelled()) {
|
||||
if ($createpasswords) {
|
||||
$user->password = 'to be generated';
|
||||
$upt->track('password', '', 'normal', false);
|
||||
$upt->track('password', get_string('uupasswordcron', 'admin'), 'warning', false);
|
||||
$upt->track('password', get_string('uupasswordcron', 'tool_uploaduser'), 'warning', false);
|
||||
} else {
|
||||
$upt->track('password', '', 'normal', false);
|
||||
$upt->track('password', get_string('missingfield', 'error', 'password'), 'error');
|
||||
@ -889,24 +889,24 @@ if ($formdata = $mform2->is_cancelled()) {
|
||||
echo $OUTPUT->box_start('boxwidthnarrow boxaligncenter generalbox', 'uploadresults');
|
||||
echo '<p>';
|
||||
if ($optype != UU_USER_UPDATE) {
|
||||
echo get_string('userscreated', 'admin').': '.$usersnew.'<br />';
|
||||
echo get_string('userscreated', 'tool_uploaduser').': '.$usersnew.'<br />';
|
||||
}
|
||||
if ($optype == UU_USER_UPDATE or $optype == UU_USER_ADD_UPDATE) {
|
||||
echo get_string('usersupdated', 'admin').': '.$usersupdated.'<br />';
|
||||
echo get_string('usersupdated', 'tool_uploaduser').': '.$usersupdated.'<br />';
|
||||
}
|
||||
if ($allowdeletes) {
|
||||
echo get_string('usersdeleted', 'admin').': '.$deletes.'<br />';
|
||||
echo get_string('deleteerrors', 'admin').': '.$deleteerrors.'<br />';
|
||||
echo get_string('usersdeleted', 'tool_uploaduser').': '.$deletes.'<br />';
|
||||
echo get_string('deleteerrors', 'tool_uploaduser').': '.$deleteerrors.'<br />';
|
||||
}
|
||||
if ($allowrenames) {
|
||||
echo get_string('usersrenamed', 'admin').': '.$renames.'<br />';
|
||||
echo get_string('renameerrors', 'admin').': '.$renameerrors.'<br />';
|
||||
echo get_string('usersrenamed', 'tool_uploaduser').': '.$renames.'<br />';
|
||||
echo get_string('renameerrors', 'tool_uploaduser').': '.$renameerrors.'<br />';
|
||||
}
|
||||
if ($usersskipped) {
|
||||
echo get_string('usersskipped', 'admin').': '.$usersskipped.'<br />';
|
||||
echo get_string('usersskipped', 'tool_uploaduser').': '.$usersskipped.'<br />';
|
||||
}
|
||||
echo get_string('usersweakpassword', 'admin').': '.$weakpasswords.'<br />';
|
||||
echo get_string('errors', 'admin').': '.$userserrors.'</p>';
|
||||
echo get_string('usersweakpassword', 'tool_uploaduser').': '.$weakpasswords.'<br />';
|
||||
echo get_string('errors', 'tool_uploaduser').': '.$userserrors.'</p>';
|
||||
echo $OUTPUT->box_end();
|
||||
|
||||
if ($bulk) {
|
||||
@ -921,7 +921,7 @@ if ($formdata = $mform2->is_cancelled()) {
|
||||
// Print the header
|
||||
echo $OUTPUT->header();
|
||||
|
||||
echo $OUTPUT->heading(get_string('uploaduserspreview', 'admin'));
|
||||
echo $OUTPUT->heading(get_string('uploaduserspreview', 'tool_uploaduser'));
|
||||
|
||||
// NOTE: this is JUST csv processing preview, we must not prevent import from here if there is something in the file!!
|
||||
// this was intended for validation of csv formatting and encoding, not filtering the data!!!!
|
||||
@ -980,11 +980,11 @@ $table = new html_table();
|
||||
$table->id = "uupreview";
|
||||
$table->attributes['class'] = 'generaltable';
|
||||
$table->tablealign = 'center';
|
||||
$table->summary = get_string('uploaduserspreview', 'admin');
|
||||
$table->summary = get_string('uploaduserspreview', 'tool_uploaduser');
|
||||
$table->head = array();
|
||||
$table->data = $data;
|
||||
|
||||
$table->head[] = get_string('uucsvline', 'admin');
|
||||
$table->head[] = get_string('uucsvline', 'tool_uploaduser');
|
||||
foreach ($filecolumns as $column) {
|
||||
$table->head[] = $column;
|
||||
}
|
92
admin/tool/uploaduser/lang/en/tool_uploaduser.php
Normal file
92
admin/tool/uploaduser/lang/en/tool_uploaduser.php
Normal file
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'tool_uploaduser', language 'en', branch 'MOODLE_22_STABLE'
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage uploaduser
|
||||
* @copyright 2011 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['allowdeletes'] = 'Allow deletes';
|
||||
$string['allowrenames'] = 'Allow renames';
|
||||
$string['csvdelimiter'] = 'CSV delimiter';
|
||||
$string['defaultvalues'] = 'Default values';
|
||||
$string['deleteerrors'] = 'Delete errors';
|
||||
$string['encoding'] = 'Encoding';
|
||||
$string['errors'] = 'Errors';
|
||||
$string['nochanges'] = 'No changes';
|
||||
$string['pluginname'] = 'User upload';
|
||||
$string['renameerrors'] = 'Rename errors';
|
||||
$string['requiredtemplate'] = 'Required. You may use template syntax here (%l = lastname, %f = firstname, %u = username). See help for details and examples.';
|
||||
$string['rowpreviewnum'] = 'Preview rows';
|
||||
$string['uploadpicture_baduserfield'] = 'The user attribute specified is not valid. Please, try again.';
|
||||
$string['uploadpicture_cannotmovezip'] = 'Cannot move zip file to temporary directory.';
|
||||
$string['uploadpicture_cannotprocessdir'] = 'Cannot process unzipped files.';
|
||||
$string['uploadpicture_cannotsave'] = 'Cannot save picture for user {$a}. Check original picture file.';
|
||||
$string['uploadpicture_cannotunzip'] = 'Cannot unzip pictures file.';
|
||||
$string['uploadpicture_invalidfilename'] = 'Picture file {$a} has invalid characters in its name. Skipping.';
|
||||
$string['uploadpicture_overwrite'] = 'Overwrite existing user pictures?';
|
||||
$string['uploadpicture_userfield'] = 'User attribute to use to match pictures:';
|
||||
$string['uploadpicture_usernotfound'] = 'User with a \'{$a->userfield}\' value of \'{$a->uservalue}\' does not exist. Skipping.';
|
||||
$string['uploadpicture_userskipped'] = 'Skipping user {$a} (already has a picture).';
|
||||
$string['uploadpicture_userupdated'] = 'Picture updated for user {$a}.';
|
||||
$string['uploadpictures'] = 'Upload user pictures';
|
||||
$string['uploadpictures_help'] = 'User pictures can be uploaded as a zip file of image files. The image files should be named chosen-user-attribute.extension, for example user1234.jpg for a user with username user1234.';
|
||||
$string['uploadusers'] = 'Upload users';
|
||||
$string['uploadusers_help'] = 'Users may be uploaded (and optionally enrolled in courses) via text file. The format of the file should be as follows:
|
||||
|
||||
* Each line of the file contains one record
|
||||
* Each record is a series of data separated by commas (or other delimiters)
|
||||
* The first record contains a list of fieldnames defining the format of the rest of the file
|
||||
* Required fieldnames are username, password, firstname, lastname, email';
|
||||
$string['uploaduserspreview'] = 'Upload users preview';
|
||||
$string['uploadusersresult'] = 'Upload users results';
|
||||
$string['useraccountupdated'] = 'User updated';
|
||||
$string['useraccountuptodate'] = 'User up-to-date';
|
||||
$string['userdeleted'] = 'User deleted';
|
||||
$string['userrenamed'] = 'User renamed';
|
||||
$string['userscreated'] = 'Users created';
|
||||
$string['usersdeleted'] = 'Users deleted';
|
||||
$string['usersrenamed'] = 'Users renamed';
|
||||
$string['usersskipped'] = 'Users skipped';
|
||||
$string['usersupdated'] = 'Users updated';
|
||||
$string['usersweakpassword'] = 'Users having a weak password';
|
||||
$string['uubulk'] = 'Select for bulk operations';
|
||||
$string['uubulkall'] = 'All users';
|
||||
$string['uubulknew'] = 'New users';
|
||||
$string['uubulkupdated'] = 'Updated users';
|
||||
$string['uucsvline'] = 'CSV line';
|
||||
$string['uulegacy1role'] = '(Original Student) typeN=1';
|
||||
$string['uulegacy2role'] = '(Original Teacher) typeN=2';
|
||||
$string['uulegacy3role'] = '(Original Non-editing teacher) typeN=3';
|
||||
$string['uunoemailduplicates'] = 'Prevent email address duplicates';
|
||||
$string['uuoptype'] = 'Upload type';
|
||||
$string['uuoptype_addinc'] = 'Add all, append number to usernames if needed';
|
||||
$string['uuoptype_addnew'] = 'Add new only, skip existing users';
|
||||
$string['uuoptype_addupdate'] = 'Add new and update existing users';
|
||||
$string['uuoptype_update'] = 'Update existing users only';
|
||||
$string['uupasswordcron'] = 'Generated in cron';
|
||||
$string['uupasswordnew'] = 'New user password';
|
||||
$string['uupasswordold'] = 'Existing user password';
|
||||
$string['uustandardusernames'] = 'Standardise usernames';
|
||||
$string['uuupdateall'] = 'Override with file and defaults';
|
||||
$string['uuupdatefromfile'] = 'Override with file';
|
||||
$string['uuupdatemissing'] = 'Fill in missing from file and defaults';
|
||||
$string['uuupdatetype'] = 'Existing user details';
|
||||
$string['uuusernametemplate'] = 'Username template';
|
@ -17,8 +17,8 @@
|
||||
/**
|
||||
* Bulk user registration functions
|
||||
*
|
||||
* @package core
|
||||
* @subpackage admin
|
||||
* @package tool
|
||||
* @subpackage uploaduser
|
||||
* @copyright 2004 onwards Martin Dougiamas (http://dougiamas.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
@ -64,10 +64,10 @@ class uu_progress_tracker {
|
||||
*/
|
||||
public function start() {
|
||||
$ci = 0;
|
||||
echo '<table id="uuresults" class="generaltable boxaligncenter flexible-wrap" summary="'.get_string('uploadusersresult', 'admin').'">';
|
||||
echo '<table id="uuresults" class="generaltable boxaligncenter flexible-wrap" summary="'.get_string('uploadusersresult', 'tool_uploaduser').'">';
|
||||
echo '<tr class="heading r0">';
|
||||
echo '<th class="header c'.$ci++.'" scope="col">'.get_string('status').'</th>';
|
||||
echo '<th class="header c'.$ci++.'" scope="col">'.get_string('uucsvline', 'admin').'</th>';
|
||||
echo '<th class="header c'.$ci++.'" scope="col">'.get_string('uucsvline', 'tool_uploaduser').'</th>';
|
||||
echo '<th class="header c'.$ci++.'" scope="col">ID</th>';
|
||||
echo '<th class="header c'.$ci++.'" scope="col">'.get_string('username').'</th>';
|
||||
echo '<th class="header c'.$ci++.'" scope="col">'.get_string('firstname').'</th>';
|
@ -1,35 +1,40 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// Copyright (C) 2007 Inaki Arenaza //
|
||||
// //
|
||||
// Based on .../admin/uploaduser.php and .../lib/gdlib.php //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
// it under the terms of the GNU General Public License as published by //
|
||||
// the Free Software Foundation; either version 2 of the License, or //
|
||||
// (at your option) any later version. //
|
||||
// //
|
||||
// This program is distributed in the hope that it will be useful, //
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||
// GNU General Public License for more details: //
|
||||
// //
|
||||
// http://www.gnu.org/copyleft/gpl.html //
|
||||
// //
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* Bulk upload of user pictures
|
||||
*
|
||||
* Based on .../admin/uploaduser.php and .../lib/gdlib.php
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage uploaduser
|
||||
* @copyright (C) 2007 Inaki Arenaza
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once('../config.php');
|
||||
require('../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/gdlib.php');
|
||||
require_once('uploadpicture_form.php');
|
||||
require_once('picture_form.php');
|
||||
|
||||
define ('PIX_FILE_UPDATED', 0);
|
||||
define ('PIX_FILE_ERROR', 1);
|
||||
define ('PIX_FILE_SKIPPED', 2);
|
||||
|
||||
admin_externalpage_setup('uploadpictures');
|
||||
admin_externalpage_setup('tooluploaduserpictures');
|
||||
|
||||
require_login();
|
||||
|
||||
@ -43,8 +48,8 @@ if (!$adminuser = get_admin()) {
|
||||
|
||||
$strfile = get_string('file');
|
||||
$struser = get_string('user');
|
||||
$strusersupdated = get_string('usersupdated', 'admin');
|
||||
$struploadpictures = get_string('uploadpictures','admin');
|
||||
$strusersupdated = get_string('usersupdated', 'tool_uploaduser');
|
||||
$struploadpictures = get_string('uploadpictures','tool_uploaduser');
|
||||
|
||||
$userfields = array (
|
||||
0 => 'username',
|
||||
@ -57,12 +62,12 @@ $overwritepicture = optional_param('overwritepicture', 0, PARAM_BOOL);
|
||||
/// Print the header
|
||||
echo $OUTPUT->header();
|
||||
|
||||
echo $OUTPUT->heading_with_help($struploadpictures, 'uploadpictures', 'admin');
|
||||
echo $OUTPUT->heading_with_help($struploadpictures, 'uploadpictures', 'tool_uploaduser');
|
||||
|
||||
$mform = new admin_uploadpicture_form(null, $userfields);
|
||||
if ($formdata = $mform->get_data()) {
|
||||
if (!array_key_exists($userfield, $userfields)) {
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_baduserfield','admin'));
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_baduserfield', 'tool_uploaduser'));
|
||||
} else {
|
||||
// Large files are likely to take their time and memory. Let PHP know
|
||||
// that we'll take longer, and that the process should be recycled soon
|
||||
@ -76,13 +81,13 @@ if ($formdata = $mform->get_data()) {
|
||||
$dstfile = $zipdir.'/images.zip';
|
||||
|
||||
if (!$mform->save_file('userpicturesfile', $dstfile, true)) {
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_cannotmovezip','admin'));
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_cannotmovezip', 'tool_uploaduser'));
|
||||
@remove_dir($zipdir);
|
||||
} else {
|
||||
$fp = get_file_packer('application/zip');
|
||||
$unzipresult = $fp->extract_to_pathname($dstfile, $zipdir);
|
||||
if (!$unzipresult) {
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_cannotunzip','admin'));
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_cannotunzip', 'tool_uploaduser'));
|
||||
@remove_dir($zipdir);
|
||||
} else {
|
||||
// We don't need the zip file any longer, so delete it to make
|
||||
@ -96,8 +101,8 @@ if ($formdata = $mform->get_data()) {
|
||||
|
||||
// Finally remove the temporary directory with all the user images and print some stats.
|
||||
remove_dir($zipdir);
|
||||
echo $OUTPUT->notification(get_string('usersupdated', 'admin') . ": " . $results['updated']);
|
||||
echo $OUTPUT->notification(get_string('errors', 'admin') . ": " . $results['errors']);
|
||||
echo $OUTPUT->notification(get_string('usersupdated', 'tool_uploaduser') . ": " . $results['updated'], 'notifysuccess');
|
||||
echo $OUTPUT->notification(get_string('errors', 'tool_uploaduser') . ": " . $results['errors'], ($results['errors'] ? 'notifyproblem' : 'notifysuccess'));
|
||||
echo '<hr />';
|
||||
}
|
||||
}
|
||||
@ -151,7 +156,7 @@ function my_mktempdir($dir, $prefix='') {
|
||||
function process_directory ($dir, $userfield, $overwrite, &$results) {
|
||||
global $OUTPUT;
|
||||
if(!($handle = opendir($dir))) {
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_cannotprocessdir','admin'));
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_cannotprocessdir', 'tool_uploaduser'));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -211,22 +216,22 @@ function process_file ($file, $userfield, $overwrite) {
|
||||
$a = new stdClass();
|
||||
$a->userfield = clean_param($userfield, PARAM_CLEANHTML);
|
||||
$a->uservalue = clean_param($uservalue, PARAM_CLEANHTML);
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_usernotfound', 'admin', $a));
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_usernotfound', 'tool_uploaduser', $a));
|
||||
return PIX_FILE_ERROR;
|
||||
}
|
||||
|
||||
$haspicture = $DB->get_field('user', 'picture', array('id'=>$user->id));
|
||||
if ($haspicture && !$overwrite) {
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_userskipped', 'admin', $user->username));
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_userskipped', 'tool_uploaduser', $user->username));
|
||||
return PIX_FILE_SKIPPED;
|
||||
}
|
||||
|
||||
if (my_save_profile_image($user->id, $file)) {
|
||||
$DB->set_field('user', 'picture', 1, array('id'=>$user->id));
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_userupdated', 'admin', $user->username));
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_userupdated', 'tool_uploaduser', $user->username), 'notifysuccess');
|
||||
return PIX_FILE_UPDATED;
|
||||
} else {
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_cannotsave', 'admin', $user->username));
|
||||
echo $OUTPUT->notification(get_string('uploadpicture_cannotsave', 'tool_uploaduser', $user->username));
|
||||
return PIX_FILE_ERROR;
|
||||
}
|
||||
}
|
55
admin/tool/uploaduser/picture_form.php
Normal file
55
admin/tool/uploaduser/picture_form.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Bulk user picture upload form
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage uploaduser
|
||||
* @copyright (C) 2007 Inaki Arenaza
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once $CFG->libdir.'/formslib.php';
|
||||
|
||||
class admin_uploadpicture_form extends moodleform {
|
||||
function definition (){
|
||||
global $CFG, $USER;
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
||||
$mform->addElement('header', 'settingsheader', get_string('upload'));
|
||||
|
||||
|
||||
$options = array();
|
||||
$options['accepted_types'] = array('archive');
|
||||
$mform->addElement('filepicker', 'userpicturesfile', get_string('file'), 'size="40"', $options);
|
||||
$mform->addRule('userpicturesfile', null, 'required');
|
||||
|
||||
$choices =& $this->_customdata;
|
||||
$mform->addElement('select', 'userfield', get_string('uploadpicture_userfield', 'tool_uploaduser'), $choices);
|
||||
$mform->setType('userfield', PARAM_INT);
|
||||
|
||||
$choices = array( 0 => get_string('no'), 1 => get_string('yes') );
|
||||
$mform->addElement('select', 'overwritepicture', get_string('uploadpicture_overwrite', 'tool_uploaduser'), $choices);
|
||||
$mform->setType('overwritepicture', PARAM_INT);
|
||||
|
||||
$this->add_action_buttons(false, get_string('uploadpictures', 'tool_uploaduser'));
|
||||
}
|
||||
}
|
||||
|
31
admin/tool/uploaduser/settings.php
Normal file
31
admin/tool/uploaduser/settings.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Link to CSV user upload
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage uploaduser
|
||||
* @copyright 2010 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
if (has_capability('moodle/site:uploadusers', $systemcontext)) {
|
||||
$ADMIN->add('accounts', new admin_externalpage('tooluploaduser', get_string('uploadusers', 'tool_uploaduser'), "$CFG->wwwroot/$CFG->admin/tool/uploaduser/index.php", 'moodle/site:uploadusers'));
|
||||
$ADMIN->add('accounts', new admin_externalpage('tooluploaduserpictures', get_string('uploadpictures','tool_uploaduser'), "$CFG->wwwroot/$CFG->admin/tool/uploaduser/picture.php", 'moodle/site:uploadusers'));
|
||||
}
|
@ -17,8 +17,8 @@
|
||||
/**
|
||||
* Bulk user upload forms
|
||||
*
|
||||
* @package core
|
||||
* @subpackage admin
|
||||
* @package tool
|
||||
* @subpackage uploaduser
|
||||
* @copyright 2007 Dan Poltawski
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
@ -31,8 +31,6 @@ require_once $CFG->libdir.'/formslib.php';
|
||||
/**
|
||||
* Upload a file CVS file with user information.
|
||||
*
|
||||
* @package core
|
||||
* @subpackage admin
|
||||
* @copyright 2007 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
@ -46,7 +44,7 @@ class admin_uploaduser_form1 extends moodleform {
|
||||
$mform->addRule('userfile', null, 'required');
|
||||
|
||||
$choices = csv_import_reader::get_delimiter_list();
|
||||
$mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'admin'), $choices);
|
||||
$mform->addElement('select', 'delimiter_name', get_string('csvdelimiter', 'tool_uploaduser'), $choices);
|
||||
if (array_key_exists('cfg', $choices)) {
|
||||
$mform->setDefault('delimiter_name', 'cfg');
|
||||
} else if (get_string('listsep', 'langconfig') == ';') {
|
||||
@ -57,14 +55,14 @@ class admin_uploaduser_form1 extends moodleform {
|
||||
|
||||
$textlib = textlib_get_instance();
|
||||
$choices = $textlib->get_encodings();
|
||||
$mform->addElement('select', 'encoding', get_string('encoding', 'admin'), $choices);
|
||||
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_uploaduser'), $choices);
|
||||
$mform->setDefault('encoding', 'UTF-8');
|
||||
|
||||
$choices = array('10'=>10, '20'=>20, '100'=>100, '1000'=>1000, '100000'=>100000);
|
||||
$mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'admin'), $choices);
|
||||
$mform->addElement('select', 'previewrows', get_string('rowpreviewnum', 'tool_uploaduser'), $choices);
|
||||
$mform->setType('previewrows', PARAM_INT);
|
||||
|
||||
$this->add_action_buttons(false, get_string('uploadusers', 'admin'));
|
||||
$this->add_action_buttons(false, get_string('uploadusers', 'tool_uploaduser'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,8 +70,6 @@ class admin_uploaduser_form1 extends moodleform {
|
||||
/**
|
||||
* Specify user upload details
|
||||
*
|
||||
* @package core
|
||||
* @subpackage admin
|
||||
* @copyright 2007 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
@ -91,35 +87,35 @@ class admin_uploaduser_form2 extends moodleform {
|
||||
// upload settings and file
|
||||
$mform->addElement('header', 'settingsheader', get_string('settings'));
|
||||
|
||||
$choices = array(UU_USER_ADDNEW => get_string('uuoptype_addnew', 'admin'),
|
||||
UU_USER_ADDINC => get_string('uuoptype_addinc', 'admin'),
|
||||
UU_USER_ADD_UPDATE => get_string('uuoptype_addupdate', 'admin'),
|
||||
UU_USER_UPDATE => get_string('uuoptype_update', 'admin'));
|
||||
$mform->addElement('select', 'uutype', get_string('uuoptype', 'admin'), $choices);
|
||||
$choices = array(UU_USER_ADDNEW => get_string('uuoptype_addnew', 'tool_uploaduser'),
|
||||
UU_USER_ADDINC => get_string('uuoptype_addinc', 'tool_uploaduser'),
|
||||
UU_USER_ADD_UPDATE => get_string('uuoptype_addupdate', 'tool_uploaduser'),
|
||||
UU_USER_UPDATE => get_string('uuoptype_update', 'tool_uploaduser'));
|
||||
$mform->addElement('select', 'uutype', get_string('uuoptype', 'tool_uploaduser'), $choices);
|
||||
|
||||
$choices = array(0 => get_string('infilefield', 'auth'), 1 => get_string('createpasswordifneeded', 'auth'));
|
||||
$mform->addElement('select', 'uupasswordnew', get_string('uupasswordnew', 'admin'), $choices);
|
||||
$mform->addElement('select', 'uupasswordnew', get_string('uupasswordnew', 'tool_uploaduser'), $choices);
|
||||
$mform->setDefault('uupasswordnew', 1);
|
||||
$mform->disabledIf('uupasswordnew', 'uutype', 'eq', UU_USER_UPDATE);
|
||||
|
||||
$choices = array(UU_UPDATE_NOCHANGES => get_string('nochanges', 'admin'),
|
||||
UU_UPDATE_FILEOVERRIDE => get_string('uuupdatefromfile', 'admin'),
|
||||
UU_UPDATE_ALLOVERRIDE => get_string('uuupdateall', 'admin'),
|
||||
UU_UPDATE_MISSING => get_string('uuupdatemissing', 'admin'));
|
||||
$mform->addElement('select', 'uuupdatetype', get_string('uuupdatetype', 'admin'), $choices);
|
||||
$choices = array(UU_UPDATE_NOCHANGES => get_string('nochanges', 'tool_uploaduser'),
|
||||
UU_UPDATE_FILEOVERRIDE => get_string('uuupdatefromfile', 'tool_uploaduser'),
|
||||
UU_UPDATE_ALLOVERRIDE => get_string('uuupdateall', 'tool_uploaduser'),
|
||||
UU_UPDATE_MISSING => get_string('uuupdatemissing', 'tool_uploaduser'));
|
||||
$mform->addElement('select', 'uuupdatetype', get_string('uuupdatetype', 'tool_uploaduser'), $choices);
|
||||
$mform->setDefault('uuupdatetype', UU_UPDATE_NOCHANGES);
|
||||
$mform->disabledIf('uuupdatetype', 'uutype', 'eq', UU_USER_ADDNEW);
|
||||
$mform->disabledIf('uuupdatetype', 'uutype', 'eq', UU_USER_ADDINC);
|
||||
|
||||
$choices = array(0 => get_string('nochanges', 'admin'), 1 => get_string('update'));
|
||||
$mform->addElement('select', 'uupasswordold', get_string('uupasswordold', 'admin'), $choices);
|
||||
$choices = array(0 => get_string('nochanges', 'tool_uploaduser'), 1 => get_string('update'));
|
||||
$mform->addElement('select', 'uupasswordold', get_string('uupasswordold', 'tool_uploaduser'), $choices);
|
||||
$mform->setDefault('uupasswordold', 0);
|
||||
$mform->disabledIf('uupasswordold', 'uutype', 'eq', UU_USER_ADDNEW);
|
||||
$mform->disabledIf('uupasswordold', 'uutype', 'eq', UU_USER_ADDINC);
|
||||
$mform->disabledIf('uupasswordold', 'uuupdatetype', 'eq', 0);
|
||||
$mform->disabledIf('uupasswordold', 'uuupdatetype', 'eq', 3);
|
||||
|
||||
$choices = array(UU_PWRESET_WEAK => get_string('usersweakpassword', 'admin'),
|
||||
$choices = array(UU_PWRESET_WEAK => get_string('usersweakpassword', 'tool_uploaduser'),
|
||||
UU_PWRESET_NONE => get_string('none'),
|
||||
UU_PWRESET_ALL => get_string('all'));
|
||||
if (empty($CFG->passwordpolicy)) {
|
||||
@ -128,27 +124,27 @@ class admin_uploaduser_form2 extends moodleform {
|
||||
$mform->addElement('select', 'uuforcepasswordchange', get_string('forcepasswordchange', 'core'), $choices);
|
||||
|
||||
|
||||
$mform->addElement('selectyesno', 'uuallowrenames', get_string('allowrenames', 'admin'));
|
||||
$mform->addElement('selectyesno', 'uuallowrenames', get_string('allowrenames', 'tool_uploaduser'));
|
||||
$mform->setDefault('uuallowrenames', 0);
|
||||
$mform->disabledIf('uuallowrenames', 'uutype', 'eq', UU_USER_ADDNEW);
|
||||
$mform->disabledIf('uuallowrenames', 'uutype', 'eq', UU_USER_ADDINC);
|
||||
|
||||
$mform->addElement('selectyesno', 'uuallowdeletes', get_string('allowdeletes', 'admin'));
|
||||
$mform->addElement('selectyesno', 'uuallowdeletes', get_string('allowdeletes', 'tool_uploaduser'));
|
||||
$mform->setDefault('uuallowdeletes', 0);
|
||||
$mform->disabledIf('uuallowdeletes', 'uutype', 'eq', UU_USER_ADDNEW);
|
||||
$mform->disabledIf('uuallowdeletes', 'uutype', 'eq', UU_USER_ADDINC);
|
||||
|
||||
$mform->addElement('selectyesno', 'uunoemailduplicates', get_string('uunoemailduplicates', 'admin'));
|
||||
$mform->addElement('selectyesno', 'uunoemailduplicates', get_string('uunoemailduplicates', 'tool_uploaduser'));
|
||||
$mform->setDefault('uunoemailduplicates', 1);
|
||||
|
||||
$mform->addElement('selectyesno', 'uustandardusernames', get_string('uustandardusernames', 'admin'));
|
||||
$mform->addElement('selectyesno', 'uustandardusernames', get_string('uustandardusernames', 'tool_uploaduser'));
|
||||
$mform->setDefault('uustandardusernames', 1);
|
||||
|
||||
$choices = array(UU_BULK_NONE => get_string('no'),
|
||||
UU_BULK_NEW => get_string('uubulknew', 'admin'),
|
||||
UU_BULK_UPDATED => get_string('uubulkupdated', 'admin'),
|
||||
UU_BULK_ALL => get_string('uubulkall', 'admin'));
|
||||
$mform->addElement('select', 'uubulk', get_string('uubulk', 'admin'), $choices);
|
||||
UU_BULK_NEW => get_string('uubulknew', 'tool_uploaduser'),
|
||||
UU_BULK_UPDATED => get_string('uubulkupdated', 'tool_uploaduser'),
|
||||
UU_BULK_ALL => get_string('uubulkall', 'tool_uploaduser'));
|
||||
$mform->addElement('select', 'uubulk', get_string('uubulk', 'tool_uploaduser'), $choices);
|
||||
$mform->setDefault('uubulk', 0);
|
||||
|
||||
// roles selection
|
||||
@ -164,7 +160,7 @@ class admin_uploaduser_form2 extends moodleform {
|
||||
|
||||
$choices = uu_allowed_roles(true);
|
||||
|
||||
$mform->addElement('select', 'uulegacy1', get_string('uulegacy1role', 'admin'), $choices);
|
||||
$mform->addElement('select', 'uulegacy1', get_string('uulegacy1role', 'tool_uploaduser'), $choices);
|
||||
if ($studentroles = get_archetype_roles('student')) {
|
||||
foreach ($studentroles as $role) {
|
||||
if (isset($choices[$role->id])) {
|
||||
@ -175,7 +171,7 @@ class admin_uploaduser_form2 extends moodleform {
|
||||
unset($studentroles);
|
||||
}
|
||||
|
||||
$mform->addElement('select', 'uulegacy2', get_string('uulegacy2role', 'admin'), $choices);
|
||||
$mform->addElement('select', 'uulegacy2', get_string('uulegacy2role', 'tool_uploaduser'), $choices);
|
||||
if ($editteacherroles = get_archetype_roles('editingteacher')) {
|
||||
foreach ($editteacherroles as $role) {
|
||||
if (isset($choices[$role->id])) {
|
||||
@ -186,7 +182,7 @@ class admin_uploaduser_form2 extends moodleform {
|
||||
unset($editteacherroles);
|
||||
}
|
||||
|
||||
$mform->addElement('select', 'uulegacy3', get_string('uulegacy3role', 'admin'), $choices);
|
||||
$mform->addElement('select', 'uulegacy3', get_string('uulegacy3role', 'tool_uploaduser'), $choices);
|
||||
if ($teacherroles = get_archetype_roles('teacher')) {
|
||||
foreach ($teacherroles as $role) {
|
||||
if (isset($choices[$role->id])) {
|
||||
@ -199,10 +195,10 @@ class admin_uploaduser_form2 extends moodleform {
|
||||
}
|
||||
|
||||
// default values
|
||||
$mform->addElement('header', 'defaultheader', get_string('defaultvalues', 'admin'));
|
||||
$mform->addElement('header', 'defaultheader', get_string('defaultvalues', 'tool_uploaduser'));
|
||||
|
||||
$mform->addElement('text', 'username', get_string('uuusernametemplate', 'admin'), 'size="20"');
|
||||
$mform->addRule('username', get_string('requiredtemplate', 'admin'), 'required', null, 'client');
|
||||
$mform->addElement('text', 'username', get_string('uuusernametemplate', 'tool_uploaduser'), 'size="20"');
|
||||
$mform->addRule('username', get_string('requiredtemplate', 'tool_uploaduser'), 'required', null, 'client');
|
||||
$mform->disabledIf('username', 'uutype', 'eq', UU_USER_ADD_UPDATE);
|
||||
$mform->disabledIf('username', 'uutype', 'eq', UU_USER_UPDATE);
|
||||
|
||||
@ -326,7 +322,7 @@ class admin_uploaduser_form2 extends moodleform {
|
||||
$mform->addElement('hidden', 'previewrows');
|
||||
$mform->setType('previewrows', PARAM_INT);
|
||||
|
||||
$this->add_action_buttons(true, get_string('uploadusers', 'admin'));
|
||||
$this->add_action_buttons(true, get_string('uploadusers', 'tool_uploaduser'));
|
||||
|
||||
$this->set_data($data);
|
||||
}
|
||||
@ -407,7 +403,7 @@ class admin_uploaduser_form2 extends moodleform {
|
||||
}
|
||||
|
||||
if (!in_array('email', $columns) and empty($data['email'])) {
|
||||
$errors['email'] = get_string('requiredtemplate', 'admin');
|
||||
$errors['email'] = get_string('requiredtemplate', 'tool_uploaduser');
|
||||
}
|
||||
}
|
||||
|
30
admin/tool/uploaduser/version.php
Normal file
30
admin/tool/uploaduser/version.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Plugin version info
|
||||
*
|
||||
* @package tool
|
||||
* @subpackage uploaduser
|
||||
* @copyright 2011 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2011091700; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2011091600; // Requires this Moodle version
|
||||
$plugin->component = 'tool_uploaduser'; // Full name of the plugin (used for diagnostics)
|
||||
|
@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
||||
}
|
||||
|
||||
require_once $CFG->libdir.'/formslib.php';
|
||||
|
||||
class admin_uploadpicture_form extends moodleform {
|
||||
function definition (){
|
||||
global $CFG, $USER;
|
||||
|
||||
$mform =& $this->_form;
|
||||
|
||||
$mform->addElement('header', 'settingsheader', get_string('upload'));
|
||||
|
||||
|
||||
$options = array();
|
||||
$options['accepted_types'] = array('archive');
|
||||
$mform->addElement('filepicker', 'userpicturesfile', get_string('file'), 'size="40"', $options);
|
||||
$mform->addRule('userpicturesfile', null, 'required');
|
||||
|
||||
$choices =& $this->_customdata;
|
||||
$mform->addElement('select', 'userfield', get_string('uploadpicture_userfield', 'admin'), $choices);
|
||||
$mform->setType('userfield', PARAM_INT);
|
||||
|
||||
$choices = array( 0 => get_string('no'), 1 => get_string('yes') );
|
||||
$mform->addElement('select', 'overwritepicture', get_string('uploadpicture_overwrite', 'admin'), $choices);
|
||||
$mform->setType('overwritepicture', PARAM_INT);
|
||||
|
||||
$this->add_action_buttons(false, get_string('uploadpictures', 'admin'));
|
||||
}
|
||||
}
|
||||
|
@ -44,13 +44,11 @@ $string['allowbeforeblockdesc'] = 'By default, entries in the blocked IPs list a
|
||||
$string['allowblockstodock'] = 'Allow blocks to use the dock';
|
||||
$string['allowcategorythemes'] = 'Allow category themes';
|
||||
$string['allowcoursethemes'] = 'Allow course themes';
|
||||
$string['allowdeletes'] = 'Allow deletes';
|
||||
$string['allowediplist'] = 'Allowed IP list';
|
||||
$string['allowemailaddresses'] = 'Allowed email domains';
|
||||
$string['allowframembedding'] = 'Allow frame embedding';
|
||||
$string['allowframembedding_help'] = 'Allow embedding of this site in frames on external sites. Enabling of this feature is not recommended for security reasons.';
|
||||
$string['allowobjectembed'] = 'Allow EMBED and OBJECT tags';
|
||||
$string['allowrenames'] = 'Allow renames';
|
||||
$string['allowthemechangeonurl'] = 'Allow theme changes in the URL';
|
||||
$string['allowuserblockhiding'] = 'Allow users to hide blocks';
|
||||
$string['allowuserswitchrolestheycantassign'] = 'Allow users without the assign roles capability to switch roles';
|
||||
@ -373,7 +371,6 @@ $string['cronerrorclionly'] = 'Sorry, internet access to this page has been disa
|
||||
$string['cronerrorpassword'] = 'Sorry, you have not provided a valid password to access this page';
|
||||
$string['cronremotepassword'] = 'Cron password for remote access';
|
||||
$string['cronwarning'] = 'The <a href="cron.php">cron.php maintenance script</a> has not been run for at least 24 hours.';
|
||||
$string['csvdelimiter'] = 'CSV delimiter';
|
||||
$string['ctyperecommended'] = 'Installing the optional ctype PHP extension is highly recommended in order to improve site performance, particularly if your site is supporting non-latin languages.';
|
||||
$string['ctyperequired'] = 'The ctype PHP extension is now required by Moodle, in order to improve site performance and to offer multilingual compatibility.';
|
||||
$string['curlcache'] = 'cURL cache TTL';
|
||||
@ -415,8 +412,6 @@ $string['defaulthomepage'] = 'Default home page for users';
|
||||
$string['defaultrequestcategory'] = 'Default category for course requests';
|
||||
$string['defaultsettinginfo'] = 'Default: {$a}';
|
||||
$string['defaultuserroleid'] = 'Default role for all users';
|
||||
$string['defaultvalues'] = 'Default values';
|
||||
$string['deleteerrors'] = 'Delete errors';
|
||||
$string['deletefilterareyousure'] = 'Are you sure you want to delete the filter \'{$a}\'';
|
||||
$string['deletefilterareyousuremessage'] = 'You are about to completely delete the filter \'{$a}\'. Are you sure you want to uninstall it?';
|
||||
$string['deletefilterfiles'] = 'All data associated with the filter \'{$a->filter}\' has been deleted from the database. To complete the deletion (and to prevent the filter from re-installing itself), you should now delete this directory from your server: {$a->directory}';
|
||||
@ -484,7 +479,6 @@ $string['enablestats'] = 'Enable statistics';
|
||||
$string['enabletrusttext'] = 'Enable trusted content';
|
||||
$string['enablewebservices'] = 'Enable web services';
|
||||
$string['enablewsdocumentation'] = 'Web services documentation';
|
||||
$string['encoding'] = 'Encoding';
|
||||
$string['enrolinstancedefaults'] = 'Enrolment instance defaults';
|
||||
$string['enrolinstancedefaults_desc'] = 'Default enrolment settings in new courses.';
|
||||
$string['enrolmultipleusers'] = 'Enrol the users';
|
||||
@ -503,7 +497,6 @@ $string['environmentsettingok'] = 'recommended setting detected';
|
||||
$string['environmentshouldfixsetting'] = 'PHP setting should be changed.';
|
||||
$string['environmentxmlerror'] = 'Error reading environment data ({$a->error_code})';
|
||||
$string['errordeletingconfig'] = 'An error occurred while deleting the configuration records for plugin \'{$a}\'.';
|
||||
$string['errors'] = 'Errors';
|
||||
$string['errorsetting'] = 'Could not save setting:';
|
||||
$string['errorwithsettings'] = 'Some settings were not changed due to an error.';
|
||||
$string['everyonewhocan'] = 'Everyone who can \'{$a}\'';
|
||||
@ -702,7 +695,6 @@ $string['navshowcategories'] = 'Show course categories';
|
||||
$string['neverdeleteruns'] = 'Never delete runs';
|
||||
$string['nobookmarksforuser'] = 'You do not have any bookmarks.';
|
||||
$string['nodatabase'] = 'No database';
|
||||
$string['nochanges'] = 'No changes';
|
||||
$string['nohttpsformobilewarning'] = 'It is recommended to enable HTTPS with a valid certificate. The Moodle app will always try to use a secured connection first.';
|
||||
$string['nomissingstrings'] = 'No missing strings';
|
||||
$string['nonewsettings'] = 'No new settings were added during this upgrade.';
|
||||
@ -844,10 +836,8 @@ $string['registration'] = 'Registration';
|
||||
$string['releasenoteslink'] = 'For information about this version of Moodle, please see the online <a target="_blank" href="{$a}">Release Notes</a>';
|
||||
$string['rememberusername'] = 'Remember username';
|
||||
$string['rememberusername_desc'] = 'Enable if you want to store permanent cookies with usernames during user login. Permanent cookies may be considered a privacy issue if used without consent.';
|
||||
$string['renameerrors'] = 'Rename errors';
|
||||
$string['requiredentrieschanged'] = '<strong>IMPORTANT - PLEASE READ<br/>(This warning message will only be displayed during this upgrade)</strong><br/>Due to a bug fix, the behaviour of database activities using the \'Required entries\' and \'Required entries before viewing settings\' settings will change. A more detailed explanation of the changes can be read on <a href="http://moodle.org/mod/forum/discuss.php?d=110928" target="_blank">the database module forum</a>. The expected behavior of these settings can also be read on <a href="http://docs.moodle.org/en/Adding/editing_a_database#Required_entries" target="_blank">Moodle Docs</a>.
|
||||
<br/><br/>This change affects the following databases in your system: (Please save this list now, and after the upgrade, check that these activities still work the way that the teacher intends.)<br/><strong>{$a->text}</strong><br/>';
|
||||
$string['requiredtemplate'] = 'Required. You may use template syntax here (%l = lastname, %f = firstname, %u = username). See help for details and examples.';
|
||||
$string['requiremodintro'] = 'Require activity description';
|
||||
$string['requires'] = 'Requires';
|
||||
$string['purgecaches']= 'Purge all caches';
|
||||
@ -869,7 +859,6 @@ $string['riskspamshort'] = 'Spam risk';
|
||||
$string['riskxss'] = 'Users could add files and texts that allow cross-site scripting (XSS)';
|
||||
$string['riskxssshort'] = 'XSS risk';
|
||||
$string['roleswithexceptions'] = '{$a->roles}, with {$a->exceptions}';
|
||||
$string['rowpreviewnum'] = 'Preview rows';
|
||||
$string['rssglobaldisabled'] = 'Disabled at server level';
|
||||
$string['runclamavonupload'] = 'Use clam AV on uploaded files';
|
||||
$string['save'] = 'Save';
|
||||
@ -978,75 +967,19 @@ $string['upgrade197salt'] = 'To reduce the risk of password theft, you are stron
|
||||
$string['upgradingdata'] = 'Upgrading data';
|
||||
$string['upgradinglogs'] = 'Upgrading logs';
|
||||
$string['upgradingversion'] = 'Upgrading to new version';
|
||||
$string['uploadpicture_baduserfield'] = 'The user attribute specified is not valid. Please, try again.';
|
||||
$string['uploadpicture_cannotmovezip'] = 'Cannot move zip file to temporary directory.';
|
||||
$string['uploadpicture_cannotprocessdir'] = 'Cannot process unzipped files.';
|
||||
$string['uploadpicture_cannotsave'] = 'Cannot save picture for user {$a}. Check original picture file.';
|
||||
$string['uploadpicture_cannotunzip'] = 'Cannot unzip pictures file.';
|
||||
$string['uploadpicture_invalidfilename'] = 'Picture file {$a} has invalid characters in its name. Skipping.';
|
||||
$string['uploadpicture_overwrite'] = 'Overwrite existing user pictures?';
|
||||
$string['uploadpictures'] = 'Upload user pictures';
|
||||
$string['uploadpictures_help'] = 'User pictures can be uploaded as a zip file of image files. The image files should be named chosen-user-attribute.extension, for example user1234.jpg for a user with username user1234.';
|
||||
$string['uploadpicture_userfield'] = 'User attribute to use to match pictures:';
|
||||
$string['uploadpicture_usernotfound'] = 'User with a \'{$a->userfield}\' value of \'{$a->uservalue}\' does not exist. Skipping.';
|
||||
$string['uploadpicture_userskipped'] = 'Skipping user {$a} (already has a picture).';
|
||||
$string['uploadpicture_userupdated'] = 'Picture updated for user {$a}.';
|
||||
$string['uploadusers'] = 'Upload users';
|
||||
$string['uploadusers_help'] = 'Users may be uploaded (and optionally enrolled in courses) via text file. The format of the file should be as follows:
|
||||
|
||||
* Each line of the file contains one record
|
||||
* Each record is a series of data separated by commas (or other delimiters)
|
||||
* The first record contains a list of fieldnames defining the format of the rest of the file
|
||||
* Required fieldnames are username, password, firstname, lastname, email';
|
||||
$string['uploadusers_link'] = 'admin/uploaduser';
|
||||
$string['uploaduserspreview'] = 'Upload users preview';
|
||||
$string['uploadusersresult'] = 'Upload users results';
|
||||
$string['upwards'] = 'upwards';
|
||||
$string['useblogassociations'] = 'Enable associations';
|
||||
$string['useexternalyui'] = 'Use online YUI libraries';
|
||||
$string['usehtmleditor'] = 'Use HTML editor';
|
||||
$string['user'] = 'User';
|
||||
$string['useraccountupdated'] = 'User updated';
|
||||
$string['useraccountuptodate'] = 'User up-to-date';
|
||||
$string['userbulk'] = 'Bulk user actions';
|
||||
$string['userdeleted'] = 'User deleted';
|
||||
$string['userlist'] = 'Browse list of users';
|
||||
$string['userpreference'] = 'User preference';
|
||||
$string['userpolicies'] = 'User policies';
|
||||
$string['userrenamed'] = 'User renamed';
|
||||
$string['users'] = 'Users';
|
||||
$string['userscreated'] = 'Users created';
|
||||
$string['usersdeleted'] = 'Users deleted';
|
||||
$string['usersrenamed'] = 'Users renamed';
|
||||
$string['usersskipped'] = 'Users skipped';
|
||||
$string['usersupdated'] = 'Users updated';
|
||||
$string['usersweakpassword'] = 'Users having a weak password';
|
||||
$string['userquota'] = 'User quota';
|
||||
$string['usesitenameforsitepages'] = 'Use site name for site pages';
|
||||
$string['usetags'] = 'Enable tags functionality';
|
||||
$string['uubulk'] = 'Select for bulk operations';
|
||||
$string['uubulkall'] = 'All users';
|
||||
$string['uubulknew'] = 'New users';
|
||||
$string['uubulkupdated'] = 'Updated users';
|
||||
$string['uucsvline'] = 'CSV line';
|
||||
$string['uulegacy1role'] = '(Original Student) typeN=1';
|
||||
$string['uulegacy2role'] = '(Original Teacher) typeN=2';
|
||||
$string['uulegacy3role'] = '(Original Non-editing teacher) typeN=3';
|
||||
$string['uunoemailduplicates'] = 'Prevent email address duplicates';
|
||||
$string['uuoptype'] = 'Upload type';
|
||||
$string['uuoptype_addinc'] = 'Add all, append number to usernames if needed';
|
||||
$string['uuoptype_addnew'] = 'Add new only, skip existing users';
|
||||
$string['uuoptype_addupdate'] = 'Add new and update existing users';
|
||||
$string['uuoptype_update'] = 'Update existing users only';
|
||||
$string['uupasswordcron'] = 'Generated in cron';
|
||||
$string['uupasswordnew'] = 'New user password';
|
||||
$string['uupasswordold'] = 'Existing user password';
|
||||
$string['uustandardusernames'] = 'Standardise usernames';
|
||||
$string['uuupdateall'] = 'Override with file and defaults';
|
||||
$string['uuupdatefromfile'] = 'Override with file';
|
||||
$string['uuupdatemissing'] = 'Fill in missing from file and defaults';
|
||||
$string['uuupdatetype'] = 'Existing user details';
|
||||
$string['uuusernametemplate'] = 'Username template';
|
||||
$string['validateerror'] = 'This value was not valid:';
|
||||
$string['verifychangedemail'] = 'Restrict domains when changing email';
|
||||
$string['warningcurrentsetting'] = 'Invalid current value: {$a}';
|
||||
|
@ -369,7 +369,7 @@ class plugin_manager {
|
||||
'tool' => array(
|
||||
'bloglevelupgrade', 'capability', 'dbtransfer', 'generator',
|
||||
'health', 'innodb', 'langimport', 'multilangupgrade',
|
||||
'profiling', 'unittest', 'unsuproles', 'xmldb'
|
||||
'profiling', 'unittest', 'uploaduser', 'unsuproles', 'xmldb'
|
||||
),
|
||||
|
||||
'webservice' => array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user