Skip to content
Snippets Groups Projects
Commit 1d8ee52e authored by Tobias Reischmann's avatar Tobias Reischmann
Browse files

Show cancle button in non-editing mode of step and trigger forms

parent 178070d9
Branches
Tags
No related merge requests found
...@@ -88,8 +88,7 @@ class form_step_instance extends \moodleform { ...@@ -88,8 +88,7 @@ class form_step_instance extends \moodleform {
$this->lib = lib_manager::get_step_lib($this->subpluginname); $this->lib = lib_manager::get_step_lib($this->subpluginname);
$this->stepsettings = $stepsettings; $this->stepsettings = $stepsettings;
$editable = workflow_manager::is_editable($workflowid); parent::__construct($url, null, 'post', '', null);
parent::__construct($url, null, 'post', '', null, $editable);
} }
/** /**
...@@ -130,7 +129,7 @@ class form_step_instance extends \moodleform { ...@@ -130,7 +129,7 @@ class form_step_instance extends \moodleform {
} }
// For active workflows, we do not want the form to be editable. // For active workflows, we do not want the form to be editable.
if ($this->workflowid && workflow_manager::is_active($this->workflowid)) { if ($this->workflowid && !workflow_manager::is_editable($this->workflowid)) {
$this->add_cancel_button(); $this->add_cancel_button();
} else { } else {
$this->add_action_buttons(); $this->add_action_buttons();
...@@ -181,7 +180,7 @@ class form_step_instance extends \moodleform { ...@@ -181,7 +180,7 @@ class form_step_instance extends \moodleform {
$this->lib->extend_add_instance_form_definition_after_data($mform, $this->stepsettings); $this->lib->extend_add_instance_form_definition_after_data($mform, $this->stepsettings);
// For active workflows, we do not want the form to be editable. // For active workflows, we do not want the form to be editable.
if ($this->workflowid && workflow_manager::is_active($this->workflowid)) { if ($this->workflowid && !workflow_manager::is_editable($this->workflowid)) {
// The group buttonar is the array of submit buttons. For inactive workflows this is only a cancel button. // The group buttonar is the array of submit buttons. For inactive workflows this is only a cancel button.
$mform->hardFreezeAllVisibleExcept(array('buttonar')); $mform->hardFreezeAllVisibleExcept(array('buttonar'));
} }
......
...@@ -93,8 +93,7 @@ class form_trigger_instance extends \moodleform { ...@@ -93,8 +93,7 @@ class form_trigger_instance extends \moodleform {
$this->lib = lib_manager::get_trigger_lib($this->subpluginname); $this->lib = lib_manager::get_trigger_lib($this->subpluginname);
} }
$editable = workflow_manager::is_editable($workflowid); parent::__construct($url, null, 'post', '', null);
parent::__construct($url, null, 'post', '', null, $editable);
} }
/** /**
...@@ -136,7 +135,7 @@ class form_trigger_instance extends \moodleform { ...@@ -136,7 +135,7 @@ class form_trigger_instance extends \moodleform {
} }
// For active workflows, we do not want the form to be editable. // For active workflows, we do not want the form to be editable.
if ($this->workflowid && workflow_manager::is_active($this->workflowid)) { if ($this->workflowid && !workflow_manager::is_editable($this->workflowid)) {
$this->add_cancel_button(); $this->add_cancel_button();
} else { } else {
$this->add_action_buttons(); $this->add_action_buttons();
...@@ -184,7 +183,7 @@ class form_trigger_instance extends \moodleform { ...@@ -184,7 +183,7 @@ class form_trigger_instance extends \moodleform {
} }
// For active workflows, we do not want the form to be editable. // For active workflows, we do not want the form to be editable.
if ($this->workflowid && workflow_manager::is_active($this->workflowid)) { if ($this->workflowid && !workflow_manager::is_editable($this->workflowid)) {
// The group buttonar is the array of submit buttons. For inactive workflows this is only a cancel button. // The group buttonar is the array of submit buttons. For inactive workflows this is only a cancel button.
$mform->hardFreezeAllVisibleExcept(array('buttonar')); $mform->hardFreezeAllVisibleExcept(array('buttonar'));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment