Skip to content
Browse files

Merge branch 'MDL-32137-MOODLE_22_STABLE-1' of git://git.luns.net.uk/…

…moodle into MOODLE_22_STABLE
  • Loading branch information...
2 parents 8c6bc1e + 4f4bf67 commit 729ef697055379ea51e2e59b5b6bb74817579f85 Sam Hemelryk committed Apr 4, 2012
Showing with 16 additions and 23 deletions.
  1. +16 −23 message/renderer.php
View
39 message/renderer.php
@@ -262,40 +262,33 @@ public function manage_messagingoptions($processors, $providers, $preferences, $
if (isset($defaultpreferences->{$defaultpreference})) {
$permitted = $defaultpreferences->{$defaultpreference};
}
- // If settings are disallowed, just display the message that
- // the setting is not permitted, if not use user settings or
- // force them.
- if ($permitted == 'disallowed') {
+ // If settings are disallowed or forced, just display the
+ // corresponding message, if not use user settings.
+ if (in_array($permitted, array('disallowed', 'forced'))) {
if ($state == 'loggedoff') {
// skip if we are rendering the second line
continue;
}
- $cellcontent = html_writer::nonempty_tag('div', get_string('notpermitted', 'message'), array('class' => 'dimmed_text'));
+ $cellcontent = html_writer::nonempty_tag('div', get_string($permitted, 'message'), array('class' => 'dimmed_text'));
$optioncell = new html_table_cell($cellcontent);
$optioncell->rowspan = 2;
$optioncell->attributes['class'] = 'disallowed';
} else {
- // determine user preferences and use then unless we force
- // the preferences.
+ // determine user preferences and use them.
$disabled = array();
- if ($permitted == 'forced') {
- $checked = true;
+ $checked = false;
+ if ($notificationsdisabled) {
$disabled['disabled'] = 1;
+ }
+ // See if user has touched this preference
+ if (isset($preferences->{$preferencebase.'_'.$state})) {
+ // User have some preferneces for this state in the database, use them
+ $checked = isset($preferences->{$preferencebase.'_'.$state}[$processor->name]);
} else {
- $checked = false;
- if ($notificationsdisabled) {
- $disabled['disabled'] = 1;
- }
- // See if user has touched this preference
- if (isset($preferences->{$preferencebase.'_'.$state})) {
- // User have some preferneces for this state in the database, use them
- $checked = isset($preferences->{$preferencebase.'_'.$state}[$processor->name]);
- } else {
- // User has not set this preference yet, using site default preferences set by admin
- $defaultpreference = 'message_provider_'.$preferencebase.'_'.$state;
- if (isset($defaultpreferences->{$defaultpreference})) {
- $checked = (int)in_array($processor->name, explode(',', $defaultpreferences->{$defaultpreference}));
- }
+ // User has not set this preference yet, using site default preferences set by admin
+ $defaultpreference = 'message_provider_'.$preferencebase.'_'.$state;
+ if (isset($defaultpreferences->{$defaultpreference})) {
+ $checked = (int)in_array($processor->name, explode(',', $defaultpreferences->{$defaultpreference}));
}
}
$elementname = $preferencebase.'_'.$state.'['.$processor->name.']';

0 comments on commit 729ef69

Please sign in to comment.
Something went wrong with that request. Please try again.