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?eid=' + eventid
, '_blank', 550, 270);
48 if ($GLOBALS
['concurrent_layout']) {
49 echo
" top.RTop.location = '../../patient_file/summary/demographics.php' " .
50 "+ '?set_pid=' + pid;\n";
52 echo
" top.location = '../../patient_file/patient_file.php' " .
53 "+ '?set_pid=' + pid + '&pid=' + pid;\n";
58 function GoToToday(theForm
){
59 var todays_date
= new Date();
60 var theMonth
= todays_date
.getMonth() + 1;
61 theMonth
= theMonth
< 10 ? "0" + theMonth
: theMonth
;
62 theForm
.jumpdate
.value
= todays_date
.getFullYear() + "-" + theMonth
+ "-" + todays_date
.getDate();
71 // this is my proposed setting in the globals config file so we don't
72 // need to mess with altering the pn database AND the config file
73 //pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', $GLOBALS['schedule_dow_start']);
75 // build a day-of-week (DOW) list so we may properly build the calendars later in this code
77 $tmpDOW = pnModGetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek');
78 // bound check and auto-correction
79 if ($tmpDOW
<0 || $tmpDOW
>6) {
80 pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', '
0');
83 while (count($DOWlist) <
7) {
84 array_push($DOWlist, $tmpDOW);
86 if ($tmpDOW
> 6) $tmpDOW =
0;
89 // A_CATEGORY is an ordered array of associative-array categories.
90 // Keys of interest are: id, name, color, desc, event_duration.
92 // echo
"<!-- A_CATEGORY = "; print_r($this-
>_tpl_vars['A_CATEGORY']); echo
" -->\n"; // debugging
93 // echo
"<!-- A_EVENTS = "; print_r($this-
>_tpl_vars['A_EVENTS']); echo
" -->\n"; // debugging
95 $A_CATEGORY =& $this-
>_tpl_vars['A_CATEGORY'];
97 // [-if $PRINT_VIEW !=
1-]
98 // [-*Main Navigation*-]
99 // [-include
file=
"$TPL_NAME/views/global/navigation.html"-]
102 $A_EVENTS =& $this-
>_tpl_vars['A_EVENTS'];
103 // $S_EVENTS =& $this-
>_tpl_vars['S_EVENTS']; // Deleted by Rod
104 $providers =& $this-
>_tpl_vars['providers'];
105 $times =& $this-
>_tpl_vars['times'];
106 $interval = $this-
>_tpl_vars['interval'];
107 $viewtype = $this-
>_tpl_vars['VIEW_TYPE'];
108 $PREV_WEEK_URL = $this-
>_tpl_vars['PREV_WEEK_URL'];
109 $NEXT_WEEK_URL = $this-
>_tpl_vars['NEXT_WEEK_URL'];
110 $PREV_DAY_URL = $this-
>_tpl_vars['PREV_DAY_URL'];
111 $NEXT_DAY_URL = $this-
>_tpl_vars['NEXT_DAY_URL'];
113 $Date = postcalendar_getDate();
114 if (!isset($y)) $y = substr($Date,
0,
4);
115 if (!isset($m)) $m = substr($Date,
4,
2);
116 if (!isset($d)) $d = substr($Date,
6,
2);
118 // echo
"<!-- There are " . count($A_EVENTS) .
" A_EVENTS days -->\n";
120 $MULTIDAY = count($A_EVENTS)
> 1;
122 //==================================
123 //FACILITY FILTERING (CHEMED)
124 if ( $_SESSION['pc_facility'] ) {
125 $provinfo = getProviderInfo('%', true, $_SESSION['pc_facility']);
127 $provinfo = getProviderInfo();
129 //EOS FACILITY FILTERING (CHEMED)
130 //==================================
135 <!-- stuff form element here to avoid the margin padding it introduces into the page in some browsers -->
136 <form name='theform' id='theform' action='index.php?module=PostCalendar&func=view&tplview=default&pc_category=&pc_topic=' method='post' onsubmit='return top.restoreSession()'
>
137 <input type=
"hidden" name=
"jumpdate" id=
"jumpdate" value=
"">
138 <input type=
"hidden" name=
"viewtype" id=
"viewtype" value=
"[-php-]echo $viewtype;[-/php-]">
140 echo
" <input type='button' value='" .xl (
"Add").
"' onclick='newEvt(1, 9, 00, $Date, 0, 0)' />\n";
141 echo
" <input type='button' value='" . xl (
"Search") .
142 "' onclick='top.restoreSession();location=\"index.php?module=PostCalendar&func=search\
"' />\n";
146 <div id=
"topToolbarRight"> <!-- this wraps some of the top toolbar items -->
149 <a href='[-php-]echo $PREV_WEEK_URL[-/php-]' onclick='top.restoreSession()'
>
150 <img id=
"prevweek" src=
"[-$TPL_IMAGE_PATH-]/leftbtn.gif" border=
"0" title=
"[-php-]echo xl("Previous Week
")[-/php-]" alt=
"[-php-]echo xl ("Previous Week
")[-/php-]" /></a>
151 <a href='[-php-]echo $NEXT_WEEK_URL[-/php-]' onclick='top.restoreSession()'
>
152 <img id=
"nextweek" src=
"[-$TPL_IMAGE_PATH-]/rightbtn.gif" border=
"0" title=
"[-php-]echo xl("Next Week
")[-/php-]" alt=
"[-php-]echo xl ("Next Week
")[-/php-]" /></a>
154 <input type='submit' name='bnsubmit' value='[-php-]echo xl (
"Today")[-/php-]' onClick='GoToToday(theform);'
/>
157 <div id=
"viewPicker">
158 <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-]" />
160 <img id=
"dayview" src=
"[-$TPL_IMAGE_PATH-]/day.gif" border=
"0" title=
"[-php-]echo xl("Day View
")[-/php-]" alt=
"[-php-]echo xl ("Day View
")[-/php-]" />
162 <img id=
"weekview" class=
"currentview" src=
"[-$TPL_IMAGE_PATH-]/week.gif" border=
"0" title=
"[-php-]echo xl ("Week View
")[-/php-]" alt=
"[-php-]echo xl ("Week View
")[-/php-]" />
164 <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-]" />
166 </div> <!-- end topToolbarRight -->
168 <div id=
"datePicker">
170 <table border=
"0" cellpadding=
"0" cellspacing=
"0">
173 $atmp = array_keys($A_EVENTS);
174 $caldate = strtotime($atmp[
0]);
175 $cMonth = date(
"m", $caldate);
176 $cYear = date(
"Y", $caldate);
177 $cDay = date(
"d", $caldate);
179 // compute the previous month date
180 // stay on the same day if possible
182 $pMonth = $cMonth -
1;
184 if ($pMonth <
1) { $pMonth =
12; $pYear = $cYear -
1; }
185 while (! checkdate($pMonth, $pDay, $pYear)) { $pDay = $pDay -
1; }
186 $prevMonth = sprintf(
"%d%02d%02d",$pYear,$pMonth,$pDay);
188 // compute the next month
189 // stay on the same day if possible
191 $nMonth = $cMonth +
1;
193 if ($nMonth
> 12) { $nMonth =
1; $nYear = $cYear +
1; }
194 while (! checkdate($nMonth, $nDay, $nYear)) { $nDay = $nDay -
1; }
195 $nextMonth = sprintf(
"%d%02d%02d",$nYear,$nMonth,$nDay);
197 <td class=
"tdDOW-small tdDatePicker tdNav" id=
"[-php-]echo $prevMonth[-/php-]" title=
"[-php-]echo date("F
", strtotime($prevMonth));[-/php-]"><</td>
198 <td colspan=
"5" class=
"tdMonthName-small">
200 echo date('F', $caldate);
203 <td class=
"tdDOW-small tdDatePicker tdNav" id=
"[-php-]echo $nextMonth[-/php-]" title=
"[-php-]echo date("F
", strtotime($nextMonth));[-/php-]">></td>
206 foreach ($DOWlist as $dow) {
207 echo
"<td class='tdDOW-small'>".$this-
>_tpl_vars['A_SHORT_DAY_NAMES'][$dow].
"</td>";
212 $atmp = array_keys($A_EVENTS);
213 $caldate = strtotime($atmp[
0]);
214 $caldateEnd = strtotime($atmp[
6]);
215 // to make a complete week row we need to compute the real
216 // start and end dates for the view
217 list ($year, $month, $day) = explode(
" ", date('Y m d', $caldate));
218 $startdate = strtotime($year.$month.
"01");
219 while (date('w', $startdate) != $DOWlist[
0]) { $startdate -=
60*
60*
24; }
221 $enddate = strtotime($year.$month.date(
"t", $prevmonth).
" 23:59");
222 while (date('w', $enddate) != $DOWlist[
6]) { $enddate +=
60*
60*
24; }
224 $currdate = $startdate;
225 while ($currdate <= $enddate) {
226 if (date('w', $currdate) == $DOWlist[
0]) {
228 $tr =
"<tr class='trDateRow'>";
233 $tdClass =
"tdMonthDay-small";
234 if (date('m', $currdate) != $month) {
235 $tdClass =
"tdOtherMonthDay-small";
237 if ((date('w', $currdate) ==
0) || (date('w', $currdate) ==
6)) {
238 $tdClass =
"tdWeekend-small";
241 if ((date('Ymd',$currdate)
>= date('Ymd', $caldate)) &&
242 (date('Ymd',$currdate) <= date('Ymd', $caldateEnd)))
244 // add a class that highlights the 'current date'
245 $tdClass .=
" currentWeek";
248 if (date('Ymd',$currdate) == $Date) {
249 // $Date is defined near the top of this file
250 // and is equal to whatever date the user has clicked
251 $tdClass .=
" currentDate";
254 // add a class so that jQuery can grab these days for the 'click' event
255 $tdClass .=
" tdDatePicker";
259 $td .=
"class=\"".$tdClass."\
" ";
260 //$td .=
"id=\"".date("Ymd
", $currdate)."\
" ";
261 $td .=
"id=\"".date("Ymd
", $currdate)."\
" ";
262 $td .=
"title=\"Go to week of
".date('M d, Y', $currdate)."\
" ";
263 $td .=
"> ".date('d', $currdate).
"</td>\n";
267 if (date('w', $currdate) == $DOWlist[
6]) echo
"</tr>\n";
269 // time correction = plus
1000 seconds, for some unknown reason
270 $currdate += (
60*
60*
24)+
1000;
276 <div id=
"bigCalHeader">
278 $atmp = array_keys($A_EVENTS);
279 echo date('d M Y', strtotime($atmp[
0]));
281 echo date('d M Y', strtotime($atmp[count($atmp)-
1]));
285 <div id=
"providerPicker">
289 // ==============================
290 // FACILITY FILTERING (lemonsoftware)
291 $facilities = getFacilities();
292 if (count($facilities)
> 1) {
293 echo
" <select name='pc_facility' id='pc_facility'>\n";
294 if ( !$_SESSION['pc_facility'] ) $selected =
"selected='selected'";
295 echo
" <option value='0' $selected>" .xl('All Facilities').
"</option>\n";
296 foreach ($facilities as $fa) {
297 $selected = ( $_SESSION['pc_facility'] == $fa['id']) ?
"selected='selected'" :
"" ;
298 echo
" <option value='" .$fa['id'].
"' $selected>" .$fa['name'].
"</option>\n";
303 // ==============================
305 echo
" <select multiple size='5' name='pc_username[]' id='pc_username'>\n";
306 echo
" <option value='__PC_ALL__'>" .xl (
"All Users").
"</option>\n";
307 foreach ($provinfo as $doc) {
308 $username = $doc['username'];
309 echo
" <option value='$username'";
310 foreach ($providers as $provider)
311 if ($provider['username'] == $username) echo
" selected";
312 echo
">" . $doc['lname'] .
", " . $doc['fname'] .
"</option>\n";
321 [-assign
var=
"dayname" value=$DATE|date_format:
"%w"-]
322 [-assign
var=
"day" value=$DATE|date_format:
"%d"|string_format:
"%1d"-]
323 [-assign
var=
"month" value=$DATE|date_format:
"%m"|string_format:
"%1d"-]
324 [-assign
var=
"year" value=$DATE|date_format:
"%Y"|string_format:
"%4d"-]
326 [-pc_sort_events
var=
"S_EVENTS" sort=
"time" order=
"asc" value=$A_EVENTS-]
331 foreach ($A_EVENTS as $date =
> $events) {
333 foreach ($events as $oneE) {
337 echo
"<hr width=100%>";
342 // This loops once for each provider to be displayed.
344 foreach ($providers as $provider) {
345 $providerid = $provider['id'];
347 // to specially handle the IN/OUT events I'm doing something new here
348 // for each IN event it will have a duration lasting until the next
349 // OUT event or until the end of the day
350 $tmpTime = $times[
0];
351 $calStartMin = ($tmpTime['hour'] *
60) + $tmpTime['minute'];
352 $tmpTime = $times[count($times)-
1];
353 $calEndMin = ($tmpTime['hour'] *
60) + $tmpTime['minute'];
355 echo
"<table border='0' cellpadding='1' cellspacing='0' width='100%'>\n";
357 echo
" <td colspan='8' class='providerheader'>";
358 echo $provider['fname'] .
" " . $provider['lname'];
362 // output column (date) headers
363 $colWidth =
100/
7; // intentionally '
7' and not '
8'
365 echo
" <td> </td>"; // blank TD for the header above the Times column
366 $defaultDate =
""; // used when creating link for a 'new' event
367 $in_cat_id =
0; // used when creating link for a 'new' event
368 foreach ($A_EVENTS as $date =
> $events) {
369 $dateFmt = date(
"Ymd", strtotime($date));
370 $gotoURL = pnModURL(__POSTCALENDAR__,'user','view',
371 array('tplview'=
>$template_view,
374 'pc_username'=
>$pc_username,
375 'pc_category'=
>$category,
376 'pc_topic'=
>$topic));
377 if ($defaultDate ==
"") $defaultDate = $dateFmt;
379 if ($Date == $dateFmt) { $currclass=
"week_currday"; }
380 echo
"<td align='center' class='week_dateheader $currclass' style='width:".$colWidth.
"%;' >";
381 echo
"<a href='$gotoURL'>";
382 echo date(
"D m/d", strtotime($date));
387 // output the TD with the times DIV
389 echo
"<td id='times'><div><table>\n";
390 foreach ($times as $slottime) {
391 $startampm = ($slottime['mer']) ==
"pm" ?
2 :
1;
392 $starttimeh = $slottime['hour'];
393 $disptimeh = ($starttimeh
> 12) ? ($starttimeh -
12) : $starttimeh;
394 $starttimem = $slottime['minute'];
395 $slotendmins = $starttimeh *
60 + $starttimem + $interval;
397 echo
"<tr><td class='timeslot'>";
398 echo
"<a href='javascript:newEvt($startampm,$starttimeh,$starttimem,$defaultDate,$providerid,$in_cat_id)' title='New Appointment' alt='New Appointment'>";
399 //echo $slottime['hour'] *
60 + $slottime['minute'];
400 echo
"$disptimeh:$starttimem</a>";
403 echo
"</table></div></td>";
406 // output a TD with an inner containing DIV positioned 'relative'
407 // within that DIV we place our event DIVs using 'absolute' positioning
408 foreach ($A_EVENTS as $date =
> $events) {
409 $eventdate = substr($date,
0,
4) . substr($date,
5,
2) . substr($date,
8,
2);
411 // having a 'title' for the TD makes the date appear by the mouse pointer
412 // this is nice when all you see are times on the left side and no head
413 // row with the dates or day-of-week (DOW)
414 echo
"<td class='schedule' title='".date(
"l, d M Y", strtotime($date)).
"'>";
415 echo
"<div class='calendar_day'>";
417 // determine if events overlap and adjust their width and left position as needed
418 //
26 Feb
2008 - This needs fine tuning or total replacement
419 // - it doesn't work as well as I'd like - JRM
420 $eventPositions = array();
421 foreach ($times as $slottime) {
422 $starttimeh = $slottime['hour'];
423 $starttimem = $slottime['minute'];
425 $slotstartmins = $starttimeh *
60 + $starttimem;
426 $slotendmins = $starttimeh *
60 + $starttimem + $interval;
428 $events_in_timeslot = array();
429 foreach ($events as $e1) {
430 // ignore IN and OUT events
431 if (($e1['catid'] ==
2) || ($e1['catid'] ==
3)) { continue; }
432 // skip events without an ID (why they are in the loop, I have no idea)
433 if ($e1['eid'] ==
"") { continue; }
434 // skip events for other providers
435 if ($providerid != $e1['aid']) { continue; }
437 // create a numeric start and end for comparison
438 $starth = substr($e1['startTime'],
0,
2);
439 $startm = substr($e1['startTime'],
3,
2);
440 $e1Start = ($starth *
60) + $startm;
441 $e1End = $e1Start + $e1['duration']/
60;
443 // three ways to overlap:
444 // start-in, end-in, span
445 if ((($e1Start
>= $slotstartmins) && ($e1Start < $slotendmins)) // start-in
446 || (($e1End
> $slotstartmins) && ($e1End <= $slotendmins)) // end-in
447 || (($e1Start < $slotstartmins) && ($e1End
> $slotendmins))) // span
449 array_push($events_in_timeslot, $e1['eid']);
454 $width =
100 / count($events_in_timeslot);
456 // loop over the events in this timeslot and adjust their width
457 foreach ($events_in_timeslot as $eid) {
458 // set the width if not already set or if the current width is smaller
459 // than was was previously set
460 if (! isset($eventPositions[$eid]-
>width)) { $eventPositions[$eid]-
>width = $width; }
461 else if ($eventPositions[$eid]-
>width
> $width) { $eventPositions[$eid]-
>width = $width; }
463 // set the left position if not already set or if the current left is
464 // greater than what was previously set
465 if (! isset($eventPositions[$eid]-
>leftpos)) { $eventPositions[$eid]-
>leftpos = $leftpos; }
466 else if ($eventPositions[$eid]-
>leftpos < $leftpos) { $eventPositions[$eid]-
>leftpos = $leftpos; }
468 // increment the leftpos by the width
471 } // end overlap detection
473 // now loop over the events for the day and output their DIVs
474 foreach ($events as $event) {
475 // skip events for other providers
476 // yeah, we've got that sort of overhead here... it ain't perfect
477 if ($providerid != $event['aid']) { continue; }
479 // skip events without an ID (why they are in the loop, I have no idea)
480 if ($event['eid'] ==
"") { continue; }
482 // figure the start time and minutes (from midnight)
483 $starth = substr($event['startTime'],
0,
2);
484 $startm = substr($event['startTime'],
3,
2);
485 $eStartMin = $starth *
60 + $startm;
486 $dispstarth = ($starth
> 12) ? ($starth -
12) : $starth;
488 // determine the class for the event DIV based on the event category
489 $evtClass =
"event_appointment";
490 switch ($event['catid']) {
491 case
1: // NO-SHOW appt
492 $evtClass =
"event_noshow";
495 $evtClass =
"event_in";
497 case
3: // OUT of office
498 $evtClass =
"event_out";
503 $evtClass =
"event_reserved";
505 default: // some appointment
506 $evtClass =
"event_appointment";
510 // if this is an IN or OUT event then we have some extra special
511 // processing to be done
512 // the IN event creates a DIV until the OUT event
513 // or, without an OUT DIV matching the IN event
514 // then the IN event runs until the end of the day
515 if ($event['catid'] ==
2) {
516 // locate a matching OUT for this specific IN
519 foreach ($events as $outevent) {
520 // skip events for other providers
521 if ($providerid != $outevent['aid']) { continue; }
522 // skip events with blank IDs
523 if ($outevent['eid'] ==
"") { continue; }
525 if ($outevent['eid'] == $event['eid']) { $found = true; continue; }
526 if (($found == true) && ($outevent['catid'] ==
3)) {
527 // calculate the duration from this event to the outevent
528 $outH = substr($outevent['startTime'],
0,
2);
529 $outM = substr($outevent['startTime'],
3,
2);
530 $outMins = ($outH *
60) + $outM;
531 $event['duration'] = ($outMins - $eStartMin) *
60; // duration is in seconds
537 // no OUT was found so this event's duration goes
538 // until the end of the day
539 $event['duration'] = ($calEndMin - $eStartMin) *
60; // duration is in seconds
543 // calculate the TOP value for the event DIV
544 // diff between event start and schedule start
545 $eMinDiff = $eStartMin - $calStartMin;
546 // diff divided by the time interval of the schedule
547 $eStartInterval = $eMinDiff / $interval;
548 // times the interval height
549 $eStartPos = $eStartInterval * $timeslotHeightVal;
550 $evtTop = $eStartPos.$timeslotHeightUnit;
552 // calculate the HEIGHT value for the event DIV
553 // diff between end and start of event
554 $eEndMin = $eStartMin + ($event['duration']/
60);
555 $eMinDiff = $eEndMin - $eStartMin;
556 // diff divided by the time interval of the schedule
557 $eEndInterval = $eMinDiff / $interval;
558 // times the interval height
559 $eHeight = $eEndInterval * $timeslotHeightVal;
560 $evtHeight = $eHeight.$timeslotHeightUnit;
562 // determine the DIV width based on any overlapping events
563 // see further above for the overlapping calculation code
566 if (isset($eventPositions[$event['eid']])) {
567 $divWidth =
"width: ".$eventPositions[$event['eid']]-
>width.
"%";
568 $divLeft =
"left: ".$eventPositions[$event['eid']]-
>leftpos.
"%";
571 $eventid = $event['eid'];
572 $patientid = $event['pid'];
573 $commapos = strpos($event['patient_name'],
",");
574 $lname = addslashes(ucfirst(strtolower(substr($event['patient_name'],
0, $commapos))));
575 $fname = addslashes(ucfirst(strtolower(substr($event['patient_name'], $commapos +
2))));
576 $patient_dob = $event['patient_dob'];
577 $patient_age = $event['patient_age'];
578 $catid = $event['catid'];
579 $comment = addslashes($event['hometext']);
580 $catname = $event['catname'];
581 $title =
"Age $patient_age ($patient_dob)";
585 if ($comment && $GLOBALS['calendar_appt_style'] <
4) $title .=
" " . $comment;
587 // the divTitle is what appears when the user hovers the mouse over the DIV
588 $divTitle = date(
"D, d M Y", strtotime($date));
590 if ($catid ==
2 || $catid ==
3 || $catid ==
4 || $catid ==
8 || $catid ==
11) {
591 if ($catid ==
2) $catname =
"IN";
592 else if ($catid ==
3) $catname =
"OUT";
593 else if ($catid ==
4) $catname =
"VACATION";
594 else if ($catid ==
8) $catname =
"LUNCH";
595 else if ($catid ==
11) $catname =
"RESERVED";
598 if ($comment) $atitle .=
" $comment";
599 //$divTitle .=
"\n[".$atitle .
"] ".$divTitle;
600 $divTitle .=
"\n[".$atitle .
"]";
601 //$content .=
"<a href='javascript:oldEvt($eventdate,$eventid)' title='$atitle'>";
602 $content .= $catname;
603 if ($comment) $content .=
" $comment";
604 //$content .=
"</a>";
607 // some sort of patient appointment
608 $divTitle .=
"\r\n[".$catname .
"] ".$fname.
" ".$lname;
609 $content .=
"<span class='appointment".$apptToggle.
"'>";
610 //$content .=
"<a href='javascript:oldEvt($eventdate,$eventid)' title='$catname'>";
611 $content .= $dispstarth . ':' . $startm . htmlspecialchars($event['apptstatus']);
612 //$content .=
"</a>";
613 $content .=
"<a href='javascript:goPid($patientid)' title='$title'>";
614 $iTitle =
"View Patient [".$fname.
" ".$lname.
"]";
615 $content .=
"<img src='$TPL_IMAGE_PATH/user-green.gif' border='0' title='".$iTitle.
"' alt='".$iTitle.
"' />";
617 if ($catid ==
1) $content .=
"<strike>";
619 if ($GLOBALS['calendar_appt_style'] !=
1) {
620 $content .=
"," . $fname;
621 if ($event['title'] && $GLOBALS['calendar_appt_style']
>=
3) {
622 $content .=
"(" . $event['title'];
623 if ($event['hometext'] && $GLOBALS['calendar_appt_style']
>=
4)
624 $content .=
": <font color='green'>" . htmlspecialchars(trim($event['hometext'])) .
"</font>";
628 if ($catid ==
1) $content .=
"</strike>";
631 $content .=
"</span>";
634 $divTitle .=
"\n(double click to edit)";
636 // output the DIV and content
637 echo
"<div class='".$evtClass.
" event' style='top:".$evtTop.
"; height:".$evtHeight.
638 "; background-color:".$event[
"catcolor"].
641 "' title='".$divTitle.
"'".
642 " id='".$eventdate.
"-".$eventid.
"'".
660 // [-include
file=
"$TPL_NAME/views/global/footer.html"-]
661 // [-include
file=
"$TPL_NAME/views/footer.html"-]
664 </div> <!-- end bigCal DIV -->
668 <script language='JavaScript'
>
670 $(document
).ready(function(){
671 $("#pc_username").change(function() { ChangeProviders(this); });
672 $("#pc_facility").change(function() { ChangeProviders(this); });
673 $("#dayview").click(function() { ChangeView(this); });
674 //$("#weekview").click(function() { ChangeView(this); });
675 $("#monthview").click(function() { ChangeView(this); });
676 //$("#yearview").click(function() { ChangeView(this); });
677 $(".tdDatePicker").click(function() { ChangeDate(this); });
678 $("#datePicker .trDateRow").mouseover(function() { $(this).children().toggleClass("tdDatePickerHighlight"); });
679 $("#datePicker .trDateRow").mouseout(function() { $(this).children().toggleClass("tdDatePickerHighlight"); });
680 $("#datePicker .tdNav").mouseover(function() { $(this).toggleClass("tdDatePickerHighlight"); });
681 $("#datePicker .tdNav").mouseout(function() { $(this).toggleClass("tdDatePickerHighlight"); });
682 $("#print").click(function() { PrintView(this); });
683 $(".event").dblclick(function() { EditEvent(this); });
684 $(".event").mouseover(function() { $(this).toggleClass("event_highlight"); });
685 $(".event").mouseout(function() { $(this).toggleClass("event_highlight"); });
688 /* edit an existing event */
689 var EditEvent = function(eObj
) {
690 //alert ('editing '+eObj.id);
691 // split the object ID into date and event ID
693 var parts
= new Array();
694 parts
= objID
.split("-");
695 // call the oldEvt function to bring up the event editor
696 oldEvt(parts
[0], parts
[1]);
700 /* change the current date based upon what the user clicked in
703 var ChangeDate = function(eObj
) {
704 baseURL
= "[-php-]echo pnModURL(__POSTCALENDAR__,'user','view',
705 array('tplview'=>$template_view,
706 'viewtype'=>$viewtype,
707 'Date'=> '~REPLACEME~',
708 'pc_username'=>$pc_username,
709 'pc_category'=>$category,
710 'pc_topic'=>$topic));[-/php-]";
711 newURL
= baseURL
.replace(/~REPLACEME~/, eObj
.id
);
712 document
.location
.href
=newURL
;
715 /* pop up a window to print the current view
717 var PrintView = function (eventObject
) {
718 printURL
= "[-php-]echo pnModURL(__POSTCALENDAR__,'user','view',
719 array('tplview'=>$template_view,
720 'viewtype'=>$viewtype,
723 'pc_username'=>$pc_username,
724 'pc_category'=>$category,
725 'pc_topic'=>$topic));[-/php-]";
726 window
.open(printURL
,'printwindow','width=740,height=480,toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,copyhistory=no,resizable=yes');
730 /* change the provider(s)
732 var ChangeProviders = function (eventObject
) {
733 $('#theform').submit();
736 /* change the calendar view
738 var ChangeView = function (eventObject
) {
739 if (eventObject
.id
== "dayview") {
740 $("#viewtype").val('day');
742 else if (eventObject
.id
== "weekview") {
743 $("#viewtype").val('week');
745 else if (eventObject
.id
== "monthview") {
746 $("#viewtype").val('month');
748 else if (eventObject
.id
== "yearview") {
749 $("#viewtype").val('year');
751 $('#theform').submit();