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