From 97be6b420707590159d77592fe3c7ecb1919f228 Mon Sep 17 00:00:00 2001 From: Tony McCormick Date: Fri, 6 Aug 2010 22:37:37 -0700 Subject: [PATCH] Revert "Merge branch 'fmc-custom' of github.com:tmccormi/openemr" This reverts commit b0231af6922f86c003c53086bc7a76493f5c9f16, reversing changes made to dcff0e1f6cc819f543b5486e9b52850275992cf4. --- .../default/views/day/ajax_template.html | 1551 ++++++++++--------- .../default/views/month/ajax_template.html | 1199 ++++++++------- .../default/views/week/ajax_template.html | 1573 ++++++++++---------- interface/main/left_nav.php | 189 ++- interface/patient_file/summary/demographics2.php | 742 --------- interface/patient_file/summary/immunizations.php | 107 +- interface/reports/billing_enc_summary.php | 376 ----- interface/reports/clinical_reports.php | 878 ----------- interface/reports/misc_report1.php | 374 ----- interface/reports/misc_report2.php | 335 ----- interface/reports/misc_report3.php | 563 ------- interface/reports/patient_research.php | 558 ------- interface/reports/payment_summary.php | 369 ----- sql/3_2_0-to-4_0_0_upgrade.sql | 14 +- sql/database.sql | 5 +- 15 files changed, 2277 insertions(+), 6556 deletions(-) delete mode 100644 interface/patient_file/summary/demographics2.php delete mode 100644 interface/reports/billing_enc_summary.php delete mode 100644 interface/reports/clinical_reports.php delete mode 100644 interface/reports/misc_report1.php delete mode 100644 interface/reports/misc_report2.php delete mode 100644 interface/reports/misc_report3.php delete mode 100644 interface/reports/patient_research.php delete mode 100644 interface/reports/payment_summary.php diff --git a/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/day/ajax_template.html b/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/day/ajax_template.html index e85aadca0..593d47a9a 100644 --- a/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/day/ajax_template.html +++ b/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/day/ajax_template.html @@ -1,776 +1,775 @@ -[-*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']; - // $S_EVENTS =& $this->_tpl_vars['S_EVENTS']; // Deleted by Rod - $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"; - - $MULTIDAY = count($A_EVENTS) > 1; - -//================================== -//FACILITY FILTERING (CHEMED) -$facilities = getUserFacilities($_SESSION['authId']); // from users_facility -if (count($facilities) == 1 || !$_SESSION['pc_facility']) { - $_SESSION['pc_facility'] = $facilities[0]['id']; -} -if ( $_SESSION['pc_facility'] ) { - $provinfo = getProviderInfo('%', true, $_SESSION['pc_facility']); -} else { - $provinfo = getProviderInfo(); -} -//EOS FACILITY FILTERING (CHEMED) -//================================== - -[-/php-] - -
- -
- - -[-php-] -echo " \n"; -echo " \n"; -[-/php-] -
- -
- -
- -[-php-]echo xl ( - -[-php-]echo xl ( -  - -
- -
-[-php-]echo xl ( -  -[-php-]echo xl ( -  -[-php-]echo xl ( -  -[-php-]echo xl ( -
-
- -
- - - -[-php-] -$atmp = array_keys($A_EVENTS); -$caldate = strtotime($atmp[0]); -$cMonth = date("m", $caldate); -$cYear = date("Y", $caldate); -$cDay = date("d", $caldate); - -// 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); -$caldate = strtotime($atmp[0]); -$caldateEnd = strtotime($atmp[6]); - -// to make a complete week row we need to compute the real -// start and end dates for the view -list ($year, $month, $day) = explode(" ", date('Y m d', $caldate)); -$startdate = strtotime($year.$month."01"); -$enddate = strtotime($year.$month.date("t", $startdate)." 23:59"); -while (date('w', $startdate) != $DOWlist[0]) { $startdate -= 60*60*24; } -while (date('w', $enddate) != $DOWlist[6]) { $enddate += 60*60*24; } - -$currdate = $startdate; -while ($currdate <= $enddate) { - 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"; - - // time correction = plus 1000 seconds, for some unknown reason - $currdate += (60*60*24)+1000; -} -[-/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-] -$atmp = array_keys($A_EVENTS); -echo date('d M Y', strtotime($atmp[0])); -[-/php-] -
- -
-[-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-] -
- - - -[-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"-] - -[-pc_sort_events var="S_EVENTS" sort="time" order="asc" value=$A_EVENTS-] - -
-[-php-] - -echo "\n"; - -// output the TD with the times DIV -echo ""; -echo ""; - - -// This loops once for each provider to be displayed. -// -foreach ($providers as $provider) { - $providerid = $provider['id']; - - // to specially handle the IN/OUT events I'm doing something new here - // for each IN event it will have a duration lasting until the next - // OUT event or until the end of the day - $tmpTime = $times[0]; - $calStartMin = ($tmpTime['hour'] * 60) + $tmpTime['minute']; - $tmpTime = $times[count($times)-1]; - $calEndMin = ($tmpTime['hour'] * 60) + $tmpTime['minute']; - - // having a 'title' for the TD makes the date appear by the mouse pointer - // this is nice when all you see are times on the left side and no head - // row with the dates or day-of-week (DOW) - echo "\n"; - -} // end provider loop - -echo " \n"; -echo "
\n"; -echo ""; -foreach ($times as $slottime) { - $startampm = ($slottime['mer']) == "pm" ? 2 : 1; - $starttimeh = $slottime['hour']; - $disptimeh = ($starttimeh > 12) ? ($starttimeh - 12) : $starttimeh; - $starttimem = $slottime['minute']; - $slotendmins = $starttimeh * 60 + $starttimem + $interval; - - // default to the first displayed provider - $providerid = $providers[0]['id']; - - echo "\n"; -} -echo "
 
"; - echo ""; - echo "$disptimeh:$starttimem"; - echo ""; - echo "
"; - echo "
"; - echo $provider['fname']." ".$provider['lname']."
"; - echo "
"; - - // For each event... - // output a TD with an inner containing DIV positioned 'relative' - // within that DIV we place our event DIVs using 'absolute' positioning - foreach ($A_EVENTS as $date => $events) { - $eventdate = substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2); - - // determine if events overlap and adjust their width and left position as needed - // 26 Feb 2008 - This needs fine tuning or total replacement - // - it doesn't work as well as I'd like - JRM - $eventPositions = array(); - foreach ($times as $slottime) { - $starttimeh = $slottime['hour']; - $starttimem = $slottime['minute']; - - $slotstartmins = $starttimeh * 60 + $starttimem; - $slotendmins = $starttimeh * 60 + $starttimem + $interval; - - $events_in_timeslot = array(); - foreach ($events as $e1) { - // ignore IN and OUT events - if (($e1['catid'] == 2) || ($e1['catid'] == 3)) { continue; } - // skip events without an ID (why they are in the loop, I have no idea) - if ($e1['eid'] == "") { continue; } - // skip events for other providers - if ($providerid != $e1['aid']) { continue; } - - // specially handle all-day events - if ($e1['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']; } - $e1['startTime'] = $tmpTime['hour'].":".$tmpTime['minute'].":00"; - $e1['duration'] = ($calEndMin - $calStartMin) * 60; // measured in seconds - } - - // create a numeric start and end for comparison - $starth = substr($e1['startTime'], 0, 2); - $startm = substr($e1['startTime'], 3, 2); - $e1Start = ($starth * 60) + $startm; - $e1End = $e1Start + $e1['duration']/60; - - // three ways to overlap: - // start-in, end-in, span - if ((($e1Start >= $slotstartmins) && ($e1Start < $slotendmins)) // start-in - || (($e1End > $slotstartmins) && ($e1End <= $slotendmins)) // end-in - || (($e1Start < $slotstartmins) && ($e1End > $slotendmins))) // span - { - array_push($events_in_timeslot, $e1['eid']); - } - } - $leftpos = 0; - $width = 100 / count($events_in_timeslot); - - // loop over the events in this timeslot and adjust their width - foreach ($events_in_timeslot as $eid) { - // set the width if not already set or if the current width is smaller - // than was was previously set - if (! isset($eventPositions[$eid]->width)) { $eventPositions[$eid]->width = $width; } - else if ($eventPositions[$eid]->width > $width) { $eventPositions[$eid]->width = $width; } - - // set the left position if not already set or if the current left is - // greater than what was previously set - if (! isset($eventPositions[$eid]->leftpos)) { $eventPositions[$eid]->leftpos = $leftpos; } - else if ($eventPositions[$eid]->leftpos < $leftpos) { $eventPositions[$eid]->leftpos = $leftpos; } - - // increment the leftpos by the width - $leftpos += $width; - } - } // end overlap detection - - // now loop over the events for the day and output their DIVs - 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; } - - // skip events without an ID (why they are in the loop, I have no idea) - if ($event['eid'] == "") { 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; - $dispstarth = ($starth > 12) ? ($starth - 12) : $starth; // used to display the hour - - // 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; - } - - // if this is an IN or OUT event then we have some extra special - // processing to be done - // the IN event creates a DIV until the OUT event - // or, without an OUT DIV matching the IN event - // then the IN event runs until the end of the day - if ($event['catid'] == 2) { - // locate a matching OUT for this specific IN - $found = false; - $outMins = 0; - foreach ($events as $outevent) { - // skip events for other providers - if ($providerid != $outevent['aid']) { continue; } - // skip events with blank IDs - if ($outevent['eid'] == "") { continue; } - - if ($outevent['eid'] == $event['eid']) { $found = true; continue; } - if (($found == true) && ($outevent['catid'] == 3)) { - // calculate the duration from this event to the outevent - $outH = substr($outevent['startTime'], 0, 2); - $outM = substr($outevent['startTime'], 3, 2); - $outMins = ($outH * 60) + $outM; - $event['duration'] = ($outMins - $eStartMin) * 60; // duration is in seconds - $found = 2; - break; - } - } - if ($outMins == 0) { - // no OUT was found so this event's duration goes - // until the end of the day - $event['duration'] = ($calEndMin - $eStartMin) * 60; // duration is in seconds - } - } - - // calculate the TOP value for the event DIV - // diff between event start and schedule start - $eMinDiff = $eStartMin - $calStartMin; - // diff divided by the time interval of the schedule - $eStartInterval = $eMinDiff / $interval; - // times the interval height - $eStartPos = $eStartInterval * $timeslotHeightVal; - $evtTop = $eStartPos.$timeslotHeightUnit; - - // calculate the HEIGHT value for the event DIV - // diff between end and start of event - $eEndMin = $eStartMin + ($event['duration']/60); - // prevent the overall height of the event from going beyond the bounds - // of the time table - if ($eEndMin > $calEndMin) { $eEndMin = $calEndMin + $interval; } - $eMinDiff = $eEndMin - $eStartMin; - // diff divided by the time interval of the schedule - $eEndInterval = $eMinDiff / $interval; - // times the interval height - $eHeight = $eEndInterval * $timeslotHeightVal; - $evtHeight = $eHeight.$timeslotHeightUnit; - - // determine the DIV width based on any overlapping events - // see further above for the overlapping calculation code - $divWidth = ""; - $divLeft = ""; - if (isset($eventPositions[$event['eid']])) { - $divWidth = "width: ".$eventPositions[$event['eid']]->width."%"; - $divLeft = "left: ".$eventPositions[$event['eid']]->leftpos."%"; - } - - $eventid = $event['eid']; - $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)"; - - $content = ""; - - if ($comment && $GLOBALS['calendar_appt_style'] < 4) $title .= " " . $comment; - - // the divTitle is what appears when the user hovers the mouse over the DIV - $divTitle = $provider['fname']." ".$provider['lname']; - - if ($catid == 2 || $catid == 3 || $catid == 4 || $catid == 8 || $catid == 11) { - if ($catid == 2) $catname = xl("IN"); - else if ($catid == 3) $catname = xl("OUT"); - else 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 .= $catname; - if ($event['recurrtype'] == 1) $content .= "Repeating event"; - if ($comment) $content .= " $comment"; - } - else { - // some sort of patient appointment - $divTitle .= "\r\n[".$catname ."] ".htmlspecialchars($fname, ENT_QUOTES)." ".htmlspecialchars($lname, ENT_QUOTES) . " | Comment:" . $comment . " "; - $content .= ""; - $content .= $dispstarth . ':' . $startm; - if ($event['recurrtype'] == 1) $content .= "Repeating event"; - // $content .= htmlspecialchars($event['apptstatus']); - $content .= ' '.htmlspecialchars($event['apptstatus']); - if ($patientid) { - $link_title = xl('Age') . ": " . $patient_age . "\n" . xl('DOB') . ": " . $patient_dob . "\n"; - if ($comment) $link_title .= "$comment"; - $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; - } - $content .= ""; - } - - $divTitle .= "\n(" . xl('double click to edit') . ")"; - - // a special case for the 'IN' event this puts the time ABOVE - // the normal DIV so it doesn't overlap another event DIV and include the time - if ($event['catid'] == 2) { - $inTop = ($eStartPos - $timeslotHeightVal).$timeslotHeightUnit; - echo "
"; - $content = $dispstarth . ':' . $startm . " " . $content; - echo $content; - echo "
\n"; - } - - // output the DIV and content - echo "
"; - // second part for the special IN event - if ($event['catid'] != 2) { echo $content; } - echo "
\n"; - } // end EVENT loop - - echo "
"; - - } // end date - - echo "
\n"; -echo "

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

- - - - - - - +[-*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']; + // $S_EVENTS =& $this->_tpl_vars['S_EVENTS']; // Deleted by Rod + $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"; + + $MULTIDAY = count($A_EVENTS) > 1; + +//================================== +//FACILITY FILTERING (CHEMED) +$facilities = getUserFacilities($_SESSION['authId']); // from users_facility +if (count($facilities) == 1 || !$_SESSION['pc_facility']) { + $_SESSION['pc_facility'] = $facilities[0]['id']; +} +if ( $_SESSION['pc_facility'] ) { + $provinfo = getProviderInfo('%', true, $_SESSION['pc_facility']); +} else { + $provinfo = getProviderInfo(); +} +//EOS FACILITY FILTERING (CHEMED) +//================================== + +[-/php-] + +
+ +
+ + +[-php-] +echo " \n"; +echo " \n"; +[-/php-] +
+ +
+ +
+ +[-php-]echo xl ( + +[-php-]echo xl ( +  + +
+ +
+[-php-]echo xl ( +  +[-php-]echo xl ( +  +[-php-]echo xl ( +  +[-php-]echo xl ( +
+
+ +
+ + + +[-php-] +$atmp = array_keys($A_EVENTS); +$caldate = strtotime($atmp[0]); +$cMonth = date("m", $caldate); +$cYear = date("Y", $caldate); +$cDay = date("d", $caldate); + +// 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); +$caldate = strtotime($atmp[0]); +$caldateEnd = strtotime($atmp[6]); + +// to make a complete week row we need to compute the real +// start and end dates for the view +list ($year, $month, $day) = explode(" ", date('Y m d', $caldate)); +$startdate = strtotime($year.$month."01"); +$enddate = strtotime($year.$month.date("t", $startdate)." 23:59"); +while (date('w', $startdate) != $DOWlist[0]) { $startdate -= 60*60*24; } +while (date('w', $enddate) != $DOWlist[6]) { $enddate += 60*60*24; } + +$currdate = $startdate; +while ($currdate <= $enddate) { + 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"; + + // time correction = plus 1000 seconds, for some unknown reason + $currdate += (60*60*24)+1000; +} +[-/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-] +$atmp = array_keys($A_EVENTS); +echo date('d M Y', strtotime($atmp[0])); +[-/php-] +
+ +
+[-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-] +
+ + + +[-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"-] + +[-pc_sort_events var="S_EVENTS" sort="time" order="asc" value=$A_EVENTS-] + +
+[-php-] + +echo "\n"; + +// output the TD with the times DIV +echo ""; +echo ""; + + +// This loops once for each provider to be displayed. +// +foreach ($providers as $provider) { + $providerid = $provider['id']; + + // to specially handle the IN/OUT events I'm doing something new here + // for each IN event it will have a duration lasting until the next + // OUT event or until the end of the day + $tmpTime = $times[0]; + $calStartMin = ($tmpTime['hour'] * 60) + $tmpTime['minute']; + $tmpTime = $times[count($times)-1]; + $calEndMin = ($tmpTime['hour'] * 60) + $tmpTime['minute']; + + // having a 'title' for the TD makes the date appear by the mouse pointer + // this is nice when all you see are times on the left side and no head + // row with the dates or day-of-week (DOW) + echo "\n"; + +} // end provider loop + +echo " \n"; +echo "
\n"; +echo ""; +foreach ($times as $slottime) { + $startampm = ($slottime['mer']) == "pm" ? 2 : 1; + $starttimeh = $slottime['hour']; + $disptimeh = ($starttimeh > 12) ? ($starttimeh - 12) : $starttimeh; + $starttimem = $slottime['minute']; + $slotendmins = $starttimeh * 60 + $starttimem + $interval; + + // default to the first displayed provider + $providerid = $providers[0]['id']; + + echo "\n"; +} +echo "
 
"; + echo ""; + echo "$disptimeh:$starttimem"; + echo ""; + echo "
"; + echo "
"; + echo $provider['fname']." ".$provider['lname']."
"; + echo "
"; + + // For each event... + // output a TD with an inner containing DIV positioned 'relative' + // within that DIV we place our event DIVs using 'absolute' positioning + foreach ($A_EVENTS as $date => $events) { + $eventdate = substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2); + + // determine if events overlap and adjust their width and left position as needed + // 26 Feb 2008 - This needs fine tuning or total replacement + // - it doesn't work as well as I'd like - JRM + $eventPositions = array(); + foreach ($times as $slottime) { + $starttimeh = $slottime['hour']; + $starttimem = $slottime['minute']; + + $slotstartmins = $starttimeh * 60 + $starttimem; + $slotendmins = $starttimeh * 60 + $starttimem + $interval; + + $events_in_timeslot = array(); + foreach ($events as $e1) { + // ignore IN and OUT events + if (($e1['catid'] == 2) || ($e1['catid'] == 3)) { continue; } + // skip events without an ID (why they are in the loop, I have no idea) + if ($e1['eid'] == "") { continue; } + // skip events for other providers + if ($providerid != $e1['aid']) { continue; } + + // specially handle all-day events + if ($e1['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']; } + $e1['startTime'] = $tmpTime['hour'].":".$tmpTime['minute'].":00"; + $e1['duration'] = ($calEndMin - $calStartMin) * 60; // measured in seconds + } + + // create a numeric start and end for comparison + $starth = substr($e1['startTime'], 0, 2); + $startm = substr($e1['startTime'], 3, 2); + $e1Start = ($starth * 60) + $startm; + $e1End = $e1Start + $e1['duration']/60; + + // three ways to overlap: + // start-in, end-in, span + if ((($e1Start >= $slotstartmins) && ($e1Start < $slotendmins)) // start-in + || (($e1End > $slotstartmins) && ($e1End <= $slotendmins)) // end-in + || (($e1Start < $slotstartmins) && ($e1End > $slotendmins))) // span + { + array_push($events_in_timeslot, $e1['eid']); + } + } + $leftpos = 0; + $width = 100 / count($events_in_timeslot); + + // loop over the events in this timeslot and adjust their width + foreach ($events_in_timeslot as $eid) { + // set the width if not already set or if the current width is smaller + // than was was previously set + if (! isset($eventPositions[$eid]->width)) { $eventPositions[$eid]->width = $width; } + else if ($eventPositions[$eid]->width > $width) { $eventPositions[$eid]->width = $width; } + + // set the left position if not already set or if the current left is + // greater than what was previously set + if (! isset($eventPositions[$eid]->leftpos)) { $eventPositions[$eid]->leftpos = $leftpos; } + else if ($eventPositions[$eid]->leftpos < $leftpos) { $eventPositions[$eid]->leftpos = $leftpos; } + + // increment the leftpos by the width + $leftpos += $width; + } + } // end overlap detection + + // now loop over the events for the day and output their DIVs + 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; } + + // skip events without an ID (why they are in the loop, I have no idea) + if ($event['eid'] == "") { 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; + $dispstarth = ($starth > 12) ? ($starth - 12) : $starth; // used to display the hour + + // 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; + } + + // if this is an IN or OUT event then we have some extra special + // processing to be done + // the IN event creates a DIV until the OUT event + // or, without an OUT DIV matching the IN event + // then the IN event runs until the end of the day + if ($event['catid'] == 2) { + // locate a matching OUT for this specific IN + $found = false; + $outMins = 0; + foreach ($events as $outevent) { + // skip events for other providers + if ($providerid != $outevent['aid']) { continue; } + // skip events with blank IDs + if ($outevent['eid'] == "") { continue; } + + if ($outevent['eid'] == $event['eid']) { $found = true; continue; } + if (($found == true) && ($outevent['catid'] == 3)) { + // calculate the duration from this event to the outevent + $outH = substr($outevent['startTime'], 0, 2); + $outM = substr($outevent['startTime'], 3, 2); + $outMins = ($outH * 60) + $outM; + $event['duration'] = ($outMins - $eStartMin) * 60; // duration is in seconds + $found = 2; + break; + } + } + if ($outMins == 0) { + // no OUT was found so this event's duration goes + // until the end of the day + $event['duration'] = ($calEndMin - $eStartMin) * 60; // duration is in seconds + } + } + + // calculate the TOP value for the event DIV + // diff between event start and schedule start + $eMinDiff = $eStartMin - $calStartMin; + // diff divided by the time interval of the schedule + $eStartInterval = $eMinDiff / $interval; + // times the interval height + $eStartPos = $eStartInterval * $timeslotHeightVal; + $evtTop = $eStartPos.$timeslotHeightUnit; + + // calculate the HEIGHT value for the event DIV + // diff between end and start of event + $eEndMin = $eStartMin + ($event['duration']/60); + // prevent the overall height of the event from going beyond the bounds + // of the time table + if ($eEndMin > $calEndMin) { $eEndMin = $calEndMin + $interval; } + $eMinDiff = $eEndMin - $eStartMin; + // diff divided by the time interval of the schedule + $eEndInterval = $eMinDiff / $interval; + // times the interval height + $eHeight = $eEndInterval * $timeslotHeightVal; + $evtHeight = $eHeight.$timeslotHeightUnit; + + // determine the DIV width based on any overlapping events + // see further above for the overlapping calculation code + $divWidth = ""; + $divLeft = ""; + if (isset($eventPositions[$event['eid']])) { + $divWidth = "width: ".$eventPositions[$event['eid']]->width."%"; + $divLeft = "left: ".$eventPositions[$event['eid']]->leftpos."%"; + } + + $eventid = $event['eid']; + $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)"; + + $content = ""; + + if ($comment && $GLOBALS['calendar_appt_style'] < 4) $title .= " " . $comment; + + // the divTitle is what appears when the user hovers the mouse over the DIV + $divTitle = $provider['fname']." ".$provider['lname']; + + if ($catid == 2 || $catid == 3 || $catid == 4 || $catid == 8 || $catid == 11) { + if ($catid == 2) $catname = xl("IN"); + else if ($catid == 3) $catname = xl("OUT"); + else 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 .= $catname; + if ($event['recurrtype'] == 1) $content .= "Repeating event"; + if ($comment) $content .= " $comment"; + } + else { + // some sort of patient appointment + $divTitle .= "\r\n[".$catname ."] ".htmlspecialchars($fname, ENT_QUOTES)." ".htmlspecialchars($lname, ENT_QUOTES); + $content .= ""; + $content .= $dispstarth . ':' . $startm; + if ($event['recurrtype'] == 1) $content .= "Repeating event"; + // $content .= htmlspecialchars($event['apptstatus']); + $content .= ' '.htmlspecialchars($event['apptstatus']); + if ($patientid) { + $link_title = xl('Age') . ": " . $patient_age . "\n" . xl('DOB') . ": " . $patient_dob . "\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; + } + $content .= ""; + } + + $divTitle .= "\n(" . xl('double click to edit') . ")"; + + // a special case for the 'IN' event this puts the time ABOVE + // the normal DIV so it doesn't overlap another event DIV and include the time + if ($event['catid'] == 2) { + $inTop = ($eStartPos - $timeslotHeightVal).$timeslotHeightUnit; + echo "
"; + $content = $dispstarth . ':' . $startm . " " . $content; + echo $content; + echo "
\n"; + } + + // output the DIV and content + echo "
"; + // second part for the special IN event + if ($event['catid'] != 2) { echo $content; } + echo "
\n"; + } // end EVENT loop + + echo "
"; + + } // end date + + echo "
\n"; +echo "

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

+ + + + + + + diff --git a/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/month/ajax_template.html b/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/month/ajax_template.html index 64624daba..78f1abf85 100644 --- a/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/month/ajax_template.html +++ b/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/month/ajax_template.html @@ -1,600 +1,599 @@ -[-*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 (count($facilities) == 1 || !$_SESSION['pc_facility']) { - $_SESSION['pc_facility'] = $facilities[0]['id']; - } - if ( $_SESSION['pc_facility'] ) { - $provinfo = getProviderInfo('%', true, $_SESSION['pc_facility']); - } else { - $provinfo = getProviderInfo(); - } - //EOS FACILITY FILTERING (CHEMED) - //================================== -[-/php-] - -
- -
- - -[-php-] -echo " \n"; -echo " \n"; -[-/php-] -
- -
- -
- -[-php-]echo xl ( - -[-php-]echo xl ( -  - -
- -
-  -[-php-]echo xl ( -  -[-php-]echo xl ( -  -[-php-]echo xl ( -  -[-php-]echo xl ( -
-
- -
- - -[-php-] -// caldate depends on what the user has clicked -$caldate = strtotime($Date); -$cMonth = date("m", $caldate); -$cYear = date("Y", $caldate); -$cDay = date("d", $caldate); - -// 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-] -echo xl(date('F', strtotime($Date))) . " " . date('Y', strtotime($Date)); -[-/php-] -
- -
-[-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-] -
- - - -[-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 $provider['fname']." ".$provider['lname']; - 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']; - $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 = date("D, d M Y", strtotime($date)); - - $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($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."\n"; - if ($comment) $link_title .= "$comment"; - $link_title .= "(" . xl('Click to view') . ")"; - $content .= ""; - $content .= "View Patient"; - $content .= ""; - } - else { - // no patient id, just output the category name - $content .= " ".$catname; - } - } - $divTitle .= "\n(" . xl('double click to edit') . ")"; - - echo "
"; - echo $content; - 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-] -

- - - - - - - +[-*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 (count($facilities) == 1 || !$_SESSION['pc_facility']) { + $_SESSION['pc_facility'] = $facilities[0]['id']; + } + if ( $_SESSION['pc_facility'] ) { + $provinfo = getProviderInfo('%', true, $_SESSION['pc_facility']); + } else { + $provinfo = getProviderInfo(); + } + //EOS FACILITY FILTERING (CHEMED) + //================================== +[-/php-] + +
+ +
+ + +[-php-] +echo " \n"; +echo " \n"; +[-/php-] +
+ +
+ +
+ +[-php-]echo xl ( + +[-php-]echo xl ( +  + +
+ +
+  +[-php-]echo xl ( +  +[-php-]echo xl ( +  +[-php-]echo xl ( +  +[-php-]echo xl ( +
+
+ +
+ + +[-php-] +// caldate depends on what the user has clicked +$caldate = strtotime($Date); +$cMonth = date("m", $caldate); +$cYear = date("Y", $caldate); +$cDay = date("d", $caldate); + +// 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-] +echo xl(date('F', strtotime($Date))) . " " . date('Y', strtotime($Date)); +[-/php-] +
+ +
+[-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-] +
+ + + +[-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 $provider['fname']." ".$provider['lname']; + 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']; + $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 = date("D, d M Y", strtotime($date)); + + $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($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."\n"; + $link_title .= "(" . xl('Click to view') . ")"; + $content .= ""; + $content .= "View Patient"; + $content .= ""; + } + else { + // no patient id, just output the category name + $content .= " ".$catname; + } + } + $divTitle .= "\n(" . xl('double click to edit') . ")"; + + echo "
"; + echo $content; + 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-] +

+ + + + + + + diff --git a/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/week/ajax_template.html b/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/week/ajax_template.html index accea8f7c..dea017398 100644 --- a/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/week/ajax_template.html +++ b/interface/main/calendar/modules/PostCalendar/pntemplates/default/views/week/ajax_template.html @@ -1,787 +1,786 @@ -[-*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 (count($facilities) == 1 || !$_SESSION['pc_facility']) { - $_SESSION['pc_facility'] = $facilities[0]['id']; - } - if ( $_SESSION['pc_facility'] ) { - $provinfo = getProviderInfo('%', true, $_SESSION['pc_facility']); - } else { - $provinfo = getProviderInfo(); - } - //EOS FACILITY FILTERING (CHEMED) - //================================== - -[-/php-] - -
- -
- - -[-php-] -echo " \n"; -echo " \n"; -[-/php-] -
- -
- -
- -[-php-]echo xl ( - -[-php-]echo xl ( -  - -
- -
-[-php-]echo xl ( -  -[-php-]echo xl ( -  -[-php-]echo xl ( -  -[-php-]echo xl ( -
-
- -
- - - -[-php-] -$atmp = array_keys($A_EVENTS); -$caldate = strtotime($atmp[0]); -$cMonth = date("m", $caldate); -$cYear = date("Y", $caldate); -$cDay = date("d", $caldate); - -// 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); -$caldate = strtotime($atmp[0]); -$caldateEnd = strtotime($atmp[6]); - -// to make a complete week row we need to compute the real -// start and end dates for the view -list ($year, $month, $day) = explode(" ", date('Y m d', $caldate)); -$startdate = strtotime($year.$month."01"); -$enddate = strtotime($year.$month.date("t", $startdate)." 23:59"); -while (date('w', $startdate) != $DOWlist[0]) { $startdate -= 60*60*24; } -while (date('w', $enddate) != $DOWlist[6]) { $enddate += 60*60*24; } - -$currdate = $startdate; -while ($currdate <= $enddate) { - 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('Ymd', $caldate)) && - (date('Ymd',$currdate) <= date('Ymd', $caldateEnd))) - { - // add a class that highlights the 'current date' - $tdClass .= " currentWeek"; - } - - 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"; - - // time correction = plus 1000 seconds, for some unknown reason - $currdate += (60*60*24)+1000; -} -[-/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-] -$atmp = array_keys($A_EVENTS); -echo date('d M Y', strtotime($atmp[0])); -echo " - "; -echo date('d M Y', strtotime($atmp[count($atmp)-1])); -[-/php-] -
- -
-[-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-] -
- - - -[-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']; - - // to specially handle the IN/OUT events I'm doing something new here - // for each IN event it will have a duration lasting until the next - // OUT event or until the end of the day - $tmpTime = $times[0]; - $calStartMin = ($tmpTime['hour'] * 60) + $tmpTime['minute']; - $tmpTime = $times[count($times)-1]; - $calEndMin = ($tmpTime['hour'] * 60) + $tmpTime['minute']; - - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - - // output column (date) headers - $colWidth = 100/7; // intentionally '7' and not '8' - echo " \n"; - echo " "; // blank TD for the header above the Times column - $defaultDate = ""; // used when creating link for a 'new' event - $in_cat_id = 0; // used when creating link for a 'new' event - foreach ($A_EVENTS as $date => $events) { - $dateFmt = date("Ymd", strtotime($date)); - $gotoURL = pnModURL(__POSTCALENDAR__,'user','view', - array('tplview'=>$template_view, - 'viewtype'=>'day', - 'Date'=> $dateFmt, - 'pc_username'=>$pc_username, - 'pc_category'=>$category, - 'pc_topic'=>$topic)); - if ($defaultDate == "") $defaultDate = $dateFmt; - $currclass = ""; - if ($Date == $dateFmt) { $currclass= "week_currday"; } - echo ""; - } - echo " \n"; - - // output the TD with the times DIV - echo ""; - echo ""; - - // For each day... - // output a TD with an inner containing DIV positioned 'relative' - // within that DIV we place our event DIVs using 'absolute' positioning - foreach ($A_EVENTS as $date => $events) { - $eventdate = substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2); - - // having a 'title' for the TD makes the date appear by the mouse pointer - // this is nice when all you see are times on the left side and no head - // row with the dates or day-of-week (DOW) - echo "\n"; - - } // end date - - echo " \n"; - - echo "
"; - echo $provider['fname'] . " " . $provider['lname']; - echo "
 "; - echo ""; - echo xl(date("D", strtotime($date))) . " " . date("m/d", strtotime($date)); - echo "
\n"; - foreach ($times as $slottime) { - $startampm = ($slottime['mer']) == "pm" ? 2 : 1; - $starttimeh = $slottime['hour']; - $disptimeh = ($starttimeh > 12) ? ($starttimeh - 12) : $starttimeh; - $starttimem = $slottime['minute']; - $slotendmins = $starttimeh * 60 + $starttimem + $interval; - - echo "\n"; - } - echo "
"; -// echo ""; - echo ""; - - //echo $slottime['hour'] * 60 + $slottime['minute']; - echo "$disptimeh:$starttimem"; - echo "
"; - echo "
"; - - // determine if events overlap and adjust their width and left position as needed - // 26 Feb 2008 - This needs fine tuning or total replacement - // - it doesn't work as well as I'd like - JRM - $eventPositions = array(); - foreach ($times as $slottime) { - $starttimeh = $slottime['hour']; - $starttimem = $slottime['minute']; - - $slotstartmins = $starttimeh * 60 + $starttimem; - $slotendmins = $starttimeh * 60 + $starttimem + $interval; - - $events_in_timeslot = array(); - foreach ($events as $e1) { - // ignore IN and OUT events - if (($e1['catid'] == 2) || ($e1['catid'] == 3)) { continue; } - // skip events without an ID (why they are in the loop, I have no idea) - if ($e1['eid'] == "") { continue; } - // skip events for other providers - if ($providerid != $e1['aid']) { continue; } - - // specially handle all-day events - if ($e1['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']; } - $e1['startTime'] = $tmpTime['hour'].":".$tmpTime['minute'].":00"; - $e1['duration'] = ($calEndMin - $calStartMin) * 60; // measured in seconds - } - - // create a numeric start and end for comparison - $starth = substr($e1['startTime'], 0, 2); - $startm = substr($e1['startTime'], 3, 2); - $e1Start = ($starth * 60) + $startm; - $e1End = $e1Start + $e1['duration']/60; - - // three ways to overlap: - // start-in, end-in, span - if ((($e1Start >= $slotstartmins) && ($e1Start < $slotendmins)) // start-in - || (($e1End > $slotstartmins) && ($e1End <= $slotendmins)) // end-in - || (($e1Start < $slotstartmins) && ($e1End > $slotendmins))) // span - { - array_push($events_in_timeslot, $e1['eid']); - } - } - - $leftpos = 0; - $width = 100 / count($events_in_timeslot); - - // loop over the events in this timeslot and adjust their width - foreach ($events_in_timeslot as $eid) { - // set the width if not already set or if the current width is smaller - // than was was previously set - if (! isset($eventPositions[$eid]->width)) { $eventPositions[$eid]->width = $width; } - else if ($eventPositions[$eid]->width > $width) { $eventPositions[$eid]->width = $width; } - - // set the left position if not already set or if the current left is - // greater than what was previously set - if (! isset($eventPositions[$eid]->leftpos)) { $eventPositions[$eid]->leftpos = $leftpos; } - else if ($eventPositions[$eid]->leftpos < $leftpos) { $eventPositions[$eid]->leftpos = $leftpos; } - - // increment the leftpos by the width - $leftpos += $width; - } - } // end overlap detection - - // now loop over the events for the day and output their DIVs - 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; } - - // skip events without an ID (why they are in the loop, I have no idea) - if ($event['eid'] == "") { 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; - $dispstarth = ($starth > 12) ? ($starth - 12) : $starth; - - // 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; - } - - // if this is an IN or OUT event then we have some extra special - // processing to be done - // the IN event creates a DIV until the OUT event - // or, without an OUT DIV matching the IN event - // then the IN event runs until the end of the day - if ($event['catid'] == 2) { - // locate a matching OUT for this specific IN - $found = false; - $outMins = 0; - foreach ($events as $outevent) { - // skip events for other providers - if ($providerid != $outevent['aid']) { continue; } - // skip events with blank IDs - if ($outevent['eid'] == "") { continue; } - - if ($outevent['eid'] == $event['eid']) { $found = true; continue; } - if (($found == true) && ($outevent['catid'] == 3)) { - // calculate the duration from this event to the outevent - $outH = substr($outevent['startTime'], 0, 2); - $outM = substr($outevent['startTime'], 3, 2); - $outMins = ($outH * 60) + $outM; - $event['duration'] = ($outMins - $eStartMin) * 60; // duration is in seconds - $found = 2; - break; - } - } - if ($outMins == 0) { - // no OUT was found so this event's duration goes - // until the end of the day - $event['duration'] = ($calEndMin - $eStartMin) * 60; // duration is in seconds - } - } - - // calculate the TOP value for the event DIV - // diff between event start and schedule start - $eMinDiff = $eStartMin - $calStartMin; - // diff divided by the time interval of the schedule - $eStartInterval = $eMinDiff / $interval; - // times the interval height - $eStartPos = $eStartInterval * $timeslotHeightVal; - $evtTop = $eStartPos.$timeslotHeightUnit; - - // calculate the HEIGHT value for the event DIV - // diff between end and start of event - $eEndMin = $eStartMin + ($event['duration']/60); - // prevent the overall height of the event from going beyond the bounds - // of the time table - if ($eEndMin > $calEndMin) { $eEndMin = $calEndMin + $interval; } - $eMinDiff = $eEndMin - $eStartMin; - // diff divided by the time interval of the schedule - $eEndInterval = $eMinDiff / $interval; - // times the interval height - $eHeight = $eEndInterval * $timeslotHeightVal; - $evtHeight = $eHeight.$timeslotHeightUnit; - - // determine the DIV width based on any overlapping events - // see further above for the overlapping calculation code - $divWidth = ""; - $divLeft = ""; - if (isset($eventPositions[$event['eid']])) { - $divWidth = "width: ".$eventPositions[$event['eid']]->width."%"; - $divLeft = "left: ".$eventPositions[$event['eid']]->leftpos."%"; - } - - $eventid = $event['eid']; - $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)"; - - $content = ""; - - if ($comment && $GLOBALS['calendar_appt_style'] < 4) $title .= " " . $comment; - - // the divTitle is what appears when the user hovers the mouse over the DIV - $divTitle = date("D, d M Y", strtotime($date)); - - if ($catid == 2 || $catid == 3 || $catid == 4 || $catid == 8 || $catid == 11) { - if ($catid == 2) $catname = xl("IN"); - else if ($catid == 3) $catname = xl("OUT"); - else 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 ."] ".$divTitle; - $divTitle .= "\n[".$atitle ."]"; - //$content .= ""; - $content .= $catname; - if ($event['recurrtype'] == 1) $content .= "Repeating event"; - if ($comment) $content .= " $comment"; - //$content .= ""; - } - else { - // some sort of patient appointment - $divTitle .= "\r\n[".$catname ."] ".htmlspecialchars($fname,ENT_QUOTES)." ".htmlspecialchars($lname,ENT_QUOTES); - $content .= ""; - $content .= $dispstarth . ':' . $startm; - if ($event['recurrtype'] == 1) $content .= "Repeating event"; - $content .= htmlspecialchars($event['apptstatus']); - 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."\n"; - if ($comment) $link_title .= "$comment"; - $link_title .= "(" . xl('Click to view') . ")"; - $content .= ""; - $content .= "View Patient"; - $content .= ""; - } - else { - // no patient id, just output the category name - $content .= $catname; - } - $content .= ""; - } - - $divTitle .= "\n(" . xl('double click to edit') . ")"; - - // output the DIV and content - echo "
"; - echo $content; - 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-] -

- - - - - - - +[-*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 (count($facilities) == 1 || !$_SESSION['pc_facility']) { + $_SESSION['pc_facility'] = $facilities[0]['id']; + } + if ( $_SESSION['pc_facility'] ) { + $provinfo = getProviderInfo('%', true, $_SESSION['pc_facility']); + } else { + $provinfo = getProviderInfo(); + } + //EOS FACILITY FILTERING (CHEMED) + //================================== + +[-/php-] + +
+ +
+ + +[-php-] +echo " \n"; +echo " \n"; +[-/php-] +
+ +
+ +
+ +[-php-]echo xl ( + +[-php-]echo xl ( +  + +
+ +
+[-php-]echo xl ( +  +[-php-]echo xl ( +  +[-php-]echo xl ( +  +[-php-]echo xl ( +
+
+ +
+ + + +[-php-] +$atmp = array_keys($A_EVENTS); +$caldate = strtotime($atmp[0]); +$cMonth = date("m", $caldate); +$cYear = date("Y", $caldate); +$cDay = date("d", $caldate); + +// 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); +$caldate = strtotime($atmp[0]); +$caldateEnd = strtotime($atmp[6]); + +// to make a complete week row we need to compute the real +// start and end dates for the view +list ($year, $month, $day) = explode(" ", date('Y m d', $caldate)); +$startdate = strtotime($year.$month."01"); +$enddate = strtotime($year.$month.date("t", $startdate)." 23:59"); +while (date('w', $startdate) != $DOWlist[0]) { $startdate -= 60*60*24; } +while (date('w', $enddate) != $DOWlist[6]) { $enddate += 60*60*24; } + +$currdate = $startdate; +while ($currdate <= $enddate) { + 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('Ymd', $caldate)) && + (date('Ymd',$currdate) <= date('Ymd', $caldateEnd))) + { + // add a class that highlights the 'current date' + $tdClass .= " currentWeek"; + } + + 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"; + + // time correction = plus 1000 seconds, for some unknown reason + $currdate += (60*60*24)+1000; +} +[-/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-] +$atmp = array_keys($A_EVENTS); +echo date('d M Y', strtotime($atmp[0])); +echo " - "; +echo date('d M Y', strtotime($atmp[count($atmp)-1])); +[-/php-] +
+ +
+[-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-] +
+ + + +[-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']; + + // to specially handle the IN/OUT events I'm doing something new here + // for each IN event it will have a duration lasting until the next + // OUT event or until the end of the day + $tmpTime = $times[0]; + $calStartMin = ($tmpTime['hour'] * 60) + $tmpTime['minute']; + $tmpTime = $times[count($times)-1]; + $calEndMin = ($tmpTime['hour'] * 60) + $tmpTime['minute']; + + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + + // output column (date) headers + $colWidth = 100/7; // intentionally '7' and not '8' + echo " \n"; + echo " "; // blank TD for the header above the Times column + $defaultDate = ""; // used when creating link for a 'new' event + $in_cat_id = 0; // used when creating link for a 'new' event + foreach ($A_EVENTS as $date => $events) { + $dateFmt = date("Ymd", strtotime($date)); + $gotoURL = pnModURL(__POSTCALENDAR__,'user','view', + array('tplview'=>$template_view, + 'viewtype'=>'day', + 'Date'=> $dateFmt, + 'pc_username'=>$pc_username, + 'pc_category'=>$category, + 'pc_topic'=>$topic)); + if ($defaultDate == "") $defaultDate = $dateFmt; + $currclass = ""; + if ($Date == $dateFmt) { $currclass= "week_currday"; } + echo ""; + } + echo " \n"; + + // output the TD with the times DIV + echo ""; + echo ""; + + // For each day... + // output a TD with an inner containing DIV positioned 'relative' + // within that DIV we place our event DIVs using 'absolute' positioning + foreach ($A_EVENTS as $date => $events) { + $eventdate = substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2); + + // having a 'title' for the TD makes the date appear by the mouse pointer + // this is nice when all you see are times on the left side and no head + // row with the dates or day-of-week (DOW) + echo "\n"; + + } // end date + + echo " \n"; + + echo "
"; + echo $provider['fname'] . " " . $provider['lname']; + echo "
 "; + echo ""; + echo xl(date("D", strtotime($date))) . " " . date("m/d", strtotime($date)); + echo "
\n"; + foreach ($times as $slottime) { + $startampm = ($slottime['mer']) == "pm" ? 2 : 1; + $starttimeh = $slottime['hour']; + $disptimeh = ($starttimeh > 12) ? ($starttimeh - 12) : $starttimeh; + $starttimem = $slottime['minute']; + $slotendmins = $starttimeh * 60 + $starttimem + $interval; + + echo "\n"; + } + echo "
"; +// echo ""; + echo ""; + + //echo $slottime['hour'] * 60 + $slottime['minute']; + echo "$disptimeh:$starttimem"; + echo "
"; + echo "
"; + + // determine if events overlap and adjust their width and left position as needed + // 26 Feb 2008 - This needs fine tuning or total replacement + // - it doesn't work as well as I'd like - JRM + $eventPositions = array(); + foreach ($times as $slottime) { + $starttimeh = $slottime['hour']; + $starttimem = $slottime['minute']; + + $slotstartmins = $starttimeh * 60 + $starttimem; + $slotendmins = $starttimeh * 60 + $starttimem + $interval; + + $events_in_timeslot = array(); + foreach ($events as $e1) { + // ignore IN and OUT events + if (($e1['catid'] == 2) || ($e1['catid'] == 3)) { continue; } + // skip events without an ID (why they are in the loop, I have no idea) + if ($e1['eid'] == "") { continue; } + // skip events for other providers + if ($providerid != $e1['aid']) { continue; } + + // specially handle all-day events + if ($e1['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']; } + $e1['startTime'] = $tmpTime['hour'].":".$tmpTime['minute'].":00"; + $e1['duration'] = ($calEndMin - $calStartMin) * 60; // measured in seconds + } + + // create a numeric start and end for comparison + $starth = substr($e1['startTime'], 0, 2); + $startm = substr($e1['startTime'], 3, 2); + $e1Start = ($starth * 60) + $startm; + $e1End = $e1Start + $e1['duration']/60; + + // three ways to overlap: + // start-in, end-in, span + if ((($e1Start >= $slotstartmins) && ($e1Start < $slotendmins)) // start-in + || (($e1End > $slotstartmins) && ($e1End <= $slotendmins)) // end-in + || (($e1Start < $slotstartmins) && ($e1End > $slotendmins))) // span + { + array_push($events_in_timeslot, $e1['eid']); + } + } + + $leftpos = 0; + $width = 100 / count($events_in_timeslot); + + // loop over the events in this timeslot and adjust their width + foreach ($events_in_timeslot as $eid) { + // set the width if not already set or if the current width is smaller + // than was was previously set + if (! isset($eventPositions[$eid]->width)) { $eventPositions[$eid]->width = $width; } + else if ($eventPositions[$eid]->width > $width) { $eventPositions[$eid]->width = $width; } + + // set the left position if not already set or if the current left is + // greater than what was previously set + if (! isset($eventPositions[$eid]->leftpos)) { $eventPositions[$eid]->leftpos = $leftpos; } + else if ($eventPositions[$eid]->leftpos < $leftpos) { $eventPositions[$eid]->leftpos = $leftpos; } + + // increment the leftpos by the width + $leftpos += $width; + } + } // end overlap detection + + // now loop over the events for the day and output their DIVs + 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; } + + // skip events without an ID (why they are in the loop, I have no idea) + if ($event['eid'] == "") { 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; + $dispstarth = ($starth > 12) ? ($starth - 12) : $starth; + + // 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; + } + + // if this is an IN or OUT event then we have some extra special + // processing to be done + // the IN event creates a DIV until the OUT event + // or, without an OUT DIV matching the IN event + // then the IN event runs until the end of the day + if ($event['catid'] == 2) { + // locate a matching OUT for this specific IN + $found = false; + $outMins = 0; + foreach ($events as $outevent) { + // skip events for other providers + if ($providerid != $outevent['aid']) { continue; } + // skip events with blank IDs + if ($outevent['eid'] == "") { continue; } + + if ($outevent['eid'] == $event['eid']) { $found = true; continue; } + if (($found == true) && ($outevent['catid'] == 3)) { + // calculate the duration from this event to the outevent + $outH = substr($outevent['startTime'], 0, 2); + $outM = substr($outevent['startTime'], 3, 2); + $outMins = ($outH * 60) + $outM; + $event['duration'] = ($outMins - $eStartMin) * 60; // duration is in seconds + $found = 2; + break; + } + } + if ($outMins == 0) { + // no OUT was found so this event's duration goes + // until the end of the day + $event['duration'] = ($calEndMin - $eStartMin) * 60; // duration is in seconds + } + } + + // calculate the TOP value for the event DIV + // diff between event start and schedule start + $eMinDiff = $eStartMin - $calStartMin; + // diff divided by the time interval of the schedule + $eStartInterval = $eMinDiff / $interval; + // times the interval height + $eStartPos = $eStartInterval * $timeslotHeightVal; + $evtTop = $eStartPos.$timeslotHeightUnit; + + // calculate the HEIGHT value for the event DIV + // diff between end and start of event + $eEndMin = $eStartMin + ($event['duration']/60); + // prevent the overall height of the event from going beyond the bounds + // of the time table + if ($eEndMin > $calEndMin) { $eEndMin = $calEndMin + $interval; } + $eMinDiff = $eEndMin - $eStartMin; + // diff divided by the time interval of the schedule + $eEndInterval = $eMinDiff / $interval; + // times the interval height + $eHeight = $eEndInterval * $timeslotHeightVal; + $evtHeight = $eHeight.$timeslotHeightUnit; + + // determine the DIV width based on any overlapping events + // see further above for the overlapping calculation code + $divWidth = ""; + $divLeft = ""; + if (isset($eventPositions[$event['eid']])) { + $divWidth = "width: ".$eventPositions[$event['eid']]->width."%"; + $divLeft = "left: ".$eventPositions[$event['eid']]->leftpos."%"; + } + + $eventid = $event['eid']; + $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)"; + + $content = ""; + + if ($comment && $GLOBALS['calendar_appt_style'] < 4) $title .= " " . $comment; + + // the divTitle is what appears when the user hovers the mouse over the DIV + $divTitle = date("D, d M Y", strtotime($date)); + + if ($catid == 2 || $catid == 3 || $catid == 4 || $catid == 8 || $catid == 11) { + if ($catid == 2) $catname = xl("IN"); + else if ($catid == 3) $catname = xl("OUT"); + else 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 ."] ".$divTitle; + $divTitle .= "\n[".$atitle ."]"; + //$content .= ""; + $content .= $catname; + if ($event['recurrtype'] == 1) $content .= "Repeating event"; + if ($comment) $content .= " $comment"; + //$content .= ""; + } + else { + // some sort of patient appointment + $divTitle .= "\r\n[".$catname ."] ".htmlspecialchars($fname,ENT_QUOTES)." ".htmlspecialchars($lname,ENT_QUOTES); + $content .= ""; + $content .= $dispstarth . ':' . $startm; + if ($event['recurrtype'] == 1) $content .= "Repeating event"; + $content .= htmlspecialchars($event['apptstatus']); + 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."\n"; + $link_title .= "(" . xl('Click to view') . ")"; + $content .= ""; + $content .= "View Patient"; + $content .= ""; + } + else { + // no patient id, just output the category name + $content .= $catname; + } + $content .= ""; + } + + $divTitle .= "\n(" . xl('double click to edit') . ")"; + + // output the DIV and content + echo "
"; + echo $content; + 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-] +

+ + + + + + + diff --git a/interface/main/left_nav.php b/interface/main/left_nav.php index 4c06545ea..346f58012 100644 --- a/interface/main/left_nav.php +++ b/interface/main/left_nav.php @@ -82,13 +82,7 @@ // TBD: Include active_pid and/or active_encounter in relevant submitted // form data, and add logic to the save routines to make sure they match // the corresponding session values. - - //SANITIZE ALL ESCAPES - $sanitize_all_escapes=true; - //STOP FAKE REGISTER GLOBALS - $fake_register_globals=false; - include_once("../globals.php"); include_once($GLOBALS['fileroot']."/library/acl.inc"); include_once($GLOBALS['fileroot']."/custom/code_types.inc.php"); @@ -177,7 +171,7 @@ if ( isset ($GLOBALS['hylafax_server']) && isset ($GLOBALS['scanner_output_direc function genTreeLink($frame, $name, $title, $mono=false) { global $primary_docs, $disallowed; if (empty($disallowed[$name])) { - $id = htmlspecialchars($name . $primary_docs[$name][1], ENT_QUOTES); + $id = $name . $primary_docs[$name][1]; echo "
  • " . htmlspecialchars($title, ENT_QUOTES) . "
  • "; + echo "return loadFrame2('$id','$frame','" . + $primary_docs[$name][2] . "')\">" . $title . ""; } } function genMiscLink($frame, $name, $level, $title, $url, $mono=false) { global $disallowed; if (empty($disallowed[$name])) { - $id = htmlspecialchars($name . $level, ENT_QUOTES); + $id = $name . $level; echo "
  • " . htmlspecialchars($title, ENT_QUOTES) . "
  • "; + echo "return loadFrame2('$id','$frame','" . + $url . "')\">" . $title . ""; } } function genPopLink($title, $url, $linkid='') { echo "
  • " . htmlspecialchars($title, ENT_QUOTES) . "
  • "; + ">" . $title . ""; } function genDualLink($topname, $botname, $title) { global $primary_docs, $disallowed; @@ -218,7 +212,7 @@ if ( isset ($GLOBALS['hylafax_server']) && isset ($GLOBALS['scanner_output_direc echo "
  • " . htmlspecialchars($title, ENT_QUOTES) . "
  • "; + $primary_docs[$botname][2] . "')\">" . $title . ""; } } @@ -226,34 +220,34 @@ function genPopupsList($style='') { global $disallowed, $webserver_root; ?> '0') { - alert(''); + alert(''); return false; } if (active_encounter == 0 && usage > '1') { - alert(''); + alert(''); return false; } var f = document.forms[0]; @@ -387,11 +381,11 @@ function genPopupsList($style='') { var topusage = tname.substring(3); var botusage = bname.substring(3); if (active_pid == 0 && (topusage > '0' || botusage > '0')) { - alert(''); + alert(''); return false; } if (active_encounter == 0 && (topusage > '1' || botusage > '1')) { - alert(''); + alert(''); return false; } var f = document.forms[0]; @@ -523,11 +517,11 @@ function goHome() { function reloadPatient(frname) { var f = document.forms[0]; if (topName.length > 3 && topName.substring(3) > '0' && frname != 'RTop') { - loadFrame('cal0','RTop', ''); + loadFrame('cal0','RTop', ''); setRadio('rb_top', 'cal'); } if (botName.length > 3 && botName.substring(3) > '0' && frname != 'RBot') { - loadFrame('ens0','RBot', ''); + loadFrame('ens0','RBot', ''); setRadio('rb_bot', 'ens'); } } @@ -538,11 +532,11 @@ function goHome() { function reloadEncounter(frname) { var f = document.forms[0]; if (topName.length > 3 && topName.substring(3) > '1' && frname != 'RTop') { - loadFrame('dem1','RTop', ''); + loadFrame('dem1','RTop', ''); setRadio('rb_top', 'dem'); } if (botName.length > 3 && botName.substring(3) > '1' && frname != 'RBot') { - loadFrame('ens1','RBot', ''); + loadFrame('ens1','RBot', ''); setRadio('rb_bot', 'ens'); } } @@ -558,7 +552,7 @@ function goHome() { setDivContent('current_patient', str); setTitleContent('current_patient', str + str_dob); if (pid == active_pid) return; - setDivContent('current_encounter', ''); + setDivContent('current_encounter', ''); active_pid = pid; active_encounter = 0; if (frname) reloadPatient(frname); @@ -572,7 +566,7 @@ function goHome() { if ( f.cb_top.checked && f.cb_bot.checked ) { var encounter_frame = getEncounterTargetFrame('enc'); if ( encounter_frame != undefined ) { - loadFrame('ens0',encounter_frame, ''); + loadFrame('ens0',encounter_frame, ''); setRadio(encounter_frame, 'ens'); } } @@ -583,7 +577,7 @@ function loadCurrentPatientFromTitle() { } function getEncounterTargetFrame( name ) { - var bias = ; + var bias = ; var f = document.forms[0]; var r = 'RTop'; if (f.cb_top.checked && f.cb_bot.checked) { @@ -610,7 +604,7 @@ function getEncounterTargetFrame( name ) { // reload encounter-specific content from the *other* frame. function setEncounter(edate, eid, frname) { if (eid == active_encounter) return; - if (!eid) edate = ''; + if (!eid) edate = ''; var str = '' + edate + ''; setDivContent('current_encounter', str); active_encounter = eid; @@ -636,9 +630,9 @@ function getEncounterTargetFrame( name ) { var f = document.forms[0]; active_pid = 0; active_encounter = 0; - setDivContent('current_encounter', ''); - setDivContent('current_patient', ''); - setTitleContent('current_patient', ''); + setDivContent('current_encounter', ''); + setDivContent('current_patient', ''); + setTitleContent('current_patient', ''); reloadPatient(''); syncRadios(); } @@ -649,7 +643,7 @@ function getEncounterTargetFrame( name ) { // stale content will be reloaded. function clearEncounter() { if (active_encounter == 0) return; - setDivContent('current_encounter', ''); + setDivContent('current_encounter', ''); active_encounter = 0; reloadEncounter(''); syncRadios(); @@ -729,9 +723,9 @@ function getEncounterTargetFrame( name ) {
    @@ -740,10 +734,10 @@ function getEncounterTargetFrame( name ) { - + - + /> @@ -752,15 +746,15 @@ function getEncounterTargetFrame( name ) {