value['id']) || $param->value['id'] == '' ) { echo '指定された施工事例は存在しません。' ; exit(); } $p_id = urldecode($param->value['id']); // ///////////////////////////////////////////////////////////////////////// // ■ データ読込 /////////////////////////////////////////////////////////// // 事例マスタ読込み $strSQL = "select * from jirei_maseken".MODE_DB." where id = ? ;"; $row_jirei = $objDB->getRow($strSQL, array( $p_id ), DB_FETCHMODE_ASSOC ); if ( DB::isError($row_jirei) ) { echo '施工事例の読込みに失敗しました。' ; exit(); } if ( is_null($row_jirei) || !is_array($row_jirei) || count($row_jirei) <= 0 ) { echo '指定された施工事例は存在しません。' ; exit(); } if ( substr( $row_jirei['pub'], PUB_JIR - 1, 1 ) == '0' ) { echo '指定された施工事例は存在しません。' ; exit(); } // ///////////////////////////////////////////////////////////////////////// // ■ HTMLファイル出力 ///////////////////////////////////////////////////// // テンプレートクラスを生成する $objTmpl = New Tmpl2('detail_tpl.html'); // 各種インクルード設定 $objTmpl->assign ( "INC_HEADER", file_exists(INC_HEADER) ? file_get_contents(INC_HEADER) : '' ); $objTmpl->assign ( "INC_FOOTER", file_exists(INC_FOOTER) ? file_get_contents(INC_FOOTER) : '' ); $objTmpl->assign ( "INC_META", file_exists(INC_META) ? file_get_contents(INC_META) : '' ); // 最終更新日 $objTmpl->assign ( "UPDDATE", htmlspecialchars( $upddate ) ) ; $objTmpl->assign ( "COPY", sprintf( $topcopy ) ); $objTmpl->assign ( "CITEM1", sprintf( $citem1 ) ); $objTmpl->assign ( "CITEM2", sprintf( $citem2 ) ); $objTmpl->assign ( "CITEM3", sprintf( $citem3 ) ); $objTmpl->assign ( "CITEM4", sprintf( $citem4 ) ); // 入力フォームデータ表示 $date = substr( $row_jirei['date'], 0, 4 ).'.'.substr( $row_jirei['date'], 4, 2 ).'.'.substr( $row_jirei['date'], 6, 2 ) ; $q = compileQueryString( $p_querystring ); if ( $q != '' ) { $objTmpl->assign ( "QUERY_STRING", '?'.htmlspecialchars( $q ) ) ; } $objTmpl->assign ( "TITLE", nl2br( htmlspecialchars( $row_jirei['title'] ) ) ) ; $objTmpl->assign ( "NAME", htmlspecialchars( $row_jirei['name'] ) ) ; $objTmpl->assign ( "CONTENTS", nl2br( htmlspecialchars( $row_jirei['contents'] ) ) ) ; // $objTmpl->assign ( "EPISODE", nl2br( htmlspecialchars( $row_jirei['episode'] ) ) ) ; if ( $row_jirei['link'] != '' ) { $objTmpl->assign_def ( "LINK_ON" ) ; if ( $row_jirei['linkcap'] != '' ) { $cap = $row_jirei['linkcap']; } else { $cap = $row_jirei['link']; } $link = ''.htmlspecialchars( $cap ).''; $objTmpl->assign ( "LINK", $link ) ; } if ( $row_jirei['inqmail'] != '' ) { $objTmpl->assign_def ( "INQ_MAIL_ON" ) ; $objTmpl->assign ( "INQ_MAIL", nl2br( htmlspecialchars($row_jirei['inqmail']) ) ) ; } // メイン写真 if ( file_exists(PATH_UPIMG.$row_jirei['mimg']) && $row_jirei['mimg'] != '' ) { // list( $w, $h ) = getImageSizeXY( PATH_UPIMG.$row_jirei['mimg'], SIZE_MIMG_W, SIZE_MIMG_H ) ; list( $w, $h ) = getImageSizeXY( PATH_UPIMG.'thumb_'.$row_jirei['mimg'], false, false ) ; $objTmpl->assign ( "ID", htmlspecialchars( $p_id ) ) ; $objTmpl->assign ( "MIMG_W", htmlspecialchars( $w ) ) ; $objTmpl->assign ( "MIMG_H", htmlspecialchars( $h ) ) ; } $objTmpl->assign ( "MIMG_CAP", htmlspecialchars( $row_jirei['mimgcap'] ) ) ; // 写真資料関連 if ( trim($row_jirei['img1']) != '' || trim($row_jirei['img2']) != '' || trim($row_jirei['img3']) != '' || trim($row_jirei['img4']) != '' || trim($row_jirei['img5']) != '' ) { $objTmpl->assign_def ( "IMGS_ON" ) ; $cols = 0; $img = array( '1' => array($row_jirei['img1'], $row_jirei['imgcap1']), '2' => array($row_jirei['img2'], $row_jirei['imgcap2']), '3' => array($row_jirei['img3'], $row_jirei['imgcap3']), '4' => array($row_jirei['img4'], $row_jirei['imgcap4']), '5' => array($row_jirei['img5'], $row_jirei['imgcap5']) ) ; $objTmpl->loopset ( "IMGS_ROWS" ) ; foreach( $img as $key => $val ) { if ( ++$cols > 2 ) { $objTmpl->loopend ( "IMGS_COLS" ) ; $objTmpl->loopnext( "IMGS_ROWS" ) ; $cols = 1; } if ( $cols == 1 ) { $objTmpl->loopset ( "IMGS_COLS" ) ; } // list( $w, $h ) = getImageSizeXY( PATH_UPIMG.$val[0], SIZE_IMG_W, SIZE_IMG_W ) ; list( $w, $h ) = getImageSizeXY( PATH_UPIMG.'thumb_'.$val[0], false, false ) ; if ( file_exists(PATH_UPIMG.$val[0]) && $val[0] != '' ) { $objTmpl->assign ( "IMG_ON", '' ) ; $objTmpl->assign ( "ID", htmlspecialchars( $p_id ) ) ; $objTmpl->assign ( "NO", htmlspecialchars( $key ) ) ; $objTmpl->assign ( "IMG_W", htmlspecialchars( $w) ) ; $objTmpl->assign ( "IMG_H", htmlspecialchars( $h) ) ; $objTmpl->assign ( "IMGCAP", htmlspecialchars( $val[1] ) ) ; } $objTmpl->loopnext ( "IMGS_COLS" ) ; } if ( $cols != 0 ) { for ( ; $cols < 2 ; $cols++ ) { $objTmpl->loopnext ( "IMGS_COLS" ) ; } $objTmpl->loopend ( "IMGS_COLS" ) ; $objTmpl->loopnext( "IMGS_ROWS" ) ; } $objTmpl->loopend ( "IMGS_ROWS" ) ; } // 添付資料関連 $objTmpl->loopset ( "DOCS" ) ; $doc = array( '1' => array($row_jirei['doc1'], $row_jirei['doccap1']), '2' => array($row_jirei['doc2'], $row_jirei['doccap2']), '3' => array($row_jirei['doc3'], $row_jirei['doccap3']) ) ; foreach( $doc as $key => $val ) { if ( $val[0] == '' ) continue; $objTmpl->assign ( "ID", htmlspecialchars( $row_jirei['id'] ) ) ; $objTmpl->assign ( "NO", htmlspecialchars( $key ) ) ; $objTmpl->assign ( "DOCCAP", htmlspecialchars( $val[1] ) ) ; $fext = getFileExtension( $val[0] ); if ( isset($TBL_FILETYPE[$fext]) ) { $docinfo = $TBL_FILETYPE[$fext]; } else { $docinfo = '資料'; } $docinfo .= ':'.getFileSizeString(PATH_UPDOC.$val[0]); $objTmpl->assign ( "DOCREF", htmlspecialchars( $docinfo ) ) ; $objTmpl->loopnext( "DOCS" ) ; } $objTmpl->loopend ( "DOCS" ) ; // HTML出力 disableBrowsercache() ; $objTmpl->flush() ; ?>