-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.php
More file actions
348 lines (307 loc) · 12.5 KB
/
Copy pathmodule.php
File metadata and controls
348 lines (307 loc) · 12.5 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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<?php
/**
* Created by PhpStorm.
* User: Pauline
* Date: 16/03/2019
* Purpose: page which shows relevant information on the module selected
*/
session_start();
include('config.php');
if (!IsSet($_SESSION["userID"])) //user variable must exist in session to stay here
header("Location: login.php"); //if not, go back to login page
$username=$_SESSION["userID"]; //get user name into variable $username
$mod_code="SCDM005"; // currently hardcoded but additional code could be written to pass a value in
$name= "Website development"; // currently hardcoded but additional code could be written to pass a value in
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1,
shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<title>Module Action List</title>
<link rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" href="assets/css/table.css">
</head>
<!--- Main body --->
<body>
<div class="container colour">
<header>
<nav class="navbar navbar-expand-sm">
<a href="index.php"><h2 class="col-sm-4 logo navbar-text">FORECAST</h2></a>
<h2 class="col-sm-4 forecast center navbar-text"><?php echo $mod_code.' '.$name ?> </h2>
<ul class="col-sm-4 nav nav-pills">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown">My Account</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="full_list.php">My task list</a>
<a class="dropdown-item" href="overview_list.php">Overview</a>
<a class="dropdown-item" href="./update/password_updateform.php">Update password</a>
<a class="dropdown-item" href="log_out.php">Sign out</a>
</div>
</li>
</ul>
</nav>
</header>
<!-- start of main section -->
<main>
<div class="container mt-3">
<article> <!--to keep together the set up of the tasks per person navbar and the subsequent selection contents-->
<!-- Nav tabs -->
<ul class="nav nav-tabs">
<li class="nav-item">Tasks for: </li>
<li class="nav-item">
<a class="nav-link active" data-toggle="collapse" href="#home">All</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="collapse" href="#menu1">My tasks</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="collapse" href="#menu2">Other tasks</a>
</li>
</ul>
<!-- Tab panes supplying the content for the navs -->
<div class="tab-content">
<div id="home" class="collapse" ><br>
<table class="module">
<tr>
<th>Name</th>
<th>Action</th>
<th>Notes(status)</th>
<th>Deadline</th>
<th>Completed</th>
</tr>
<?php
$sql_query="SELECT * FROM module_task,user WHERE module_task.username= user.username ORDER BY deadline ";
$result = $db->query($sql_query);
while($row = $result->fetch_array()){
$task = $row['task'];
$comments = $row['comments'];
$deadline = $row['deadline'];
$completed = $row['completed'];
$id=$row['id'];
$firstname=$row['firstname'];
$lastname=$row['lastname'];
echo "
<tr>
<td>{$firstname} {$lastname}</td>
<td>{$task}</td>
<td>{$comments}</td>
<td>{$deadline}</td>
<td>{$completed}</td>
</tr>
";
};
?>
</table>
</div>
<div id="menu1" class="collapse"><br>
<table class="module">
<tr>
<th>Name</th>
<th>Action</th>
<th>Notes(status)</th>
<th>Deadline</th>
<th>Completed</th>
</tr>
<?php
$sql_query="SELECT * FROM module_task,user WHERE module_task.username= user.username AND user.username='$username'ORDER BY deadline";
$result = $db->query($sql_query);
while($row = $result->fetch_array()) {
$task = $row['task'];
$comments = $row['comments'];
$deadline = $row['deadline'];
$completed = $row['completed'];
$id=$row['id'];
$firstname=$row['firstname'];
$lastname=$row['lastname'];
echo "
<tr>
<td>{$firstname} {$lastname}</td>
<td>{$task}</td>
<td>{$comments}</td>
<td>{$deadline}</td>
<td>{$completed}</td>
</tr>
";
}
?>
</table>
</div>
<div id="menu2" class="collapse"><br>
<table class="module">
<tr>
<th>Name</th>
<th>Action</th>
<th>Notes(status)</th>
<th>Deadline</th>
<th>Completed</th>
</tr>
<?php
$sql_query="SELECT * FROM module_task,user WHERE module_task.username= user.username AND user.username!='$username'ORDER BY deadline";
$result = $db->query($sql_query);
while($row = $result->fetch_array()) {
$task = $row['task'];
$comments = $row['comments'];
$deadline = $row['deadline'];
$completed = $row['completed'];
$id=$row['id'];
$firstname=$row['firstname'];
$lastname=$row['lastname'];
echo "
<tr>
<td>{$firstname} {$lastname}</td>
<td>{$task}</td>
<td>{$comments}</td>
<td>{$deadline}</td>
<td>{$completed}</td>
</tr>
";
}
?>
</table>
</div>
</div>
</article>
<!-- end of navbar containing the tasks per person -->
<br><br>
<article><!--to keep together the three table sections displayed on the page-->
<!-- start of document display section -->
<section>
<h3>Documents</h3>
<!-- insert collapse button -->
<button type="button" data-toggle="collapse" data-target="#documents">Show all documents</button>
<br><br>
<div id="documents" class="collapse" >
<p><a href="create/documents_form.php">Add document</a></p>
<table class='cabinet'>
<tr>
<th>Description</th>
<th>Filename</th>
<th>Delete</th>
<th>Download</th>
</tr>
<?php
// Get images from the database
$query = $db->query("SELECT * FROM documents");
if($query->num_rows > 0){
while($row = $query->fetch_assoc()){
$id=$row['id'];
$filename=$row['filename'];
$description=$row['description'];
echo "
<tr>
<td>{$description}</td>
<td>{$filename}</td>
<td><form action='delete_file.php' method='post'>
<input type='hidden' name='id' value='$id'/>
<input type='submit' name='submit' value='Delete' /></form></td>
<td><form action='document_download.php' method='post'>
<input type='hidden' name='id' value='$id'/>
<input type='submit' name='submit' value='Download' /></form></td>
</tr>
";
}}else{echo"
<p>No document(s) found...</p>";
}
?>
</table>
</div>
</section>
<!-- end of document display section -->
<br><br>
<!-- Start of articles display section -->
<section>
<h3>Articles</h3>
<button type="button" data-toggle="collapse" data-target="#articles">Show all articles</button>
<br><br>
<!-- insert collapse button -->
<div id="articles" class="collapse" >
<p><a href="create/articles_form.php">Add reference</a></p>
<table class='article'>
<tr>
<th>Website</th>
<th>Notes(status)</th>
<th>Delete</th>
</tr>
<tr>
<?php
$sql_query="SELECT * FROM articles WHERE mod_code='$mod_code'";
$result = $db->query($sql_query);
while($row = $result->fetch_array()) {
$title = $row['title'];
$webref = $row['webref'];
$description = $row['description'];
$id=$row['id'];
echo "
<tr>
<td><a href='{$webref}' target='_blank'>{$title}</a></td>
<td>{$description}</td>
<td><form action='delete/delete_article.php' method='post'>
<input type='hidden' name='id' value='$id'/>
<input type='submit' name='submit' value='Delete' /></form></td>
</tr>
";
}
?>
</table>
</div>
</section>
<!-- end of articles display section -->
<br><br>
<!-- start of notes section -->
<section>
<h3>Notes</h3>
<!-- insert collapse button -->
<button type="button" data-toggle="collapse" data-target="#notes">Show all notes</button>
<br><br>
<div id="notes" class="collapse" >
<p><a href="create/notes_form.php">Add note</a></p>
<table class='notes'>
<tr>
<th width="400">Add note</th>
<th>Delete</th>
</tr>
<?php
$sql_query="SELECT * FROM notes WHERE mod_code='$mod_code'";
$result = $db->query($sql_query);
while($row = $result->fetch_array()) {
$notes = $row['notes'];
$id=$row['id'];
echo "
<tr>
<td>{$notes}</td>
<td><form action='delete/delete_notes.php' method='post'>
<input type='hidden' name='id' value='$id'/>
<input type='submit' name='submit' value='Delete' /></form></td>
</tr>
";
}
?>
</table>
</section>
<!-- end of notes section -->
<br><br>
<!-- end of the section containing three display tables -->
</article>
</main>
<!--- end of main section -->
<!-- footer section -->
<?php
include('footer.html')
?>
<!-- End of footer -->
<!-- End of <div class="container colour">-->
</div>
<!-- Go to www.addthis.com/dashboard to customize your tools -->
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5c853fcb8b82e462"></script>
<!-- Required for drop down lists -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<!-- Bootstrap script for general CSS layout-->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
</body>
</html>