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 [-* DO NOT INCLUDE the default header,
14 * which includes a stylesheet to screw up
15 * our styles below *-]
16 [-*include
file=
"$TPL_NAME/views/header.html"*-]
25 font-family: Arial, Helvetica, sans-serif;
27 div.tiny { width:
1px; height:
1px; font-size:
1px; }
31 font-family: Arial, Helvetica, sans-serif;
49 background-color: lightblue;
50 font-family: Arial, Helvetica, sans-serif;
53 border-collapse: collapse;
69 page-break-after: always;
72 /* these are for the small datepicker DIV */
77 background-color: lightblue;
80 font-family: Arial, Helvetica, sans-serif;
84 border-collapse: collapse;
86 #datePicker .tdDOW-small {
87 font-family: Arial, Helvetica, sans-serif;
90 background-color: lightblue;
92 border-bottom:
1px solid black;
93 padding:
2px
3px
2px
3px;
95 #datePicker .tdWeekend-small {
96 font-family: Arial, Helvetica, sans-serif;
100 padding:
2px
3px
2px
3px;
101 background-color: #dddddd;
105 #datePicker .tdOtherMonthDay-small {
106 font-family: Arial, Helvetica, sans-serif;
110 padding:
2px
3px
2px
3px;
111 background-color: #ffffff;
115 #datePicker .tdMonthName-small {
117 font-family: Arial, Helvetica, sans-serif;
122 #datePicker .tdMonthDay-small {
123 font-family: Arial, Helvetica, sans-serif;
127 padding:
2px
3px
2px
3px;
128 background-color: #ffffff;
130 #datePicker .currentWeek {
131 border-top:
1px solid blue;
132 border-bottom:
1px solid blue;
133 background-color: lightblue;
135 #datePicker .currentDate {
136 border:
1px solid blue;
137 background-color: blue;
141 /* the DIV of times */
143 border-right:
1px solid black;
146 border-collapse: collapse;
153 border-top:
1px solid black;
159 height: [-php-]echo $timeslotHeightVal.$timeslotHeightUnit;[-/php-];
164 background-color: pink;
168 border:
1px solid #
999999;
170 /* types of events */
172 background-color: white;
176 background-color: pink;
183 border-bottom:
1px solid lightgrey;
190 border-bottom:
1px solid lightgrey;
196 border-bottom:
1px solid lightgrey;
200 <script type=
"text/javascript" src=
"[-php-] echo $GLOBALS['webroot'] [-/php-]/library/js/jquery-1.2.2.min.js"></script>
207 // build a day-of-week (DOW) list so we may properly build the calendars later in this code
209 $tmpDOW = pnModGetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek');
210 // bound check and auto-correction
211 if ($tmpDOW
<0 || $tmpDOW
>6) {
212 pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', '
0');
215 while (count($DOWlist) <
7) {
216 array_push($DOWlist, $tmpDOW);
218 if ($tmpDOW
> 6) $tmpDOW =
0;
221 // this is my proposed setting in the globals config file so we don't
222 // need to mess with altering the pn database AND the config file
223 //pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', $GLOBALS['schedule_dow_start']);
225 $A_CATEGORY =& $this-
>_tpl_vars['A_CATEGORY'];
226 $A_EVENTS =& $this-
>_tpl_vars['A_EVENTS'];
227 $providers =& $this-
>_tpl_vars['providers'];
228 $times =& $this-
>_tpl_vars['times'];
229 $interval = $this-
>_tpl_vars['interval'];
230 $viewtype = $this-
>_tpl_vars['VIEW_TYPE'];
231 $PREV_WEEK_URL = $this-
>_tpl_vars['PREV_WEEK_URL'];
232 $NEXT_WEEK_URL = $this-
>_tpl_vars['NEXT_WEEK_URL'];
233 $PREV_DAY_URL = $this-
>_tpl_vars['PREV_DAY_URL'];
234 $NEXT_DAY_URL = $this-
>_tpl_vars['NEXT_DAY_URL'];
236 $Date = postcalendar_getDate();
237 if (!isset($y)) $y = substr($Date,
0,
4);
238 if (!isset($m)) $m = substr($Date,
4,
2);
239 if (!isset($d)) $d = substr($Date,
6,
2);
241 $provinfo = getProviderInfo();
244 [-assign
var=
"dayname" value=$DATE|date_format:
"%w"-]
245 [-assign
var=
"day" value=$DATE|date_format:
"%d"|string_format:
"%1d"-]
246 [-assign
var=
"month" value=$DATE|date_format:
"%m"|string_format:
"%1d"-]
247 [-assign
var=
"year" value=$DATE|date_format:
"%Y"|string_format:
"%4d"-]
251 // start out without adding a pagebreak
252 $addPagebreak = false;
254 // This loops once for each provider to be displayed.
256 foreach ($providers as $provider) {
257 // output a pagebreak, if needed
258 if ($addPagebreak) { echo
"<div class='pagebreak'></div>"; }
259 $addPagebreak = true;
261 echo
"<div id='bigCalHeader'>";
262 //echo
"<img src='/images/cfa_logo_small.gif' style='position:relative; z-index:-100'/>";
264 echo
"<div id='bigCalText'>";
265 // output the provider name
266 echo
"<span id='provname'>".$provider['fname'] .
" " . $provider['lname'].
"</span>";
268 // output the date range
269 $atmp = array_keys($A_EVENTS);
270 echo
"<span id='daterange'>";
271 echo xl(date('F', strtotime($Date))).
" " . date('Y', strtotime($Date));
275 // output a calendar for the subsequent month
276 list($nyear, $nmonth, $nday) = explode(
" ", date(
"Y m d", strtotime($Date)));
278 if ($nmonth
> 12) { $nyear++; $nmonth=
1; }
279 echo
"<div id='datePicker'>";
280 PrintDatePicker(strtotime($nyear.
"-".$nmonth.
"-1"), $DOWlist, $this-
>_tpl_vars['A_SHORT_DAY_NAMES']);
283 // output a small calendar for the chosen month
284 echo
"<div id='datePicker'>";
285 PrintDatePicker(strtotime($Date), $DOWlist, $this-
>_tpl_vars['A_SHORT_DAY_NAMES']);
288 echo
"</div>"; // end the bigCalHeader
290 echo
"<div id='bigCal'>";
292 $providerid = $provider['id'];
296 // output day of week headers
298 $defaultDate =
""; // used when creating link for a 'new' event
299 $in_cat_id =
0; // used when creating link for a 'new' event
301 foreach ($A_EVENTS as $date =
> $events) {
302 if ($defaultDate ==
"") $defaultDate = date(
"Ymd", strtotime($date));
304 echo xl(date(
"l", strtotime($date)));
306 if ($dowCount++ ==
6) { break; }
311 // output a TD with an inner containing DIV positioned 'relative'
312 foreach ($A_EVENTS as $date =
> $events) {
313 $eventdate = substr($date,
0,
4) . substr($date,
5,
2) . substr($date,
8,
2);
315 $gotoURL = pnModURL(__POSTCALENDAR__,'user','view',
316 array('tplview'=
>$template_view,
318 'Date'=
> date(
"Ymd", strtotime($date)),
319 'pc_username'=
>$pc_username,
320 'pc_category'=
>$category,
321 'pc_topic'=
>$topic));
323 if (date(
"w", strtotime($date)) == $DOWlist[
0]) { echo
"<tr>"; }
324 echo
"<td class='schedule'>";
325 echo
"<div style='position: relative; height: 100%; width: 100%;'>\n";
326 echo
"<div style='width:100%; font-size: 0.8em; text-align:right; background-color:lightgrey; padding:1px 2px 1px 2px;'>";
327 echo date(
"d", strtotime($date)).
"</div>";
329 if (count($events) ==
0) { echo
" "; }
331 foreach ($events as $event) {
332 // skip events for other providers
333 // yeah, we've got that sort of overhead here... it ain't perfect
334 if ($providerid != $event['aid']) { continue; }
336 // Omit IN and OUT events to reduce clutter in this month view
337 if (($event['catid'] ==
2) || ($event['catid'] ==
3)) { continue; }
339 // specially handle all-day events
340 if ($event['alldayevent'] ==
1) {
341 $tmpTime = $times[
0];
342 if (strlen($tmpTime['hour']) <
2) { $tmpTime['hour'] =
"0".$tmpTime['hour']; }
343 if (strlen($tmpTime['minute']) <
2) { $tmpTime['minute'] =
"0".$tmpTime['minute']; }
344 $event['startTime'] = $tmpTime['hour'].
":".$tmpTime['minute'].
":00";
345 $event['duration'] = ($calEndMin - $calStartMin) *
60; // measured in seconds
348 // figure the start time and minutes (from midnight)
349 $starth = substr($event['startTime'],
0,
2);
350 $startm = substr($event['startTime'],
3,
2);
351 $eStartMin = $starth *
60 + $startm;
352 $startDateTime = strtotime($date.
" ".$event['startTime']);
354 // determine the class for the event DIV based on the event category
355 $evtClass =
"event_appointment";
356 switch ($event['catid']) {
357 case
1: // NO-SHOW appt
358 $evtClass =
"event_noshow";
361 $evtClass =
"event_in";
363 case
3: // OUT of office
364 $evtClass =
"event_out";
369 $evtClass =
"event_reserved";
371 default: // some appointment
372 $evtClass =
"event_appointment";
376 // now, output the event DIV
379 $eventid = $event['eid'];
380 $patientid = $event['pid'];
381 $commapos = strpos($event['patient_name'],
",");
382 $lname = substr($event['patient_name'],
0, $commapos);
383 $fname = substr($event['patient_name'], $commapos +
2);
384 $patient_dob = $event['patient_dob'];
385 $patient_age = $event['patient_age'];
386 $catid = $event['catid'];
387 $comment = addslashes($event['hometext']);
388 $catname = $event['catname'];
389 $title =
"Age $patient_age ($patient_dob)";
391 // format the time specially
392 $displayTime = date(
"g", $startDateTime);
393 if (date(
"i", $startDateTime) ==
"00") {
394 $displayTime .= (date(
"a", $startDateTime));
397 $displayTime .= (date(
":ia", $startDateTime));
401 if ($comment && $GLOBALS['calendar_appt_style'] <
4) $title .=
" " . $comment;
403 if ($catid ==
4 || $catid ==
8 || $catid ==
11) {
404 if ($catid ==
4) $catname = xl(
"VACATION");
405 else if ($catid ==
8) $catname = xl(
"LUNCH");
406 else if ($catid ==
11) $catname = xl(
"RESERVED");
408 $content .= $displayTime.
" ";
409 $content .= $catname;
410 if ($comment) $content .=
" - $comment";
413 // some sort of patient appointment
415 $content .= $displayTime.
" ";
416 if ($catid ==
1) $content .=
"<strike>";
417 $content .= htmlspecialchars($lname);
418 if ($catid ==
1) $content .=
"</strike>";
421 echo
"<div class='".$evtClass.
"' style='background-color:".$event['catcolor'].
";'>";
428 if (date(
"w", strtotime($date)) == $DOWlist[
6]) { echo
"</tr>"; }
436 // [-include
file=
"$TPL_NAME/views/global/footer.html"-]
437 // [-include
file=
"$TPL_NAME/views/footer.html"-]
439 /* output a small calendar, based on the date-picker code from the normal calendar */
440 function PrintDatePicker($caldate, $DOWlist, $daynames) {
442 $cMonth = date(
"m", $caldate);
443 $cYear = date(
"Y", $caldate);
444 $cDay = date(
"d", $caldate);
448 echo '
<td colspan=
"7" class=
"tdMonthName-small">';
449 echo date('F Y', $caldate);
453 foreach ($DOWlist as $dow) {
454 echo
"<td class='tdDOW-small'>".$daynames[$dow].
"</td>";
458 // to make a complete week row we need to compute the real
459 // start and end dates for the view
460 list ($year, $month, $day) = explode(
" ", date('Y m d', $caldate));
461 $startdate = strtotime($year.$month.
"01");
462 while (date('w', $startdate) != $DOWlist[
0]) { $startdate -=
60*
60*
24; }
464 $enddate = strtotime($year.$month.date(
"t", $month));
465 while (date('w', $enddate) != $DOWlist[
6]) { $enddate +=
60*
60*
24; }
467 $currdate = $startdate;
468 while ($currdate <= $enddate) {
469 if (date('w', $currdate) == $DOWlist[
0]) {
473 // we skip outputting some days
477 $tdClass =
"tdMonthDay-small";
478 if (date('m', $currdate) != $month) {
479 $tdClass =
"tdOtherMonthDay-small";
482 if ((date('w', $currdate) ==
0) || (date('w', $currdate) ==
6)) {
483 $tdClass =
"tdWeekend-small";
486 if (date('Ymd',$currdate) == $Date) {
487 // $Date is defined near the top of this file
488 // and is equal to whatever date the user has clicked
489 $tdClass .=
" currentDate";
492 // add a class so that jQuery can grab these days for the 'click' event
493 $tdClass .=
" tdDatePicker";
497 $td .=
"class=\"".$tdClass."\
" ";
498 //$td .=
"id=\"".date("Ymd
", $currdate)."\
" ";
499 $td .=
"id=\"".date("Ymd
", $currdate)."\
" ";
500 $td .=
"title=\"Go to week of
".date('M d, Y', $currdate)."\
" ";
501 $td .=
"> ".date('d', $currdate).
"</td>\n";
502 if ($skipit == true) { echo
"<td></td>"; }
506 if (date('w', $currdate) == $DOWlist[
6]) echo
"</tr>\n";
508 // time correction = plus
1000 seconds, for some unknown reason
509 $currdate += (
60*
60*
24)+
1000;
513 // end DatePicker, small calendar output
519 <script language='JavaScript'
>
520 $(document
).ready(function(){
521 var win
= top
.printLogPrint
? top
: opener
.top
;
522 win
.printLogPrint(window
);