From 4c0862efe57fbdaa51a69c8dc39f6fc4ae45fa20 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 19 Mar 2021 13:54:22 +0100 Subject: [locations/rebootcontrol] Inherit openingtimes for WOL/shutdown The opening times schedule is now inherited to child locations, so it's easy to toggle WOL or shutdown for individual rooms in a building, where you only have to set the opening times once for the entire building. As of now, WOL and shutdown settings are *not* inherited to child locations, as I'm not sure if you always want to inherit those by default. Closes #3710 --- inc/database.inc.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'inc') diff --git a/inc/database.inc.php b/inc/database.inc.php index eddd4faf..3e8ee0f8 100644 --- a/inc/database.inc.php +++ b/inc/database.inc.php @@ -90,6 +90,19 @@ class Database return $res->fetchAll(PDO::FETCH_COLUMN, 0); } + /** + * Fetch two columns as key => value list. + * + * @return array|bool Associative array, first column is key, second column is value + */ + public static function queryKeyValueList($query, $args = array(), $ignoreError = null) + { + $res = self::simpleQuery($query, $args, $ignoreError); + if ($res === false) + return false; + return $res->fetchAll(PDO::FETCH_KEY_PAIR); + } + /** * Execute the given query and return the number of rows affected. * Mostly useful for UPDATEs or INSERTs -- cgit v1.2.3-55-g7522