3 * Viewing and modification/creation of office notes.
5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
17 * @author Brady Miller <brady.g.miller@gmail.com>
18 * @link http://www.open-emr.org
23 use OpenEMR\Core\Header
;
25 include_once("../../globals.php");
27 $oNoteService = new \services\
ONoteService();
29 //the number of records to display per screen
32 $offset = (isset($_REQUEST['offset'])) ?
$_REQUEST['offset'] : 0;
33 $active = (isset($_REQUEST['active'])) ?
$_REQUEST['active'] : -1;
35 //this code handles changing the state of activity tags when the user updates them through the interface
36 if (isset($_POST['mode'])) {
37 if ($_POST['mode'] == "update") {
38 foreach ($_POST as $var => $val) {
39 if ($val == "true" ||
$val == "false") {
40 $id = str_replace("act", "", $var);
42 $result = $oNoteService->enableNoteById($id);
43 } elseif ($val=="false") {
44 $oNoteService->disableNoteById($id);
48 } elseif ($_POST['mode'] == "new") {
49 $oNoteService->add($_POST["note"]);
56 <?php Header
::setupHeader(); ?
>
58 <body
class="body_top">
60 <div id
="officenotes_edit">
62 <form method
="post" name
="new_note" action
="office_comments_full.php" onsubmit
='return top.restoreSession()'>
65 /* BACK should go to the main Office Notes screen */
66 if ($userauthorized) {
67 $backurl="office_comments.php";
69 $backurl="../main_info.php";
73 <a href
="office_comments.php" onclick
='top.restoreSession()'>
75 <span
class="title"><?php
echo xlt('Office Notes'); ?
></span
>
76 <span
class="back"><?php
echo text($tback); ?
></span
></a
>
79 <input type
="hidden" name
="mode" value
="new">
80 <input type
="hidden" name
="offset" value
="<?php echo attr($offset); ?>">
81 <input type
="hidden" name
="active" value
="<?php echo attr($active); ?>">
83 <textarea name
="note" class="form-control" rows
="3" placeholder
="<?php echo xla("Enter
new office note here
"); ?>" ></textarea
>
84 <input type
="submit" value
="<?php echo xla('Add New Note'); ?>" />
90 <form method
="post" name
="update_activity" action
="office_comments_full.php" onsubmit
='return top.restoreSession()'>
92 <?php
//change the view on the current mode, whether all, active, or inactive
94 $inactive_class="_small";
96 } elseif ($active==="0") {
97 $active_class="_small";
100 $active_class="_small";
101 $inactive_class="_small";
105 <a href
="office_comments_full.php?offset=0&active=-1" class="css_button<?php echo attr($all_class);?>" onclick
='top.restoreSession()'><?php
echo xlt('All'); ?
></a
>
106 <a href
="office_comments_full.php?offset=0&active=1" class="css_button<?php echo attr($active_class);?>" onclick
='top.restoreSession()'><?php
echo xlt('Only Active'); ?
></a
>
107 <a href
="office_comments_full.php?offset=0&active=0" class="css_button<?php echo attr($inactive_class);?>" onclick
='top.restoreSession()'><?php
echo xlt('Only Inactive'); ?
></a
>
109 <input type
="hidden" name
="mode" value
="update">
110 <input type
="hidden" name
="offset" value
="<?php echo attr($offset);?>">
111 <input type
="hidden" name
="active" value
="<?php echo attr($active);?>">
114 <table border
="0" class="existingnotes table table-striped">
116 //display all of the notes for the day, as well as others that are active from previous dates, up to a certain number, $N
118 $notes = $oNoteService->getNotes($active, $offset, $N);
123 print "<thead><tr><th>" . xlt("Active") . "</th><th>" . xlt("Date") . " (" . xlt("Sender") . ")</th><th>" . xlt("Office Note") . "</th></tr></thead><tbody>";
124 foreach ($notes as $note) {
127 $date = $note->getDate()->format('Y-m-d');
128 $date = oeFormatShortDate($date);
130 $todaysDate = new DateTime();
131 if ($todaysDate->format('Y-m-d') == $date) {
132 $date_string = xl("Today") . ", " . $date;
134 $date_string = $date;
137 if ($note->getActivity()) {
138 $checked = "checked";
143 print "<tr><td><input type=hidden value='' name='act".attr($note->getId())."' id='act".attr($note->getId())."'>";
144 print "<input name='box".attr($note->getId())."' id='box".attr($note->getId())."' onClick='javascript:document.update_activity.act".attr($note->getId()).".value=this.checked' type=checkbox $checked></td>";
145 print "<td><label for='box".attr($note->getId())."' class='bold'>".text($date_string) . "</label>";
146 print " <label for='box".attr($note->getId())."' class='bold'>(". text($note->getUser()->getUsername()).")</label></td>";
147 print "<td><label for='box".attr($note->getId())."' class='text'>" . nl2br(text($note->getBody())) . " </label></td></tr></tbody>\n";
151 print "<tr><td></td><td></td><td></td></tr>\n";
157 <input type
="submit" value
="<?php echo xla('Save Activity'); ?>" />
160 <table width
="400" border
="0" cellpadding
="0" cellspacing
="0" class="table">
163 if ($offset>($N-1)) {
164 echo "<a class='css_button' href=office_comments_full.php?active=".attr($active)."&offset=".attr($offset-$N)." onclick='top.restoreSession()'>".xlt('Previous')."</a>";
167 </td
><td align
=right
>
169 if ($result_count == $N) {
170 echo "<a class='css_button' href=office_comments_full.php?active=".attr($active)."&offset=".attr($offset+
$N)." onclick='top.restoreSession()'>".xlt('Next')."</a>";