diff --git a/config.php b/config.php new file mode 100644 index 0000000..662b976 --- /dev/null +++ b/config.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/controleur/page.php b/controleur/page.php index 471dc0e..226dbb3 100644 --- a/controleur/page.php +++ b/controleur/page.php @@ -1,8 +1,10 @@ chemin = $chemin; + } + public function liste_enfants() { - // Ouvrir le dossier (fopen). - // Lister les dossiers. - // Construire un objet Page pour chacun (code commun avec Page::enfant(nom)). - // renvoyer la liste. + $lst = scandir($this->chemin); + $lst_enfants = Array(); + if ($lst !== false) { + foreach ($lst as $k => $v) { + // Construire un objet Page pour chacun (code commun avec Page::enfant(nom)). + $lst_enfants[] = new Page($this->chemin . '/' . $v); // TODO : . '/' . n'est pas portable ! + } + } + return $lst_enfants; } - public function enfant(nom) { + public function enfant($nom) { // Récupéere le sous-dossier "nom" // Construire un objet Page (code commun avec Page::liste_enfants()). } @@ -30,30 +42,36 @@ class Page { // Construire un objet Page (code commun avec Page::enfant(nom)). } - public function nouveau(nom) { + public function nouveau($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 // Construire un objet Page (code commun avec Page::enfant(nom)). } - public function supprimer(récursif) { + public function supprimer($récursif) { // Si récursif || il n'y a pas de sous-dossiers // alors supprimer récursivement le dossier courant // sinon renvoyer FAUX } - public function get_prop(nom_propriété) { + public function get_prop($nom_propriété) { // lire le contenu du fichier prop_nom_propriété } - public function set_prop(nom_propriété, valeur) { + public function set_prop($nom_propriété, $valeur) { // écrire le contenu du fichier prop_nom_propriété } public function url() { // calculer l'url de cette page en fonction de son chemin et de l'url de base + global $config_url_base; + return $config_url_base . $this->chemin; } - } + + public function vue() { + return "Aucune vue pour «" . $this->chemin . "» ."; + } +} ?> \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..69a97b4 --- /dev/null +++ b/index.php @@ -0,0 +1,10 @@ +