common = new Common; $this->template = new Template; $this->db = new DB; $this->kenpou = new Kenpou; return; } /** * 検索メイン * @param string $start 検索表示の開始件数 * @param string $category_id カテゴリID * @param string $mode 検索モード * @param string $kind_id 種類ID * @param string $title_1 書籍・論文 * @param string $writer 著者 * @param string $bulletin 雑誌・紀要 * @param string $publishing 出版社 * @param string $select 検索方法( AND OR ) * @return void 戻り値なし **/ function main ( $start, $category_id, $mode, $kind_id, $title_1, $writer, $bulletin, $publishing, $select ) { // 共通で扱う配列 $kenpou_data = array(); $keyword_list = array(); $parent_list = array(); $tmp_data = array(); // 表示開始件数のデフォルト値 if ( ! $start ) { $start = 0; } // カテゴリ選択のデフォルト値 if ( ! $category_id ) { $category_id = "1"; } else if ( $category_id == "no_select" ) { $category_id = "0"; } // カテゴリ検索トップページへ遷移の場合 if ( $category_id == "0" && ! $keyword && ( $start == "0" || $start ) ) { $category_id = "1"; } // カテゴリIDを格納する $kenpou_data[ "category_id" ] = $category_id; // ラジオBox // 詳細検索項目の格納 if ( $select == "AND" ) { $opt_and = "checked"; $opt_or = ""; } else if ( $select == "OR" ) { $opt_and = ""; $opt_or = "checked"; } else { $opt_and = "checked"; $opt_or = ""; } // 表示順項目の格納 if ( $mode == "DESC" ) { $opt_desc = "checked"; $opt_asc = ""; } else if ( $mode == "ASC" ) { $opt_desc = ""; $opt_asc = "checked"; } else { $opt_desc = "checked"; $opt_asc = ""; } $kenpou_data[ "DESCchecked" ] = $opt_desc; $kenpou_data[ "ASCchecked" ] = $opt_asc; $kenpou_data[ "ANDchecked" ] = $opt_and; $kenpou_data[ "ORchecked" ] = $opt_or; $kind_checked = $this->checkSelectKindChecked( $kind_id ); $kenpou_data[ "kind1_checked" ] = $kind_checked[ "kind1" ]; $kenpou_data[ "kind2_checked" ] = $kind_checked[ "kind2" ]; $kenpou_data[ "kind3_checked" ] = $kind_checked[ "kind3" ]; $kenpou_data[ "kind4_checked" ] = $kind_checked[ "kind4" ]; $kenpou_data[ "kind_id" ] = $kind_id; $kenpou_data[ "title_1" ] = $title_1; $kenpou_data[ "writer" ] = $writer; $kenpou_data[ "bulletin" ] = $bulletin; $kenpou_data[ "publishing" ] = $publishing; $kenpou_data[ "category_id" ] = $category_id; $kenpou_data[ "start" ] = $start; $kenpou_data[ "select" ] = $select; $key_data = $this->common->setTemplatePrivateDataList( $kenpou_data ); $kenpou_data[ "search" ] = $this->template->contentsFlushList( "template/", "select_search.html", $key_data ); // overwrite 2004.01.20 $category_check = $this->checkSelectCategoryChecked( $category_id ); $tmp_data = $this->common->setTemplatePrivateData( $category_check, "CHECKED" ); $kenpou_data[ "contents" ] = $this->template->contentsFlush( "template/","category_list.html", $tmp_data ); // HTMLの取得・表示 $ret_data = $this->common->setTemplatePrivateDataList( $kenpou_data ); $contents_html = $this->template->contentsFlushList( "template/", "index.html", $ret_data ); $contents_data = $this->common->setTemplatePrivateData( "contents", $contents_html ); $html = $this->template->contentsFlush( "template/","main.html", $contents_data ); // ヘッダー情報の取得 $header_html = $this->template->contentsFlush( "template/","header.html" ); // フッター情報の取得 $footer_html = $this->template->contentsFlush( "template/","footer.html" ); // 表示するHTMLを生成する $html = $header_html . $html . $footer_html; echo $html; return; } /** * 種類選択のセレクトリストの値を判断する * @param string $kind_id 種類ID * @return array $check_list 種類選択リストの値を返す **/ function checkSelectKindChecked ( $kind_id ) { // 選択リスト $check_list = array(); // 書籍を選択 if ( $kind_id == 1 ) { $check_list[ "kind1" ] = "selected"; $check_list[ "kind2" ] = ""; $check_list[ "kind3" ] = ""; $check_list[ "kind4" ] = ""; // 紀要論文を選択 } else if ( $kind_id == 2 ) { $check_list[ "kind2" ] = "selected"; $check_list[ "kind1" ] = ""; $check_list[ "kind3" ] = ""; $check_list[ "kind4" ] = ""; // その他論文を選択 } else if ( $kind_id == 3 ) { $check_list[ "kind3" ] = "selected"; $check_list[ "kind1" ] = ""; $check_list[ "kind2" ] = ""; $check_list[ "kind4" ] = ""; // その他を選択 } else if ( $kind_id == 4 ) { $check_list[ "kind4" ] = "selected"; $check_list[ "kind1" ] = ""; $check_list[ "kind2" ] = ""; $check_list[ "kind3" ] = ""; } return $check_list; } /** * 分類選択の値を判断する * @param string $category_id カテゴリID * @return string $key 選択IDのCHECKEDを返す **/ function checkSelectCategoryChecked ( $category_id ) { $key = "1checked"; // 選択リスト $check_list = $this->kenpou->getCategorySelectList( $this->db ); for ( $num = 0; $num < count( $check_list ); $num++ ) { // 選択されているラジオBoxの判断 if ( $category_id == $check_list[ $num ] ) { $key = $check_list[ $num ]."checked"; } } return $key; } } // グローバル変数の受け取り $start = $HTTP_GET_VARS[ "start" ]; $category_id = $HTTP_GET_VARS[ "category_id" ]; $mode = $HTTP_GET_VARS[ "mode" ]; $kind_id = $HTTP_GET_VARS[ "kind_id" ]; $title_1 = $HTTP_GET_VARS[ "title_1" ]; $writer = $HTTP_GET_VARS[ "writer" ]; $bulletin = $HTTP_GET_VARS[ "bulletin" ]; $publishing = $HTTP_GET_VARS[ "publishing" ]; $select = $HTTP_GET_VARS[ "select" ]; //$title_2 = $HTTP_GET_VARS[ "title_2" ]; //$sub_title = $HTTP_GET_VARS[ "sub_title" ]; //$id = $HTTP_GET_VARS[ "id" ]; // Searchクラスの実行 $index = new Index; $index->main( $start, $category_id, $mode, $kind_id, $title_1, $writer, $bulletin, $publishing, $select ); ?>