Remove concurrent_layout and clarify layout and themes selections (#272)
[openemr.git] / interface / patient_file / encounter / delete_form.php
blobaf5b3af6b6d6a011654674cabd699397c1dc5a87
1 <?php
2 /**
3 * This script delete an Encounter form.
5 * Copyright (C) 2015 Roberto Vasquez <robertogagliotta@gmail.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @package OpenEMR
19 * @author Roberto Vasquez <robertogagliotta@gmail.com>
20 * @link http://www.open-emr.org
23 $fake_register_globals=false;
24 $sanitize_all_escapes=true;
26 include_once("../../globals.php");
28 // allow a custom 'delete' form
29 $deleteform = $incdir . "/forms/" . $_REQUEST["formname"]."/delete.php";
31 check_file_dir_name($_REQUEST["formname"]);
33 if (file_exists($deleteform)) {
34 include_once($deleteform);
35 exit;
38 // if no custom 'delete' form, then use a generic one
40 // when the Cancel button is pressed, where do we go?
41 $returnurl = 'encounter_top.php';
43 if ($_POST['confirm']) {
44 // set the deleted flag of the indicated form
45 $sql = "update forms set deleted=1 where id= ?";
46 if ($_POST['id'] != "*" && $_POST['id'] != '') sqlInsert($sql, array($_POST['id']));
47 // log the event
48 newEvent("delete", $_SESSION['authUser'], $_SESSION['authProvider'], 1, "Form ".$_POST['formname']." deleted from Encounter ".$_POST['encounter']);
50 // redirect back to the encounter
51 $address = "{$GLOBALS['rootdir']}/patient_file/encounter/$returnurl";
52 echo "\n<script language='Javascript'>top.restoreSession();window.location='$address';</script>\n";
53 exit;
56 <html>
58 <head>
59 <?php html_header_show();?>
60 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
62 <!-- supporting javascript code -->
63 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-1/index.js"></script>
65 </head>
67 <body class="body_top">
69 <span class="title"><?php echo xlt('Delete Encounter Form'); ?></span>
71 <form method="post" action="<?php echo $rootdir;?>/patient_file/encounter/delete_form.php" name="my_form" id="my_form">
72 <?php
73 // output each GET variable as a hidden form input
74 foreach ($_GET as $key => $value) {
75 echo '<input type="hidden" id="'.attr($key).'" name="'.attr($key).'" value="'.attr($value).'"/>'."\n";
78 <input type="hidden" id="confirm" name="confirm" value="1"/>
79 <p>
80 <?php echo xlt('You are about to delete the following form from this encounter') . ': ' . text($_GET['formname']); ?>
81 </p>
82 <input type="button" id="confirmbtn" name="confirmbtn" value='<?php echo xla('Yes, Delete this form'); ?>'>
83 <input type="button" id="cancel" name="cancel" value='<?php echo xla('Cancel'); ?>'>
84 </form>
86 </body>
88 <script language="javascript">
89 // jQuery stuff to make the page a little easier to use
91 $(document).ready(function(){
92 $("#confirmbtn").click(function() { return ConfirmDelete(); });
93 $("#cancel").click(function() { location.href='<?php echo "$rootdir/patient_file/encounter/$returnurl";?>'; });
94 });
96 function ConfirmDelete() {
97 if (confirm('<?php echo xls('This action cannot be undone. Are you sure you wish to delete this form?'); ?>')) {
98 top.restoreSession();
99 $("#my_form").submit();
100 return true;
102 return false;
105 </script>
107 </html>