|
|
<?
# **********************************************************
# 外部ファイル
# **********************************************************
require_once( "common.php" );
require_once( "db.php" );
require_once( "model.php" );
# **********************************************************
# 定数定義
# **********************************************************
define( 'PASS_MESSAGE', 1 );
define( 'PASS_HEAD', 2 );
define( 'PASS_BODY', 3 );
define( 'VIEW_MESSAGE', 'viewmessage.php' );
define( 'VIEW_HEAD', 'view.php' );
define( 'VIEW_BODY', 'view2.php' );
# **********************************************************
# グローバル変数
# **********************************************************
$Target = '商品分類マスタ';
$KeyName = '';
$KeyField = '';
$ErrMessage = '';
$Message = '';
$InData = '';
$OutData = '';
$OptionList = '';
# **********************************************************
# 初期処理
# **********************************************************
if ( $_POST['In1001'] != "" ) {
setcookie( 'In1001', $_POST['In1001'] );
}
if ( $_POST['In1002'] != "" ) {
setcookie( 'In1002', $_POST['In1002'] );
}
$SQL = new DB( "localhost", "lightbox", "root", "" );
$SQL->Debug = FALSE;
# **********************************************************
# 処理コントロール
# **********************************************************
switch( $_POST['GNO'] ) {
# ヘッド部からの処理
case PASS_HEAD:
CheckDataHead( );
if ( $ErrMessage == "" ) {
GetData( $SQL );
}
else {
$_POST['GNO'] = PASS_MESSAGE;
}
break;
}
# **********************************************************
# ビュー
# **********************************************************
RestoreValue();
CreateInData( );
switch( $_POST['GNO'] ) {
# メッセージ表示
case PASS_MESSAGE:
require_once( VIEW_MESSAGE );
break;
# ヘッド部からの処理
case PASS_HEAD:
EditDataBody();
require_once( VIEW_BODY );
break;
# ボディ部からの処理
case PASS_BODY:
EditDataBody();
require_once( VIEW_BODY );
break;
# 初期画面
default:
if ( $_GET['view'] == 'head' ) {
RestoreCookie( );
EditDataHead( );
RestoreValue();
require_once( VIEW_HEAD );
}
if ( $_GET['view'] == 'body' ) {
EditDataBody();
require_once( VIEW_MESSAGE );
}
break;
}
# **********************************************************
# 終了処理
# **********************************************************
$SQL->Close();
# **********************************************************
# デバッグ
# **********************************************************
#DispData();
?>
| |
|
|
|
|
<?
# **********************************************************
# SQL文字列作成用
# **********************************************************
function SetCond( &$Value ) {
if ( $Value == "" ) {
$Value .= " where ";
}
else {
$Value .= " and ";
}
}
# **********************************************************
# データベースデータの読出し
# **********************************************************
function GetData( &$SQL ) {
global $Target,$KeyField,$KeyName;
$Query = 'select * from ' . $Target;
$Cond = "";
# 最初の条件
if ( $_POST['In1001'] != "" ) {
SetCond( $Cond );
$Cond .= "名称 like '%{$_POST['In1001']}%'";
}
# 2つ目の条件
if ( $_POST['In1002'] != "" ) {
SetCond( $Cond );
$Cond .= "left(商品分類,1) = '{$_POST['In1002']}'";
}
$Column = $SQL->QueryEx( $Query . $Cond );
while ( $Column ) {
EditQueryData( $Column );
$Column = $SQL->QueryEx( );
}
}
# **********************************************************
# データベースデータの編集
# **********************************************************
function EditQueryData( &$Column ) {
global $OutData;
$OutData .= "<TR>\n";
$OutData .= "<TD>";
$OutData .= $Column['商品分類'];
$OutData .= "</TD>\n";
$OutData .= "<TD>{$Column['名称']}</TD>\n";
$OutData .= "</TR>\n";
}
# **********************************************************
# ヘッド部の編集
# **********************************************************
function EditDataHead( ) {
global $Target,$KeyField,$KeyName;
global $OptionList,$SQL;
$Query = 'select コード,名称 from コード名称マスタ';
$Query .= " where 区分 = 5 order by コード";
$OptionList = CreateOption( $SQL, "In1002", $Query );
}
# **********************************************************
# ボディ部の編集
# **********************************************************
function EditDataBody( ) {
global $Target,$KeyField,$KeyName;
}
# **********************************************************
# 更新処理
# **********************************************************
function UpdateData( &$SQL ) {
global $ErrMessage,$Message;
global $Target,$KeyField,$KeyName;
return TRUE;
}
# **********************************************************
# 削除処理
# **********************************************************
function DeleteData( &$SQL ){
global $ErrMessage,$Message;
global $Target,$KeyField,$KeyName;
return TRUE;
}
# **********************************************************
# ヘッド部のエラーチェック
# **********************************************************
function CheckDataHead( ) {
global $ErrMessage;
global $Target,$KeyField,$KeyName;
return TRUE;
}
# **********************************************************
# ボディ部のエラーチェック
# **********************************************************
function CheckDataBody( ) {
global $ErrMessage;
global $Target,$KeyField,$KeyName;
return TRUE;
}
?>
| |
|
|
ページにリンクを作成して指定ページへジャンプさせる |
|