$PageTitle="Proposed RCF Shift Schedule"; ?>
require("$DOCUMENT_ROOT/RCF/templates/RCF_Top_Menu.html") ?> require("$DOCUMENT_ROOT/RCF/templates/Title_Banner.php") ?> import_request_variables('pg','p_'); if (empty($p_year)) { $smonth = array('Jan','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug', 'Sep','Oct','Nov','Dec'); ?> Please select the month and year you want the schedule for.} else { $white = "#ffffffff"; $black = "#00000000"; $aqua = "#00ffff"; $maroon = "#800000"; $red = "#ff0000"; $purple = "#800080"; $fuchsia = "#ff00ff"; $green = "#008000"; $lime = "#00ff00"; $olive = "#808000"; $yellow = "#ffff00"; $navy = "#000080"; $blue = "#0000ff"; $light_blue = "#b0e2ff"; $teal = "#008080"; $cell_color; $font_color = $red; $table_color = $light_blue; $day_color = $aqua; #$teal; $month = array('January', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); $days_month = array( '01' => '31', '02' => '28', '03' => '31', '04' => '30', '05' => '31', '06' => '30', '07' => '31', '08' => '31', '09' => '30', '10' => '31', '11' => '30', '12' => '31' ); mysql_pconnect("www.acf.bnl.gov","oncall","mtdiawot") or die("Unable to connect to SQL server"); mysql_select_db("rcf") or die("Unable to select database"); # Ognian assumes start time and end time is on same day and splits date and time $query = sprintf("select t1.day as day,t1.startt as stime,t1.endt as etime, t2.name as name,t2.officeno as office,t2.beeperno as pager,t2.homeno as hphone from testschedule as t1, monitor_staff as t2 where t1.personid = t2.personid and t1.day like '%d-%02d-%%' order by t1.day, t1.startt",$p_year,$p_month); $results = mysql_query($query) or die("DB select failed"); while ($record = mysql_fetch_array($results)) { $n = sscanf($record['day'],"%4d-%2d-%2d",&$s_year, &$s_month,&$s_day); $n = sscanf($record['stime'],"%2d:%2d:%s",&$s_hour,&$s_min,&$s_rest); $rdow = `date -d "$s_day $month[$s_month] $s_year" +%w`; $dow = rtrim($rdow); $d_index = sprintf("%02d-%d-%02d:%02d",$s_day,$dow,$s_hour,$s_min); $n = sscanf($record['etime'],"%2d:%2d:%s",&$e_hour,&$e_min,&$e_rest); # Break up name if (preg_match("/PHENIX/",$record['name'])) { $first_name = 'Oncall'; $lname = 'PHENIX'; } elseif (preg_match("/STAR/",$record['name'])) { $first_name = 'Oncall'; $lname = 'STAR'; } elseif (preg_match("/None/",$record['name'])) { $first_name = 'Oncall'; $lname = 'None'; } else { $words = explode(" ",$record['name']); $first_name = $words[0]; $lname = end($words); } $shifts[$d_index] = sprintf("%02d:%02d-%02d:%02d %s", $s_hour,$s_min,$e_hour,$e_min, $lname); if (empty($fnames[$record['name']])) { $fnames[$record['name']] = $first_name; $offices[$record['name']] = $record['office']; $pagers[$record['name']] = $record['pager']; $hphones[$record['name']] = $record['hphone']; } } ksort($shifts); ksort($fnames); # values for next and prev if ($p_month == 1) { $nx_year = $p_year; $nx_month = 2; $pr_year = $p_year - 1; $pr_month = 12; } elseif ($p_month == 12) { $nx_year = $p_year + 1; $nx_month = 1; $pr_year = $p_year; $pr_month = 11; } else { $nx_year = $p_year; $nx_month = $p_month + 1; $pr_year = $p_year; $pr_month = $p_month - 1; } ?>
| Prev | Next |
| Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday |
|---|---|---|---|---|---|---|
| } ?> |
|
# Check if end of week
if ($curr_dow == 6) {
$curr_dow = -1;
?>
|||||
|
# if also dow is now 0, need to end the row and start another
if ($d_dow == 0){
$curr_dow = -1;
?>
||||||
|
| Name | Extension | Pager Number |
|---|---|---|
| echo $key ?> | echo $offices[$key] ?> | echo $pagers[$key] ?> |