This repository has been archived by the owner on Jun 6, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin.php
266 lines (266 loc) · 9.69 KB
/
admin.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
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
<!DOCTYPE html>
<html>
<head>
<title>Progress - Back-end</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="css/main.css" rel="stylesheet" media="screen">
<link href="css/daterangepicker.css" rel="stylesheet" media="screen">
</head>
<body>
<div class="navbar navbar-static-top navbar-inverse">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="admin.php">Progress - Admin</a>
</div>
</div>
</div>
<div class="container">
<?php require_once 'connect.php'; ?>
<div class="row">
<div class="span9">
<?php $editPost = $_GET['id'];
if(!isset($editPost)) {
?>
<ul class="nav nav-tabs">
<li class="active">
<a href="#projecttab1" data-toggle="tab">Add a project</a>
</li>
<li>
<a href="#projecttab2" data-toggle="tab">Edit a project</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="projecttab1">
<?php } ?>
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<fieldset>
<?php if(!isset($editPost)) { ?>
<legend>New project</legend>
<label>Project name</label>
<input type="text" name="projectname" placeholder="Virgin Galactic" required>
<label>Project date range</label>
<div class="input-prepend">
<span class="add-on">
<i class="icon-calendar"></i>
</span>
<input type="text" name="projectdate" id="projectdate" value="" required>
</div>
<label>Project members</label>
<?php
getMembers();
?>
<?php } else { ?>
<legend>Edit project</legend>
<?php } ?>
<?php
getProject($editPost);
?>
<hr/>
<?php if(!isset($editPost)) { ?>
<button type="submit" name="addProject" class="btn">Add project</button>
<?php } else { ?>
<div id="deleteProject" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Delete project</h3>
</div>
<div class="modal-body">
<p>Are you sure you want to delete this project?</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Keep this project</button>
<button type="submit" name="deleteProject" class="btn btn-danger">Yes I'm sure, delete this project</button>
</div>
</div>
<button type="submit" name="updateProject" class="btn btn-primary">Save changes</button>
<a href="#deleteProject" role="button" class="btn btn-danger" data-toggle="modal">Delete project</a>
<button type="button" name="cancelUpdate" class="btn" onclick="window.location='admin.php?updateCancelled'">Cancel</button>
<?php } ?>
</fieldset>
</form>
<?php if(!isset($editPost)) { ?>
</div>
<div class="tab-pane" id="projecttab2">
<legend>Select project</legend>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>#</th>
<th>Project name</th>
<th>Deadline</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php getAllProjects(); ?>
</tbody>
</table>
</div>
</div>
<?php } ?>
</div>
<div class="span3">
<ul class="nav nav-tabs">
<?php $editEmployee = $_GET['member'];
if(!isset($editEmployee)) {
?>
<li class="active">
<?php } else { ?>
<li>
<?php } ?>
<a href="#employeetab1" data-toggle="tab">Add</a>
</li>
<?php
if(isset($editEmployee)) {
?>
<li class="active">
<?php } else { ?>
<li>
<?php } ?>
<a href="#employeetab2" data-toggle="tab">Edit</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane <?php if(!isset($editEmployee)) { ?>active<?php } ?> well well-admin" id="employeetab1">
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<fieldset>
<legend>Employees</legend>
<label>Name</label>
<div class="input-prepend">
<span class="add-on">
<i class="icon-user"></i>
</span>
<input type="text" name="name" placeholder="Richard Branson" required>
</div>
<label>Facebook ID</label>
<div class="input-prepend">
<span class="add-on">
<i class="icon-thumbs-up"></i>
</span>
<input class="fbid" data-content="To get a users Facebook ID just fill in their profile url on <a href='http://findmyfacebookid.com' target='_blank'>this</a> page." data-original-title="Facebook ID" data-toggle="popover" data-trigger="focus" data-placement="left" type="text" name="fbid" placeholder="1337" required>
</div>
<label>Birthday</label>
<div class="input-prepend">
<span class="add-on">
<i class="icon-calendar"></i>
</span>
<input type="text" class="memberbirthday" name="birthday" placeholder="11/05/1987" required>
</div>
<label>Department</label>
<div class="input-prepend">
<span class="add-on">
<i class="icon-briefcase"></i>
</span>
<select name="position">
<?php
getPositions();
?>
</select>
</div>
<button type="submit" name="addMember" class="btn">Add member</button>
</fieldset>
</form>
</div>
<div class="tab-pane <?php if(isset($editEmployee)) { ?>active<?php } ?> well well-admin" id="employeetab2">
<?php if(!isset($editEmployee)) { ?>
<legend>Employees</legend>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Name</th>
</tr>
</thead>
<tbody>
<?php getAllEmployees(); ?>
</tbody>
</table>
<?php } else { ?>
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<fieldset>
<legend>Edit employee</legend>
<?php getEmployee($editEmployee); ?>
<input type="checkbox" name="delete" value="delete"> Delete employee
<button type="submit" name="updateMember" class="btn btn-primary">Save changes</button>
<button type="button" name="cancelUpdate" class="btn" onclick="window.location='admin.php?updateMemberCancelled'">Cancel</button>
</fieldset>
</form>
<?php } ?>
</div>
</div>
<ul class="nav nav-tabs">
<?php $editDepartment = $_GET['department'];
if(!isset($editDepartment)) {
?>
<li class="active">
<?php } else { ?>
<li>
<?php } ?>
<a href="#departmenttab1" data-toggle="tab">Add</a>
</li>
<?php
if(isset($editDepartment)) {
?>
<li class="active">
<?php } else { ?>
<li>
<?php } ?>
<a href="#departmenttab2" data-toggle="tab">Edit</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane <?php if(!isset($editDepartment)) { ?>active<?php } ?> well well-admin" id="departmenttab1">
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<fieldset>
<legend>Department</legend>
<label>Department name</label>
<input type="text" name="position" placeholder="Front-end developer" required>
<button type="submit" name="addPosition" class="btn">Add department</button>
</fieldset>
</form>
</div>
<div class="tab-pane <?php if(isset($editDepartment)) { ?>active<?php } ?> well well-admin" id="departmenttab2">
<?php if(!isset($editDepartment)) { ?>
<legend>Edit department</legend>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Department name</th>
</tr>
</thead>
<tbody>
<?php getAllDepartments(); ?>
</tbody>
</table>
<?php } else { ?>
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<fieldset>
<legend>Edit department</legend>
<?php getDepartment($editDepartment); ?>
<input type="checkbox" name="delete" value="delete"> Delete department
<button type="submit" name="updateDepartment" class="btn btn-primary">Save changes</button>
<button type="button" name="cancelUpdate" class="btn" onclick="window.location='admin.php?updateDepartmentCancelled'">Cancel</button>
</fieldset>
</form>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/date.js"></script>
<script src="js/daterangepicker.js"></script>
<script src="js/jquery.tablesorter.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#projectdate').daterangepicker();
$('#fbid').popover({html : true});
$("#projecttab2 table").tablesorter();
});
</script>
<?php mysql_close($link); ?>
</body>
</html>