示例#1
0
 /**
  * Récupère un lieu par son nom
  * @param string $name
  * @return Lieu
  * @throws \Exception
  */
 public static function getLieuByName($name)
 {
     try {
         $conn = Main::bdd();
         $reqPrepare = $conn->prepare("SELECT * FROM lieu WHERE nomLieu = ?");
         $reqPrepare->execute(array($name));
         $tab = $reqPrepare->fetch();
         $lieu = new Lieu($tab['idLieu'], $tab['nomLieu'], $tab['adrLieu'], $tab['cpLieu'], $tab['villeLieu']);
         $lesSeances = MSeance::getSeancesByLieu($lieu);
         $lieu->setLesSeances($lesSeances);
         return $lieu;
     } catch (\PDOException $e) {
         throw new \Exception("Le lieu {$name} n'existe pas.");
     }
 }
示例#2
0
 /**
  * Supprime un spectacle
  * @param Spectacle $spectacle
  * @throws \Exception
  */
 public static function rmSpectacle(Spectacle $spectacle)
 {
     $conn = Main::bdd();
     try {
         $conn->beginTransaction();
         MSaison::rmSaisonSpectacle($spectacle);
         foreach ($spectacle->getLesSeances()->getCollection() as $seance) {
             MPlanning::rmPlanningbySeance($seance);
         }
         MSeance::rmSeancesSpec($spectacle);
         $reqPrepare = $conn->prepare("DELETE FROM spectacle WHERE idSpectacle = ?");
         $reqPrepare->execute(array($spectacle->getId()));
         $conn->commit();
     } catch (\PDOException $e) {
         $conn->rollBack();
         throw new \Exception("Le spectacle " . $spectacle->getId() . " n'a pas pu être supprimé. Détails : <p>" . $e->getMessage() . "</p>");
     }
 }
示例#3
0
 /**
  * Récupère le planning où l'inscription est passé en paramètre
  * @param Inscription $inscription
  * @return Planning
  * @throws \Exception
  */
 public static function getPlanningByInscription(Inscription $inscription)
 {
     try {
         $conn = Main::bdd();
         $reqPrepare = $conn->prepare("SELECT * FROM planning WHERE idInscription = ?");
         $reqPrepare->execute(array($inscription->getId()));
         $tab = $reqPrepare->fetch();
         $seance = MSeance::getSeance($tab['idSeance']);
         $planning = new Planning($seance, $inscription);
         return $planning;
     } catch (\PDOException $e) {
         throw new \Exception("L'inscription " . $inscription->getId() . " n'est pas dans le planning");
     }
 }
示例#4
0
                <?php 
                $content = ob_get_clean();
                // convert in PDF
                require_once ROOT . 'vendor/spipu/html2pdf/html2pdf.class.php';
                try {
                    $pdf = new HTML2PDF('L', 'A4', 'fr');
                    $pdf->writeHTML($content);
                    ob_end_clean();
                    $pdf->Output('Planning.pdf');
                } catch (HTML2PDF_exception $e) {
                    echo $e;
                    exit;
                }
            }
            $listSeance = MSeance::getSeances();
            $listSpectacle = MSpectacle::getSpectacles();
            require_once ROOT . 'views/kiosqueadmin/CollegeLycee/v_SeancePDF.php';
        } catch (\Exception $e) {
            Main::setFlashMessage($e->getMessage(), "error");
        }
        break;
    case 'JaugePDFCL':
        try {
            if (isset($_GET['spectacle'])) {
                $spectacle = MSpectacle::getSpectacleById($_GET['spectacle']);
                $listJaugeSpectacle = MPlanning::getJaugeRestanteJeunePublicBySpec($spectacle);
                $_SESSION['idSpectacle'] = $_GET['spectacle'];
                $_SESSION['seance'] = $listJaugeSpectacle;
            }
            if (isset($_POST['valider'])) {