public function signal() { if (isset($_GET['id_avi'])) { if (!isset($_SESSION['user'])) { $m = new message(); $m->setFlash("Vous devez etre connecté pour signaler un commentaire"); $c = new T_E_CLIENT_CLIController(); $c->render("login"); } else { $allAvas = T_J_AVISABUSIF_AVA::FindAllByIdAvis($_GET['id_avi']); $alreadySignal = false; foreach ($allAvas as $ava) { if ($ava->T_E_CLIENT_CLI->cli_id == $_SESSION['user']->cli_id) { $alreadySignal = true; } } if ($alreadySignal) { $m = new message(); $m->setFlash("Vous avez déja signaler ce commentaire, merci d'attendre que le service vente prenne en compte votre requête"); header("Refresh:0; url=../Sprint/?r=jeu"); } else { T_J_AVISABUSIF_AVA::insertNewAva($_GET['id_avi'], $_SESSION['user']->cli_id); $m = new message(); $m->setFlash("Le commentaire a bien été signalé", 'success'); header("Refresh:0; url=../Sprint/?r=jeu"); } } } }
public function deleteAllAva() { $id = $this->avi_id; $allAvas = T_J_AVISABUSIF_AVA::FindAllByIdAvis($id); foreach ($allAvas as $ava) { $idAva = $ava->T_E_AVIS_AVI->avi_id; $st = db()->prepare("DELETE FROM T_J_AVISABUSIF_AVA WHERE avi_id=:avi"); $st->bindParam(':avi', $idAva); $st->execute(); } $avi = new T_E_AVIS_AVI($id); $avi->deleteAvi(); }
public function ava() { $this->render("ava", T_J_AVISABUSIF_AVA::findAll()); }