-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
123 lines (116 loc) · 3.76 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
use app\controller\ControllerArticle;
use app\controller\ControllerEvent;
use app\controller\ControllerLogin;
use app\controller\ControllerReservation;
//autoload method
function autoLoad($classe)
{
$classe=str_replace('\\','/',$classe);
require $classe . '.php';
}
spl_autoload_register('autoLoad'); //fin Autoload
// Creation controllers for actions
$controllerArticle = new ControllerArticle();
$controllerLogin = new ControllerLogin();
$controllerEvent = new ControllerEvent();
$controllerReservation = new ControllerReservation();
if (isset($_GET["action"]))
{
switch ($_GET["action"]){
case "addArticle":
$controllerArticle->addArticle();
break;
case "getArticle":
if (isset($_GET["id_article"])){
$controllerArticle->getArticle($_GET["id_article"]);
}
break;
case "editArticle":
if (isset($_GET["id_article"])) {
$controllerArticle->editArticle($_GET["id_article"]);
}
break;
case "deleteArticle":
if (isset($_GET["id_article"])) {
$controllerArticle->deleteArticle($_GET["id_article"]);
}
break;
case "createEvent":
if (isset($_GET["id_article"])) {
$controllerEvent->createEvent($_GET["id_article"]);
}
break;
case "getEvent":
if (isset($_GET["id_event"])){
//$controllerArticle->getEvent($_GET["id_article"]);
}
break;
case "editEvent":
if (isset($_GET["id_event"])) {
$controllerEvent->editEvent($_GET["id_event"]);
}
break;
case "deleteEvent":
if (isset($_GET["id_event"])) {
$controllerEvent->deleteEvent($_GET["id_event"]);
}
break;
case "addReservation":
if (isset($_GET["id_event"])) {
$controllerReservation->addreservation($_GET["id_event"]);
}
break;
case "listReservation":
if (isset($_GET["id_user"]) || isset($_SESSION['isAdmin'])) {
$controllerReservation->listReservationUser($_GET["id_user"]);
}else{
if (isset($_GET["id_event"]) || isset($_SESSION['isAdmin']))
{
$controllerEvent->listReservationEvent($_GET["id_event"]);
}
else{
$controllerReservation->getReservations();
}
}
break;
case "editReservation":
if (isset($_GET["id_reservation"]))
$controllerReservation->editReservation($_GET["id_reservation"]);
break;
case "cancelReservation":
if (isset($_GET["id_reservation"]))
$controllerReservation->deleteReservation($_GET["id_reservation"]);
break;
case "login":
$controllerLogin->login();
break;
case "logout":
$controllerLogin->logout();
break;
case "register":
$controllerLogin->createUser();
break;
case "adminControlPanel":
$controllerLogin->getAllUsers();
case "editUser":
if (isset($_GET["id_user"]))
{
$controllerLogin->editUser($_GET["id_user"]);
}
break;
case "deleteUser":
if (isset($_GET["id_user"]))
{
$controllerLogin->deleteUser($_GET["id_user"]);
}
break;
default:
include ("app/view/viewPageNotFound.php");
break;
}
}elseif (isset($_GET))
{
$controllerArticle->getAll();
}
?>