예제 #1
0
        $todo = htmlentities($_POST['todo']);
        $priority = htmlentities($_POST['priority']);
        $responsable = htmlentities($_POST['responsable']);
        $description = htmlentities($_POST['description']);
        $status = 0;
        $createdBy = $_SESSION['userMerlaTrav']->login();
        $created = date('Y-m-d h:i:s');
        if ($idProjet == 0) {
            $idSociete = htmlentities($_POST['idSociete']);
        } else {
            $idSociete = $projet->idSociete();
        }
        //create object
        $todo = new TodoProjet(array('todo' => $todo, 'priority' => $priority, 'status' => $status, 'responsable' => $responsable, 'description' => $description, 'idProjet' => $idProjet, 'idSociete' => $idSociete, 'created' => $created, 'createdBy' => $createdBy));
        //add it to db
        $todoManager->add($todo);
        $actionMessage = "Opération Valide : Todo Ajouté(e) avec succès.";
        $typeMessage = "success";
    } else {
        $actionMessage = "Erreur Ajout todo : Vous devez remplir le champ 'todo'.";
        $typeMessage = "error";
    }
} else {
    if ($action == "update") {
        $idTodo = htmlentities($_POST['idTodo']);
        if (!empty($_POST['todo'])) {
            $todo = htmlentities($_POST['todo']);
            $priority = htmlentities($_POST['priority']);
            $responsable = htmlentities($_POST['responsable']);
            $description = htmlentities($_POST['description']);
            $status = 0;