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

Coding style

parent af91e941
No related branches found
No related tags found
No related merge requests found
......@@ -34,17 +34,6 @@ require_once($CFG->libdir . '/formslib.php');
*/
class form_upload_workflow extends \moodleform {
/**
* Constructor
* @param \moodle_url $url.
* @param workflow $workflow workflow entity.
* @throws \moodle_exception if neither step nor subpluginname are set.
*/
public function __construct($url) {
parent::__construct($url);
}
/**
* Defines forms elements
*/
......
......@@ -150,7 +150,8 @@ class restore_lifecycle_workflow {
$installedtrigger = \core_component::get_plugin_list('lifecycletrigger');
foreach ($this->trigger as $trigger) {
if (!array_key_exists($trigger->subpluginname, $installedtrigger)) {
$this->errors[] = get_string('restore_trigger_does_not_exist', 'tool_lifecycle', $trigger->subpluginname); return false;
$this->errors[] = get_string('restore_trigger_does_not_exist',
'tool_lifecycle', $trigger->subpluginname);
}
}
if (count($this->errors) > 0) {
......@@ -165,7 +166,9 @@ class restore_lifecycle_workflow {
*/
private function persist() {
workflow_manager::insert_or_update($this->workflow);
usort($this->steps, function($a, $b) {return $a->sortindex > $b->sortindex;});
usort($this->steps, function($a, $b) {
return $a->sortindex > $b->sortindex;
});
foreach ($this->steps as $step) {
$step->workflowid = $this->workflow->id;
$stepid = $step->id;
......@@ -179,7 +182,9 @@ class restore_lifecycle_workflow {
}
}
}
usort($this->trigger, function($a, $b) {return $a->sortindex > $b->sortindex;});
usort($this->trigger, function($a, $b) {
return $a->sortindex > $b->sortindex;
});
foreach ($this->trigger as $trigger) {
$trigger->workflowid = $this->workflow->id;
$triggerid = $trigger->id;
......
......@@ -147,7 +147,7 @@ $string['manual_trigger_process_existed'] = 'A workflow for this course already
$string['workflow_started'] = 'Workflow started.';
$string['workflow_is_running'] = 'Workflow is running.';
// Backup & Restore
// Backup & Restore.
$string['restore_workflow_not_found'] = 'Wrong format of the backup file. The workflow could not be found.';
$string['restore_subplugins_invalid'] = 'Wrong format of the backup file. The structure of the subplugin elements is not as expected.';
$string['restore_step_does_not_exist'] = 'The step {$a} is not installed, but is included in the backup file. Please installed it first and try again.';
......
......@@ -36,21 +36,25 @@ use tool_lifecycle\manager\workflow_manager;
class tool_lifecycle_generator extends testing_module_generator {
private static $defaultsteps = [
"deletecourse" =>
["maximumdeletionspercron" => 10],
"email" =>
["responsetimeout" => 10,
"deletecourse" => [
"maximumdeletionspercron" => 10
],
"email" => [
"responsetimeout" => 10,
"subject" => "Test Email",
"content" => "Content",
"contenthtml"=> "Content HTML"],
"contenthtml" => "Content HTML"
],
"createbackup" => [],
];
private static $defaulttrigger = [
"startdatedelay" =>
["delay" => 10000],
"categories" =>
["categories" => "1,10",
"exclude" => true],
"startdatedelay" => [
"delay" => 10000
],
"categories" => [
"categories" => "1,10",
"exclude" => true
],
];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment