1 2 3 4 5 6 7 | <?php // ... other routes $app->get('/add-list', 'authenticate', function () use ($app) { $app->render('add-list.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 | <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/ jquery.mobile-1.3.2.min.css" /> <script src="//code.jquery.com/jquery-1.9.1.min.js"></script> <script src="//code.jquery.com/mobile/1.3.2/ jquery.mobile-1.3.2.min.js"></script> </head> <body> <div data-role="page"> <div data-role="header"> Add List </div> <div data-role="content"> <div data-role="collapsible-set"> <form method="post" action="/add-list"> <label for="title">Title:</label> <input name="title" id="title" data-clear-btn="true" type="text"/> <input name="submit" value="Save" type="submit" data-icon="check" data-inline="true" data-theme="a" /> <a href="/index" data-role="button" data-inline="true" data-icon="back" data-theme="a">Back</a> </form> </div> </div> </body> </html> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?php // ... other routes $app->post('/add-list', 'authenticate', function () use ($app) { if (isset($_POST['submit'])) { $title = trim(htmlentities($_POST['title'])); if (empty($title)) { $title = 'Untitled List'; } $tasklist = new Google_TaskList(); $tasklist->setTitle($title); $result = $app->tasksService->tasklists->insert($tasklist); $app->redirect('/index'); } }); |
1 2 3 4 5 6 7 8 | <?php // ... other routes $app->get('/delete-list/:lid', 'authenticate', function ($lid) use ($app) { $app->tasksService->tasklists->delete($lid); $app->redirect('/index'); }); |
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 | <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/ jquery.mobile-1.3.2.min.css" /> <script src="//code.jquery.com/jquery-1.9.1.min.js"></script> <script src="//code.jquery.com/mobile/1.3.2/ jquery.mobile-1.3.2.min.js"></script> </head> <body> <div data-role="page"> <div data-role="header"> Tasks </div> <div data-role="content"> <div data-role="collapsible-set" data-inset="false"> <?php foreach ($lists['items'] as $list): ?> <?php $id = $list['id']; ?> <div data-role="collapsible"> <h2><?php echo $list['title']; ?></h2> <ul data-role="listview"> <?php if (isset($tasks[$id]['items'])): ?> <?php foreach ($tasks[$id]['items'] as $task): ?> <li> <?php if ($task['status'] == 'needsAction'): ?> <h3><?php echo $task['title']; ?></h3> <?php else: ?> <h3 style="text-decoration:line-through" ><?php echo $task['title']; ?></h3> <?php endif; ?> <?php if (isset($task['due']) && ($task['status'] == 'needsAction')): ?> <p>Due on <?php echo date('d M Y', strtotime($task['due'])); ?></p> <?php endif; ?> <?php if (isset($task['completed']) && ($task['status'] == 'completed')): ?> <p>Completed on <?php echo date('d M Y', strtotime($task['completed'])); ?></p> <?php endif; ?> </li> <?php endforeach; ?> <?php endif; ?> </ul> <a href="/delete-list/<?php echo $id; ?>" data-inline="true" data-role="button" data-icon="delete" data-theme="a">Remove list</a> </div> <?php endforeach; ?> </div> </div> <a href="/add-list" data-inline="true" data-role="button" data-icon="plus" data-theme="b">Add new list</a> </div> </body> </html> |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |