MDL-61864 tool_policy: cancel button when agreeing to policies
Show cancel button during signup only and do not show when user is logged in and has to accept changed policies When cancel button is clicked redirect to the site homepage
This commit is contained in:
@@ -401,6 +401,9 @@ class page_agreedocs implements renderable, templatable {
|
||||
$data->behalfuser = html_writer::link(\context_user::instance($this->behalfid)->get_url(), $userfullname);
|
||||
}
|
||||
|
||||
// User can cancel accepting policies only if it is a part of signup.
|
||||
$data->cancancel = !isloggedin() || isguestuser();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ define('NO_SITEPOLICY_CHECK', true);
|
||||
// @codingStandardsIgnoreLine See the {@link page_agreedocs} for the access control checks.
|
||||
require(__DIR__.'/../../../config.php');
|
||||
|
||||
$action = optional_param('action', null, PARAM_ALPHA);
|
||||
$submit = optional_param('submit', null, PARAM_NOTAGS);
|
||||
$cancel = optional_param('cancel', null, PARAM_NOTAGS);
|
||||
$agreedocs = optional_param_array('agreedoc', null, PARAM_INT);
|
||||
$behalfid = optional_param('userid', null, PARAM_INT);
|
||||
|
||||
@@ -59,8 +60,10 @@ if (!empty($USER->id)) {
|
||||
|
||||
if (!$haspermissionagreedocs) {
|
||||
$outputpage = new \tool_policy\output\page_nopermission($behalfid);
|
||||
} else if ($cancel) {
|
||||
redirect(new moodle_url('/'));
|
||||
} else {
|
||||
$outputpage = new \tool_policy\output\page_agreedocs($agreedocs, $behalfid, $action);
|
||||
$outputpage = new \tool_policy\output\page_agreedocs($agreedocs, $behalfid, $submit);
|
||||
}
|
||||
|
||||
$output = $PAGE->get_renderer('tool_policy');
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
|
||||
<form id="agreedocsform" method="post" action="{{myurl}}">
|
||||
<input type="hidden" name="sesskey" value="{{sesskey}}">
|
||||
<input type="hidden" name="action" value="agreedocs">
|
||||
|
||||
{{#behalfuser}}
|
||||
<div class="clearfix">
|
||||
@@ -115,9 +114,10 @@
|
||||
{{# str }}somefieldsrequired, form, <i class="icon fa fa-exclamation-circle text-danger fa-fw" title="{{# str }} required {{/ str }}" ></i>{{/ str }}
|
||||
<hr>
|
||||
|
||||
<input type="submit" class="btn btn-primary" value={{#quote}}{{#str}} next {{/str}}{{/quote}}>
|
||||
<input type="reset" class="btn btn-secondary" value={{#quote}}{{#str}} cancel {{/str}}{{/quote}}>
|
||||
|
||||
<input type="submit" class="btn btn-primary" name="submit" value={{#quote}}{{#str}} next {{/str}}{{/quote}}>
|
||||
{{#cancancel}}
|
||||
<input type="submit" class="btn btn-secondary" name="cancel" value={{#quote}}{{#str}} cancel {{/str}}{{/quote}}>
|
||||
{{/cancancel}}
|
||||
</form>
|
||||
|
||||
{{#js}}
|
||||
|
||||
Reference in New Issue
Block a user