Example #1
0
function main()
{
    if (isset($_GET['action'])) {
        $action = $_GET['action'];
    } else {
        $action = 'list';
    }
    create_html_start();
    check_post_values();
    // Just list todos
    if ($action == 'list') {
        list_todos();
    } else {
        if ($action == 'edit') {
            show_edit();
        } else {
            if ($action == 'delete') {
                if (isset($_GET['id'])) {
                    delete_todo($_GET['id']);
                }
            } else {
                if ($action == 'finished') {
                    if (isset($_GET['id'])) {
                        finish_todo($_GET['id']);
                        list_todos();
                    }
                } else {
                    if ($action == 'show_finished') {
                        show_finished();
                    }
                }
            }
        }
    }
    create_html_end();
}
Example #2
0
<?php

require_once __DIR__ . '/lib/functions.php';
show_edit();