This repository has been archived by the owner on Aug 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheditReport.php
223 lines (150 loc) · 6.03 KB
/
editReport.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
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
<?php
include($_SERVER['DOCUMENT_ROOT'].'/php/user_session_check.php'); //checks if user is logged on
$permission_status = 0;
foreach ($_SESSION['permissions'] as $item) {
//echo $item;
if ($item['position'] == "sso_admin") {
$permission_status = 1;
}
}
if ($permission_status == 1) {
include ($_SERVER['DOCUMENT_ROOT'] . "/php/prepare_sql.php");
?>
<html>
<title>Edit Report</title> <!-- Name of site page in tab -->
<head> <!-- Calling all javascript, jquery and css files in the head-->
<?php include ($_SERVER['DOCUMENT_ROOT'] . "/includes/head_includes.php"); ?>
<?php include ($_SERVER['DOCUMENT_ROOT'] . "/javascript/color.php"); ?>
<script>
$(document).ready(function(){
$("#add").hide();
$("#add_button").click(function(){
$("#add").toggle();
});
});
</script>
</head>
<body>
<p>
<?php
include('includes/toolbar.php');
include('includes/optionsTab.php');
?>
<center>
<div class="subtitle">
<p class="subtitle_title">
Edit Report
</p>
</div>
<div class="content">
<div id="headerInformation">
<div id="headerTitle">
Header Information
</div>
<div id="header">
<form action="/php/header.php" method = 'POST'>
Title: <input class="mobileProgress" type="text" name="title" placeholder="Progress Report Card"><br>
School: <input class="mobileProgress" type="text" name="schoolName" placeholder="School Name"><br>
Street Address: <input class="mobileProgress" type="text" name="streetAddress" placeholder="123 example road"><br>
Address: <input class="mobileProgress" type="text" name="location" placeholder="Dunrobin, Ontario, Canada"><br>
Postal Code: <input class="mobileProgress" type="text" name="postalCode" placeholder="1A2 B3C"><br>
<input class="mobileProgress" type="submit" value="Submit">
</form>
</div>
<table id="headerExample">
<td>
<?php
$sql = "SELECT * FROM header";
$header = array_prepare_select ($sql, $pdo, []);
#include ($_SERVER['DOCUMENT_ROOT'] . "/php/pal-sql.php");
foreach ($header as $item) {
echo $item['content'];
echo"<br>";
}
/* while ($item = $results -> fetch(PDO::FETCH_ASSOC)) {
$header[] = $item['content'];
echo $item['content'];
echo"<br>";
}*/
?>
</td>
</table>
</div>
<div id="footerInformation">
<div id="footerTitle">
Footer Information
</div>
<div id="footer">
<?php
$sql = "SELECT * FROM footer";
$footer = array_prepare_select ($sql, $pdo, []);
#include ($_SERVER['DOCUMENT_ROOT'] . "/php/pal-sql.php");
/*while ($item = $results -> fetch(PDO::FETCH_ASSOC)) {
$footer[] = $item['content'];
}*/
?>
<form action="/php/footer.php" method="POST">
Message:<br><textarea class="mobileProgress" id="fMess" name = 'message' rows="6" cols="40" ><?php echo $footer[0]['content'] ?></textarea>
<br></br>
Footer:<br><textarea class="mobileProgress" id="fMess" name = 'footer' rows="6" cols="40" ><?php echo $footer[1]['content'] ?></textarea>
<br></br>
<input class="mobileProgress" type="submit" value="Submit">
</form>
</div>
<table id="footerExample">
<td>
<?php
echo $footer[0]['content'] . "<br>";
echo $footer[1]['content'] . "<br>";
?>
</td>
</table>
</div>
<div id="editComments">
<div id="editCommentsTitle">
Edit Comments
</div>
<div id="comments">
<?php
#$sql = "SELECT * FROM comments";
$sql = "SELECT * FROM comment_list";
$comments = array_prepare_select ($sql, $pdo, []);
#include ($_SERVER['DOCUMENT_ROOT'] . "/php/pal-sql.php");
/*while ($item = $results -> fetch(PDO::FETCH_ASSOC)) {
$comments[] = array('comment_id' => $item['comment_id'], 'comment' => $item['comment']);
}*/
?>
<form action="/php/editComments.php" method="POST">
<?php
#$count = 0; //tells the amount of comments there are currently are in the database
foreach($comments as $item){
//echo "<input name='comment[]' value='$item[comment]'>";
echo "<input class ='mobileProgress' id='commentWidth' name='comment[]' placeholder ='$item[comment]'>";
echo "<input type = 'hidden' name = 'update_id[]' value = '$item[comment_id]'>";
echo "</input>";
?>
<a href = "/php/delete_comment.php?delete=<?php echo $item['comment_id']; ?>"><button class ='mobileProgress' type = 'button'>X</button></a>
<?php
echo "<br></br>";
#$count++;
}
?>
<button type = 'button' class ='mobileProgress' id = 'add_button'>Add Button</button><br>
<p><input id = 'add' class ='mobileProgress' name = 'new_comment' placeholder = 'New Comment'></p>
<?php
#$sql = "SELECT MAX(comment_id) FROM comments;";
#include ($_SERVER['DOCUMENT_ROOT'] . "/php/par-sql.php");
#$count = $results->fetch(PDO::FETCH_ASSOC);
//print_r($count);
?>
<?php #<input type = 'hidden' name = 'count' value = '<?php echo $count['MAX(comment_id)'];'></input>?>
<input class ='mobileProgress' type="submit" value="Submit">
</form>
</div>
</div>
</div>
</center>
</p>
</body>
</html>
<?php } ?>