mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
Merge branch 'MDL-64495-master' of https://github.com/aanabit/moodle
This commit is contained in:
commit
a3d85254f1
13 changed files with 233 additions and 112 deletions
|
@ -20,6 +20,9 @@
|
|||
* @package core_message
|
||||
* @copyright 2011 Lancaster University Network Services Limited
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*
|
||||
* @deprecated since Moodle 3.7 MDL-64495. Please use /admin/message.php instead.
|
||||
* @todo MDL-64866 This will be deleted in Moodle 4.1.
|
||||
*/
|
||||
require_once(__DIR__ . '/../config.php');
|
||||
require_once($CFG->dirroot . '/message/lib.php');
|
||||
|
|
|
@ -36,6 +36,37 @@ defined('MOODLE_INTERNAL') || die();
|
|||
*/
|
||||
class core_message_renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Display the interface to manage both message outputs and default message outputs
|
||||
*
|
||||
* @param array $allprocessors array of objects containing all message processors
|
||||
* @param array $processors array of objects containing active message processors
|
||||
* @param array $providers array of objects containing message providers
|
||||
* @param array $preferences array of objects containing current preferences
|
||||
* @return string The text to render
|
||||
*/
|
||||
public function manage_messageoutput_settings($allprocessors, $processors, $providers, $preferences) {
|
||||
$output = html_writer::start_tag('form', array('id' => 'defaultmessageoutputs', 'method' => 'post'));
|
||||
$output .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
|
||||
|
||||
// Add message output processors enabled/disabled and settings.
|
||||
$output .= $this->heading(get_string('messageoutputs', 'message'));
|
||||
$output .= $this->manage_messageoutputs($allprocessors);
|
||||
|
||||
// Add active message output processors settings.
|
||||
$output .= $this->heading(get_string('managemessageoutputs', 'message'));
|
||||
$output .= $this->manage_defaultmessageoutputs($processors, $providers, $preferences);
|
||||
|
||||
$output .= html_writer::start_tag('div', array('class' => 'form-buttons'));
|
||||
$output .= html_writer::empty_tag('input',
|
||||
array('type' => 'submit', 'value' => get_string('savechanges', 'admin'), 'class' => 'form-submit btn btn-primary')
|
||||
);
|
||||
$output .= html_writer::end_tag('div');
|
||||
$output .= html_writer::end_tag('form');
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the interface to manage message outputs
|
||||
*
|
||||
|
@ -43,7 +74,6 @@ class core_message_renderer extends plugin_renderer_base {
|
|||
* @return string The text to render
|
||||
*/
|
||||
public function manage_messageoutputs($processors) {
|
||||
global $CFG;
|
||||
// Display the current workflows
|
||||
$table = new html_table();
|
||||
$table->attributes['class'] = 'admintable generaltable';
|
||||
|
@ -61,28 +91,21 @@ class core_message_renderer extends plugin_renderer_base {
|
|||
$row = new html_table_row();
|
||||
$row->attributes['class'] = 'messageoutputs';
|
||||
|
||||
// Name
|
||||
$name = new html_table_cell(get_string('pluginname', 'message_'.$processor->name));
|
||||
|
||||
// Enable
|
||||
$enable = new html_table_cell();
|
||||
$enable->attributes['class'] = 'mdl-align';
|
||||
if (!$processor->available) {
|
||||
$enable->text = html_writer::nonempty_tag('span', get_string('outputnotavailable', 'message'), array('class' => 'error'));
|
||||
} else if (!$processor->configured) {
|
||||
$enable->text = html_writer::nonempty_tag('span', get_string('outputnotconfigured', 'message'), array('class' => 'error'));
|
||||
} else if ($processor->enabled) {
|
||||
$url = new moodle_url('/admin/message.php', array('disable' => $processor->id, 'sesskey' => sesskey()));
|
||||
$enable->text = html_writer::link($url, $this->output->pix_icon('t/hide', get_string('outputenabled', 'message')));
|
||||
$enable->text = html_writer::nonempty_tag('span', get_string('outputnotavailable', 'message'),
|
||||
array('class' => 'error')
|
||||
);
|
||||
} else {
|
||||
$row->attributes['class'] = 'dimmed_text';
|
||||
$url = new moodle_url('/admin/message.php', array('enable' => $processor->id, 'sesskey' => sesskey()));
|
||||
$enable->text = html_writer::link($url, $this->output->pix_icon('t/show', get_string('outputdisabled', 'message')));
|
||||
$enable->text = html_writer::checkbox($processor->name, $processor->id, $processor->enabled, '',
|
||||
array('id' => $processor->name)
|
||||
);
|
||||
}
|
||||
// Settings
|
||||
$settings = new html_table_cell();
|
||||
if ($processor->available && $processor->hassettings) {
|
||||
$settingsurl = new moodle_url('settings.php', array('section' => 'messagesetting'.$processor->name));
|
||||
$settingsurl = new moodle_url('/admin/settings.php', array('section' => 'messagesetting'.$processor->name));
|
||||
$settings->text = html_writer::link($settingsurl, get_string('settings', 'message'));
|
||||
}
|
||||
|
||||
|
@ -101,17 +124,12 @@ class core_message_renderer extends plugin_renderer_base {
|
|||
* @return string The text to render
|
||||
*/
|
||||
public function manage_defaultmessageoutputs($processors, $providers, $preferences) {
|
||||
global $CFG;
|
||||
|
||||
// Prepare list of options for dropdown menu
|
||||
$options = array();
|
||||
foreach (array('disallowed', 'permitted', 'forced') as $setting) {
|
||||
$options[$setting] = get_string($setting, 'message');
|
||||
}
|
||||
|
||||
$output = html_writer::start_tag('form', array('id'=>'defaultmessageoutputs', 'method'=>'post'));
|
||||
$output .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'sesskey', 'value'=>sesskey()));
|
||||
|
||||
// Display users outputs table
|
||||
$table = new html_table();
|
||||
$table->attributes['class'] = 'generaltable';
|
||||
|
@ -195,11 +213,7 @@ class core_message_renderer extends plugin_renderer_base {
|
|||
$table->data[] = $row;
|
||||
}
|
||||
|
||||
$output .= html_writer::table($table);
|
||||
$output .= html_writer::start_tag('div', array('class' => 'form-buttons'));
|
||||
$output .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('savechanges','admin'), 'class' => 'form-submit'));
|
||||
$output .= html_writer::end_tag('div');
|
||||
$output .= html_writer::end_tag('form');
|
||||
$output = html_writer::table($table);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue