forked from openemr/openemr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.php
158 lines (125 loc) · 5.13 KB
/
view.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<?php
/**
* Sports Physical Form
*
* @package OpenEMR
* @link http:https://www.open-emr.org
* @author Jason Morrill
* @author Brady Miller <[email protected]>
* @copyright Copyright (c) 2018 Brady Miller <[email protected]>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
*/
require_once("../../globals.php");
require_once("$srcdir/api.inc");
use OpenEMR\Common\Csrf\CsrfUtils;
use OpenEMR\Core\Header;
/** CHANGE THIS - name of the database table associated with this form **/
$table_name = "form_example";
/** CHANGE THIS name to the name of your form **/
$form_name = "My Example Form";
/** CHANGE THIS to match the folder you created for this form **/
$form_folder = "example";
formHeader("Form: " . $form_name);
$returnurl = 'encounter_top.php';
/* load the saved record */
$record = formFetch($table_name, $_GET["id"]);
/* remove the time-of-day from the date fields */
if ($record['form_date'] != "") {
$dateparts = explode(" ", $record['form_date']);
$record['form_date'] = $dateparts[0];
}
if ($record['dob'] != "") {
$dateparts = explode(" ", $record['dob']);
$record['dob'] = $dateparts[0];
}
if ($record['sig_date'] != "") {
$dateparts = explode(" ", $record['sig_date']);
$record['sig_date'] = $dateparts[0];
}
?>
<html><head>
<?php Header::setupHeader('datetime-picker'); ?>
<link rel="stylesheet" href="../../forms/<?php echo $form_folder; ?>/style.css?v=<?php echo $v_js_includes; ?>">
<script>
function PrintForm() {
newwin = window.open("<?php echo "http:https://" . $_SERVER['SERVER_NAME'] . $rootdir . "/forms/" . $form_folder . "/print.php?id=" ?>" + <?php echo js_url($_GET["id"]); ?>,"mywin");
}
</script>
</head>
<body class="body_top">
<?php echo date("F d, Y", time()); ?>
<form method=post action="<?php echo $rootdir;?>/forms/<?php echo $form_folder; ?>/save.php?mode=update&id=<?php echo attr_url($_GET["id"]);?>" name="my_form">
<input type="hidden" name="csrf_token_form" value="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
<span class="title"><?php echo xlt($form_name); ?></span><br />
<!-- Save/Cancel links -->
<input type="button" class="save" value="<?php echo xla('Save Changes'); ?>">
<input type="button" class="dontsave" value="<?php echo xla('Don\'t Save Changes'); ?>">
<input type="button" class="printform" value="<?php echo xla('Print'); ?>">
<!-- container for the main body of the form -->
<div id="form_container">
<div id="general">
<table>
<tr><td>
Date:
<input type='text' size='10' class='datepicker' name='form_date' id='form_date'
value='<?php echo attr($record['form_date']);?>'
title='<?php echo xla('yyyy-mm-dd'); ?>' />
</td></tr>
<tr><td>
Name: <input id="name" name="name" type="text" size="50" maxlength="250" value="<?php echo attr($record['name']);?>">
Date of Birth:
<input type='text' size='10' class='datepicker' name='dob' id='dob'
value='<?php echo attr($record['dob']);?>'
title='<?php echo xla('yyyy-mm-dd Date of Birth'); ?>'
/>
</td></tr>
<tr><td>
Phone: <input name="phone" id="phone" type="text" size="15" maxlength="15" value="<?php echo attr($record['phone']);?>">
</td></tr>
<tr><td>
Address: <input name="address" id="address" type="text" size="80" maxlength="250" value="<?php echo attr($record['address']);?>">
</td></tr>
</table>
</div>
<div id="bottom">
Use this space to express notes <br />
<textarea name="notes" id="notes" cols="80" rows="4"><?php echo attr($record['notes']);?></textarea>
<br /><br />
<div style="text-align:right;">
Signature?
<input type="radio" id="sig" name="sig" value="y" <?php if ($record["sig"] == 'y') {
echo "CHECKED";
} ?>>Yes
/
<input type="radio" id="sig" name="sig" value="n" <?php if ($record["sig"] == 'n') {
echo "CHECKED";
} ?>>No
Date of signature:
<input type='text' size='10' class='datepicker' name='sig_date' id='sig_date'
value='<?php echo attr($record['sig_date']);?>'
title='<?php echo xla('yyyy-mm-dd'); ?>' />
</div>
</div>
</div> <!-- end form_container -->
<input type="button" class="save" value="<?php echo xla('Save Changes'); ?>">
<input type="button" class="dontsave" value="<?php echo xla('Don\'t Save Changes'); ?>">
<input type="button" class="printform" value="<?php echo xla('Print'); ?>">
</form>
</body>
<script>
// jQuery stuff to make the page a little easier to use
$(function () {
$(".save").click(function() { top.restoreSession(); document.my_form.submit(); });
$(".dontsave").click(function() { parent.closeTab(window.name, false); });
$(".printform").click(function() { PrintForm(); });
$('.datepicker').datetimepicker({
<?php $datetimepicker_timepicker = false; ?>
<?php $datetimepicker_showseconds = false; ?>
<?php $datetimepicker_formatInput = false; ?>
<?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
<?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
});
});
</script>
</html>