-
Notifications
You must be signed in to change notification settings - Fork 5
/
item.php
146 lines (137 loc) · 4.19 KB
/
item.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
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
<?php
/*
Copyright (C) 2014 Nicholas Anderson
This file is part of Audemium ERP. Audemium ERP is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Audemium ERP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with Audemium ERP. If not, see <http://www.gnu.org/licenses/>.
*/
require_once('init.php');
$sth = $dbh->prepare(
'SELECT *
FROM '.$TYPES[$_GET['type']]['pluralName'].'
WHERE '.$TYPES[$_GET['type']]['idName'].' = :id');
$sth->execute([':id' => $_GET['id']]);
$item = $sth->fetch();
$parsed = parseValue($_GET['type'], $item);
$name = getName($_GET['type'], $_GET['id']);
?>
<!DOCTYPE html>
<html>
<head>
<title><?php echo $name; ?></title>
<?php
require('head.php');
?>
<script type="text/javascript">
var type = '<?php echo $_GET['type']; ?>';
var id = <?php echo $_GET['id']; ?>;
var active = <?php echo $item['active']; ?>;
//echo date/time formats
var dateFormatJS = '<?php echo $SETTINGS['dateFormatJS'] ?>';
var timeFormatJS = '<?php echo $SETTINGS['timeFormatJS'] ?>';
</script>
<script type="text/javascript" src="js/item.js"></script>
<?php
$file = 'js/'.$TYPES[$_GET['type']]['formalName'].'.js';
if (file_exists($file)) {
echo '<script type="text/javascript" src="'.$file.'"></script>';
}
?>
</head>
<body>
<?php
require('menu.php');
?>
<div id="content">
<div id="topControls">
<div id="topControlLeft"></div>
<div id="topControlCenter">
<a class="controlAdd addEnabled" href="#">Add</a>
<a class="controlEdit editDisabled" href="#" title="Item is inactive and cannot be edited">Edit</a>
<a class="controlDelete deleteDisabled" href="#" title="Item is inactive and cannot be deleted">Delete</a>
</div>
<div id="topControlRight"></div>
</div>
<div id="data">
<h1><?php echo $name; ?></h1>
<?php
foreach ($TYPES[$_GET['type']]['formData'] as $key => $section) {
echo '<section><h2>'.$key.'</h2><div class="sectionData">';
foreach ($section as $column) {
echo '<dl>';
foreach ($column as $field) {
echo '<dt>'.$TYPES[$_GET['type']]['fields'][$field]['formalName'].'</dt>';
echo '<dd>'.$parsed[$field].'</dd>';
}
echo '</dl>';
}
echo '</div></section>';
}
$factoryItem = Factory::createItem($_GET['type']);
echo $factoryItem->printItemBody($_GET['id']);
echo $factoryItem->printAttachments($_GET['type'], $_GET['id']);
?>
<section>
<h2>History</h2>
<div class="sectionData">
<table class="dataTable stripe row-border" id="historyTable">
<thead>
<tr>
<th class="dateTimeHeader textLeft">Time</th>
<th class="textLeft">Modified By</th>
<th class="textLeft">Changes</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td colspan="3" class="tableFooter">
<a href="#">View All</a>
</td>
</tr>
</tfoot>
</table>
</div>
</section>
</div>
<?php
require('footer.php');
?>
</div>
<div class="popup" id="defaultPopup">
<div>
<a class="close" title="Close">X</a>
<div></div>
</div>
</div>
<div class="popup" id="attachmentPopup">
<div>
<a class="close" title="Close">X</a>
<div>
<h1>Add Attachment</h1>
<section>
<h2></h2>
<div class="sectionData">
<form action="#" enctype="multipart/form-data" method="post">
<label for="uploadFile">File (max size <?php echo ini_get('upload_max_filesize'); ?>)</label>
<input type="file" name="uploadFile">
</form>
<div class="meter">
<span style="width:0%;"></span>
</div>
</div>
</section>
<div class="btnSpacer">
<button id="attachmentBtn">Add</button>
</div>
</div>
</div>
</div>
<?php
echo $factoryItem->printPopups();
?>
</body>
</html>