-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
66 lines (52 loc) · 1.7 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
64
<?php
use Elias\Todo\DB\Config;
use Elias\Todo\Classes\TaskHandler;
class IndexMe{
protected $model;
public function __construct()
{
require_once __DIR__ . '/vendor/autoload.php';
$this->model = new TaskHandler();
}
//just to check static func/can be used as nonstatic(in that case use $this in the place of (new self)
public static function get_todos()
{
return (new self)->model->get_tasks();
}
//just to check static func/can be used as nonstatic(in that case use $this in the place of (new self)
public static function get_done_todos()
{
return (new self)->model->get_done_tasks();
}
}
$obj = new IndexMe();
$config = new Config();
?>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="./assets/css/style.css"/>
<script src="assets/js/custom.js"></script>
</head>
<body>
<div class="container">
<p class="title">TODO'S</p>
<form id="add-form">
<div class="input-group">
<input id="task-input" class="task-input" type="text" name="task" placeholder="Enter a task..."/>
<button id="add-button" class="add-button">Add Task</button>
</div>
</form>
<div id="todo-lists" class="todo-lists">
<?php IndexMe::get_todos(); ?>
</div>
<div class="done-section" style="margin-top: 10px;">
<p class="done-title">DONE</p>
<div id="done-lists" class="todo-lists">
<?php IndexMe::get_done_todos() ?>
</div>
</div
</div>
</body>
</html>