Fix for NFQ 0059 added check for procedure code in addition to standard code in lab...
[openemr.git] / gacl / admin / group_admin.php
blobc3af940535898c2d35dda9e8b66d4f3009c85a92
1 <?php
2 //First make sure user has access
3 include_once("../../interface/globals.php");
4 include_once("$srcdir/acl.inc");
5 //ensure user has proper access
6 if (!acl_check('admin', 'acl')) {
7 echo xl('ACL Administration Not Authorized');
8 exit;
10 //ensure php is installed
11 if (!isset($phpgacl_location)) {
12 echo xl('php-GACL access controls are turned off');
13 exit;
17 require_once('gacl_admin.inc.php');
19 //GET takes precedence.
20 if ($_GET['group_type'] != '') {
21 $group_type = $_GET['group_type'];
22 } else {
23 $group_type = $_POST['group_type'];
26 switch(strtolower(trim($group_type))) {
27 case 'axo':
28 $group_type = 'axo';
29 $group_table = $gacl_api->_db_table_prefix . 'axo_groups';
30 $group_map_table = $gacl_api->_db_table_prefix . 'groups_axo_map';
31 $smarty->assign('current','axo_group');
32 break;
33 default:
34 $group_type = 'aro';
35 $group_table = $gacl_api->_db_table_prefix . 'aro_groups';
36 $group_map_table = $gacl_api->_db_table_prefix . 'groups_aro_map';
37 $smarty->assign('current','aro_group');
38 break;
41 switch ($_POST['action']) {
42 case 'Delete':
43 //See edit_group.php
44 break;
45 default:
46 $formatted_groups = $gacl_api->format_groups($gacl_api->sort_groups($group_type), HTML);
48 $query = '
49 SELECT a.id, a.name, a.value, count(b.'. $group_type .'_id)
50 FROM '. $group_table .' a
51 LEFT JOIN '. $group_map_table .' b ON b.group_id=a.id
52 GROUP BY a.id,a.name,a.value';
53 $rs = $db->Execute($query);
55 $group_data = array();
57 if(is_object($rs)) {
58 while($row = $rs->FetchRow()) {
59 $group_data[$row[0]] = array(
60 'name' => $row[1],
61 'value' => $row[2],
62 'count' => $row[3]
67 $groups = array();
69 foreach($formatted_groups as $id => $name) {
70 $groups[] = array(
71 'id' => $id,
72 // 'parent_id' => $parent_id,
73 // 'family_id' => $family_id,
74 'name' => $name,
75 'raw_name' => $group_data[$id]['name'],
76 'value' => $group_data[$id]['value'],
77 'object_count' => $group_data[$id]['count']
81 $smarty->assign('groups', $groups);
82 break;
85 $smarty->assign('group_type', $group_type);
86 $smarty->assign('return_page', $_SERVER['REQUEST_URI']);
88 $smarty->assign('current', $group_type .'_group');
89 $smarty->assign('page_title', strtoupper($group_type) .' Group Admin');
91 $smarty->assign('phpgacl_version', $gacl_api->get_version());
92 $smarty->assign('phpgacl_schema_version', $gacl_api->get_schema_version());
94 $smarty->display('phpgacl/group_admin.tpl');