summaryrefslogtreecommitdiffstats
path: root/modules-available/runmode/inc/runmode.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2017-11-30 18:30:01 +0100
committerSimon Rettberg2017-11-30 18:30:01 +0100
commitb90c97b1f096008b5fa9abf8c50a120a85c47a4e (patch)
tree2e6de58e0de3d044549946b352cb6b2bd61916fd /modules-available/runmode/inc/runmode.inc.php
parentUpdate translations (diff)
downloadslx-admin-b90c97b1f096008b5fa9abf8c50a120a85c47a4e.tar.gz
slx-admin-b90c97b1f096008b5fa9abf8c50a120a85c47a4e.tar.xz
slx-admin-b90c97b1f096008b5fa9abf8c50a120a85c47a4e.zip
[roomplanner] Refactor to use runmode
Diffstat (limited to 'modules-available/runmode/inc/runmode.inc.php')
-rw-r--r--modules-available/runmode/inc/runmode.inc.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/modules-available/runmode/inc/runmode.inc.php b/modules-available/runmode/inc/runmode.inc.php
index 59f8cf01..50ae2d72 100644
--- a/modules-available/runmode/inc/runmode.inc.php
+++ b/modules-available/runmode/inc/runmode.inc.php
@@ -36,6 +36,9 @@ class RunMode
*/
public static function setRunMode($machineuuid, $moduleId, $modeId, $modeData = null, $isClient = null)
{
+ if (is_object($moduleId)) {
+ $moduleId = $moduleId->getIdentifier();
+ }
// - Check if machine exists
$machine = Statistics::getMachine($machineuuid, Machine::NO_DATA);
if ($machine === false)
@@ -196,6 +199,21 @@ class RunMode
return call_user_func($conf->getModeName, $modeId);
}
+ /**
+ * Delete given runmode.
+ *
+ * @param string|\Module $module Module runmode belongs to
+ * @param string $modeId run mode id
+ */
+ public static function deleteMode($module, $modeId)
+ {
+ if (is_object($module)) {
+ $module = $module->getIdentifier();
+ }
+ Database::exec('DELETE FROM runmode WHERE module = :module AND modeid = :modeId',
+ compact('module', 'modeId'));
+ }
+
}
/* *\
@@ -235,6 +253,10 @@ class RunModeModuleConfig
* @var bool If true, config.tgz should not be downloaded by the client
*/
public $noSysconfig = false;
+ /**
+ * @var bool Allow adding and removing machines to this mode via the generic form
+ */
+ public $allowGenericEditor = true;
public function __construct($file)
{
@@ -248,6 +270,7 @@ class RunModeModuleConfig
$this->loadType($data, 'configHook', 'string');
$this->loadType($data, 'isClient', 'boolean');
$this->loadType($data, 'noSysconfig', 'boolean');
+ $this->loadType($data, 'allowGenericEditor', 'boolean');
}
private function loadType($data, $key, $type)