aboutsummaryrefslogtreecommitdiff
path: root/lib/models/CourseWizardStepRegistry.php
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:07:19 +0200
committerJan-Hendrik Willms <tleilax+github@gmail.com>2021-07-22 16:19:12 +0200
commita3da1483a9e689846179159355badfec8073dbec (patch)
tree770dcca6bdf5f6f2a11b0e7fcbbeda6919a3fc52 /lib/models/CourseWizardStepRegistry.php
current code from svn, revision 62608
Diffstat (limited to 'lib/models/CourseWizardStepRegistry.php')
-rw-r--r--lib/models/CourseWizardStepRegistry.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/lib/models/CourseWizardStepRegistry.php b/lib/models/CourseWizardStepRegistry.php
new file mode 100644
index 0000000..4f9eb6fc
--- /dev/null
+++ b/lib/models/CourseWizardStepRegistry.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * CourseWizardStepRegistry.php
+ * Model class for table coursewizardsteps.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * @author Thomas Hackl <thomas.hackl@uni-passau.de>
+ * @copyright 2015 Stud.IP Core-Group
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
+ * @category Stud.IP
+ */
+
+class CourseWizardStepRegistry extends SimpleORMap
+{
+
+ protected static function configure($config = [])
+ {
+ $config['db_table'] = 'coursewizardsteps';
+ parent::configure($config);
+ }
+
+ public static function registerStep($name, $class, $number, $enabled=false)
+ {
+ $step = new CourseWizardStepRegistry();
+ $step->name = $name;
+ $step->classname = $class;
+ $step->number = $number;
+ $step->enabled = $enabled ? 1 : 0;
+ return $step->store();
+ }
+
+ public static function unregisterStep($id)
+ {
+ $step = self::find($id);
+ if ($step)
+ {
+ return $step->delete();
+ }
+ return true;
+ }
+
+ public static function hasEnabledSteps()
+ {
+ return sizeof(self::findBySQL("`enabled`=1")) > 0 ? true : false;
+ }
+
+} \ No newline at end of file