<?php

require_once "../header.php";

$data = array();
$data["error"] = false;

if ( !isset($_REQUEST['id']) ) pushData("Invalid task request");
$task = new Task(intval($_REQUEST['id']));
if ( $task->getID() == 0 ) pushData("No task found");
$data["message"] = "Listing Task ID={$task->getID()}";
$data["task"] = $task;

pushData();

exit();

function pushData($errormsg = null) {
    global $data;

    if ( !is_null($errormsg) ) {
        $data["error"] = true;
        $data["message"] = $errormsg;
    }
    header('Content-Type: application/json');
    echo json_encode($data);
    exit();
}