-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroleur_modification_retour.php
More file actions
30 lines (30 loc) · 1009 Bytes
/
controleur_modification_retour.php
File metadata and controls
30 lines (30 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/**
* Rôle : Récupère les données modifiées envoyées par le formulaire de “retour”
* Paramètres : via POST titre, description
* Sorties : retour vers la vue "vue_profil_utilisateur.php"
*/
require 'library/init.php';
session_start();
//
require_once 'model/tache.php';
//
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$id = $_POST['id'] ?? null;
$titre = $_POST['titre'] ?? '';
$description = $_POST['description'] ?? '';
$tacheModel = new Tache();
if ($id) {
$tacheModel->updateTask($id, $titre, $description);
} else {
$utilisateur_id = $_SESSION['user']['id'];
$tacheModel->createTask($titre, $description, $utilisateur_id);
}
$taches = $tacheModel->findAllByUser($_SESSION['user']['id']);
include 'template/pages/vue_profil_utilisateur.php';
//
} else {
header('Location: controleur_accueil.php');
exit;
}
?>