connexion_bdd_pdo = $register->get('connexion_bdd_pdo'); $this->dev = $register->get('dev'); } function creerFeuilleton() { $table = 'pol_feuilleton'; $champs = array(); $champs[0] = array( 'titre' => $this->titre, 'resume' => $this->resume, 'date_creation' => date('Y-m-d H:i:s'), 'actif' => $this->actif, 'accueil' => $this->accueil, 'complet' => $this->complet, // 'type' => $this->type ); if (!empty($this->type)) { $champs[0]['type'] = $this->type; } $this->numfeuilleton = $this->connexion_bdd_pdo->executionRequeteInsertion($table, $champs); return $this->numfeuilleton; } function modifierFeuilleton() { if ($this->numfeuilleton) { $champs = array(); $champs[0] = array( 'titre' => $this->titre, 'resume' => $this->resume, 'actif' => $this->actif, 'accueil' => $this->accueil, 'complet' => $this->complet, //'type' => $this->type ); if (!empty($this->type)) { $champs[0]['type'] = $this->type; } $this->numfeuilleton = $this->connexion_bdd_pdo->executionRequeteUpdate('pol_feuilleton', $champs, 'numfeuilleton', $this->numfeuilleton); return $this->numfeuilleton; } } function associerAuteurFeuilleton() { $table = 'pol_feuilleton_auteur'; $champs = array(); $champs[0] = array( 'numfeuilleton' => $this->numfeuilleton, 'numauteur' => $this->numauteur ); $this->connexion_bdd_pdo->executionRequeteInsertion($table, $champs); } function modifDateDernierEpisodeFeuilleton() { if ($this->numfeuilleton) { // on met a jour le champ date_dernier_episode du feuilleton $sql = "SELECT pol_paragraphe.date_episode as para_date FROM pol_paragraphe,pol_feuilleton_para WHERE pol_feuilleton_para.numpara=pol_paragraphe.numpara AND pol_feuilleton_para.numfeuilleton='" . $this->numfeuilleton . "' ORDER BY pol_paragraphe.date_episode DESC"; $row = $this->connexion_bdd_pdo->executionRequeteFetchAssoc($sql); $champs = array(); $champs[0] = array( 'date_dernier_episode' => $row[0]['para_date'] ); $this->numfeuilleton = $this->connexion_bdd_pdo->executionRequeteUpdate('pol_feuilleton', $champs, 'numfeuilleton', $this->numfeuilleton); } } function associerParaFeuilleton() { if ($this->numfeuilleton) { $table = 'pol_feuilleton_para'; $champs = array(); $champs[0] = array( 'numfeuilleton' => $this->numfeuilleton, 'numpara' => $this->numpara ); $this->connexion_bdd_pdo->executionRequeteInsertion($table, $champs); } } function modifierParaFeuilleton() { if ($this->numpara) { $champs = array(); $champs[0] = array( 'ordre' => $this->ordre ); $this->numfeuilleton = $this->connexion_bdd_pdo->executionRequeteUpdate('pol_feuilleton_para', $champs, 'numpara', $this->numpara); } } function supprimerFeuilleton() { if ($this->numfeuilleton) { $this->connexion_bdd_pdo->executionRequeteDelete('pol_feuilleton_para', 'numfeuilleton', $this->numfeuilleton); $this->connexion_bdd_pdo->executionRequeteDelete('pol_feuilleton_auteur', 'numfeuilleton', $this->numfeuilleton); $this->connexion_bdd_pdo->executionRequeteDelete('pol_feuilleton', 'numfeuilleton', $this->numfeuilleton); } } function supprimerFeuilletonAuteur() { if ($this->numfeuilleton) { $this->connexion_bdd_pdo->executionRequeteDelete('pol_feuilleton_auteur', 'numfeuilleton', $this->numfeuilleton); } } function supprimerParaFeuilleton() { if ($this->numpara) { $this->connexion_bdd_pdo->executionRequeteDelete('pol_feuilleton_para', 'numpara', $this->numpara); } } function infosFeuilleton() { $row = SelectMultiple("pol_feuilleton", "numfeuilleton", $this->numfeuilleton); $this->titre = $row["titre"]; $this->resume = $row["resume"]; $this->actif = $row["actif"]; $this->accueil = $row["accueil"]; $this->complet = $row["complet"]; $this->type = $row["type"]; $tab_nom_type = array("1" => "Feuilletons", "2" => "Théâtre", "3" => "Textes libres"); $this->nom_type = $tab_nom_type[$row["type"]]; $datedujour = date("Y-m-d") . " 00:00:00"; // date du dernier episode $sql = "SELECT pol_paragraphe.date_episode as date_episode FROM pol_paragraphe,pol_feuilleton_para WHERE pol_feuilleton_para.numfeuilleton='" . $row["numfeuilleton"] . "' AND pol_feuilleton_para.numpara=pol_paragraphe.numpara AND pol_paragraphe.date_episode<='" . $datedujour . "' ORDER BY pol_paragraphe.date_episode DESC LIMIT 0,1"; $result = $this->connexion_bdd_pdo->executionRequeteFetchAssoc($sql); $date_episode[0] = $result[0]['date_episode']; if ($date_episode[0] && $date_episode[0] != "0000-00-00 00:00:00") { $datep = explode("/", MiseEnformeDateBddFr($date_episode[0])); $this->date_episode_bon = strftime("%d %B %Y", mktime(0, 0, 0, $datep[1], $datep[0], $datep[2])); } else $this->date_episode_bon = ""; $sql2 = "SELECT numpara FROM pol_feuilleton_para WHERE numfeuilleton='" . $row["numfeuilleton"] . "'"; $results = $this->connexion_bdd_pdo->executionRequeteFetchAssoc($sql2); foreach ($results as $result) { $this->tab_para_feuilleton[] = $result['numpara']; } $sql3 = "SELECT numauteur FROM pol_feuilleton_auteur WHERE numfeuilleton='" . $row["numfeuilleton"] . "'"; $results = $this->connexion_bdd_pdo->executionRequeteFetchAssoc($sql3); foreach ($results as $result) { $this->tab_auteur_feuilleton[] = $result['numauteur']; } }}?>