ongoing new datepicker project
[openemr.git] / interface / usergroup / facility_user_admin.php
blobd0df652fa19869e7dc221671ef6d1cc7812ceafe
1 <?php
2 /**
3 * edit per-facility user information.
5 * Copyright (C) 2012 NP Clinics <info@npclinics.com.au>
6 * Copyright (C) 2017 Brady Miller <brady.g.miller@gmail.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
20 * A copy of the GNU General Public License is included along with this program:
21 * openemr/interface/login/GnuGPL.html
22 * For more information write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 * @package OpenEMR
26 * @author Scott Wakefield <scott@npclinics.com.au>
27 * @author Brady Miller <brady.g.miller@gmail.com>
28 * @link http://open-emr.org
31 //SANITIZE ALL ESCAPES
32 $sanitize_all_escapes=true;
35 //STOP FAKE REGISTER GLOBALS
36 $fake_register_globals=false;
39 require_once("../globals.php");
40 require_once("$srcdir/options.inc.php");
41 require_once("$srcdir/acl.inc");
43 // Ensure authorized
44 if (!acl_check('admin', 'users')) {
45 die(xlt("Unauthorized"));
48 // Ensure variables exist
49 if (!isset($_GET["user_id"]) || !isset($_GET["fac_id"])) {
50 die(xlt("Error"));
55 <html>
56 <head>
58 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
59 <link rel="stylesheet" type="text/css" href="../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
60 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
62 <script type="text/javascript" src="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
63 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-7-2/index.js"></script>
64 <script type="text/javascript" src="../../library/js/common.js?v=<?php echo $v_js_includes; ?>"></script>
65 <script type="text/javascript" src="../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
66 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-ui.js"></script>
67 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.easydrag.handler.beta2.js"></script>
68 <script type="text/javascript" src="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script>
69 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script>
71 <script language="JavaScript">
73 function submitform() {
74 top.restoreSession();
75 var flag=0;
76 function trimAll(sString)
78 while (sString.substring(0,1) == ' ')
80 sString = sString.substring(1, sString.length);
82 while (sString.substring(sString.length-1, sString.length) == ' ')
84 sString = sString.substring(0,sString.length-1);
86 return sString;
88 if(flag == 0){
89 document.forms[0].submit();
90 parent.$.fn.fancybox.close();
97 $(document).ready(function(){
98 $("#cancel").click(function() {
99 parent.$.fn.fancybox.close();
102 $('.datepicker').datetimepicker({
103 <?php $datetimepicker_timepicker = false; ?>
104 <?php $datetimepicker_showseconds = false; ?>
105 <?php $datetimepicker_formatInput = false; ?>
106 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
107 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
109 $('.datetimepicker').datetimepicker({
110 <?php $datetimepicker_timepicker = true; ?>
111 <?php $datetimepicker_showseconds = false; ?>
112 <?php $datetimepicker_formatInput = false; ?>
113 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
114 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
118 </script>
120 </head>
121 <body class="body_top" style="width:450px;height:200px !important;">
123 <?php
124 // Collect user information
125 $user_info = sqlQuery("select * from `users` WHERE `id` = ?", array($_GET["user_id"]) );
127 // Collect facility information
128 $fac_info = sqlQuery("select * from `facility` where `id` = ?", array($_GET["fac_id"]) );
130 // Collect layout information and store them in an array
131 $l_res = sqlStatement("SELECT * FROM layout_options " .
132 "WHERE form_id = 'FACUSR' AND uor > 0 AND field_id != '' " .
133 "ORDER BY group_name, seq");
134 $l_arr = array();
135 for($i=0; $row=sqlFetchArray($l_res); $i++) {
136 $l_arr[$i]=$row;
140 <table>
141 <tr>
142 <td>
143 <span class="title"><?php echo xlt('Edit Facility Specific User Information'); ?></span>&nbsp;&nbsp;&nbsp;</td><td>
144 <a class="css_button large_button" name='form_save' id='form_save' onclick='submitform()' href='#' >
145 <span class='css_button_span large_button_span'><?php echo xlt('Save');?></span>
146 </a>
147 <a class="css_button large_button" id='cancel' href='#'>
148 <span class='css_button_span large_button_span'><?php echo xlt('Cancel');?></span>
149 </a>
150 </td>
151 </tr>
152 </table>
154 <form name='medicare' method='post' action="facility_user.php" target="_parent">
155 <input type=hidden name=mode value="facility_user_id">
156 <input type=hidden name=user_id value="<?php echo attr($_GET["user_id"]);?>">
157 <input type=hidden name=fac_id value="<?php echo attr($_GET["fac_id"]);?>">
158 <?php $iter = sqlQuery("select * from facility_user_ids where id=?", array($my_id)); ?>
160 <table border=0 cellpadding=0 cellspacing=0>
161 <tr>
162 <td>
163 <span class=text><?php echo xlt('User'); ?>: </span>
164 </td>
165 <td>
166 <span class=text><?php echo text($user_info['username']); ?> </span>
167 </td>
168 </tr>
170 <tr>
171 <td>
172 <span class=text><?php echo xlt('Facility'); ?>: </span>
173 </td>
174 <td>
175 <span class=text><?php echo text($fac_info['name']); ?> </span>
176 </td>
177 </tr>
179 <?php foreach ($l_arr as $layout_entry) { ?>
180 <tr>
181 <td style="width:180px;">
182 <span class=text><?php echo text(xl_layout_label($layout_entry['title'])) ?>: </span>
183 </td>
184 <td style="width:270px;">
185 <?php
186 $entry_data = sqlQuery("SELECT `field_value` FROM `facility_user_ids` " .
187 "WHERE `uid` = ? AND `facility_id` = ? AND `field_id` = ?", array($user_info['id'],$fac_info['id'],$layout_entry['field_id']) );
188 echo "<td><span class='text'>" . generate_form_field($layout_entry,$entry_data['field_value']) . "&nbsp;</td>";
190 </td>
191 </tr>
192 <?php } ?>
194 </table>
195 </form>
197 <!-- include support for the list-add selectbox feature -->
198 <?php include $GLOBALS['fileroot'] . "/library/options_listadd.inc"; ?>
200 <script language="JavaScript">
201 <?php echo $date_init; ?>
202 </script>
204 </body>
205 </html>