-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateTask.php
More file actions
229 lines (180 loc) · 8.99 KB
/
createTask.php
File metadata and controls
229 lines (180 loc) · 8.99 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
<?php
include './Template.php';
include './DBConfig.php';
$mysql = new DBConfig();
$db = $mysql->getDBConfig();
session_start();
$nameErr = $descErr = $sdateErr = $edateErr = $empErr = $tName = $tDesc = $tProjId = $tSDate = $tEDate = $tSts = $tPrio = "";
//Getting Error Messages
if (!empty($_SESSION['nameError'])) {
$nameErr = $_SESSION['nameError'];
$_SESSION['nameError'] = "";
}
if (!empty($_SESSION['tDescError'])) {
$descErr = $_SESSION['tDescError'];
$_SESSION['tDescError'] = "";
}
if (!empty($_SESSION['tSDateError'])) {
$sdateErr = $_SESSION['tSDateError'];
$_SESSION['tSDateError'] = "";
}
if (!empty($_SESSION['tEDateError'])) {
$edateErr = $_SESSION['tEDateError'];
$_SESSION['tEDateError'] = "";
}
if (!empty($_SESSION['empError'])) {
$empErr = $_SESSION['empError'];
$_SESSION['empError'] = "";
}
//Getting Old Values
if (!empty($_SESSION['tName'])) {
$tName = $_SESSION['tName'];
$_SESSION['tName'] = "";
}
if (!empty($_SESSION['tDesc'])) {
$tDesc = $_SESSION['tDesc'];
$_SESSION['tDesc'] = "";
}
if (!empty($_SESSION['tProjId'])) {
$tProjId = $_SESSION['tProjId'];
$_SESSION['tProjId'] = "";
}
if (!empty($_SESSION['tSDate'])) {
$tSDate = $_SESSION['tSDate'];
$_SESSION['tSDate'] = "";
}
if (!empty($_SESSION['tEDate'])) {
$tEDate = $_SESSION['tEDate'];
$_SESSION['tEDate'] = "";
}
if (!empty($_SESSION['tSts'])) {
$tSts = $_SESSION['tSts'];
$_SESSION['tSts'] = "";
}
if (!empty($_SESSION['tPrio'])) {
$tPrio = $_SESSION['tPrio'];
$_SESSION['tPrio'] = "";
}
//Save Emp old value NEED
$head = '<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<script src="ModalPopupWindow.js" type="text/javascript"></script>
<script src="js/updateTask4.js"> </script>
<script src="js/updateTask3.js" type="text/javascript"></script>
';
$header = new Template("./header.php", array('head' => $head, 'title' => "Create a task",'return'=>"createTask.php",'current_page'=>"3"));
$header->out();
?>
<!-- content-wrap -->
<div id="content-wrap">
<!-- content -->
<div id="content" class="clearfix">
<!-- main -->
<div id="main">
<div class="main-content">
<form method='post' action='createTaskProcessing.php' id='mainForm'>
<label for='exampleInputEmail1'>Task Name</label>
<input type='text' name='taskname' maxlength = "30"
value='<?php echo isset($tName) ? $tName : ""; ?>' placeholder='Enter task name' required/>
<span class="error"><?php echo isset($nameErr) ? $nameErr : ""; ?></span>
<!-- Description -->
<label>Task Description</label>
<textarea rows='10' cols='50' name='descr' maxlength = "20000" required><?php echo isset($tDesc) ? $tDesc : ""; ?></textarea>
<span class="error"><?php echo $descErr; ?></span>
<!-- Linking task to a project -->
<label>Project</label>
<select name='proj_id' style='width: 165px'>
<option></option>
<?php
$sql = "SELECT uid, name FROM project WHERE deleted='N'";
$result = $db->query($sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_row($result)) {
$id = $row[0];
$name = $row[1];
echo ($tProjId == $id)? "<option selected value=".$id." >" . $name . "</option>":"<option value=".$id." >" . $name . "</option>";
}}
?>
</select>
<?php $sql = "SELECT uid, start_date, end_date, deleted FROM project WHERE deleted='N'";
$result = $db->query($sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_row($result)) {
$id = $row[0];
$date = DateTime::createFromFormat('Y-m-d', $row[1]);
$sd = $date->format('m/d/Y');
$date = DateTime::createFromFormat('Y-m-d', $row[2]);
$ed = $date->format('m/d/Y');
echo "<input type='hidden' name='s$id' value='$sd'/>";
echo "<input type='hidden' name='e$id' value='$ed'/>";
}}
?>
<!-- Set dates -->
<label>Start Date</label>
<input name="startdate" id="from" value='<?php if ($tSDate) echo $tSDate; ?>'
placeholder="MM/DD/YYYY" readonly="true">
<span class="error"><?php echo $sdateErr; ?></span>
<label>End Date</label>
<input name="enddate" id="to" value='<?php echo $tEDate; ?>'
placeholder="MM/DD/YYYY" readonly="true">
<span class="error"><?php echo $edateErr; ?></span>
<!-- Status -->
<label for='exampleInputEmail1'>Status</label>
<select class='form-control' name='status' id='sts' style='width: 165px'>
<option <?php echo ($tSts === "Default") ? "selected" : ""; ?> value='Default'>Default</option>
<option <?php echo ($tSts === "Closed") ? "selected" : ""; ?> value='Closed'>Closed</option>
</select>
<!-- priority -->
<label for='exampleInputEmail1'>Priority</label>
<select class='form-control' name='priority' style='width: 165px'>
<option <?php echo ($tPrio === 'High') ? 'selected' : ''; ?> value='High'>High</option>
<option value='Mid' <?php echo ($tPrio === "Mid") ? "selected" : ""; ?>>Mid</option>
<option <?php echo ($tPrio === "Low") ? "selected" : ""; ?> value='Low'>Low</option>
</select>
<!-- Employees names -->
<label>Assignees</label>
<input type="button" onclick="ShowNewPage()" value="Assign Employees" />
<span id="divShowChildWindowValues">
<dl id='empList'>
<?php
if (!empty($_SESSION['uEmpId'])) {
$i = 0;
foreach ($_SESSION['uEmpId'] as $emp) {
echo "<input type='hidden' name='emp[]' id='" . $i . "' value = '" . $emp . "'/>";
$i++;
}
$_SESSION['uEmpId'] = "";
if (!empty($_SESSION['uEmpName'])) {
$i = 0;
foreach ($_SESSION['uEmpName'] as $emp) {
echo "<input type='hidden' name='empName[]' id='n" . $i . "' value = '" . $emp . "'/>";
echo "<p>" . $emp . "</p>";
$i++;
}
$_SESSION['uEmpName'] = "";
}
//echo $displayString;
echo "<input type='hidden' name='empName[]' value = '" . $displayString . "'/>";
}
?>
</dl></span>
<span class="error"><?php echo $empErr; ?></span>
<!-- Buttons -->
</br>
<input type='reset' name= 'cancel' value='Cancel' class='btn btn-info1'>
<input type='submit' name= 'submit' value='Create Task' onclick='getTime()' class='btn btn-info2'>
</div>
</form>
</div>
<!-- /main -->
</div>
<!-- sidebar -->
<? include './sidebar.php'; ?>
<!-- content -->
</div>
<!-- /content-out -->
</div>
<!-- extra -->
<?php
include './footer.php';
?>