Skip to content

Commit

Permalink
MDL-21198 used new simple_button class when doing OUTPUT->confirm() -…
Browse files Browse the repository at this point in the history
… more consistent and hopefully easier to remember than html_form::make_button() ;-)
  • Loading branch information
skodak committed Jan 3, 2010
1 parent 26eab8d commit dc6896e
Show file tree
Hide file tree
Showing 24 changed files with 53 additions and 53 deletions.
8 changes: 4 additions & 4 deletions admin/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
if (empty($sure)) {
$optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey());

$formcontinue = html_form::make_button('delete.php', $optionsyes, get_string('yes'));
$formcancel = html_form::make_button('index.php', null, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('delete.php', $optionsyes), get_string('yes'));
$formcancel = new single_button('index.php', get_string('no'), 'get');
echo $OUTPUT->confirm('Are you completely sure you want to delete everything inside the directory '. $deletedir .' ?', $formcontinue, $formcancel);
echo $OUTPUT->footer();
exit;
}

if (!data_submitted() or empty($reallysure)) {
$optionsyes = array('sure'=>'yes', 'sesskey'=>sesskey(), 'reallysure'=>'yes');
$formcontinue = html_form::make_button('delete.php', $optionsyes, get_string('yes'));
$formcancel = html_form::make_button('index.php', null, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('delete.php', $optionsyes), get_string('yes'));
$formcancel = new signle_button('index.php', get_string('no'), 'get');
echo $OUTPUT->confirm('Are you REALLY REALLY completely sure you want to delete everything inside the directory '.
$deletedir .' (this includes all user images, and any other course files that have been created) ?',
$formcontinue, $formcancel);
Expand Down
2 changes: 1 addition & 1 deletion admin/filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
echo $OUTPUT->heading($title);

$linkcontinue = new moodle_url($returnurl, array('action' => 'delete', 'filterpath' => $filterpath, 'confirm' => 1));
$formcancel = html_form::make_button($returnurl, null, get_string('no'), 'get');
$formcancel = new single_button($returnurl, get_string('no'), 'get');
echo $OUTPUT->confirm(get_string('deletefilterareyousuremessage', 'admin', $filtername), $linkcontinue, $formcancel);
echo $OUTPUT->footer();
exit;
Expand Down
4 changes: 2 additions & 2 deletions admin/innodb.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

} else {
$optionsyes = array('confirm'=>'1', 'sesskey'=>sesskey());
$formcontinue = html_form::make_button('innodb.php', $optionsyes, get_string('yes'));
$formcancel = html_form::make_button('index.php', null, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('innodb.php', $optionsyes), get_string('yes'));
$formcancel = new single_button('index.php', get_string('no'), 'get');
echo $OUTPUT->confirm('Are you sure you want convert all your tables to the InnoDB format?', $formcontinue, $formcancel);
echo $OUTPUT->footer();
}
Expand Down
4 changes: 2 additions & 2 deletions admin/mnet/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
$MNET->get_private_key();
$SESSION->mnet_confirm_delete_key = md5(sha1($MNET->keypair['keypair_PEM'])).':'.time();

$formcontinue = html_form::make_button('index.php', array('confirm' => md5($MNET->public_key)), get_string('yes'));
$formcancel = html_form::make_button('index.php', null, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('index.php', array('confirm' => md5($MNET->public_key))), get_string('yes'));
$formcancel = new single_button('index.php', get_string('no'), 'get');
echo $OUTPUT->confirm(get_string("deletekeycheck", "mnet"), $formcontinue, $formcancel);
exit;
} else {
Expand Down
8 changes: 4 additions & 4 deletions admin/roles/manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
$a->shortname = $roles[$roleid]->shortname;
$a->count = $DB->count_records('role_assignments', array('roleid'=>$roleid));

$formcontinue = html_form::make_button($baseurl, array('confirm' => 1, 'msg' => $msg), get_string('yes'));
$formcancel = html_form::make_button($baseurl, $optionsno, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url($baseurl, $optionsyes), get_string('yes'));
$formcancel = new single_button($baseurl, get_string('no'), 'get');
echo $OUTPUT->confirm(get_string('deleterolesure', 'role', $a), $formcontinue, $formcancel);
echo $OUTPUT->footer();
die;
Expand Down Expand Up @@ -172,8 +172,8 @@
} else {
$warning = get_string('resetrolesure', 'role', $a);
}
$formcontinue = html_form::make_button('manage.php', array('confirm' => 1, 'msg' => $msg), get_string('yes'));
$formcancel = html_form::make_button('manage.php', $optionsno, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('manage.php', $optionsyes), get_string('yes'));
$formcancel = new single_button(new moodle_url('manage.php', $optionsno), get_string('no'), 'get');
echo $OUTPUT->confirm(get_string('confirmmessage', 'bulkusers', $usernames), $formcontinue, $formcancel);
echo $OUTPUT->footer();
die;
Expand Down
4 changes: 2 additions & 2 deletions admin/user/user_bulk_confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
$userlist = $DB->get_records_select_menu('user', "id $in", $params, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
$usernames = implode(', ', $userlist);
echo $OUTPUT->heading(get_string('confirmation', 'admin'));
$formcontinue = html_form::make_button('user_bulk_confirm.php', array('confirm' => 1), get_string('yes'));
$formcancel = html_form::make_button('user_bulk.php', $optionsno, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('user_bulk_confirm.php', array('confirm' => 1)), get_string('yes'));
$formcancel = new single_button('user_bulk.php', get_string('no'), 'get');
echo $OUTPUT->confirm(get_string('confirmcheckfull', '', $usernames), $formcontinue, $formcancel);
}

Expand Down
4 changes: 2 additions & 2 deletions admin/user/user_bulk_delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
$userlist = $DB->get_records_select_menu('user', "id $in", $params, 'fullname', 'id,'.$DB->sql_fullname().' AS fullname');
$usernames = implode(', ', $userlist);
echo $OUTPUT->heading(get_string('confirmation', 'admin'));
$formcontinue = html_form::make_button('user_bulk_delete.php', array('confirm' => 1), get_string('yes'));
$formcancel = html_form::make_button('user_bulk.php', $optionsno, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('user_bulk_delete.php', array('confirm' => 1)), get_string('yes'));
$formcancel = new single_button('user_bulk.php', get_string('no'), 'get');
echo $OUTPUT->confirm(get_string('deletecheckfull', '', $usernames), $formcontinue, $formcancel);
}

Expand Down
4 changes: 2 additions & 2 deletions admin/user/user_bulk_forcepasswordchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
$usernames .= ', ...';
}
echo $OUTPUT->heading(get_string('confirmation', 'admin'));
$formcontinue = html_form::make_button('user_bulk_forcepasswordchange.php', array('confirm' => 1), get_string('yes'));
$formcancel = html_form::make_button('user_bulk.php', array(), get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('user_bulk_forcepasswordchange.php', array('confirm' => 1)), get_string('yes'));
$formcancel = new single_button('user_bulk.php', get_string('no'), 'get');
echo $OUTPUT->confirm(get_string('forcepasswordchangecheckfull', '', $usernames), $formcontinue, $formcancel);
}

Expand Down
4 changes: 2 additions & 2 deletions admin/user/user_bulk_message.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
echo $OUTPUT->heading(get_string('confirmation', 'admin'));
echo $OUTPUT->box($msg, 'boxwidthnarrow boxaligncenter generalbox', 'preview');

$formcontinue = html_form::make_button('user_bulk_message.php', array('confirm' => 1, 'msg' => $msg), get_string('yes'));
$formcancel = html_form::make_button('user_bulk.php', $optionsno, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('user_bulk_message.php', array('confirm' => 1, 'msg' => $msg)), get_string('yes'));
$formcancel = new single_button('user_bulk.php', get_string('no'), 'get');
echo $OUTPUT->confirm(get_string('confirmmessage', 'bulkusers', $usernames), $formcontinue, $formcancel);
echo $OUTPUT->footer();
die;
Expand Down
4 changes: 2 additions & 2 deletions admin/webservice/service.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
admin_externalpage_print_header();
$optionsyes = array('id'=>$id, 'action'=>'delete', 'confirm'=>1, 'sesskey'=>sesskey());
$optionsno = array('section'=>'externalservices');
$formcontinue = html_form::make_button('service.php', $optionsyes, get_string('delete'), 'post');
$formcancel = html_form::make_button("$CFG->wwwroot/$CFG->admin/settings.php", $optionsno, get_string('cancel'), 'get');
$formcontinue = new single_button(new moodle_url('service.php', $optionsyes), get_string('delete'), 'post');
$formcancel = new single_button(new moodle_url("$CFG->wwwroot/$CFG->admin/settings.php", $optionsno), get_string('cancel'), 'get');
echo $OUTPUT->confirm(get_string('deleteserviceconfirm', 'webservice', $service->name), $formcontinue, $formcancel);
echo $OUTPUT->footer();
die;
Expand Down
4 changes: 2 additions & 2 deletions admin/webservice/service_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
admin_externalpage_print_header();
$optionsyes = array('id'=>$id, 'action'=>'delete', 'confirm'=>1, 'sesskey'=>sesskey(), 'fid'=>$function->id);
$optionsno = array('id'=>$id);
$formcontinue = html_form::make_button('service_functions.php', $optionsyes, get_string('delete'), 'post');
$formcancel = html_form::make_button('service_functions.php', $optionsno, get_string('cancel'), 'get');
$formcontinue = new single_button(new moodle_url('service_functions.php', $optionsyes), get_string('delete'));
$formcancel = new single_button(new moodle_url('service_functions.php', $optionsno), get_string('cancel'), 'get');
echo $OUTPUT->confirm(get_string('removefunctionconfirm', 'webservice', (object)array('service'=>$service->name, 'function'=>$function->name)), $formcontinue, $formcancel);
echo $OUTPUT->footer();
die;
Expand Down
4 changes: 2 additions & 2 deletions course/mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@

// print_simple_box_start('center', '60%', '#FFAAAA', 20, 'noticebox');
echo $OUTPUT->box_start('noticebox');
$formcontinue = html_form::make_button("$CFG->wwwroot/course/mod.php", $optionsyes, get_string('yes'));
$formcancel = html_form::make_button($return, $optionsno, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url("$CFG->wwwroot/course/mod.php", $optionsyes), get_string('yes'));
$formcancel = new single_button(new moodle_url($return, $optionsno), get_string('no'), 'get');
echo $OUTPUT->confirm($strdeletecheckfull, $formcontinue, $formcancel);
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
Expand Down
4 changes: 2 additions & 2 deletions grade/edit/tree/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@
$strdeletecheckfull = get_string('deletecheck', '', $object->get_name());
$optionsyes = array('eid'=>$eid, 'confirm'=>1, 'sesskey'=>sesskey(), 'id'=>$course->id, 'action'=>'delete');
$optionsno = array('id'=>$course->id);
$formcontinue = html_form::make_button('index.php', $optionsyes, get_string('yes'));
$formcancel = html_form::make_button('index.php', $optionsno, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('index.php', $optionsyes), get_string('yes'));
$formcancel = new signle_button(new moodle_url('index.php', $optionsno), get_string('no'), 'get');
echo $OUTPUT->confirm($strdeletecheckfull, $formcontinue, $formcancel);
echo $OUTPUT->footer();
die;
Expand Down
4 changes: 2 additions & 2 deletions grade/export/key.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
echo $OUTPUT->header();
$optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1);
$optionsno = array('id'=>$courseid);
$formcontinue = html_form::make_button('key.php', $optionsyes, get_string('yes'), 'get');
$formcancel = html_form::make_button('keymanager.php', $optionsno, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('key.php', $optionsyes), get_string('yes'), 'get');
$formcancel = new single_button(new moodle_url('keymanager.php', $optionsno), get_string('no'), 'get');
echo $OUTPUT->confirm(get_string('deletekeyconfirm', 'userkey', $key->value), $formcontinue, $formcancel);
echo $OUTPUT->footer();
die;
Expand Down
4 changes: 2 additions & 2 deletions grade/import/key.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
echo $OUTPUT->header();
$optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1);
$optionsno = array('id'=>$courseid);
$formcontinue = html_form::make_button('key.php', $optionsyes, get_string('yes'), 'get');
$formcancel = html_form::make_button('keymanager.php', $optionsno, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('key.php', $optionsyes), get_string('yes'), 'get');
$formcancel = new single_button(new moodle_url('keymanager.php', $optionsno), get_string('no'), 'get');
echo $OUTPUT->confirm(get_string('deletekeyconfirm', 'userkey', $key->value), $formcontinue, $formcancel);
echo $OUTPUT->footer();
die;
Expand Down
4 changes: 2 additions & 2 deletions group/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
}
$message.='</ul>';
}
$formcontinue = html_form::make_button('delete.php', $optionsyes, get_string('yes'), 'post');
$formcancel = html_form::make_button('index.php', $optionsno, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('delete.php', $optionsyes), get_string('yes'), 'post');
$formcancel = new single_button(new moodle_url('index.php', $optionsno), get_string('no'), 'get');
echo $OUTPUT->confirm($message, $formcontinue, $formcancel);
echo $OUTPUT->footer();
}
4 changes: 2 additions & 2 deletions group/group.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
echo $OUTPUT->header();
$optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1);
$optionsno = array('id'=>$courseid);
$formcontinue = html_form::make_button('group.php', $optionsyes, get_string('yes'), 'get');
$formcancel = html_form::make_button($baseurl, $optionsno, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('group.php', $optionsyes), get_string('yes'), 'get');
$formcancel = new single_button(new moodle_url($baseurl, $optionsno), get_string('no'), 'get');
echo $OUTPUT->confirm(get_string('deletegroupconfirm', 'group', $group->name), $formcontinue, $formcancel);
echo $OUTPUT->footer();
die;
Expand Down
4 changes: 2 additions & 2 deletions group/grouping.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
echo $OUTPUT->header();
$optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1);
$optionsno = array('id'=>$courseid);
$formcontinue = html_form::make_button('grouping.php', $optionsyes, get_string('yes'), 'get');
$formcancel = html_form::make_button('groupings.php', $optionsno, get_string('no'), 'get');
$formcontinue = new single_button(new moodle_url('grouping.php', $optionsyes), get_string('yes'), 'get');
$formcancel = new single_button(new moodle_url('groupings.php', $optionsno), get_string('no'), 'get');
echo $OUTPUT->confirm(get_string('deletegroupingconfirm', 'group', $grouping->name), $formcontinue, $formcancel);
echo $OUTPUT->footer();
die;
Expand Down
2 changes: 1 addition & 1 deletion mod/lesson/pagetypes/branchtable.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function display($renderer, $attempt) {
$params['pageid'] = $this->properties->id;
$params['sesskey'] = sesskey();
$params['jumpto'] = $answer->jumpto;
$buttons[] = $renderer->button(html_form::make_button($CFG->wwwroot.'/mod/lesson/continue.php', $params, strip_tags(format_text($answer->answer, FORMAT_MOODLE, $options))));
$buttons[] = $renderer->button(new single_button(new moodle_url($CFG->wwwroot.'/mod/lesson/continue.php', $params), strip_tags(format_text($answer->answer, FORMAT_MOODLE, $options))));
$i++;
}
// Set the orientation
Expand Down
6 changes: 3 additions & 3 deletions mod/lesson/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@
echo $lessonoutput->header($lesson, $cm);
if ($lesson->timed) {
if ($lesson->retake) {
$continuelink = html_form::make_button($CFG->wwwroot.'/mod/lesson/view.php', array('id'=>$cm->id, 'pageid'=>$lesson->firstpageid, 'startlastseen'=>'no'), get_string('continue', 'lesson'), 'get');
$continuelink = new single_button(new moodle_url($CFG->wwwroot.'/mod/lesson/view.php', array('id'=>$cm->id, 'pageid'=>$lesson->firstpageid, 'startlastseen'=>'no')), get_string('continue', 'lesson'), 'get');
echo $lessonoutput->message(get_string('leftduringtimed', 'lesson'), $continuelink);
} else {
$courselink = html_form::make_button($CFG->wwwroot.'/course/view.php', array('id'=>$PAGE->course->id), get_string('returntocourse', 'lesson'), 'get');
$courselink = new single_button(new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$PAGE->course->id)), get_string('returntocourse', 'lesson'), 'get');
echo $lessonoutput->message(get_string('leftduringtimednoretake', 'lesson'), $courselink);
}
} else {
Expand All @@ -234,7 +234,7 @@
if ($attemptflag) {
if (!$lesson->retake) {
echo $lessonoutput->header($lesson, $cm, 'view');
$courselink = html_form::make_button($CFG->wwwroot.'/course/view.php', array('id'=>$PAGE->course->id), get_string('returntocourse', 'lesson'), 'get');
$courselink = new single_button(new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$PAGE->course->id)), get_string('returntocourse', 'lesson'), 'get');
echo $lessonoutput->message(get_string("noretake", "lesson"), $courselink);
echo $lessonoutput->footer();
exit();
Expand Down
4 changes: 2 additions & 2 deletions portfolio/add.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
} else {
$exporter->print_header('confirmcancel');
echo $OUTPUT->box_start();
$yesbutton = html_form::make_button($CFG->wwwroot . '/portfolio/add.php', array('id' => $dataid, 'cancel' => 1, 'cancelsure' => 1, 'logreturn' => $logreturn));
$nobutton = html_form::make_button($CFG->wwwroot . '/portfolio/add.php', array('id' => $dataid), get_string('no'));
$yesbutton = new single_button(new moodle_url($CFG->wwwroot . '/portfolio/add.php', array('id' => $dataid, 'cancel' => 1, 'cancelsure' => 1, 'logreturn' => $logreturn)). get_string('yes'));
$nobutton = new single_button(new moodle_url($CFG->wwwroot . '/portfolio/add.php', array('id' => $dataid)), get_string('no'));
if ($logreturn) {
$nobutton->url = $CFG->wwwroot . '/user/portfoliologs.php';
}
Expand Down
4 changes: 2 additions & 2 deletions repository/manage_instances.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@
}
exit;
}
$formcontinue = html_form::make_button($baseurl, array('delete' => $delete, 'sure' => 'yes'), get_string('yes'));
$formcancel = html_form::make_button($baseurl, array(), get_string('no'));
$formcontinue = new single_button(new moodle_url($baseurl, array('delete' => $delete, 'sure' => 'yes')), get_string('yes'));
$formcancel = new single_button($baseurl, get_string('no'));
echo $OUTPUT->confirm(get_string('confirmdelete', 'repository', $instance->name), $formcontinue, $formcancel);
$return = false;
} else {
Expand Down
4 changes: 2 additions & 2 deletions user/policy.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
echo '<a href="'.$CFG->sitepolicy.'" onclick="this.target=\'_blank\'">'.$strpolicyagreementclick.'</a>';
echo '</object></div>';

$formcontinue = html_form::make_button('policy.php', array('agree'=>1), get_string('yes'));
$formcancel = html_form::make_button($CFG->wwwroot.'/login/logout.php', array(), get_string('no'));
$formcontinue = new single_button(new moodle_url('policy.php', array('agree'=>1)), get_string('yes'));
$formcancel = new single_button($CFG->wwwroot.'/login/logout.php', get_string('no'));
echo $OUTPUT->confirm($strpolicyagree, $formcontinue, $formcancel);

echo $OUTPUT->footer();
Expand Down
Loading

0 comments on commit dc6896e

Please sign in to comment.