[-*Smarty*-] [-*****************************************************************************-] [-* This is the source code for both day/default.html and week/default.html. *-] [-* They should always be identical. If you change one, copy to the other! *-] [-*****************************************************************************-] [-* Copyright (C) 2005 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-] // [-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']; $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; $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. 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"; echo " \n"; echo " "; echo ""; echo "\n"; echo " \n"; echo "  \n"; echo " \n"; echo " \n"; echo " \n"; echo "
\n"; $atmp = array_keys($A_EVENTS); if ($MULTIDAY) { echo "<< \n"; echo date("F j Y", strtotime($atmp[0])); echo " - "; echo date("F j Y", strtotime($atmp[count($atmp)-1])); echo " >>\n"; } else { echo "<< \n"; echo date("l, F j, Y", strtotime($atmp[0])); 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"; // 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 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 setting cell colors. if ($catid == 2) { // in office $provstat[$providerid]['in'] = true; } else if ($catid == 3) { // out of office $provstat[$providerid]['in'] = false; } else if ($catid == 4 || $catid == 8 || $catid == 11) { // unavailable types $endindex = $slotindex + $durslots; for ($i = $slotindex; $i < $endindex; ++$i) { $provstat[$providerid][$i]['res'] = true; } } // if duration > slot size then mark slots for border control. if ($durslots > 1) { $endindex = $slotindex + $durslots - 1; for ($i = $slotindex; $i < $endindex; ++$i) { $provstat[$providerid][$i]['ext'] = true; } } } // 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']; $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. // $tdstyle=""; if ($slotindex < $lastslotindex && ($provstat[$providerid][$slotindex]['ext'] || !$provstat[$providerid]['in'])) { $tdstyle .= " nobot"; } if ($slotindex > 0 && ($provstat[$providerid][$slotindex-1]['ext'] || !($provstat[$providerid]['in'] || $provstat[$providerid]['wasin']))) { $tdstyle .= " notop"; } $disptimeh = ($starttimeh > 12) ? ($starttimeh - 12) : $starttimeh; 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 "
" . date("l, F j, Y", strtotime($date)) . "
"; echo $provider['fname'][0] . " " . $provider['lname']; echo "
"; echo ""; echo "$disptimeh:$starttimem"; 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 = addslashes(ucfirst(strtolower(substr($event['patient_name'], 0, $commapos)))); $fname = addslashes(ucfirst(strtolower(substr($event['patient_name'], $commapos + 2)))); $patient_dob = $event['patient_dob']; $patient_age = $event['patient_age']; $catid = $event['catid']; $catname = $event['catname']; $title = "Age $patient_age ($patient_dob) " . addslashes($event['hometext']); if ($catid == 2 || $catid == 3 || $catid == 4 || $catid == 8 || $catid == 11) { if ($catid == 2) $catname = "IN"; else if ($catid == 3) $catname = "OUT"; else if ($catid == 4) $catname = "VACATION"; else if ($catid == 8) $catname = "LUNCH"; else if ($catid == 11) $catname = "RESERVED"; // Omit lunch, vacation, etc. if the doc is not in-office. if ($provstat[$providerid]['in'] || $catid < 4) { $content .= ""; $content .= $catname . ""; } } else { // some sort of patient appointment $content .= ""; $content .= $startm . htmlspecialchars($event['apptstatus']) . ""; $content .= ""; if ($catid == 1) $content .= ""; $content .= $lname; if ($GLOBALS['calendar_appt_style'] != 1) { $content .= "," . $fname; if ($event['title'] && $GLOBALS['calendar_appt_style'] == 3) $content .= "(" . $event['title'] . ")"; } if ($catid == 1) $content .= ""; $content .= ""; } } // end while if (! $content) $content = " "; echo $content . "
\n"; // [-*footer*-] // [-include file="$TPL_NAME/views/global/footer.html"-] // [-include file="$TPL_NAME/views/footer.html"-] [-/php-]