function sendMailForNewEvent() { $reponse['statut'] = 'ok'; $idEvent = $_REQUEST['idEvent']; $arch = new Archiviste(); $event = new Event(); $event->set('id', $idEvent); $events = $arch->restituer($event); $nom = $events[0]->get('nom'); $time = $events[0]->get('date'); mailCreation($nom, $time, $idEvent); return $reponse; }
function validEvent(&$vueAgenda, $idUser, $loginUser, $withMail = true) { $nom = ''; $date = ''; $heure = ''; $duree = ''; $texte = ''; if (isset($_POST['dureeEvent'])) { $duree = $_POST['dureeEvent']; } if (isset($_POST['textEvent'])) { $texte = $_POST['textEvent']; } if (isset($_POST['nomEvent']) && isset($_POST['dateEvent']) && isset($_POST['heureEvent'])) { $nom = $_POST['nomEvent']; $date = $_POST['dateEvent']; $heure = $_POST['heureEvent']; $timestamp = Agenda::dateToTime($date, $heure); if ($timestamp) { $arch = new Archiviste(); $event = new Event(); $event->set('nom', $nom); $event->set('date', $timestamp); $event->set('duree', $duree); $event->set('texte', $texte); $event->set('idUser', $idUser); $event->set('nomLead', $loginUser); $idEvent = $arch->archiver($event); $vueAgenda->eventValidOk($idEvent, $timestamp); //envois des mail pour prevenir de l'ajout if ($withMail) { mailCreation($nom, $timestamp, $idEvent); } } else { $vueAgenda->erreurValidEvent($nom, $duree, $date, $heure, $texte); } } else { $vueAgenda->erreurValidEvent($nom, $duree, $date, $heure, $texte); } }