www/includes/global.inc.php

Thu, 30 Aug 2018 22:22:09 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 30 Aug 2018 22:22:09 +0200
changeset 48
bdd1ec9b9c06
parent 46
ff9be9dbcac0
child 50
6d94167c2697
permissions
-rw-r--r--

Start recipes import and menus.

<?php
/*****************************************************************************
 * Copyright (C) 2014-2018
 *   
 * Michiel Broek <mbroek at mbse dot eu>
 *
 * This file is part of Brewery Management System
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * BrewCloud is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with ThermFerm; see the file COPYING.  If not, write to the Free
 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
 *****************************************************************************/

/*
 * Look for the style names in the jqwidgets/styles directory.
 */
//$my_style = 'ui-darkness';
$my_style = 'ui-mbse';

require_once($_SERVER['DOCUMENT_ROOT'].'/config.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/version.php');


function page_header($title, $loadjs) {
	global $my_style;
	global $my_version;
?>
<!DOCTYPE html>
<html lang=nl-NL>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>BMS v<?php echo $my_version;?> - <?php echo $title;?></title>
  <link type="text/css" href="css/style.css" rel="stylesheet" media="all" />
  <link type="text/css" href="jqwidgets/styles/jqx.base.css" rel="stylesheet" />
  <link type="text/css" href="jqwidgets/styles/jqx.<?php echo $my_style; ?>.css" rel="stylesheet" />
  <meta name="viewport" content="width=device-width, initial-scale=1 maximum-scale=1 minimum-scale=1" />
  <script>
	var theme = "<?php echo $my_style; ?>";
  </script>
  <script src="js/jquery-1.11.1.min.js"></script>
  <script src="jqwidgets/jqxcore.js"></script>
  <script src="jqwidgets/jqxwindow.js"></script>
  <script src="jqwidgets/jqxmenu.js"></script>
  <script src="jqwidgets/jqxdata.js"></script>
  <script src="jqwidgets/jqxdata.export.js"></script>
  <script src="jqwidgets/jqxbuttons.js"></script>
  <script src="jqwidgets/jqxscrollbar.js"></script>
  <script src="jqwidgets/jqxgrid.js"></script>
  <script src="jqwidgets/jqxgrid.edit.js"></script>
  <script src="jqwidgets/jqxgrid.sort.js"></script>
  <script src="jqwidgets/jqxgrid.pager.js"></script>
  <script src="jqwidgets/jqxgrid.filter.js"></script>
  <script src="jqwidgets/jqxgrid.selection.js"></script>
  <script src="jqwidgets/jqxnumberinput.js"></script>
  <script src="jqwidgets/jqxlistbox.js"></script>
  <script src="jqwidgets/jqxdropdownlist.js"></script>
  <script src="jqwidgets/jqxdropdownbutton.js"></script>
  <script src="jqwidgets/jqxinput.js"></script>
  <script src="jqwidgets/jqxeditor.js"></script>
  <script src="jqwidgets/jqxtooltip.js"></script>
  <script src="jqwidgets/jqxcheckbox.js"></script>
  <script src="jqwidgets/jqxdatetimeinput.js"></script>
  <script src="jqwidgets/jqxcalendar.js"></script>
  <script src="jqwidgets/jqxgauge.js"></script>
  <script src="jqwidgets/jqxdraw.js"></script>
  <script src="jqwidgets/globalization/globalize.js"></script>
  <script src="js/global.js"></script>
<?php
if (strlen($loadjs))
    echo  '  <script src="js/'.$loadjs.'.js"></script>'.PHP_EOL;
?>
 </head>

 <body class="default">
  <div id="jqxWidget">

   <!-- Menu -->
   <div id="jqxMenu">
    <ul>
     <li><a href="index.php">Home</a></li>
     <li>Monitoren
      <ul>
       <li>Systemen
	<ul>
<?php
$connect = mysqli_connect(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
$result = mysqli_query($connect, "SELECT uuid,node,online,net_address FROM mon_nodes ORDER BY node");
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
    echo '         <li><a href="mon_node.php?uuid='.$row['uuid'].'">'.$row['node'].'</a></li>'.PHP_EOL;
}
mysqli_free_result($result);
?>
	</ul>
       </li>
       <li>Klimaatkasten
	<ul>
<?php
$result = mysqli_query($connect, "SELECT uuid,node,alias,online,mode FROM mon_fermenters ORDER BY node,alias");
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
    echo '         <li><a href="mon_fermenter.php?uuid='.$row['uuid'].'">'.$row['node'].'/'.$row['alias'].'</a></li>'.PHP_EOL;
}
mysqli_free_result($result);
?>
        </ul>
       </li>
      </ul>
     </li>
     <li>Productie
     </li>
     <li>Recepten
      <ul>
<?php
$result = mysqli_query($connect, "SELECT DISTINCT style_guide FROM recipes ORDER BY style_guide");
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
    $guide = $row['style_guide'];
    echo '       <li>' . $guide . PHP_EOL;
    echo '        <ul>'.PHP_EOL;
    $result2 = mysqli_query($connect, "SELECT DISTINCT style_letter FROM recipes WHERE style_guide='".$guide."' ORDER BY style_letter");
    while($row2 = mysqli_fetch_array($result2, MYSQLI_ASSOC)) {
	$letter = $row2['style_letter'];
	echo '         <li>' . $letter . PHP_EOL;
        echo '          <ul>'.PHP_EOL;
	$result3 = mysqli_query($connect, "SELECT DISTINCT style_name FROM recipes WHERE style_guide='".$guide."' and style_letter='".$letter."' ORDER BY style_name");
	while ($row3 =  mysqli_fetch_array($result3, MYSQLI_ASSOC)) {
	    $name = $row3['style_name'];
	    echo '           <li>' . $name . PHP_EOL;
	    echo '            <ul>'.PHP_EOL;
	    $result4 = mysqli_query($connect, "SELECT DISTINCT record,name FROM recipes WHERE style_guide='".$guide."' and style_letter='".$letter."' and style_name='".$name."'ORDER BY name");
	    while ($row4 =  mysqli_fetch_array($result4, MYSQLI_ASSOC)) {
		echo '             <li><a href="recipe.php?record='.$row4['record'].'">' . $row4['name'] . '</a></li>' . PHP_EOL;
	    }
	    mysqli_free_result($result4);
	    echo '            </ul>'.PHP_EOL;
	    echo '           </li>' . PHP_EOL;
	}
	mysqli_free_result($result3);
	echo '          </ul>'.PHP_EOL;
	echo '         </li>'.PHP_EOL;
    }
    mysqli_free_result($result2);
    echo '        </ul>'.PHP_EOL;
    echo '       </li>'.PHP_EOL;
}
mysqli_free_result($result);
?>
       <li>Nieuw</li>
      </ul>
     </li>
     <li>Inventaris
      <ul>
       <li><a href="inv_suppliers.php">Leveranciers</a></li>
       <li><a href="inv_fermentables.php">Vergistbare ingredienten</a></li>
       <li><a href="inv_hops.php">Hoppen</a></li>
       <li><a href="inv_yeasts.php">Gisten</a></li>
       <li><a href="inv_miscs.php">Overige ingredienten</a></li>
       <li><a href="inv_waters.php">Brouwwater</a></li>
       <li><a href="inv_equipments.php">Brouw apparatuur</a></li>
       <li><a href="inv_instock.php">Voorraad lijst</a></li>
      </ul>
     </li>
     <li>Profielen
      <ul>
       <li><a href="profile_water.php">Water profielen</a></li>
       <li><a href="profile_mash.php">Maisch schemas</a></li>
       <li><a href="profile_styles.php">Bierstijlen</a></li>
      </ul>
     </li>
     <li>Over
      <ul>
       <li><a href="#aboutWindow">Informatie</a></li>
      </ul>
     </li>
    </ul>
   </div> <!-- End menu -->

   <div id="aboutWindow">
    <div>
     Over BMS
    </div>
    <div>
     The about text comes here
    </div>
   </div>

<?php
}


function confirm_delete() {
?>
   <div id="eventWindow">
    <div>
     Bevestig verwijderen
    </div>
    <div>
     <div>
      Klik "OK" om dit record definitief te verwijderen.<br>
      Druk "Cancel" om te sluiten zonder dit record te verwijderen.
     </div>
     <div>
      <div style="float: right; margin-top: 15px; margin-bottom: 10px;">
       <input type="button" id="delOk" value="OK" style="margin-right: 15px" />
       <input type="button" id="delCancel" value="Cancel" style="margin-right: 65px" />
      </div>
     </div>
    </div>
   </div>

<?php
}


function page_footer() {
?>
  </div> <!-- jqxWidget -->
 </body>
</html>
<?php
}
?>

mercurial