-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
79 lines (62 loc) · 1.7 KB
/
Copy pathindex.php
File metadata and controls
79 lines (62 loc) · 1.7 KB
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
<?php
/* Dhiyaa Nazim
* January 2024
* https://dhiyaa-naz.greenriverdev.com/328/diner/
* This is my CONTROLLER for the Diner app
*/
// Turn on error reporting
ini_set('display_errors', 1);
error_reporting(E_ALL);
session_save_path('/home/dhiyaana/public_html');
// Require the autoload file
require_once ('vendor/autoload.php');
// Test my Order class
/*
$order = new Order("pizza", "lunch", "sriracha");
var_dump($order);
*/
// Test my DataLayer class
//var_dump( DataLayer::getMeals() );
//var_dump( DataLayer::getCondiments() );
// Test Validate class
//echo Validate::validMeal('aloo gobi');
// Instantiate Fat-Free framework (F3)
$f3 = Base::instance(); //static method
$con = new Controller($f3);
// Instantiate DataLayer class
$dataLayer = new DataLayer();
// Test DataLayer class
/*
echo "<pre>";
var_dump($dataLayer->getOrders());
echo "</pre>";
*/
// Define a default route
$f3->route('GET /', function() {
$GLOBALS['con']->home();
});
// Define a breakfast route
$f3->route('GET /breakfast', function() {
//echo "Breakfast";
// Display a view page
$view = new Template();
echo $view->render('views/breakfast-menu.html');
});
// Define a order form 1 route
$f3->route('GET|POST /order1', function($f3) {
$GLOBALS['con']->order1();
});
// Define a order form 2 route
$f3->route('GET|POST /order2', function($f3) {
$GLOBALS['con']->order2();
});
// Define an order summary route
$f3->route('GET /summary', function() {
$GLOBALS['con']->summary();
});
// Define a view orders route
$f3->route('GET /view-orders', function() {
$GLOBALS['con']->view();
});
// Run Fat-Free
$f3->run(); //instance method