[-*Smarty*-] [-*****************************************************************************-] [-* Copyright (C) 2005-2006 Rod Roark and others *-] [-* *-] [-* This program is free software; you can redistribute it and/or *-] [-* modify it under the terms of the GNU General Public License *-] [-* as published by the Free Software Foundation; either version 2 *-] [-* of the License, or (at your option) any later version. *-] [-*****************************************************************************-] [-config_load file="default.conf"-] [-*Load the Language Definitions*-] [-config_load file="lang.$USER_LANG"-] [-include file="$TPL_NAME/views/header.html"-] [-*Values used in setting timeslot and event heights*-] [-php-] /* if you change these be sure to change their matching values in * the CSS for the calendar, found in interface/themes/ajax_calendar.css */ $timeslotHeightVal=20; $timeslotHeightUnit="px"; [-/php-] [-php-] // this is my proposed setting in the globals config file so we don't // need to mess with altering the pn database AND the config file //pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', $GLOBALS['schedule_dow_start']); // build a day-of-week (DOW) list so we may properly build the calendars later in this code $DOWlist = array(); $tmpDOW = pnModGetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek'); // bound check and auto-correction if ($tmpDOW <0 || $tmpDOW >6) { pnModSetVar(__POSTCALENDAR__, 'pcFirstDayOfWeek', '0'); $tmpDOW = 0; } while (count($DOWlist) < 7) { array_push($DOWlist, $tmpDOW); $tmpDOW++; if ($tmpDOW > 6) $tmpDOW = 0; } // A_CATEGORY is an ordered array of associative-array categories. // Keys of interest are: id, name, color, desc, event_duration. // // echo "\n"; // debugging // echo "\n"; // debugging $A_CATEGORY =& $this->_tpl_vars['A_CATEGORY']; // [-if $PRINT_VIEW != 1-] // [-*Main Navigation*-] // [-include file="$TPL_NAME/views/global/navigation.html"-] // [-/if-] $A_EVENTS =& $this->_tpl_vars['A_EVENTS']; $providers =& $this->_tpl_vars['providers']; $times =& $this->_tpl_vars['times']; $interval = $this->_tpl_vars['interval']; $viewtype = $this->_tpl_vars['VIEW_TYPE']; $PREV_WEEK_URL = $this->_tpl_vars['PREV_WEEK_URL']; $NEXT_WEEK_URL = $this->_tpl_vars['NEXT_WEEK_URL']; $PREV_DAY_URL = $this->_tpl_vars['PREV_DAY_URL']; $NEXT_DAY_URL = $this->_tpl_vars['NEXT_DAY_URL']; $Date = postcalendar_getDate(); if (!isset($y)) $y = substr($Date, 0, 4); if (!isset($m)) $m = substr($Date, 4, 2); if (!isset($d)) $d = substr($Date, 6, 2); // echo "\n"; //================================== //FACILITY FILTERING (CHEMED) $facilities = getUserFacilities($_SESSION['authId']); // from users_facility if ( $_SESSION['pc_facility'] ) { $provinfo = getProviderInfo('%', true, $_SESSION['pc_facility']); } else { $provinfo = getProviderInfo(); } //EOS FACILITY FILTERING (CHEMED) //================================== [-/php-]
[-php-] echo " ".xl("Add")."\n"; echo " ".xl("Search")."\n"; [-/php-]
[-php-] echo xl("Today")[-/php-] [-php-]echo xl ( [-php-]echo xl (   [-php-] echo xl(date('F', strtotime($Date))) . " " . date('Y', strtotime($Date)); [-/php-]
[-php-] // caldate depends on what the user has clicked $caldate = strtotime($Date); $cMonth = date("m", $caldate); $cYear = date("Y", $caldate); $cDay = date("d", $caldate); include_once($GLOBALS['webserver_root'].'/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/monthSelector.php'); [-/php-] [-php-] // compute the previous month date // stay on the same day if possible $pDay = $cDay; $pMonth = $cMonth - 1; $pYear = $cYear; if ($pMonth < 1) { $pMonth = 12; $pYear = $cYear - 1; } while (! checkdate($pMonth, $pDay, $pYear)) { $pDay = $pDay - 1; } $prevMonth = sprintf("%d%02d%02d",$pYear,$pMonth,$pDay); // compute the next month // stay on the same day if possible $nDay = $cDay; $nMonth = $cMonth + 1; $nYear = $cYear; if ($nMonth > 12) { $nMonth = 1; $nYear = $cYear + 1; } while (! checkdate($nMonth, $nDay, $nYear)) { $nDay = $nDay - 1; } $nextMonth = sprintf("%d%02d%02d",$nYear,$nMonth,$nDay); [-/php-] [-php-] foreach ($DOWlist as $dow) { echo ""; } [-/php-] [-php-] $atmp = array_keys($A_EVENTS); foreach ($atmp as $currdate) { $currdate = strtotime($currdate); if (date('w', $currdate) == $DOWlist[0]) { // start of week row $tr = ""; echo $tr; } // set the TD class $tdClass = "tdMonthDay-small"; if (date('m', $currdate) != $month) { $tdClass = "tdOtherMonthDay-small"; } if ((date('w', $currdate) == 0) || (date('w', $currdate) == 6)) { $tdClass = "tdWeekend-small"; } if (date('Ymd',$currdate) == $Date) { // $Date is defined near the top of this file // and is equal to whatever date the user has clicked $tdClass .= " currentDate"; } // add a class so that jQuery can grab these days for the 'click' event $tdClass .= " tdDatePicker"; // output the TD $td = "\n"; } [-/php-]
< [-php-] echo xl(date('F', $caldate)); [-/php-] >
".$this->_tpl_vars['A_SHORT_DAY_NAMES'][$dow]."
\n"; echo $td; // end of week row if (date('w', $currdate) == $DOWlist[6]) echo "
[-php-] xl('Providers','e'); [-/php-]
[-php-] // ============================== // FACILITY FILTERING (lemonsoftware) // $facilities = getFacilities(); if ($_SESSION['authorizeduser'] == 1) { $facilities = getFacilities(); } else { $facilities = getUserFacilities($_SESSION['authId']); // from users_facility if (count($facilities) == 1) $_SESSION['pc_facility'] = key($facilities); } if (count($facilities) > 1) { echo " \n"; } // EOS FF // ============================== echo "
"; echo " \n"; [-/php-]
[-php-] if($_SESSION['pc_facility'] == 0){ [-/php-]
[-php-] foreach ($facilities as $f){ echo " "; } [-/php-]
".htmlspecialchars($f['name'],ENT_QUOTES)."
[-php-] } [-/php-] [-assign var="dayname" value=$DATE|date_format:"%w"-] [-assign var="day" value=$DATE|date_format:"%d"|string_format:"%1d"-] [-assign var="month" value=$DATE|date_format:"%m"|string_format:"%1d"-] [-assign var="year" value=$DATE|date_format:"%Y"|string_format:"%4d"-]
[-php-] /* used in debugging foreach ($A_EVENTS as $date => $events) { echo $date." = "; foreach ($events as $oneE) { print_r($oneE); echo "

"; } echo "
"; } */ // This loops once for each provider to be displayed. // foreach ($providers as $provider) { $providerid = $provider['id']; echo "\n"; echo " \n"; echo " \n"; echo " \n"; // output date headers echo " \n"; $defaultDate = ""; // used when creating link for a 'new' event $in_cat_id = 0; // used when creating link for a 'new' event $dowCount = 0; foreach ($A_EVENTS as $date => $events) { if ($defaultDate == "") $defaultDate = date("Ymd", strtotime($date)); echo ""; if ($dowCount++ == 6) { break; } } echo " \n"; // For each day... // output a TD with an inner containing DIV positioned 'relative' foreach ($A_EVENTS as $date => $events) { $eventdate = substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2); $gotoURL = pnModURL(__POSTCALENDAR__,'user','view', array('tplview'=>$template_view, 'viewtype'=>'day', 'Date'=> date("Ymd", strtotime($date)), 'pc_username'=>$pc_username, 'pc_category'=>$category, 'pc_topic'=>$topic)); if (date("w", strtotime($date)) == $DOWlist[0]) { echo ""; } echo ""; if (date("w", strtotime($date)) == $DOWlist[6]) { echo ""; } } // end date echo "
"; echo htmlspecialchars($provider['fname'],ENT_QUOTES)." ".htmlspecialchars($provider['lname'],ENT_QUOTES); echo "
"; echo xl(date("D", strtotime($date))); echo "
"; echo "
\n"; echo ""; if (count($events) == 0) { echo " "; } //======================================================================================= //======================================================================================= foreach ($events as $event) { // skip events for other providers // yeah, we've got that sort of overhead here... it ain't perfect if ($providerid != $event['aid']) { continue; } // Omit IN and OUT events to reduce clutter in this month view if (($event['catid'] == 2) || ($event['catid'] == 3)) { continue; } // specially handle all-day events if ($event['alldayevent'] == 1) { $tmpTime = $times[0]; if (strlen($tmpTime['hour']) < 2) { $tmpTime['hour'] = "0".$tmpTime['hour']; } if (strlen($tmpTime['minute']) < 2) { $tmpTime['minute'] = "0".$tmpTime['minute']; } $event['startTime'] = $tmpTime['hour'].":".$tmpTime['minute'].":00"; $event['duration'] = ($calEndMin - $calStartMin) * 60; // measured in seconds } // figure the start time and minutes (from midnight) $starth = substr($event['startTime'], 0, 2); $startm = substr($event['startTime'], 3, 2); $eStartMin = $starth * 60 + $startm; $startDateTime = strtotime($date." ".$event['startTime']); // determine the class for the event DIV based on the event category $evtClass = "event_appointment"; switch ($event['catid']) { case 1: // NO-SHOW appt $evtClass = "event_noshow"; break; case 2: // IN office $evtClass = "event_in"; break; case 3: // OUT of office $evtClass = "event_out"; break; case 4: // VACATION case 8: // LUNCH case 11: // RESERVED $evtClass = "event_reserved"; break; default: // some appointment $evtClass = "event_appointment"; break; } // now, output the event DIV $eventid = $event['eid']; $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."'"); $pccattype = ''; if($eventtype['pc_cattype']==1) $pccattype = 'true'; $patientid = $event['pid']; $commapos = strpos($event['patient_name'], ","); $lname = substr($event['patient_name'], 0, $commapos); $fname = substr($event['patient_name'], $commapos + 2); $patient_dob = $event['patient_dob']; $patient_age = $event['patient_age']; $catid = $event['catid']; $comment = addslashes($event['hometext']); $catname = $event['catname']; $title = "Age $patient_age ($patient_dob)"; // format the time specially $displayTime = date("g", $startDateTime); if (date("i", $startDateTime) == "00") { $displayTime .= (date("a", $startDateTime)); } else { $displayTime .= (date(":ia", $startDateTime)); } if ($comment && $GLOBALS['calendar_appt_style'] < 4) $title .= " " . $comment; // the divTitle is what appears when the user hovers the mouse over the DIV $divTitle = dateformat (strtotime($date),true); $result = sqlStatement("SELECT name,id,color FROM facility WHERE id=(SELECT pc_facility FROM openemr_postcalendar_events WHERE pc_eid=".$eventid.")"); $row = sqlFetchArray($result); $color=$event["catcolor"]; if($GLOBALS['event_color']==2) $color=$row['color']; $divTitle .= "\n" .htmlspecialchars($row['name'],ENT_QUOTES); $content = ""; if ($catid == 4 || $catid == 8 || $catid == 11) { if ($catid == 4) $catname = xl("VACATION"); else if ($catid == 8) $catname = xl("LUNCH"); else if ($catid == 11) $catname = xl("RESERVED"); $atitle = $catname; if ($comment) $atitle .= " $comment"; $divTitle .= "\n[".$atitle ."]"; $content .= $displayTime; $content .= " ".$catname; } else { // some sort of patient appointment $divTitle .= "\r\n[".$catname.' '.htmlspecialchars($comment, ENT_QUOTES) ."]".htmlspecialchars($fname,ENT_QUOTES)." ".htmlspecialchars($lname,ENT_QUOTES); $content .= $displayTime; if ($patientid) { // include patient name and link to their details $link_title = htmlspecialchars($fname,ENT_QUOTES)." ".htmlspecialchars($lname,ENT_QUOTES). " \n"; $link_title .= xl('Age') . ": ".$patient_age."\n" . xl('DOB') . ": ".$patient_dob.htmlspecialchars($comment, ENT_QUOTES)."\n"; $link_title .= "(" . xl('Click to view') . ")"; $content .= ""; $content .= "View Patient"; if ($catid == 1) $content .= ""; $content .= htmlspecialchars($lname); if ($GLOBALS['calendar_appt_style'] != 1) { $content .= "," . htmlspecialchars($fname); if ($event['title'] && $GLOBALS['calendar_appt_style'] >= 3) { $content .= "(" . $event['title']; if ($event['hometext'] && $GLOBALS['calendar_appt_style'] >= 4) $content .= ": " . htmlspecialchars(trim($event['hometext'])) . ""; $content .= ")"; } } if ($catid == 1) $content .= ""; $content .= ""; } else { // no patient id, just output the category name $content .= " ".$catname; } } $divTitle .= "\n(" . xl('double click to edit') . ")"; if($_SESSION['pc_facility'] == 0){ echo "
"; echo $content; echo "
\n"; } elseif($_SESSION['pc_facility'] == $row['id']){ echo "
"; echo $content; echo "
\n"; } else{ echo "
"; echo "".$displayTime." ".htmlspecialchars($row['name'],ENT_QUOTES).""; echo "
\n"; } } // end EVENT loop //======================================================================================= //======================================================================================= echo "
"; echo "
\n"; echo "

"; } // end provider // [-*footer*-] // [-include file="$TPL_NAME/views/global/footer.html"-] // [-include file="$TPL_NAME/views/footer.html"-] [-/php-]