-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
63 lines (60 loc) · 2.1 KB
/
index.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
<html>
<head>
<title>ToDoList for CakeMail Interview</title>
<script src='//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
<script src='/js/j.js'></script>
<script src='/js/jquery.datetimepicker.js'></script>
<link rel='stylesheet' href='/css/s.css'>
<link rel='stylesheet' href='/css/jquery.datetimepicker.css'>
<link href='//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' rel='stylesheet'>
</head>
<body>
<div id='taskList'>
<table>
<?php
require('Models/db.php');
require('Models/Task.php');
try {
// Task not done
$results = $db->query("SELECT * FROM tasks WHERE status LIKE 'Not Done' ORDER BY due_date ASC,priority ASC");
if(!empty($results)){
echo '<tr><th></th><th>Priority</th><th>Due Date</th><th></th></tr>';
while($row = $results->fetch(PDO::FETCH_OBJ))
{
echo Task::stringify($row) ;
}
}
echo '</table><table>';
$results = $db->query("SELECT * FROM tasks WHERE status LIKE 'Done' ORDER BY due_date ASC, priority ASC");
while( $row = $results->fetch(PDO::FETCH_OBJ))
{
echo Task::stringify($row) ;
}
} catch(PDOExecption $e) {
$db->rollback();
echo "Error!: " . $e->getMessage() . "</br>";
}
?>
</table>
<div id='addtask' onclick='showForm()'>
<i class='fa fa-plus'></i>
Add a new task...
</div>
</div>
<div id='form'>
<label>Task Name</label>
<input type='text' id='taskName' placeholder='task name...'/><br/>
<label>DueDate <input type='checkbox' id='cbxDueDate' onclick='toggleId("#form .datetimepicker")'></label>
<input class='datetimepicker' type='text' ><br/>
<label>Priority <input type='checkbox' id='cbxPriority' onclick='toggleId("#form #selPrio")'></label>
<select id='selPrio'>
<option value='1'>Very High</option>
<option value='2'>High</option>
<option value='3'>Kind of Important</option>
<option value='4'>Low</option>
<option value='5'>Very Low</option>
</select>
<button onclick='addTask()'>Add</button>
</div>
</body>
</html>