/** * @param String $todoString * @return Todo */ public static function parse($todoString) { $completed = false; if ('x ' === substr($todoString, 0, 2)) { $completed = true; } if ($completed) { $todo = new Todo(self::getText($todoString), self::getCreationDate($todoString), null, self::getProjects($todoString), self::getContexts($todoString), self::getDueDate($todoString), true); $todo->done(self::getCompletedDate($todoString)); } else { $todo = new Todo(self::getText($todoString), self::getCreationDate($todoString), self::getPriority($todoString), self::getProjects($todoString), self::getContexts($todoString), self::getDueDate($todoString)); } return $todo; }
$todo = new Todo($post_vars["_id"]); $foodMenu = new FoodItem($post_vars["_id"]); // Typical switch statement calling our functions from the Todo object switch ($action) { case "remove": $todo->delete(); break; case "add": $foodMenu->addToMenu(); break; case "edit": $todo->setDescription($post_vars["description"]); $todo->store(); break; case "done": $todo->done(); $todo->store(); break; } // This creates a cursor of all the Todo items in our database $todoCursor = new TodoCursor(); $foodCursor = new FoodCursor(); ?> <?php if ($_POST["email"]) { $todoCursor->SendOrder(); } ?> </head>
| */ //actions Route::group(array('prefix' => 'todos', 'before' => 'admin'), function () { Route::resource('/', 'TodosController'); Route::get('{id}/flag-0', function ($id) { //flag return Todo::flag($id); })->where('id', '[0-9]+'); Route::get('{id}/flag-1', function ($id) { //unflag return Todo::unflag($id); })->where('id', '[0-9]+'); Route::get('{id}/done-0', function ($id) { //done return Todo::done($id); })->where('id', '[0-9]+'); Route::get('{id}/done-1', function ($id) { //make not done return Todo::undone($id); })->where('id', '[0-9]+'); Route::get('{id}/from-tim', function ($id) { //done return Todo::fromTim($id); })->where('id', '[0-9]+'); Route::get('{id}/from-lee', function ($id) { //make not done return Todo::fromLee($id); })->where('id', '[0-9]+'); }); /*