forked from iaguas/construyetupc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainController.php
58 lines (56 loc) · 1.76 KB
/
mainController.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
<?php
/**
* Fichero: mainController.php
* Descripcion: dicho documento representa al controlador para la parte de la página principal.
*/
function mainController($match){
if($match) {
// Si la URL encaja en alguna de las rutas
switch($match['target']) {
case 'vLandingPage':
if($match['params']['id'] == 2) {
vCreatorId();
}
else {
vLandingPage();
}
break;
case 'vMainPage':
vShowMainPage();
break;
case 'vWhoWeAre':
vShowWhoWeAre();
break;
case 'vShowComponentSelection':
vShowComponentSelection($match['params']['part']);
break;
case 'sAddPart':
sAddPart($match['params']['part']);
break;
case 'sRemovePart':
sRemovePart($match['params']['part']);
vShowPartList();
break;
case 'vShowDetailedPartModel':
vShowDetailedPartModel($match['params']['part'], $match['params']['serialNumber']);
break;
case 'vShowContact':
vShowContact();
break;
case 'vSendMessage':
vSendMessage();
break;
case 'vShowAbout':
vShowAbout();
break;
// Por defecto se llama a la función indicada en la ruta
default:
call_user_func($match['target']);
break;
}
}
else {
// Si no encaja, mostramos 404 y nos echamos una siesta
echo file_get_contents('views/404.html');
}
}