示例#1
0
<?php

require_once __DIR__ . "/../util/web.php";
require_once __DIR__ . "/../service/data_service.php";
require_once __DIR__ . "/../util/validators.php";
require_once __DIR__ . "/../config/constants.php";
require_once __DIR__ . "/../controller/ensure_session.php";
if (!isset($_SESSION["taskId"])) {
    redirect(VIEWS . "/home.php");
}
$taskId = $_SESSION["taskId"];
$taskDesc = $_POST["description"];
$taskStatus = $_POST["status"];
//validate task description
$valid = validateRequired($taskDesc);
if ($valid) {
    update_todo_list($taskId, $taskDesc, $taskStatus);
} else {
    $_SESSION["error"] = "Task description is required and can have upto 120 characters";
}
redirect(VIEWS . "/home.php");
exit;
示例#2
0
function update_todo($taskId, $desc, $status)
{
    switch ($status) {
        case "N":
            $status = "Not Started";
            break;
        case "S":
            $status = "Started";
            break;
        case "M":
            $status = "Midway";
            break;
        case "C":
            $status = "Completed";
            break;
        default:
            break;
    }
    update_todo_list($taskId, $desc, $status);
}
示例#3
0
function update_todo($taskId, $desc, $staus)
{
    update_todo_list($taskId, $desc, $status);
}