dolibarr 21.0.0-beta
menu.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) - 2020 Andreu Bisquerra Gaya <jove@bisquerra.com>
3 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
25if (!defined("NOLOGIN")) {
26 define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
27}
28if (!defined('NOIPCHECK')) {
29 define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
30}
31if (!defined('NOBROWSERNOTIF')) {
32 define('NOBROWSERNOTIF', '1');
33}
34
35// Load Dolibarr environment
36require '../../main.inc.php';
37
38require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
45if (!$conf->global->TAKEPOS_QR_MENU) {
46 accessforbidden(); // If Restaurant Menu is disabled never allow NO LOGIN access
47}
48?>
49<!DOCTYPE html>
50<html>
51<head>
52 <meta charset="UTF-8">
53 <title><?php echo $mysoc->name; ?></title>
54 <link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/foundation-sites@6.6.3/dist/css/foundation.min.css'>
55<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Khand:400,300,500,600,700'><link rel="stylesheet" href="css/style.css">
56<meta name="viewport" content="width=device-width, initial-scale=1">
57</head>
58<body>
59<!-- partial:index.partial.html -->
60<body>
61 <div class="grid-container">
62 <div class="grid-x grid-padding-x menu2">
63 <div class="cell small-12">
64 <h1><?php print $mysoc->name; ?> - <small><?php print $langs->trans('RestaurantMenu'); ?></small></h1>
65
66<?php
67$categorie = new Categorie($db);
68$categories = $categorie->get_full_arbo('product', ((getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) ? $conf->global->TAKEPOS_ROOT_CATEGORY_ID : 0), 1);
69$levelofrootcategory = 0;
70if (getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID') > 0) {
71 foreach ($categories as $key => $categorycursor) {
72 if ($categorycursor['id'] == getDolGlobalInt('TAKEPOS_ROOT_CATEGORY_ID')) {
73 $levelofrootcategory = $categorycursor['level'];
74 break;
75 }
76 }
77}
78$levelofmaincategories = $levelofrootcategory + 1;
79
80$maincategories = array();
81$subcategories = array();
82foreach ($categories as $key => $categorycursor) {
83 if ($categorycursor['level'] == $levelofmaincategories) {
84 $maincategories[$key] = $categorycursor;
85 } else {
86 $subcategories[$key] = $categorycursor;
87 }
88}
89
90$maincategories = dol_sort_array($maincategories, 'label');
91
92foreach ($maincategories as $cat) {
93 print '<div class="text-center">
94 <a id="'.$cat['id'].'"></a><h3>'.$cat['label'].'</h3>
95 </div>
96 <div class="grid-x grid-padding-x">';
97
98 $object = new Categorie($db);
99 $result = $object->fetch($cat['id']);
100 $prods = $object->getObjectsInCateg("product", 0, 0, 0, $conf->global->TAKEPOS_SORTPRODUCTFIELD, 'ASC');
102 foreach ($prods as $pro) {
103 print '
104 <div class="cell small-6 medium-4">
105 <div class="item">
106 <h4>'.$pro->label.'</h4>
107 <span class="dots"></span>
108 <span class="price">'.price($pro->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).'</span>
109 </div>
110 </div>';
111 }
112 print '</div>';
113}
114?>
115 </div>
116 </div>
117 </div>
118 <footer class="footer">
119 <div class="container">
120 <p class="text-muted"><?php print $mysoc->name; ?></p>
121 </div>
122 </footer>
123</body>
124<!-- partial -->
125<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js'></script>
126<script src='https://cdn.jsdelivr.net/npm/foundation-sites@6.6.3/dist/js/foundation.min.js'></script>
127<script src="js/script.js"></script>
128
129</body>
130</html>
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
Class to manage categories.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
$conf db name
Only used if Module[ID]Name translation string is not found.
Definition repair.php:152
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.