[-*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"-] [-* we want to include out stylesheet for this view*-] [-fetch file="$TPL_STYLE_PATH/day.css" assign="css"-] [-eval var=$css-] [-php-] include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); [-/php-] [-php-] // 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; $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(); } // echo "
\n"; echo "
\n"; echo "\n"; echo " \n"; echo " \n"; // Build the scrolling selection list of providers. echo " \n"; // Build the date and view type selectors and the Go button and the Today button. echo " \n"; // Show the Add and Search buttons. echo " \n"; echo " \n"; // Show the date/range and its previous- and next-day/week selectors. echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; echo " \n"; /********************************************************************* // ============================== // FACILITY FILTERING (lemonsoftware) $facilities = getFacilities(); echo " \n"; *********************************************************************/ // ============================== // FACILITY FILTERING (lemonsoftware) if ($_SESSION['authorizeduser'] == 1) { $facilities = getFacilities(); } else { $facilities = getUserFacilities($_SESSION['authId']); // from users_facility if (count($facilities) == 1) $_SESSION['pc_facility'] = ($facilities[0]['id']); } if (count($facilities) > 1) { echo " \n"; } /********************************************************************/ // EOS FF // ============================== echo " \n"; echo " \n" . " [?]\n"; echo "  \n"; echo "  \n"; echo "  \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; $atmp = array_keys($A_EVENTS); if ($MULTIDAY) { echo "<< \n"; echo dateformat(strtotime($atmp[0])); echo " - "; echo dateformat(strtotime($atmp[count($atmp)-1])); echo " >>\n"; } else { echo "<< \n"; echo dateformat(strtotime($atmp[0]), true); echo " >>\n"; } echo " \n"; echo "  \n"; echo "
\n"; echo "
\n"; 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"; $tdstylearr = array('bordyy', 'bordny', 'bordyn', 'bordnn'); // For each day... foreach ($A_EVENTS as $date => $events) { $need_headers = true; $eventdate = substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2); // If multiple days then show a date header for each. if ($MULTIDAY) { echo " \n"; echo " "; echo " \n"; } $arr_events = $S_EVENTS[$date]; list($slotkey, $slotevent) = each($arr_events); // This is an array of provider status information for this day, // used to properly assign table cell attributes. $provstat = array(); $slotindex = 0; $lastslotindex = count($times) - 1; // For each time slot... foreach ($times as $slottime) { $startampm = ($slottime['mer']) == "pm" ? 2 : 1; $starttimeh = $slottime['hour']; $starttimem = $slottime['minute']; $slotendmins = $starttimeh * 60 + $starttimem + $interval; // Repeat doc names at 1PM. This is a kludge; omit it for released code. // if ($starttimeh == 13 && $starttimem == 0) $need_headers = true; // Get all events for all providers just for this time slot now, because we // can pick up where we left off and because we don't want to re-scan all // events for the day for each table cell. // $arr_slot = array(); for (; isset($slotkey); list($slotkey, $slotevent) = each($arr_events)) { $starth = substr($slotevent['startTime'], 0, 2); $startm = substr($slotevent['startTime'], 3, 2); if (($starth * 60 + $startm) >= $slotendmins) break; $arr_slot[$slotkey] = $slotevent; $catid = $slotevent['catid']; $providerid = $slotevent['aid']; $durminutes = ceil($slotevent['duration'] / 60); $durslots = ceil($durminutes / $interval); // While we're here, collect information for cell cosmetics. if ($catid == 2) { // in office $provstat[$providerid]['in'] = true; // Save preferred category info for this IN event. $provstat[$providerid]['in_cat'] = -1; $provstat[$providerid]['in_slot0'] = $slotindex; $provstat[$providerid]['in_slots'] = 1; if ($slotevent['prefcatid']) { foreach ($A_CATEGORY as $catkey => $catval) { if ($catval['id'] == $slotevent['prefcatid']) { $provstat[$providerid]['in_cat'] = $catkey; $provstat[$providerid]['in_slots'] = ceil(ceil($catval['event_duration'] / 60) / $interval); break; } } // Debugging: if ($provstat[$providerid]['in_cat'] < 0) { echo "\n"; // debugging } } } else if ($catid == 3) { // out of office $provstat[$providerid]['in'] = false; } else if ($catid == 4 || $catid == 8 || $catid == 11) { // unavailable types // unavailable slots are marked 'res' for appropriate coloring. $endindex = $slotindex + $durslots; for ($i = $slotindex; $i < $endindex; ++$i) { $provstat[$providerid][$i]['res'] = true; } } // If duration > slot size then mark slots for border control. A slot // marked 'ext' is not to have a border between itself and the slot below. if ($durslots > 1) { $endindex = $slotindex + $durslots - 1; for ($i = $slotindex; $i < $endindex; ++$i) { $provstat[$providerid][$i]['ext'] = true; } } } // Finished getting event information for this time slot. // Write a header row with the provider names if appropriate. if ($need_headers) { $need_headers = false; echo " \n"; foreach ($providers as $provider) { echo " \n"; } echo " \n"; } echo " \n"; // We are now ready to write the table row for the current time slot. // This loops once for each provider to be displayed. // foreach ($providers as $provider) { $providerid = $provider['id']; // Mark this as a no-bottom-border slot if the preferred category // duration extends beyond it. // // echo "\n"; // debugging // if ($provstat[$providerid]['in']) { if (($slotindex + 1 - $provstat[$providerid]['in_slot0']) % $provstat[$providerid]['in_slots']) $provstat[$providerid][$slotindex]['ext'] = true; } $content = ""; // this will be the event cell content $clsuffix = "acell"; if ($provstat[$providerid][$slotindex]['res'] || ! $provstat[$providerid]['in']) { $clsuffix = "ucell"; } // Remove top and/or bottom table cell borders using CSS when events span // time slots or when the practitioner is not in-office. Using "rowspan" // would be a difficult and inferior solution to this problem. // $tdstyleix = 0; $timelabel = true; if ($slotindex < $lastslotindex && ($provstat[$providerid][$slotindex]['ext'] || !$provstat[$providerid]['in'])) { $tdstyleix += 1; // no bottom } if ($slotindex > 0 && ($provstat[$providerid][$slotindex-1]['ext'] || !($provstat[$providerid]['in'] || $provstat[$providerid]['wasin']))) { $tdstyleix += 2; // no top $timelabel = false; } $tdstyle = ' ' . $tdstylearr[$tdstyleix]; $disptimeh = ($starttimeh > 12) ? ($starttimeh - 12) : $starttimeh; $in_cat_id = 0; if ($provstat[$providerid]['in_cat'] >= 0) { $category =& $A_CATEGORY[$provstat[$providerid]['in_cat']]; if ($category['id']) $in_cat_id = $category['id']; } // If a slot omits the top border, then we omit the TOD cell's top border // and skip writing its time-of-day text. This way we can get some rows // with no content at all, which should produce a more compact and readable // calendar display. echo " \n"; echo " \n"; // Keep track of whether the doc was in during the previous time slot. $provstat[$providerid]['wasin'] = $provstat[$providerid]['in']; } // end provider echo " \n"; ++$slotindex; } // end time slot } // end day echo "
" . dateformat(strtotime($date), true) . "
"; echo $provider['fname'][0] . " " . $provider['lname']; echo "
"; if ($timelabel) { echo ""; echo "$disptimeh:$starttimem"; } else { echo "
"; // 1x1 px content so the browser does not suppress borders } echo "
"; // Scan all events for this time slot and generate the associated HTML for // this doc. JavaScript is used in hrefs to reduce the volume of output. // reset($arr_slot); while (list($eventkey, $event) = each($arr_slot)) { if ($event['aid'] != $providerid) continue; if ($content) $content .= " "; $starth = substr($event['startTime'], 0, 2); $startm = substr($event['startTime'], 3, 2); $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']; $title = xl('Age') . " $patient_age ($patient_dob)"; $catid = $event['catid']; $comment = addslashes($event['hometext']); $catname = $event['catname']; if ($comment && $GLOBALS['calendar_appt_style'] < 4) $title .= " " . $comment; 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'); // Omit lunch, vacation, etc. if the doc is not in-office. if ($provstat[$providerid]['in'] || $catid < 4) { $content .= ""; $content .= $catname; if ($comment) $content .= " - $comment"; $content .= ""; } } else if ($patientid) { // some sort of patient appointment $content .= ""; // $content .= $starth . ':' . $startm . htmlspecialchars($event['apptstatus']) . ""; $content .= $starth . ':' . $startm . ' ' . htmlspecialchars($event['apptstatus']) . " "; $content .= ""; 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 { // some other non-patient event $content .= ""; $content .= $starth . ':' . $startm . ' ' . htmlspecialchars($event['apptstatus']) . " "; if ($GLOBALS['calendar_appt_style'] != 1) { 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 .= ""; } } // end while if (! $content) $content = "
"; // so the browser does not suppress borders echo $content . "
\n"; // [-*footer*-] // [-include file="$TPL_NAME/views/global/footer.html"-] // [-include file="$TPL_NAME/views/footer.html"-] [-/php-]