summaryrefslogtreecommitdiffstats
path: root/modules-available/roomplanner/page.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2016-09-07 19:13:24 +0200
committerSimon Rettberg2016-09-07 19:13:24 +0200
commit78c2407ba64007256f61328e2c58daa3bd49cd97 (patch)
treef2f05b1794a83e9c59782cf5b615fab0a3072feb /modules-available/roomplanner/page.inc.php
parent[sysconfig] Confirm dialog for deletion; show success message after deleting ... (diff)
downloadslx-admin-78c2407ba64007256f61328e2c58daa3bd49cd97.tar.gz
slx-admin-78c2407ba64007256f61328e2c58daa3bd49cd97.tar.xz
slx-admin-78c2407ba64007256f61328e2c58daa3bd49cd97.zip
[roomplanner] Add managerip field, move mgr/tutor fields to location_roomplanner table, add to install.inc.php
Diffstat (limited to 'modules-available/roomplanner/page.inc.php')
-rw-r--r--modules-available/roomplanner/page.inc.php25
1 files changed, 18 insertions, 7 deletions
diff --git a/modules-available/roomplanner/page.inc.php b/modules-available/roomplanner/page.inc.php
index 2d3b5187..8826615d 100644
--- a/modules-available/roomplanner/page.inc.php
+++ b/modules-available/roomplanner/page.inc.php
@@ -60,7 +60,7 @@ class Page_Roomplanner extends Page
if (Request::get('pvs', false, 'bool')) {
/* return a pvs-file */
echo "<pre>";
- echo PvsGenerator::generate($locationid);
+ echo PvsGenerator::generate();
echo "</pre>";
die();
}
@@ -68,12 +68,19 @@ class Page_Roomplanner extends Page
if ($this->action === 'show') {
/* do nothing */
Dashboard::disable();
- $furniture = $this->getFurniture();
+ $config = Database::queryFirst('SELECT roomplan, managerip FROM location_roomplan WHERE locationid = :locationid', ['locationid' => $this->locationid]);
+ if ($config !== false) {
+ $managerIp = $config['managerip'];
+ } else {
+ $managerIp = '';
+ }
+ $furniture = $this->getFurniture($config);
$subnetMachines = $this->getPotentialMachines();
$machinesOnPlan = $this->getMachinesOnPlan();
$roomConfig = array_merge($furniture, $machinesOnPlan);
Render::addTemplate('page', [
'location' => $this->location,
+ 'managerip' => $managerIp,
'subnetMachines' => json_encode($subnetMachines),
'locationid' => $this->locationid,
'roomConfiguration' => json_encode($roomConfig)]);
@@ -201,14 +208,18 @@ class Page_Roomplanner extends Page
protected function saveRoomConfig($furniture)
{
$obj = json_encode(['furniture' => $furniture]);
- Database::exec('INSERT INTO location_roomplan (locationid, roomplan) VALUES (:locationid, :roomplan) ON DUPLICATE KEY UPDATE roomplan=:roomplan',
- ['locationid' => $this->locationid,
- 'roomplan' => $obj]);
+ Database::exec('INSERT INTO location_roomplan (locationid, roomplan, managerip, tutoruuid)'
+ . ' VALUES (:locationid, :roomplan, :managerip, :tutoruuid)'
+ . ' ON DUPLICATE KEY UPDATE roomplan=VALUES(roomplan), managerip=VALUES(managerip), tutoruuid=VALUES(tutoruuid)', [
+ 'locationid' => $this->locationid,
+ 'roomplan' => $obj,
+ 'managerip' => Request::post('managerip', '', 'string'),
+ 'tutoruuid' => '' // TODO
+ ]);
}
- protected function getFurniture()
+ protected function getFurniture($config)
{
- $config = Database::queryFirst('SELECT roomplan FROM location_roomplan WHERE locationid = :locationid', ['locationid' => $this->locationid]);
if ($config === false) {
return array();
}