summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo/inc/locationinfo.inc.php
diff options
context:
space:
mode:
authorJannik Schönartz2017-11-30 12:59:49 +0100
committerJannik Schönartz2017-11-30 12:59:49 +0100
commite88a313149cb39e187baf74a2fc18cc7c5d86d81 (patch)
treef2019cc85e1ff50d0708cb4828357b2d7e6f1d7a /modules-available/locationinfo/inc/locationinfo.inc.php
parent[inc/Database] Do EXPLAIN SELECT at shutdown so we don't interfere with SQL_C... (diff)
downloadslx-admin-e88a313149cb39e187baf74a2fc18cc7c5d86d81.tar.gz
slx-admin-e88a313149cb39e187baf74a2fc18cc7c5d86d81.tar.xz
slx-admin-e88a313149cb39e187baf74a2fc18cc7c5d86d81.zip
[locationinfo] Reworked summary-panel to the new panel uuid stuff.
Diffstat (limited to 'modules-available/locationinfo/inc/locationinfo.inc.php')
-rw-r--r--modules-available/locationinfo/inc/locationinfo.inc.php76
1 files changed, 60 insertions, 16 deletions
diff --git a/modules-available/locationinfo/inc/locationinfo.inc.php b/modules-available/locationinfo/inc/locationinfo.inc.php
index 933eaf4d..64070cd4 100644
--- a/modules-available/locationinfo/inc/locationinfo.inc.php
+++ b/modules-available/locationinfo/inc/locationinfo.inc.php
@@ -23,6 +23,32 @@ class LocationInfo
}
/**
+ * Return list of locationids associated with given panel.
+ * @param string $paneluuid panel
+ * @param bool $recursive if true and paneltype == SUMMARY the result is recursive with all child room ids.
+ * @return int[] locationIds
+ */
+ public static function getLocationsOr404($paneluuid, $recursive = true)
+ {
+ $panel = Database::queryFirst('SELECT paneltype, locationids FROM locationinfo_panel WHERE paneluuid = :paneluuid',
+ compact('paneluuid'));
+ if ($panel !== false) {
+ $idArray = array_map('intval', explode(',', $panel['locationids']));
+ if ($panel['paneltype'] == "SUMMARY" && $recursive) {
+ $idList = Location::getRecursiveFlat($idArray);
+ $idArray = array();
+
+ foreach ($idList as $key => $value) {
+ $idArray[] = $key;
+ }
+ }
+ return $idArray;
+ }
+ http_response_code(404);
+ die('Panel not found');
+ }
+
+ /**
* Set current error message of given server. Pass null or false to clear.
*
* @param int $serverId id of server
@@ -47,27 +73,38 @@ class LocationInfo
}
/**
- * Creates and returns a default config for room that didn't saved a config yet.
+ * Creates and returns a default config for room that didn't save a config yet.
*
* @return array Return a default config.
*/
public static function defaultPanelConfig($type)
{
- return array(
- 'language' => 'en',
- 'mode' => 1,
- 'vertical' => false,
- 'eco' => false,
- 'prettytime' => true,
- 'scaledaysauto' => true,
- 'daystoshow' => 7,
- 'rotation' => 0,
- 'scale' => 50,
- 'switchtime' => 20,
- 'calupdate' => 30,
- 'roomupdate' => 15,
- 'configupdate' => 180,
- );
+ if ($type === 'DEFAULT') {
+ return array(
+ 'language' => 'en',
+ 'mode' => 1,
+ 'vertical' => false,
+ 'eco' => false,
+ 'prettytime' => true,
+ 'scaledaysauto' => true,
+ 'daystoshow' => 7,
+ 'rotation' => 0,
+ 'scale' => 50,
+ 'switchtime' => 20,
+ 'calupdate' => 30,
+ 'roomupdate' => 15,
+ 'configupdate' => 180,
+ );
+ }
+ if ($type === 'SUMMARY') {
+ return array(
+ 'language' => 'en',
+ 'calupdate' => 30,
+ 'roomupdate' => 15,
+ 'configupdate' => 180,
+ );
+ }
+ return array();
}
/**
@@ -81,6 +118,12 @@ class LocationInfo
return $ret['panelname'];
}
+ /**
+ * Hook called by runmode module where we should modify the client config according to our
+ * needs. Disable standby/logout timeouts, enable autologin, set URL.
+ * @param $machineUuid
+ * @param $panelUuid
+ */
public static function configHook($machineUuid, $panelUuid)
{
$row = Database::queryFirst('SELECT paneltype, panelconfig FROM locationinfo_panel WHERE paneluuid = :uuid',
@@ -98,6 +141,7 @@ class LocationInfo
ConfigHolder::add('SLX_ADDONS', '', 1000);
ConfigHolder::add('SLX_LOGOUT_TIMEOUT', '', 1000);
ConfigHolder::add('SLX_SCREEN_STANDBY_TIMEOUT', '', 1000);
+ ConfigHolder::add('SLX_SYSTEM_STANDBY_TIMEOUT', '', 1000);
ConfigHolder::add('SLX_AUTOLOGIN', '1', 1000);
}