Here is the updated integration of the DDI, take 2
[openemr.git] / library / custom_template / delete_category.php
blobe33fddc39dfd6dec86807618a446b50014d388b2
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.
23 // Author: Eldho Chacko <eldho@zhservices.com>
24 // Jacob T Paul <jacob@zhservices.com>
26 // +------------------------------------------------------------------------------+
30 require_once("../../interface/globals.php");
31 $res=sqlStatement("SELECT * FROM customlists as cl left outer join users as u on cl_creator=u.id WHERE cl_list_type=3 AND cl_deleted=0");
33 <html>
34 <head>
35 <title><!-- Insert your title here --></title>
36 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
37 <script type="text/javascript" src="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js?v=<?php echo $v_js_includes; ?>"></script>
38 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
39 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery/dist/jquery.min.js"></script>
40 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/ajax_functions_writer.js"></script>
42 <script type='text/javascript'>
43 function delete_full_category(id){
44 top.restoreSession();
45 $.ajax({
46 type: "POST",
47 url: "ajax_code.php",
48 dataType: "html",
49 data: {
50 templateid: id,
51 source: "delete_full_category"
53 success: function(thedata){
54 alert("<?php echo addslashes(xl('Deleted Successfully.'));?>");
55 document.location.reload();
57 error:function(){
59 });
60 return;
62 function delete_category(id){
63 top.restoreSession();
64 if(confirm("<?php echo addslashes(xl('Do you want to delete?'));?>")){
65 $.ajax({
66 type: "POST",
67 url: "ajax_code.php",
68 dataType: "html",
69 data: {
70 templateid: id,
71 source: "delete_category"
73 success: function(thedata){
74 if(thedata){
75 alert("<?php echo addslashes('There are currently other users of the category you are trying to delete. Please contact them and ask them to delete it. Categories may not be deleted while in use. This Categories are currently used by \n');?>"+thedata);
77 else{
78 delete_full_category(id);
81 error:function(){
83 });
85 return;
88 </script>
89 </head>
90 <body class="body_top">
91 <form name="myform">
92 <table align="center">
93 <tr class="text reportTableHeadRow">
94 <th><?php echo htmlspecialchars('Sl.No', ENT_QUOTES);?></th>
95 <th><?php echo htmlspecialchars(xl('Category'), ENT_QUOTES);?></th>
96 <th><?php echo htmlspecialchars(xl('Context'), ENT_QUOTES);?></th>
97 <th><?php echo htmlspecialchars(xl('Creator'), ENT_QUOTES);?></th>
98 <th><?php echo htmlspecialchars(xl('Delete'), ENT_QUOTES);?></th>
99 </tr>
100 <?php
101 $i=0;
102 while ($row=sqlFetchArray($res)) {
103 $context=sqlQuery("SELECT * FROM customlists WHERE cl_list_slno=?", array($row['cl_list_id']));
104 $i++;
105 $class = ($class=='reportTableOddRow') ? 'reportTableEvenRow' : 'reportTableOddRow';
106 echo "<tr class='text ".htmlspecialchars($class, ENT_QUOTES)."'>";
107 echo "<td>".$i."</td>";
108 echo "<td>".htmlspecialchars($row['cl_list_item_long'], ENT_QUOTES)."</td>";
109 echo "<td>".htmlspecialchars($context['cl_list_item_long'], ENT_QUOTES)."</td>";
110 echo "<td>".htmlspecialchars($row['fname']." ".$row['mname']." ".$row['lname'], ENT_QUOTES)."</td>";
111 echo "<td><a href=#>";
112 echo "<img src='../../interface/pic/Delete.gif' border=0 title='Delete This Row' onclick=delete_category('".htmlspecialchars($row['cl_list_slno'], ENT_QUOTES)."')>";
113 echo "</a></td>";
114 echo "</tr>";
116 echo "</table>";