Fully responsive globals.php with vertical menu (#2460)
[openemr.git] / interface / main / messages / messages.php
blob5be01330726a2cf56f837571a0118642fff88982
1 <?php
2 /**
3 * Message and Reminder Center UI
5 * @Package OpenEMR
6 * @link http://www.open-emr.org
7 * @author OpenEMR Support LLC
8 * @author Roberto Vasquez robertogagliotta@gmail.com
9 * @author Rod Roark rod@sunsetsystems.com
10 * @author Brady Miller brady.g.miller@gmail.com
11 * @author Ray Magauran magauran@medfetch.com
12 * @copyright Copyright (c) 2010 OpenEMR Support LLC
13 * @copyright Copyright (c) 2017 MedEXBank.com
14 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
15 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
18 require_once("../../globals.php");
19 require_once("$srcdir/pnotes.inc");
20 require_once("$srcdir/patient.inc");
21 require_once("$srcdir/acl.inc");
22 require_once("$srcdir/options.inc.php");
23 require_once("$srcdir/gprelations.inc.php");
24 require_once "$srcdir/user.inc";
25 require_once("$srcdir/MedEx/API.php");
27 use OpenEMR\Common\Logging\EventAuditLogger;
28 use OpenEMR\Core\Header;
30 //validation library
31 $use_validate_js = 1;
32 require_once($GLOBALS['srcdir'] . "/validation/validation_script.js.php");
33 //Gets validation rules from Page Validation list.
34 $collectthis = collectValidationPageRules("/interface/main/messages/messages.php");
35 if (empty($collectthis)) {
36 $collectthis = "{}";
37 } else {
38 $collectthis = json_sanitize($collectthis[array_keys($collectthis)[0]]["rules"]);
41 $MedEx = new MedExApi\MedEx('MedExBank.com');
43 if ($GLOBALS['medex_enable'] == '1') {
44 if ($_REQUEST['SMS_bot']) {
45 $result = $MedEx->login('1');
46 $MedEx->display->SMS_bot($result['status']);
47 exit();
49 $result = $MedEx->login();
50 $logged_in = $result['status'];
53 $setting_bootstrap_submenu = prevSetting('', 'setting_bootstrap_submenu', 'setting_bootstrap_submenu', ' ');
54 //use $uspfx as the first variable for page/script specific user settings instead of '' (which is like a global but you have to request it).
55 $uspfx = substr(__FILE__, strlen($webserver_root)) . '.';
56 $rcb_selectors = prevSetting($uspfx, 'rcb_selectors', 'rcb_selectors', 'block');
57 $rcb_facility = prevSetting($uspfx, 'form_facility', 'form_facility', '');
58 $rcb_provider = prevSetting($uspfx, 'form_provider', 'form_provider', $_SESSION['authUserID']);
60 if (($_POST['setting_bootstrap_submenu']) ||
61 ($_POST['rcb_selectors'])) {
62 // These are not form elements. We only ever change them via ajax, so exit now.
63 exit();
66 <!DOCTYPE html>
67 <html>
68 <head>
69 <link rel="stylesheet" href="<?php echo $webroot; ?>/interface/main/messages/css/reminder_style.css?v=<?php echo $v_js_includes; ?>" type="text/css">
70 <link rel="stylesheet" href="<?php echo $GLOBALS['web_root']; ?>/library/css/bootstrap_navbar.css?v=<?php echo $v_js_includes; ?>" type="text/css">
72 <?php Header::setupHeader(['datetime-picker', 'jquery-ui', 'jquery-ui-redmond', 'opener', 'moment']); ?>
73 <script>
74 var xljs1 = '<?php echo xla('Preferences updated successfully'); ?>';
75 var format_date_moment_js = '<?php echo attr(DateFormatRead("validateJS")); ?>';
76 <?php require_once "$srcdir/restoreSession.php"; ?>
77 </script>
79 <script type="text/javascript" src="<?php echo $GLOBALS['web_root']; ?>/interface/main/messages/js/reminder_appts.js?v=<?php echo $v_js_includes; ?>"></script>
81 <link rel="shortcut icon" href="<?php echo $webroot; ?>/sites/default/favicon.ico" />
83 <meta charset="utf-8">
84 <meta http-equiv="X-UA-Compatible" content="IE=edge">
85 <meta name="description" content="MedEx Bank">
86 <meta name="author" content="OpenEMR: MedExBank">
87 <meta name="viewport" content="width=device-width, initial-scale=1">
88 <style>
89 @media only screen and (max-width: 768px) {
90 [class*="col-"] {
91 width: 100%;
92 text-align: left!important;
94 .navbar-toggle>span.icon-bar {
95 background-color: #68171A ! important;
97 .navbar-default .navbar-toggle {
98 border-color: #4a4a4a;
100 .navbar-default .navbar-toggle:focus, .navbar-default .navbar-toggle:hover {
101 background-color: #f2f2f2 !important;
102 font-weight: 900 !important;
103 color: #000000 !important;
105 .navbar-color {
106 background-color: #E5E5E5;
108 .icon-bar {
109 background-color: #68171A;
111 .navbar-header {
112 float: none;
114 .navbar-toggle {
115 display: block;
116 background-color: #f2f2f2;
118 .navbar-nav {
119 float: none!important;
121 .navbar-nav>li {
122 float: none;
124 .navbar-collapse.collapse.in {
125 z-index: 100;
126 background-color: #dfdfdf;
127 font-weight: 700;
128 color: #000000 !important;
133 </style>
135 <?php
136 if (($GLOBALS['medex_enable'] == '1') && (empty($_REQUEST['nomenu'])) && ($GLOBALS['disable_rcb'] != '1')) {
137 $MedEx->display->navigation($logged_in);
138 echo "<br />";
141 if (!empty($_REQUEST['go'])) { ?>
142 <?php
143 if (($_REQUEST['go'] == "setup") && (!$logged_in)) {
144 echo "<title>" . xlt('MedEx Setup') . "</title></head><body class='body_top'>";
145 $stage = $_REQUEST['stage'];
146 if (!is_numeric($stage)) {
147 echo "<br /><span class='title'>$stage " . xlt('Warning') . ": " . xlt('This is not a valid request') . ".</span>";
148 } else {
149 $MedEx->setup->MedExBank($stage);
151 } elseif ($_REQUEST['go'] == "addRecall") {
152 echo "<title>" . xlt('New Recall') . "</title></head><body class='body_top'>";
153 $MedEx->display->display_add_recall();
154 } elseif ($_REQUEST['go'] == 'Recalls') {
155 echo "<title>" . xlt('Recall Board') . "</title></head><body class='body_top'>";
156 $MedEx->display->display_recalls($logged_in);
157 } elseif ((($_REQUEST['go'] == "setup") || ($_REQUEST['go'] == 'Preferences')) && ($logged_in)) {
158 echo "<title>MedEx" . xlt('Preferences') . "</title></head><body class='body_top'>";
159 $MedEx->display->preferences();
160 } elseif ($_REQUEST['go'] == 'icons') {
161 echo "<title>MedEx" . xlt('Icons') . "</title></head><body class='body_top'>";
162 $MedEx->display->icon_template();
163 } elseif ($_REQUEST['go'] == 'SMS_bot') {
164 echo "<title>MedEx" . xlt('SMS') . "</title></head><body class='body_top'>";
165 $MedEx->display->SMS_bot($logged_in);
166 } else {
167 echo "<title>" . xlt('MedEx Setup') . "</title></head><body class='body_top'>";
168 echo xlt('Warning: Navigation error. Please refresh this page.');
170 } else {
171 //original message.php stuff
172 echo "<title>" . xlt('Message Center') . "</title>
173 </head>
174 <body class='body_top'>";
175 if ($GLOBALS['enable_help'] == 1) {
176 $help_icon = '<a class="pull-right oe-help-redirect" data-target="#myModal" data-toggle="modal" href="#" id="help-href" name="help-href" style="color:#676666" title="' . xla("Click to view Help") . '"><i class="fa fa-question-circle" aria-hidden="true"></i></a>';
177 } elseif ($GLOBALS['enable_help'] == 2) {
178 $help_icon = '<a class="pull-right oe-help-redirect" data-target="#myModal" data-toggle="modal" href="#" id="help-href" name="help-href" style="color:#DCD6D0 !Important" title="' . xla("To enable help - Go to Administration > Globals > Features > Enable Help Modal") . '"><i class="fa fa-question-circle" aria-hidden="true"></i></a>';
179 } elseif ($GLOBALS['enable_help'] == 0) {
180 $help_icon = '';
183 <div class="container">
184 <div class="row">
185 <div class="page-header clearfix">
186 <h2 id="header_title" class="clearfix"><span id='header_text'>
187 <?php
188 echo xlt('Messages, Reminders');
189 if ($GLOBALS['disable_rcb'] != '1') {
190 echo ", " . xlt('Recalls');
193 </span><?php echo $help_icon; ?></h2>
194 </div>
195 </div>
196 <div class="row" >
197 <nav class="navbar navbar-default navbar-color navbar-static-top" >
198 <div class="container-fluid">
199 <div class="navbar-header">
200 <button class="navbar-toggle" data-target="#myNavbar" data-toggle="collapse" type="button"><span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span></button>
201 </div>
202 <div class="collapse navbar-collapse" id="myNavbar" >
203 <ul class="nav navbar-nav" >
204 <li class="active oe-bold-black" id='li-mess'>
205 <a href='#' style="font-weight:700; color:#000000" id='messages-li'><?php echo xlt('Messages'); ?></a>
206 </li>
207 <li class="oe-bold-black" id='li-remi' >
208 <a href='#' id='reminders-li' style="font-weight:700; color:#000000"><?php echo xlt('Reminders'); ?></a>
209 </li>
210 <?php if ($GLOBALS['disable_rcb'] != '1') { ?>
211 <li class="oe-bold-black" id='li-reca'>
212 <a href='#' id='recalls-li' style="font-weight:700; color:#000000"><?php echo xlt('Recalls'); ?></a>
213 </li>
214 <?php }?>
215 <?php if ($logged_in) { ?>
216 <li class="oe-bold-black" id='li-sms'>
217 <a href='#' id='sms-li' style="font-weight:700; color:#000000"><?php echo xlt('SMS Zone'); ?></a>
218 </li>
219 <?php }?>
220 </ul>
221 </div>
222 </div>
223 </nav>
224 </div>
225 <div class="row" id="messages-div">
226 <fieldset>
227 <div class="col-sm-12 col-md-12 col-lg-12">
228 <?php
229 // Check to see if the user has Admin rights, and if so, allow access to See All.
230 $showall = isset($_GET['show_all']) ? $_GET['show_all'] : "";
231 if ($showall == "yes") {
232 $show_all = $showall;
233 } else {
234 $show_all = "no";
236 // Collect active variable and applicable html code for links
237 $form_active = (isset($_REQUEST['form_active']) ? $_REQUEST['form_active'] : false);
238 $form_inactive = (isset($_REQUEST['form_inactive']) ? $_REQUEST['form_inactive'] : false);
239 if ($form_active) {
240 $active = '1';
241 $activity_string_html = 'form_active=1';
242 } elseif ($form_inactive) {
243 $active = '0';
244 $activity_string_html = 'form_inactive=1';
245 } else {
246 $active = 'all';
247 $activity_string_html = '';
249 //collect the task setting
250 $task = isset($_REQUEST['task']) ? $_REQUEST['task'] : "";
251 if (acl_check('admin', 'super')) {
252 if ($show_all == 'yes') {
253 $showall = "yes";
254 $lnkvar = "\"messages.php?show_all=no&$activity_string_html\" name='Just Mine' onclick=\"top.restoreSession()\"><i id='just-mine-tooltip' class='fa fa-user fa-lg' aria-hidden='true'></i>";
255 $messages = xl('All Messages');
256 } else {
257 $showall = "no";
258 $lnkvar = "\"messages.php?show_all=yes&$activity_string_html\" name='See All' onclick=\"top.restoreSession()\"><i id='see-all-tooltip' class='fa fa-users fa-lg' aria-hidden='true'></i>";
259 $messages = xl('My Messages');
261 } else {
262 $messages = xlt('My Messages');
265 <div class="oe-margin-b-20">
266 <span class="title"><?php echo text($messages); ?></span>
267 <a class='more' href=<?php echo $lnkvar; ?></a>
268 </div>
269 <div class="oe-margin-b-10">
270 <?php
271 //show the activity links
272 if (empty($task) || $task == "add" || $task == "delete") { ?>
273 <?php if ($active == "all") { ?>
274 <span><strong><?php echo xlt('All Messages'); ?></strong></span>
275 <?php } else { ?>
276 <a href="messages.php" class="link btn btn-default"
277 onclick="top.restoreSession()"><span><?php echo xlt('Show All'); ?></span></a>
278 <?php } ?>
280 <?php if ($active == '1') { ?>
281 <span><strong><?php echo xlt('Active Messages'); ?></strong></span>
282 <?php } else { ?>
283 <a href="messages.php?form_active=1" class="link btn btn-default"
284 onclick="top.restoreSession()"><span><?php echo xlt('Show Active'); ?></span></a>
285 <?php } ?>
287 <?php if ($active == '0') { ?>
288 <span><strong><?php echo xlt('Inactive Messages'); ?></strong></span>
289 <?php } else { ?>
290 <a href="messages.php?form_inactive=1" class="link btn btn-default"
291 onclick="top.restoreSession()"><span><?php echo xlt('Show Inactive'); ?></span></a>
292 <?php } ?>
293 <?php } ?>
294 </div>
295 <?php
296 switch ($task) {
297 case "add":
298 // Add a new message for a specific patient; the message is documented in Patient Notes.
299 // Add a new message; it's treated as a new note in Patient Notes.
300 $note = $_POST['note'];
301 $noteid = $_POST['noteid'];
302 $form_note_type = $_POST['form_note_type'];
303 $form_message_status = $_POST['form_message_status'];
304 $reply_to = explode(';', rtrim($_POST['reply_to'], ';'));
305 $assigned_to_list = explode(';', $_POST['assigned_to']);
306 $datetime = isset($_POST['form_datetime']) ? DateTimeToYYYYMMDDHHMMSS($_POST['form_datetime']) : '';
307 foreach ($assigned_to_list as $assigned_to) {
308 if ($noteid && $assigned_to != '-patient-') {
309 updatePnote($noteid, $note, $form_note_type, $assigned_to, $form_message_status, $datetime);
310 $noteid = '';
311 } else {
312 if ($noteid && $assigned_to == '-patient-') {
313 // When $assigned_to == '-patient-' we don't update the current note, but
314 // instead create a new one with the current note's body prepended and
315 // attributed to the patient. This seems to be all for the patient portal.
316 $row = getPnoteById($noteid);
317 if (!$row) {
318 die("getPnoteById() did not find id '" . text($noteid) . "'");
320 $pres = sqlQuery("SELECT lname, fname " .
321 "FROM patient_data WHERE pid = ?", array($reply_to[0]));
322 $patientname = $pres['lname'] . ", " . $pres['fname'];
323 $note .= "\n\n$patientname on " . $row['date'] . " wrote:\n\n";
324 $note .= $row['body'];
326 // There's no note ID, and/or it's assigned to the patient.
327 // In these cases a new note is created.
328 foreach ($reply_to as $patient) {
329 addPnote($patient, $note, $userauthorized, '1', $form_note_type, $assigned_to, $datetime, $form_message_status);
333 break;
334 case "savePatient":
335 case "save":
336 // Update alert.
337 $noteid = $_POST['noteid'];
338 $form_message_status = $_POST['form_message_status'];
339 $reply_to = $_POST['reply_to'];
340 if ($task == "save") {
341 updatePnoteMessageStatus($noteid, $form_message_status);
342 } else {
343 updatePnotePatient($noteid, $reply_to);
345 $task = "edit";
346 $note = $_POST['note'];
347 $title = $_POST['form_note_type'];
348 $reply_to = $_POST['reply_to'];
349 break;
350 case "edit":
351 if ($noteid == "") {
352 $noteid = $_GET['noteid'];
354 // Update the message if it already exists; it's appended to an existing note in Patient Notes.
355 $result = getPnoteById($noteid);
356 if ($result) {
357 if ($title == "") {
358 $title = $result['title'];
360 $body = $result['body'];
361 if ($reply_to == "") {
362 $reply_to = $result['pid'];
364 $form_message_status = $result['message_status'];
365 $datetime = $result['date'];
367 break;
368 case "delete":
369 // Delete selected message(s) from the Messages box (only).
370 $delete_id = $_POST['delete_id'];
371 for ($i = 0; $i < count($delete_id); $i++) {
372 deletePnote($delete_id[$i]);
373 EventAuditLogger::instance()->newEvent("delete", $_SESSION['authUser'], $_SESSION['authProvider'], 1, "pnotes: id " . $delete_id[$i]);
375 break;
377 if ($task == "addnew" or $task == "edit") {
378 // Display the Messages page layout.
379 echo "<form name='form_patient' id='new_note'
380 class='form-horizontal'
381 action=\"messages.php?showall=" . attr_url($showall) . "&sortby=" . attr_url($sortby) . "&sortorder=" . attr_url($sortorder) . "&begin=" . attr_url($begin) . "&$activity_string_html\"
382 method='post'>
383 <input type=hidden name=noteid id=noteid value='" . attr($noteid) . "'>
384 <input type=hidden name=task id=task value=add>";
385 if ($task == "addnew") {
386 $message_legend = xl('Create New Message');
387 $onclick = "onclick=multi_sel_patient()";
388 } elseif ($task == "edit") {
389 $message_legend = xl('Add To Existing Message');
390 $onclick = "";
394 <div class='col-md-12'>
395 <fieldset>
396 <legend><?php echo text($message_legend); ?></legend>
397 <div class="row">
398 <div class="col-xs-12 col-sm-12 col-md-12 col-lg-10 oe-custom-line col-lg-offset-1">
399 <div class="row">
400 <div class="col-xs-3 col-sm-3">
401 <label class="control-label" for="form_note_type"><?php echo xlt('Type'); ?>:</label>
402 <?php
403 if ($title == "") {
404 $title = "Unassigned";
406 // Added 6/2009 by BM to incorporate the patient notes into the list_options listings.
407 generate_form_field(array('data_type' => 1, 'field_id' => 'note_type', 'list_id' => 'note_type', 'empty_title' => 'SKIP', 'order_by' => 'title', 'class' => 'form-control'), $title);
409 </div>
410 <div class="col-xs-3 col-sm-3">
411 <label class="control-label" for="form_message_status"><?php echo xlt('Status'); ?>:</label>
412 <?php
413 if ($form_message_status == "") {
414 $form_message_status = 'New';
416 generate_form_field(array('data_type' => 1, 'field_id' => 'message_status', 'list_id' => 'message_status', 'empty_title' => 'SKIP', 'order_by' => 'title', 'class' => 'form-control'), $form_message_status); ?>
417 </div>
418 <div class="col-xs-4">
419 <label class="control-label" for="form_patient">
420 <?php
421 if ($task != "addnew" && $result['pid'] != 0) { ?>
422 <a class="patLink"
423 onclick="goPid('<?php echo attr(addslashes($result['pid'])); ?>')"><?php echo xlt('Patient'); ?>
424 :</a>
425 <?php
426 } else { ?>
427 <b class='<?php echo($task == "addnew" ? "required" : "") ?>'><?php echo xlt('Patient'); ?>
428 :</b>
429 <?php
432 </label>
433 <?php
434 if ($reply_to) {
435 $prow = sqlQuery("SELECT lname, fname,pid, pubpid, DOB " .
436 "FROM patient_data WHERE pid = ?", array($reply_to));
437 $patientname = $prow['lname'] . ", " . $prow['fname'];
439 if ($task == "addnew" || $result['pid']==0) {
440 $cursor = "oe-cursor-add";
441 $background = "oe-patient-background";
442 } elseif ($task == "edit") {
443 $cursor = "oe-cursor-stop";
444 $background = '';
447 <input type='text' id='form_patient' name='form_patient' class='form-control <?php echo $cursor . " " .$background;?>' onclick="multi_sel_patient()" placeholder='<?php echo xla("Click to add patient"); ?>' value='<?php echo attr($patientname); ?>' readonly/>
448 <input type='hidden' class="form-control" name='reply_to' id='reply_to' value='<?php echo attr($reply_to); ?>'/>
449 </div>
450 <div class="col-xs-2">
451 <?php
452 if ($task=="addnew" || $result['pid']==0) {
453 echo "<label class='control-label oe-empty-label' for='clear_patients'></label>";
454 echo '<button type="button" id="clear_patients" class="btn btn-default btn-undo pull-left flip" value="' . xla('Clear') .'">' . xlt("Clear") . '</button>';
455 } ?>
456 </div>
457 </div>
458 </div>
459 </div>
460 <div class="row">
461 <div class="col-xs-12 col-sm-12 col-md-12 col-lg-10 oe-custom-line col-lg-offset-1">
462 <div class="row">
463 <?php if ($GLOBALS['messages_due_date']) { ?>
464 <div class="col-xs-6 col-sm-2">
465 <label class="control-label" for="form_note_type"><?php echo xlt('Due date'); ?>:</label>
466 <?php generate_form_field(array('data_type' => 4, 'field_id' => 'datetime', 'edit_options' => 'F'), empty($datetime) ? date('Y-m-d H:i') : $datetime) ?>
467 </div>
468 <?php } ?>
469 <div class="col-xs-6 col-sm-4">
470 <label class="control-label" for="assigned_to_text"><?php echo xlt('To'); ?>:</label>
471 <input type='text' name='assigned_to_text' class='form-control oe-cursor-stop' id='assigned_to_text' readonly='readonly'
472 value='' placeholder='<?php echo xla("SELECT Users FROM The Dropdown LIST"); ?>'>
473 <input type='hidden' name='assigned_to' id='assigned_to'>
474 </div>
475 <div class="col-xs-6 col-sm-4">
476 <label class="control-label oe-empty-label" for="users"></label>
477 <select name='users' id='users' class='form-control' onchange='addtolist(this);'>
478 <?php
479 echo "<option value='--'";
480 echo ">" . xlt('Select User');
481 echo "</option>\n";
482 $ures = sqlStatement("SELECT username, fname, lname FROM users " .
483 "WHERE username != '' AND active = 1 AND " .
484 "( info IS NULL OR info NOT LIKE '%Inactive%' ) " .
485 "ORDER BY lname, fname");
486 while ($urow = sqlFetchArray($ures)) {
487 echo " <option value='" . attr($urow['username']) . "'";
488 echo ">" . text($urow['lname']);
489 if ($urow['fname']) {
490 echo ", " . text($urow['fname']);
492 echo "</option>\n";
494 if ($GLOBALS['portal_offsite_enable']) {
495 echo "<option value='-" . xla('patient') . "-'";
496 echo ">-" . xlt('Patient') . "-";
497 echo "</option>\n";
500 </select>
501 </div>
502 <div class="col-xs-6 col-sm-2">
503 <label class="control-label oe-empty-label" for="users"></label>
504 <button type="button" name="clear_user" id="clear_user" class="btn btn-default btn-undo pull-left flip" value="<?php echo xla('Clear'); ?>"><?php echo xlt('Clear'); ?></button>
505 </div>
506 </div>
507 <div class='col-xs-12 oe-margin-t-3'>
508 <?php
509 if ($noteid) {
510 // Get the related document IDs if any.
511 $tmp = sqlStatement(
512 "SELECT id1 FROM gprelations WHERE " .
513 "type1 = ? AND type2 = ? AND id2 = ?",
514 array('1', '6', $noteid)
516 if (sqlNumRows($tmp)) {
517 echo " <tr>\n";
518 echo " <td class='text'><b>";
519 echo xlt('Linked document') . ":</b>\n";
520 while ($gprow = sqlFetchArray($tmp)) {
521 $d = new Document($gprow['id1']);
522 $enc_list = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe " .
523 " LEFT JOIN openemr_postcalendar_categories ON fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? ORDER BY fe.date DESC", array($prow['pid']));
524 $str_dob = xl("DOB") . ":" . $prow['DOB'] . " " . xl("Age") . ":" . getPatientAge($prow['DOB']);
525 $pname = $prow['fname'] . " " . $prow['lname'];
526 echo "<a href='javascript:void(0);' ";
527 echo "onClick=\"gotoReport(" . attr(addslashes($d->get_id())) . ",'" . attr(addslashes($pname)) . "'," . attr(addslashes($prow['pid'])) . "," . attr(addslashes($prow['pubpid'])) . ",'" . attr(addslashes($str_dob)) . "');\">";
528 echo text($d->get_url_file());
529 echo "</a>\n";
531 echo " </td>\n";
532 echo " </tr>\n";
534 // Get the related procedure order IDs if any.
535 $tmp = sqlStatement(
536 "SELECT id1 FROM gprelations WHERE " .
537 "type1 = ? AND type2 = ? AND id2 = ?",
538 array('2', '6', $noteid)
540 if (sqlNumRows($tmp)) {
541 echo " <tr>\n";
542 echo " <td class='text'><b>";
543 echo xlt('Linked procedure order') . ":</b>\n";
544 while ($gprow = sqlFetchArray($tmp)) {
545 echo " <a href='";
546 echo $GLOBALS['webroot'] . "/interface/orders/single_order_results.php?orderid=";
547 echo attr_url($gprow['id1']);
548 echo "' target='_blank' onclick='top.restoreSession()'>";
549 echo text($gprow['id1']);
550 echo "</a>\n";
552 echo " </td>\n";
553 echo " </tr>\n";
557 </div>
558 </div>
559 <div class="row">
560 <div class='col-xs-12'>
561 <?php
563 if ($noteid) {
564 $body = preg_replace('/(:\d{2}\s\()' . $result['pid'] . '(\sto\s)/', '${1}' . $patientname . '${2}', $body);
565 $body = preg_replace('/(\d{4}-\d{2}-\d{2} \d{2}:\d{2}\s\([^)(]+\s)(to)(\s[^)(]+\))/', '${1}' . xl('to') . '${3}', $body);
566 $body =nl2br(text(oeFormatPatientNote($body)));
567 echo "<div class='text oe-margin-t-3' style='background-color:white; color: gray; border:1px solid #999; padding: 5px;'>" . $body . "</div>";
571 <textarea name='note' id='note' class='form-control oe-margin-t-3'
572 style='margin-left:-1px !important; background-color:white; color: gray; border:1px solid #999; padding: 5px; height:100px!important;'><?php echo nl2br(text($note)); ?></textarea>
573 </div>
574 <div class="col-xs-12 position-override oe-margin-t-10">
575 <?php if ($noteid) { ?>
576 <!-- This is for displaying an existing note. -->
577 <button type="button" class="btn btn-default btn-send-msg" id="newnote"
578 value="<?php echo xla('Send message'); ?>"><?php echo xlt('Send message'); ?></button>
579 <button type="button" class="btn btn-default btn-print" id="printnote"
580 value="<?php echo xla('Print message'); ?>"><?php echo xlt('Print message'); ?></button>
581 <button type="button" class="btn btn-link btn-cancel oe-opt-btn-separate-left" id="cancel"
582 value="<?php echo xla('Cancel'); ?>"><?php echo xlt('Cancel'); ?></button>
583 <?php } else { ?>
584 <!-- This is for displaying a new note. -->
585 <button type="button" class="btn btn-default btn-send-msg" id="newnote"
586 value="<?php echo xla('Send message'); ?>"><?php echo xlt('Send message'); ?></button>
587 <button type="button" class="btn btn-link btn-cancel oe-opt-btn-separate-left" id="cancel"
588 value="<?php echo xla('Cancel'); ?>"><?php echo xlt('Cancel'); ?></button>
589 <?php }
591 </div>
592 </div>
593 </fieldset>
594 </div>
595 </form>
596 <?php
597 } else {
598 // This is for sorting the records.
599 $sort = array("users.lname", "patient_data.lname", "pnotes.title", "pnotes.date", "pnotes.message_status");
600 $sortby = (isset($_REQUEST['sortby']) && ($_REQUEST['sortby'] != "")) ? $_REQUEST['sortby'] : $sort[3];
601 $sortorder = (isset($_REQUEST['sortorder']) && ($_REQUEST['sortorder'] != "")) ? $_REQUEST['sortorder'] : "desc";
602 $begin = isset($_REQUEST['begin']) ? $_REQUEST['begin'] : 0;
604 for ($i = 0; $i < count($sort); $i++) {
605 $sortlink[$i] = "<a class='arrowhead' href=\"messages.php?show_all=".attr($showall)."&sortby=".attr($sort[$i])."&sortorder=asc&$activity_string_html\" onclick=\"top.restoreSession()\" alt=\"" . xla('Sort Up') . "\"><i class='fa fa-sort-desc fa-lg' aria-hidden='true'></i></a>";
607 for ($i = 0; $i < count($sort); $i++) {
608 if ($sortby == $sort[$i]) {
609 switch ($sortorder) {
610 case "asc":
611 $sortlink[$i] = "<a class='arrowhead' href=\"messages.php?show_all=".attr($showall)."&sortby=".attr($sortby)."&sortorder=desc&$activity_string_html\" onclick=\"top.restoreSession()\" alt=\"" . xla('Sort Up') . "\"><i class='fa fa-sort-asc fa-lg' aria-hidden='true'></i></a>";
612 break;
613 case "desc":
614 $sortlink[$i] = "<a class='arrowhead' href=\"messages.php?show_all=".attr($showall)."&sortby=".attr($sortby)."&sortorder=asc&$activity_string_html\" onclick=\"top.restoreSession()\" alt=\"" . xla('Sort Down') . "\"><i class='fa fa-sort-desc fa-lg' aria-hidden='true'></i></a>";
615 break;
616 } break;
619 // Manage page numbering and display beneath the Messages table.
620 $listnumber = 25;
621 $total = getPnotesByUser($active, $show_all, $_SESSION['authUser'], true);
622 if ($begin == "" or $begin == 0) {
623 $begin = 0;
625 $prev = $begin - $listnumber;
626 $next = $begin + $listnumber;
627 $start = $begin + 1;
628 $end = $listnumber + $start - 1;
630 $chevron_icon_left = $_SESSION['language_direction'] == 'ltr' ? 'fa-chevron-circle-left' : 'fa-chevron-circle-right';
631 $chevron_icon_right = $_SESSION['language_direction'] == 'ltr' ? 'fa-chevron-circle-right' : 'fa-chevron-circle-left';
633 if ($end >= $total) {
634 $end = $total;
636 if ($end < $start) {
637 $start = 0;
639 if ($prev >= 0) {
640 $prevlink = "<a href=\"messages.php?show_all=" . attr($showall) . "&sortby=" . attr($sortby) . "&sortorder=" . attr($sortorder) . "&begin=" . attr($prev) . "&$activity_string_html\" onclick=\"top.restoreSession()\"><i class=\"fa " . $chevron_icon_left . " chevron_color\" aria-hidden=\"true\"></i></a>";
641 } else {
642 $prevlink = "<i class=\"fa ". $chevron_icon_left ." \" style=\"color:grey\" aria-hidden=\"true\" title=\"". xla("On first page") . "\"></i>";
645 if ($next < $total) {
646 $nextlink = "<a href=\"messages.php?show_all=" . attr($showall) . "&sortby=" . attr($sortby) . "&sortorder=" . attr($sortorder) . "&begin=" . attr($next) . "&$activity_string_html\" onclick=\"top.restoreSession()\"><i class=\"fa . $chevron_icon_right . chevron_color\" aria-hidden=\"true\"></i></a>";
647 } else {
648 $nextlink = "<i class=\"fa . $chevron_icon_right .\" style=\"color:grey\" aria-hidden=\"true\" title=\"". xla("On first page") . "\"></i>";
650 // Display the Messages table header.
651 echo "
652 <table width=100%>
653 <tr>
654 <td>
655 <form name='MessageList' id='MessageList' action=\"messages.php?showall=" . attr($showall) . "&sortby=" . attr($sortby) . "&sortorder=" . attr($sortorder) . "&begin=" . attr($begin) . "&$activity_string_html\" method=post>
656 <table border=0 cellpadding=1 cellspacing=0 style=\"border-left: 1px #000000 solid; width:100%; border-right: 1px #000000 solid; border-top: 1px #000000 solid;\">
657 <input type=hidden name=task value=delete>
658 <tr height=\"24\" style=\"background:lightgrey\" class=\"head\">
659 <td align=\"center\" width=\"25\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><input type=checkbox id=\"checkAll\" onclick=\"selectAll()\"></td>
660 <td width=\"20%\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold>&nbsp;<b>" .
661 xlt('From') . "</b> $sortlink[0]</td>
662 <td width=\"20%\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold>&nbsp;<b>" .
663 xlt('Patient') . "</b> $sortlink[1]</td>
664 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold>&nbsp;<b>" .
665 xlt('Type') . "</b> $sortlink[2]</td>
666 <td width=\"15%\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold>&nbsp;<b>" .
667 xlt($GLOBALS['messages_due_date'] ? 'Due date' : 'Date') . "</b> $sortlink[3]</td>
668 <td width=\"15%\" style=\"border-bottom: 1px #000000 solid; \" class=bold>&nbsp;<b>" .
669 xlt('Status') . "</b> $sortlink[4]</td>
670 </tr>";
671 // Display the Messages table body.
672 $count = 0;
673 $result = getPnotesByUser($active, $show_all, $_SESSION['authUser'], false, $sortby, $sortorder, $begin, $listnumber);
674 while ($myrow = sqlFetchArray($result)) {
675 $name = $myrow['user'];
676 $name = $myrow['users_lname'];
677 if ($myrow['users_fname']) {
678 $name .= ", " . $myrow['users_fname'];
680 $patient = $myrow['pid'];
681 if ($patient > 0) {
682 $patient = $myrow['patient_data_lname'];
683 if ($myrow['patient_data_fname']) {
684 $patient .= ", " . $myrow['patient_data_fname'];
686 } else {
687 $patient = "* " . xl('Patient must be set manually') . " *";
689 $count++;
690 echo "
691 <tr id=\"row" . attr($count) . "\" style=\"background:white\" height=\"24\">
692 <td align=\"center\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\">
693 <input type=checkbox id=\"check" . attr($count) . "\" name=\"delete_id[]\" value=\"" .
694 attr($myrow['id']) . "\" onclick=\"if(this.checked==true){ selectRow('row" . attr(addslashes($count)) . "'); }else{ deselectRow('row" . attr(addslashes($count)) . "'); }\"></td>
695 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\">
696 <table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\">" .
697 text($name) . "</td><td width=5></td></tr>
698 </table></td>
699 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\">
700 <table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\"><a href=\"messages.php?showall=" . attr_url($showall) . "&sortby=" . attr_url($sortby) . "&sortorder=" . attr_url($sortorder) . "&begin=" . attr_url($begin) . "&task=edit&noteid=" .
701 attr_url($myrow['id']) . "&$activity_string_html\" onclick=\"top.restoreSession()\">" .
702 text($patient) . "</a></td><td width=5></td></tr>
703 </table></td>
704 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\">
705 <table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\">" .
706 xlt($myrow['title']) . "</td><td width=5></td></tr>
707 </table></td>
708 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\">
709 <table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\">" .
710 text(oeFormatShortDate(substr($myrow['date'], 0, strpos($myrow['date'], " ")))) . "</td><td width=5></td></tr>
711 </table>
712 </td>
713 <td style=\"border-bottom: 1px #000000 solid;\">
714 <table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\">" .
715 text(getListItemTitle('message_status', $myrow['message_status'])) . "</td><td width=5></td></tr>
716 </table>
717 </td>
718 </tr>";
720 // Display the Messages table footer.
722 echo " </table>
723 </form>
724 <div class='row oe-margin-t-10'>
726 <div class=\"col-xs-12 col-md-12 col-lg-12\"><a href=\"messages.php?showall=" . attr_url($showall) . "&sortby=" . attr_url($sortby) . "&sortorder=" . attr_url($sortorder) . "&begin=" . attr_url($begin) . "&task=addnew&$activity_string_html\" class=\"btn btn-default btn-add\" onclick=\"top.restoreSession()\">" .
727 xlt('Add New') . "</a> &nbsp; <a href=\"javascript:confirmDeleteSelected()\" class=\"btn btn-default btn-delete\" onclick=\"top.restoreSession()\">" .
728 xlt('Delete') . "</a>
729 <div class=\"text-right\">$prevlink &nbsp; " . text($end) . " " . xlt('of') . " " . text($total) . " &nbsp; $nextlink</div>
730 </div>
731 </div>
732 </td>
733 </tr>
734 </table>
735 <br>";
738 <script language="javascript">
739 // This is to confirm delete action.
740 function confirmDeleteSelected() {
741 var int_checked = 0;
742 var elem = document.forms.namedItem("MessageList").getElementsByTagName("input");
744 for (i=0; i < elem.length; i++){
745 if(elem[i].checked == true){
746 int_checked = ++int_checked;
749 if (int_checked > 0){
750 if (confirm("<?php echo xls('Do you really want to delete the selection?'); ?>")) {
751 document.MessageList.submit();
753 } else {
754 alert("<?php echo xls('Please select message(s) to delete'); ?>");
759 // This is to allow selection of all items in Messages table for deletion.
760 function selectAll() {
761 if (document.getElementById("checkAll").checked === true) {
762 document.getElementById("checkAll").checked = true;<?php
763 for ($i = 1; $i <= $count; $i++) {
764 echo "document.getElementById(\"check$i\").checked=true; document.getElementById(\"row$i\").style.background='#E7E7E7'; ";
765 } ?>
766 } else {
767 document.getElementById("checkAll").checked = false;<?php
768 for ($i = 1; $i <= $count; $i++) {
769 echo "document.getElementById(\"check$i\").checked=false; document.getElementById(\"row$i\").style.background='#F7F7F7'; ";
770 } ?>
774 // The two functions below are for managing row styles in Messages table.
775 function selectRow(row) {
776 document.getElementById(row).style.background = "#E7E7E7";
779 function deselectRow(row) {
780 document.getElementById(row).style.background = "#F7F7F7";
782 </script>
783 <?php
786 </div>
787 </fieldset>
788 </div><!--end of messages div-->
789 <div class="row oe-display" id="reminders-div">
790 <fieldset>
791 <div class="col-sm-12 col-md-12 col-lg-12">
792 <div class="oe-margin-b-10">
793 <span class="title"><?php echo xlt('Reminders'); ?></span>
794 </div>
795 <?php
796 // TajEmo Work by CB 2012/01/11 02:51:25 PM adding dated reminders
797 // I am asuming that at this point security checks have been performed
798 //require_once '../dated_reminders/dated_reminders.php';
799 require_once '../dated_reminders/dated_reminders.php';
801 </div>
802 </fieldset>
803 </div><!--end of reminders div-->
804 <div class="row oe-display" id="recalls-div">
805 <fieldset>
806 <?php if ($GLOBALS['disable_rcb'] != '1') { ?>
807 <div class="col-sm-6 col-md-6 col-lg-6">
808 <div class="dr_container">
809 <span class="title"><?php echo xlt('Recalls'); ?></span>
810 <br/><br/>
811 <a class="btn btn-default btn-add"
812 onclick="goReminderRecall('addRecall');"><span><?php echo xlt('New Recall'); ?></span></a>
813 &nbsp;
814 <a class="btn btn-default btn-transmit"
815 onclick="goReminderRecall('Recalls');"><span><?php echo xlt('Recall Board'); ?></span></a>
816 &nbsp;
817 </div>
818 </div>
819 <?php } ?>
820 </fieldset>
821 </div><!--end of recalls div-->
822 <div class="row oe-display" id="sms-div">
823 <fieldset>
824 <?php if ($logged_in) { ?>
825 <div class="col-sm-4 col-md-4 col-lg-4">
826 <span class="title"><?php echo xlt('SMS Zone'); ?></span>
827 <br/><br/>
828 <form id="smsForm" class="input-group">
829 <input id="SMS_patient" type="text" style="margin:0;max-width:100%;" class="form-control"
830 placeholder="<?php echo xla("Patient Name"); ?>" />
831 <span class="input-group-addon" onclick="SMS_direct();"><i
832 class="glyphicon glyphicon-phone"></i></span>
833 <input type="hidden" id="sms_pid">
834 <input type="hidden" id="sms_mobile" value="">
835 <input type="hidden" id="sms_allow" value="">
836 </form>
837 </div>
838 <?php } ?>
839 </fieldset>
840 </div><!--end of sms div-->
841 </div><!--end of container div-->
842 <br>
843 <?php
844 //home of the help modal ;)
845 //$GLOBALS['enable_help'] = 0; // Please comment out line if you want help modal to function on this page
846 if ($GLOBALS['enable_help'] == 1) {
847 echo "<script>var helpFile = 'message_center_help.php'</script>";
848 //help_modal.php lives in interface, set path accordingly
849 require "../../help_modal.php";
852 <script language="javascript">
854 var collectvalidation = <?php echo $collectthis; ?>;
856 $(function (){
857 $("#reminders-div").hide();
858 $("#recalls-div").hide();
859 $("#sms-div").hide();
860 $("#messages-li").click(function(){
861 $("#messages-div").show(250);
862 $("#reminders-div").hide(250);
863 $("#recalls-div").hide(250);
864 $("#sms-div").hide(250);
865 $("#li-mess").addClass("active");
866 $("#li-remi").removeClass("active");
867 $("#li-reca").removeClass("active");
868 $("#li-sms").removeClass("active");
871 $("#reminders-li").click(function(){
872 $("#messages-div").hide(250);
873 $("#reminders-div").show(250);
874 $("#recalls-div").hide(250);
875 $("#sms-div").hide(250);
876 $("#li-remi").addClass("active");
877 $("#li-mess").removeClass("active");
878 $("#li-reca").removeClass("active");
879 $("#li-sms").removeClass("active");
881 $("#recalls-li").click(function(){
882 $("#messages-div").hide(250);
883 $("#reminders-div").hide(250);
884 $("#recalls-div").show(250);
885 $("#sms-div").hide(250);
886 $("#li-remi").removeClass("active");
887 $("#li-mess").removeClass("active");
888 $("#li-reca").addClass("active");
889 $("#li-sms").removeClass("active");
891 $("#sms-li").click(function(){
892 $("#messages-div").hide(250);
893 $("#reminders-div").hide(250);
894 $("#recalls-div").hide(250);
895 $("#sms-div").show(250);
896 $("#li-remi").removeClass("active");
897 $("#li-mess").removeClass("active");
898 $("#li-reca").removeClass("active");
899 $("#li-sms").addClass("active");
902 $('.datetimepicker').datetimepicker({
903 <?php $datetimepicker_timepicker = true; ?>
904 <?php $datetimepicker_showseconds = false; ?>
905 <?php $datetimepicker_formatInput = true; ?>
906 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
907 ,minDate : 0 //only future
911 $(function (){
912 $( "ul.navbar-nav" ).children().click(function(){
913 $(".collapse").collapse('hide');
916 $(function (){
917 //for jquery tooltip to function if jquery 1.12.1.js is called via jquery-ui in the Header::setupHeader
918 // the relevant css file needs to be called i.e. jquery-ui-darkness
919 $('#see-all-tooltip').attr( "title", "<?php echo xla('Click to show messages for all users'); ?>" );
920 $('#see-all-tooltip').tooltip();
921 $('#just-mine-tooltip').attr( "title", "<?php echo xla('Click to show messages for only the current user'); ?>" );
922 $('#just-mine-tooltip').tooltip();
924 $(function () {
925 var f = $("#smsForm");
926 $("#SMS_patient").autocomplete({
927 source: "save.php?go=sms_search",
928 minLength: 2,
929 select: function (event, ui) {
930 event.preventDefault();
931 $("#SMS_patient").val(ui.item.label + ' ' + ui.item.mobile);
932 $("#sms_pid").val(ui.item.pid);
933 $("#sms_mobile").val(ui.item.mobile);
934 $("#sms_allow").val(ui.item.allow);
938 jQuery.ui.autocomplete.prototype._resizeMenu = function () {
939 var ul = this.menu.element;
940 ul.outerWidth(this.element.outerWidth());
942 $(function () {
943 $("#newnote").click(function (event) {
944 NewNote(event);
946 $("#printnote").click(function () {
947 PrintNote();
949 var obj = $("#form_message_status");
950 obj.onchange = function () {
951 SaveNote();
953 $("#cancel").click(function () {
954 CancelNote();
956 $("#note").focus();
958 //clear button in messages
959 $("#clear_user").click(function(){
960 $("#assigned_to_text").val("<?php echo xls('Select Users From The Dropdown List'); ?>");
961 $("#assigned_to").val("");
962 $("#users").val("--");
965 //clear inputs of patients
966 $("#clear_patients").click(function(){
967 $("#reply_to").val("");
968 $("#form_patient").val("");
972 var NewNote = function (event) {
973 top.restoreSession();
974 if(document.getElementById("form_message_status").value !== 'Done'){
975 collectvalidation.assigned_to = {
976 presence: {message: "<?php echo xls('Recipient required unless status is Done'); ?>"}
979 else{
980 delete collectvalidation.assigned_to;
983 $('#newnote').attr('disabled', true);
985 var submit = submitme(1, event, 'new_note', collectvalidation);
986 if(!submit){
987 $('#newnote').attr('disabled', false);
989 else {
990 $("#new_note").submit();
993 var PrintNote = function () {
994 top.restoreSession();
995 window.open('../../patient_file/summary/pnotes_print.php?noteid=' + <?php echo js_url($noteid); ?>, '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
998 var SaveNote = function () {
999 <?php if ($noteid) { ?>
1000 top.restoreSession();
1001 $("#task").val("save");
1002 $("#new_note").submit();
1003 <?php } ?>
1006 var CancelNote = function () {
1007 top.restoreSession();
1008 $("#task").val("");
1009 $("#new_note").submit();
1012 function gotoReport(doc_id, pname, pid, pubpid, str_dob) {
1013 EncounterDateArray = [];
1014 CalendarCategoryArray = [];
1015 EncounterIdArray = [];
1016 Count = 0;
1017 <?php
1018 if (isset($enc_list) && sqlNumRows($enc_list) > 0) {
1019 while ($row = sqlFetchArray($enc_list)) {
1021 EncounterIdArray[Count] = '<?php echo attr($row['encounter']); ?>';
1022 EncounterDateArray[Count] = '<?php echo attr(oeFormatShortDate(date("Y-m-d", strtotime($row['date'])))); ?>';
1023 CalendarCategoryArray[Count] = '<?php echo attr(xl_appt_category($row['pc_catname'])); ?>';
1024 Count++;
1025 <?php
1029 top.restoreSession();
1030 $.ajax({
1031 type: 'get',
1032 url: '<?php echo $GLOBALS['webroot'] . "/library/ajax/set_pt.php";?>',
1033 data: {
1034 set_pid: pid,
1035 csrf_token_form: <?php echo js_escape(collectCsrfToken()); ?>
1037 async: false
1039 parent.left_nav.setPatient(pname, pid, pubpid, '', str_dob);
1040 parent.left_nav.setPatientEncounter(EncounterIdArray, EncounterDateArray, CalendarCategoryArray);
1041 <?php if ($GLOBALS['new_tabs_layout']) { ?>
1042 var docurl = '../controller.php?document&view' + "&patient_id=" + encodeURIComponent(pid) + "&document_id=" + encodeURIComponent(doc_id) + "&";
1043 var paturl = 'patient_file/summary/demographics.php?pid=' + encodeURIComponent(pid);
1044 parent.left_nav.loadFrame('dem1', 'pat', paturl);
1045 parent.left_nav.loadFrame('doc0', 'enc', docurl);
1046 top.activateTabByName('enc', true);
1047 <?php } else { ?>
1048 var docurl = '<?php echo $GLOBALS['webroot'] . "/controller.php?document&view"; ?>' + "&patient_id=" + encodeURIComponent(pid) + "&document_id=" + encodeURIComponent(doc_id) + "&";
1049 var paturl = '<?php echo $GLOBALS['webroot'] . "/interface/patient_file/summary/demographics.php?pid="; ?>' + encodeURIComponent(pid);
1050 var othername = (window.name === 'RTop') ? 'RBot' : 'RTop';
1051 parent.frames[othername].location.href = paturl;
1052 location.href = docurl;
1053 <?php } ?>
1056 // This is for callback by the find-patient popup.
1057 function setpatient(pid, lname, fname, dob) {
1058 var f = document.getElementById('new_note');
1059 f.form_patient.value += lname + ', ' + fname + '; ';
1060 f.reply_to.value += pid + ';';
1061 <?php if ($noteid) { ?>
1062 //used when direct messaging service inserts a pnote with indeterminate patient
1063 //to allow the user to assign the message to a patient.
1064 top.restoreSession();
1065 $("#task").val("savePatient");
1066 $("#new_note").submit();
1067 <?php } ?>
1070 // This is for callback by the multi_patients_finder popup.
1071 function setMultiPatients(patientsList) {
1072 var f = document.getElementById('new_note');
1073 f.form_patient.value='';
1074 f.reply_to.value='';
1075 $.each(patientsList, function (key, patient) {
1076 f.form_patient.value += patient.lname + ', ' + patient.fname + '; ';
1077 f.reply_to.value += patient.pid + ';';
1080 <?php if ($noteid) { ?>
1081 //used when direct messaging service inserts a pnote with indeterminate patient
1082 //to allow the user to assign the message to a patient.
1083 top.restoreSession();
1084 $("#task").val("savePatient");
1085 $("#new_note").submit();
1086 <?php } ?>
1089 // This invokes the find-patient popup.
1090 function sel_patient() {
1091 dlgopen('../../main/calendar/find_patient_popup.php', '_blank', 625, 400);
1094 function multi_sel_patient() {
1095 $('#reply_to').trigger('click');
1096 var url = '../../main/finder/multi_patients_finder.php'
1097 // for edit selected list
1098 if ($('#reply_to').val() !== '') {
1099 url = url + '?patients=' + $('#reply_to').val() + '&csrf_token_form=<?php echo attr_url(collectCsrfToken()); ?>';
1101 dlgopen(url, '_blank', 625, 400);
1104 function addtolist(sel) {
1105 $('#assigned_to').trigger("click");
1106 var itemtext = document.getElementById('assigned_to_text');
1107 var item = document.getElementById('assigned_to');
1108 if (sel.value !== '--') {
1109 if (item.value) {
1110 if (item.value.indexOf(sel.value) === -1) {
1111 itemtext.value = itemtext.value + ' ; ' + sel.options[sel.selectedIndex].text;
1112 item.value = item.value + ';' + sel.value;
1114 } else {
1115 itemtext.value = sel.options[sel.selectedIndex].text;
1116 item.value = sel.value;
1121 function SMS_direct() {
1122 var pid = $("#sms_pid").val();
1123 var m = $("#sms_mobile").val();
1124 var allow = $("#sms_allow").val();
1125 if ((pid === '') || (m === '')) {
1126 alert('<?php echo xls("MedEx needs a valid mobile number to send SMS messages..."); ?>');
1127 } else if (allow === 'NO') {
1128 alert('<?php echo xls("This patient does not allow SMS messaging!"); ?>');
1129 } else {
1130 top.restoreSession();
1131 window.open('messages.php?nomenu=1&go=SMS_bot&pid=' + encodeURIComponent(pid) + '&m=' + encodeURIComponent(m), 'SMS_bot', 'width=370,height=600,resizable=0');
1134 </script>
1135 <?php
1138 </body>
1139 </html>