Support for optional logging of print actions.
[openemr.git] / interface / main / calendar / modules / PostCalendar / pntemplates / default / views / month_print / outlook_ajax_template.html
bloba5e414161b29d0696f4ca9f62d263db396049f0a
1 [-*Smarty*-]
2 [-*****************************************************************************-]
3 [-* Copyright (C) 2005-2006 Rod Roark <rod@sunsetsystems.com> and others *-]
4 [-* *-]
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"*-]
18 <html>
19 <head>
20 <style>
21 a {
22 text-decoration:none;
24 td {
25 font-family: Arial, Helvetica, sans-serif;
27 div.tiny { width:1px; height:1px; font-size:1px; }
28 #bigCalHeader {
29 width: 100%;
30 height: 20%;
31 font-family: Arial, Helvetica, sans-serif;
32 font-size: 1em;
34 #bigCalText {
35 float: left;
37 #provname {
38 font-size: 2em;
40 #daterange {
41 font-size: 1.8em;
42 font-weight: bold;
45 #bigCal {
46 width: 100%;
47 height: 80%;
48 overflow: hidden;
49 background-color: lightblue;
50 font-family: Arial, Helvetica, sans-serif;
52 #bigCal table {
53 border-collapse: collapse;
54 width: 100%;
55 height: 100%;
57 #bigCal table th {
58 height: 5%;
59 text-align: center;
60 width: 13%;
61 font-size: 0.7em;
63 #bigCal table td {
64 height: 15%;
65 white-space: nowrap;
66 overflow: hidden;
68 .pagebreak {
69 page-break-after: always;
72 /* these are for the small datepicker DIV */
73 #datePicker {
74 float: right;
75 padding: 5px;
76 text-align: center;
77 background-color: lightblue;
79 #datePicker td {
80 font-family: Arial, Helvetica, sans-serif;
81 font-size: 0.7em;
83 #datePicker table {
84 border-collapse: collapse;
86 #datePicker .tdDOW-small {
87 font-family: Arial, Helvetica, sans-serif;
88 font-size: 10px;
89 vertical-align: top;
90 background-color: lightblue;
91 text-align: center;
92 border-bottom: 1px solid black;
93 padding: 2px 3px 2px 3px;
95 #datePicker .tdWeekend-small {
96 font-family: Arial, Helvetica, sans-serif;
97 font-size: 10px;
98 vertical-align: top;
99 border: none;
100 padding: 2px 3px 2px 3px;
101 background-color: #dddddd;
102 color: #999999;
105 #datePicker .tdOtherMonthDay-small {
106 font-family: Arial, Helvetica, sans-serif;
107 font-size: 10px;
108 vertical-align: top;
109 border: none;
110 padding: 2px 3px 2px 3px;
111 background-color: #ffffff;
112 color: #999999;
115 #datePicker .tdMonthName-small {
116 text-align: center;
117 font-family: Arial, Helvetica, sans-serif;
118 font-size: 12px;
119 font-style: normal
122 #datePicker .tdMonthDay-small {
123 font-family: Arial, Helvetica, sans-serif;
124 font-size: 10px;
125 vertical-align: top;
126 border: none;
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;
138 color: lightblue;
141 /* the DIV of times */
142 #times {
143 border-right: 1px solid black;
145 #times table {
146 border-collapse: collapse;
147 width: 100%;
148 margin: 0px;
149 padding: 0px;
151 #times table td {
152 border: 0px;
153 border-top: 1px solid black;
154 margin: 0px;
155 padding: 0px;
156 font-size: 10pt;
158 .timeslot {
159 height: [-php-]echo $timeslotHeightVal.$timeslotHeightUnit;[-/php-];
160 margin: 0px;
161 padding: 0px;
163 .schedule {
164 background-color: pink;
165 vertical-align: top;
166 padding: 0px;
167 margin: 0px;
168 border: 1px solid #999999;
170 /* types of events */
171 .event_in {
172 background-color: white;
173 width: 100%;
175 .event_out {
176 background-color: pink;
177 width: 100%;
179 .event_appointment {
180 overflow: hidden;
181 width: 100%;
182 font-size: 0.8em;
183 border-bottom: 1px solid lightgrey;
184 height: 1.4em;
186 .event_noshow {
187 overflow: hidden;
188 width: 100%;
189 font-size: 0.8em;
190 border-bottom: 1px solid lightgrey;
192 .event_reserved {
193 overflow: hidden;
194 width: 100%;
195 font-size: 0.8em;
196 border-bottom: 1px solid lightgrey;
198 </style>
200 <script type="text/javascript" src="[-php-] echo $GLOBALS['webroot'] [-/php-]/library/js/jquery-1.2.2.min.js"></script>
202 </head>
203 <body>
205 [-php-]
207 // build a day-of-week (DOW) list so we may properly build the calendars later in this code
208 $DOWlist = array();
209 $tmpDOW = pnModGetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek');
210 // bound check and auto-correction
211 if ($tmpDOW <0 || $tmpDOW >6) {
212 pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', '0');
213 $tmpDOW = 0;
215 while (count($DOWlist) < 7) {
216 array_push($DOWlist, $tmpDOW);
217 $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();
242 [-/php-]
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"-]
249 [-php-]
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>";
267 echo "<br>";
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));
272 echo "</span>";
273 echo "</div>";
275 // output a calendar for the subsequent month
276 list($nyear, $nmonth, $nday) = explode(" ", date("Y m d", strtotime($Date)));
277 $nmonth++;
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']);
281 echo "</div>";
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']);
286 echo "</div>";
288 echo "</div>"; // end the bigCalHeader
290 echo "<div id='bigCal'>";
292 $providerid = $provider['id'];
294 echo "<table>\n";
296 // output day of week headers
297 echo " <tr>\n";
298 $defaultDate = ""; // used when creating link for a 'new' event
299 $in_cat_id = 0; // used when creating link for a 'new' event
300 $dowCount = 0;
301 foreach ($A_EVENTS as $date => $events) {
302 if ($defaultDate == "") $defaultDate = date("Ymd", strtotime($date));
303 echo "<th>";
304 echo xl(date("l", strtotime($date)));
305 echo "</th>";
306 if ($dowCount++ == 6) { break; }
308 echo " </tr>\n";
310 // For each day...
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,
317 'viewtype'=>'day',
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 "&nbsp;"; }
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";
359 break;
360 case 2: // IN office
361 $evtClass = "event_in";
362 break;
363 case 3: // OUT of office
364 $evtClass = "event_out";
365 break;
366 case 4: // VACATION
367 case 8: // LUNCH
368 case 11: // RESERVED
369 $evtClass = "event_reserved";
370 break;
371 default: // some appointment
372 $evtClass = "event_appointment";
373 break;
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));
396 else {
397 $displayTime .= (date(":ia", $startDateTime));
400 $content = "";
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";
412 else {
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'].";'>";
422 echo $content;
423 echo "</div>\n";
424 } // end EVENT loop
426 echo "</div>";
427 echo "</td>";
428 if (date("w", strtotime($date)) == $DOWlist[6]) { echo "</tr>"; }
429 } // end date
431 echo "</table>\n";
432 echo "</div>";
433 } // end provider
435 // [-*footer*-]
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);
446 echo '<table>';
447 echo '<tr>';
448 echo '<td colspan="7" class="tdMonthName-small">';
449 echo date('F Y', $caldate);
450 echo '</td>';
451 echo '</tr>';
452 echo '<tr>';
453 foreach ($DOWlist as $dow) {
454 echo "<td class='tdDOW-small'>".$daynames[$dow]."</td>";
456 echo '</tr>';
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]) {
470 echo "<tr>";
473 // we skip outputting some days
474 $skipit = false;
476 // set the TD class
477 $tdClass = "tdMonthDay-small";
478 if (date('m', $currdate) != $month) {
479 $tdClass = "tdOtherMonthDay-small";
480 $skipit = true;
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";
495 // output the TD
496 $td = "<td ";
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>"; }
503 else { echo $td; }
505 // end of week row
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;
511 echo "</table>";
513 // end DatePicker, small calendar output
515 [-/php-]
517 </body>
519 <script language='JavaScript'>
520 $(document).ready(function(){
521 var win = top.printLogPrint ? top : opener.top;
522 win.printLogPrint(window);
523 window.close();
525 </script>
528 </html>