2 [-*****************************************************************************-]
3 [-* Copyright (C)
2005-
2006 Rod Roark
<rod@sunsetsystems.com
> and others *-]
5 [-* This program is free software; you can redistribute it and/or *-]
6 [-* modify it under the terms of the GNU General Public License *-]
7 [-* as published by the Free Software Foundation; either version
2 *-]
8 [-* of the License, or (at your option) any later version. *-]
9 [-*****************************************************************************-]
10 [-config_load
file=
"default.conf"-]
11 [-*Load the Language Definitions*-]
12 [-config_load
file=
"lang.$USER_LANG"-]
13 [-include
file=
"$TPL_NAME/views/header.html"-]
15 [-*Values used in setting timeslot and event heights*-]
17 /* if you change these be sure to change their matching values in
18 * the CSS for the calendar, found in interface/themes/ajax_calendar.css
20 $timeslotHeightVal=
20;
21 $
timeslotHeightUnit=
"px";
24 <script language='JavaScript'
>
26 var mypcc
= '[-php-] echo $GLOBALS['phone_country_code
'] [-/php-]';
28 // This is called from the event editor popup.
29 function refreshme() {
31 document
.forms
[0].submit();
34 function newEvt(startampm
, starttimeh
, starttimem
, eventdate
, providerid
, catid
) {
35 dlgopen('add_edit_event.php?startampm=' + startampm
+
36 '&starttimeh=' + starttimeh
+ '&starttimem=' + starttimem
+
37 '&date=' + eventdate
+ '&userid=' + providerid
+ '&catid=' + catid
,
41 function oldEvt(eventdate
, eventid
) {
42 dlgopen('add_edit_event.php?date='+eventdate
+'&eid=' + eventid
, '_blank', 550, 310);
48 if ($GLOBALS
['concurrent_layout'])
51 echo
" top.RTop.location = '../../patient_file/summary/demographics.php' " .
52 "+ '?set_pid=' + pid;\n";
56 echo
" top.location = '../../patient_file/patient_file.php' " .
57 "+ '?set_pid=' + pid + '&pid=' + pid;\n";
62 function GoToToday(theForm
){
63 var todays_date
= new Date();
64 var theMonth
= todays_date
.getMonth() + 1;
65 theMonth
= theMonth
< 10 ? "0" + theMonth
: theMonth
;
66 theForm
.jumpdate
.value
= todays_date
.getFullYear() + "-" + theMonth
+ "-" + todays_date
.getDate();
75 // this is my proposed setting in the globals config file so we don't
76 // need to mess with altering the pn database AND the config file
77 //pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', $GLOBALS['schedule_dow_start']);
79 // build a day-of-week (DOW) list so we may properly build the calendars later in this code
81 $tmpDOW = pnModGetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek');
82 // bound check and auto-correction
83 if ($tmpDOW
<0 || $tmpDOW
>6) {
84 pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', '
0');
87 while (count($DOWlist) <
7) {
88 array_push($DOWlist, $tmpDOW);
90 if ($tmpDOW
> 6) $tmpDOW =
0;
93 // A_CATEGORY is an ordered array of associative-array categories.
94 // Keys of interest are: id, name, color, desc, event_duration.
96 // echo
"<!-- A_CATEGORY = "; print_r($this-
>_tpl_vars['A_CATEGORY']); echo
" -->\n"; // debugging
97 // echo
"<!-- A_EVENTS = "; print_r($this-
>_tpl_vars['A_EVENTS']); echo
" -->\n"; // debugging
99 $A_CATEGORY =& $this-
>_tpl_vars['A_CATEGORY'];
101 // [-if $PRINT_VIEW !=
1-]
102 // [-*Main Navigation*-]
103 // [-include
file=
"$TPL_NAME/views/global/navigation.html"-]
106 $A_EVENTS =& $this-
>_tpl_vars['A_EVENTS'];
107 // $S_EVENTS =& $this-
>_tpl_vars['S_EVENTS']; // Deleted by Rod
108 $providers =& $this-
>_tpl_vars['providers'];
109 $times =& $this-
>_tpl_vars['times'];
110 $interval = $this-
>_tpl_vars['interval'];
111 $viewtype = $this-
>_tpl_vars['VIEW_TYPE'];
112 $PREV_WEEK_URL = $this-
>_tpl_vars['PREV_WEEK_URL'];
113 $NEXT_WEEK_URL = $this-
>_tpl_vars['NEXT_WEEK_URL'];
114 $PREV_DAY_URL = $this-
>_tpl_vars['PREV_DAY_URL'];
115 $NEXT_DAY_URL = $this-
>_tpl_vars['NEXT_DAY_URL'];
117 $Date = postcalendar_getDate();
118 if (!isset($y)) $y = substr($Date,
0,
4);
119 if (!isset($m)) $m = substr($Date,
4,
2);
120 if (!isset($d)) $d = substr($Date,
6,
2);
122 // echo
"<!-- There are " . count($A_EVENTS) .
" A_EVENTS days -->\n";
124 $MULTIDAY = count($A_EVENTS)
> 1;
126 //==================================
127 //FACILITY FILTERING (CHEMED)
128 $facilities = getUserFacilities($_SESSION['authId']); // from users_facility
129 if (count($facilities) ==
1 || !$_SESSION['pc_facility']) {
130 $_SESSION['pc_facility'] = $facilities[
0]['id'];
132 if ( $_SESSION['pc_facility'] ) {
133 $provinfo = getProviderInfo('%', true, $_SESSION['pc_facility']);
135 $provinfo = getProviderInfo();
137 //EOS FACILITY FILTERING (CHEMED)
138 //==================================
143 <!-- stuff form element here to avoid the margin padding it introduces into the page in some browsers -->
144 <form name='theform' id='theform' action='index.php?module=PostCalendar&func=view&tplview=default&pc_category=&pc_topic=' method='post' onsubmit='return top.restoreSession()'
>
145 <input type=
"hidden" name=
"jumpdate" id=
"jumpdate" value=
"">
146 <input type=
"hidden" name=
"viewtype" id=
"viewtype" value=
"[-php-]echo $viewtype;[-/php-]">
148 echo
" <input type='button' value='" .xl (
"Add").
"' onclick='newEvt(1, 9, 00, $Date, 0, 0)' />\n";
149 echo
" <input type='button' value='" . xl (
"Search") .
150 "' onclick='top.restoreSession();location=\"index.php?module=PostCalendar&func=search\
"' />\n";
154 <div id=
"topToolbarRight"> <!-- this wraps some of the top toolbar items -->
157 <a href='[-php-]echo $PREV_DAY_URL[-/php-]' onclick='top.restoreSession()'
>
158 <img id=
"prevday" src=
"[-$TPL_IMAGE_PATH-]/leftbtn.gif" border=
"0" title=
"[-php-]echo xl("Previous Day
")[-/php-]" alt=
"[-php-]echo xl ("Previous Day
")[-/php-]" /></a>
159 <a href='[-php-]echo $NEXT_DAY_URL[-/php-]' onclick='top.restoreSession()'
>
160 <img id=
"nextday" src=
"[-$TPL_IMAGE_PATH-]/rightbtn.gif" border=
"0" title=
"[-php-]echo xl("Next Day
")[-/php-]" alt=
"[-php-]echo xl ("Next Day
")[-/php-]" /></a>
162 <input type='submit' name='bnsubmit' value='[-php-]echo xl (
"Today")[-/php-]' onClick='GoToToday(theform);'
/>
165 <div id=
"viewPicker">
166 <img id=
"printview" src=
"[-$TPL_IMAGE_PATH-]/print.gif" border=
"0" title=
"[-php-]echo xl("Print View
")[-/php-]" alt=
"[-php-]echo xl ("Print View
")[-/php-]" />
168 <img id=
"dayview" class=
"currentview" src=
"[-$TPL_IMAGE_PATH-]/day.gif" border=
"0" title=
"[-php-]echo xl("Day View
")[-/php-]" alt=
"[-php-]echo xl ("Day View
")[-/php-]" />
170 <img id=
"weekview" src=
"[-$TPL_IMAGE_PATH-]/week.gif" border=
"0" title=
"[-php-]echo xl ("Week View
")[-/php-]" alt=
"[-php-]echo xl ("Week View
")[-/php-]" />
172 <img id=
"monthview" src=
"[-$TPL_IMAGE_PATH-]/month.gif" border=
"0" title=
"[-php-]echo xl ("Month View
")[-/php-]" alt=
"[-php-]echo xl ("Month View
")[-/php-]" />
174 </div> <!-- end topToolbarRight -->
176 <div id=
"datePicker">
178 <table border=
"0" cellpadding=
"0" cellspacing=
"0">
181 $atmp = array_keys($A_EVENTS);
182 $caldate = strtotime($atmp[
0]);
183 $cMonth = date(
"m", $caldate);
184 $cYear = date(
"Y", $caldate);
185 $cDay = date(
"d", $caldate);
187 // compute the previous month date
188 // stay on the same day if possible
190 $pMonth = $cMonth -
1;
192 if ($pMonth <
1) { $pMonth =
12; $pYear = $cYear -
1; }
193 while (! checkdate($pMonth, $pDay, $pYear)) { $pDay = $pDay -
1; }
194 $prevMonth = sprintf(
"%d%02d%02d",$pYear,$pMonth,$pDay);
196 // compute the next month
197 // stay on the same day if possible
199 $nMonth = $cMonth +
1;
201 if ($nMonth
> 12) { $nMonth =
1; $nYear = $cYear +
1; }
202 while (! checkdate($nMonth, $nDay, $nYear)) { $nDay = $nDay -
1; }
203 $nextMonth = sprintf(
"%d%02d%02d",$nYear,$nMonth,$nDay);
205 <td class=
"tdDOW-small tdDatePicker" id=
"[-php-]echo $prevMonth[-/php-]" title=
"[-php-]echo xl(date("F
", strtotime($prevMonth)));[-/php-]"><</td>
206 <td colspan=
"5" class=
"tdMonthName-small">
208 echo xl(date('F', $caldate));
211 <td class=
"tdDOW-small tdDatePicker" id=
"[-php-]echo $nextMonth[-/php-]" title=
"[-php-]echo xl(date("F
", strtotime($nextMonth)));[-/php-]">></td>
214 foreach ($DOWlist as $dow) {
215 echo
"<td class='tdDOW-small'>".$this-
>_tpl_vars['A_SHORT_DAY_NAMES'][$dow].
"</td>";
220 $atmp = array_keys($A_EVENTS);
221 $caldate = strtotime($atmp[
0]);
222 $caldateEnd = strtotime($atmp[
6]);
224 // to make a complete week row we need to compute the real
225 // start and end dates for the view
226 list ($year, $month, $day) = explode(
" ", date('Y m d', $caldate));
227 $startdate = strtotime($year.$month.
"01");
228 $enddate = strtotime($year.$month.date(
"t", $startdate).
" 23:59");
229 while (date('w', $startdate) != $DOWlist[
0]) { $startdate -=
60*
60*
24; }
230 while (date('w', $enddate) != $DOWlist[
6]) { $enddate +=
60*
60*
24; }
232 $currdate = $startdate;
233 while ($currdate <= $enddate) {
234 if (date('w', $currdate) == $DOWlist[
0]) {
241 $tdClass =
"tdMonthDay-small";
242 if (date('m', $currdate) != $month) {
243 $tdClass =
"tdOtherMonthDay-small";
245 if ((date('w', $currdate) ==
0) || (date('w', $currdate) ==
6)) {
246 $tdClass =
"tdWeekend-small";
249 if (date('Ymd',$currdate) == $Date) {
250 // $Date is defined near the top of this file
251 // and is equal to whatever date the user has clicked
252 $tdClass .=
" currentDate";
255 // add a class so that jQuery can grab these days for the 'click' event
256 $tdClass .=
" tdDatePicker";
260 $td .=
"class=\"".$tdClass."\
" ";
261 //$td .=
"id=\"".date("Ymd
", $currdate)."\
" ";
262 $td .=
"id=\"".date("Ymd
", $currdate)."\
" ";
263 $td .=
"title=\"" . xl('Go to') . " ".date('M d, Y', $currdate)."\
" ";
264 $td .=
"> ".date('d', $currdate).
"</td>\n";
268 if (date('w', $currdate) == $DOWlist[
6]) echo
"</tr>\n";
270 // time correction = plus
1000 seconds, for some unknown reason
271 $currdate += (
60*
60*
24)+
1000;
277 <div id=
"bigCalHeader">
279 $atmp = array_keys($A_EVENTS);
280 echo date('d M Y', strtotime($atmp[
0]));
284 <div id=
"providerPicker">
285 [-php-] xl('Providers','e'); [-/php-]
288 // ==============================
289 // FACILITY FILTERING (lemonsoftware)
290 /*********************************************************************
291 $facilities = getFacilities();
292 *********************************************************************/
293 if ($_SESSION['authorizeduser'] ==
1) {
294 $facilities = getFacilities();
296 $facilities = getUserFacilities($_SESSION['authId']); // from users_facility
297 if (count($facilities) ==
1)
298 $_SESSION['pc_facility'] = key($facilities);
300 /********************************************************************/
301 if (count($facilities)
> 1) {
302 echo
" <select name='pc_facility' id='pc_facility'>\n";
303 if ( !$_SESSION['pc_facility'] ) $selected =
"selected='selected'";
304 // echo
" <option value='0' $selected>" .xl('All Facilities').
"</option>\n";
305 if (!$GLOBALS['restrict_user_facility']) echo
" <option value='0' $selected>" . xl('All Facilities') .
"</option>\n";
306 foreach ($facilities as $fa) {
307 $selected = ( $_SESSION['pc_facility'] == $fa['id']) ?
"selected='selected'" :
"" ;
308 echo
" <option value='" .$fa['id'].
"' $selected>" .$fa['name'].
"</option>\n";
313 // ==============================
315 echo
" <select multiple size='5' name='pc_username[]' id='pc_username'>\n";
316 echo
" <option value='__PC_ALL__'>" .xl (
"All Users").
"</option>\n";
317 foreach ($provinfo as $doc) {
318 $username = $doc['username'];
319 echo
" <option value='$username'";
320 foreach ($providers as $provider)
321 if ($provider['username'] == $username) echo
" selected";
322 echo
">" . $doc['lname'] .
", " . $doc['fname'] .
"</option>\n";
331 [-assign
var=
"dayname" value=$DATE|date_format:
"%w"-]
332 [-assign
var=
"day" value=$DATE|date_format:
"%d"|string_format:
"%1d"-]
333 [-assign
var=
"month" value=$DATE|date_format:
"%m"|string_format:
"%1d"-]
334 [-assign
var=
"year" value=$DATE|date_format:
"%Y"|string_format:
"%4d"-]
336 [-pc_sort_events
var=
"S_EVENTS" sort=
"time" order=
"asc" value=$A_EVENTS-]
341 echo
"<table border='0' cellpadding='1' cellspacing='0' width='100%'>\n";
343 // output the TD with the times DIV
345 echo
"<td id='times'><div><table>\n";
346 echo
"<td class='timeslot'> </td>";
347 foreach ($times as $slottime) {
348 $startampm = ($slottime['mer']) ==
"pm" ?
2 :
1;
349 $starttimeh = $slottime['hour'];
350 $disptimeh = ($starttimeh
> 12) ? ($starttimeh -
12) : $starttimeh;
351 $starttimem = $slottime['minute'];
352 $slotendmins = $starttimeh *
60 + $starttimem + $interval;
354 // default to the first displayed provider
355 $providerid = $providers[
0]['id'];
357 echo
"<tr><td class='timeslot'>";
358 echo
"<a href='javascript:newEvt($startampm,$starttimeh,$starttimem,$Date,$providerid,0)' title='" . xl('New Appointment') .
"' alt='New Appointment'>";
359 echo
"$disptimeh:$starttimem";
363 echo
"</table></div></td>";
366 // This loops once for each provider to be displayed.
368 foreach ($providers as $provider) {
369 $providerid = $provider['id'];
371 // to specially handle the IN/OUT events I'm doing something new here
372 // for each IN event it will have a duration lasting until the next
373 // OUT event or until the end of the day
374 $tmpTime = $times[
0];
375 $calStartMin = ($tmpTime['hour'] *
60) + $tmpTime['minute'];
376 $tmpTime = $times[count($times)-
1];
377 $calEndMin = ($tmpTime['hour'] *
60) + $tmpTime['minute'];
379 // having a 'title' for the TD makes the date appear by the mouse pointer
380 // this is nice when all you see are times on the left side and no head
381 // row with the dates or day-of-week (DOW)
382 echo
"<td class='schedule' title='".$provider['fname'].
" ".$provider['lname'].
"'>";
383 echo
"<div class='providerheader'>";
384 echo $provider['fname'].
" ".$provider['lname'].
"</div>";
385 echo
"<div class='calendar_day'>";
388 // output a TD with an inner containing DIV positioned 'relative'
389 // within that DIV we place our event DIVs using 'absolute' positioning
390 foreach ($A_EVENTS as $date =
> $events) {
391 $eventdate = substr($date,
0,
4) . substr($date,
5,
2) . substr($date,
8,
2);
393 // determine if events overlap and adjust their width and left position as needed
394 //
26 Feb
2008 - This needs fine tuning or total replacement
395 // - it doesn't work as well as I'd like - JRM
396 $eventPositions = array();
397 foreach ($times as $slottime) {
398 $starttimeh = $slottime['hour'];
399 $starttimem = $slottime['minute'];
401 $slotstartmins = $starttimeh *
60 + $starttimem;
402 $slotendmins = $starttimeh *
60 + $starttimem + $interval;
404 $events_in_timeslot = array();
405 foreach ($events as $e1) {
406 // ignore IN and OUT events
407 if (($e1['catid'] ==
2) || ($e1['catid'] ==
3)) { continue; }
408 // skip events without an ID (why they are in the loop, I have no idea)
409 if ($e1['eid'] ==
"") { continue; }
410 // skip events for other providers
411 if ($providerid != $e1['aid']) { continue; }
413 // specially handle all-day events
414 if ($e1['alldayevent'] ==
1) {
415 $tmpTime = $times[
0];
416 if (strlen($tmpTime['hour']) <
2) { $tmpTime['hour'] =
"0".$tmpTime['hour']; }
417 if (strlen($tmpTime['minute']) <
2) { $tmpTime['minute'] =
"0".$tmpTime['minute']; }
418 $e1['startTime'] = $tmpTime['hour'].
":".$tmpTime['minute'].
":00";
419 $e1['duration'] = ($calEndMin - $calStartMin) *
60; // measured in seconds
422 // create a numeric start and end for comparison
423 $starth = substr($e1['startTime'],
0,
2);
424 $startm = substr($e1['startTime'],
3,
2);
425 $e1Start = ($starth *
60) + $startm;
426 $e1End = $e1Start + $e1['duration']/
60;
428 // three ways to overlap:
429 // start-in, end-in, span
430 if ((($e1Start
>= $slotstartmins) && ($e1Start < $slotendmins)) // start-in
431 || (($e1End
> $slotstartmins) && ($e1End <= $slotendmins)) // end-in
432 || (($e1Start < $slotstartmins) && ($e1End
> $slotendmins))) // span
434 array_push($events_in_timeslot, $e1['eid']);
438 $width =
100 / count($events_in_timeslot);
440 // loop over the events in this timeslot and adjust their width
441 foreach ($events_in_timeslot as $eid) {
442 // set the width if not already set or if the current width is smaller
443 // than was was previously set
444 if (! isset($eventPositions[$eid]-
>width)) { $eventPositions[$eid]-
>width = $width; }
445 else if ($eventPositions[$eid]-
>width
> $width) { $eventPositions[$eid]-
>width = $width; }
447 // set the left position if not already set or if the current left is
448 // greater than what was previously set
449 if (! isset($eventPositions[$eid]-
>leftpos)) { $eventPositions[$eid]-
>leftpos = $leftpos; }
450 else if ($eventPositions[$eid]-
>leftpos < $leftpos) { $eventPositions[$eid]-
>leftpos = $leftpos; }
452 // increment the leftpos by the width
455 } // end overlap detection
457 // now loop over the events for the day and output their DIVs
458 foreach ($events as $event) {
459 // skip events for other providers
460 // yeah, we've got that sort of overhead here... it ain't perfect
461 if ($providerid != $event['aid']) { continue; }
463 // skip events without an ID (why they are in the loop, I have no idea)
464 if ($event['eid'] ==
"") { continue; }
466 // specially handle all-day events
467 if ($event['alldayevent'] ==
1) {
468 $tmpTime = $times[
0];
469 if (strlen($tmpTime['hour']) <
2) { $tmpTime['hour'] =
"0".$tmpTime['hour']; }
470 if (strlen($tmpTime['minute']) <
2) { $tmpTime['minute'] =
"0".$tmpTime['minute']; }
471 $event['startTime'] = $tmpTime['hour'].
":".$tmpTime['minute'].
":00";
472 $event['duration'] = ($calEndMin - $calStartMin) *
60; // measured in seconds
475 // figure the start time and minutes (from midnight)
476 $starth = substr($event['startTime'],
0,
2);
477 $startm = substr($event['startTime'],
3,
2);
478 $eStartMin = $starth *
60 + $startm;
479 $dispstarth = ($starth
> 12) ? ($starth -
12) : $starth; // used to display the hour
481 // determine the class for the event DIV based on the event category
482 $evtClass =
"event_appointment";
483 switch ($event['catid']) {
484 case
1: // NO-SHOW appt
485 $evtClass =
"event_noshow";
488 $evtClass =
"event_in";
490 case
3: // OUT of office
491 $evtClass =
"event_out";
496 $evtClass =
"event_reserved";
498 default: // some appointment
499 $evtClass =
"event_appointment";
503 // if this is an IN or OUT event then we have some extra special
504 // processing to be done
505 // the IN event creates a DIV until the OUT event
506 // or, without an OUT DIV matching the IN event
507 // then the IN event runs until the end of the day
508 if ($event['catid'] ==
2) {
509 // locate a matching OUT for this specific IN
512 foreach ($events as $outevent) {
513 // skip events for other providers
514 if ($providerid != $outevent['aid']) { continue; }
515 // skip events with blank IDs
516 if ($outevent['eid'] ==
"") { continue; }
518 if ($outevent['eid'] == $event['eid']) { $found = true; continue; }
519 if (($found == true) && ($outevent['catid'] ==
3)) {
520 // calculate the duration from this event to the outevent
521 $outH = substr($outevent['startTime'],
0,
2);
522 $outM = substr($outevent['startTime'],
3,
2);
523 $outMins = ($outH *
60) + $outM;
524 $event['duration'] = ($outMins - $eStartMin) *
60; // duration is in seconds
530 // no OUT was found so this event's duration goes
531 // until the end of the day
532 $event['duration'] = ($calEndMin - $eStartMin) *
60; // duration is in seconds
536 // calculate the TOP value for the event DIV
537 // diff between event start and schedule start
538 $eMinDiff = $eStartMin - $calStartMin;
539 // diff divided by the time interval of the schedule
540 $eStartInterval = $eMinDiff / $interval;
541 // times the interval height
542 $eStartPos = $eStartInterval * $timeslotHeightVal;
543 $evtTop = $eStartPos.$timeslotHeightUnit;
545 // calculate the HEIGHT value for the event DIV
546 // diff between end and start of event
547 $eEndMin = $eStartMin + ($event['duration']/
60);
548 // prevent the overall height of the event from going beyond the bounds
550 if ($eEndMin
> $calEndMin) { $eEndMin = $calEndMin + $interval; }
551 $eMinDiff = $eEndMin - $eStartMin;
552 // diff divided by the time interval of the schedule
553 $eEndInterval = $eMinDiff / $interval;
554 // times the interval height
555 $eHeight = $eEndInterval * $timeslotHeightVal;
556 $evtHeight = $eHeight.$timeslotHeightUnit;
558 // determine the DIV width based on any overlapping events
559 // see further above for the overlapping calculation code
562 if (isset($eventPositions[$event['eid']])) {
563 $divWidth =
"width: ".$eventPositions[$event['eid']]-
>width.
"%";
564 $divLeft =
"left: ".$eventPositions[$event['eid']]-
>leftpos.
"%";
567 $eventid = $event['eid'];
568 $patientid = $event['pid'];
569 $commapos = strpos($event['patient_name'],
",");
570 $lname = substr($event['patient_name'],
0, $commapos);
571 $fname = substr($event['patient_name'], $commapos +
2);
572 $patient_dob = $event['patient_dob'];
573 $patient_age = $event['patient_age'];
574 $catid = $event['catid'];
575 $comment = addslashes($event['hometext']);
576 $catname = $event['catname'];
577 $title =
"Age $patient_age ($patient_dob)";
581 if ($comment && $GLOBALS['calendar_appt_style'] <
4) $title .=
" " . $comment;
583 // the divTitle is what appears when the user hovers the mouse over the DIV
584 $divTitle = $provider['fname'].
" ".$provider['lname'];
586 if ($catid ==
2 || $catid ==
3 || $catid ==
4 || $catid ==
8 || $catid ==
11) {
587 if ($catid ==
2) $catname = xl(
"IN");
588 else if ($catid ==
3) $catname = xl(
"OUT");
589 else if ($catid ==
4) $catname = xl(
"VACATION");
590 else if ($catid ==
8) $catname = xl(
"LUNCH");
591 else if ($catid ==
11) $catname = xl(
"RESERVED");
594 if ($comment) $atitle .=
" $comment";
595 $divTitle .=
"\n[".$atitle .
"]";
596 $content .= $catname;
597 if ($event['recurrtype'] ==
1) $content .=
"<img src='$TPL_IMAGE_PATH/repeating8.png' border='0' style='margin:0px 2px 0px 2px;' title='Repeating event' alt='Repeating event'>";
598 if ($comment) $content .=
" $comment";
601 // some sort of patient appointment
602 $divTitle .=
"\r\n[".$catname .
"] " . htmlspecialchars($fname, ENT_QUOTES) .
" " . htmlspecialchars($lname, ENT_QUOTES) .
603 " | " . xl(
"Comment") .
":" . htmlspecialchars($comments, ENT_QUOTES) .
" ";
604 $content .=
"<span class='appointment'>";
605 $content .= $dispstarth . ':' . $startm;
606 if ($event['recurrtype'] ==
1) $content .=
"<img src='$TPL_IMAGE_PATH/repeating8.png' border='0' style='margin:0px 2px 0px 2px;' title='Repeating event' alt='Repeating event'>";
607 // $content .= htmlspecialchars($event['apptstatus']);
608 $content .= '
'.htmlspecialchars($event['apptstatus']);
610 $link_title = xl('Age') .
": " . $patient_age .
" \n" . xl('DOB') .
": " . $patient_dob .
" \n";
611 if ($comment) $link_title .=
"$comment";
612 $link_title .=
"(" . xl('Click to view') .
")";
613 $content .=
"<a href='javascript:goPid($patientid)' title='$link_title'>";
614 $content .=
"<img src='$TPL_IMAGE_PATH/user-green.gif' border='0' title='$link_title' alt='View Patient' />";
615 if ($catid ==
1) $content .=
"<strike>";
616 $content .= htmlspecialchars($lname);
617 if ($GLOBALS['calendar_appt_style'] !=
1) {
618 $content .=
"," . htmlspecialchars($fname);
619 if ($event['title'] && $GLOBALS['calendar_appt_style']
>=
3) {
620 $content .=
"(" . $event['title'];
621 if ($event['hometext'] && $GLOBALS['calendar_appt_style']
>=
4)
622 $content .=
": <font color='green'>" . htmlspecialchars(trim($event['hometext'])) .
"</font>";
626 if ($catid ==
1) $content .=
"</strike>";
630 // no patient id, just output the category name
631 $content .= $catname;
633 $content .=
"</span>";
636 $divTitle .=
"\n(" . xl('double click to edit') .
")";
638 // a special case for the 'IN' event this puts the time ABOVE
639 // the normal DIV so it doesn't overlap another event DIV and include the time
640 if ($event['catid'] ==
2) {
641 $inTop = ($eStartPos - $timeslotHeightVal).$timeslotHeightUnit;
642 echo
"<div class='".$evtClass.
" event' style='top:".$inTop.
643 "; height:".$timeslotHeightVal.$timeslotHeightUnit.
646 "; background:transparent".
648 "' title='".$divTitle.
"'".
649 " id='".$eventdate.
"-".$eventid.
"'".
651 $content = $dispstarth . ':' . $startm .
" " . $content;
656 // output the DIV and content
657 echo
"<div class='".$evtClass.
" event' style='top:".$evtTop.
"; height:".$evtHeight.
658 "; background-color:".$event[
"catcolor"].
661 "' title='".$divTitle.
"'".
662 " id='".$eventdate.
"-".$eventid.
"'".
664 // second part for the special IN event
665 if ($event['catid'] !=
2) { echo $content; }
675 } // end provider loop
682 // [-include
file=
"$TPL_NAME/views/global/footer.html"-]
683 // [-include
file=
"$TPL_NAME/views/footer.html"-]
686 </div> <!-- end bigCal DIV -->
690 <script language='JavaScript'
>
692 $(document
).ready(function(){
693 $("#pc_username").change(function() { ChangeProviders(this); });
694 $("#pc_facility").change(function() { ChangeProviders(this); });
695 //$("#dayview").click(function() { ChangeView(this); });
696 $("#weekview").click(function() { ChangeView(this); });
697 $("#monthview").click(function() { ChangeView(this); });
698 //$("#yearview").click(function() { ChangeView(this); });
699 $(".tdDatePicker").click(function() { ChangeDate(this); });
700 $(".tdDatePicker").mouseover(function() { $(this).toggleClass("tdDatePickerHighlight"); });
701 $(".tdDatePicker").mouseout(function() { $(this).toggleClass("tdDatePickerHighlight"); });
702 $("#printview").click(function() { PrintView(this); });
703 $(".event").dblclick(function() { EditEvent(this); });
704 $(".event").mouseover(function() { $(this).toggleClass("event_highlight"); });
705 $(".event").mouseout(function() { $(this).toggleClass("event_highlight"); });
708 /* edit an existing event */
709 var EditEvent = function(eObj
) {
710 //alert ('editing '+eObj.id);
711 // split the object ID into date and event ID
713 var parts
= new Array();
714 parts
= objID
.split("-");
715 // call the oldEvt function to bring up the event editor
716 oldEvt(parts
[0], parts
[1]);
720 /* change the current date based upon what the user clicked in
723 var ChangeDate = function(eObj
) {
724 baseURL
= "[-php-]echo pnModURL(__POSTCALENDAR__,'user','view',
725 array('tplview'=>$template_view,
726 'viewtype'=>$viewtype,
727 'Date'=> '~REPLACEME~',
728 'pc_username'=>$pc_username,
729 'pc_category'=>$category,
730 'pc_topic'=>$topic));[-/php-]";
731 newURL
= baseURL
.replace(/~REPLACEME~/, eObj
.id
);
732 document
.location
.href
=newURL
;
735 /* pop up a window to print the current view
737 var PrintView = function (eventObject
) {
738 printURL
= "[-php-]echo pnModURL(__POSTCALENDAR__,'user','view',
739 array('tplview'=>$template_view,
740 'viewtype'=>$viewtype,
743 'pc_username'=>$pc_username,
744 'pc_category'=>$category,
745 'pc_topic'=>$topic));[-/php-]";
746 window
.open(printURL
,'printwindow','width=740,height=480,toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,copyhistory=no,resizable=yes');
750 /* change the provider(s)
752 var ChangeProviders = function (eventObject
) {
753 $('#theform').submit();
756 /* change the calendar view
758 var ChangeView = function (eventObject
) {
759 if (eventObject
.id
== "dayview") {
760 $("#viewtype").val('day');
762 else if (eventObject
.id
== "weekview") {
763 $("#viewtype").val('week');
765 else if (eventObject
.id
== "monthview") {
766 $("#viewtype").val('month');
768 else if (eventObject
.id
== "yearview") {
769 $("#viewtype").val('year');
771 $('#theform').submit();