bug fix march continued (#1921)
[openemr.git] / interface / usergroup / facility_user_admin.php
blobfcc90348e8f97d30d2497725352c9ac8a2749324
1 <?php
2 /**
3 * edit per-facility user information.
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author Scott Wakefield <scott@npclinics.com.au>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2012 NP Clinics <info@npclinics.com.au>
10 * @copyright Copyright (c) 2017 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
16 require_once("$srcdir/options.inc.php");
17 require_once("$srcdir/acl.inc");
19 use OpenEMR\Core\Header;
21 // Ensure authorized
22 if (!acl_check('admin', 'users')) {
23 die(xlt("Unauthorized"));
26 // Ensure variables exist
27 if (!isset($_GET["user_id"]) || !isset($_GET["fac_id"])) {
28 die(xlt("Error"));
33 <html>
34 <head>
36 <title><?php echo xlt("Edit Facility Specific User Information"); ?></title>
38 <?php Header::setupHeader(['common','jquery-ui','datetime-picker','opener']); ?>
40 <script language="JavaScript">
41 $(document).ready(function(){
42 $("#form_facility_user").submit(function (event) {
43 top.restoreSession();
44 event.preventDefault();
45 var post_url = $(this).attr("action");
46 var request_method = $(this).attr("method");
47 var form_data = $(this).serialize();
48 $.ajax({
49 url: post_url,
50 type: request_method,
51 data: form_data
52 }).done(function (r) {
53 dlgclose('refreshme', false);
54 });
55 });
57 $("#cancel").click(function() {
58 dlgclose();
59 });
61 $('.datepicker').datetimepicker({
62 <?php $datetimepicker_timepicker = false; ?>
63 <?php $datetimepicker_showseconds = false; ?>
64 <?php $datetimepicker_formatInput = true; ?>
65 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
66 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
67 });
68 $('.datetimepicker').datetimepicker({
69 <?php $datetimepicker_timepicker = true; ?>
70 <?php $datetimepicker_showseconds = false; ?>
71 <?php $datetimepicker_formatInput = true; ?>
72 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
73 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
74 });
75 });
76 </script>
78 </head>
79 <body class="body_top">
80 <?php
81 // Collect user information
82 $user_info = sqlQuery("select * from `users` WHERE `id` = ?", array($_GET["user_id"]));
84 // Collect facility information
85 $fac_info = sqlQuery("select * from `facility` where `id` = ?", array($_GET["fac_id"]));
87 // Collect layout information and store them in an array
88 $l_res = sqlStatement("SELECT * FROM layout_options " .
89 "WHERE form_id = 'FACUSR' AND uor > 0 AND field_id != '' " .
90 "ORDER BY group_id, seq");
91 $l_arr = array();
92 for ($i=0; $row=sqlFetchArray($l_res); $i++) {
93 $l_arr[$i]=$row;
97 <div class="container">
98 <div class="row">
99 <div class="col-xs-12">
100 <div class="page-title">
101 <h3><?php echo xlt('Edit Facility Specific User Information'); ?></h3>
102 </div>
103 </div>
104 </div>
105 <div class="row">
106 <form name='form_facility_user' id='form_facility_user' method='post' action="facility_user.php">
107 <input type=hidden name=mode value="facility_user_id">
108 <input type=hidden name=user_id value="<?php echo attr($_GET["user_id"]);?>">
109 <input type=hidden name=fac_id value="<?php echo attr($_GET["fac_id"]);?>">
110 <?php $iter = sqlQuery("select * from facility_user_ids where id=?", array($my_id)); ?>
112 <table border=0 cellpadding=0 cellspacing=0>
113 <tr>
114 <td>
115 <?php echo xlt('User'); ?>:
116 </td>
117 <td>
118 <?php echo text($user_info['username']); ?>
119 </td>
120 </tr>
121 <tr>
122 <td>
123 <?php echo xlt('Facility'); ?>:
124 </td>
125 <td>
126 <?php echo text($fac_info['name']); ?>
127 </td>
128 </tr>
129 <?php foreach ($l_arr as $layout_entry) { ?>
130 <tr>
131 <td style="width:180px;">
132 <?php echo text(xl_layout_label($layout_entry['title'])) ?>:
133 </td>
134 <td style="width:270px;">
135 <?php
136 $entry_data = sqlQuery("SELECT `field_value` FROM `facility_user_ids` " .
137 "WHERE `uid` = ? AND `facility_id` = ? AND `field_id` = ?", array($user_info['id'],$fac_info['id'],$layout_entry['field_id']));
138 echo "<td>" . generate_form_field($layout_entry, $entry_data['field_value']) . "&nbsp;</td>";
140 </td>
141 </tr>
142 <?php } ?>
143 <tr>
144 <td>&nbsp;</td>
145 <td>
146 <button type="submit" class="btn btn-default btn-save" name='form_save' id='form_save' href='#' >
147 <?php echo xlt('Save');?>
148 </button>
149 <a class="btn btn-link btn-cancel oe-opt-btn-separate-left" id='cancel' href='#'>
150 <?php echo xlt('Cancel');?>
151 </a>
152 </td>
153 </tr>
154 </table>
155 </form>
156 </div>
157 </div>
158 <!-- include support for the list-add selectbox feature -->
159 <?php include $GLOBALS['fileroot'] . "/library/options_listadd.inc"; ?>
161 <script language="JavaScript">
162 <?php echo $date_init; ?>
163 </script>
164 </body>
165 </html>