Esempio n. 1
0
             $nomCategorie = htmlspecialchars($_POST['categorieAgenda']);
             if ($nomCategorie != '') {
                 if (!($idCategorie = $agendaManager->checkCategorieExist($nomCategorie))) {
                     //this categorie dos not exist -> we add it in database
                     if ($agendaManager->addCategorie($nomCategorie)) {
                         //insert success -> get the id
                         $idCategorie = $agendaManager->checkCategorieExist($nomCategorie);
                     } else {
                         //error the categorie was not add in DB
                         $errorView->errorGeneral();
                     }
                 }
                 //we already have idCategorie in $idCategorie -> join agenda and categorie
                 if ($agendaManager->addCategorieAgenda($idAgenda, $idCategorie)) {
                     //all work -> success message
                     $errorView->successAgendaCreated();
                     //$errorView->redirection(1);
                     //header('Refresh: 1; url=createCalendar.php');
                 } else {
                     //link between categorie and agenda failed
                     $errorView->errorGeneral();
                 }
             }
         } else {
             $errorView->errorAgendaCreateFailed();
         }
     }
     //we want to create an activity / event
 } elseif (isset($_POST['createActivity'])) {
     $dataActivity["idAgenda"] = htmlspecialchars($_POST['idAgenda']);
     //if we don't have already create an agenda, we can't add any activity