|
<?
# **********************************************************
# SQL文字列作成用
# **********************************************************
function SetCond( &$Value ) {
if ( $Value == "" ) {
$Value .= " where ";
}
else {
$Value .= " and ";
}
}
# **********************************************************
# データベースデータの読出し
# **********************************************************
function GetData( &$SQL ) {
global $Left;
global $Target,$KeyField,$KeyName;
$Query = 'select * from ' . $Target;
$Cond = " where ID = {$_POST['id']} order by 連番";
$Column = $SQL->QueryEx( $Query . $Cond );
$Cnt = 0;
while ( $Column ) {
$Cnt++;
EditQueryData( $Column, $Cnt );
$Column = $SQL->QueryEx( );
}
}
# **********************************************************
# データベースデータの編集
# **********************************************************
function EditQueryData( &$Column, $Cnt ) {
global $Left,$Mid,$Right;
if ( $_POST['mode'] == 'mtn' ) {
$Left[$Cnt] = "<INPUT size=50 name=IUL{$Column['連番']}";
$Left[$Cnt] .= " type=text value='{$Column['URL']}'><br>";
$Left[$Cnt] .= "<INPUT size=50 name=ITL{$Column['連番']}";
$Left[$Cnt] .= " type=text value='{$Column['タイトル']}'>";
$Mid[$Cnt] = "<INPUT size=50 name=IUM{$Column['連番']}";
$Mid[$Cnt] .= " type=text value='{$Column['URL2']}'><br>";
$Mid[$Cnt] .= "<INPUT size=50 name=ITM{$Column['連番']}";
$Mid[$Cnt] .= " type=text value='{$Column['タイトル2']}'>";
$Right[$Cnt] = "<INPUT size=50 name=IUR{$Column['連番']}";
$Right[$Cnt] .= " type=text value='{$Column['URL3']}'><br>";
$Right[$Cnt] .= "<INPUT size=50 name=ITR{$Column['連番']}";
$Right[$Cnt] .= " type=text value='{$Column['タイトル3']}'>";
}
else {
if ( $_POST['send'] != '' ) {
$Left[$Cnt] = "<INPUT size=50 name=IUL{$Column['連番']}";
$Left[$Cnt] .= " type=text value='{$_POST["IUL{$Column['連番']}"]}'><br>";
$Left[$Cnt] .= "<INPUT size=50 name=ITL{$Column['連番']}";
$Left[$Cnt] .= " type=text value='{$_POST["ITL{$Column['連番']}"]}'>";
$Mid[$Cnt] = "<INPUT size=50 name=IUM{$Column['連番']}";
$Mid[$Cnt] .= " type=text value='{$_POST["IUM{$Column['連番']}"]}'><br>";
$Mid[$Cnt] .= "<INPUT size=50 name=ITM{$Column['連番']}";
$Mid[$Cnt] .= " type=text value='{$_POST["ITM{$Column['連番']}"]}'>";
$Right[$Cnt] = "<INPUT size=50 name=IUR{$Column['連番']}";
$Right[$Cnt] .= " type=text value='{$_POST["IUR{$Column['連番']}"]}'><br>";
$Right[$Cnt] .= "<INPUT size=50 name=ITR{$Column['連番']}";
$Right[$Cnt] .= " type=text value='{$_POST["ITR{$Column['連番']}"]}'>";
}
else {
$Left[$Cnt] = "<a href='";
$Left[$Cnt] .= $Column['URL'];
$Left[$Cnt] .= "' style='text-decoration:none;color:navy'>";
$Left[$Cnt] .= $Column['タイトル'];
$Left[$Cnt] .= "</a>";
$Mid[$Cnt] = "<a href='";
$Mid[$Cnt] .= $Column['URL2'];
$Mid[$Cnt] .= "' style='text-decoration:none;color:navy'>";
$Mid[$Cnt] .= $Column['タイトル2'];
$Mid[$Cnt] .= "</a>";
$Right[$Cnt] = "<a href='";
$Right[$Cnt] .= $Column['URL3'];
$Right[$Cnt] .= "' style='text-decoration:none;color:navy'>";
$Right[$Cnt] .= $Column['タイトル3'];
$Right[$Cnt] .= "</a>";
}
}
}
# **********************************************************
# ヘッド部の編集
# **********************************************************
function EditDataHead( ) {
global $Target,$KeyField,$KeyName;
global $SendButton;
if ( $_POST['mode'] == 'mtn' ) {
$SendButton = '<INPUT type=submit name=send value="更新">';
}
if ( $_POST['send'] != '' ) {
$SendButton = '<INPUT type=submit name=send value="更新">';
}
}
# **********************************************************
# ボディ部の編集
# **********************************************************
function EditDataBody( ) {
global $Target,$KeyField,$KeyName;
}
# **********************************************************
# 更新処理
# **********************************************************
function UpdateData( &$SQL ) {
global $ErrMessage,$Message;
global $Target,$KeyField,$KeyName;
if ( $_POST['send'] != '更新' ) {
return;
}
foreach( $_POST as $Key => $Value ) {
if ( substr( $Key, 0, 3 ) == 'IUL' ) {
$Renban = str_replace( 'IUL', '', $Key );
$Query = 'update メニューマスタ';
$Query .= " set URL = '$Value'" ;
$Query .= " where id = {$_POST['id']}" ;
$Query .= " and 連番 = $Renban";
$SQL->Execute( $Query );
}
if ( substr( $Key, 0, 3 ) == 'ITL' ) {
$Renban = str_replace( 'ITL', '', $Key );
$Query = 'update メニューマスタ';
$Query .= " set タイトル = '$Value'" ;
$Query .= " where id = {$_POST['id']}" ;
$Query .= " and 連番 = $Renban";
$SQL->Execute( $Query );
}
if ( substr( $Key, 0, 3 ) == 'IUM' ) {
$Renban = str_replace( 'IUM', '', $Key );
$Query = 'update メニューマスタ';
$Query .= " set URL2 = '$Value'" ;
$Query .= " where id = {$_POST['id']}" ;
$Query .= " and 連番 = $Renban";
$SQL->Execute( $Query );
}
if ( substr( $Key, 0, 3 ) == 'ITM' ) {
$Renban = str_replace( 'ITM', '', $Key );
$Query = 'update メニューマスタ';
$Query .= " set タイトル2 = '$Value'" ;
$Query .= " where id = {$_POST['id']}" ;
$Query .= " and 連番 = $Renban";
$SQL->Execute( $Query );
}
if ( substr( $Key, 0, 3 ) == 'IUR' ) {
$Renban = str_replace( 'IUR', '', $Key );
$Query = 'update メニューマスタ';
$Query .= " set URL3 = '$Value'" ;
$Query .= " where id = {$_POST['id']}" ;
$Query .= " and 連番 = $Renban";
$SQL->Execute( $Query );
}
if ( substr( $Key, 0, 3 ) == 'ITR' ) {
$Renban = str_replace( 'ITR', '', $Key );
$Query = 'update メニューマスタ';
$Query .= " set タイトル3 = '$Value'" ;
$Query .= " where id = {$_POST['id']}" ;
$Query .= " and 連番 = $Renban";
$SQL->Execute( $Query );
}
}
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;
}
?>
| |