diff --git a/__cms__/cms.php b/__cms__/cms.php index 6c56137..1a2084e 100644 --- a/__cms__/cms.php +++ b/__cms__/cms.php @@ -13,12 +13,20 @@ require_once("types/galerie-evenement.php"); require_once("types/galerie-photo.php"); class CMS { - public static function affiche($chemin) { + public static function affiche($chemin, $action = "afficher", $params=null) { + if (is_null($params)) $params = array(); + $p = Page::_new($chemin); - echo CMS::en_tete($p->chemin->get()) // TODO - . $p->vue() - . CMS::pied(); + if ($action == "nouvel_enfant") { + $p->nouvel_enfant($params["titre"]); + } else if ($action == "supprimer") { + $p->supprimer($params["recursif"]); + } else if ($action == "modifier") { + // TODO : houlà... + } else { + $p->affiche(); + } } public static function en_tete($titre) { diff --git a/__cms__/controleur/page.php b/__cms__/controleur/page.php index 02c64d0..8e41ac0 100644 --- a/__cms__/controleur/page.php +++ b/__cms__/controleur/page.php @@ -84,7 +84,7 @@ class Page { return self::_new($this->chemin->parent()); } - public function nouveau($nom = "") { + public function nouvel_enfant($nom = "") { // Si nom est null, utiliser "Article" + numéro // Créer un sous-dossier "nom" // L'initialiser avec le modèle donné dans __prop__modele_enfants @@ -146,6 +146,12 @@ class Page { public function vue() { return "Aucune vue pour «" . $this->chemin->get() . "» ."; } + + public function affiche() { + echo CMS::en_tete($this->chemin->get()) // TODO + . $this->vue() + . CMS::pied(); + } } ?> \ No newline at end of file diff --git a/index.php b/index.php index c3eeb28..a6a4cf1 100644 --- a/index.php +++ b/index.php @@ -2,6 +2,6 @@ require_once("__cms__/cms.php"); -CMS::affiche('/'); +CMS::affiche('/', $_GET["action"], $_GET); ?> \ No newline at end of file