www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

site-index.php (2632B)


      1 <?php
      2 
      3 class SiteIndex {
      4 	public static function action($chemin, $action, $paramètres) {
      5 		if (isset($paramètres["nom_site"])) {
      6 			Stockage::set_prop($chemin, "nom_site", $paramètres["nom_site"]);
      7 		}
      8 		
      9 		if (isset($paramètres["prochain_evenement"])) {
     10 			Stockage::set_prop($chemin, "prochain_evenement", $paramètres["prochain_evenement"]);
     11 		}
     12 		
     13 		if (isset($paramètres["description"])) {
     14 			Stockage::set_prop($chemin, "description", $paramètres["description"]);
     15 		}
     16 		
     17 		if (isset($paramètres["vue"])) {
     18 			return self::vue($chemin, $paramètres["vue"]);
     19 		} else {
     20 			return self::vue($chemin);
     21 		}
     22 	}
     23 	
     24 	public static function vue($chemin, $vue = "normal") {
     25 		if ($vue == "normal") {
     26 			$ret = '';
     27 			
     28 			$ret .= '<div class="prochain-evenement">';
     29 			$ret .= '<h2>Prochain évènement</h2>';
     30 			if (Permissions::vérifier_permission($chemin, "set_prop", Authentification::get_utilisateur())) {
     31 				$ret .= '<form method="post" action="' . $chemin->get_url() . '">';
     32 				$ret .= formulaire_édition_texte_enrichi(Stockage::get_prop($chemin, "prochain_evenement"), "prochain_evenement");
     33 				$ret .= '<p><input type="submit" value="appliquer" /></p>';
     34 				$ret .= '</form>';
     35 			} else {
     36 				$ret .= Stockage::get_prop($chemin, "prochain_evenement");
     37 			}
     38 			$ret .= '</div>';
     39 			
     40 			$ret .= '<div class="description-site">';
     41 			if (Permissions::vérifier_permission($chemin, "set_prop", Authentification::get_utilisateur())) {
     42 				$ret .= '<form class="nom_site infos" method="post" action="' . $chemin->get_url() . '">';
     43 				$ret .= '<h2><input type="text" name="nom_site" value="' . Stockage::get_prop($chemin, "nom_site") . '" /></h2>';
     44 				$ret .= '<p><input type="submit" value="appliquer" /></p>';
     45 				$ret .= '</form>';
     46 			} else {
     47 				$ret .= "<h2>" . Stockage::get_prop($chemin, "nom_site") . "</h2>";
     48 			}
     49 			if (Permissions::vérifier_permission($chemin, "set_prop", Authentification::get_utilisateur())) {
     50 				$ret .= '<form method="post" action="' . $chemin->get_url() . '">';
     51 				$ret .= formulaire_édition_texte_enrichi(Stockage::get_prop($chemin, "description"), "description");
     52 				$ret .= '<p><input type="submit" value="appliquer" /></p>';
     53 				$ret .= '</form>';
     54 			} else {
     55 				$ret .= Stockage::get_prop($chemin, "description");
     56 			}
     57 			$ret .= '</div>';
     58 			return new Page($ret, Stockage::get_prop($chemin, "nom_site"));
     59 		} else if ($vue == "css") {
     60 			return new Page(get_css(), "text/css", "raw");
     61 		}
     62 		return new Page('',''); // TODO : devrait renvoyer une page d'erreur !
     63 	}
     64 }
     65 
     66 Modules::enregister_module("SiteIndex", "site-index", "vue", "nom_site prochain_evenement description");
     67 
     68 ?>