Beispiel #1
0
<?php

include '../config.php';
include '../model/TodoManager.php';
$todoManager = new TodoManager($pdo);
$task_id = $_GET['idTask'];
//mysql_query("DELETE FROM tasks WHERE id='$task_id'");
$todoManager->delete($task_id);
header('Location:../todo.php');
    } else {
        if ($action == "update-priority") {
            $idTodo = htmlentities($_POST['idTodo']);
            $priority = htmlentities($_POST['priority']);
            $todoManager->updatePriority($idTodo);
            $actionMessage = "Opération Valide : Todo Modifié avec succès.";
            $typeMessage = "success";
        } else {
            if ($action == "update-date") {
                $idTodo = htmlentities($_POST['idTodo']);
                $date = htmlentities($_POST['date']);
                $updatedBy = $_SESSION['userMerlaTrav']->login();
                $updated = date('Y-m-d h:i:s');
                $todoManager->updateDate($idTodo, $date, $updated, $updatedBy);
                $actionMessage = "Opération Valide : Todo Modifié avec succès.";
                $typeMessage = "success";
            } else {
                if ($action == "delete") {
                    $idTodo = htmlentities($_POST['idTodo']);
                    $todoManager->delete($idTodo);
                    $actionMessage = "Opération Valide : Todo supprimé(e) avec succès.";
                    $typeMessage = "success";
                }
            }
        }
    }
}
//Action Delete Processing End
$_SESSION['todo-action-message'] = $actionMessage;
$_SESSION['todo-type-message'] = $typeMessage;
header('Location:../todo.php');