1 | <?php |
||
4 | class FlashMessage { |
||
5 | |||
6 | public function __construct() { |
||
9 | |||
10 | |||
11 | /** |
||
12 | * @param string $message message a affiche dans la popup d'erreur |
||
13 | * @param string $type type du message (error, success, info) |
||
14 | */ |
||
15 | public static function setFlash($message, $type = "error") { |
||
34 | |||
35 | /** |
||
36 | * pour afficher un message d'info definit avec setFlash() |
||
37 | */ |
||
38 | public static function getFlash() { |
||
39 | self::setStartSession(); |
||
40 | if (isset($_SESSION['flash'])) { |
||
41 | if (strstr($_SERVER['SCRIPT_NAME'], "index.php")) { |
||
42 | $chemin = str_replace("\\", "/", str_replace("index.php", "", $_SERVER['SCRIPT_NAME']).__NAMESPACE__."/view/"); |
||
43 | } |
||
44 | else if (strstr($_SERVER['SCRIPT_NAME'], "installation.php")) { |
||
45 | $chemin = str_replace("\\", "/", str_replace("installation.php", "", $_SERVER['SCRIPT_NAME']).__NAMESPACE__."/view/"); |
||
46 | } |
||
47 | else { |
||
48 | $chemin = str_replace("\\", "/", str_replace("admin.php", "", $_SERVER['SCRIPT_NAME']).__NAMESPACE__."/view/"); |
||
49 | } |
||
50 | require("view/index.php"); |
||
51 | unset($_SESSION['flash']); |
||
52 | } |
||
53 | } |
||
54 | |||
55 | private static function setStartSession() { |
||
60 | } |