Annoying CKEditor4 security warning (#7543)
[openemr.git] / interface / main / calendar / modules / PostCalendar / pntemplates / default / views / month / ajax_template.html
blob5d7e132cbcd8efcef8396276bcccad78bd03bcbd
1 [-*Smarty*-]
2 [-*****************************************************************************-]
3 [-* Copyright (C) 2005-2006 Rod Roark <rod@sunsetsystems.com> and others *-]
4 [-* Copyright (C) 2019 Jerry Padgett <sjpadgett@gmail.com> *-]
5 [-* *-]
6 [-* This program is free software; you can redistribute it and/or *-]
7 [-* modify it under the terms of the GNU General Public License *-]
8 [-* as published by the Free Software Foundation; either version 2 *-]
9 [-* of the License, or (at your option) any later version. *-]
10 [-*****************************************************************************-]
11 [-config_load file="default.conf"-]
12 [-*Load the Language Definitions*-]
13 [-config_load file="lang.$USER_LANG"-]
14 [-include file="$TPL_NAME/views/header.html"-]
16 [-*Values used in setting timeslot and event heights*-]
17 [-php-]
18 /* if you change these be sure to change their matching values in
19 * the CSS for the calendar, found in interface/themes/ajax_calendar.css
21 $timeslotHeightVal=20;
22 $timeslotHeightUnit="px";
23 [-/php-]
25 <script>
26 // This is called from the event editor popup.
27 function refreshme() {
28 top.restoreSession();
29 document.forms[0].submit();
32 function newEvt(startampm, starttimeh, starttimem, eventdate, providerid, catid) {
33 dlgopen('add_edit_event.php?startampm=' + encodeURIComponent(startampm) +
34 '&starttimeh=' + encodeURIComponent(starttimeh) + '&starttimem=' + encodeURIComponent(starttimem) +
35 '&date=' + encodeURIComponent(eventdate) + '&userid=' + encodeURIComponent(providerid) + '&catid=' + encodeURIComponent(catid)
36 ,'_blank', 780, 675, '', '', {onClosed: 'refreshme'});
39 function oldEvt(eventdate, eventid, pccattype) {
40 dlgopen('add_edit_event.php?date=' + encodeURIComponent(eventdate) + '&eid=' + encodeURIComponent(eventid) + '&prov=' + encodeURIComponent(pccattype), '_blank', 780, 675);
43 function oldGroupEvt(eventdate, eventid, pccattype){
44 top.restoreSession();
45 dlgopen('add_edit_event.php?group=true&date=' + encodeURIComponent(eventdate) + '&eid=' + encodeURIComponent(eventid) + '&prov=' + encodeURIComponent(pccattype), '_blank', 780, 675);
48 function goPid(pid) {
49 top.restoreSession();
50 [-php-]
51 echo " top.RTop.location = '../../patient_file/summary/demographics.php' " .
52 "+ '?set_pid=' + encodeURIComponent(pid);\n";
53 [-/php-]
56 function goGid(gid) {
57 top.restoreSession();
58 [-php-]
59 echo " top.RTop.location = '" . $GLOBALS['rootdir'] . "/therapy_groups/index.php' " .
60 "+ '?method=groupDetails&group_id=' + encodeURIComponent(gid);\n ";
61 [-/php-]
64 function GoToToday(theForm){
65 var todays_date = new Date();
66 var theMonth = todays_date.getMonth() + 1;
67 theMonth = theMonth < 10 ? "0" + theMonth : theMonth;
68 theForm.jumpdate.value = todays_date.getFullYear() + "-" + theMonth + "-" + todays_date.getDate();
69 top.restoreSession();
70 theForm.submit();
72 function ShowImage(src)
74 var img = document.getElementById('popupImage');
75 var div = document.getElementById('popup');
76 img.src = src;
77 div.style.display = "block";
79 function HideImage()
81 document.getElementById('popup').style.display = "none";
83 </script>
85 [-php-]
87 // this is my proposed setting in the globals config file so we don't
88 // need to mess with altering the pn database AND the config file
89 //pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', $GLOBALS['schedule_dow_start']);
91 // build a day-of-week (DOW) list so we may properly build the calendars later in this code
92 $DOWlist = array();
93 $tmpDOW = pnModGetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek');
94 // bound check and auto-correction
95 if ($tmpDOW <0 || $tmpDOW >6) {
96 pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', '0');
97 $tmpDOW = 0;
99 while (count($DOWlist) < 7) {
100 array_push($DOWlist, $tmpDOW);
101 $tmpDOW++;
102 if ($tmpDOW > 6) $tmpDOW = 0;
105 // A_CATEGORY is an ordered array of associative-array categories.
106 // Keys of interest are: id, name, color, desc, event_duration.
108 // echo "<!-- A_CATEGORY = "; print_r($this->_tpl_vars['A_CATEGORY']); echo " -->\n"; // debugging
109 // echo "<!-- A_EVENTS = "; print_r($this->_tpl_vars['A_EVENTS']); echo " -->\n"; // debugging
111 $A_CATEGORY =& $this->_tpl_vars['A_CATEGORY'];
113 $A_EVENTS =& $this->_tpl_vars['A_EVENTS'];
114 $providers =& $this->_tpl_vars['providers'];
115 $times =& $this->_tpl_vars['times'];
116 $interval = $this->_tpl_vars['interval'];
117 $viewtype = $this->_tpl_vars['VIEW_TYPE'];
118 $PREV_WEEK_URL = $this->_tpl_vars['PREV_WEEK_URL'];
119 $NEXT_WEEK_URL = $this->_tpl_vars['NEXT_WEEK_URL'];
120 $PREV_DAY_URL = $this->_tpl_vars['PREV_DAY_URL'];
121 $NEXT_DAY_URL = $this->_tpl_vars['NEXT_DAY_URL'];
122 $PREV_MONTH_URL = $this->_tpl_vars['PREV_MONTH_URL'];
123 $NEXT_MONTH_URL = $this->_tpl_vars['NEXT_MONTH_URL'];
125 $Date = postcalendar_getDate();
126 if (!isset($y)) $y = substr($Date, 0, 4);
127 if (!isset($m)) $m = substr($Date, 4, 2);
128 if (!isset($d)) $d = substr($Date, 6, 2);
130 // echo "<!-- There are " . count($A_EVENTS) . " A_EVENTS days -->\n";
132 //==================================
133 //FACILITY FILTERING (CHEMED)
134 $facilities = getUserFacilities($_SESSION['authUserID']); // from users_facility
135 if ( $_SESSION['pc_facility'] ) {
136 $provinfo = getProviderInfo('%', true, $_SESSION['pc_facility']);
137 } else {
138 $provinfo = getProviderInfo();
140 //EOS FACILITY FILTERING (CHEMED)
141 //==================================
143 $chevron_icon_left = $_SESSION['language_direction'] == 'ltr' ? 'fa-chevron-circle-left' : 'fa-chevron-circle-right';
144 $chevron_icon_right = $_SESSION['language_direction'] == 'ltr' ? 'fa-chevron-circle-right' : 'fa-chevron-circle-left';
146 [-/php-]
147 <div id="wrapper">
148 <!-- stuff form element here to avoid the margin padding it introduces into the page in some browsers -->
149 <form name='theform' id='theform' action='index.php?module=PostCalendar&func=view&tplview=default&pc_category=&pc_topic=' method='post' onsubmit='return top.restoreSession()'>
150 <div class="container-fluid sticky-top">
151 <div id="topToolbarRight" class="bgcolor2">
152 <!-- this wraps some of the top toolbar items -->
153 <div id="functions">
154 <a id="menu-toggle" href="#" class="btn btn-outline-dark"><i class="fas fa-bars"></i></a>
155 <input type="hidden" name="jumpdate" id="jumpdate" value="" />
156 <input type="hidden" name="viewtype" id="viewtype" value="[-php-]echo attr($viewtype);[-/php-]" />
157 [-php-]
158 echo "<a href='#' title='" . xla("New Appointment") . "' onclick='newEvt(1, 9, 00, " . attr_js($Date) . ", 0, 0)' class='btn btn-primary'><i class='fa fa-plus'></i></a>\n";
159 echo "<a href='#' title='" . xla("Search Appointment") . "'
160 onclick='top.restoreSession();location=\"index.php?module=PostCalendar&func=search\"' class='btn btn-primary'><i class='fa fa-search'></i></a>\n";
161 if ($Date <> date('Ymd')) {
162 [-/php-]
163 <a href='#' name='bnsubmit' value='[-xla t="Today"-]' onClick='GoToToday(theform);' class='btn btn-primary'>[-xlt t='Today'-]</a>
164 [-php-]
166 [-/php-]
168 </div>
169 <div id="dateNAV">
170 [-php-]
171 echo " <a id='prevmonth' href='$PREV_MONTH_URL' onclick='top.restoreSession()' title='" . xla("Previous Month") . "'><i class='fa " . attr($chevron_icon_left) . " chevron_color'></i></a>\n";;
172 echo xlt(date('F', strtotime($Date))) . " " . text(date('Y', strtotime($Date)));
173 echo " <a id='nextmonth' href='$NEXT_MONTH_URL' onclick='top.restoreSession()' title='" . xla("Next Month") . "'><i class= 'fa " . attr($chevron_icon_right) . " chevron_color'></i></a>\n";
174 [-/php-]
175 </div>
177 <div id="viewPicker">
178 [-php-]
179 echo " <a href='#' id='printview' title='" . xla("View Printable Version") . "' class='btn btn-primary'><i class='fa fa-print'></i></a>\n";
180 echo " <a href='#' title='" . xla("Refresh") . "' onclick='javascript:refreshme()' class='btn btn-primary'><i class='fa fa-sync'></i></a>\n";
181 echo " <a href='#' type='button' id='dayview' title='" . xla('Day View') . "' class='btn btn-primary'>" . xlt('Day') . "</a>\n";
182 echo " <a href='#' type='button' id='weekview' title='" . xla('Week View') . "' class='btn btn-primary'>" . xlt('Week') . "</a>\n";
183 echo " <a href='#' type='button' id='monthview' title='" . xla('Month View') . "' class='btn btn-primary'>" . xlt('Month') . "</a>\n";
184 [-/php-]
185 </div>
186 </div> <!-- end topToolbarRight -->
187 </div>
188 <div class="sticky-top">
189 <div id="bottomLeft" class="sidebar-wrapper">
190 <div id="datePicker">
191 [-php-]
192 // caldate depends on what the user has clicked
193 $caldate = strtotime($Date);
194 $cMonth = date("m", $caldate);
195 $cYear = date("Y", $caldate);
196 $cDay = date("d", $caldate);
198 include_once($GLOBALS['fileroot'].'/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/monthSelector.php');
199 [-/php-]
200 <div class="table-responsive">
201 <table class='table table-sm table-borderless'>
202 <tbody><tr>
203 [-php-]
205 // compute the previous month date
206 // stay on the same day if possible
207 $pDay = $cDay;
208 $pMonth = $cMonth - 1;
209 $pYear = $cYear;
210 if ($pMonth < 1) { $pMonth = 12; $pYear = $cYear - 1; }
211 while (! checkdate($pMonth, $pDay, $pYear)) { $pDay = $pDay - 1; }
212 $prevMonth = sprintf("%d%02d%02d",$pYear,$pMonth,$pDay);
214 // compute the next month
215 // stay on the same day if possible
216 $nDay = $cDay;
217 $nMonth = $cMonth + 1;
218 $nYear = $cYear;
219 if ($nMonth > 12) { $nMonth = 1; $nYear = $cYear + 1; }
220 while (! checkdate($nMonth, $nDay, $nYear)) { $nDay = $nDay - 1; }
221 $nextMonth = sprintf("%d%02d%02d",$nYear,$nMonth,$nDay);
222 [-/php-]
223 <td class="tdDOW-small tdDatePicker tdNav" id="[-php-]echo attr($prevMonth)[-/php-]" title="[-php-]echo xla(date("F", strtotime($prevMonth)));[-/php-]">&lt;</td>
224 <td colspan="5" class="tdMonthName-small">
225 [-php-]
226 echo xl(date('F', $caldate));
227 [-/php-]
228 </td>
229 <td class="tdDOW-small tdDatePicker tdNav" id="[-php-]echo attr($nextMonth)[-/php-]" title="[-php-]echo xla(date("F", strtotime($nextMonth)));[-/php-]">&gt;</td>
230 <tr>
231 [-php-]
232 foreach ($DOWlist as $dow) {
233 echo "<td class='tdDOW-small'>" . text($this->_tpl_vars['A_SHORT_DAY_NAMES'][$dow]) . "</td>";
235 [-/php-]
236 </tr>
237 [-php-]
238 $atmp = array_keys($A_EVENTS);
240 foreach ($atmp as $currdate) {
241 $currdate = strtotime($currdate);
242 if (date('w', $currdate) == $DOWlist[0]) {
243 // start of week row
244 $tr = "<tr>";
245 echo $tr;
248 // set the TD class
249 $tdClass = "tdMonthDay-small";
250 if (!empty($month) && (date('m', $currdate) != $month)) {
251 $tdClass = "tdOtherMonthDay-small";
253 if (is_weekend_day(date('w', $currdate))) {
254 $tdClass = "tdWeekend-small";
256 if (is_holiday(date('Y-m-d', $currdate))) {
257 $tdClass = "tdHoliday-small";
260 if (date('Ymd',$currdate) == $Date) {
261 // $Date is defined near the top of this file
262 // and is equal to whatever date the user has clicked
263 $tdClass .= " currentDate";
266 // add a class so that jQuery can grab these days for the 'click' event
267 $tdClass .= " tdDatePicker";
269 // output the TD
270 $td = "<td ";
271 $td .= "class=\"" . attr($tdClass) . "\" ";
272 //$td .= "id=\"" . attr(date("Ymd", $currdate)) . "\" ";
273 $td .= "id=\"" . attr(date("Ymd", $currdate)) . "\" ";
274 $td .= "title=\"" . xla('Go to') . " " . attr(date('F', $currdate)) . "\" ";
275 $td .= "> " . text(date('d', $currdate)) . "</td>\n";
276 echo $td;
278 // end of week row
279 if (date('w', $currdate) == $DOWlist[6]) echo "</tr>\n";
281 [-/php-]
282 </tbody>
283 </table>
284 </div>
285 </div>
286 <div id="bigCalHeader">
287 </div>
289 <div id="providerPicker">
290 [-php-] echo xlt('Providers'); [-/php-]
291 <div>
292 [-php-]
293 // ==============================
294 // FACILITY FILTERING (lemonsoftware)
295 // $facilities = getFacilities();
296 if (!empty($_SESSION['authorizeduser']) && ($_SESSION['authorizeduser'] == 1)) {
297 $facilities = getFacilities();
298 } else {
299 $facilities = getUserFacilities($_SESSION['authUserID']); // from users_facility
300 if (count($facilities) == 1)
301 OpenEMR\Common\Session\SessionUtil::setSession('pc_facility', key($facilities));
303 if (count($facilities) > 1) {
304 echo " <select name='pc_facility' id='pc_facility' class='view1 form-control'>\n";
305 if ( !$_SESSION['pc_facility'] ) $selected = "selected='selected'";
306 // echo " <option class='bg-info' value='0' $selected>" . xlt('All Facilities'). "</option>\n";
307 if (!$GLOBALS['restrict_user_facility']) echo " <option class='bg-info' value='0' $selected>" . xlt('All Facilities') . "</option>\n";
309 foreach ($facilities as $fa) {
310 $selected = ( $_SESSION['pc_facility'] == $fa['id']) ? "selected='selected'" : "" ;
311 echo " <option class='bg-info' value='" . attr($fa['id']). "' $selected>" . text($fa['name']). "</option>\n";
313 echo " </select>\n";
315 // EOS FF
316 // ==============================
317 echo "</div>";
318 echo " <select multiple size='5' name='pc_username[]' id='pc_username' class='view2 form-control'>\n";
319 echo " <option value='__PC_ALL__'>" . xlt("All Users") . "</option>\n";
320 foreach ($provinfo as $doc) {
321 $username = $doc['username'];
322 echo " <option value='" . attr($username) . "'";
323 foreach ($providers as $provider)
324 if ($provider['username'] == $username) echo " selected";
325 echo ">" . text($doc['lname']) . ", " . text($doc['fname']) . "</option>\n";
327 echo " </select>\n";
329 [-/php-]
330 </div>
331 [-php-]
332 if($_SESSION['pc_facility'] == 0){
333 [-/php-]
334 <ul class="list-group list-group-flush" id="facilityColor">
335 [-php-]
336 foreach ($facilities as $f){
337 echo "<li class='list-group-item' style='border-left: 35px solid ".$f['color'].";'>" . text($f['name'])."</li>";
339 [-/php-]
340 </ul>
341 [-php-]
343 [-/php-]
344 [-assign var="dayname" value=$DATE|date_format:"%w"-]
345 [-assign var="day" value=$DATE|date_format:"%d"|string_format:"%1d"-]
346 [-assign var="month" value=$DATE|date_format:"%m"|string_format:"%1d"-]
347 [-assign var="year" value=$DATE|date_format:"%Y"|string_format:"%4d"-]
349 <div id="popup" class="pop-up">
350 <img id="popupImage" alt="" />
351 </div>
352 </div><!-- end bottomLeft -->
353 </div>
355 <div class="page-content-wrapper">
356 <div class="container-fluid calsearch_body">
357 <div id="bigCal">
358 [-php-]
359 /* used in debugging
360 foreach ($A_EVENTS as $date => $events) {
361 echo $date." = ";
362 foreach ($events as $oneE) {
363 print_r($oneE);
364 echo "<br /><br />";
366 echo "<hr class='w-100'>";
371 // This loops once for each provider to be displayed.
373 foreach ($providers as $provider) {
374 $providerid = $provider['id'];
376 echo "<div class='table-responsive'>";
377 echo "<table class='table'>\n";
378 echo " <tr>\n";
379 echo " <td colspan='7' class='providerheader'>";
380 echo text($provider['fname']) . " " . text($provider['lname']);
381 echo "</td>\n";
382 echo " </tr>\n";
384 // output date headers
385 echo " <tr>\n";
386 $defaultDate = ""; // used when creating link for a 'new' event
387 $in_cat_id = 0; // used when creating link for a 'new' event
388 $dowCount = 0;
389 foreach ($A_EVENTS as $date => $events) {
390 if ($defaultDate == "") $defaultDate = date("Ymd", strtotime($date));
391 echo "<td align='center' class='month_dateheader'>";
392 echo xlt(date("D", strtotime($date)));
393 echo "</td>";
394 if ($dowCount++ == 6) { break; }
396 echo " </tr>\n";
398 // For each day...
399 // output a TD with an inner containing DIV positioned 'relative'
401 foreach ($A_EVENTS as $date => $events) {
402 $eventdate = substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2);
404 $gotoURL = pnModURL(__POSTCALENDAR__,'user','view',
405 array('tplview'=>($template_view ?? null),
406 'viewtype'=>'day',
407 'Date'=> date("Ymd", strtotime($date)),
408 'pc_username'=>($pc_username ?? null),
409 'pc_category'=>($category ?? null),
410 'pc_topic'=>($topic ?? null)));
412 if (date("w", strtotime($date)) == $DOWlist[0]) { echo "<tr>"; }
413 $classForWeekend = is_weekend_day(date('w', strtotime($date))) ? 'weekend-day' : 'work-day';
414 echo "<td class='schedule " . attr($classForWeekend) . "'>";
416 echo "<div class='calendar_day'>\n";
418 echo "<div class='month_daylink'>";
419 echo "<a href='".$gotoURL."' alt='Go to " . attr(date("d M Y",strtotime($date))) . "' title='" . xla('Go to') . " " . attr(date("d M Y", strtotime($date))) . "'>";
420 echo text(date("d", strtotime($date))) . "</a></div>";
422 if (count($events) == 0) { echo "&nbsp;"; }
423 //=======================================================================================
424 //=======================================================================================
425 foreach ($events as $event) {
426 // skip events for other providers
427 // yeah, we've got that sort of overhead here... it ain't perfect
428 // $event['aid']!=0 :With the holidays we included clinic events, they have provider id =0
429 // we dont want to exclude those events from being displayed
430 if ($providerid != $event['aid'] && $event['aid']!=0) { continue; }
432 // Omit IN and OUT events to reduce clutter in this month view
433 if (($event['catid'] == 2) || ($event['catid'] == 3)) { continue; }
435 // specially handle all-day events
436 if ($event['alldayevent'] == 1) {
437 $tmpTime = $times[0];
438 if (strlen($tmpTime['hour']) < 2) { $tmpTime['hour'] = "0".$tmpTime['hour']; }
439 if (strlen($tmpTime['minute']) < 2) { $tmpTime['minute'] = "0".$tmpTime['minute']; }
440 $event['startTime'] = $tmpTime['hour'].":".$tmpTime['minute'].":00";
441 $event['duration'] = ($calEndMin - $calStartMin) * 60; // measured in seconds
444 // figure the start time and minutes (from midnight)
445 $starth = (int) substr($event['startTime'], 0, 2);
446 $startm = (int) substr($event['startTime'], 3, 2);
447 $eStartMin = $starth * 60 + $startm;
448 $startDateTime = strtotime($date." ".$event['startTime']);
450 // determine the class for the event DIV based on the event category
451 $evtClass = "event_appointment";
452 switch ($event['catid']) {
453 case 1: // NO-SHOW appt
454 $evtClass = "event_noshow";
455 break;
456 case 2: // IN office
457 $evtClass = "event_in";
458 break;
459 case 3: // OUT of office
460 $evtClass = "event_out";
461 break;
462 case 4: // VACATION
463 $evtClass = "event_reserved";
464 break;
465 case 6: // HOLIDAY
466 $evtClass = "event_holiday hiddenevent";
467 break;
468 case 8: // LUNCH
469 $evtClass = "event_reserved";
470 break;
471 case 11: // RESERVED
472 $evtClass = "event_reserved";
473 break;
474 default: // some appointment
475 $evtClass = "event_appointment";
476 break;
478 // eventViewClass allows the event class to override the template (such as from a dispatched system event).
479 $evtClass = $event['eventViewClass'] ?? $evtClass;
481 // now, output the event DIV
483 $eventid = $event['eid'] ?? null;
484 $eventtype = sqlQuery("SELECT pc_cattype FROM openemr_postcalendar_categories as oc LEFT OUTER JOIN openemr_postcalendar_events as oe ON oe.pc_catid=oc.pc_catid WHERE oe.pc_eid=?", [$eventid]);
485 $pccattype = '';
486 if($eventtype['pc_cattype']==1)
487 $pccattype = 'true';
488 $patientid = $event['pid'];
489 $commapos = strpos($event['patient_name'], ",");
490 $lname = substr($event['patient_name'], 0, $commapos);
491 $fname = substr($event['patient_name'], $commapos + 2);
492 $patient_dob = oeFormatShortDate($event['patient_dob']);
493 $patient_age = $event['patient_age'];
494 $catid = $event['catid'] ?? null;
495 $comment = $event['hometext'];
496 $catname = $event['catname'];
497 $title = "Age $patient_age ($patient_dob)";
499 //Variables for therapy groups
500 $groupid = $event['gid'];
501 if($groupid) $patientid = '';
502 $groupname = $event['group_name'];
503 $grouptype = $event['group_type'];
504 $groupstatus = $event['group_status'];
505 $groupcounselors = '';
506 foreach($event['group_counselors'] as $counselor){
507 $groupcounselors .= getUserNameById($counselor) . " \n ";
510 // format the time specially
511 $displayTime = date("g", $startDateTime);
512 if (date("i", $startDateTime) == "00") {
513 $displayTime .= (date("a", $startDateTime));
515 else {
516 $displayTime .= (date(":ia", $startDateTime));
519 if ($comment && $GLOBALS['calendar_appt_style'] < 4) $title .= " " . $comment;
521 // the divTitle is what appears when the user hovers the mouse over the DIV
522 $divTitle = dateformat (strtotime($date),true);
523 $result = sqlStatement("SELECT name,id,color FROM facility WHERE id=(SELECT pc_facility FROM openemr_postcalendar_events WHERE pc_eid=?)", [$eventid]);
524 $row = sqlFetchArray($result);
525 $color=$event["catcolor"];
526 if($GLOBALS['event_color']==2)
527 $color=$row['color'];
528 $divTitle .= "\n" . $row['name'];
529 $content = "";
530 if ($catid == 4 || $catid == 8 || $catid == 11) {
531 if ($catid == 4) $catname = xl("VACATION");
532 else if ($catid == 8) $catname = xl("LUNCH");
533 else if ($catid == 11) $catname = xl("RESERVED");
535 $atitle = $catname;
536 if ($comment) $atitle .= " $comment";
537 $divTitle .= "\n[".$atitle ."]";
538 $content .= text($displayTime);
539 $content .= "&nbsp;" . text($catname);
541 else {
542 // some sort of patient appointment
543 if($groupid){
544 $divTitle .= "\n" . xl('Counselors') . ": \n" . $groupcounselors . " \n";
545 $divTitle .= "\r\n[" . $catname . ' ' . $comment . "]" . $groupname;
547 else
548 $divTitle .= "\r\n[" . $catname . ' ' . $comment . "]" . $fname . " " . $lname;
549 $content .= create_event_time_anchor($displayTime);
550 if ($patientid) {
551 // include patient name and link to their details
552 $link_title = $fname . " " . $lname . " \n";
553 $link_title .= xl('Age') . ": " . $patient_age . "\n" . xl('DOB') . ": " . $patient_dob . $comment . "\n";
554 $link_title .= "(" . xl('Click to view') . ")";
555 $content .= "<a class='link_title' data-pid='". attr($patientid) . "' href='javascript:goPid(" . attr_js($patientid) . ")' title='" . attr($link_title) . "'>";
556 $content .= "<img src='{$this->_tpl_vars['TPL_IMAGE_PATH']}/user-green.gif' onmouseover=\"javascript:ShowImage(" . attr_js($GLOBALS['webroot']."/controller.php?document&retrieve&patient_id=".$patientid."&document_id=-1&as_file=false&original_file=true&disable_exit=false&show_original=true&context=patient_picture") . ");\" onmouseout=\"javascript:HideImage();\" border='0' title='" . attr($link_title) . "' alt='View Patient' />";
557 if ($catid == 1) $content .= "<s>";
558 $content .= text($lname);
559 if ($GLOBALS['calendar_appt_style'] != 1) {
560 $content .= "," . text($fname);
561 if ($event['title'] && $GLOBALS['calendar_appt_style'] >= 3) {
562 $content .= "(" . text($event['title']);
563 if ($event['hometext'] && $GLOBALS['calendar_appt_style'] >= 4)
564 $content .= ": <span class='text-success'>" . text(trim($event['hometext'])) . "</span>";
565 $content .= ")";
568 if ($catid == 1) $content .= "</s>";
569 $content .= "</a>";
571 elseif($groupid){
572 $divTitle .= "\n" . getTypeName($grouptype) . "\n";
573 $link_title = '';
574 $link_title .= $divTitle ."\n";
575 $link_title .= "(" . xl('Click to view') . ")";
576 $content .= "<a href='javascript:goGid(" . attr_js($groupid) . ")' title='" . attr($link_title) . "'>";
577 $content .= "<img src='{$this->_tpl_vars['TPL_IMAGE_PATH']}/user-blue.gif' border='0' title='" . attr($link_title) . "' alt='View Patient' />";
578 if ($catid == 1) $content .= "<s>";
579 $content .= text($groupname);
580 if ($GLOBALS['calendar_appt_style'] != 1) {
581 if ($event['title'] && $GLOBALS['calendar_appt_style'] >= 3) {
582 $content .= "(" . text($event['title']);
583 if ($event['hometext'] && $GLOBALS['calendar_appt_style'] >= 4)
584 $content .= ": <span class='text-success'>" . text(trim($event['hometext'])) . "</span>";
585 $content .= ")";
588 if ($catid == 1) $content .= "</s>";
589 $content .= "</a>";
591 //Add class to wrapping div so EditEvent js function can differentiate between click on group and patient
592 $evtClass .= ' groups ';
596 else {
597 //Category Clinic closaed or holiday take the event title
598 if ( $catid == 6 || $catid == 7){
599 $content = xlt($event['title']);
600 }else{
601 // no patient id, just output the category name
602 $content .= text(xl_appt_category($catname));
606 if ( $catid != 6){
607 $divTitle .= "\n(" . xl('double click to edit') . ")";
609 if($_SESSION['pc_facility'] == 0){
610 echo "<div data-eid='" . attr($eventid) . "' class='" . attr($evtClass) . " month_event' style='background-color:" . $color. "' title='" . attr($divTitle) . "'" . " id='" . attr($eventdate) . "-" . attr($eventid) . "-" . attr($pccattype) . "'" . ">";
611 echo $content;
612 echo "</div>\n";
614 elseif($_SESSION['pc_facility'] == $row['id']){
615 echo "<div data-eid='" . attr($eventid) . "' class='" . attr($evtClass) . " month_event' style='background-color:".$event["catcolor"].
616 "' title='" . attr($divTitle) . "'".
617 " id='" . attr($eventdate) . "-" . attr($eventid) . "-" . attr($pccattype) . "'".
618 ">";
619 echo $content;
620 echo "</div>\n";
622 else{
623 echo "<div data-eid='" . attr($eventid) . "' class='" . attr($evtClass) . " month_event' style='background-color: var(--gray300)' title='" . attr($divTitle) . "'" . " id='" . attr($eventdate) . "-" . attr($eventid) . "-" . attr($pccattype) . "'>";
624 echo "<span class='text-center text-danger'>" . text($displayTime) . " " . text($row['name'])."</span>";
625 echo "</div>\n";
627 } // end EVENT loop
628 //=======================================================================================
629 //=======================================================================================
630 echo "</div>";
631 echo "</td>";
632 if (date("w", strtotime($date)) == $DOWlist[6]) { echo "</tr>"; }
633 } // end date
635 echo "</table>\n";
636 echo "</div>";
637 } // end provider
639 [-/php-]
640 </div> <!-- end bigCal DIV -->
641 </div> <!-- end bottom DIV -->
642 </div>
643 </form>
644 </div>
646 <script>
648 $(function () {
649 $("#pc_username").change(function() {
650 ChangeProviders(this);
652 $("#pc_facility").change(function() {
653 ChangeProviders(this);
655 $("#dayview").click(function() {
656 ChangeView(this);
658 $("#weekview").click(function() {
659 ChangeView(this);
661 //$("#monthview").click(function() { ChangeView(this); });
662 //$("#yearview").click(function() { ChangeView(this); });
663 $(".tdDatePicker").click(function() {
664 ChangeDate(this);
666 $("#datePicker .tdNav").mouseover(function() {
667 $(this).toggleClass("tdDatePickerHighlight");
669 $("#datePicker .tdNav").mouseout(function() {
670 $(this).toggleClass("tdDatePickerHighlight");
672 $("#printview").click(function() {
673 PrintView(this);
675 $(".month_event").dblclick(function() {
676 EditEvent(this);
678 $(".month_event").mouseover(function() {
679 $(this).toggleClass("event_highlight");
681 $(".month_event").mouseout(function() {
682 $(this).toggleClass("event_highlight");
685 $(".tdMonthName-small").click(function() {
686 dpCal = $("#datePicker > table");
687 mp = $("#monthPicker");
688 mp.width(dpCal.width());
689 mp.toggle();
694 /* edit an existing event */
695 var EditEvent = function(eObj) {
696 // if have hiddenevent class do nothing
697 if (eObj.classList.contains('hiddenevent'))
698 return true;
699 //alert ('editing '+eObj.id);
700 // split the object ID into date and event ID
701 objID = eObj.id;
702 var parts = new Array();
703 parts = objID.split("-");
704 editing_group = $(eObj).hasClass("groups");
705 if(editing_group){
706 oldGroupEvt(parts[0], parts[1], parts[2]);
707 return true;
709 // call the oldEvt function to bring up the event editor
710 oldEvt(parts[0], parts[1], parts[2]);
711 return true;
714 /* pop up a window to print the current view
716 var PrintView = function (eventObject) {
717 printURL = "[-php-]echo pnModURL(__POSTCALENDAR__,'user','view',
718 array('tplview'=>($template_view ?? ''),
719 'viewtype'=>$viewtype,
720 'Date'=> $Date,
721 'print'=> 1,
722 'pc_username'=>($pc_username ?? ''),
723 'pc_category'=>($category ?? ''),
724 'pc_topic'=>($topicv ?? '')));[-/php-]";
725 window.open(printURL,'printwindow','width=740,height=480,toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,copyhistory=no,resizable=yes');
726 return false;
729 /* change the current date based upon what the user clicked in
730 * the datepicker DIV
732 var ChangeDate = function(eObj) {
733 baseURL = "[-php-]echo pnModURL(__POSTCALENDAR__,'user','view',
734 array('tplview'=>($template_view ?? ''),
735 'viewtype'=>$viewtype,
736 'Date'=> '~REPLACEME~',
737 'pc_username'=>($pc_username ?? ''),
738 'pc_category'=>($category ?? ''),
739 'pc_topic'=>($topic ?? '')));[-/php-]";
740 newURL = baseURL.replace(/~REPLACEME~/, eObj.id);
741 document.location.href=newURL;
744 /* change the provider(s)
746 var ChangeProviders = function (eventObject) {
747 $('#theform').submit();
750 /* change the calendar view
752 var ChangeView = function (eventObject) {
753 if (eventObject.id == "dayview") {
754 $("#viewtype").val('day');
756 else if (eventObject.id == "weekview") {
757 $("#viewtype").val('week');
759 else if (eventObject.id == "monthview") {
760 $("#viewtype").val('month');
762 else if (eventObject.id == "yearview") {
763 $("#viewtype").val('year');
765 $('#theform').submit();
768 $("#menu-toggle").click(function(e) {
769 e.preventDefault();
770 $("#wrapper").toggleClass("toggled");
772 </script>
774 </body>
775 </html>