mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'w28_MDL-8249_m24_roletranslations' of git://github.com/skodak/moodle
Conflicts: lib/db/upgrade.php version.php
This commit is contained in:
commit
e1980f8bb9
37 changed files with 631 additions and 422 deletions
|
@ -44,10 +44,10 @@ if ($ADMIN->fulltree) {
|
|||
if (!during_initial_install()) {
|
||||
$settings->add(new admin_setting_heading('enrol_flatfile_mapping', get_string('mapping', 'enrol_flatfile'), ''));
|
||||
|
||||
$roles = $DB->get_records('role', null, '', 'id, name, shortname');
|
||||
$roles = role_fix_names(get_all_roles());
|
||||
|
||||
foreach ($roles as $id => $record) {
|
||||
$settings->add(new admin_setting_configtext('enrol_flatfile/map_'.$id, format_string($record->name), '', format_string($record->shortname)));
|
||||
foreach ($roles as $id => $role) {
|
||||
$settings->add(new admin_setting_configtext('enrol_flatfile/map_'.$id, $role->localname, '', $role->shortname));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,13 +89,13 @@ class admin_setting_ldap_rolemapping extends admin_setting {
|
|||
* @return mixed null if null, else an array
|
||||
*/
|
||||
public function get_setting() {
|
||||
$roles = get_all_roles();
|
||||
$roles = role_fix_names(get_all_roles());
|
||||
$result = array();
|
||||
foreach ($roles as $role) {
|
||||
$contexts = $this->config_read('contexts_role'.$role->id);
|
||||
$memberattribute = $this->config_read('memberattribute_role'.$role->id);
|
||||
$result[] = array('id' => $role->id,
|
||||
'name' => $role->name,
|
||||
'name' => $role->localname,
|
||||
'contexts' => $contexts,
|
||||
'memberattribute' => $memberattribute);
|
||||
}
|
||||
|
|
|
@ -450,7 +450,7 @@ class course_enrolment_manager {
|
|||
*/
|
||||
public function get_all_roles() {
|
||||
if ($this->_roles === null) {
|
||||
$this->_roles = role_fix_names(get_all_roles(), $this->context);
|
||||
$this->_roles = role_fix_names(get_all_roles($this->context), $this->context);
|
||||
}
|
||||
return $this->_roles;
|
||||
}
|
||||
|
|
|
@ -31,11 +31,7 @@ if ($ADMIN->fulltree) {
|
|||
$settings->add(new admin_setting_heading('enrol_meta_settings', '', get_string('pluginname_desc', 'enrol_meta')));
|
||||
|
||||
if (!during_initial_install()) {
|
||||
$allroles = array();
|
||||
foreach (get_all_roles() as $role) {
|
||||
$rolename = strip_tags(format_string($role->name)) . ' ('. $role->shortname . ')';
|
||||
$allroles[$role->id] = $rolename;
|
||||
}
|
||||
$allroles = role_fix_names(get_all_roles(), null, ROLENAME_ORIGINALANDSHORT, true);
|
||||
$settings->add(new admin_setting_configmultiselect('enrol_meta/nosyncroleids', get_string('nosyncroleids', 'enrol_meta'), get_string('nosyncroleids_desc', 'enrol_meta'), array(), $allroles));
|
||||
|
||||
$settings->add(new admin_setting_configcheckbox('enrol_meta/syncall', get_string('syncall', 'enrol_meta'), get_string('syncall_desc', 'enrol_meta'), 1));
|
||||
|
|
|
@ -161,19 +161,18 @@ class enrol_self_edit_form extends moodleform {
|
|||
* Gets a list of roles that this user can assign for the course as the default for self-enrolment
|
||||
*
|
||||
* @param context $context the context.
|
||||
* @param integer $defaultrole the id of the role that is set as the default for self-enrolement
|
||||
* @param integer $defaultrole the id of the role that is set as the default for self-enrolment
|
||||
* @return array index is the role id, value is the role name
|
||||
*/
|
||||
function extend_assignable_roles($context, $defaultrole) {
|
||||
global $DB;
|
||||
$roles = get_assignable_roles($context);
|
||||
$sql = "SELECT r.id, r.name
|
||||
FROM {role} r
|
||||
WHERE r.id = $defaultrole";
|
||||
$results = $DB->get_record_sql($sql);
|
||||
if (isset($results->name)) {
|
||||
$roles[$results->id] = $results->name;
|
||||
|
||||
$roles = get_assignable_roles($context, ROLENAME_BOTH);
|
||||
if (!isset($roles[$defaultrole])) {
|
||||
if ($role = $DB->get_record('role', array('id'=>$defaultrole))) {
|
||||
$roles[$defaultrole] = role_get_name($role, $context, ROLENAME_BOTH);
|
||||
}
|
||||
}
|
||||
return $roles;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,13 @@ This files describes API changes in /enrol/* - plugins,
|
|||
information provided here is intended especially for developers.
|
||||
|
||||
|
||||
=== 2.4 ===
|
||||
|
||||
required changes in code:
|
||||
* use role_get_name() or role_fix_names() if you need any role names, using role.name
|
||||
directly from database is not correct any more
|
||||
|
||||
|
||||
=== 2.2 ===
|
||||
|
||||
required changes in code:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue