-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
111 lines (100 loc) · 3.56 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
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
<?php
session_start();
require_once(__DIR__ . '/config.php');
require_once(__DIR__ . '/functions.php');
require_once(__DIR__ . '/Todo.php');
// get todos
$todoApp = new \MyApp\Todo();
$todos = $todoApp->getAll();
// var_dump($todos);
// exit;
?>
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Todo List</title>
<!-- jQuery読み込み -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<!-- jQueryテーマ読み込み -->
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/cupertino/jquery-ui.css">
<!-- BootstrapのJS読み込み -->
<script src="bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<!-- BootstrapのCSS読み込み -->
<link href="bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
<!-- CSS読み込み -->
<link href="styles.css" rel="stylesheet">
</head>
<body>
<section>
<div class="container">
<h1>
Todos
</h1>
<div class="row">
<div class="col-md-12 mb-4">
<form action="" id="new_todo_form">
<input type="text" id="new_todo" placeholder="タスク内容">
<input type="text" id="new_todo_deadline" class="calendar" placeholder="期限">
<br>
<input type="submit" name="button" value="登録" class="btn btn-primary">
<input type="reset" name="button" class="btn btn-danger">
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table id="todos" class="table table-striped">
<tr id="todos_head">
<th>
<i class="checkAll glyphicon glyphicon-check text-primary" data-checkAllClassName="checkGroupA" value=0></i>
</th>
<th>タスク</th>
<th>期限</th>
<th>
<i class="glyphicon glyphicon-remove text-danger"></i>
</th>
</tr>
<?php foreach ($todos as $todo) : ?>
<tr id="todo_<?= h($todo->id); ?>" data-id="<?= h($todo->id); ?>">
<td>
<input type="checkbox" class="update_todo checkGroupA" <?php if ($todo->state == '1') { echo 'checked'; } ?>>
</td>
<td class="todo_title <?php if ($todo->state == '1') { echo 'done'; } ?>">
<?= h($todo->title); ?>
</td>
<td class="todo_deadline">
<?= h($todo->deadline); ?>
</td>
<td>
<i class="delete_todo glyphicon glyphicon-trash text-danger"></i>
</td>
</tr>
<?php endforeach; ?>
<tr id="todo_template" data-id="">
<td>
<input type="checkbox" class="update_todo checkGroupA">
</td>
<td class="todo_title"></td>
<td class="todo_deadline"></td>
<td>
<i class="delete_todo glyphicon glyphicon-trash text-danger"></i>
</td>
</tr>
</table>
</div>
</div>
</div>
</section>
<input type="hidden" id="token" value="<?= h($_SESSION['token']); ?>">
<script src="js/datepicker-ja.js"></script>
<script src="js/todo.js"></script>
<script>
$(function() {
$('.calendar').datepicker();
});
</script>
</body>
</html>