Focus the search term on load
[openemr.git] / interface / usergroup / facility_user_admin.php
blobeb17f7b2a68f2bae80e74d21fe96de4e332ef423
1 <?php
2 // +-----------------------------------------------------------------------------+
3 // Copyright (C) 2012 NP Clinics <info@npclinics.com.au>
4 //
5 //
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
18 // A copy of the GNU General Public License is included along with this program:
19 // openemr/interface/login/GnuGPL.html
20 // For more information write to the Free Software
21 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 // Author: Scott Wakefield <scott@npclinics.com.au>
25 // +------------------------------------------------------------------------------+
27 //SANITIZE ALL ESCAPES
28 $sanitize_all_escapes=true;
31 //STOP FAKE REGISTER GLOBALS
32 $fake_register_globals=false;
35 require_once("../globals.php");
36 require_once("$srcdir/sql.inc");
37 require_once("$srcdir/formdata.inc.php");
38 require_once("$srcdir/options.inc.php");
39 require_once("$srcdir/acl.inc");
41 // Ensure authorized
42 if (!acl_check('admin', 'users')) {
43 die(xlt("Unauthorized"));
46 // Ensure variables exist
47 if (!isset($_GET["user_id"]) || !isset($_GET["fac_id"])) {
48 die(xlt("Error"));
53 <html>
54 <head>
56 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
57 <link rel="stylesheet" type="text/css" href="../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
58 <script type="text/javascript" src="../../library/dialog.js"></script>
59 <script type="text/javascript" src="../../library/js/jquery.1.3.2.js"></script>
60 <script type="text/javascript" src="../../library/js/common.js"></script>
61 <script type="text/javascript" src="../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
62 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-ui.js"></script>
63 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.easydrag.handler.beta2.js"></script>
64 <script type="text/javascript" src="../../library/textformat.js"></script>
65 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
66 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
67 <script type="text/javascript" src="../../library/dynarch_calendar_setup.js"></script>
68 <script language="JavaScript">
70 function submitform() {
71 top.restoreSession();
72 var flag=0;
73 function trimAll(sString)
75 while (sString.substring(0,1) == ' ')
77 sString = sString.substring(1, sString.length);
79 while (sString.substring(sString.length-1, sString.length) == ' ')
81 sString = sString.substring(0,sString.length-1);
83 return sString;
85 if(flag == 0){
86 document.forms[0].submit();
87 parent.$.fn.fancybox.close();
94 $(document).ready(function(){
95 $("#cancel").click(function() {
96 parent.$.fn.fancybox.close();
97 });
99 });
101 // This is for callback by the find-code popup.
102 // Appends to or erases the current list of related codes.
103 function set_related(codetype, code, selector, codedesc) {
104 var frc = document.getElementById('form_related_code');
105 var s = frc.value;
106 if (code) {
107 if (s.length > 0) s += ';';
108 s += codetype + ':' + code;
109 } else {
110 s = '';
112 frc.value = s;
115 // This invokes the find-code popup.
116 function sel_related() {
117 dlgopen('<?php echo $rootdir ?>/patient_file/encounter/find_code_popup.php', '_blank', 500, 400);
120 </script>
122 </head>
123 <body class="body_top" style="width:450px;height:200px !important;">
125 <?php
126 // Collect user information
127 $user_info = sqlQuery("select * from `users` WHERE `id` = ?", array($_GET["user_id"]) );
129 // Collect facility information
130 $fac_info = sqlQuery("select * from `facility` where `id` = ?", array($_GET["fac_id"]) );
132 // Collect layout information and store them in an array
133 $l_res = sqlStatement("SELECT * FROM layout_options " .
134 "WHERE form_id = 'FACUSR' AND uor > 0 AND field_id != '' " .
135 "ORDER BY group_name, seq");
136 $l_arr = array();
137 for($i=0; $row=sqlFetchArray($l_res); $i++) {
138 $l_arr[$i]=$row;
142 <table>
143 <tr>
144 <td>
145 <span class="title"><?php echo xlt('Edit Facility Specific User Information'); ?></span>&nbsp;&nbsp;&nbsp;</td><td>
146 <a class="css_button large_button" name='form_save' id='form_save' onclick='submitform()' href='#' >
147 <span class='css_button_span large_button_span'><?php echo xlt('Save');?></span>
148 </a>
149 <a class="css_button large_button" id='cancel' href='#'>
150 <span class='css_button_span large_button_span'><?php echo xlt('Cancel');?></span>
151 </a>
152 </td>
153 </tr>
154 </table>
156 <form name='medicare' method='post' action="facility_user.php" target="_parent">
157 <input type=hidden name=mode value="facility_user_id">
158 <input type=hidden name=user_id value="<?php echo attr($_GET["user_id"]);?>">
159 <input type=hidden name=fac_id value="<?php echo attr($_GET["fac_id"]);?>">
160 <?php $iter = sqlQuery("select * from facility_user_ids where id=?", array($my_id)); ?>
162 <table border=0 cellpadding=0 cellspacing=0>
163 <tr>
164 <td>
165 <span class=text><?php echo xlt('User'); ?>: </span>
166 </td>
167 <td>
168 <span class=text><?php echo text($user_info['username']); ?> </span>
169 </td>
170 </tr>
172 <tr>
173 <td>
174 <span class=text><?php echo xlt('Facility'); ?>: </span>
175 </td>
176 <td>
177 <span class=text><?php echo text($fac_info['name']); ?> </span>
178 </td>
179 </tr>
181 <?php foreach ($l_arr as $layout_entry) { ?>
182 <tr>
183 <td style="width:180px;">
184 <span class=text><?php echo text(xl_layout_label($layout_entry['title'])) ?>: </span>
185 </td>
186 <td style="width:270px;">
187 <?php
188 $entry_data = sqlQuery("SELECT `field_value` FROM `facility_user_ids` " .
189 "WHERE `uid` = ? AND `facility_id` = ? AND `field_id` = ?", array($user_info['id'],$fac_info['id'],$layout_entry['field_id']) );
190 echo "<td><span class='text'>" . generate_form_field($layout_entry,$entry_data['field_value']) . "&nbsp;</td>";
192 </td>
193 </tr>
194 <?php } ?>
196 </table>
197 </form>
199 <!-- include support for the list-add selectbox feature -->
200 <?php include $GLOBALS['fileroot'] . "/library/options_listadd.inc"; ?>
202 <script language="JavaScript">
203 <?php echo $date_init; ?>
204 </script>
206 </body>
207 </html>