-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.php
executable file
·95 lines (75 loc) · 3.03 KB
/
menu.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
<?php
error_reporting(E_ALL);
require('localcms/loader.php');
$page = 'menu';
// Set caching
if ($is_cached) $helper->set_cache($page, $cachetime);
// Grab the data from the database
$site_options = $helper->site_options($DB->read('options'));
$categories = $DB->read('categories','order');
$items = $DB->read('items','item_order');
$sub_items = $DB->read('subitems','title');
// Create an array of category titles
$category_titles = array(''); // category ID starts at 1
foreach ($categories as $category) {
array_push($category_titles, $category->title);
}
// Sort menu items by category
$menu_items_by_category = $helper->sort_menu_items($items, 'category');
ksort($menu_items_by_category); // Re-sort by category
// Sort sub-items by their parent item
$sub_items_by_item = $helper->sort_menu_items($sub_items, 'parent_id');
?>
<?php include('partials/header.php'); ?>
<div class="container">
<div class="hero menu-hero clearfix">
<div class="row">
<div class="columns large-9">
<h1><a href="./" title="Return to homepage" data-instant><?php echo $site_options->name; ?></a></h1>
</div>
<div class="columns large-3">
<a href="./" class="menu" data-instant>Return Home</a>
</div>
<div class="clear"></div>
</div>
</div>
<div class="row">
<div class="columns large-6 medium-8 large-centered medium-centered">
<h2>Dining Menu</h2>
<?php
$menu = 'appdata/menu.pdf';
if(file_exists($menu)){
echo "<a href='appdata/menu.pdf'>Download our full menu</a>";
}
?>
<ul id="menu">
<?php
if (count($menu_items_by_category) > 0) {
foreach($menu_items_by_category as $key => $menu_items) {
echo '<h3>' . $category_titles[$key] . '</h3>';
foreach($menu_items as $item) { ?>
<li>
<h5><?php echo $item->title; ?>
<strong class="price right">
<?php echo $currency; echo $item->price; ?>
</strong></h5>
<p class="description"><em><?php echo $item->description; ?></em></p>
<?php if (isset($sub_items_by_item[$item->id]) && count($sub_items_by_item[$item->id]) > 0) { ?>
<ul class="options">
<?php foreach($sub_items_by_item[$item->id] as $item_option) { ?>
<li>
<?php echo $item_option->title; ?>
<div class="right"><?php echo $currency; echo $item_option->price; ?></div>
</li>
<?php } ?>
</ul>
<?php } ?>
</li>
<?php } ?>
<hr>
<?php }
} ?>
</ul>
</div>
</div>
<?php include('partials/footer.php'); ?>