MDL-34992 message : grouped message profile setting providers by component

This commit is contained in:
Aparup Banerjee 2012-09-20 13:55:38 +08:00
parent d2ae1df1a3
commit 8d7f1b1530
2 changed files with 106 additions and 88 deletions

View File

@ -226,28 +226,45 @@ class core_message_renderer extends plugin_renderer_base {
$output .= html_writer::start_tag('fieldset', array('id' => 'providers', 'class' => 'clearfix'));
$output .= html_writer::nonempty_tag('legend', get_string('providers_config', 'message'), array('class' => 'ftoggler'));
// Display the messging options table
foreach($providers as $provider) {
$components[] = $provider->component;
}
// Lets arrange by components so that core settings (moodle) appear as the first table.
$components = array_unique($components);
asort($components);
array_pop($components); //drop moodle! omg!
array_unshift($components, 'moodle'); // pop it in front! phew!
asort($providers);
$number_procs = count($processors);
// Display the messaging options table(s)
foreach ($components as $component) {
$table = new html_table();
$table->attributes['class'] = 'generaltable';
$table->data = array();
$table->head = array('');
if ($component != 'moodle') {
$componentname = get_string('pluginname', $component);
} else {
$componentname = get_string('coresystem');
}
$table->head = array($componentname);
foreach ($readyprocessors as $processor) {
$table->head[] = get_string('pluginname', 'message_'.$processor->name);
}
$number_procs = count($processors);
// Populate the table with rows
asort($providers);
ksort($providers);
foreach ( $providers as $provider) {
if( $provider->component != $component) {
continue;
}
$preferencebase = $provider->component.'_'.$provider->name;
$headerrow = new html_table_row();
$providername = get_string('messageprovider:'.$provider->name, $provider->component);
$providercell = new html_table_cell($providername);
$providercell->header = true;
$providercell->colspan = $number_procs + 1;
$providercell->colspan = $number_procs;
$providercell->attributes['class'] = 'c0';
$headerrow->cells = array($providercell);
$table->data[] = $headerrow;
@ -313,12 +330,10 @@ class core_message_renderer extends plugin_renderer_base {
$table->data[] = $optionrow;
}
}
$output .= html_writer::start_tag('div');
$output .= html_writer::start_tag('div', array('class' => 'messagesettingcomponent'));
$output .= html_writer::table($table);
$output .= html_writer::end_tag('div');
$disableallcheckbox = $this->output->help_icon('disableall', 'message') . get_string('disableall', 'message') . html_writer::checkbox('disableall', 1, $notificationsdisabled, '', array('class'=>'disableallcheckbox'));
$output .= html_writer::nonempty_tag('div', $disableallcheckbox, array('class'=>'disableall'));
}
$output .= html_writer::end_tag('fieldset');
@ -339,6 +354,8 @@ class core_message_renderer extends plugin_renderer_base {
$output .= get_string('blocknoncontacts', 'message').': ';
$output .= html_writer::checkbox('blocknoncontacts', 1, $preferences->blocknoncontacts, '');
$output .= html_writer::end_tag('div');
$disableallcheckbox = $this->output->help_icon('disableall', 'message') . get_string('disableall', 'message') . html_writer::checkbox('disableall', 1, $notificationsdisabled, '', array('class'=>'disableallcheckbox'));
$output .= html_writer::nonempty_tag('div', $disableallcheckbox, array('class'=>'disableall'));
$output .= html_writer::end_tag('fieldset');
$output .= html_writer::start_tag('div', array('class' => 'mdl-align'));
$output .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('updatemyprofile'), 'class' => 'form-submit'));

View File

@ -450,6 +450,7 @@ table#tag-management-list {margin: 10px auto;width: 80%;}
.portfolio-add-icon {margin-left:5px;}
/* Messaging options */
#page-message-edit .mform fieldset div.messagesettingcomponent {float: left; }
#page-message-edit table.generaltable th.c0 {text-align: left;}
#page-message-edit table.generaltable td.c0 {text-align: right;}
#page-message-edit table.generaltable td.disallowed {text-align: center;vertical-align:middle;}