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

Changed hard coded strings to constants

parent 6ee7bfcf
No related branches found
No related tags found
No related merge requests found
...@@ -37,13 +37,13 @@ class settings_manager { ...@@ -37,13 +37,13 @@ class settings_manager {
*/ */
public static function save_settings($instanceid, $type, $subpluginname, $data) { public static function save_settings($instanceid, $type, $subpluginname, $data) {
global $DB; global $DB;
if ($type !== 'trigger' && $type !== 'step') { if ($type !== SETTINGS_TYPE_TRIGGER && $type !== SETTINGS_TYPE_STEP) {
throw new \coding_exception('Invalid type value. "step" or "trigger" expected.'); throw new \coding_exception('Invalid type value. "step" or "trigger" expected.');
} }
if ($type == 'trigger') { if ($type == SETTINGS_TYPE_TRIGGER) {
$lib = lib_manager::get_step_lib($subpluginname);
} else {
$lib = lib_manager::get_trigger_lib($subpluginname); $lib = lib_manager::get_trigger_lib($subpluginname);
} else {
$lib = lib_manager::get_step_lib($subpluginname);
} }
$settingsfields = $lib->instance_settings(); $settingsfields = $lib->instance_settings();
...@@ -88,10 +88,10 @@ class settings_manager { ...@@ -88,10 +88,10 @@ class settings_manager {
public static function get_settings($instanceid, $type) { public static function get_settings($instanceid, $type) {
global $DB; global $DB;
if ($type !== 'trigger' && $type !== 'step') { if ($type !== SETTINGS_TYPE_TRIGGER && $type !== SETTINGS_TYPE_STEP) {
throw new \coding_exception('Invalid type value. "step" or "trigger" expected.'); throw new \coding_exception('Invalid type value. "step" or "trigger" expected.');
} }
if ($type == 'trigger') { if ($type == SETTINGS_TYPE_TRIGGER) {
$instance = trigger_manager::get_instance($instanceid); $instance = trigger_manager::get_instance($instanceid);
} else { } else {
$instance = step_manager::get_step_instance($instanceid); $instance = step_manager::get_step_instance($instanceid);
...@@ -101,7 +101,7 @@ class settings_manager { ...@@ -101,7 +101,7 @@ class settings_manager {
return null; return null;
} }
if ($type == 'trigger') { if ($type == SETTINGS_TYPE_TRIGGER) {
$lib = lib_manager::get_trigger_lib($instance->subpluginname); $lib = lib_manager::get_trigger_lib($instance->subpluginname);
} else { } else {
$lib = lib_manager::get_step_lib($instance->subpluginname); $lib = lib_manager::get_step_lib($instance->subpluginname);
......
...@@ -32,7 +32,9 @@ define('ACTION_DOWN_STEP', 'down_step'); ...@@ -32,7 +32,9 @@ define('ACTION_DOWN_STEP', 'down_step');
define('ACTION_UP_WORKFLOW', 'up_workflow'); define('ACTION_UP_WORKFLOW', 'up_workflow');
define('ACTION_DOWN_WORKFLOW', 'down_workflow'); define('ACTION_DOWN_WORKFLOW', 'down_workflow');
define('ACTION_STEP_INSTANCE_FORM', 'step_instance_form'); define('ACTION_STEP_INSTANCE_FORM', 'step_instance_form');
define('ACTION_TRIGGER_INSTANCE_FORM', 'step_instance_form'); define('SETTINGS_TYPE_TRIGGER', 'trigger');
define('SETTINGS_TYPE_STEP', 'step');
define('ACTION_TRIGGER_INSTANCE_FORM', 'trigger_instance_form');
define('ACTION_STEP_INSTANCE_DELETE', 'step_instance_delete'); define('ACTION_STEP_INSTANCE_DELETE', 'step_instance_delete');
define('ACTION_WORKFLOW_INSTANCE_FROM', 'workflow_instance_form'); define('ACTION_WORKFLOW_INSTANCE_FROM', 'workflow_instance_form');
define('ACTION_WORKFLOW_DELETE', 'workflow_instance_delete'); define('ACTION_WORKFLOW_DELETE', 'workflow_instance_delete');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment