Click on time of event to edit event
[openemr.git] / interface / main / calendar / modules / PostCalendar / pntemplates / default / views / month / ajax_template.html
blob0768bf69aba0d5709f1165e44c0e644eaab56dcc
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[-php-]
38 if(isset($_SESSION[pid]))
40 if($_SESSION[pid]>0)
42 echo "+'&patientid=$_SESSION[pid]'";
45 [-/php-]
46 ,'_blank', 575, 375);
49 function oldEvt(eventdate, eventid, pccattype) {
50 dlgopen('add_edit_event.php?date='+eventdate+'&eid=' + eventid+'&prov=' + pccattype, '_blank', 575, 375);
53 function goPid(pid) {
54 top.restoreSession();
55 [-php-]
56 if ($GLOBALS['concurrent_layout'])
59 echo " top.RTop.location = '../../patient_file/summary/demographics.php' " .
60 "+ '?set_pid=' + pid;\n";
62 } else {
63 echo " top.location = '../../patient_file/patient_file.php' " .
64 "+ '?set_pid=' + pid + '&pid=' + pid;\n";
66 [-/php-]
69 function GoToToday(theForm){
70 var todays_date = new Date();
71 var theMonth = todays_date.getMonth() + 1;
72 theMonth = theMonth < 10 ? "0" + theMonth : theMonth;
73 theForm.jumpdate.value = todays_date.getFullYear() + "-" + theMonth + "-" + todays_date.getDate();
74 top.restoreSession();
75 theForm.submit();
78 </script>
80 [-php-]
82 // this is my proposed setting in the globals config file so we don't
83 // need to mess with altering the pn database AND the config file
84 //pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', $GLOBALS['schedule_dow_start']);
86 // build a day-of-week (DOW) list so we may properly build the calendars later in this code
87 $DOWlist = array();
88 $tmpDOW = pnModGetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek');
89 // bound check and auto-correction
90 if ($tmpDOW <0 || $tmpDOW >6) {
91 pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', '0');
92 $tmpDOW = 0;
94 while (count($DOWlist) < 7) {
95 array_push($DOWlist, $tmpDOW);
96 $tmpDOW++;
97 if ($tmpDOW > 6) $tmpDOW = 0;
100 // A_CATEGORY is an ordered array of associative-array categories.
101 // Keys of interest are: id, name, color, desc, event_duration.
103 // echo "<!-- A_CATEGORY = "; print_r($this->_tpl_vars['A_CATEGORY']); echo " -->\n"; // debugging
104 // echo "<!-- A_EVENTS = "; print_r($this->_tpl_vars['A_EVENTS']); echo " -->\n"; // debugging
106 $A_CATEGORY =& $this->_tpl_vars['A_CATEGORY'];
108 // [-if $PRINT_VIEW != 1-]
109 // [-*Main Navigation*-]
110 // [-include file="$TPL_NAME/views/global/navigation.html"-]
111 // [-/if-]
113 $A_EVENTS =& $this->_tpl_vars['A_EVENTS'];
114 $providers =& $this->_tpl_vars['providers'];
115 $times =& $this->_tpl_vars['times'];
116 $interval = $this->_tpl_vars['interval'];
117 $viewtype = $this->_tpl_vars['VIEW_TYPE'];
118 $PREV_WEEK_URL = $this->_tpl_vars['PREV_WEEK_URL'];
119 $NEXT_WEEK_URL = $this->_tpl_vars['NEXT_WEEK_URL'];
120 $PREV_DAY_URL = $this->_tpl_vars['PREV_DAY_URL'];
121 $NEXT_DAY_URL = $this->_tpl_vars['NEXT_DAY_URL'];
123 $Date = postcalendar_getDate();
124 if (!isset($y)) $y = substr($Date, 0, 4);
125 if (!isset($m)) $m = substr($Date, 4, 2);
126 if (!isset($d)) $d = substr($Date, 6, 2);
128 // echo "<!-- There are " . count($A_EVENTS) . " A_EVENTS days -->\n";
130 //==================================
131 //FACILITY FILTERING (CHEMED)
132 $facilities = getUserFacilities($_SESSION['authId']); // from users_facility
133 if ( $_SESSION['pc_facility'] ) {
134 $provinfo = getProviderInfo('%', true, $_SESSION['pc_facility']);
135 } else {
136 $provinfo = getProviderInfo();
138 //EOS FACILITY FILTERING (CHEMED)
139 //==================================
140 [-/php-]
141 <div id="topToolbarRight"> <!-- this wraps some of the top toolbar items -->
142 <div id="functions">
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-]">
147 [-php-]
148 echo " <a href='#' value='" .xl ("Add"). "' onclick='newEvt(1, 9, 00, $Date, 0, 0)' class='css_button'/><span>".xl("Add")."</span></a>\n";
149 echo " <a href='#' value='" . xl ("Search") .
150 "' onclick='top.restoreSession();location=\"index.php?module=PostCalendar&func=search\"' class='css_button'/><span>".xl("Search")."</span></a>\n";
151 [-/php-]
152 </div>
155 <div id="dateNAV"">
156 <a href='#' name='bnsubmit' value='[-php-]echo xl ("Today")[-/php-]' onClick='GoToToday(theform);' class='css_button'/><span>[-php-] echo xl("Today")[-/php-]</span></a>
157 <a href='[-php-]echo $PREV_MONTH_URL[-/php-]' onclick='top.restoreSession()'>
158 <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>
159 <a href='[-php-]echo $NEXT_MONTH_URL[-/php-]' onclick='top.restoreSession()'>
160 <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>
161 &nbsp;
162 [-php-]
163 echo xl(date('F', strtotime($Date))) . " " . date('Y', strtotime($Date));
164 [-/php-]
165 </div>
167 <div id="viewPicker">
168 [-php-]
169 echo " <a href='#' type='button' id='printview' title='" .xl ("Print View"). "' class='css_button'/><span>".xl("Print")."</span></a>\n";
170 echo " <a href='#' type='button' value='" .xl ("Refresh"). "' onclick='javascript:refreshme()' class='css_button'/><span>".xl("Refresh")."</span></a>\n";
171 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";
172 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";
173 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";
174 [-/php-]
175 </div>
176 </div> <!-- end topToolbarRight -->
177 <div id="bottom">
178 <div id="bottomLeft">
179 <div id="datePicker">
180 [-php-]
181 // caldate depends on what the user has clicked
182 $caldate = strtotime($Date);
183 $cMonth = date("m", $caldate);
184 $cYear = date("Y", $caldate);
185 $cDay = date("d", $caldate);
187 include_once($GLOBALS['webserver_root'].'/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/monthSelector.php');
188 [-/php-]
190 <table border="0" cellpadding="0" cellspacing="0">
191 <tr>
192 [-php-]
194 // compute the previous month date
195 // stay on the same day if possible
196 $pDay = $cDay;
197 $pMonth = $cMonth - 1;
198 $pYear = $cYear;
199 if ($pMonth < 1) { $pMonth = 12; $pYear = $cYear - 1; }
200 while (! checkdate($pMonth, $pDay, $pYear)) { $pDay = $pDay - 1; }
201 $prevMonth = sprintf("%d%02d%02d",$pYear,$pMonth,$pDay);
203 // compute the next month
204 // stay on the same day if possible
205 $nDay = $cDay;
206 $nMonth = $cMonth + 1;
207 $nYear = $cYear;
208 if ($nMonth > 12) { $nMonth = 1; $nYear = $cYear + 1; }
209 while (! checkdate($nMonth, $nDay, $nYear)) { $nDay = $nDay - 1; }
210 $nextMonth = sprintf("%d%02d%02d",$nYear,$nMonth,$nDay);
211 [-/php-]
212 <td class="tdDOW-small tdDatePicker tdNav" id="[-php-]echo $prevMonth[-/php-]" title="[-php-]echo xl(date("F", strtotime($prevMonth)));[-/php-]">&lt;</td>
213 <td colspan="5" class="tdMonthName-small">
214 [-php-]
215 echo xl(date('F', $caldate));
216 [-/php-]
217 </td>
218 <td class="tdDOW-small tdDatePicker tdNav" id="[-php-]echo $nextMonth[-/php-]" title="[-php-]echo xl(date("F", strtotime($nextMonth)));[-/php-]">&gt;</td>
219 <tr>
220 [-php-]
221 foreach ($DOWlist as $dow) {
222 echo "<td class='tdDOW-small'>".$this->_tpl_vars['A_SHORT_DAY_NAMES'][$dow]."</td>";
224 [-/php-]
225 </tr>
226 [-php-]
227 $atmp = array_keys($A_EVENTS);
229 foreach ($atmp as $currdate) {
230 $currdate = strtotime($currdate);
231 if (date('w', $currdate) == $DOWlist[0]) {
232 // start of week row
233 $tr = "<tr>";
234 echo $tr;
237 // set the TD class
238 $tdClass = "tdMonthDay-small";
239 if (date('m', $currdate) != $month) {
240 $tdClass = "tdOtherMonthDay-small";
242 if ((date('w', $currdate) == 0) || (date('w', $currdate) == 6)) {
243 $tdClass = "tdWeekend-small";
246 if (date('Ymd',$currdate) == $Date) {
247 // $Date is defined near the top of this file
248 // and is equal to whatever date the user has clicked
249 $tdClass .= " currentDate";
252 // add a class so that jQuery can grab these days for the 'click' event
253 $tdClass .= " tdDatePicker";
255 // output the TD
256 $td = "<td ";
257 $td .= "class=\"".$tdClass."\" ";
258 //$td .= "id=\"".date("Ymd", $currdate)."\" ";
259 $td .= "id=\"".date("Ymd", $currdate)."\" ";
260 $td .= "title=\"" . xl('Go to') . " ".date('F', $currdate)."\" ";
261 $td .= "> ".date('d', $currdate)."</td>\n";
262 echo $td;
264 // end of week row
265 if (date('w', $currdate) == $DOWlist[6]) echo "</tr>\n";
267 [-/php-]
268 </table>
269 </div>
270 <div id="bigCalHeader">
271 </div>
273 <div id="providerPicker">
274 [-php-] xl('Providers','e'); [-/php-]
275 <div>
276 [-php-]
277 // ==============================
278 // FACILITY FILTERING (lemonsoftware)
279 // $facilities = getFacilities();
280 if ($_SESSION['authorizeduser'] == 1) {
281 $facilities = getFacilities();
282 } else {
283 $facilities = getUserFacilities($_SESSION['authId']); // from users_facility
284 if (count($facilities) == 1)
285 $_SESSION['pc_facility'] = key($facilities);
287 if (count($facilities) > 1) {
288 echo " <select name='pc_facility' id='pc_facility' class='view1' >\n";
289 if ( !$_SESSION['pc_facility'] ) $selected = "selected='selected'";
290 // echo " <option value='0' $selected>" .xl('All Facilities'). "</option>\n";
291 if (!$GLOBALS['restrict_user_facility']) echo " <option value='0' $selected>" . xl('All Facilities') . "</option>\n";
293 foreach ($facilities as $fa) {
294 $selected = ( $_SESSION['pc_facility'] == $fa['id']) ? "selected='selected'" : "" ;
295 echo " <option style=background-color:".htmlspecialchars($fa['color'],ENT_QUOTES)." value='" .htmlspecialchars($fa['id'],ENT_QUOTES). "' $selected>" .htmlspecialchars($fa['name'],ENT_QUOTES). "</option>\n";
297 echo " </select>\n";
299 // EOS FF
300 // ==============================
301 echo "</div>";
302 echo " <select multiple size='5' name='pc_username[]' id='pc_username' class='view2'>\n";
303 echo " <option value='__PC_ALL__'>" .xl ("All Users"). "</option>\n";
304 foreach ($provinfo as $doc) {
305 $username = $doc['username'];
306 echo " <option value='$username'";
307 foreach ($providers as $provider)
308 if ($provider['username'] == $username) echo " selected";
309 echo ">" . htmlspecialchars($doc['lname'],ENT_QUOTES) . ", " . htmlspecialchars($doc['fname'],ENT_QUOTES) . "</option>\n";
311 echo " </select>\n";
313 [-/php-]
314 </div>
315 [-php-]
316 if($_SESSION['pc_facility'] == 0){
317 [-/php-]
318 <div id="facilityColor">
319 <table>
320 [-php-]
321 foreach ($facilities as $f){
322 echo " <tr><td><div class='view1' style=background-color:".$f['color'].";font-weight:bold>".htmlspecialchars($f['name'],ENT_QUOTES)."</div></td></tr>";
324 [-/php-]
325 </table>
326 </div>
327 [-php-]
329 [-/php-]
330 </form>
332 [-assign var="dayname" value=$DATE|date_format:"%w"-]
333 [-assign var="day" value=$DATE|date_format:"%d"|string_format:"%1d"-]
334 [-assign var="month" value=$DATE|date_format:"%m"|string_format:"%1d"-]
335 [-assign var="year" value=$DATE|date_format:"%Y"|string_format:"%4d"-]
336 </div> <!-- end bottomLeft -->
338 <div id="bigCal">
339 [-php-]
340 /* used in debugging
341 foreach ($A_EVENTS as $date => $events) {
342 echo $date." = ";
343 foreach ($events as $oneE) {
344 print_r($oneE);
345 echo "<br><br>";
347 echo "<hr width=100%>";
352 // This loops once for each provider to be displayed.
354 foreach ($providers as $provider) {
355 $providerid = $provider['id'];
357 echo "<table>\n";
358 echo " <tr>\n";
359 echo " <td colspan='7' class='providerheader'>";
360 echo htmlspecialchars($provider['fname'],ENT_QUOTES)." ".htmlspecialchars($provider['lname'],ENT_QUOTES);
361 echo "</td>\n";
362 echo " </tr>\n";
364 // output date headers
365 echo " <tr>\n";
366 $defaultDate = ""; // used when creating link for a 'new' event
367 $in_cat_id = 0; // used when creating link for a 'new' event
368 $dowCount = 0;
369 foreach ($A_EVENTS as $date => $events) {
370 if ($defaultDate == "") $defaultDate = date("Ymd", strtotime($date));
371 echo "<td align='center' class='month_dateheader'>";
372 echo xl(date("D", strtotime($date)));
373 echo "</td>";
374 if ($dowCount++ == 6) { break; }
376 echo " </tr>\n";
378 // For each day...
379 // output a TD with an inner containing DIV positioned 'relative'
381 foreach ($A_EVENTS as $date => $events) {
382 $eventdate = substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2);
384 $gotoURL = pnModURL(__POSTCALENDAR__,'user','view',
385 array('tplview'=>$template_view,
386 'viewtype'=>'day',
387 'Date'=> date("Ymd", strtotime($date)),
388 'pc_username'=>$pc_username,
389 'pc_category'=>$category,
390 'pc_topic'=>$topic));
392 if (date("w", strtotime($date)) == $DOWlist[0]) { echo "<tr>"; }
393 echo "<td class='schedule'>";
395 echo "<div class='calendar_day'>\n";
397 echo "<div class='month_daylink'>";
398 echo "<a href='".$gotoURL."' alt='Go to ".date("d M Y",strtotime($date))."' title='" . xl('Go to') . " " .date("d M Y", strtotime($date))."'>";
399 echo date("d", strtotime($date))."</a></div>";
401 if (count($events) == 0) { echo "&nbsp;"; }
402 //=======================================================================================
403 //=======================================================================================
404 foreach ($events as $event) {
405 // skip events for other providers
406 // yeah, we've got that sort of overhead here... it ain't perfect
407 if ($providerid != $event['aid']) { continue; }
409 // Omit IN and OUT events to reduce clutter in this month view
410 if (($event['catid'] == 2) || ($event['catid'] == 3)) { continue; }
412 // specially handle all-day events
413 if ($event['alldayevent'] == 1) {
414 $tmpTime = $times[0];
415 if (strlen($tmpTime['hour']) < 2) { $tmpTime['hour'] = "0".$tmpTime['hour']; }
416 if (strlen($tmpTime['minute']) < 2) { $tmpTime['minute'] = "0".$tmpTime['minute']; }
417 $event['startTime'] = $tmpTime['hour'].":".$tmpTime['minute'].":00";
418 $event['duration'] = ($calEndMin - $calStartMin) * 60; // measured in seconds
421 // figure the start time and minutes (from midnight)
422 $starth = substr($event['startTime'], 0, 2);
423 $startm = substr($event['startTime'], 3, 2);
424 $eStartMin = $starth * 60 + $startm;
425 $startDateTime = strtotime($date." ".$event['startTime']);
427 // determine the class for the event DIV based on the event category
428 $evtClass = "event_appointment";
429 switch ($event['catid']) {
430 case 1: // NO-SHOW appt
431 $evtClass = "event_noshow";
432 break;
433 case 2: // IN office
434 $evtClass = "event_in";
435 break;
436 case 3: // OUT of office
437 $evtClass = "event_out";
438 break;
439 case 4: // VACATION
440 case 8: // LUNCH
441 case 11: // RESERVED
442 $evtClass = "event_reserved";
443 break;
444 default: // some appointment
445 $evtClass = "event_appointment";
446 break;
449 // now, output the event DIV
451 $eventid = $event['eid'];
452 $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."'");
453 $pccattype = '';
454 if($eventtype['pc_cattype']==1)
455 $pccattype = 'true';
456 $patientid = $event['pid'];
457 $commapos = strpos($event['patient_name'], ",");
458 $lname = substr($event['patient_name'], 0, $commapos);
459 $fname = substr($event['patient_name'], $commapos + 2);
460 $patient_dob = $event['patient_dob'];
461 $patient_age = $event['patient_age'];
462 $catid = $event['catid'];
463 $comment = addslashes($event['hometext']);
464 $catname = $event['catname'];
465 $title = "Age $patient_age ($patient_dob)";
467 // format the time specially
468 $displayTime = date("g", $startDateTime);
469 if (date("i", $startDateTime) == "00") {
470 $displayTime .= (date("a", $startDateTime));
472 else {
473 $displayTime .= (date(":ia", $startDateTime));
476 if ($comment && $GLOBALS['calendar_appt_style'] < 4) $title .= " " . $comment;
478 // the divTitle is what appears when the user hovers the mouse over the DIV
479 $divTitle = dateformat (strtotime($date),true);
480 $result = sqlStatement("SELECT name,id,color FROM facility WHERE id=(SELECT pc_facility FROM openemr_postcalendar_events WHERE pc_eid=".$eventid.")");
481 $row = sqlFetchArray($result);
482 $color=$event["catcolor"];
483 if($GLOBALS['event_color']==2)
484 $color=$row['color'];
485 $divTitle .= "\n" .htmlspecialchars($row['name'],ENT_QUOTES);
486 $content = "";
487 if ($catid == 4 || $catid == 8 || $catid == 11) {
488 if ($catid == 4) $catname = xl("VACATION");
489 else if ($catid == 8) $catname = xl("LUNCH");
490 else if ($catid == 11) $catname = xl("RESERVED");
492 $atitle = $catname;
493 if ($comment) $atitle .= " $comment";
494 $divTitle .= "\n[".$atitle ."]";
495 $content .= $displayTime;
496 $content .= "&nbsp;".$catname;
498 else {
499 // some sort of patient appointment
500 $divTitle .= "\r\n[".$catname.' '.htmlspecialchars($comment, ENT_QUOTES) ."]".htmlspecialchars($fname,ENT_QUOTES)." ".htmlspecialchars($lname,ENT_QUOTES);
501 $content .= create_event_time_anchor($displayTime);
502 if ($patientid) {
503 // include patient name and link to their details
504 $link_title = htmlspecialchars($fname,ENT_QUOTES)." ".htmlspecialchars($lname,ENT_QUOTES). " \n";
505 $link_title .= xl('Age') . ": ".$patient_age."\n" . xl('DOB') . ": ".$patient_dob.htmlspecialchars($comment, ENT_QUOTES)."\n";
506 $link_title .= "(" . xl('Click to view') . ")";
507 $content .= "<a href='javascript:goPid($patientid)' title='$link_title'>";
508 $content .= "<img src='$TPL_IMAGE_PATH/user-green.gif' border='0' title='$link_title' alt='View Patient' />";
509 if ($catid == 1) $content .= "<strike>";
510 $content .= htmlspecialchars($lname);
511 if ($GLOBALS['calendar_appt_style'] != 1) {
512 $content .= "," . htmlspecialchars($fname);
513 if ($event['title'] && $GLOBALS['calendar_appt_style'] >= 3) {
514 $content .= "(" . $event['title'];
515 if ($event['hometext'] && $GLOBALS['calendar_appt_style'] >= 4)
516 $content .= ": <font color='green'>" . htmlspecialchars(trim($event['hometext'])) . "</font>";
517 $content .= ")";
520 if ($catid == 1) $content .= "</strike>";
521 $content .= "</a>";
523 else {
524 // no patient id, just output the category name
525 $content .= " ".$catname;
528 $divTitle .= "\n(" . xl('double click to edit') . ")";
529 if($_SESSION['pc_facility'] == 0){
530 echo "<div class='".$evtClass." month_event' style='background-color:".$color.
531 "' title='".$divTitle."'".
532 " id='".$eventdate."-".$eventid."-".$pccattype."'".
533 ">";
534 echo $content;
535 echo "</div>\n";
537 elseif($_SESSION['pc_facility'] == $row['id']){
538 echo "<div class='".$evtClass." month_event' style='background-color:".$event["catcolor"].
539 "' title='".$divTitle."'".
540 " id='".$eventdate."-".$eventid."-".$pccattype."'".
541 ">";
542 echo $content;
543 echo "</div>\n";
545 else{
546 echo "<div class='".$evtClass." month_event' style='background-color:#DDDDDD".
547 "' title='".$divTitle."'".
548 " id='".$eventdate."-".$eventid."-".$pccattype."'".
549 ">";
550 echo "<span style='color:red;text-align:center;'>".$displayTime." ".htmlspecialchars($row['name'],ENT_QUOTES)."</span>";
551 echo "</div>\n";
553 } // end EVENT loop
554 //=======================================================================================
555 //=======================================================================================
556 echo "</div>";
557 echo "</td>";
558 if (date("w", strtotime($date)) == $DOWlist[6]) { echo "</tr>"; }
559 } // end date
561 echo "</table>\n";
562 echo "<P>";
563 } // end provider
565 // [-*footer*-]
566 // [-include file="$TPL_NAME/views/global/footer.html"-]
567 // [-include file="$TPL_NAME/views/footer.html"-]
569 [-/php-]
570 </div> <!-- end bigCal DIV -->
571 </div> <!-- end bottom DIV -->
572 </body>
574 <script language='JavaScript'>
576 $(document).ready(function(){
577 $("#pc_username").change(function() { ChangeProviders(this); });
578 $("#pc_facility").change(function() { ChangeProviders(this); });
579 $("#dayview").click(function() { ChangeView(this); });
580 $("#weekview").click(function() { ChangeView(this); });
581 //$("#monthview").click(function() { ChangeView(this); });
582 //$("#yearview").click(function() { ChangeView(this); });
583 $(".tdDatePicker").click(function() { ChangeDate(this); });
584 $("#datePicker .tdNav").mouseover(function() { $(this).toggleClass("tdDatePickerHighlight"); });
585 $("#datePicker .tdNav").mouseout(function() { $(this).toggleClass("tdDatePickerHighlight"); });
586 $("#printview").click(function() { PrintView(this); });
587 $(".month_event").dblclick(function() { EditEvent(this); });
588 $(".month_event").mouseover(function() { $(this).toggleClass("event_highlight"); });
589 $(".month_event").mouseout(function() { $(this).toggleClass("event_highlight"); });
591 $(".tdMonthName-small").click(function() {
593 dpCal=$("#datePicker>table");
594 mp = $("#monthPicker"); mp.width(dpCal.width()); mp.toggle();});
598 /* edit an existing event */
599 var EditEvent = function(eObj) {
600 //alert ('editing '+eObj.id);
601 // split the object ID into date and event ID
602 objID = eObj.id;
603 var parts = new Array();
604 parts = objID.split("-");
605 // call the oldEvt function to bring up the event editor
606 oldEvt(parts[0], parts[1], parts[2]);
607 return true;
610 /* pop up a window to print the current view
612 var PrintView = function (eventObject) {
613 printURL = "[-php-]echo pnModURL(__POSTCALENDAR__,'user','view',
614 array('tplview'=>$template_view,
615 'viewtype'=>$viewtype,
616 'Date'=> $Date,
617 'print'=> 1,
618 'pc_username'=>$pc_username,
619 'pc_category'=>$category,
620 'pc_topic'=>$topic));[-/php-]";
621 window.open(printURL,'printwindow','width=740,height=480,toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,copyhistory=no,resizable=yes');
622 return false;
625 /* change the current date based upon what the user clicked in
626 * the datepicker DIV
628 var ChangeDate = function(eObj) {
629 baseURL = "[-php-]echo pnModURL(__POSTCALENDAR__,'user','view',
630 array('tplview'=>$template_view,
631 'viewtype'=>$viewtype,
632 'Date'=> '~REPLACEME~',
633 'pc_username'=>$pc_username,
634 'pc_category'=>$category,
635 'pc_topic'=>$topic));[-/php-]";
636 newURL = baseURL.replace(/~REPLACEME~/, eObj.id);
637 document.location.href=newURL;
640 /* change the provider(s)
642 var ChangeProviders = function (eventObject) {
643 $('#theform').submit();
646 /* change the calendar view
648 var ChangeView = function (eventObject) {
649 if (eventObject.id == "dayview") {
650 $("#viewtype").val('day');
652 else if (eventObject.id == "weekview") {
653 $("#viewtype").val('week');
655 else if (eventObject.id == "monthview") {
656 $("#viewtype").val('month');
658 else if (eventObject.id == "yearview") {
659 $("#viewtype").val('year');
661 $('#theform').submit();
664 </script>
667 </html>