-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
34 lines (25 loc) · 865 Bytes
/
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
<?php
require("views/view_header.php");
$model = isset($_GET["model"]) ? $_GET["model"] : 'student';
$method = isset($_GET["method"]) ? $_GET["method"] : 'list';
$inc = "models/".$model.".php";
if (file_exists($inc) && is_readable($inc)) {
include $inc;
} else {
die('Model '.$model.' file does not exists or is not readable.');
}
$function_name = "get".ucfirst($model).ucfirst($method);
if (function_exists($function_name)) {
$params = array_merge($_POST, $_GET);
$tpl_vars = $function_name($params);
} else {
die ("Error: ".$model." has not ".$method." function implemented");
}
$view = "views/view_".$model."_".$method.".php";
if (file_exists($view) && is_readable($view)) {
include $view;
} else {
die('View '.$view.' file does not exists or is not readable.');
}
require("views/view_footer.php");
?>