diff options
author | Jannik Schönartz | 2017-12-28 15:55:49 +0100 |
---|---|---|
committer | Jannik Schönartz | 2017-12-28 15:55:49 +0100 |
commit | 086c7458fe2c59dbb907755648362917c615404e (patch) | |
tree | a0ddf550223e628e70bcf9fe33096c1f000d2742 /modules-available/statistics/pages/projectors.inc.php | |
parent | [usb-lock-off] Switched to the _hw db structure. Adding a device and db contr... (diff) | |
parent | [sysconfig] Restore long lost ajax functionality (diff) | |
download | slx-admin-086c7458fe2c59dbb907755648362917c615404e.tar.gz slx-admin-086c7458fe2c59dbb907755648362917c615404e.tar.xz slx-admin-086c7458fe2c59dbb907755648362917c615404e.zip |
Merge branch 'origin/master' into usb-lock-off
Diffstat (limited to 'modules-available/statistics/pages/projectors.inc.php')
-rw-r--r-- | modules-available/statistics/pages/projectors.inc.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/modules-available/statistics/pages/projectors.inc.php b/modules-available/statistics/pages/projectors.inc.php new file mode 100644 index 00000000..cde542c6 --- /dev/null +++ b/modules-available/statistics/pages/projectors.inc.php @@ -0,0 +1,58 @@ +<?php + +class SubPage +{ + + public static function doPreprocess() + { + $action = Request::post('action', false, 'string'); + if ($action !== false) { + self::handleProjector($action); + } + } + + private static function handleProjector($action) + { + $hwid = Request::post('hwid', false, 'int'); + if ($hwid === false) { + Util::traceError('Param hwid missing'); + } + if ($action === 'addprojector') { + Database::exec('INSERT INTO statistic_hw_prop (hwid, prop, value)' + . ' VALUES (:hwid, :prop, :value)', array( + 'hwid' => $hwid, + 'prop' => 'projector', + 'value' => 'true', + )); + } else { + Database::exec('DELETE FROM statistic_hw_prop WHERE hwid = :hwid AND prop = :prop', array( + 'hwid' => $hwid, + 'prop' => 'projector', + )); + } + if (Module::isAvailable('sysconfig')) { + ConfigTgz::rebuildAllConfigs(); + } + Util::redirect('?do=statistics&show=projectors'); + } + + public static function doRender() + { + self::showProjectors(); + } + + private static function showProjectors() + { + $res = Database::simpleQuery('SELECT h.hwname, h.hwid FROM statistic_hw h' + . " INNER JOIN statistic_hw_prop p ON (h.hwid = p.hwid AND p.prop = :projector)" + . " WHERE h.hwtype = :screen ORDER BY h.hwname ASC", array( + 'projector' => 'projector', + 'screen' => DeviceType::SCREEN, + )); + $data = array( + 'projectors' => $res->fetchAll(PDO::FETCH_ASSOC) + ); + Render::addTemplate('projector-list', $data); + } + +}
\ No newline at end of file |