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>;.
19 * @author Roberto Vasquez <robertogagliotta@gmail.com>
20 * @link http://www.open-emr.org
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);
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'] != '') {
47 sqlInsert($sql, array($_POST['id']));
51 newEvent("delete", $_SESSION['authUser'], $_SESSION['authProvider'], 1, "Form ".$_POST['formname']." deleted from Encounter ".$_POST['encounter']);
53 // redirect back to the encounter
54 $address = "{$GLOBALS['rootdir']}/patient_file/encounter/$returnurl";
55 echo "\n<script language='Javascript'>top.restoreSession();window.location='$address';</script>\n";
62 <?php
html_header_show();?
>
63 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
65 <!-- supporting javascript code
-->
66 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-2/index.js"></script
>
70 <body
class="body_top">
72 <span
class="title"><?php
echo xlt('Delete Encounter Form'); ?
></span
>
74 <form method
="post" action
="<?php echo $rootdir;?>/patient_file/encounter/delete_form.php" name
="my_form" id
="my_form">
76 // output each GET variable as a hidden form input
77 foreach ($_GET as $key => $value) {
78 echo '<input type="hidden" id="'.attr($key).'" name="'.attr($key).'" value="'.attr($value).'"/>'."\n";
81 <input type
="hidden" id
="confirm" name
="confirm" value
="1"/>
83 <?php
echo xlt('You are about to delete the following form from this encounter') . ': ' . text(xl_form_title($_GET['formname'])); ?
>
85 <input type
="button" id
="confirmbtn" name
="confirmbtn" value
='<?php echo xla('Yes
, Delete this form
'); ?>'>
86 <input type
="button" id
="cancel" name
="cancel" value
='<?php echo xla('Cancel
'); ?>'>
91 <script language
="javascript">
92 // jQuery stuff to make the page a little easier to use
94 $
(document
).ready(function(){
95 $
("#confirmbtn").click(function() { return ConfirmDelete(); });
96 $
("#cancel").click(function() { location
.href
='<?php echo "$rootdir/patient_file/encounter/$returnurl";?>'; });
99 function ConfirmDelete() {
100 if (confirm('<?php echo xls('This action cannot be undone
. Are you sure you wish to delete this form?
'); ?>')) {
101 top
.restoreSession();
102 $
("#my_form").submit();