forum-message.php (1575B)
1 <?php 2 3 class ForumMessage { 4 public static function action($chemin, $action, $paramètres) { 5 if ($action == "anuler") { 6 return new Page($chemin, '', "redirect"); 7 } else if ($action == "supprimer") { 8 Stockage::supprimer($chemin, true); // TODO ! gérer correctement le récursif 9 return new Page($chemin->parent(), '', "redirect"); 10 } else { 11 if (isset($paramètres["message"])) { 12 Stockage::set_prop($chemin, "message", $paramètres["message"]); 13 } 14 15 return new Page($chemin->parent(), '', "redirect"); 16 } 17 } 18 19 public static function vue($chemin, $vue = "normal") { 20 if ($vue == "normal") { 21 $ret = ''; 22 23 if (Permissions::vérifier_permission($chemin, "set_prop", Authentification::get_utilisateur())) { 24 $ret .= '<form class="forum message edition" enctype="multipart/form-data" method="post" action="' . $chemin->get_url() . '">'; 25 $ret .= formulaire_édition_texte_enrichi(Stockage::get_prop($chemin, "message"), "message"); 26 $ret .= '<p><input type="submit" value="appliquer" /></p>'; 27 $ret .= '</form>'; 28 } else { 29 $ret .= affichage_texte_enrichi(Stockage::get_prop($chemin, "message")); 30 } 31 if (Permissions::vérifier_permission($chemin, "supprimer", Authentification::get_utilisateur())) { 32 // peut-être afficher le bouton "Supprimer" ??? ou est-ce trop d'options ? 33 } 34 35 // Peut-être afficher le bouton "citer" ? ou est-ce trop d'options ? 36 37 return new Page($ret, Stockage::get_prop($chemin, "titre")); 38 } 39 } 40 } 41 42 Modules::enregister_module("ForumMessage", "forum-message", "vue", "message"); 43 44 ?>