commit 3e101d22be767bf4a5b46921086f689d1ec0d89f
parent f06eb076f9053fca101011bdbeda93fe1ecd4328
Author: Georges Dupéron <jahvascriptmaniac+github@free.fr>
Date: Thu, 8 Jul 2010 03:17:37 +0200
Squelette du support pour les différentes actions.
Diffstat:
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git 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
@@ -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
@@ -2,6 +2,6 @@
require_once("__cms__/cms.php");
-CMS::affiche('/');
+CMS::affiche('/', $_GET["action"], $_GET);
?>
\ No newline at end of file