Feature to add drug-drug interaction checking for the
[openemr.git] / interface / usergroup / facility_user_admin.php
blobb1ee9782a0bd90239d7b8311a39b48dc9b5fd672
1 <?php
2 /**
3 * edit per-facility user information.
5 * Copyright (C) 2012 NP Clinics <info@npclinics.com.au>
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 * @link http://open-emr.org
30 //SANITIZE ALL ESCAPES
31 $sanitize_all_escapes=true;
34 //STOP FAKE REGISTER GLOBALS
35 $fake_register_globals=false;
38 require_once("../globals.php");
39 require_once("$srcdir/sql.inc");
40 require_once("$srcdir/formdata.inc.php");
41 require_once("$srcdir/options.inc.php");
42 require_once("$srcdir/acl.inc");
44 // Ensure authorized
45 if (!acl_check('admin', 'users')) {
46 die(xlt("Unauthorized"));
49 // Ensure variables exist
50 if (!isset($_GET["user_id"]) || !isset($_GET["fac_id"])) {
51 die(xlt("Error"));
56 <html>
57 <head>
59 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
60 <link rel="stylesheet" type="text/css" href="../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
61 <script type="text/javascript" src="../../library/dialog.js"></script>
62 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-3-2/index.js"></script>
63 <script type="text/javascript" src="../../library/js/common.js"></script>
64 <script type="text/javascript" src="../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
65 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-ui.js"></script>
66 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.easydrag.handler.beta2.js"></script>
67 <script type="text/javascript" src="../../library/textformat.js"></script>
68 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
69 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
70 <script type="text/javascript" src="../../library/dynarch_calendar_setup.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();
104 </script>
106 </head>
107 <body class="body_top" style="width:450px;height:200px !important;">
109 <?php
110 // Collect user information
111 $user_info = sqlQuery("select * from `users` WHERE `id` = ?", array($_GET["user_id"]) );
113 // Collect facility information
114 $fac_info = sqlQuery("select * from `facility` where `id` = ?", array($_GET["fac_id"]) );
116 // Collect layout information and store them in an array
117 $l_res = sqlStatement("SELECT * FROM layout_options " .
118 "WHERE form_id = 'FACUSR' AND uor > 0 AND field_id != '' " .
119 "ORDER BY group_name, seq");
120 $l_arr = array();
121 for($i=0; $row=sqlFetchArray($l_res); $i++) {
122 $l_arr[$i]=$row;
126 <table>
127 <tr>
128 <td>
129 <span class="title"><?php echo xlt('Edit Facility Specific User Information'); ?></span>&nbsp;&nbsp;&nbsp;</td><td>
130 <a class="css_button large_button" name='form_save' id='form_save' onclick='submitform()' href='#' >
131 <span class='css_button_span large_button_span'><?php echo xlt('Save');?></span>
132 </a>
133 <a class="css_button large_button" id='cancel' href='#'>
134 <span class='css_button_span large_button_span'><?php echo xlt('Cancel');?></span>
135 </a>
136 </td>
137 </tr>
138 </table>
140 <form name='medicare' method='post' action="facility_user.php" target="_parent">
141 <input type=hidden name=mode value="facility_user_id">
142 <input type=hidden name=user_id value="<?php echo attr($_GET["user_id"]);?>">
143 <input type=hidden name=fac_id value="<?php echo attr($_GET["fac_id"]);?>">
144 <?php $iter = sqlQuery("select * from facility_user_ids where id=?", array($my_id)); ?>
146 <table border=0 cellpadding=0 cellspacing=0>
147 <tr>
148 <td>
149 <span class=text><?php echo xlt('User'); ?>: </span>
150 </td>
151 <td>
152 <span class=text><?php echo text($user_info['username']); ?> </span>
153 </td>
154 </tr>
156 <tr>
157 <td>
158 <span class=text><?php echo xlt('Facility'); ?>: </span>
159 </td>
160 <td>
161 <span class=text><?php echo text($fac_info['name']); ?> </span>
162 </td>
163 </tr>
165 <?php foreach ($l_arr as $layout_entry) { ?>
166 <tr>
167 <td style="width:180px;">
168 <span class=text><?php echo text(xl_layout_label($layout_entry['title'])) ?>: </span>
169 </td>
170 <td style="width:270px;">
171 <?php
172 $entry_data = sqlQuery("SELECT `field_value` FROM `facility_user_ids` " .
173 "WHERE `uid` = ? AND `facility_id` = ? AND `field_id` = ?", array($user_info['id'],$fac_info['id'],$layout_entry['field_id']) );
174 echo "<td><span class='text'>" . generate_form_field($layout_entry,$entry_data['field_value']) . "&nbsp;</td>";
176 </td>
177 </tr>
178 <?php } ?>
180 </table>
181 </form>
183 <!-- include support for the list-add selectbox feature -->
184 <?php include $GLOBALS['fileroot'] . "/library/options_listadd.inc"; ?>
186 <script language="JavaScript">
187 <?php echo $date_init; ?>
188 </script>
190 </body>
191 </html>