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

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>";
}

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();
}

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();

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);

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();

View File

@ -401,7 +401,7 @@
/// Restore button
echo $OUTPUT->button(html_form::make_button("restore.php", $hidden, get_string("restorecoursenow")));
echo $OUTPUT->single_button(new moodle_url("restore.php", $hidden), get_string("restorecoursenow"));
}
echo "</div>";

View File

@ -8296,7 +8296,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
$hidden["launch"] = "form";
$hidden["file"] = $file;
$hidden["id"] = $id;
echo $OUTPUT->button(html_form::make_button("restore.php", $hidden, get_string("continue")));
echo $OUTPUT->single_button(new moodle_url("restore.php", $hidden), get_string("continue"));
echo "</div>";
}
else {

View File

@ -132,12 +132,8 @@ foreach($feeds as $feed) {
$table->print_html();
$button = new html_form();
$button->method = 'get';
$button->url = $CFG->wwwroot . '/blocks/rss_client/editfeed.php?' . substr($extraparams, 1);
$button->showbutton = true;
$button->button->text = get_string('addnewfeed', 'block_rss_client');
echo '<div class="actionbuttons">' . $OUTPUT->button($button) . '</div>';
$url = $CFG->wwwroot . '/blocks/rss_client/editfeed.php?' . substr($extraparams, 1);
echo '<div class="actionbuttons">' . $OUTPUT->single_button($url, get_string('addnewfeed', 'block_rss_client'), 'get') . '</div>';
if ($returnurl) {

View File

@ -100,26 +100,19 @@ echo $OUTPUT->header();
echo $OUTPUT->box_start('eventlist');
// Delete this event button is always shown
$deleteone = new html_form();
$deleteone->button->text = get_string('delete');
$deleteone->url = new moodle_url(CALENDAR_URL.'delete.php', array('id'=>$event->id, 'confirm'=>true));
$buttons = $OUTPUT->button($deleteone);
$url = new moodle_url(CALENDAR_URL.'delete.php', array('id'=>$event->id, 'confirm'=>true));
$buttons = $OUTPUT->single_button($url, get_string('delete'));
// If there are repeated events then add a Delete Repeated button
$repeatspan = '';
if (!empty($event->eventrepeats) && $event->eventrepeats > 0) {
$deleteall = new html_form();
$deleteall->button->text = get_string('deleteall');
$deleteall->url = new moodle_url(CALENDAR_URL.'delete.php', array('id'=>$event->repeatid, 'confirm'=>true, 'repeats'=>true));
$buttons .= $OUTPUT->button($deleteall);
$url = new moodle_url(CALENDAR_URL.'delete.php', array('id'=>$event->repeatid, 'confirm'=>true, 'repeats'=>true));
$buttons .= $OUTPUT->single_button($url, get_string('deleteall'));
$repeatspan = '<br /><br />'.$OUTPUT->span(get_string('youcandeleteallrepeats', 'calendar'));
}
// And add the cancel button
$cancel = new html_form();
$cancel->button->text = get_string('cancel');
$cancel->url = $viewcalendarurl;
$buttons .= $OUTPUT->button($cancel);
$buttons .= $OUTPUT->single_button($viewcalendarurl, get_string('cancel'));
// And show the buttons and notes
echo $OUTPUT->box_start('generalbox', 'notice');

View File

@ -183,7 +183,7 @@ switch($view) {
//Link to calendar export page
echo $OUTPUT->container_start('bottom');
if (!empty($CFG->enablecalendarexport)) {
echo $OUTPUT->button(html_form::make_button('export.php', array('course'=>$courseid), get_string('exportcalendar', 'calendar')));
echo $OUTPUT->single_button(new moodle_url('export.php', array('course'=>$courseid)), get_string('exportcalendar', 'calendar'));
if (!empty($USER->id)) {
$authtoken = sha1($USER->username . $USER->password . $CFG->calendar_exportsalt);

View File

@ -207,11 +207,11 @@
// Print button to update this category
$options = array('id' => $category->id);
echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/course/editcategory.php', $options, get_string('editcategorythis'), 'get'));
echo $OUTPUT->single_button(new moodle_url($CFG->wwwroot.'/course/editcategory.php', $options), get_string('editcategorythis'), 'get');
// Print button for creating new categories
$options = array('parent' => $category->id);
echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/course/editcategory.php', $options, get_string('addsubcategory'), 'get'));
echo $OUTPUT->single_button(new moodle_url($CFG->wwwroot.'/course/editcategory.php', $options), get_string('addsubcategory'), 'get');
echo $OUTPUT->container_end();
}
@ -451,14 +451,14 @@
$options['id'] = $category->id;
$options['resort'] = 'name';
$options['sesskey'] = sesskey();
echo $OUTPUT->button(html_form::make_button('category.php', $options, get_string('resortcoursesbyname'), 'get'));
echo $OUTPUT->single_button(new moodle_url('category.php', $options), get_string('resortcoursesbyname'), 'get');
}
if (has_capability('moodle/course:create', $context)) {
/// Print button to create a new course
unset($options);
$options['category'] = $category->id;
echo $OUTPUT->button(html_form::make_button('edit.php', $options, get_string('addnewcourse'), 'get'));
echo $OUTPUT->single_button(new moodle_url('edit.php', $options), get_string('addnewcourse'), 'get');
}
if (!empty($CFG->enablecourserequests) && $category->id == $CFG->enablecourserequests) {

View File

@ -103,9 +103,7 @@ if (!$adminediting) {
/// Print link to create a new course
/// Get the 1st available category
$options = array('category' => $CFG->defaultrequestcategory);
$form = html_form::make_button('edit.php', $options, get_string('addnewcourse'));
$form->method = 'get';
echo $OUTPUT->button($form);
echo $OUTPUT->single_button(new moodle_url('edit.php', $options), get_string('addnewcourse'), 'get');
}
print_course_request_buttons($systemcontext);
echo $OUTPUT->container_end();
@ -265,20 +263,14 @@ echo '</table>';
echo '<div class="buttons">';
if (has_capability('moodle/course:create', $systemcontext)) {
// print create course link to first category
$options = array();
$options = array('category' => $CFG->defaultrequestcategory);
$form = html_form::make_button('edit.php', $options, get_string('addnewcourse'));
$form->method = 'get';
echo $OUTPUT->button($form);
echo $OUTPUT->single_button(new moodle_url('edit.php', $options), get_string('addnewcourse'), 'get');
}
// Print button for creating new categories
if (has_capability('moodle/category:manage', $systemcontext)) {
$options = array();
$options['parent'] = 0;
$form = html_form::make_button('editcategory.php', $options, get_string('addnewcategory'));
$form->method = 'get';
echo $OUTPUT->button($form);
$options = array('parent'=>0);
echo $OUTPUT->single_button(new moodle_url('editcategory.php', $options), get_string('addnewcategory'), 'get');
}
print_course_request_buttons($systemcontext);

View File

@ -2047,13 +2047,12 @@ function print_course_request_buttons($systemcontext) {
}
if (isloggedin() && !isguestuser() && !has_capability('moodle/course:create', $systemcontext) && has_capability('moodle/course:request', $systemcontext)) {
/// Print a button to request a new course
echo $OUTPUT->button(html_form::make_button('request.php', NULL, get_string('requestcourse'), 'get'));
echo $OUTPUT->single_button('request.php', get_string('requestcourse'), 'get');
}
/// Print a button to manage pending requests
if (has_capability('moodle/site:approvecourse', $systemcontext)) {
$form = html_form::make_button('pending.php', NULL, get_string('coursespending'), 'get');
$form->button->disabled = !$DB->record_exists('course_request', array());
echo $OUTPUT->button($form);
$disabled = !$DB->record_exists('course_request', array());
echo $OUTPUT->single_button('pending.php', get_string('coursespending'), 'get', array('disabled'=>$disabled));
}
}
@ -2100,7 +2099,7 @@ function update_category_button($categoryid = 0) {
} else {
$page = 'index.php';
}
return $OUTPUT->button(html_form::make_button($CFG->wwwroot . '/course/' . $page, $options, $label, 'get'));
return $OUTPUT->single_button(new moodle_url($CFG->wwwroot . '/course/' . $page, $options), $label, 'get');
}
/**
@ -2146,7 +2145,7 @@ function print_courses($category) {
$options = array();
$options['category'] = $category->id;
echo '<div class="addcoursebutton">';
echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/course/edit.php', $options, get_string("addnewcourse")));
echo $OUTPUT->single_button(new moodle_url($CFG->wwwroot.'/course/edit.php', $options), get_string("addnewcourse"));
echo '</div>';
}
}
@ -2324,7 +2323,7 @@ function print_my_moodle() {
echo "<table width=\"100%\"><tr><td align=\"center\">";
print_course_search("", false, "short");
echo "</td><td align=\"center\">";
echo $OUTPUT->button(html_form::make_button("$CFG->wwwroot/course/index.php", NULL, get_string("fulllistofcourses"), "get"));
echo $OUTPUT->single_button("$CFG->wwwroot/course/index.php", get_string("fulllistofcourses"), "get");
echo "</td></tr></table>\n";
}

View File

@ -106,7 +106,7 @@ if (empty($pending)) {
$strrequireskey = get_string('requireskey');
// Loop over requested courses.
$keyicon = $OUTPUT->image('y/key', array('alt'=>$strrequireskey, 'class'=>'icon'));
$keyicon = $OUTPUT->image('i/key', array('alt'=>$strrequireskey, 'class'=>'icon'));
foreach ($pending as $course) {
$course = new course_request($course);
@ -127,8 +127,8 @@ if (empty($pending)) {
$row[] = fullname($course->get_requester());
$row[] = $course->summary;
$row[] = format_string($course->reason);
$row[] = $OUTPUT->button(html_form::make_button($baseurl, array('approve' => $course->id, 'sesskey' => sesskey()), get_string('approve'), 'get')) .
$OUTPUT->button(html_form::make_button($baseurl, array('reject' => $course->id), get_string('rejectdots'), 'get'));
$row[] = $OUTPUT->single_button(new moodle_url($baseurl, array('approve' => $course->id, 'sesskey' => sesskey())), get_string('approve'), 'get') .
$OUTPUT->single_button(new moodle_url($baseurl, array('reject' => $course->id)), get_string('rejectdots'), 'get');
/// Add the row to the table.
$table->data[] = $row;
@ -144,5 +144,5 @@ if (empty($pending)) {
}
/// Finish off the page.
echo $OUTPUT->button(html_form::make_button($CFG->wwwroot . '/course/index.php', array(), get_string('backtocourselisting')));
echo $OUTPUT->single_button($CFG->wwwroot . '/course/index.php', get_string('backtocourselisting'));
echo $OUTPUT->footer();

View File

@ -188,16 +188,13 @@
$edit = "on";
}
$form = new html_form();
$form->url = new moodle_url("$CFG->wwwroot/course/search.php", array(
$aurl = new moodle_url("$CFG->wwwroot/course/search.php", array(
'edit' => $edit,
'sesskey' => sesskey(),
'search' => s($search, true),
'search' => $search,
'page' => $page,
'perpage' => $perpage));
$form->method = 'get';
$form->button->text = s($string);
$searchform = $OUTPUT->button($form);
$searchform = $OUTPUT->single_button($aurl, $string, 'get');
}
}

View File

@ -316,8 +316,8 @@ class enrolment_plugin_authorize
echo $OUTPUT->box_start('generalbox notice');
echo '<p>'. get_string('paymentthanks', 'moodle', $course->fullname) .'</p>';
echo $OUTPUT->container_start('buttons');
echo $OUTPUT->button(html_form::make_button("$CFG->wwwroot/enrol/authorize/index.php", array('order'=>$order->id), get_string('payments')));
echo $OUTPUT->button(html_form::make_button("$CFG->wwwroot/course/view.php", array('id'=>$course->id), $course->fullname));
echo $OUTPUT->single_button(new moodle_url("$CFG->wwwroot/enrol/authorize/index.php", array('order'=>$order->id)), get_string('payments'));
echo $OUTPUT->single_button(new moodle_url("$CFG->wwwroot/course/view.php", array('id'=>$course->id)), $course->fullname);
echo $OUTPUT->container_end();
echo $OUTPUT->box_end();
echo $OUTPUT->footer();

View File

@ -41,7 +41,7 @@
if (isguestuser()) {
echo $OUTPUT->box_start('centerpara');
$loginurl = get_login_url();
echo $OUTPUT->button(html_form::make_button($loginurl, null, get_string('login')));
echo $OUTPUT->single_button($loginurl, get_string('login'));
echo $OUTPUT->box_end();
}
?>

View File

@ -135,7 +135,7 @@ if ($handle = fopen($imported_file['userfile']['tmp_name'], 'r')) {
if ($error) {
echo $OUTPUT->box_start('generalbox importoutcomenofile');
echo get_string('importoutcomenofile', 'grades', $line);
echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get'));
echo $OUTPUT->single_button(new moodle_url($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid)), get_string('back'), 'get');
echo $OUTPUT->box_end();
$fatal_error = true;
break;
@ -154,7 +154,7 @@ if ($handle = fopen($imported_file['userfile']['tmp_name'], 'r')) {
if ( count($csv_data) != count($file_headers) ) {
echo $OUTPUT->box_start('generalbox importoutcomenofile');
echo get_string('importoutcomenofile', 'grades', $line);
echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get'));
echo $OUTPUT->single_button(new moodle_url($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid)), get_string('back'), 'get');
echo $OUTPUT->box_end();
$fatal_error = true;
//echo $OUTPUT->box(var_export($csv_data, true) ."<br />". var_export($header, true));
@ -166,7 +166,7 @@ if ($handle = fopen($imported_file['userfile']['tmp_name'], 'r')) {
if ($csv_data[$imported_headers[$header]] == '') {
echo $OUTPUT->box_start('generalbox importoutcomenofile');
echo get_string('importoutcomenofile', 'grades', $line);
echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid), get_string('back'), 'get'));
echo $OUTPUT->single_button(new moodle_url($CFG->wwwroot.'/grade/edit/outcome/index.php', array('id'=> $courseid)), get_string('back'), 'get');
echo $OUTPUT->box_end();
$fatal_error = true;
break;

View File

@ -247,9 +247,9 @@ foreach($outcomes_tables as $table) {
}
echo $OUTPUT->container_start('buttons');
echo $OUTPUT->button(html_form::make_button('edit.php', array('courseid'=>$courseid), $strcreatenewoutcome));
echo $OUTPUT->single_button(new moodle_url('edit.php', array('courseid'=>$courseid)), $strcreatenewoutcome);
if ( !empty($outcomes_tables) ) {
echo $OUTPUT->button(html_form::make_button('export.php', array('id'=>$courseid, 'sesskey'=>sesskey()), get_string('exportalloutcomes', 'grades')));
echo $OUTPUT->single_button(new moodle_url('export.php', array('id'=>$courseid, 'sesskey'=>sesskey())), get_string('exportalloutcomes', 'grades'));
}
echo $OUTPUT->container_end();
@ -268,7 +268,6 @@ function grade_print_scale_link($courseid, $scale, $gpr) {
global $CFG, $OUTPUT;
$url = new moodle_url($CFG->wwwroot.'/grade/edit/scale/edit.php', array('courseid' => $courseid, 'id' => $scale->id));
$url = $gpr->add_url_params($url);
$link = html_link::make($url, $scale->get_name());
return $OUTPUT->link($link);
return $OUTPUT->link($url, $scale->get_name());
}

View File

@ -162,6 +162,6 @@ echo $OUTPUT->table($table);
echo $OUTPUT->heading($strstandardscale, 3, 'main');
echo $OUTPUT->table($table2);
echo $OUTPUT->container_start('buttons');
echo $OUTPUT->button(html_form::make_button('edit.php', array('courseid'=>$courseid), $srtcreatenewscale));
echo $OUTPUT->single_button(new moodle_url('edit.php', array('courseid'=>$courseid)), $srtcreatenewscale);
echo $OUTPUT->container_end();
echo $OUTPUT->footer();

View File

@ -341,16 +341,16 @@ echo $OUTPUT->box_end();
echo $OUTPUT->container_start('buttons');
if ($moving) {
echo $OUTPUT->button(html_form::make_button('index.php', array('id'=>$course->id), get_string('cancel'), 'get'));
echo $OUTPUT->single_button(new moodle_url('index.php', array('id'=>$course->id)), get_string('cancel'), 'get');
} else {
echo $OUTPUT->button(html_form::make_button('category.php', array('courseid'=>$course->id), get_string('addcategory', 'grades'), 'get'));
echo $OUTPUT->button(html_form::make_button('item.php', array('courseid'=>$course->id), get_string('additem', 'grades'), 'get'));
echo $OUTPUT->single_button(new moodle_url('category.php', array('courseid'=>$course->id)), get_string('addcategory', 'grades'), 'get');
echo $OUTPUT->single_button(new moodle_url('item.php', array('courseid'=>$course->id)), get_string('additem', 'grades'), 'get');
if (!empty($CFG->enableoutcomes)) {
echo $OUTPUT->button(html_form::make_button('outcomeitem.php', array('courseid'=>$course->id), get_string('addoutcomeitem', 'grades'), 'get'));
echo $OUTPUT->single_button(new moodle_url('outcomeitem.php', array('courseid'=>$course->id)), get_string('addoutcomeitem', 'grades'), 'get');
}
//print_single_button('index.php', array('id'=>$course->id, 'action'=>'autosort'), get_string('autosort', 'grades'), 'get');
//echo $OUTPUT->(new moodle_url('index.php', array('id'=>$course->id, 'action'=>'autosort')), get_string('autosort', 'grades'), 'get');
}
echo $OUTPUT->container_end();

View File

@ -77,7 +77,7 @@ $table->data = $data;
echo $OUTPUT->table($table);
echo $OUTPUT->container_start('buttons mdl-align');
echo $OUTPUT->button(html_form::make_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey')));
echo $OUTPUT->single_button(new moodle_url('key.php', array('courseid'=>$course->id)), get_string('newuserkey', 'userkey'));
echo $OUTPUT->container_end();
echo $OUTPUT->footer();

View File

@ -295,8 +295,7 @@ abstract class grade_export {
echo $OUTPUT->container_start('gradeexportlink');
if (!$this->userkey) { // this button should trigger a download prompt
echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/grade/export/'.$this->plugin.'/export.php',
$params, get_string('download', 'admin')));
echo $OUTPUT->single_button(new moodle_url($CFG->wwwroot.'/grade/export/'.$this->plugin.'/export.php', $params), get_string('download', 'admin'));
} else {
$paramstr = '';
@ -308,7 +307,7 @@ abstract class grade_export {
$link = $CFG->wwwroot.'/grade/export/'.$this->plugin.'/dump.php'.$paramstr.'&key='.$this->userkey;
echo get_string('download', 'admin').': ' . $OUTPUT->link(html_link::make($link, $link));
echo get_string('download', 'admin').': ' . $OUTPUT->link($link, $link);
}
echo $OUTPUT->container_end();
}

View File

@ -74,7 +74,7 @@ $table->data = $data;
echo $OUTPUT->table($table);
echo $OUTPUT->container_start('buttons mdl-align');
echo $OUTPUT->button(html_form::make_button('key.php', array('courseid'=>$course->id), get_string('newuserkey', 'userkey')));
echo $OUTPUT->single_button(new moodle_url('key.php', array('courseid'=>$course->id)), get_string('newuserkey', 'userkey'));
echo $OUTPUT->container_end();
echo $OUTPUT->footer();

View File

@ -84,7 +84,7 @@ if (has_capability('moodle/grade:edit', $context)) {
$string = get_string('turneditingon');
}
$buttons = $OUTPUT->button(html_form::make_button('index.php', $options, $string, 'get'));
$buttons = $OUTPUT->single_button(new moodle_url('index.php', $options), $string, 'get');
} else {
$USER->gradeediting[$course->id] = 0;

View File

@ -101,7 +101,7 @@ $table->data = $data;
echo $OUTPUT->table($table);
echo $OUTPUT->container_start('buttons');
echo $OUTPUT->button(html_form::make_button('grouping.php', array('courseid'=>$courseid), $srtnewgrouping));
echo $OUTPUT->single_button(new moodle_url('grouping.php', array('courseid'=>$courseid)), $srtnewgrouping);
echo $OUTPUT->container_end();
echo $OUTPUT->footer();

View File

@ -5263,7 +5263,9 @@ function admin_externalpage_print_header($focus='') {
$caption = get_string('blocksediton');
$options['adminedit'] = 'on';
}
$buttons = $OUTPUT->button(html_form::make_button($PAGE->url->out(), $options, $caption, 'get'));
$url = clone($PAGE->url);
$url->params($options);
$buttons = $OUTPUT->single_button($url, $caption, 'get');
}
$PAGE->set_title("$SITE->shortname: " . implode(": ",$visiblepathtosection));

View File

@ -2472,7 +2472,7 @@ function button_to_popup_window ($url, $name=null, $linkname=null,
$id=null, $class=null) {
global $OUTPUT;
debugging('button_to_popup_window() has been deprecated. Please change your code to use $OUTPUT->button().');
debugging('button_to_popup_window() has been deprecated. Please change your code to use $OUTPUT->single_button().');
if ($options == 'none') {
$options = null;
@ -2516,7 +2516,7 @@ function button_to_popup_window ($url, $name=null, $linkname=null,
}
$form->button->add_action(new popup_action('click', $url, $name, $popupparams));
$output = $OUTPUT->button($form);
$output = $OUTPUT->single_button($form);
if ($return) {
return $output;
@ -2546,7 +2546,7 @@ function print_single_button($link, $options, $label='OK', $method='get', $notus
$return=false, $tooltip='', $disabled = false, $jsconfirmmessage='', $formid = '') {
global $OUTPUT;
debugging('print_single_button() has been deprecated. Please change your code to use $OUTPUT->button().');
debugging('print_single_button() has been deprecated. Please change your code to use $OUTPUT->single_button().');
// Cast $options to array
$options = (array) $options;
@ -2562,7 +2562,7 @@ function print_single_button($link, $options, $label='OK', $method='get', $notus
$form->button->add_confirm_action($jsconfirmmessage);
}
$output = $OUTPUT->button($form);
$output = $OUTPUT->single_button($form);
if ($return) {
return $output;
@ -3561,10 +3561,8 @@ function update_module_button($cmid, $ignored, $string) {
if (has_capability('moodle/course:manageactivities', get_context_instance(CONTEXT_MODULE, $cmid))) {
$string = get_string('updatethis', '', $string);
$form = new html_form();
$form->url = new moodle_url("$CFG->wwwroot/course/mod.php", array('update' => $cmid, 'return' => true, 'sesskey' => sesskey()));
$form->button->text = $string;
return $OUTPUT->button($form);
$url = new moodle_url("$CFG->wwwroot/course/mod.php", array('update' => $cmid, 'return' => true, 'sesskey' => sesskey()));
return $OUTPUT->single_button($url, $string);
} else {
return '';
}

View File

@ -995,20 +995,26 @@ class core_renderer extends renderer_base {
/**
* Returns a form with single button.
* If first parameter is html_form instance all other parameters are ignored.
*
* @param string|moodle_url|html_form $url_or_form
* @param string $label button text
* @param string $method get or post submit method
* @param array $options associative array {disabled, title}
* @return string HTML fragment
*/
public function single_button($url_or_form, $label=null, $method='get') {
public function single_button($url_or_form, $label=null, $method='post', array $options=null) {
if ($url_or_form instanceof html_form) {
$form = clone($url_or_form);
if (!is_null($label)) {
$form->button->text = $label;
$form = $url_or_form;
if (func_num_args() > 1) {
debugging('html_form instance used as first parameter of $OUTPUT->single_button(), all other parameters are ignored.');
}
} else {
$form = html_form::make_button($url_or_form, null, $label, $method);
$form->button->disabled = !empty($options['disabled']);
if (!empty($options['title'])) {
$form->button->title = $options['title'];
}
}
return $this->button($form);
@ -1058,7 +1064,7 @@ class core_renderer extends renderer_base {
$buttonoutput = null;
if (empty($contents) && !empty($form->button)) {
debugging("You probably want to use \$OUTPUT->button(\$form), please read that function's documentation", DEBUG_DEVELOPER);
debugging("You probably want to use \$OUTPUT->single_button(\$form), please read that function's documentation", DEBUG_DEVELOPER);
} else if (empty($contents)) {
$contents = $this->output_empty_tag('input', array('type' => 'submit', 'value' => get_string('ok')));
} else if (!empty($form->button)) {

View File

@ -116,17 +116,14 @@ $DB = $realdb;
echo $OUTPUT->container_start();
$form = html_form::make_button($baseurl, array('action' => 'setup'), 'Set up test tables', 'get');
$form->button->disabled = $issetup > 0;
echo $OUTPUT->button($form);
$aurl = new moodle_url($baseurl, array('action' => 'setup'));
echo $OUTPUT->single_button($aurl, 'Set up test tables', 'get', array('disabled'=>($issetup > 0)));
$form = html_form::make_button($baseurl, array('action' => 'teardown'), 'Drop test tables', 'get');
$form->button->disabled = $issetup == 0;
echo $OUTPUT->button($form);
$aurl = new moodle_url($baseurl, array('action' => 'teardown'));
echo $OUTPUT->single_button($aurl, 'Drop test tables', 'get', array('disabled'=>($issetup == 0)));
$form = html_form::make_button($baseurl, array('action' => 'test'), 'Run tests', 'get');
$form->button->disabled = $issetup != count($requiredtables);
echo $OUTPUT->button($form);
$aurl = new moodle_url($baseurl, array('action' => 'test'));
echo $OUTPUT->single_button($aurl, 'Run tests', 'get', array('disabled'=>($issetup != count($requiredtables))));
echo $OUTPUT->container_end();

View File

@ -2218,7 +2218,7 @@ function switchroles_form($courseid) {
$options['sesskey'] = sesskey();
$options['switchrole'] = 0;
return $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/course/view.php', $options, get_string('switchrolereturn')));
return $OUTPUT->single_button(new moodle_url($CFG->wwwroot.'/course/view.php', $options), get_string('switchrolereturn'));
}
if (has_capability('moodle/role:switchroles', $context)) {

View File

@ -39,7 +39,7 @@ if (!empty($data) || (!empty($p) && !empty($s))) {
echo $OUTPUT->box_start('generalbox centerpara boxwidthnormal boxaligncenter');
echo "<h3>".get_string("thanks").", ". fullname($user) . "</h3>\n";
echo "<p>".get_string("alreadyconfirmed")."</p>\n";
echo $OUTPUT->button(html_form::make_button("$CFG->wwwroot/course/", null, get_string('courses')));
echo $OUTPUT->single_button("$CFG->wwwroot/course/", get_string('courses'));
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
exit;
@ -66,7 +66,7 @@ if (!empty($data) || (!empty($p) && !empty($s))) {
echo $OUTPUT->box_start('generalbox centerpara boxwidthnormal boxaligncenter');
echo "<h3>".get_string("thanks").", ". fullname($USER) . "</h3>\n";
echo "<p>".get_string("confirmed")."</p>\n";
echo $OUTPUT->button(html_form::make_button("$CFG->wwwroot/course/", null, get_string('courses')));
echo $OUTPUT->single_button("$CFG->wwwroot/course/", get_string('courses'));
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
exit;

View File

@ -179,7 +179,7 @@ function message_print_contacts() {
echo $OUTPUT->container_end();
echo $OUTPUT->container_start('messagejsmanualrefresh aligncenter');
echo $OUTPUT->button(html_form::make_button('index.php', false, get_string('refresh')));
echo $OUTPUT->single_button('index.php', get_string('refresh'));
echo $OUTPUT->container_end();
}
@ -518,7 +518,7 @@ function message_print_search_results($frm) {
}
echo '<br />';
echo $OUTPUT->button(html_form::make_button('index.php', array( 'tab' => 'search'), get_string('newsearch', 'message')));
echo $OUTPUT->single_button(new moodle_url('index.php', array('tab' => 'search')), get_string('newsearch', 'message'));
echo '</div>';
}

View File

@ -126,8 +126,7 @@ class assignment_online extends assignment_base {
echo $OUTPUT->box_end();
if (!$editmode && $editable) {
echo "<div style='text-align:center'>";
echo $OUTPUT->button(html_form::make_button('view.php', array('id'=>$this->cm->id,'edit'=>'1'),
get_string('editmysubmission', 'assignment')));
echo $OUTPUT->single_button(new moodle_url('view.php', array('id'=>$this->cm->id, 'edit'=>'1')), get_string('editmysubmission', 'assignment'));
echo "</div>";
}

View File

@ -180,7 +180,7 @@ class assignment_upload extends assignment_base {
if ($this->can_update_notes($submission)) {
$options = array ('id'=>$this->cm->id, 'action'=>'editnotes');
echo '<div style="text-align:center">';
echo $OUTPUT->button(html_form::make_button('upload.php', $options, get_string('edit')));
echo $OUTPUT->single_button(new moodle_url('upload.php', $options), get_string('edit'));
echo '</div>';
}
}
@ -376,10 +376,10 @@ class assignment_upload extends assignment_base {
if ($this->drafts_tracked() and $this->isopen() and has_capability('mod/assignment:grade', $this->context) and $mode != '') { // we do not want it on view.php page
if ($this->can_unfinalize($submission)) {
$options = array ('id'=>$this->cm->id, 'userid'=>$userid, 'action'=>'unfinalize', 'mode'=>$mode, 'offset'=>$offset);
$output .= $OUTPUT->button(html_form::make_button('upload.php', $options, get_string('unfinalize', 'assignment')));
$output .= $OUTPUT->single_button(new moodle_url('upload.php', $options), get_string('unfinalize', 'assignment'));
} else if ($this->can_finalize($submission)) {
$options = array ('id'=>$this->cm->id, 'userid'=>$userid, 'action'=>'finalizeclose', 'mode'=>$mode, 'offset'=>$offset);
$output .= $OUTPUT->button(html_form::make_button('upload.php', $options, get_string('finalize', 'assignment')));
$output .= $OUTPUT->single_button(new moodle_url('upload.php', $options), get_string('finalize', 'assignment'));
}
}

View File

@ -224,13 +224,13 @@
$options = array();
$options["id"] = "$cm->id";
$options["download"] = "ods";
echo $OUTPUT->button(html_form::make_button("report.php", $options, get_string("downloadods")));
echo $OUTPUT->single_button(new moodle_url("report.php", $options), get_string("downloadods"));
echo "</td><td>";
$options["download"] = "xls";
echo $OUTPUT->button(html_form::make_button("report.php", $options, get_string("downloadexcel")));
echo $OUTPUT->single_button(new moodle_url("report.php", $options), get_string("downloadexcel"));
echo "</td><td>";
$options["download"] = "txt";
echo $OUTPUT->button(html_form::make_button("report.php", $options, get_string("downloadtext")));
echo $OUTPUT->single_button(new moodle_url("report.php", $options), get_string("downloadtext"));
echo "</td></tr></table>";
}

View File

@ -141,7 +141,7 @@
echo $OUTPUT->box_start('generalbox', 'notice');
echo '<p align="center">'. get_string('noguestchoose', 'choice') .'</p>';
echo $OUTPUT->container_start('continuebutton');
echo $OUTPUT->button(html_form::make_button($CFG->wwwroot.'/course/enrol.php?id='.$course->id, NULL, get_string('enrolme', '', format_string($course->shortname))));
echo $OUTPUT->single_button(new moodle_url($CFG->wwwroot.'/course/enrol.php?', array('id'=>$course->id)), get_string('enrolme', '', format_string($course->shortname)));
echo $OUTPUT->container_end();
echo $OUTPUT->box_end();

View File

@ -339,7 +339,7 @@ $options = array();
$options['sesskey'] = sesskey();
$options['action'] = 'export';
$options['d'] = $data->id;
echo $OUTPUT->button(html_form::make_button('preset.php', $options, $strexport));
echo $OUTPUT->single_button(new moodle_url('preset.php', $options), $strexport);
echo '</td></tr>';
echo '<tr><td><label>'.$strsaveaspreset.'</label>';
@ -349,7 +349,7 @@ $options = array();
$options['sesskey'] = sesskey();
$options['action'] = 'save1';
$options['d'] = $data->id;
echo $OUTPUT->button(html_form::make_button('preset.php', $options, $strsave));
echo $OUTPUT->single_button(new moodle_url('preset.php', $options), $strsave);
echo '</td></tr>';
echo '<tr><td valign="top" colspan="2" align="center"><h3>'.$strimport.'</h3></td></tr>';
echo '<tr><td><label for="fromfile">'.$strfromfile.'</label>';

View File

@ -87,10 +87,8 @@ if( $capabilities->viewreports ) {
//echo '<div class="mdl-align">';
// echo '<div class="feedback_centered_button">';
echo $OUTPUT->container_start('form-buttons');
$export_button_link = 'analysis_to_excel.php';
$export_button_options = array('sesskey'=>sesskey(), 'id'=>$id);
$export_button_label = get_string('export_to_excel', 'feedback');
echo $OUTPUT->button(html_form::make_button($export_button_link, $export_button_options, $export_button_label));
$aurl = new moodle_url('analysis_to_excel.php', array('sesskey'=>sesskey(), 'id'=>$id));
echo $OUTPUT->single_button($aurl, get_string('export_to_excel', 'feedback'));
echo $OUTPUT->container_end();
}

View File

@ -84,10 +84,8 @@ echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthwide');
if( $capabilities->viewreports ) {
//button "export to excel"
echo $OUTPUT->container_start('mdl-align');
$export_button_link = 'analysis_to_excel.php';
$export_button_options = array('sesskey'=>sesskey(), 'id'=>$id, 'coursefilter'=>$coursefilter);
$export_button_label = get_string('export_to_excel', 'feedback');
echo $OUTPUT->button(html_form::make_button($export_button_link, $export_button_options, $export_button_label));
$aurl = new moodle_url('analysis_to_excel.php', array('sesskey'=>sesskey(), 'id'=>$id, 'coursefilter'=>$coursefilter));
echo $OUTPUT->single_button($aurl, get_string('export_to_excel', 'feedback'));
echo $OUTPUT->container_end();
}

View File

@ -123,12 +123,7 @@
<tr>
<td>&nbsp;</td>
<td><?php
$form = new html_form();
$form->button->text = get_string('choosefile', 'feedback');
$form->button->title = $form->button->text;
$form->url = "/files/index.php?id={$course->id}&choose=form.choosefile";
$form->button->add_action(new popup_action('click', $form->url, "coursefiles", array('width' => 750, 'height' => 500)));
echo $OUTPUT->button($form);
echo 'TODO: implement new file picker and file ahdnling - MDL-14493';
?>
<input type="submit" name="save" value="<?php print_string('importfromthisfile', 'feedback'); ?>" />
</td>
@ -141,7 +136,7 @@
<?php
echo $OUTPUT->container_start('mdl-align');
echo $OUTPUT->button(html_form::make_button('edit.php', array('id'=>$id, 'do_show'=>'templates'), get_string('cancel')));
echo $OUTPUT->single_button(new moodle_url('edit.php', array('id'=>$id, 'do_show'=>'templates')), get_string('cancel'));
echo $OUTPUT->container_end();
echo $OUTPUT->footer();

View File

@ -152,10 +152,8 @@ if($do_show == 'showentries'){
</td>
<td align="right">
<?php
$show_button_link = $ME;
$show_button_options = array('sesskey'=>sesskey(), 'userid'=>$student->id, 'do_show'=>'showoneentry', 'id'=>$id);
$show_button_label = get_string('show_entries', 'feedback');
echo $OUTPUT->button(html_form::make_button($show_button_link, $show_button_options, $show_button_label));
$aurl = new moodle_url($ME, array('sesskey'=>sesskey(), 'userid'=>$student->id, 'do_show'=>'showoneentry', 'id'=>$id));
echo $OUTPUT->single_button($aurl, get_string('show_entries', 'feedback'));
?>
</td>
<?php
@ -163,10 +161,8 @@ if($do_show == 'showentries'){
?>
<td align="right">
<?php
$delete_button_link = 'delete_completed.php';
$delete_button_options = array('sesskey'=>sesskey(), 'completedid'=>$feedbackcompleted->id, 'do_show'=>'showoneentry', 'id'=>$id);
$delete_button_label = get_string('delete_entry', 'feedback');
echo $OUTPUT->button(html_form::make_button($delete_button_link, $delete_button_options, $delete_button_label));
$aurl = new moodle_url('delete_completed.php', array('sesskey'=>sesskey(), 'completedid'=>$feedbackcompleted->id, 'do_show'=>'showoneentry', 'id'=>$id));
echo $OUTPUT->single_button($aurl, get_string('delete_entry', 'feedback'));
?>
</td>
<?php
@ -187,10 +183,8 @@ if($do_show == 'showentries'){
</td>
<td align="right">
<?php
$show_anon_button_link = 'show_entries_anonym.php';
$show_anon_button_options = array('sesskey'=>sesskey(), 'userid'=>0, 'do_show'=>'showoneentry', 'id'=>$id);
$show_anon_button_label = get_string('show_entries', 'feedback');
echo $OUTPUT->button(html_form::make_button($show_anon_button_link, $show_anon_button_options, $show_anon_button_label));
$aurl = new moodle_url('show_entries_anonym.php', array('sesskey'=>sesskey(), 'userid'=>0, 'do_show'=>'showoneentry', 'id'=>$id));
echo $OUTPUT->single_button($aurl, get_string('show_entries', 'feedback'));
?>
</td>
</tr>

View File

@ -208,15 +208,11 @@ if ($generalforums) {
$trackedlink = $stryes;
} else {
$options = array('id'=>$forum->id);
$aurl = new moodle_url($CFG->wwwroot.'/mod/forum/settracking.php', array('id'=>$forum->id));
if (!isset($untracked[$forum->id])) {
$form = html_form::make_button($CFG->wwwroot.'/mod/forum/settracking.php', $options, $stryes);
$form->button->title = $strnotrackforum;
$trackedlink = $OUTPUT->button($form);
$trackedlink = $OUTPUT->single_button($aurl, $stryes, 'post', array('title'=>$strnotrackforum));
} else {
$form = html_form::make_button($CFG->wwwroot.'/mod/forum/settracking.php', $options, $strno);
$form->button->title = $strtrackforum;
$trackedlink = $OUTPUT->button($form);
$trackedlink = $OUTPUT->single_button($aurl, $strno, 'post', array('title'=>$strtrackforum));
}
}
}
@ -335,15 +331,11 @@ if ($course->id != SITEID) { // Only real courses have learning forums
$trackedlink = $stryes;
} else {
$options = array('id'=>$forum->id);
$aurl = new moodle_url($CFG->wwwroot.'/mod/forum/settracking.php', array('id'=>$forum->id));
if (!isset($untracked[$forum->id])) {
$form = html_form::make_button($CFG->wwwroot.'/mod/forum/settracking.php', $options, $stryes);
$form->button->title = $strnotrackforum;
$trackedlink = $OUTPUT->button($form);
$trackedlink = $OUTPUT->single_button($aurl, $stryes, 'post', array('title'=>$strnotrackforum));
} else {
$form = html_form::make_button($CFG->wwwroot.'/mod/forum/settracking.php', $options, $strno);
$form->button->title = $strtrackforum;
$trackedlink = $OUTPUT->button($form);
$trackedlink = $OUTPUT->single_button($aurl, $strno, 'post', array('title'=>$strtrackforum));
}
}
}

View File

@ -5019,9 +5019,8 @@ function forum_get_subscribe_link($forum, $context, $messages = array(), $cantac
$link = "<noscript>";
}
$options ['id'] = $forum->id;
$form = html_form::make_button($CFG->wwwroot.'/mod/forum/subscribe.php', $options, $linktext);
$form->button->title = $linktitle;
$link .= $OUTPUT->button($form);
$url = new moodle_url($CFG->wwwroot.'/mod/forum/subscribe.php', $options);
$link .= $OUTPUT->single_button($url, $linktext, 'get', array('title'=>$linktitle));
if ($fakelink) {
$link .= '</noscript>';
}
@ -5075,9 +5074,8 @@ function forum_get_tracking_link($forum, $messages=array(), $fakelink=true) {
// use <noscript> to print button in case javascript is not enabled
$link .= '<noscript>';
}
$form = html_form::make_button($CFG->wwwroot.'/mod/forum/settracking.php?id=' . $forum->id, $options, $linktext);
$form->button->title = $linktitle;
$link .= $OUTPUT->button($form);
$url = new moodle_url($CFG->wwwroot.'/mod/forum/settracking.php', array('id'=>$forum->id));
$link .= $OUTPUT->single_button($url, $linktext, 'get', array('title'=>$linktitle));
if ($fakelink) {
$link .= '</noscript>';

View File

@ -146,7 +146,7 @@ if ( $hook >0 ) {
<?php
unset($options);
$options = array ("id" => $id);
echo $OUTPUT->button(html_form::make_button("editcategories.php", $options, get_string("no")));
echo $OUTPUT->single_button(new moodle_url("editcategories.php", $options), get_string("no"));
echo "</td></tr></table>";
echo "</div>";
echo $OUTPUT->box_end();
@ -241,12 +241,12 @@ if ( $action ) {
$options['action'] = "add";
echo "<table border=\"0\"><tr><td align=\"right\">";
echo $OUTPUT->button(html_form::make_button("editcategories.php", $options, get_string("add") . " " . get_string("category","glossary")));
echo $OUTPUT->single_button(new moodle_url("editcategories.php", $options), get_string("add") . " " . get_string("category","glossary"));
echo "</td><td align=\"left\">";
unset($options['action']);
$options['mode'] = 'cat';
$options['hook'] = $hook;
echo $OUTPUT->button(html_form::make_button("view.php", $options, get_string("back","glossary")));
echo $OUTPUT->single_button(new moodle_url("view.php", $options), get_string("back","glossary"));
echo "</td></tr>";
echo "</table>";

View File

@ -1492,7 +1492,7 @@ function glossary_print_categories_menu($cm, $glossary, $hook, $category) {
$options['id'] = $cm->id;
$options['mode'] = 'cat';
$options['hook'] = $hook;
echo $OUTPUT->button(html_form::make_button("editcategories.php", $options, get_string("editcategories","glossary"), "get"));
echo $OUTPUT->single_button(new moodle_url("editcategories.php", $options), get_string("editcategories","glossary"), "get");
}
echo '</td>';

View File

@ -138,12 +138,12 @@ function hotpot_print_review_buttons(&$course, &$hotpot, &$attempt, $context) {
print "\n".'<table border="0" align="center" cellpadding="2" cellspacing="2" class="generaltable">';
print "\n<tr>\n".'<td align="center">';
echo $OUTPUT->button(html_form::make_button("report.php?hp=$hotpot->id", NULL, get_string('continue')));
echo $OUTPUT->single_button(new moodle_url("report.php", array('hp'=>$hotpot->id)), get_string('continue'));
if (has_capability('mod/hotpot:viewreport',$context) && $DB->record_exists('hotpot_details', array('attempt'=>$attempt->id))) {
print "</td>\n".'<td align="center">';
echo $OUTPUT->button(html_form::make_button("review.php?hp=$hotpot->id&attempt=$attempt->id&action=showxmlsource", NULL, get_string('showxmlsource', 'hotpot')));
echo $OUTPUT->single_button(new moodle_url("review.php", array('hp'=>$hotpot->id, 'attempt'=>$attempt->id, 'action'=>'showxmlsource')), get_string('showxmlsource', 'hotpot'));
print "</td>\n".'<td align="center">';
echo $OUTPUT->button(html_form::make_button("review.php?hp=$hotpot->id&attempt=$attempt->id&action=showxmltree", NULL, get_string('showxmltree', 'hotpot')));
echo $OUTPUT->single_button(new moodle_url("review.php", array('hp'=>$hotpot->id,'attempt'=>$attempt->id, 'action'=>'showxmltree')), get_string('showxmltree', 'hotpot'));
$colspan = 3;
} else {
$colspan = 1;

View File

@ -186,14 +186,13 @@ if ($lesson->review && !$result->correctanswer && !$result->noanswer && !$result
echo $OUTPUT->form($form);
}
$url = $CFG->wwwroot.'/mod/lesson/view.php';
$options = array('id'=>$cm->id, 'pageid'=>$result->newpageid);
$url = new moodle_url($CFG->wwwroot.'/mod/lesson/view.php', array('id'=>$cm->id, 'pageid'=>$result->newpageid));
if ($lesson->review && !$result->correctanswer && !$result->noanswer && !$result->isessayquestion) {
// Review button continue
$form = html_form::make_button($url, $options, get_string('reviewquestioncontinue', 'lesson'));
echo $OUTPUT->single_button($url, get_string('reviewquestioncontinue', 'lesson'));
} else {
// Normal continue button
$form = html_form::make_button($url, $options, get_string('continue', 'lesson'));
echo $OUTPUT->single_button($url, get_string('continue', 'lesson'));
}
echo $OUTPUT->button($form);
echo $lessonoutput->footer();

View File

@ -567,9 +567,8 @@ function lesson_add_header_buttons($cm, $context, $extraeditbuttons=false, $less
print_error('invalidpageid', 'lesson');
}
if (!empty($lessonpageid) && $lessonpageid != LESSON_EOL) {
$options = array('id'=>$cm->id, 'redirect'=>'navigation', 'pageid'=>$lessonpageid);
$buttonform = html_form::make_button($CFG->wwwroot.'/mod/lesson/lesson.php', $options, get_string('editpagecontent', 'lesson'));
$PAGE->set_button($OUTPUT->button($buttonform));
$url = new moodle_url($CFG->wwwroot.'/mod/lesson/lesson.php', array('id'=>$cm->id, 'redirect'=>'navigation', 'pageid'=>$lessonpageid));
$PAGE->set_button($OUTPUT->single_button($url, get_string('editpagecontent', 'lesson')));
}
}
}
}

View File

@ -507,9 +507,8 @@ if ($pageid != LESSON_EOL) {
}
if (!$highscores or $madeit) {
$lessoncontent .= $lessonoutput->paragraph(get_string("youmadehighscore", "lesson", $lesson->maxhighscores), 'center');
$params = array('id'=>$PAGE->cm->id, 'sesskey'=>sesskey());
$highscoresbutton = html_form::make_button($CFG->wwwroot.'/mod/lesson/highscores.php', $params, get_string('clicktopost', 'lesson'));
$lessoncontent .= $OUTPUT->button($highscoresbutton);
$aurl = new moodle_url($CFG->wwwroot.'/mod/lesson/highscores.php', array('id'=>$PAGE->cm->id, 'sesskey'=>sesskey()));
$lessoncontent .= $OUTPUT->single_button($aurl, get_string('clicktopost', 'lesson'));
} else {
$lessoncontent .= get_string("nothighscore", "lesson", $lesson->maxhighscores)."<br />";
}

View File

@ -224,7 +224,7 @@ class quiz_access_manager {
if ($strconfirmstartattempt) {
$form->button->add_confirm_action($strconfirmstartattempt);
}
echo $OUTPUT->button($form);
echo $OUTPUT->single_button($form);
}
echo "</div>\n";
}
@ -750,7 +750,7 @@ class securewindow_access_rule extends quiz_access_rule_base {
$form->button->title = $form->button->text;
$form->url = $this->_quizobj->review_url($attemptid);
$form->button->add_action(new popup_action('click', $form->url, 'quizpopup', $this->windowoptions));
return $OUTPUT->button($form);
return $OUTPUT->single_button($form);
}
/**

View File

@ -742,8 +742,8 @@ class quiz_attempt extends quiz {
public function print_restart_preview_button() {
global $CFG, $OUTPUT;
echo $OUTPUT->container_start('controls');
$options = array('cmid' => $this->cm->id, 'forcenew' => true);
echo $OUTPUT->button(html_form::make_button($this->start_attempt_url(), $options, get_string('startagain', 'quiz')));
$url = new moodle_url($this->start_attempt_url(), array('cmid' => $this->cm->id, 'forcenew' => true));
echo $OUTPUT->single_button($url, get_string('startagain', 'quiz'));
echo $OUTPUT->container_end();
}

View File

@ -603,15 +603,8 @@ function quiz_print_question_list($quiz, $pageurl, $allowdelete = true,
if (!$reordertool && !$quiz->shufflequestions) {
echo $OUTPUT->container_start('addpage');
$form = html_form::make_button($pageurl->out(true),
array('cmid' => $quiz->cmid,
'courseid' => $quiz->course,
'addpage' => $count,
'sesskey' => sesskey()),
get_string('addpagehere', 'quiz'),
'get');
$form->button->disabled = $hasattempts;
echo $OUTPUT->button($form);
$url = new moodle_url($pageurl->out(true), array('cmid' => $quiz->cmid, 'courseid' => $quiz->course, 'addpage' => $count, 'sesskey' => sesskey()));
echo $OUTPUT->single_button($url, get_string('addpagehere', 'quiz'), 'get', $hasattempts);
echo $OUTPUT->container_end();
}
$pageopen = false;

View File

@ -554,8 +554,8 @@ function quiz_grade_item_update($quiz, $grades=NULL) {
echo $OUTPUT->box_start('generalbox', 'notice');
echo '<p>'. $message .'</p>';
echo $OUTPUT->container_start('buttons');
echo $OUTPUT->button(html_form::make_button($regrade_link, null, get_string('regradeanyway', 'grades')));
echo $OUTPUT->button(html_form::make_button($back_link, null, get_string('cancel')));
echo $OUTPUT->single_button($regrade_link, get_string('regradeanyway', 'grades'));
echo $OUTPUT->single_button($back_link, get_string('cancel'));
echo $OUTPUT->container_end();
echo $OUTPUT->box_end();

View File

@ -409,8 +409,8 @@ class quiz_statistics_report extends quiz_default_report {
}
$quizinformationtablehtml .= $OUTPUT->box_start('boxaligncenter generalbox boxwidthnormal mdl-align');
$quizinformationtablehtml .= get_string('lastcalculated', 'quiz_statistics', $a);
$quizinformationtablehtml .= $OUTPUT->button(html_form::make_button($reporturl->out(true), $reporturl->params()+array('recalculate'=>1),
get_string('recalculatenow', 'quiz_statistics')));
$aurl = new moodle_url($reporturl->out(true), $reporturl->params()+array('recalculate'=>1));
$quizinformationtablehtml .= $OUTPUT->single_button($aurl, get_string('recalculatenow', 'quiz_statistics'));
$quizinformationtablehtml .= $OUTPUT->box_end();
}
$downloadoptions = $this->table->get_download_menu();

View File

@ -128,7 +128,7 @@ $form = html_form::make_button($attemptobj->processattempt_url(), $options, get_
$form->id = 'responseform';
$form->button->add_confirm_action(get_string('confirmclose', 'quiz'));
echo $OUTPUT->button($form);
echo $OUTPUT->single_button($form);
echo $OUTPUT->container_end();
/// Finish the page

View File

@ -484,13 +484,13 @@
$options["group"] = $currentgroup;
$options["type"] = "ods";
echo $OUTPUT->button(html_form::make_button("download.php", $options, get_string("downloadods")));
echo $OUTPUT->single_button(new moodle_url("download.php", $options), get_string("downloadods"));
$options["type"] = "xls";
echo $OUTPUT->button(html_form::make_button("download.php", $options, get_string("downloadexcel")));
echo $OUTPUT->single_button(new moodle_url("download.php", $options), get_string("downloadexcel"));
$options["type"] = "txt";
echo $OUTPUT->button(html_form::make_button("download.php", $options, get_string("downloadtext")));
echo $OUTPUT->single_button(new moodle_url("download.php", $options), get_string("downloadtext"));
echo $OUTPUT->container_end();
break;

View File

@ -37,10 +37,8 @@
$edit = '1';
}
$form = new html_form();
$form->url = new moodle_url("$CFG->wwwroot/my/index.php", array('edit' => $edit));
$form->button->text = $string;
$button = $OUTPUT->button($form);
$url = new moodle_url("$CFG->wwwroot/my/index.php", array('edit' => $edit));
$button = $OUTPUT->single_button($url, $string);
$header = $SITE->shortname . ': ' . $strmymoodle;
$PAGE->navbar->add($strmymoodle);

View File

@ -1927,10 +1927,8 @@ function create_new_question_button($categoryid, $params, $caption, $tooltip = '
global $CFG, $PAGE, $OUTPUT;
static $choiceformprinted = false;
$params['category'] = $categoryid;
$form = html_form::make_button($CFG->wwwroot . '/question/addquestion.php', $params, $caption,'get');
$form->button->title = $tooltip;
$form->button->disabled = $disabled;
echo $OUTPUT->button($form);
$url = new moodle_url($CFG->wwwroot . '/question/addquestion.php', $params);
echo $OUTPUT->single_button($url, $caption, 'get', array('disabled'=>$disabled, 'title'=>$tooltip));
echo $OUTPUT->help_icon('types', get_string('createnewquestion', 'question'), 'question');
$PAGE->requires->yui2_lib('dragdrop');

View File

@ -59,7 +59,7 @@ if ($reset and confirm_sesskey()) {
admin_externalpage_print_header('themeselector');
echo $OUTPUT->heading(get_string('themes'));
echo $OUTPUT->button(html_form::make_button('index.php', array('sesskey'=>sesskey(),'reset'=>1), get_string('themeresetcaches', 'admin')));
echo $OUTPUT->single_button(new moodle_url('index.php', array('sesskey'=>sesskey(),'reset'=>1)), get_string('themeresetcaches', 'admin'));
$table = new html_table();
$table->id = 'adminthemeselector';
@ -95,7 +95,7 @@ foreach ($themes as $themename => $themedir) {
// Contents of the second cell.
$infocell = $OUTPUT->heading($themename, 3);
if ($themename != $CFG->theme) {
$infocell .= $OUTPUT->button(html_form::make_button('index.php', array('choose' => $themename, 'sesskey' => sesskey()), get_string('choose'), 'get'));
$infocell .= $OUTPUT->single_button(new moodle_url('index.php', array('choose' => $themename, 'sesskey' => sesskey())), get_string('choose'), 'get');
}
$row[] = $infocell;

View File

@ -151,7 +151,7 @@ echo $OUTPUT->select(html_select::make_popup_form($popupurl, 'datatype', $option
/// Create a new category link
$options = array('action'=>'editcategory');
echo $OUTPUT->button(html_form::make_button('index.php', $options, get_string('profilecreatecategory', 'admin')));
echo $OUTPUT->single_button(new moodle_url('index.php', $options), get_string('profilecreatecategory', 'admin'));
echo '</div>';

View File

@ -278,13 +278,8 @@ EOF;
/// Print button
$form = new html_form();
$parameters = array ('wsusername' => $username, 'wspassword' => $password, 'print' => true);
$form->url = new moodle_url($CFG->wwwroot.'/webservice/wsdoc.php', $parameters); // Required
$form->button = new html_button();
$form->button->text = get_string('print','webservice'); // Required
$form->button->disabled = false;
$form->button->title = get_string('print','webservice');
$form->method = 'post';
$documentationhtml .= $OUTPUT->button($form);
$url = new moodle_url($CFG->wwwroot.'/webservice/wsdoc.php', $parameters); // Required
$documentationhtml .= $OUTPUT->single_button($url, get_string('print','webservice'));
$documentationhtml .= $this->output_empty_tag('br', array());