Skip to content
Snippets Groups Projects
Commit 538bcd5b authored by Rico van Endern's avatar Rico van Endern
Browse files

a lot of shit -sql4Zusatzstoffe

parent 2774cf69
Branches
No related tags found
No related merge requests found
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -19,7 +19,7 @@ $SQL_DB = "infoscreen"; ...@@ -19,7 +19,7 @@ $SQL_DB = "infoscreen";
// JSON // JSON
$JSON_NAME = "mensaPlan.json"; $JSON_NAME = "mensaPlan.json";
$JSON_INC_NR = true; $JSON_INC_NR = false;
$JSON_INC_ORIGINAL = false; $JSON_INC_ORIGINAL = false;
$JSON_INC_SHORT = true; $JSON_INC_SHORT = true;
$JSON_INC_ART = true; $JSON_INC_ART = true;
......
...@@ -297,18 +297,18 @@ class GERICHT { ...@@ -297,18 +297,18 @@ class GERICHT {
$json .= ','; $json .= ',';
} }
if ($inc_art) { if ($inc_art) {
$json .= '"rind": "' . $this->rind . '",'; $json .= '"rind": ' . $this->rind . ',';
$json .= '"schwein": "' . $this->schwein . '",'; $json .= '"schwein": ' . $this->schwein . ',';
$json .= '"gefluegel": "' . $this->gefluegel . '",'; $json .= '"gefluegel": ' . $this->gefluegel . ',';
$json .= '"fisch": "' . $this->fisch . '",'; $json .= '"fisch": ' . $this->fisch . ',';
$json .= '"vegetarisch": "' . $this->vegetarisch . '",'; $json .= '"vegetarisch": ' . $this->vegetarisch . ',';
$json .= '"vegan": "' . $this->vegan . '"'; $json .= '"vegan": ' . $this->vegan . '';
} }
if ($inc_art && ($inc_kind || $inc_counter || $inc_stoffe || $inc_date)) { if ($inc_art && ($inc_kind || $inc_counter || $inc_stoffe || $inc_date)) {
$json .= ','; $json .= ',';
} }
if ($inc_kind) { if ($inc_kind) {
$json .= '"kinderteller":' . $this->kinderteller . '"'; $json .= '"kinderteller":' . $this->kinderteller . '';
} }
if ($inc_kind && ($inc_counter || $inc_stoffe || $inc_date)) { if ($inc_kind && ($inc_counter || $inc_stoffe || $inc_date)) {
$json .= ','; $json .= ',';
......
...@@ -31,8 +31,8 @@ function toSql($tage, $server, $user, $pw, $db) { // TODO NR ...@@ -31,8 +31,8 @@ function toSql($tage, $server, $user, $pw, $db) { // TODO NR
$stmt = mysqli_prepare ( $mysqli, "INSERT INTO gerichte (nr,originalText,shortText,rind,schwein,gefluegel,fisch,vegetarisch,vegan,kinderteller,counter,date) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE originalText = ?,shortText = ?,rind = ?,schwein = ?,gefluegel = ?,fisch = ?,vegetarisch = ?,vegan = ?,kinderteller = ?, counter = ?" ); $stmt = mysqli_prepare ( $mysqli, "INSERT INTO gerichte (nr,originalText,shortText,rind,schwein,gefluegel,fisch,vegetarisch,vegan,kinderteller,counter,date) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON DUPLICATE KEY UPDATE originalText = ?,shortText = ?,rind = ?,schwein = ?,gefluegel = ?,fisch = ?,vegetarisch = ?,vegan = ?,kinderteller = ?, counter = ?" );
foreach ( $tage as $tag ) { foreach ( $tage as $tag ) {
foreach ( $tag->getGerichte () as $gericht ) { foreach ( $tag->getGerichte () as $gericht ) {
echo mysqli_stmt_bind_param ( $stmt, "issiiiiiiiisssiiiiiiii", $gericht->getNr (), $gericht->getOriginalText (), $gericht->getShortText (), $gericht->isRind (), $gericht->isSchwein (), $gericht->isGefluegel (), $gericht->isFisch (), $gericht->isVegetarisch (), $gericht->isVegan (), $gericht->isKinderteller (), $gericht->getCounter (), $gericht->getDate (), $gericht->getOriginalText (), $gericht->getShortText (), $gericht->isRind (), $gericht->isSchwein (), $gericht->isGefluegel (), $gericht->isFisch (), $gericht->isVegetarisch (), $gericht->isVegan (), $gericht->isKinderteller (), $gericht->getCounter () ); mysqli_stmt_bind_param ( $stmt, "issiiiiiiiisssiiiiiiii", $gericht->getNr (), $gericht->getOriginalText (), $gericht->getShortText (), $gericht->isRind (), $gericht->isSchwein (), $gericht->isGefluegel (), $gericht->isFisch (), $gericht->isVegetarisch (), $gericht->isVegan (), $gericht->isKinderteller (), $gericht->getCounter (), $gericht->getDate (), $gericht->getOriginalText (), $gericht->getShortText (), $gericht->isRind (), $gericht->isSchwein (), $gericht->isGefluegel (), $gericht->isFisch (), $gericht->isVegetarisch (), $gericht->isVegan (), $gericht->isKinderteller (), $gericht->getCounter () );
echo $gericht->getNr (); $gericht->getNr ();
$stmt->execute (); $stmt->execute ();
} }
} }
......
This diff is collapsed.
this.loaded = function(panel, config) { this.loaded = function(panel, config) {
// reload data
setInterval(function() { setInterval(function() {
getMensaPlan(); getMensaPlan();
}, 1800000); }, 1800000);
// switch tabs
setInterval(function() { setInterval(function() {
var currentTab = $("#tabs").tabs('option', 'active'); var currentTab = $("#tabs").tabs('option', 'active');
if (currentTab == 0) { if (currentTab == 0) {
...@@ -56,13 +58,12 @@ this.loaded = function(panel, config) { ...@@ -56,13 +58,12 @@ this.loaded = function(panel, config) {
var day = json.montag; var day = json.montag;
break; break;
} }
var gerichte = day.gerichte;
if (next) { if (next) {
document.getElementById("mensaPlanTitleBar").innerHTML = "Mensaplan von MORGEN dem " document.getElementById("mensaPlanTitleBar").innerHTML = "Mensaplan von MORGEN dem "
+ day.date; + day[0].date;
} else { } else {
document.getElementById("mensaPlanTitleBar").innerHTML = "Mensaplan von HEUTE dem " document.getElementById("mensaPlanTitleBar").innerHTML = "Mensaplan von HEUTE dem "
+ day.date; + day[0].date;
} }
var tableBody1 = document.getElementById("mensaPlanTable1Body"); var tableBody1 = document.getElementById("mensaPlanTable1Body");
var tableBody2 = document.getElementById("mensaPlanTable2Body"); var tableBody2 = document.getElementById("mensaPlanTable2Body");
...@@ -70,10 +71,10 @@ this.loaded = function(panel, config) { ...@@ -70,10 +71,10 @@ this.loaded = function(panel, config) {
tableBody2.innerHTML = ""; tableBody2.innerHTML = "";
var a = 0; var a = 0;
var b = 0; var b = 0;
for (var i = 0; i < gerichte.length; i++) { for (var i = 0; i < day.length; i++) {
var gericht = gerichte[i]; var gericht = day[i];
if (gericht.kategorie == 1 || gericht.kategorie == 2 if (gericht.counter != 8 && gericht.counter != 6
|| gericht.kategorie == 3 || gericht.kategorie == 4) { && gericht.counter != 4) {
var row = tableBody1.insertRow(a); var row = tableBody1.insertRow(a);
a++; a++;
} else { } else {
...@@ -83,25 +84,81 @@ this.loaded = function(panel, config) { ...@@ -83,25 +84,81 @@ this.loaded = function(panel, config) {
var cell1 = row.insertCell(0); var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1); var cell2 = row.insertCell(1);
var cell3 = row.insertCell(2); var cell3 = row.insertCell(2);
cell1.innerHTML = gericht.gericht; cell1.innerHTML = gericht.shortText;
cell2.innerHTML = gericht.art; var art = "";
var first = true;
if(gericht.rind){
art += "R";
}
if(!first) {
art += " ";
first = false;
}
if(gericht.schwein){
art += "S";
}
if(!first) {
art += " ";
first = false;
}
if(gericht.gefluegel){
art += "G";
}
if(!first) {
art += " ";
first = false;
}
if(gericht.fisch){
art += "F";
}
if(!first) {
art += " ";
first = false;
}
if(gericht.vegetarisch){
art += "V";
}
if(!first) {
art += " ";
first = false;
}
if(gericht.vegan){
art += "N";
}
cell2.innerHTML = art;
var img = ""; var img = "";
switch (gericht.kategorie) { switch (gericht.counter) {
case 0: case "1":
img = "icon-aktionsteller.png";
break;
case 1:
img = "icon-menue-1.png"; img = "icon-menue-1.png";
break; break;
case 2: case "2":
img = "icon-menue-2.png"; img = "icon-menue-2.png";
break; break;
default: case "3":
img = "icon-tagesgericht.png";
break;
case "4":
img = "icon-vegetarisch.png";
break;
case "5":
img = "icon-aktionsteller.png"; img = "icon-aktionsteller.png";
break;
case "6":
img = "icon-grillstation.png";
break;
case "7":
img = "icon-fisch.png";
break;
case "8":
img = "icon-vegan.png";
break;
default:
img = "ERROR";
}
if (gericht.counter != 0) {
gericht.counter = cell3.innerHTML = '<img src="panels/mensaPlan/img/'
+ img + '" />';
} }
gericht.kategorie = cell3.innerHTML = '<img src="panels/mensaPlan/img/'
+ gericht.kategorie + '" />';
j++;
} }
} }
......
This diff is collapsed.
<link rel="stylesheet" href="css/JQStyle.css">
<div id="tabs"> <div id="tabs">
<div id="mensaPlanTitleBar"></div> <div id="mensaPlanTitleBar"></div>
<ul> <ul>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment