'."\n" ?> getMessage()); } mysql_query("SET NAMES utf8"); //テーブル名の設定 $table_name = "Dublin Core"; $management_name = "management ledger"; //表示件数 if (!$_GET["numPage"]){ $numPage = 20; //デフォルトは「20」 } else { $numPage = $_GET["numPage"]; } //文書名の取得 if (!$_GET["DocumentNo"]){ $DocumentNo = 1; //現状は「1」 } else { $DocumentNo = $_GET["DocumentNo"]; } $sql = "SELECT Document FROM `{$management_name}` ". "WHERE Number = $DocumentNo"; //SQLを実行 $result =& $db->query($sql); if (DB::isError($result)) { die ($result->getMessage()); } $row1 =& $result->fetchrow(DB_FETCHMODE_ASSOC); //ページ表示数の設定 define ("PAGE_ITEMS", $numPage); //自分自身のファイル名を取得 $myfile = basename($_SERVER['PHP_SELF']); //自分自身のURLを取得 $ParaURL = "http://".$_SERVER['HTTP_HOST']."".$_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']; //検索条件配列 $conditions = array('DocumentNo' => '文書番号', 'Freeword' => 'フリーワード', 'Ad_1' => '西暦', 'Ad_2' => '西暦(迄)', 'Title' => '表題', 'Subject' => '内容', 'Creator' => '差出・作成', 'Payee' => '請取' ); //項目配列 $fields = array('Core_NO' => 'DB番号', // 0 'Material_No' => '資料番号', // 1 'Date_Code' => '年月日', // 2 'Date' => '年月日テキスト', // 3 'AD' => '西暦', // 4 'Title' => '表題', // 5 'Subject' => '内容', // 6 'kenmei_ichiran' => '件名一覧', // 7 'Creator' => '差出・作成', // 8 'Payee' => '請取', // 9 'Form' => '形・数', // 10 'Remarks' => '備考', // 11 'Search_Text' => '検索用テキスト', // 12 'Attached_file' => '画像', // 13 'File_form' => 'ファイル形式', // 14 'File_size' => 'ファイルサイズ' // 15 ); //テーブルクラス配列 $name_class = array('no' => '資料番号', 'date' => '年月日', 'ad' => '西暦', 'title' => '表題(内容)', 'present' => '差出・作成→請取', 'form' => '形・数', 'remarks' => '備考', 'files' => '添付ファイル' ); //フォーム入力値をセッションに保存し、WHERE句を生成 $_SESSION = array(); session_start(); $kensaku_zyouken = ""; foreach ($conditions as $key => $val) { if (isset($_GET[$key])){ $_SESSION[$key] = mysql_escape_string($_GET[$key]); } if (!$_SESSION[$key]) continue; switch ($key) { case 'DocumentNo': if($_SESSION[$key]==1){ $where[] = " `Number` <= 2"; //文書番号2以下を抽出 普通は→ "= '{$_SESSION[$key]}%'"; } else { $where[] = " `Number` = $_SESSION[$key]"; } break; case 'Freeword': if($_SESSION[$key]){ $kensaku_zyouken = 1; $str = array(" ", " and ", " AND "); $_SESSION[$key] = str_replace($str, " ", $_SESSION[$key]); if(stristr($_SESSION[$key], " ")){//複数キーワードでの検索 $ex = explode(" ", $_SESSION[$key]); $count = count($ex); for($i=0; $i<$count; $i++){ $where[] = " Search_Text LIKE '%{$ex[$i]}%'"; } }else{//単体キーワードでの検索 $where[] = " Search_Text LIKE '%{$_SESSION[$key]}%'"; } } break; case 'Ad_1': $Ad_1 = $_SESSION[$key]; $kensaku_zyouken = 1; break; case 'Ad_2': $Ad_2 = $_SESSION[$key]; $kensaku_zyouken = 1; break; case 'Title': if($_SESSION[$key]){ $kensaku_zyouken = 1; $str = array(" ", " and ", " AND "); $_SESSION[$key] = str_replace($str, " ", $_SESSION[$key]); if(stristr($_SESSION[$key], " ")){//複数キーワードでの検索 $ex = explode(" ", $_SESSION[$key]); $count = count($ex); for($i=0; $i<$count; $i++){ $where[] = " Title LIKE '%{$ex[$i]}%'"; } }else{//単体キーワードでの検索 $where[] = " Title LIKE '%{$_SESSION[$key]}%'"; } } break; case 'Subject': if($_SESSION[$key]){ $kensaku_zyouken = 1; $str = array(" ", " and ", " AND "); $_SESSION[$key] = str_replace($str, " ", $_SESSION[$key]); if(stristr($_SESSION[$key], " ")){//複数キーワードでの検索 $ex = explode(" ", $_SESSION[$key]); $count = count($ex); for($i=0; $i<$count; $i++){ $where[] = " Subject LIKE '%{$ex[$i]}%'"; } }else{//単体キーワードでの検索 $where[] = " Subject LIKE '%{$_SESSION[$key]}%'"; } } break; case 'Creator': if($_SESSION[$key]){ $kensaku_zyouken = 1; $str = array(" ", " and ", " AND "); $_SESSION[$key] = str_replace($str, " ", $_SESSION[$key]); if(stristr($_SESSION[$key], " ")){//複数キーワードでの検索 $ex = explode(" ", $_SESSION[$key]); $count = count($ex); for($i=0; $i<$count; $i++){ $where[] = " Creator LIKE '%{$ex[$i]}%'"; } }else{//単体キーワードでの検索 $where[] = " Creator LIKE '%{$_SESSION[$key]}%'"; } } break; case 'Payee': if($_SESSION[$key]){ $str = array(" ", " and ", " AND "); $kensaku_zyouken = 1; $_SESSION[$key] = str_replace($str, " ", $_SESSION[$key]); if(stristr($_SESSION[$key], " ")){//複数キーワードでの検索 $ex = explode(" ", $_SESSION[$key]); $count = count($ex); for($i=0; $i<$count; $i++){ $where[] = " Payee LIKE '%{$ex[$i]}%'"; } }else{//単体キーワードでの検索 $where[] = " Payee LIKE '%{$_SESSION[$key]}%'"; } } break; case 'Appearance': if($_SESSION[$key]){ $kensaku_zyouken = 1; $str = array(" ", " and ", " AND "); $_SESSION[$key] = str_replace($str, " ", $_SESSION[$key]); if(stristr($_SESSION[$key], " ")){//複数キーワードでの検索 $ex = explode(" ", $_SESSION[$key]); $count = count($ex); for($i=0; $i<$count; $i++){ $where[] = " Appearance LIKE '%{$ex[$i]}%'"; } }else{//単体キーワードでの検索 $where[] = " Appearance LIKE '%{$_SESSION[$key]}%'"; } } break; } } if($Ad_1<>""){ if($Ad_2<>""){ $where[] = " AD >= $Ad_1 AND AD <= $Ad_2"; }else{ $where[] = " AD = $Ad_1"; } }else{ if($Ad_2<>""){ $where[] = " AD = $Ad_2"; } } //検索条件未入力の場合はすべてを出力 if (!is_array($where)){ } else { //検索条件のつなぎ合わせ $wherestr = implode(" AND " , $where); } //検索条件が無い場合 if ($wherestr == ""){ $wherestr = " `Number` <= 2"; } //ソートの項目を保存 if ($_GET['sort'] && in_array($_GET['sort'], array_keys($fields))){ $_SESSION['sort'] = $_GET['sort']; } if (isset($_GET['dir'])){ $_SESSION['dir'] = $_GET['dir']; } if (!$_SESSION['sort']) { $_SESSION['sort'] = 'Date_Code'; } //データベースへの接続 $db = DB::connect($dsn); if (DB::isError($db)) { dir($db->getMessage()); } //検索条件に該当するレコード件数を取得 $sql = "SELECT COUNT(*) AS num FROM `{$table_name}` " ."WHERE $wherestr"; $result =& $db->query($sql); if (DB::isError($result)) { die ($result->getMessage()); } $row =& $result->fetchRow(DB_FETCHMODE_ASSOC); $num = $row['num']; ?> 史資料目録検索システム|<?php echo $row1[Document]; ?>
HOME史資料目録検索システム

目録

目録[全件](PDF版)

"; } ?>

検索方法(ヘルプ)

■史資料目録検索システム(Ver.1.0)■

簡易検索
フリーワード
 
詳細検索
年(西暦) ※半角数値
表題
内容
差出・作成
請取
 
検索条件"; foreach ($conditions as $key => $val) { if ($_SESSION[$key]) if ($val <> '文書番号'){ echo " {$val}: {$_SESSION[$key]}
"; } } } //件数0の場合 if (!$num){ echo "


検索条件に該当するデータはありません。

"; // exit(); //件数が存在する場合 }else{ //ページ数、開始・終了番号の計算 $params = array('perPage' => $numPage, 'totalItems' => $num ); $pager = & new Pager_Sliding($params); $links = $pager->getLinks(); $page = $pager->getCurrentPageID(); $pagenum = $pager->numPages(); $offset = ($page - 1)*PAGE_ITEMS; $from = $offset + 1; if ($offset+PAGE_ITEMS > $num) { $to = $num; } else { $to = $offset+PAGE_ITEMS; } //該当レコード抽出用SQL分を組み立て $sql = "SELECT * FROM `{$table_name}` ". "WHERE $wherestr ". "ORDER BY {$_SESSION['sort']} ". ($_SESSION['dir'] ? "DESC" : "ASC"). ", `Date_Code` ". "LIMIT ".PAGE_ITEMS." OFFSET $offset"; //SQLを実行 $result =& $db->query($sql); if (DB::isError($result)) { die ($result->getMessage()); } while ($row =& $result->fetchRow(DB_FETCHMODE_ASSOC)) { $list[] = $row; } //データベースから切断 $db->disconnect(); echo "

{$row1[Document]}目録:全"; echo "{$num}件中の"; echo "{$from}~{$to}"; echo "件({$page} / {$pagenum})

"; echo "
\n"; echo " \n\n\n\n
\n"; echo "{$links['all']}\n"; ?> \n
表示件数:"; echo "\n"; echo "\n
\n"; echo "
\n"; echo "
\n"; echo " \n"; echo " \n"; //項目名を出力 foreach ($fields as $key => $val) { switch ($key) { case 'Material_No': echo "\n"; // if ($_SESSION['sort'] == $key) { // $dirstr = $_SESSION['dir'] ? "▼" : "▲"; // $rdir = !$_SESSION['dir']; // echo ""; // } else { // echo ""; // } break; case 'Date': break; case 'AD': echo "\n"; break; case 'Date_Code': $dirstr = $_SESSION['dir'] ? "▼" : "▲"; $rdir = !$_SESSION['dir']; if ($_SESSION['sort'] == $key) { echo ""; } else { echo ""; } break; case 'Title': echo "\n"; break; case 'Creator': echo "\n"; break; case 'Form': echo "\n"; break; case 'Remarks': echo "\n"; break; case 'Search_Text': break; case 'Attached_file': $dirstr = $_SESSION['dir'] ? "▼" : "▲"; $rdir = !$_SESSION['dir']; if ($_SESSION['sort'] == $key) { echo ""; } else { echo ""; } break; case 'File_form': break; case 'File_size': break; } } echo " \n"; foreach ($list as $row) { echo " \n"; foreach ($fields as $key => $val ) { switch ($key) { case 'Core_NO': $core_no = $row[$key]; break; case 'Material_No': echo " \n"; break; case 'Date': echo " \n"; break; case 'AD': if (trim($row[$key]) <> 0) { echo " \n"; } else { echo " \n"; } break; case 'Date_Code': break; case 'Title': // echo " \n"; } else { echo "\n"; } break; case 'Creator': echo " \n"; } else { echo "\n"; } break; case 'Form': echo " \n"; break; case 'Remarks': if (trim($row[$key]) <>"") { echo " \n"; } else { echo "\n"; } break; case 'Search_Text': break; case 'Attached_file': if (trim($row[$key]) <>"") { echo " \n"; } else { echo "\n"; } break; } } echo " \n"; } echo "
資料番号"; // echo "{$val} {$dirstr}"; // echo "{$val}西暦"; echo "{$val} {$dirstr}"; echo "{$val}表題"; break; case 'Subject': echo "
(内容)
差出・作成"; break; case 'Payee': echo "
→請取
形・数備考"; echo "{$val} {$dirstr}"; echo "{$val}
{$row[$key]}{$row[$key]}{$row[$key]}{$row[$key]}"; echo " {$row[$key]}"; break; case 'Subject': if (trim($row[$key]) <>"") { echo "
({$row[$key]})\n"; } else { echo "\n"; } break; case 'kenmei_ichiran': if (trim($row[$key]) == 1) { // echo "
【件名一覧あり】"; echo "
{$row[$key]}"; break; case 'Payee': if (trim($row[$key]) <>"") { echo "
→{$row[$key]}
{$row[$key]}{$row[$key]}\n"; echo "\n"; echo ""; } break; case 'File_form': if (trim($row[$key]) <>"") { echo "{$row[$key]}' target='_blank'>画像あり\n("; echo strtoupper($row[$key]); echo ":"; } else { echo ""; } break; case 'File_size': if (trim($row[$key]) <> 0.00) { echo "{$row[$key]}MB)
\n"; echo "
\n"; // echo "
\n"; echo "
\n"; echo " \n\n\n\n
\n"; echo "{$links['all']}\n"; echo "\n
\n"; echo "
\n"; echo "
{$row1[Document]}目録:全{$num}件中の{$from}~{$to}件({$page}/{$pagenum})\n"; echo "
\n"; } if (!$_GET["numPage"]){ $ParaURL = $ParaURL; } else { if ($_GET["numPage"]==20){ $ParaURL = $ParaURL."&numPage=20"; }elseif($_GET["numPage"]==50){ $ParaURL = $ParaURL."&numPage=50"; }elseif($_GET["numPage"]==100){ $ParaURL = $ParaURL."&numPage=100"; } } ?>

目録(PDF版)