質問編集履歴
1
ソースコード全公開
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,11 +8,193 @@
|
|
8
8
|
<option value="test">テスト</option>
|
9
9
|
```
|
10
10
|
```import.php
|
11
|
+
<head>
|
12
|
+
<link rel="stylesheet" href="css/import.css" type="text/css">
|
13
|
+
<link href="https://fonts.googleapis.com/css?family=M+PLUS+1p&display=swap" rel="stylesheet">
|
14
|
+
<title>インポート確認</title>
|
15
|
+
<script type="text/javascript">
|
16
|
+
function submitChk () {
|
17
|
+
/* 確認ダイアログ表示 */
|
18
|
+
var flag = confirm ("この内容で登録して宜しいですか?\n\n登録したくない場合は[キャンセル]ボタンを押して下さい");
|
19
|
+
/* send_flg が TRUEなら送信、FALSEなら送信しない */
|
20
|
+
return flag;
|
21
|
+
}
|
22
|
+
function set2fig(num) {
|
23
|
+
// 桁数が1桁だったら先頭に0を加えて2桁に調整する
|
24
|
+
var ret;
|
25
|
+
if( num < 10 ) { ret = "0" + num; }
|
26
|
+
else { ret = num; }
|
27
|
+
return ret;
|
28
|
+
}//時計
|
29
|
+
function showClock2() {
|
30
|
+
var nowTime = new Date();
|
31
|
+
var nowHour = set2fig( nowTime.getHours() );
|
32
|
+
var nowMin = set2fig( nowTime.getMinutes() );
|
33
|
+
var nowSec = set2fig( nowTime.getSeconds() );
|
34
|
+
var msg = nowHour + ":" + nowMin + ":" + nowSec;
|
35
|
+
document.getElementById("RealtimeClockArea").innerHTML = msg;
|
36
|
+
}//時計
|
37
|
+
setInterval('showClock2()',1000);
|
38
|
+
</script>
|
39
|
+
</head>
|
40
|
+
<?php
|
41
|
+
try{
|
42
|
+
$pdo = new PDO('mysql:host=localhost;dbname=workinfo;charset=utf8', 'root','root',
|
43
|
+
array(PDO::ATTR_EMULATE_PREPARES => false));
|
44
|
+
} catch (PDOException $e) {
|
45
|
+
exit('データベース接続失敗。'.$e->getMessage());
|
46
|
+
}
|
47
|
+
|
11
|
-
|
48
|
+
//工場を取得
|
12
|
-
<form enctype="multipart/form-data" action="insert.php" method="post">
|
13
49
|
$location = $_REQUEST['location'];
|
14
|
-
var_dump($location); →string(4)'test'
|
15
|
-
|
50
|
+
//理念を取得'
|
51
|
+
$philosophy = $_REQUEST['philosophy'];
|
52
|
+
//変数に配列を代入
|
53
|
+
$data = array();
|
54
|
+
function add_person($workday, $workgroup, $personal, $product, $create, $unit, $exp, $remarks, $worktime, $breaktime)
|
55
|
+
{
|
56
|
+
global $data;
|
57
|
+
|
58
|
+
//配列にヘッダーの列名を代入
|
59
|
+
$data []= array(
|
60
|
+
'workday' => $workday,
|
61
|
+
'workgroup' => $workgroup,
|
62
|
+
'personal' => $personal,
|
63
|
+
'product' => $product,
|
64
|
+
'create' => $create,
|
65
|
+
'unit' => $unit,
|
66
|
+
'exp' => $exp,
|
67
|
+
'remarks' => $remarks,
|
68
|
+
'worktime' => $worktime,
|
69
|
+
'breaktime' => $breaktime
|
70
|
+
);
|
71
|
+
}
|
72
|
+
//ファイルの読み込み
|
73
|
+
if ( $_FILES['file']['tmp_name'] )
|
74
|
+
{
|
75
|
+
$dom = DOMDocument::load( $_FILES['file']['tmp_name'] );
|
76
|
+
$rows = $dom->getElementsByTagName( 'Row' );
|
77
|
+
//日付に項目がある場合の処理(基本)
|
78
|
+
$workday_row = true;
|
79
|
+
//繰り返し
|
80
|
+
foreach ($rows as $row){
|
81
|
+
if ( !$workday_row ){
|
82
|
+
$workday = "";
|
83
|
+
$workgroup = "";
|
84
|
+
$personal = "";
|
85
|
+
$product = "";
|
86
|
+
$create = "";
|
87
|
+
$unit = "";
|
88
|
+
$exp = "";
|
89
|
+
$remarks = "";
|
90
|
+
$worktime = "";
|
91
|
+
$breaktime = "";
|
92
|
+
|
93
|
+
$index = 1;
|
94
|
+
$cells = $row->getElementsByTagName( 'Cell' );
|
95
|
+
foreach( $cells as $cell ){
|
96
|
+
$ind = $cell->getAttribute( 'Index' );
|
97
|
+
if ( $ind != null ) $index = $ind;
|
98
|
+
|
99
|
+
if ( $index == 1 ) $workday = $cell->nodeValue;
|
100
|
+
if ( $index == 2 ) $workgroup = $cell->nodeValue;
|
101
|
+
if ( $index == 3 ) $personal = $cell->nodeValue;
|
102
|
+
if ( $index == 4 ) $product = $cell->nodeValue;
|
103
|
+
if ( $index == 5 ) $create = $cell->nodeValue;
|
104
|
+
if ( $index == 6 ) $unit = $cell->nodeValue;
|
105
|
+
if ( $index == 7 ) $exp = $cell->nodeValue;
|
106
|
+
if ( $index == 8 ) $remarks = $cell->nodeValue;
|
107
|
+
if ( $index == 9 ) $worktime= $cell->nodeValue;
|
108
|
+
if ( $index == 10) $breaktime = $cell->nodeValue;
|
109
|
+
|
110
|
+
$index += 1;
|
111
|
+
}/*
|
112
|
+
//SQL文
|
113
|
+
$sql = "INSERT INTO $location (workday, workgroup, personal, contents, product, worktime, breaktime) Values(:workday, :workgroup, :personal, :contents, :product, :worktime, :breaktime)";
|
114
|
+
$stmt = $pdo -> prepare($sql);
|
115
|
+
$workday = substr($workday,0,10);
|
116
|
+
//$stmt -> bindParam(':location',$location,PDO::PARAM_STR);
|
117
|
+
$stmt -> bindParam(':workday',$workday,PDO::PARAM_STR);
|
118
|
+
$stmt -> bindParam(':workgroup',$workgroup,PDO::PARAM_STR);
|
119
|
+
$stmt -> bindParam(':personal',$personal,PDO::PARAM_STR);
|
120
|
+
$stmt -> bindParam(':contents',$contents,PDO::PARAM_STR);
|
121
|
+
$stmt -> bindParam(':product',$product,PDO::PARAM_STR);
|
122
|
+
$stmt -> bindParam(':worktime',$worktime,PDO::PARAM_STR);
|
123
|
+
$stmt -> bindParam(':breaktime',$breaktime,PDO::PARAM_STR);
|
124
|
+
|
125
|
+
$stmt->execute();
|
126
|
+
*/
|
127
|
+
//var_dump($sql);
|
128
|
+
add_person($workday, $workgroup, $personal, $product, $create, $unit, $exp, $remarks, $worktime, $breaktime);
|
129
|
+
//var_dump($workday, $workgroup, $personal, $contents, $product, $worktime, $breaktime);
|
130
|
+
}
|
131
|
+
$workday_row = false;
|
132
|
+
}
|
133
|
+
}
|
134
|
+
?>
|
135
|
+
<html>
|
136
|
+
<body>
|
137
|
+
<!--
|
138
|
+
<ul class="link">
|
139
|
+
<li><a href="index.php">業務内容アップロード</a></li>
|
140
|
+
<li><a href="ogaki.php">大垣工場</a></li>
|
141
|
+
<li><a href="iga.php">伊賀工場</a></li>
|
142
|
+
</ul>
|
143
|
+
-->
|
144
|
+
<div id="header">
|
145
|
+
<img src="img/text-logo-new.png"class="titlelogo">
|
146
|
+
<img src="img/logo-new.png" class="logo">
|
147
|
+
<h1 class="title">生産計画表 製造場所:(
|
148
|
+
<?php if($location == 'ogaki'){
|
149
|
+
echo '大垣';
|
150
|
+
}else {
|
151
|
+
echo '伊賀';
|
152
|
+
}
|
153
|
+
; ?>)
|
154
|
+
</h1>
|
155
|
+
<!--日付+曜日+時計-->
|
156
|
+
<?php
|
157
|
+
$week = array( "日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日" );
|
158
|
+
?>
|
159
|
+
<h2>本日の日付:<?php echo date("Y/m/d").' '.'('.$week[date("w")].')';?>
|
160
|
+
<div class="clock">
|
161
|
+
<h2 style="display:inline" id="RealtimeClockArea"></h2>
|
162
|
+
</div>
|
163
|
+
<hr>
|
164
|
+
</div>
|
165
|
+
<marquee><h2 class="philosophy"><?php echo $philosophy; ?></h2></marquee>
|
166
|
+
<table border ="1" class="table">
|
167
|
+
<hr>
|
168
|
+
<tr>
|
169
|
+
<th>グループ</th>
|
170
|
+
<th>担当者</th>
|
171
|
+
<th>製造製品</th>
|
172
|
+
<th>生産量</th><!--単位も含める-->
|
173
|
+
<th>賞味期限</th>
|
174
|
+
<th>備考</th>
|
175
|
+
<th>就業時間</th>
|
176
|
+
<th>休憩時間</th>
|
177
|
+
</tr>
|
178
|
+
<?php foreach( $data as $row ) { ?>
|
179
|
+
<tr>
|
180
|
+
<td><?php echo( $row['workgroup'] ); ?></td>
|
181
|
+
<td><?php echo( $row['personal'] ); ?></td>
|
182
|
+
<td><?php echo( $row['product'] ); ?></td>
|
183
|
+
<td><?php echo( $row['create'].$row['unit'] ); ?></td>
|
184
|
+
<td><?php echo( $row['exp'] ); ?></td>
|
185
|
+
<td><?php echo( $row['remarks'] ); ?></td>
|
186
|
+
<td><?php echo( $row['worktime'] ); ?></td>
|
187
|
+
<td><?php echo( $row['breaktime'] ); ?></td>
|
188
|
+
</tr>
|
189
|
+
<?php } ?>
|
190
|
+
</table>
|
191
|
+
<form enctype="multipart/form-data" action="insert.php" method="post" onsubmit="return submitChk()">
|
192
|
+
<input type="hidden" name="workgroup" value=<?php echo $workgroup ?>>
|
193
|
+
<input type="hidden" name="personal" value=<?php echo $personal ?>>
|
194
|
+
<input type="submit" value="登録" />
|
195
|
+
</body>
|
196
|
+
</html>
|
197
|
+
|
16
198
|
```
|
17
199
|
```insert.php
|
18
200
|
省略///
|