Calendar layout changes. Wrapping datePicker, providerPicker and facilityColor in...
[openemr.git] / interface / main / calendar / modules / PostCalendar / pntemplates / default / views / month / ajax_template.html
blob575c9b87086cddf421b44549e190c778ef0a05da
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 [-include file="$TPL_NAME/views/header.html"-]
15 [-*Values used in setting timeslot and event heights*-]
16 [-php-]
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";
22 [-/php-]
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() {
30 top.restoreSession();
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,
38 '_blank', 575, 375);
41 function oldEvt(eventdate, eventid, pccattype) {
42 dlgopen('add_edit_event.php?date='+eventdate+'&eid=' + eventid+'&prov=' + pccattype, '_blank', 575, 375);
45 function goPid(pid) {
46 top.restoreSession();
47 [-php-]
48 if ($GLOBALS['concurrent_layout'])
51 echo " top.RTop.location = '../../patient_file/summary/demographics.php' " .
52 "+ '?set_pid=' + pid;\n";
54 } else {
55 echo " top.location = '../../patient_file/patient_file.php' " .
56 "+ '?set_pid=' + pid + '&pid=' + pid;\n";
58 [-/php-]
61 function GoToToday(theForm){
62 var todays_date = new Date();
63 var theMonth = todays_date.getMonth() + 1;
64 theMonth = theMonth < 10 ? "0" + theMonth : theMonth;
65 theForm.jumpdate.value = todays_date.getFullYear() + "-" + theMonth + "-" + todays_date.getDate();
66 top.restoreSession();
67 theForm.submit();
70 </script>
72 [-php-]
74 // this is my proposed setting in the globals config file so we don't
75 // need to mess with altering the pn database AND the config file
76 //pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', $GLOBALS['schedule_dow_start']);
78 // build a day-of-week (DOW) list so we may properly build the calendars later in this code
79 $DOWlist = array();
80 $tmpDOW = pnModGetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek');
81 // bound check and auto-correction
82 if ($tmpDOW <0 || $tmpDOW >6) {
83 pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', '0');
84 $tmpDOW = 0;
86 while (count($DOWlist) < 7) {
87 array_push($DOWlist, $tmpDOW);
88 $tmpDOW++;
89 if ($tmpDOW > 6) $tmpDOW = 0;
92 // A_CATEGORY is an ordered array of associative-array categories.
93 // Keys of interest are: id, name, color, desc, event_duration.
95 // echo "<!-- A_CATEGORY = "; print_r($this->_tpl_vars['A_CATEGORY']); echo " -->\n"; // debugging
96 // echo "<!-- A_EVENTS = "; print_r($this->_tpl_vars['A_EVENTS']); echo " -->\n"; // debugging
98 $A_CATEGORY =& $this->_tpl_vars['A_CATEGORY'];
100 // [-if $PRINT_VIEW != 1-]
101 // [-*Main Navigation*-]
102 // [-include file="$TPL_NAME/views/global/navigation.html"-]
103 // [-/if-]
105 $A_EVENTS =& $this->_tpl_vars['A_EVENTS'];
106 $providers =& $this->_tpl_vars['providers'];
107 $times =& $this->_tpl_vars['times'];
108 $interval = $this->_tpl_vars['interval'];
109 $viewtype = $this->_tpl_vars['VIEW_TYPE'];
110 $PREV_WEEK_URL = $this->_tpl_vars['PREV_WEEK_URL'];
111 $NEXT_WEEK_URL = $this->_tpl_vars['NEXT_WEEK_URL'];
112 $PREV_DAY_URL = $this->_tpl_vars['PREV_DAY_URL'];
113 $NEXT_DAY_URL = $this->_tpl_vars['NEXT_DAY_URL'];
115 $Date = postcalendar_getDate();
116 if (!isset($y)) $y = substr($Date, 0, 4);
117 if (!isset($m)) $m = substr($Date, 4, 2);
118 if (!isset($d)) $d = substr($Date, 6, 2);
120 // echo "<!-- There are " . count($A_EVENTS) . " A_EVENTS days -->\n";
122 //==================================
123 //FACILITY FILTERING (CHEMED)
124 $facilities = getUserFacilities($_SESSION['authId']); // from users_facility
125 if ( $_SESSION['pc_facility'] ) {
126 $provinfo = getProviderInfo('%', true, $_SESSION['pc_facility']);
127 } else {
128 $provinfo = getProviderInfo();
130 //EOS FACILITY FILTERING (CHEMED)
131 //==================================
132 [-/php-]
133 <div id="topheader">&nbsp;</div>
134 <div id="topToolbarRight"> <!-- this wraps some of the top toolbar items -->
135 <div id="functions">
136 <!-- stuff form element here to avoid the margin padding it introduces into the page in some browsers -->
137 <form name='theform' id='theform' action='index.php?module=PostCalendar&func=view&tplview=default&pc_category=&pc_topic=' method='post' onsubmit='return top.restoreSession()'>
138 <input type="hidden" name="jumpdate" id="jumpdate" value="">
139 <input type="hidden" name="viewtype" id="viewtype" value="[-php-]echo $viewtype;[-/php-]">
140 [-php-]
141 echo " <a href='#' value='" .xl ("Add"). "' onclick='newEvt(1, 9, 00, $Date, 0, 0)' class='css_button'/><span>".xl("Add")."</span></a>\n";
142 echo " <a href='#' value='" . xl ("Search") .
143 "' onclick='top.restoreSession();location=\"index.php?module=PostCalendar&func=search\"' class='css_button'/><span>".xl("Search")."</span></a>\n";
144 [-/php-]
145 </div>
148 <div id="dateNAV" style="width:33%;">
149 <a href='#' name='bnsubmit' value='[-php-]echo xl ("Today")[-/php-]' onClick='GoToToday(theform);' class='css_button'/><span>[-php-] echo xl("Today")[-/php-]</span></a>
150 <a href='[-php-]echo $PREV_MONTH_URL[-/php-]' onclick='top.restoreSession()'>
151 <img id="prevmonth" src="[-$TPL_IMAGE_PATH-]/leftbtn.gif" border="0" title="[-php-]echo xl("Previous Month")[-/php-]" alt="[-php-]echo xl ("Previous Month")[-/php-]" style="padding-top:5px"/></a>
152 <a href='[-php-]echo $NEXT_MONTH_URL[-/php-]' onclick='top.restoreSession()'>
153 <img id="nextmonth" src="[-$TPL_IMAGE_PATH-]/rightbtn.gif" border="0" title="[-php-]echo xl("Next Month")[-/php-]" alt="[-php-]echo xl ("Next Month")[-/php-]" /></a>
154 &nbsp;
155 [-php-]
156 echo xl(date('F', strtotime($Date))) . " " . date('Y', strtotime($Date));
157 [-/php-]
158 </div>
160 <div id="viewPicker">
161 [-php-]
162 echo " <a href='#' type='button' id='printview' title='" .xl ("Print View"). "' class='css_button'/><span>".xl("Print")."</span></a>\n";
163 echo " <a href='#' type='button' value='" .xl ("Refresh"). "' onclick='javascript:refreshme()' class='css_button'/><span>".xl("Refresh")."</span></a>\n";
164 echo " <a href='#' type='button' id='dayview' title='" .htmlspecialchars( xl('Day View'), ENT_QUOTES). "' class='css_button'/><span>".htmlspecialchars( xl('Day'), ENT_QUOTES)."</span></a>\n";
165 echo " <a href='#' type='button' id='weekview' title='" .htmlspecialchars( xl('Week View'), ENT_QUOTES). "' class='css_button'/><span>".htmlspecialchars( xl('Week'), ENT_QUOTES)."</span></a>\n";
166 echo " <a href='#' type='button' id='monthview' title='" .htmlspecialchars( xl('Month View'), ENT_QUOTES). "' class='css_button'/><span>".htmlspecialchars( xl('Month'), ENT_QUOTES)."</span></a>\n";
167 [-/php-]
168 </div>
169 </div> <!-- end topToolbarRight -->
170 <div id="bottomLeft">
171 <div id="datePicker">
172 <table border="0" cellpadding="0" cellspacing="0">
173 <tr>
174 [-php-]
175 // caldate depends on what the user has clicked
176 $caldate = strtotime($Date);
177 $cMonth = date("m", $caldate);
178 $cYear = date("Y", $caldate);
179 $cDay = date("d", $caldate);
181 // compute the previous month date
182 // stay on the same day if possible
183 $pDay = $cDay;
184 $pMonth = $cMonth - 1;
185 $pYear = $cYear;
186 if ($pMonth < 1) { $pMonth = 12; $pYear = $cYear - 1; }
187 while (! checkdate($pMonth, $pDay, $pYear)) { $pDay = $pDay - 1; }
188 $prevMonth = sprintf("%d%02d%02d",$pYear,$pMonth,$pDay);
190 // compute the next month
191 // stay on the same day if possible
192 $nDay = $cDay;
193 $nMonth = $cMonth + 1;
194 $nYear = $cYear;
195 if ($nMonth > 12) { $nMonth = 1; $nYear = $cYear + 1; }
196 while (! checkdate($nMonth, $nDay, $nYear)) { $nDay = $nDay - 1; }
197 $nextMonth = sprintf("%d%02d%02d",$nYear,$nMonth,$nDay);
198 [-/php-]
199 <td class="tdDOW-small tdDatePicker tdNav" id="[-php-]echo $prevMonth[-/php-]" title="[-php-]echo xl(date("F", strtotime($prevMonth)));[-/php-]">&lt;</td>
200 <td colspan="5" class="tdMonthName-small">
201 [-php-]
202 echo xl(date('F', $caldate));
203 [-/php-]
204 </td>
205 <td class="tdDOW-small tdDatePicker tdNav" id="[-php-]echo $nextMonth[-/php-]" title="[-php-]echo xl(date("F", strtotime($nextMonth)));[-/php-]">&gt;</td>
206 <tr>
207 [-php-]
208 foreach ($DOWlist as $dow) {
209 echo "<td class='tdDOW-small'>".$this->_tpl_vars['A_SHORT_DAY_NAMES'][$dow]."</td>";
211 [-/php-]
212 </tr>
213 [-php-]
214 $atmp = array_keys($A_EVENTS);
216 foreach ($atmp as $currdate) {
217 $currdate = strtotime($currdate);
218 if (date('w', $currdate) == $DOWlist[0]) {
219 // start of week row
220 $tr = "<tr>";
221 echo $tr;
224 // set the TD class
225 $tdClass = "tdMonthDay-small";
226 if (date('m', $currdate) != $month) {
227 $tdClass = "tdOtherMonthDay-small";
229 if ((date('w', $currdate) == 0) || (date('w', $currdate) == 6)) {
230 $tdClass = "tdWeekend-small";
233 if (date('Ymd',$currdate) == $Date) {
234 // $Date is defined near the top of this file
235 // and is equal to whatever date the user has clicked
236 $tdClass .= " currentDate";
239 // add a class so that jQuery can grab these days for the 'click' event
240 $tdClass .= " tdDatePicker";
242 // output the TD
243 $td = "<td ";
244 $td .= "class=\"".$tdClass."\" ";
245 //$td .= "id=\"".date("Ymd", $currdate)."\" ";
246 $td .= "id=\"".date("Ymd", $currdate)."\" ";
247 $td .= "title=\"" . xl('Go to') . " ".date('F', $currdate)."\" ";
248 $td .= "> ".date('d', $currdate)."</td>\n";
249 echo $td;
251 // end of week row
252 if (date('w', $currdate) == $DOWlist[6]) echo "</tr>\n";
254 [-/php-]
255 </table>
256 </div>
257 <div id="bigCalHeader">
258 </div>
260 <div id="providerPicker">
261 [-php-] xl('Providers','e'); [-/php-]
262 <div>
263 [-php-]
264 // ==============================
265 // FACILITY FILTERING (lemonsoftware)
266 // $facilities = getFacilities();
267 if ($_SESSION['authorizeduser'] == 1) {
268 $facilities = getFacilities();
269 } else {
270 $facilities = getUserFacilities($_SESSION['authId']); // from users_facility
271 if (count($facilities) == 1)
272 $_SESSION['pc_facility'] = key($facilities);
274 if (count($facilities) > 1) {
275 echo " <select name='pc_facility' id='pc_facility' class='view1' >\n";
276 if ( !$_SESSION['pc_facility'] ) $selected = "selected='selected'";
277 // echo " <option value='0' $selected>" .xl('All Facilities'). "</option>\n";
278 if (!$GLOBALS['restrict_user_facility']) echo " <option value='0' $selected>" . xl('All Facilities') . "</option>\n";
280 foreach ($facilities as $fa) {
281 $selected = ( $_SESSION['pc_facility'] == $fa['id']) ? "selected='selected'" : "" ;
282 echo " <option style=background-color:".htmlspecialchars($fa['color'],ENT_QUOTES)." value='" .htmlspecialchars($fa['id'],ENT_QUOTES). "' $selected>" .htmlspecialchars($fa['name'],ENT_QUOTES). "</option>\n";
284 echo " </select>\n";
286 // EOS FF
287 // ==============================
288 echo "</div>";
289 echo " <select multiple size='5' name='pc_username[]' id='pc_username' class='view2'>\n";
290 echo " <option value='__PC_ALL__'>" .xl ("All Users"). "</option>\n";
291 foreach ($provinfo as $doc) {
292 $username = $doc['username'];
293 echo " <option value='$username'";
294 foreach ($providers as $provider)
295 if ($provider['username'] == $username) echo " selected";
296 echo ">" . htmlspecialchars($doc['lname'],ENT_QUOTES) . ", " . htmlspecialchars($doc['fname'],ENT_QUOTES) . "</option>\n";
298 echo " </select>\n";
300 [-/php-]
301 </div>
302 [-php-]
303 if($_SESSION['pc_facility'] == 0){
304 [-/php-]
305 <div id="facilityColor">
306 <table>
307 [-php-]
308 foreach ($facilities as $f){
309 echo " <tr><td><div class='view1' style=background-color:".$f['color'].";font-weight:bold>".htmlspecialchars($f['name'],ENT_QUOTES)."</div></td></tr>";
311 [-/php-]
312 </table>
313 </div>
314 [-php-]
316 [-/php-]
317 </form>
319 [-assign var="dayname" value=$DATE|date_format:"%w"-]
320 [-assign var="day" value=$DATE|date_format:"%d"|string_format:"%1d"-]
321 [-assign var="month" value=$DATE|date_format:"%m"|string_format:"%1d"-]
322 [-assign var="year" value=$DATE|date_format:"%Y"|string_format:"%4d"-]
323 </div> <!-- end bottomLeft -->
325 <div id="bigCal">
326 [-php-]
327 /* used in debugging
328 foreach ($A_EVENTS as $date => $events) {
329 echo $date." = ";
330 foreach ($events as $oneE) {
331 print_r($oneE);
332 echo "<br><br>";
334 echo "<hr width=100%>";
339 // This loops once for each provider to be displayed.
341 foreach ($providers as $provider) {
342 $providerid = $provider['id'];
344 echo "<table>\n";
345 echo " <tr>\n";
346 echo " <td colspan='7' class='providerheader'>";
347 echo htmlspecialchars($provider['fname'],ENT_QUOTES)." ".htmlspecialchars($provider['lname'],ENT_QUOTES);
348 echo "</td>\n";
349 echo " </tr>\n";
351 // output date headers
352 echo " <tr>\n";
353 $defaultDate = ""; // used when creating link for a 'new' event
354 $in_cat_id = 0; // used when creating link for a 'new' event
355 $dowCount = 0;
356 foreach ($A_EVENTS as $date => $events) {
357 if ($defaultDate == "") $defaultDate = date("Ymd", strtotime($date));
358 echo "<td align='center' class='month_dateheader'>";
359 echo xl(date("D", strtotime($date)));
360 echo "</td>";
361 if ($dowCount++ == 6) { break; }
363 echo " </tr>\n";
365 // For each day...
366 // output a TD with an inner containing DIV positioned 'relative'
368 foreach ($A_EVENTS as $date => $events) {
369 $eventdate = substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2);
371 $gotoURL = pnModURL(__POSTCALENDAR__,'user','view',
372 array('tplview'=>$template_view,
373 'viewtype'=>'day',
374 'Date'=> date("Ymd", strtotime($date)),
375 'pc_username'=>$pc_username,
376 'pc_category'=>$category,
377 'pc_topic'=>$topic));
379 if (date("w", strtotime($date)) == $DOWlist[0]) { echo "<tr>"; }
380 echo "<td class='schedule'>";
382 echo "<div class='calendar_day'>\n";
384 echo "<div class='month_daylink'>";
385 echo "<a href='".$gotoURL."' alt='Go to ".date("d M Y",strtotime($date))."' title='" . xl('Go to') . " " .date("d M Y", strtotime($date))."'>";
386 echo date("d", strtotime($date))."</a></div>";
388 if (count($events) == 0) { echo "&nbsp;"; }
389 //=======================================================================================
390 //=======================================================================================
391 foreach ($events as $event) {
392 // skip events for other providers
393 // yeah, we've got that sort of overhead here... it ain't perfect
394 if ($providerid != $event['aid']) { continue; }
396 // Omit IN and OUT events to reduce clutter in this month view
397 if (($event['catid'] == 2) || ($event['catid'] == 3)) { continue; }
399 // specially handle all-day events
400 if ($event['alldayevent'] == 1) {
401 $tmpTime = $times[0];
402 if (strlen($tmpTime['hour']) < 2) { $tmpTime['hour'] = "0".$tmpTime['hour']; }
403 if (strlen($tmpTime['minute']) < 2) { $tmpTime['minute'] = "0".$tmpTime['minute']; }
404 $event['startTime'] = $tmpTime['hour'].":".$tmpTime['minute'].":00";
405 $event['duration'] = ($calEndMin - $calStartMin) * 60; // measured in seconds
408 // figure the start time and minutes (from midnight)
409 $starth = substr($event['startTime'], 0, 2);
410 $startm = substr($event['startTime'], 3, 2);
411 $eStartMin = $starth * 60 + $startm;
412 $startDateTime = strtotime($date." ".$event['startTime']);
414 // determine the class for the event DIV based on the event category
415 $evtClass = "event_appointment";
416 switch ($event['catid']) {
417 case 1: // NO-SHOW appt
418 $evtClass = "event_noshow";
419 break;
420 case 2: // IN office
421 $evtClass = "event_in";
422 break;
423 case 3: // OUT of office
424 $evtClass = "event_out";
425 break;
426 case 4: // VACATION
427 case 8: // LUNCH
428 case 11: // RESERVED
429 $evtClass = "event_reserved";
430 break;
431 default: // some appointment
432 $evtClass = "event_appointment";
433 break;
436 // now, output the event DIV
438 $eventid = $event['eid'];
439 $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."'");
440 $pccattype = '';
441 if($eventtype['pc_cattype']==1)
442 $pccattype = 'true';
443 $patientid = $event['pid'];
444 $commapos = strpos($event['patient_name'], ",");
445 $lname = substr($event['patient_name'], 0, $commapos);
446 $fname = substr($event['patient_name'], $commapos + 2);
447 $patient_dob = $event['patient_dob'];
448 $patient_age = $event['patient_age'];
449 $catid = $event['catid'];
450 $comment = addslashes($event['hometext']);
451 $catname = $event['catname'];
452 $title = "Age $patient_age ($patient_dob)";
454 // format the time specially
455 $displayTime = date("g", $startDateTime);
456 if (date("i", $startDateTime) == "00") {
457 $displayTime .= (date("a", $startDateTime));
459 else {
460 $displayTime .= (date(":ia", $startDateTime));
463 if ($comment && $GLOBALS['calendar_appt_style'] < 4) $title .= " " . $comment;
465 // the divTitle is what appears when the user hovers the mouse over the DIV
466 $divTitle = dateformat (strtotime($date),true);
467 $result = sqlStatement("SELECT name,id,color FROM facility WHERE id=(SELECT pc_facility FROM openemr_postcalendar_events WHERE pc_eid=".$eventid.")");
468 $row = sqlFetchArray($result);
469 $color=$event["catcolor"];
470 if($GLOBALS['event_color']==2)
471 $color=$row['color'];
472 $divTitle .= "\n" .htmlspecialchars($row['name'],ENT_QUOTES);
473 $content = "";
474 if ($catid == 4 || $catid == 8 || $catid == 11) {
475 if ($catid == 4) $catname = xl("VACATION");
476 else if ($catid == 8) $catname = xl("LUNCH");
477 else if ($catid == 11) $catname = xl("RESERVED");
479 $atitle = $catname;
480 if ($comment) $atitle .= " $comment";
481 $divTitle .= "\n[".$atitle ."]";
482 $content .= $displayTime;
483 $content .= "&nbsp;".$catname;
485 else {
486 // some sort of patient appointment
487 $divTitle .= "\r\n[".$catname.' '.htmlspecialchars($comment, ENT_QUOTES) ."]".htmlspecialchars($fname,ENT_QUOTES)." ".htmlspecialchars($lname,ENT_QUOTES);
488 $content .= $displayTime;
489 if ($patientid) {
490 // include patient name and link to their details
491 $link_title = htmlspecialchars($fname,ENT_QUOTES)." ".htmlspecialchars($lname,ENT_QUOTES). " \n";
492 $link_title .= xl('Age') . ": ".$patient_age."\n" . xl('DOB') . ": ".$patient_dob.htmlspecialchars($comment, ENT_QUOTES)."\n";
493 $link_title .= "(" . xl('Click to view') . ")";
494 $content .= "<a href='javascript:goPid($patientid)' title='$link_title'>";
495 $content .= "<img src='$TPL_IMAGE_PATH/user-green.gif' border='0' title='$link_title' alt='View Patient' />";
496 $content .= "</a>";
498 else {
499 // no patient id, just output the category name
500 $content .= " ".$catname;
503 $divTitle .= "\n(" . xl('double click to edit') . ")";
504 if($_SESSION['pc_facility'] == 0){
505 echo "<div class='".$evtClass." month_event' style='background-color:".$color.
506 "' title='".$divTitle."'".
507 " id='".$eventdate."-".$eventid."-".$pccattype."'".
508 ">";
509 echo $content;
510 echo "</div>\n";
512 elseif($_SESSION['pc_facility'] == $row['id']){
513 echo "<div class='".$evtClass." month_event' style='background-color:".$event["catcolor"].
514 "' title='".$divTitle."'".
515 " id='".$eventdate."-".$eventid."-".$pccattype."'".
516 ">";
517 echo $content;
518 echo "</div>\n";
520 else{
521 echo "<div class='".$evtClass." month_event' style='background-color:#DDDDDD".
522 "' title='".$divTitle."'".
523 " id='".$eventdate."-".$eventid."-".$pccattype."'".
524 ">";
525 echo "<span style='color:red;text-align:center;'>".$displayTime." ".htmlspecialchars($row['name'],ENT_QUOTES)."</span>";
526 echo "</div>\n";
528 } // end EVENT loop
529 //=======================================================================================
530 //=======================================================================================
531 echo "</div>";
532 echo "</td>";
533 if (date("w", strtotime($date)) == $DOWlist[6]) { echo "</tr>"; }
534 } // end date
536 echo "</table>\n";
537 echo "<P>";
538 } // end provider
540 // [-*footer*-]
541 // [-include file="$TPL_NAME/views/global/footer.html"-]
542 // [-include file="$TPL_NAME/views/footer.html"-]
544 [-/php-]
545 </div> <!-- end bigCal DIV -->
547 </body>
549 <script language='JavaScript'>
551 $(document).ready(function(){
552 $("#pc_username").change(function() { ChangeProviders(this); });
553 $("#pc_facility").change(function() { ChangeProviders(this); });
554 $("#dayview").click(function() { ChangeView(this); });
555 $("#weekview").click(function() { ChangeView(this); });
556 //$("#monthview").click(function() { ChangeView(this); });
557 //$("#yearview").click(function() { ChangeView(this); });
558 $(".tdDatePicker").click(function() { ChangeDate(this); });
559 $("#datePicker .tdNav").mouseover(function() { $(this).toggleClass("tdDatePickerHighlight"); });
560 $("#datePicker .tdNav").mouseout(function() { $(this).toggleClass("tdDatePickerHighlight"); });
561 $("#printview").click(function() { PrintView(this); });
562 $(".month_event").dblclick(function() { EditEvent(this); });
563 $(".month_event").mouseover(function() { $(this).toggleClass("event_highlight"); });
564 $(".month_event").mouseout(function() { $(this).toggleClass("event_highlight"); });
567 /* edit an existing event */
568 var EditEvent = function(eObj) {
569 //alert ('editing '+eObj.id);
570 // split the object ID into date and event ID
571 objID = eObj.id;
572 var parts = new Array();
573 parts = objID.split("-");
574 // call the oldEvt function to bring up the event editor
575 oldEvt(parts[0], parts[1], parts[2]);
576 return true;
579 /* pop up a window to print the current view
581 var PrintView = function (eventObject) {
582 printURL = "[-php-]echo pnModURL(__POSTCALENDAR__,'user','view',
583 array('tplview'=>$template_view,
584 'viewtype'=>$viewtype,
585 'Date'=> $Date,
586 'print'=> 1,
587 'pc_username'=>$pc_username,
588 'pc_category'=>$category,
589 'pc_topic'=>$topic));[-/php-]";
590 window.open(printURL,'printwindow','width=740,height=480,toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,copyhistory=no,resizable=yes');
591 return false;
594 /* change the current date based upon what the user clicked in
595 * the datepicker DIV
597 var ChangeDate = function(eObj) {
598 baseURL = "[-php-]echo pnModURL(__POSTCALENDAR__,'user','view',
599 array('tplview'=>$template_view,
600 'viewtype'=>$viewtype,
601 'Date'=> '~REPLACEME~',
602 'pc_username'=>$pc_username,
603 'pc_category'=>$category,
604 'pc_topic'=>$topic));[-/php-]";
605 newURL = baseURL.replace(/~REPLACEME~/, eObj.id);
606 document.location.href=newURL;
609 /* change the provider(s)
611 var ChangeProviders = function (eventObject) {
612 $('#theform').submit();
615 /* change the calendar view
617 var ChangeView = function (eventObject) {
618 if (eventObject.id == "dayview") {
619 $("#viewtype").val('day');
621 else if (eventObject.id == "weekview") {
622 $("#viewtype").val('week');
624 else if (eventObject.id == "monthview") {
625 $("#viewtype").val('month');
627 else if (eventObject.id == "yearview") {
628 $("#viewtype").val('year');
630 $('#theform').submit();
633 </script>
636 </html>