diff options
author | Christian Hofmaier | 2017-03-29 11:31:47 +0200 |
---|---|---|
committer | Christian Hofmaier | 2017-03-29 11:31:47 +0200 |
commit | 7bb3fdb8520dbeeedcc8862f8fdafc5223089199 (patch) | |
tree | 364bdf57b91aafc8eb8e30ebed2c0256073cfde3 /modules-available/permissionmanager/inc/getdata.inc.php | |
parent | [permission-manager] changed include/exclude to all/selected (diff) | |
download | slx-admin-7bb3fdb8520dbeeedcc8862f8fdafc5223089199.tar.gz slx-admin-7bb3fdb8520dbeeedcc8862f8fdafc5223089199.tar.xz slx-admin-7bb3fdb8520dbeeedcc8862f8fdafc5223089199.zip |
[permission-manager] first fill of location table
Diffstat (limited to 'modules-available/permissionmanager/inc/getdata.inc.php')
-rw-r--r-- | modules-available/permissionmanager/inc/getdata.inc.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/modules-available/permissionmanager/inc/getdata.inc.php b/modules-available/permissionmanager/inc/getdata.inc.php index 7ca56754..caa50215 100644 --- a/modules-available/permissionmanager/inc/getdata.inc.php +++ b/modules-available/permissionmanager/inc/getdata.inc.php @@ -16,6 +16,20 @@ class GetData { return $data; } + // get LocationIDs, Location Names, Roles of each Location + public static function getLocationData() { + $res = self::queryLocationData(); + $data = array(); + while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + $data[] = array( + 'locid' => $row['locid'], + 'name' => $row['locname'], + 'role' => explode(",",$row['role']) + ); + } + return $data; + } + // get all roles from database (id and name) public static function getRoles() { $res = Database::simpleQuery("SELECT id, name FROM role ORDER BY name ASC"); @@ -68,4 +82,16 @@ class GetData { return $res; } + // LocationID, Location Name, Roles of each Location + private static function queryLocationData() { + $res = Database::simpleQuery("SELECT location.locationid AS locid, location.locationname AS locname, GROUP_CONCAT(role.name ORDER BY role.name ASC) AS role + FROM location + LEFT JOIN roleXlocation ON location.locationid = roleXlocation.locid + LEFT JOIN role ON roleXlocation.roleid = role.id + GROUP BY location.locationid + ORDER BY location.locationname + "); + return $res; + } + }
\ No newline at end of file |