-
Notifications
You must be signed in to change notification settings - Fork 1
/
readSoilFiles.php
92 lines (83 loc) · 2.46 KB
/
readSoilFiles.php
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
<?php include("parts_checkSession.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-US" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/frame.css" />
<title>Read Soil Files</title>
<script src="js/function.js" type="text/javascript">
</script>
<style type="text/css">
.style1 {
border: 1px solid #000000;
background-color: #C0C0C0;
}
.style2 {
border: 2px solid #000000;
}
.style3 {
border: 1px solid #000000;
}
.style4 {
border: 1px solid #000000;
text-align: center;
}
.style5 {
text-align: center;
}
</style>
</head>
<body>
<div id="container">
<?php include("parts_header.php"); ?>
<?php include("functionForSoil.php"); ?>
<?php
$fileNum = 1;
$files = array();
for($i = 0; $i < $fileNum; $i++) {
$line = "";
$flg[0] = "";
$flg[1] = "";
$flg[2] = "";
$lineNo = 0;
$ret = createSoilArray();
$file = fopen($_FILES["FilePath"]["tmp_name"],"r") or exit("Unable to open file!");
while(!feof($file)) {
$lineNo++;
$line = fgets($file);
$flg = judgeContentType($line, $flg); // explode,splitStrToArray
//echo "[line".$lineNo."],[".$flg[0]."],[".$flg[1]."],[".$flg[2]."]<br>"; //debug
$ret = getSpliterResult($flg, $line, $ret);
}
fclose($file);
//$ret = checkExpId($ret, $_FILES["FilePath"]["name"]); // TODO if there must be a soil id, then add this method to do that
$files[$i] = $ret;
printSoilArray($ret); //debug
//print_r($ret); //debug
}
?>
<div id="content">
<form id="form1" method="post" action="saveFiles.php">
<table class="style2" style="width: 600px" align="center">
<!--tr>
<td class="style1">Experiment ID</td>
<td class="style1">Treatment Num</td>
<td class="style1">Treatment Name</td>
<td class="style1" style="width: 81px">Select?</td>
</tr-->
<?php
echo "<input name='files' type='hidden' value='" . json_encode($files) . "' />";
?>
</table>
<br />
<p class="style5">
<span><input name="Button1" type="button" value="Back" onclick="goBack()"/></span>
<span><input id="save" name="save" type="button" value="Save" onclick="checkChkbox('<?php echo $jsCheck; ?>')" /></span></form>
</p>
</form>
</div>
<?php include("parts_footer.php"); ?>
</div>
</body>
</html>