adminimenu.php
6.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<?php
//*****************************************************************************
//*
//* プログラム名:e-イベント
//* プログラムID:adminimenu.php
//* 機能 :管理者画面
//* 作成者 :
//*
//*****************************************************************************
//セッション開始
require_once("./include/session_start.inc");
require('function/operatezero.inc');
//ファイル名称取得
$filename = "eventmst".fun_addzero($main_mon).".csv";
//定数ファイル名称####
$ddir = "data/event/";
$filename = $ddir.$filename;
?>
<HTML>
<HEAD>
<TITLE>E_イベント管理者用画面</TITLE>
<SCRIPT Language="JavaScript">
<!--
function incheck(){
}
function Move_Menu(){
document.eventup.action = "main_menu.php";
document.eventup.method = "POST";
document.eventup.submit();
return;
}
function Move_LogOut(){
document.eventup.action = "login.php";
document.eventup.method = "POST";
document.eventup.submit();
return;
}
function Move_Update(){
if (document.eventup.rec.value == 0){
alert("レコードが存在しませんでした");
return false;
}
var maxcnt,cnt;
maxcnt = document.eventup.elements.length;
cnt = 0;
for(i = 2; i<maxcnt; i++){
if (document.eventup.elements[i].checked){
cnt++;
}
}
if (cnt == 0){
alert("処理対象が選択されていません");
return false;
}
if(confirm ("変更しますか?")){
document.eventup.action = "eventmod.php";
document.eventup.method = "POST";
document.eventup.submit();
return;
}
}
function Move_Delete(){
if (document.eventup.rec.value == 0){
alert("レコードが存在しませんでした");
return false;
}
var maxcnt,cnt;
maxcnt = document.eventup.elements.length;
cnt = 0;
for(i = 2; i<maxcnt; i++){
if (document.eventup.elements[i].checked){
cnt++;
}
}
if (cnt == 0){
alert("処理対象が選択されていません");
return false;
}
if(confirm ("削除しますか?")){
document.eventup.action = "eventdel.php";
document.eventup.method = "POST";
document.eventup.submit();
return;
}
}
-->
</SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
<link href="css/style.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY>
<FORM method="POST" name="eventup">
<TABLE width="100%" border="0" align="center" cellPadding=0 cellSpacing=0 class="header">
<TBODY>
<TR>
<TD align="left"><img src="image/titilemini.gif" alt="e-イベント" width="117" height="40"></TD>
<TD align="right" width="300">
<INPUT type="button" value="戻る" onclick="return Move_Menu()">
<INPUT type="button" value="ログアウト" onclick="return Move_LogOut()">
</TD>
</TR>
</TBODY>
</TABLE>
<?php
switch($syori){
case 2:
echo '<INPUT type="button" value="変更" onclick="return Move_Update()">';
break;
case 3:
echo '<INPUT type="button" value="削除" onclick="return Move_Delete()">';
break;
}
?>
<TABLE border="1" width="auto" cellspacing="1" callpadding="2" bgcolor="#ffffff">
<TR bgcolor ="#FFFFCC">
<TD colspan="13">
<FONT size="-1">
<?php
//見出しの設定
$midashi = array(" ", "イベント日付", "イベント名", "開始年月日", "終了年月日", "ホームページアドレス", "吹き出し文言");
$midashi_w = array("30", "95", "250", "80", "80", "200", "300");
$Num_cnst = 7;
switch($syori){
case 2:
$midashi[0] = "変更";
break;
case 3:
$midashi[0] = "削除";
break;
}
echo $main_year."年".$main_mon."月のデータ";
?>
</FONT>
</TD>
</TR>
<TR>
<?php
for ($m = 0; $m < $Num_cnst; $m++){
echo '<TD width='.$midashi_w[$m].'><FONT size="-1">'.$midashi[$m].'</FONT></TD>';
}
?>
</TR>
<?php
//!!PHPの処理
$fp = @fopen("$filename","r");
if ($fp == False){
print("ファイルを開くのに失敗しました。<BR>");
exit;
}
$rec_cnt = 0;
while($buf = fgetcsv($fp, 4096)){
$num = count($buf);
list($event_ymd, $event_idx, $eventname, $fyear, $fmon, $fday, $tyear, $tmon, $tday, $t_place, $hpadr, $msg) = $buf;
$exp_key = $event_ymd.",".$event_idx;
if(substr($event_ymd, 0, 4) == $main_year){
echo '<TR><TD width=30><FONT size="-1">';
if (($syori == "1") || ($syori == "3" )){
echo '<INPUT type="checkbox" name="touroku[]" value="'.$exp_key.'"></FONT></TD>';
}else{
echo '<INPUT type="radio" name="touroku" value="'.$exp_key.'"></FONT></TD>';
}
$eventy = substr($event_ymd, 0, 4);
$eventm = substr($event_ymd, 4, 2);
$eventd = substr($event_ymd, 6, 2);
$jun_tbl = array("33" => "上旬", "55" => "中旬", "99" => "下旬");
if (($eventd == 33) || ($eventd == 55) || ($eventd == 99)){
echo '<TD width=95><FONT size="-1">'.$eventy.'/'.$eventm.'/'.$jun_tbl[$eventd].'</FONT></TD>';
}else{
echo '<TD width=95><FONT size="-1">'.$eventy.'/'.$eventm.'/'.$eventd.'</FONT></TD>';
}
//ここから下はイベント登録ファイルの出力
if ($buf[2] != ""){
echo '<TD width=250><FONT size="-1">'.$buf[2].'</FONT></TD>';
}else{
echo '<TD width=250><FONT size="-1"><BR></FONT></TD>';
}
if (($fyear != "") && ($fmon != "") && ($fday != "")){
echo '<TD width=80><FONT size="-1">'.$fyear.'/'.$fmon.'/'.$fday.'</FONT></TD>';
}else{
echo '<TD width=80><FONT size="-1"><BR></FONT></TD>';
}
if (($tyear != "") && ($tmon != "") && ($tday != "")){
echo '<TD width=80><FONT size="-1">'.$tyear.'/'.$tmon.'/'.$tday.'</FONT></TD>';
}else{
echo '<TD width=80><FONT size="-1"><BR></FONT></TD>';
}
for($i = 10; $i < 12; $i++){
$s = $i-4;
if ($buf[$i] != ""){
echo '<TD width='.$midashi_w[$s].'><FONT size="-1">';
echo '<div class="url_return">'.$buf[$i].'</div></TD></FONT>';
}else{
echo '<TD width='.$midashi_w[$s].'><FONT size="-1">';
echo '<BR></TD></FONT>';
}
}
echo '</TR>';
$rec_cnt++;
}
}
echo '</TABLE>';
fclose($fp);
echo '登録件数は'.$rec_cnt;
echo '件でした<BR><BR>';
?>
<INPUT type ="hidden" name="main_year" value ="<?php echo $main_year; ?>">
<INPUT type ="hidden" name="main_mon" value ="<?php echo $main_mon; ?>">
<INPUT type ="hidden" name="file_month" value ="<?php echo $main_mon; ?>">
<INPUT type ="hidden" name="filetyp" value ="<?php echo $filetyp; ?>">
<INPUT type ="hidden" name="rec" value ="<?php echo $rec_cnt; ?>">
<INPUT type ="hidden" name="syori" value ="<?php echo $syori; ?>">
</FORM>
</BODY>
</HTML>