2 [-*****************************************************************************-]
3 [-* Copyright (C)
2005-
2006 Rod Roark
<rod@sunsetsystems.com
> and others *-]
4 [-* Copyright (C)
2019 Jerry Padgett
<sjpadgett@gmail.com
> *-]
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*-]
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";
26 // This is called from the event editor popup.
27 function refreshme() {
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
){
45 dlgopen('add_edit_event.php?group=true&date=' + encodeURIComponent(eventdate
) + '&eid=' + encodeURIComponent(eventid
) + '&prov=' + encodeURIComponent(pccattype
), '_blank', 780, 675);
51 echo
" top.RTop.location = '../../patient_file/summary/demographics.php' " .
52 "+ '?set_pid=' + encodeURIComponent(pid);\n";
59 echo
" top.RTop.location = '" . $GLOBALS
['rootdir'] . "/therapy_groups/index.php' " .
60 "+ '?method=groupDetails&group_id=' + encodeURIComponent(gid);\n ";
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();
72 function ShowImage(src
)
74 var img
= document
.getElementById('popupImage');
75 var div
= document
.getElementById('popup');
77 div
.style
.display
= "block";
81 document
.getElementById('popup').style
.display
= "none";
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
93 $tmpDOW = pnModGetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek');
94 // bound check and auto-correction
95 if ($tmpDOW
<0 || $tmpDOW
>6) {
96 pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', '
0');
99 while (count($DOWlist) <
7) {
100 array_push($DOWlist, $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']);
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';
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 -->
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-]" />
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')) {
163 <a href='#' name='bnsubmit' value='[-xla
t=
"Today"-]' onClick='GoToToday(theform);' class='btn btn-primary'
>[-xlt t='Today'-]
</a>
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";
177 <div id=
"viewPicker">
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";
186 </div> <!-- end topToolbarRight -->
188 <div class=
"sticky-top">
189 <div id=
"bottomLeft" class=
"sidebar-wrapper">
190 <div id=
"datePicker">
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');
200 <div class=
"table-responsive">
201 <table class='table table-sm table-borderless'
>
205 // compute the previous month date
206 // stay on the same day if possible
208 $pMonth = $cMonth -
1;
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
217 $nMonth = $cMonth +
1;
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);
223 <td class=
"tdDOW-small tdDatePicker tdNav" id=
"[-php-]echo attr($prevMonth)[-/php-]" title=
"[-php-]echo xla(date("F
", strtotime($prevMonth)));[-/php-]"><</td>
224 <td colspan=
"5" class=
"tdMonthName-small">
226 echo xl(date('F', $caldate));
229 <td class=
"tdDOW-small tdDatePicker tdNav" id=
"[-php-]echo attr($nextMonth)[-/php-]" title=
"[-php-]echo xla(date("F
", strtotime($nextMonth)));[-/php-]">></td>
232 foreach ($DOWlist as $dow) {
233 echo
"<td class='tdDOW-small'>" . text($this-
>_tpl_vars['A_SHORT_DAY_NAMES'][$dow]) .
"</td>";
238 $atmp = array_keys($A_EVENTS);
240 foreach ($atmp as $currdate) {
241 $currdate = strtotime($currdate);
242 if (date('w', $currdate) == $DOWlist[
0]) {
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";
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";
279 if (date('w', $currdate) == $DOWlist[
6]) echo
"</tr>\n";
286 <div id=
"bigCalHeader">
289 <div id=
"providerPicker">
290 [-php-] echo xlt('Providers'); [-/php-]
293 // ==============================
294 // FACILITY FILTERING (lemonsoftware)
295 // $facilities = getFacilities();
296 if (!empty($_SESSION['authorizeduser']) && ($_SESSION['authorizeduser'] ==
1)) {
297 $facilities = getFacilities();
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";
316 // ==============================
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";
332 if($_SESSION['pc_facility'] ==
0){
334 <ul class=
"list-group list-group-flush" id=
"facilityColor">
336 foreach ($facilities as $f){
337 echo
"<li class='list-group-item' style='border-left: 35px solid ".$f['color'].
";'>" . text($f['name']).
"</li>";
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=
"" />
352 </div><!-- end bottomLeft -->
355 <div class=
"page-content-wrapper">
356 <div class=
"container-fluid calsearch_body">
360 foreach ($A_EVENTS as $date =
> $events) {
362 foreach ($events as $oneE) {
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";
379 echo
" <td colspan='7' class='providerheader'>";
380 echo text($provider['fname']) .
" " . text($provider['lname']);
384 // output date headers
386 $defaultDate =
""; // used when creating link for a 'new' event
387 $in_cat_id =
0; // used when creating link for a 'new' event
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)));
394 if ($dowCount++ ==
6) { break; }
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),
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
" "; }
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";
457 $evtClass =
"event_in";
459 case
3: // OUT of office
460 $evtClass =
"event_out";
463 $evtClass =
"event_reserved";
466 $evtClass =
"event_holiday hiddenevent";
469 $evtClass =
"event_reserved";
472 $evtClass =
"event_reserved";
474 default: // some appointment
475 $evtClass =
"event_appointment";
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]);
486 if($eventtype['pc_cattype']==
1)
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));
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'];
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");
536 if ($comment) $atitle .=
" $comment";
537 $divTitle .=
"\n[".$atitle .
"]";
538 $content .= text($displayTime);
539 $content .=
" " . text($catname);
542 // some sort of patient appointment
544 $divTitle .=
"\n" . xl('Counselors') .
": \n" . $groupcounselors .
" \n";
545 $divTitle .=
"\r\n[" . $catname . ' ' . $comment .
"]" . $groupname;
548 $divTitle .=
"\r\n[" . $catname . ' ' . $comment .
"]" . $fname .
" " . $lname;
549 $content .= create_event_time_anchor($displayTime);
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>";
568 if ($catid ==
1) $content .=
"</s>";
572 $divTitle .=
"\n" . getTypeName($grouptype) .
"\n";
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>";
588 if ($catid ==
1) $content .=
"</s>";
591 //Add class to wrapping div so EditEvent js function can differentiate between click on group and patient
592 $evtClass .= ' groups ';
597 //Category Clinic closaed or holiday take the event title
598 if ( $catid ==
6 || $catid ==
7){
599 $content = xlt($event['title']);
601 // no patient id, just output the category name
602 $content .= text(xl_appt_category($catname));
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) .
"'" .
">";
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) .
"'".
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>";
628 //=======================================================================================
629 //=======================================================================================
632 if (date(
"w", strtotime($date)) == $DOWlist[
6]) { echo
"</tr>"; }
640 </div> <!-- end bigCal DIV -->
641 </div> <!-- end bottom DIV -->
649 $("#pc_username").change(function() {
650 ChangeProviders(this);
652 $("#pc_facility").change(function() {
653 ChangeProviders(this);
655 $("#dayview").click(function() {
658 $("#weekview").click(function() {
661 //$("#monthview").click(function() { ChangeView(this); });
662 //$("#yearview").click(function() { ChangeView(this); });
663 $(".tdDatePicker").click(function() {
666 $("#datePicker .tdNav").mouseover(function() {
667 $(this).toggleClass("tdDatePickerHighlight");
669 $("#datePicker .tdNav").mouseout(function() {
670 $(this).toggleClass("tdDatePickerHighlight");
672 $("#printview").click(function() {
675 $(".month_event").dblclick(function() {
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());
694 /* edit an existing event */
695 var EditEvent = function(eObj
) {
696 // if have hiddenevent class do nothing
697 if (eObj
.classList
.contains('hiddenevent'))
699 //alert ('editing '+eObj.id);
700 // split the object ID into date and event ID
702 var parts
= new Array();
703 parts
= objID
.split("-");
704 editing_group
= $(eObj
).hasClass("groups");
706 oldGroupEvt(parts
[0], parts
[1], parts
[2]);
709 // call the oldEvt function to bring up the event editor
710 oldEvt(parts
[0], parts
[1], parts
[2]);
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,
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');
729 /* change the current date based upon what the user clicked in
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
) {
770 $("#wrapper").toggleClass("toggled");