require_once"./dbconfig.php";
require_once"./config.php";
require_once"../../db/util/nslib.php";
require "DB.php";
$db =& DB::connect($dsn);
if (DB::isError($db)) {
$db->getMessage();
$db->getDebugInfo();
die("connect error");
}
//カテゴリ一覧
$sql = "SELECT distinct(category_mei) from program order by category_mei";
//$stt = $db->prepare($sql);
$result = $db->getAll($sql,array(),DB_FETCHMODE_ASSOC);
if (DB::isError($result)) {
echo $result->getMessage() . "
";
echo $result->getDebugInfo();
die("
ERROR
");
}
$categories = $result;
$o_smarty->assign("categories",$categories);
/*
foreach($categories as $ckey=>$cval) {
$categories[$ckey]['category_mei'] = rtrim($cval['category_mei']);
}
*/
foreach($categories as $ckey=>$cval) {
//データを取得
$sql = "SELECT s_day_p,s_time_p,e_time_p,room_mei,shurui,session_mei,room_e,live1,live2,live3 from program where interid is not null and category_mei = ? group by s_day_p,s_time_p,e_time_p,room_mei,shurui,session_mei,room_e,live1,live2,live3 order by s_day_p,s_time_p,e_time_p,room_e";
//$stt = $db->prepare($sql);
$result = $db->getAll($sql,array($cval['category_mei']),DB_FETCHMODE_ASSOC);
if (DB::isError($result)) {
echo $result->getMessage() . "
";
echo $result->getDebugInfo();
die("
ERROR
");
} else {
$program_data[$cval['category_mei']] = $result;
foreach($program_data[$cval['category_mei']] as $pkey=>$pval) {
if ($cval['kubun'] == "Surgical") {
$program_data[$cval['category_mei']][$pkey]['kbn'] = "s";
} else if ($cval['kubun'] == "Co-medical") {
$program_data[$cval['category_mei']][$pkey]['kbn'] = "cm";
}
}
}
}
//$program_data = $result;
$o_smarty->assign("program_data",$program_data);
$o_smarty->display("2006/program/category_index.tpl");
exit;
?>