added numeral js package for Matrix's zend patient validation module
[openemr.git] / library / custom_template / share_template.php
blob9319f4de3cf5c576a424e9dc6e11816e72a552e8
1 <?php
2 // +-----------------------------------------------------------------------------+
3 // Copyright (C) 2011 Z&H Consultancy Services Private Limited <sam@zhservices.com>
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.
22 //
23 // Author: Eldho Chacko <eldho@zhservices.com>
24 // Jacob T Paul <jacob@zhservices.com>
26 // +------------------------------------------------------------------------------+
28 //SANITIZE ALL ESCAPES
29 $sanitize_all_escapes=true;
32 //STOP FAKE REGISTER GLOBALS
33 $fake_register_globals=false;
36 require_once("../../interface/globals.php");
37 $list_id = $_REQUEST['list_id'];
39 <html>
40 <head>
41 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
42 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.1.3.2.js"></script>
43 <script type="text/javascript">
44 function add_template(){
45 top.restoreSession();
46 len = document.getElementById('provider').options.length;
47 sel_len=0;
48 val="";
49 for(i=0;i<len;i++){
50 if(document.getElementById('provider').options[i].selected==true){
51 sel_len++;
52 val+=document.getElementById('provider').options[i].value+"|";
55 if(sel_len>0){
56 $.ajax({
57 type: "POST",
58 url: "ajax_code.php",
59 dataType: "html",
60 data: {
61 list_id: <?php echo htmlspecialchars($list_id,ENT_QUOTES);?>,
62 multi: val,
63 source: "save_provider"
65 async: false,
66 success: function(thedata){
69 error:function(){
70 alert("fail");
72 });
73 parent.$.fn.fancybox.close();
74 return;
76 else{
77 alert("<?php echo addslashes(xl('You should select at least one Provider'));?>");
81 </script>
82 </head>
83 <body class="body_top">
84 <form >
85 <table>
86 <tr class="text">
87 <td>
88 <select multiple name="provider[]" id="provider" size="5">
89 <?php
90 $query = "SELECT id, lname, fname FROM users WHERE authorized = 1 AND username != '' " .
91 "AND active = 1 AND ( info IS NULL OR info NOT LIKE '%Inactive%' ) ORDER BY lname, fname";
92 $res = sqlStatement($query);
93 $sel_query = "SELECT tu_user_id FROM template_users WHERE tu_template_id=?";
94 $row_sel =sqlQuery($sel_query,array($list_id));
95 while ($row = sqlFetchArray($res)) {
96 foreach($row_sel as $key=>$value){
97 if($value==$row['id']){
98 $sel="selected";
100 else{
101 $sel='';
105 echo "<option value='".htmlspecialchars($row['id'],ENT_QUOTES)."' $sel>".htmlspecialchars($row['lname'].",".$row['fname'],ENT_QUOTES)."</option>";
108 </select>
109 </td>
110 <td>
111 <a href="#" onclick="add_template()" class="css_button"><span><?php echo htmlspecialchars(xl('Save'),ENT_QUOTES);?></span></a>
112 </td>
113 </tr>
114 </table>
115 </form>
116 </body>
117 </html>