Skip to content
Snippets Groups Projects
Commit 740f7765 authored by Justus Dieckmann's avatar Justus Dieckmann
Browse files

Rollbackdelay, finishdelay and delayallworkflows to mform

parent 4233ff20
No related branches found
No related tags found
No related merge requests found
...@@ -49,7 +49,16 @@ class workflow { ...@@ -49,7 +49,16 @@ class workflow {
/** title that is displayed to users */ /** title that is displayed to users */
public $displaytitle; public $displaytitle;
private function __construct($id, $title, $timeactive, $timedeactive, $sortindex, $manual, $displaytitle) { /** @var int the delay in case of rollback */
public $rollbackdelay;
/** @var int the delay in case of finished course */
public $finishdelay;
public $delayforallworkflows;
private function __construct($id, $title, $timeactive, $timedeactive, $sortindex, $manual, $displaytitle,
$rollbackdelay, $finishdelay, $delayforallworkflows) {
$this->id = $id; $this->id = $id;
$this->title = $title; $this->title = $title;
$this->timeactive = $timeactive; $this->timeactive = $timeactive;
...@@ -57,6 +66,9 @@ class workflow { ...@@ -57,6 +66,9 @@ class workflow {
$this->sortindex = $sortindex; $this->sortindex = $sortindex;
$this->manual = $manual; $this->manual = $manual;
$this->displaytitle = $displaytitle; $this->displaytitle = $displaytitle;
$this->rollbackdelay = $rollbackdelay;
$this->finishdelay = $finishdelay;
$this->delayforallworkflows = $delayforallworkflows;
} }
/** /**
...@@ -103,7 +115,23 @@ class workflow { ...@@ -103,7 +115,23 @@ class workflow {
$displaytitle = $record->displaytitle; $displaytitle = $record->displaytitle;
} }
$instance = new self($id, $record->title, $timeactive, $timedeactive, $sortindex, $manual, $displaytitle); $rollbackdelay = null;
if (object_property_exists($record, 'rollbackdelay')) {
$rollbackdelay = $record->rollbackdelay;
}
$finishdelay = null;
if (object_property_exists($record, 'finishdelay')) {
$finishdelay = $record->finishdelay;
}
$delayforallworkflows = null;
if (object_property_exists($record, 'delayforallworkflows')) {
$delayforallworkflows = $record->delayforallworkflows;
}
$instance = new self($id, $record->title, $timeactive, $timedeactive, $sortindex, $manual, $displaytitle,
$rollbackdelay, $finishdelay, $delayforallworkflows);
return $instance; return $instance;
} }
......
...@@ -83,6 +83,27 @@ class form_workflow_instance extends \moodleform { ...@@ -83,6 +83,27 @@ class form_workflow_instance extends \moodleform {
$mform->setDefault($elementname, $this->workflow->displaytitle); $mform->setDefault($elementname, $this->workflow->displaytitle);
} }
$elementname = 'rollbackdelay';
$mform->addElement('duration', $elementname, get_string('workflow_rollbackdelay', 'tool_lifecycle'));
$mform->setType($elementname, PARAM_INT);
if (isset($this->workflow)) {
$mform->setDefault($elementname, $this->workflow->rollbackdelay);
}
$elementname = 'finishdelay';
$mform->addElement('duration', $elementname, get_string('workflow_finishdelay', 'tool_lifecycle'));
$mform->setType($elementname, PARAM_INT);
if (isset($this->workflow)) {
$mform->setDefault($elementname, $this->workflow->finishdelay);
}
$elementname = 'delayforallworkflows';
$mform->addElement('checkbox', $elementname, get_string('workflow_delayforallworkflows', 'tool_lifecycle'));
$mform->setType($elementname, PARAM_BOOL);
if (isset($this->workflow)) {
$mform->setDefault($elementname, $this->workflow->delayforallworkflows);
}
$this->add_action_buttons(); $this->add_action_buttons();
} }
......
...@@ -72,6 +72,9 @@ $string['workflow_title'] = 'Title'; ...@@ -72,6 +72,9 @@ $string['workflow_title'] = 'Title';
$string['workflow_title_help'] = 'Workflow title (visible for admins only).'; $string['workflow_title_help'] = 'Workflow title (visible for admins only).';
$string['workflow_displaytitle'] = 'Displayed workflow title'; $string['workflow_displaytitle'] = 'Displayed workflow title';
$string['workflow_displaytitle_help'] = 'This title is displayed to users when managing their courses.'; $string['workflow_displaytitle_help'] = 'This title is displayed to users when managing their courses.';
$string['workflow_rollbackdelay'] = 'Delay in case of rollback';
$string['workflow_finishdelay'] = 'Delay in case of finished course';
$string['workflow_delayforallworkflows'] = 'Delay for all Workflows?';
$string['workflow_active'] = 'Active'; $string['workflow_active'] = 'Active';
$string['workflow_processes'] = 'Active processes'; $string['workflow_processes'] = 'Active processes';
$string['workflow_timeactive'] = 'Active since'; $string['workflow_timeactive'] = 'Active since';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment