Enrobage de la page par le squelette.
This commit is contained in:
parent
3f8c725ca1
commit
c8b2df3fc1
|
@ -13,19 +13,27 @@ class CMS {
|
|||
$module = Modules::get_module($chemin);
|
||||
|
||||
$paramètres = array("action" => "vue");
|
||||
foreach ($module["get_post"] as $param) {
|
||||
if (isset($_GET[$param])) $paramètres[$param] = $_GET[$param];
|
||||
if (isset($_POST[$param])) $paramètres[$param] = $_POST[$param];
|
||||
}
|
||||
foreach ($module["post"] as $param) {
|
||||
if (isset($_POST[$param])) $paramètres[$param] = $_POST[$param];
|
||||
}
|
||||
foreach ($module["file"] as $param) {
|
||||
if (isset($_FILE[$param])) $paramètres[$param] = $_FILE[$param];
|
||||
}
|
||||
|
||||
|
||||
foreach ($module["get_post"] as $param) {
|
||||
if (isset($_GET[$param])) $paramètres[$param] = $_GET[$param];
|
||||
if (isset($_POST[$param])) $paramètres[$param] = $_POST[$param];
|
||||
}
|
||||
foreach ($module["post"] as $param) {
|
||||
if (isset($_POST[$param])) $paramètres[$param] = $_POST[$param];
|
||||
}
|
||||
foreach ($module["file"] as $param) {
|
||||
if (isset($_FILE[$param])) $paramètres[$param] = $_FILE[$param];
|
||||
}
|
||||
|
||||
$action = $paramètres["action"];
|
||||
echo Modules::action($chemin, $action, $paramètres);
|
||||
$ret = Modules::action($chemin, $action, $paramètres);
|
||||
|
||||
// TODO
|
||||
// if ($ret est une page) {
|
||||
echo Squelette::enrober($ret);
|
||||
// } else if ($ret est un redirect) {
|
||||
// } else if ($ret est un raw) {
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ class GalerieÉvènement {
|
|||
}
|
||||
|
||||
public static function vue($chemin, $vue = "normal") {
|
||||
$ret = '';
|
||||
if ($vue == "normal") {
|
||||
$ret = '';
|
||||
if (Permissions::vérifier_permission($chemin, "set_prop", Authentification::get_utilisateur())) {
|
||||
$ret .= '<input type="text" name="titre" value="' . Stockage::get_prop($chemin, "titre") . '" />';
|
||||
$ret .= formulaire_édition_texte_enrichi(Stockage::get_prop($chemin, "description"), "message");
|
||||
|
@ -56,12 +56,13 @@ class GalerieÉvènement {
|
|||
$ret .= '<li><a href="' . $k->get_url() . '">' . Modules::vue($k, 'miniature') . '</a></li>'; // TODO : escape l'url !
|
||||
}
|
||||
$ret .= '</ul>';
|
||||
return $ret;
|
||||
} else if ($vue == "miniature") {
|
||||
$ret = "Aucune<br/>photo";
|
||||
|
||||
$enfants = Stockage::liste_enfants($chemin);
|
||||
if (isset($enfants[0])) return Modules::vue($enfants[0], 'miniature');
|
||||
else return "Aucune<br/>photo";
|
||||
if (isset($enfants[0])) $ret = Modules::vue($enfants[0], 'miniature')->contenu;
|
||||
}
|
||||
return Modules::page($ret, Stockage::get_prop($chemin, "titre"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ class GalerieIndex {
|
|||
}
|
||||
|
||||
public static function vue($chemin, $vue = "normal") {
|
||||
$ret = '';
|
||||
if ($vue == "normal") {
|
||||
$ret = '';
|
||||
if (Permissions::vérifier_permission($chemin, "set_prop", Authentification::get_utilisateur())) {
|
||||
$ret .= '<input type="text" name="titre" value="' . Stockage::get_prop($chemin, "titre") . '" />';
|
||||
$ret .= formulaire_édition_texte_enrichi(Stockage::get_prop($chemin, "description"), "message");
|
||||
|
@ -51,17 +51,15 @@ class GalerieIndex {
|
|||
$ret .= '<input type="submit" value="Supprimer"/>';
|
||||
$ret .= '</form>';
|
||||
}
|
||||
$ret .= '<ul class="galerie index">';
|
||||
foreach (Stockage::liste_enfants($chemin) as $k) {
|
||||
$ret .= '<li><a href="' . $k->get_url() . '">' . Modules::vue($k, 'miniature') . '</a></li>'; // TODO : escape l'url !
|
||||
}
|
||||
$ret .= '</ul>';
|
||||
return $ret;
|
||||
} else if ($vue == "miniature") {
|
||||
$enfants = Stockage::liste_enfants($chemin);
|
||||
if (isset($enfants[0])) return Modules::vue($enfants[0], 'miniature');
|
||||
else return "Aucune<br/>photo";
|
||||
$ret .= '<ul class="galerie index">';
|
||||
foreach (Stockage::liste_enfants($chemin) as $k) {
|
||||
$ret .= '<li><a href="' . $k->get_url() . '">'
|
||||
. Modules::vue($k, 'miniature')->contenu
|
||||
. '</a></li>'; // TODO : escape l'url !
|
||||
}
|
||||
$ret .= '</ul>';
|
||||
}
|
||||
return Modules::page($ret, Stockage::get_prop($chemin, "titre"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ class GaleriePériode {
|
|||
}
|
||||
|
||||
public static function vue($chemin, $vue = "normal") {
|
||||
$ret = '';
|
||||
if ($vue == "normal") {
|
||||
$ret = '';
|
||||
if (Permissions::vérifier_permission($chemin, "set_prop", Authentification::get_utilisateur())) {
|
||||
$ret .= '<input type="text" name="titre" value="' . Stockage::get_prop($chemin, "titre") . '" />';
|
||||
$ret .= formulaire_édition_texte_enrichi(Stockage::get_prop($chemin, "description"), "message");
|
||||
|
@ -56,12 +56,13 @@ class GaleriePériode {
|
|||
$ret .= '<li><a href="' . $k->get_url() . '">' . Modules::vue($k, 'miniature') . '</a></li>'; // TODO : escape l'url !
|
||||
}
|
||||
$ret .= '</ul>';
|
||||
return $ret;
|
||||
} else if ($vue == "miniature") {
|
||||
$ret = "Aucune<br/>photo";
|
||||
|
||||
$enfants = Stockage::liste_enfants($chemin);
|
||||
if (isset($enfants[0])) return Modules::vue($enfants[0], 'miniature');
|
||||
else return "Aucune<br/>photo";
|
||||
if (isset($enfants[0])) $ret = Modules::vue($enfants[0], 'miniature')->contenu;
|
||||
}
|
||||
return Modules::page($ret, Stockage::get_prop($chemin, "titre"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,13 +45,15 @@ class GaleriePhoto {
|
|||
$ret .= '<img src="' . $chemin->get_url("?vue=image") . '"></img>';
|
||||
$ret .= affichage_texte_enrichi(Stockage::get_prop($chemin, "message"));
|
||||
}
|
||||
return $ret;
|
||||
return Modules::page($ret, "Photo");
|
||||
} else if ($vue == "miniature") {
|
||||
return '<img src="' . $chemin->get_url("?vue=image_mini") . '"></img>';
|
||||
$ret = '<img src="' . $chemin->get_url("?vue=image_mini") . '"></img>';
|
||||
|
||||
return Modules::page($ret, "Photo");
|
||||
} else if ($vue == "image") {
|
||||
Stockage::get_prop_sendfile("image");
|
||||
return Modules::raw(Stockage::get_prop_sendfile("image"));
|
||||
} else if ($vue == "image_mini") {
|
||||
Stockage::get_prop_sendfile("image_mini");
|
||||
return Modules::raw(Stockage::get_prop_sendfile("image_mini"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,15 +21,19 @@ class Modules {
|
|||
|
||||
public static function action($chemin, $action, $paramètres) {
|
||||
$module = self::get_module($chemin);
|
||||
if ($module === false) return false;
|
||||
if ($module === false) return self::page(false, "Erreur");
|
||||
return call_user_func(array($module["classe"], "action"), $chemin, $action, $paramètres);
|
||||
}
|
||||
|
||||
public static function vue($chemin, $vue = "normal") {
|
||||
$module = self::get_module($chemin);
|
||||
if ($module === false) return false;
|
||||
if ($module === false) return self::page(false, "Erreur");
|
||||
return call_user_func(array($module["classe"], "vue"), $chemin, $vue);
|
||||
}
|
||||
}
|
||||
|
||||
public static function page($contenu, $titre) {
|
||||
return (object)array("contenu" => $contenu, "titre" => $titre);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -18,8 +18,7 @@ class Squelette {
|
|||
<meta http-equiv="Content-Language" content="fr" />
|
||||
<link href="../style.css" rel="stylesheet" type="text/css" /><!-- TODO : chemin incorrect -->
|
||||
</head>
|
||||
<body>
|
||||
<h1>' . $page->titre . '</h1>';
|
||||
<body>';
|
||||
// <meta name="keywords" lang="fr" content="motcle1,mocle2" />
|
||||
// <meta name="description" content="Description de ma page web." />
|
||||
}
|
||||
|
|
1
__cms__/donnees/__prop__titre
Normal file
1
__cms__/donnees/__prop__titre
Normal file
|
@ -0,0 +1 @@
|
|||
Site d'exemple
|
Loading…
Reference in New Issue
Block a user