MDL-21198 $OUTPUT->single_button() resurrection, hopefully much easier to use than $OUTPUT->button(); fixed some regressions and code style improvements

This commit is contained in:
Petr Skoda
2010-01-03 15:46:14 +00:00
parent 3cd5305f11
commit 5c2ed7e215
62 changed files with 170 additions and 243 deletions
+2 -2
View File
@@ -38,7 +38,7 @@ $original_theme = fullclone($THEME);
$options['choose'] = $unlikely_name;// Something unlikely to ever be a theme name... initially $unlikely_name = 'ZoqZoqZ';
$options['sesskey'] = $sesskey;
$options['hostid'] = $mnet_peer->id;
echo $OUTPUT->button(html_form::make_button('mnet_themes.php', $options, $strchoose));
echo $OUTPUT->single_button(new moodle_url('mnet_themes.php', $options), $strchoose);
echo '</td>';
echo "</tr>";
@@ -111,7 +111,7 @@ $original_theme = fullclone($THEME);
$options['choose'] = $theme;
$options['sesskey'] = $sesskey;
$options['hostid'] = $mnet_peer->id;
echo $OUTPUT->button(html_form::make_button('mnet_themes.php', $options, $strchoose));
echo $OUTPUT->single_button(new moodle_url('mnet_themes.php', $options), $strchoose);
echo '</td>';
echo "</tr>";
}
+5 -5
View File
@@ -135,16 +135,16 @@
$options = array();
$options['roleid'] = $roleid;
$options['action'] = 'edit';
echo $OUTPUT->button(html_form::make_button($defineurl, $options, get_string('edit')));
echo $OUTPUT->single_button(new moodle_url($defineurl, $options), get_string('edit'));
$options['action'] = 'reset';
if ($definitiontable->get_legacy_type()) {
echo $OUTPUT->button(html_form::make_button($manageurl, $options, get_string('resetrole', 'role')));
echo $OUTPUT->single_button(new moodle_url($manageurl, $options), get_string('resetrole', 'role'));
} else {
echo $OUTPUT->button(html_form::make_button($manageurl, $options, get_string('resetrolenolegacy', 'role')));
echo $OUTPUT->single_button(new moodle_url($manageurl, $options), get_string('resetrolenolegacy', 'role'));
}
$options['action'] = 'duplicate';
echo $OUTPUT->button(html_form::make_button($defineurl, $options, get_string('duplicaterole', 'role')));
echo $OUTPUT->button(html_form::make_button($manageurl, null, get_string('listallroles', 'role')));
echo $OUTPUT->single_button(new moodle_url($defineurl, $options), get_string('duplicaterole', 'role'));
echo $OUTPUT->single_button(new moodle_url($manageurl), get_string('listallroles', 'role'));
echo $OUTPUT->container_end();
}
+1 -1
View File
@@ -265,7 +265,7 @@
echo $OUTPUT->table($table);
echo $OUTPUT->container_start('buttons');
echo $OUTPUT->button(html_form::make_button($defineurl, array('action' => 'add'), get_string('addrole', 'role'), 'get'));
echo $OUTPUT->single_button(new moodle_url($defineurl, array('action' => 'add')), get_string('addrole', 'role'), 'get');
echo $OUTPUT->container_end();
echo $OUTPUT->footer();
+4 -4
View File
@@ -90,15 +90,15 @@ if (empty($SITE->fullname)) {
} else {
if ($PAGE->user_allowed_editing()) {
$options = $PAGE->url->params();
$url = clone($PAGE->url);
if ($PAGE->user_is_editing()) {
$caption = get_string('blockseditoff');
$options['adminedit'] = 'off';
$url->param('adminedit', 'off');
} else {
$caption = get_string('blocksediton');
$options['adminedit'] = 'on';
$url->param('adminedit', 'on');
}
$buttons = $OUTPUT->button(html_form::make_button($PAGE->url->out(), $options, $caption, 'get'));
$buttons = $OUTPUT->single_button($url, $caption, 'get');
}
$visiblepathtosection = array_reverse($settingspage->visiblepath);
+4 -10
View File
@@ -130,19 +130,13 @@ echo $OUTPUT->table($table);
// we can edit only custom functions, the build-in would be overridden after each upgrade
if (empty($service->component)) {
$form = new html_form();
$form->url = new moodle_url('service_functions.php', array('sesskey'=>sesskey(), 'id'=>$service->id, 'action'=>'add'));
$form->button->text = get_string('add');
$form->method = 'get';
echo $OUTPUT->button($form);
$url = new moodle_url('service_functions.php', array('sesskey'=>sesskey(), 'id'=>$service->id, 'action'=>'add'));
echo $OUTPUT->single_button($url, get_string('add'), 'get');
}
// simple back button
$form = new html_form();
$form->url = new moodle_url('../settings.php', array('section'=>'externalservices'));
$form->button->text = get_string('back');
$form->method = 'get';
echo $OUTPUT->button($form);
$url = new moodle_url('../settings.php', array('section'=>'externalservices'));
echo $OUTPUT->single_button($url, get_string('back'), 'get');
echo $OUTPUT->footer();