コード例 #1
1
ファイル: FoodItem.php プロジェクト: JoshAllan/todo-example
 public function addToMenu()
 {
     $variable = new Todo();
     $variable->document = $this->document;
     $variable->document["_id"] = new MongoId();
     $variable->store();
 }
コード例 #2
0
ファイル: index.php プロジェクト: JoshAllan/todo-example
// Get the action veriable from our post data
$action = filter_input(INPUT_POST, "action", FILTER_SANITIZE_STRING);
// Create our Todo object. If the _id sent in the post data isn't set then the Todo is blank
$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();
}