require_once"./dbconfig.php";
require_once"./config.php";
require_once"../../db/util/nslib.php";
require "DB.php";
//日付、区分が空の場合のデフォルト
if ($_REQUEST['d'] == "") {
if ($_REQUEST['kbn'] != "s") {
$_REQUEST['d'] = '2008-01-31';
} else {
$_REQUEST['d'] = '2008-02-01';
}
}
if ($_REQUEST['kbn'] == "") {
$_REQUEST['kbn'] = 'cap';
}
//データベースに接続
$db =& DB::connect($dsn);
if (DB::isError($db)) {
$db->getMessage();
$db->getDebugInfo();
die("connect error");
}
//区分
$kubun_cond = null;
$kubun_array = null;
if ($_REQUEST['kbn'] == "" || $_REQUEST['kbn'] == null) {
$kbn = "cap";
} else if ($_REQUEST['kbn'] == "cap") {
$kbn = "cap";
} else if ($_REQUEST['kbn'] == "e") {
$kbn = "e";
} else if ($_REQUEST['kbn'] == "p") {
$kbn = "p";
} else if ($_REQUEST['kbn'] == "s") {
$kbn = "s";
} else if ($_REQUEST['kbn'] == "cm") {
$kbn = "cm";
} else {
$kbn = "cap";
}
$o_smarty->assign("kbn",$kbn);
$kubun_cond = array(
"cap"=>"(kubun = 'Coronary' or kubun = 'Peripheral')",
"e"=>"(kubun = 'Electrophysiology')",
"p"=>"(kubun = 'Peripheral')",
"s"=>"(kubun = 'Surgical')",
"cm"=>"(kubun = 'Co-medical')",
);
//タイトル横に表示する用
$kubun_p = array(
"cap"=>"Coronary and Peripheral",
"e"=>"Electrophysiology",
"p"=>"Peripheral",
"s"=>"Surgical",
"cm"=>"Co-medical",
);
$o_smarty->assign("kubun_p",$kubun_p);
//セッション名を日本語か英語か判定
if ($kbn == "s" || $kbn == "cm") {
$session_mei__name = 'session_mei_j';
} else {
$session_mei__name = 'session_mei';
}
$cond_sql = " and s_day_p = ? and " .$kubun_cond[$_REQUEST['kbn']];
$room_mei_array = array(
"kh2_mai_t"=>"Main Theater",
"kh2_mas_t"=>"Masters Theater",
"kh2_pro_b"=>"Promotion Bureau",
"kh2_han_c"=>"PCI Hands-on Center",
"kh2_han_c2"=>"PCI Hands-on Center",
"kh2_end_t"=>"Endovascular Theater",
"kh1_ha2"=>"Hall A-2",
"kh1_hb"=>"Hall B",
"kh1_exh"=>"Exhibit Hall",
"ph_r1"=>"Room 1",
"ph_r2"=>"Room 2",
"ph_r3"=>"Room 3",
"ph_r4"=>"Room 4",
"ph_r5"=>"Room 5",
"ph_r6"=>"Room 6",
"ph_r7"=>"Room 7",
"ph_r8"=>"Room 8",
"ph_r9"=>"Room 9",
"ph_r10"=>"Room 10",
"ph_r11"=>"Room 11",
"ph_r12"=>"Room 12",
"ph_r13"=>"Room 13",
);
$o_smarty->assign("room_mei_array",$room_mei_array);
foreach ($room_mei_array as $rm_key=>$rm_val) {
//取得
$sql = "SELECT psn,s_day_p,s_time_p,e_time_p,session_mei,session_mei_j,room_mei from program where room_mei = ?";
$sql .= $cond_sql;
if ($rm_key == 'kh2_han_c') {
$sql .= " and psn in (1001,1002,998,1003,1004,999,1005,1006,1000)";
} elseif ($rm_key == 'kh2_han_c2') {
$sql .= " and psn in (990,991,994,995,996,997,992,993)";
}
$sql .= " group by psn,s_day_p,s_time_p,e_time_p,session_mei,session_mei_j,room_mei order by s_day_p,s_time_p,e_time_p;";
/*
//一覧を取得
$sql = "SELECT psn,s_day_p,s_time_p,e_time_p,session_mei from program where room_mei = 'Main Theater' group by psn,s_day_p,s_time_p,e_time_p,session_mei order by s_day_p,s_time_p,e_time_p;";
*/
$result = $db->getAll($sql,array($rm_val,$_REQUEST['d']),DB_FETCHMODE_ASSOC);
if (DB::isError($result)) {
echo $result->getMessage() . "
";
echo $result->getDebugInfo();
die("
ERROR
");
}
$program_data[$rm_key] = $result;
//ループ処理用
$program_seq_num = 0;
//総セッション数
$total_session_num[$rm_key] = count($program_data[$rm_key]);
//echo $total_session_num[$rm_key] . "
";
foreach($program_data[$rm_key] as $key=>$val) {
//TRI暫定対応
if ($dummy != "dummy") {
//調整
//Coronary
if ($val['psn'] =="1159") {
$val['s_time_p'] = "08:15";
$val['e_time_p'] = "08:30";
}
if ($val['psn'] =="1162") {
$val['e_time_p'] = "14:15";
}
if ($val['psn'] =="965") {
$val['s_time_p'] = "14:15";
}
/*
if ($val['psn'] =="979") {
$val['s_time_p'] = "14:15";
}
*/
if ($val['psn'] =="1007") {
$val['e_time_p'] = "10:30";
}
if ($val['psn'] =="1008") {
$val['s_time_p'] = "10:30";
}
if ($val['psn'] =="927") {
$val['s_time_p'] = "10:45";
}
if ($val['psn'] =="1260") {
$val['e_time_p'] = "16:45";
}
//Electro
if ($val['psn'] =="1146") {
$val['e_time_p'] = "09:45";
}
if ($val['psn'] =="1147") {
$val['s_time_p'] = "09:45";
}
if ($val['psn'] =="1148") {
$val['e_time_p'] = "12:15";
}
if ($val['psn'] =="1150") {
$val['s_time_p'] = "14:45";
$val['e_time_p'] = "15:45";
}
if ($val['psn'] =="1151") {
$val['s_time_p'] = "15:45";
$val['e_time_p'] = "16:45";
}
if ($val['psn'] =="1152") {
$val['s_time_p'] = "16:45";
$val['e_time_p'] = "17:45";
}
//Co-medical
if ($val['psn'] =="1196") {
$val['s_time_p'] = "09:45";
$val['e_time_p'] = "11:00";
}
if ($val['psn'] =="1197") {
$val['s_time_p'] = "11:15";
}
if ($val['psn'] =="1199") {
$val['e_time_p'] = "15:15";
}
if ($val['psn'] =="1203") {
$val['e_time_p'] = "09:45";
}
if ($val['psn'] =="1204") {
$val['s_time_p'] = "09:45";
}
if ($val['psn'] =="1205") {
$val['s_time_p'] = "10:45";
$val['e_time_p'] = "11:15";
}
if ($val['psn'] =="1206") {
$val['e_time_p'] = "12:15";
}
if ($val['psn'] =="1219") {
$val['s_time_p'] = "12:15";
$val['e_time_p'] = "13:15";
}
if ($val['psn'] =="1220") {
$val['s_time_p'] = "13:15";
$val['e_time_p'] = "14:15";
}
if ($val['psn'] =="1221") {
$val['s_time_p'] = "14:15";
$val['e_time_p'] = "15:15";
}
//時間ごとのID $data[0845]にする
$time_key = null;
$time_key = substr(str_replace(":","",$val['s_time_p']),0,4);
$end_time_key = substr(str_replace(":","",$val['e_time_p']),0,4);
//$quarter_check = 0;
/*
if (substr($time_key,2,2) > 45) {
$time_key = substr($time_key,2,2) . "45";
}
if (substr($end_time_key,2,2) > 45) {
$val['e_time_p'] = substr($val['e_time_p'],0,2) . "45";
}
*/
$val['session_quarters_num'] = floor((strtotime($val['e_time_p']) - strtotime($val['s_time_p'])) / 60 / 15);
//echo "\n";
//朝開始時間までの空白
$first_time_quarters = null;
if ($program_seq_num == 0) {
$first_session_start_time = $val['s_time_p'];
if (strtotime($first_session_start_time) > strtotime("08:00")) {
$first_time_quarters = (strtotime($first_session_start_time) - strtotime("08:00")) / 60 / 15;
$morning_time_key = "0800";
$time_table_data[$rm_key][$morning_time_key]['session_quarters_num'] = $first_time_quarters;
}
}
//次のセッションまでの空白がある場合
$quaters_temp = null;
$this_session_start_time = $val['s_time_p'];
if (strtotime($lastsession_endtime) < strtotime($val['s_time_p'])) {
$quaters_temp = (strtotime($val['s_time_p']) - strtotime($lastsession_endtime)) / 60 / 15;
$session_key_temp = substr(str_replace(":","",$lastsession_endtime),0,4);
$time_table_data[$rm_key][$session_key_temp]['session_quarters_num'] = $quaters_temp;
}
//$でーた['psn']にする
$time_table_data[$rm_key][$time_key] = $val;
if ($first_time_quarters != null) {
}
$lastsession_endtime = $val['e_time_p'];
$program_seq_num++;
//最後のセッションの場合、22:00までの空白を作成
if ($program_seq_num = $total_session_num[$rm_key]) {
$quaters_temp = (strtotime("22:00") - strtotime($lastsession_endtime)) / 60 / 15;
$session_key_temp = substr(str_replace(":","",$lastsession_endtime),0,4);
$time_table_data[$rm_key][$session_key_temp]['session_quarters_num'] = $quaters_temp;
}
}
}
if ($time_table_data[$rm_key] == null) {
$time_table_data[$rm_key]['0800']['session_quarters_num'] = 56;
}
}
$o_smarty->assign("program_data",$program_data);
$o_smarty->assign("time_table_data",$time_table_data);
//タイムテーブル行の繰り返し用データ(for smarty)
$tla_base_data = strtotime("08:00");
for ($i=0;$i<56;$i++) {
$timeline_temp_sec = $tla_base_data + ((15*60) * $i);
$timeline_array[] = str_replace(":","",date("H:i",$timeline_temp_sec));
}
$o_smarty->assign("timeline_array",$timeline_array);
//stylesheet
for ($i=1;$i<57;$i++) {
$height = ($i-1)*21+13;
$quarters_css .=<<<_CSS_
.quarter{$i} {
width: 98px;
height:{$height}px;
margin:0px;
padding:3px;
font-size:10px;
overflow: hidden;
background-color:#FFFFFF;
border-top:1px solid #d6d6d6;
border-right:1px solid #a9a9a9;
border-bottom:1px solid #a9a9a9;
border-left:1px solid #d6d6d6;
}
.quarter{$i}_blank {
width: 98px;
height:{$height}px;
margin:0px;
padding:3px;
font-size:10px;
overflow: hidden;
background-color:#FE9A82;
/*
border-top:1px solid #d6d6d6;
border-right:1px solid #a9a9a9;
border-bottom:1px solid #a9a9a9;
border-left:1px solid #d6d6d6;
*/
border-top:1px solid #FE9A82;
border-right:1px solid #FE9A82;
border-bottom:1px solid #FE9A82;
border-left:1px solid #FE9A82;
}
_CSS_;
}
$o_smarty->assign("quarters_css",$quarters_css);
$o_smarty->display("2008/program/at_a_glance.tpl.html");
exit;
?>