Skip to content

Commit

Permalink
Merge branch 'MDL-32137-master-1' of git://git.luns.net.uk/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Hemelryk committed Apr 3, 2012
2 parents c9d1f43 + de132c2 commit cad96a8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
1 change: 0 additions & 1 deletion lang/en/message.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
$string['nomessagesfound'] = 'No messages were found';
$string['noreply'] = 'Do not reply to this message';
$string['nosearchresults'] = 'There were no results from your search';
$string['notpermitted'] = 'Not permitted';
$string['offline'] = 'Offline';
$string['offlinecontacts'] = 'Offline contacts ({$a})';
$string['online'] = 'Online';
Expand Down
39 changes: 16 additions & 23 deletions message/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.']';
Expand Down

0 comments on commit cad96a8

Please sign in to comment.