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

After creation of new workflow, redirect to details page

parent 330da020
No related branches found
No related tags found
No related merge requests found
...@@ -165,6 +165,17 @@ class subplugin_settings { ...@@ -165,6 +165,17 @@ class subplugin_settings {
$this->view_footer(); $this->view_footer();
} }
/**
* Redirect to workflow details page.
* @param $workflowid int id of the workflow.
* @throws \moodle_exception
*/
private function view_workflow_details($workflowid) {
$url = new \moodle_url('/admin/tool/cleanupcourses/workflowsettings.php',
array('workflowid' => $workflowid, 'sesskey' => sesskey()));
redirect($url);
}
/** /**
* Write the page header * Write the page header
*/ */
...@@ -214,10 +225,17 @@ class subplugin_settings { ...@@ -214,10 +225,17 @@ class subplugin_settings {
if ($data->id) { if ($data->id) {
$workflow = workflow_manager::get_workflow($data->id); $workflow = workflow_manager::get_workflow($data->id);
$workflow->title = $data->title; $workflow->title = $data->title;
$newworkflow = false;
} else { } else {
$workflow = workflow::from_record($data); $workflow = workflow::from_record($data);
$newworkflow = true;
} }
workflow_manager::insert_or_update($workflow); workflow_manager::insert_or_update($workflow);
// If a new workflow was created, redirect to details page to directly create a trigger.
if ($newworkflow) {
$this->view_workflow_details($workflow->id);
return;
}
} }
$this->view_plugins_table(); $this->view_plugins_table();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment