2 include_once("../../globals.php");
4 // allow a custom 'delete' form
5 $deleteform = $incdir . "/forms/" . $_REQUEST["formname"]."/delete.php";
7 check_file_dir_name($_REQUEST["formname"]);
9 if (file_exists($deleteform)) {
10 include_once($deleteform);
14 // if no custom 'delete' form, then use a generic one
16 // when the Cancel button is pressed, where do we go?
17 $returnurl = $GLOBALS['concurrent_layout'] ?
'encounter_top.php' : 'patient_encounter.php';
19 if ($_POST['confirm']) {
20 // set the deleted flag of the indicated form
21 $sql = "update forms set deleted=1 where id=".$_POST['id'];
22 if ($_POST['id'] != "*" && $_POST['id'] != '') sqlInsert($sql);
24 newEvent("delete", $_SESSION['authUser'], $_SESSION['authProvider'], 1, "Form ".$_POST['formname']." deleted from Encounter ".$_POST['encounter']);
26 // redirect back to the encounter
27 $address = "{$GLOBALS['rootdir']}/patient_file/encounter/$returnurl";
28 echo "\n<script language='Javascript'>top.restoreSession();window.location='$address';</script>\n";
35 <?php
html_header_show();?
>
36 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
38 <!-- supporting javascript code
-->
39 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.js"></script
>
43 <body
class="body_top">
45 <span
class="title">Delete Encounter Form
</span
>
47 <form method
="post" action
="<?php echo $rootdir;?>/patient_file/encounter/delete_form.php" name
="my_form" id
="my_form">
49 // output each GET variable as a hidden form input
50 foreach ($_GET as $key => $value) {
51 echo '<input type="hidden" id="'.$key.'" name="'.$key.'" value="'.$value.'"/>'."\n";
54 <input type
="hidden" id
="confirm" name
="confirm" value
="1"/>
56 You are about to delete the form
'<?php echo $_GET['formname
']; ?>' from
<?php
xl('This Encounter','e'); ?
>.
58 <input type
="button" id
="confirmbtn" name
="confirmbtn" value
="Yes, Delete this form">
59 <input type
="button" id
="cancel" name
="cancel" value
="Cancel">
64 <script language
="javascript">
65 // jQuery stuff to make the page a little easier to use
67 $
(document
).ready(function(){
68 $
("#confirmbtn").click(function() { return ConfirmDelete(); });
69 $
("#cancel").click(function() { location
.href
='<?php echo "$rootdir/patient_file/encounter/$returnurl";?>'; });
72 function ConfirmDelete() {
73 if (confirm("This action cannot be undone. Are you sure you wish to delete this form?")) {
75 $
("#my_form").submit();