From 7b851ddcff80f322486f098dd9cef6a75529cb41 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Thu, 5 Mar 2015 10:26:44 +0000 Subject: [PATCH] Add group_uuid to the links and move the sql query out of the content. --- core/users/groups.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/core/users/groups.php b/core/users/groups.php index 371d31d609..6944e605c0 100644 --- a/core/users/groups.php +++ b/core/users/groups.php @@ -56,6 +56,15 @@ require_once "resources/require.php"; unset($sql); } +//get the groups + $sql = "SELECT * FROM v_groups "; + $sql .= "where domain_uuid = '$domain_uuid' "; + $sql .= "or domain_uuid is null "; + $sql .= "order by group_name asc "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $groups = $prep_statement->fetchAll(PDO::FETCH_NAMED); + //show the content echo ""; echo ""; @@ -75,13 +84,6 @@ require_once "resources/require.php"; echo "
"; echo "
"; - $sql = "SELECT * FROM v_groups "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "or domain_uuid is null "; - $sql .= "order by group_name asc "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; @@ -100,11 +102,10 @@ require_once "resources/require.php"; $strlist .= "\n"; $count = 0; - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); - foreach ($result as &$row) { + foreach ($groups as &$row) { + $group_uuid = $row["group_uuid"]; $group_name = $row["group_name"]; $group_protected= $row["group_protected"]; - $group_uuid = $row["group_uuid"]; $group_description = $row["group_description"]; if (strlen($group_name) == 0) { $group_name = " "; } if (strlen($group_description) == 0) { $group_description = " "; } @@ -132,18 +133,18 @@ require_once "resources/require.php"; $strlist .= "\n"; $strlist .= "\n"; if (permission_exists('group_add') || if_group("superadmin")) { - $strlist .= "".$text['label-group_permissions']."  "; + $strlist .= "".$text['label-group_permissions']."  "; } if (permission_exists('group_member_view') || if_group("superadmin")) { - $strlist .= "".$text['label-group_members'].""; + $strlist .= "".$text['label-group_members'].""; } $strlist .= "\n"; $strlist .= "\n"; if ($group_protected == "true") { - $strlist .= " \n"; + $strlist .= " \n"; } else { - $strlist .= " \n"; + $strlist .= " \n"; } $strlist .= "\n"; $strlist .= "".$group_description."\n";