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

fixed mensapenal and added startdate for werbung

parent 079b3453
No related branches found
No related tags found
No related merge requests found
...@@ -23,35 +23,17 @@ ...@@ -23,35 +23,17 @@
"config": { "config": {
"files": [ "files": [
{ {
"filename": "itour2016_0.png", "filename": "OpenSourceInfoscreen.jpg",
"enddate": "02.11.2016" "startdate": "24.04.2017",
"enddate": "NEVER"
}, },
{ {
"filename": "DAT_2016_Flyer_DINA6.png", "filename": "ko.jpg",
"enddate": "18.11.2016" "startdate": "NEVER",
}, "enddate": "25.04.2017"
{
"filename": "Ankndigung_FVV.png",
"enddate": "30.11.2019"
},
{
"filename": "OpenSourceInfoscreen.jpg",
"enddate": "NEVER"
} }
] ]
} }
},
{
"type": "panel",
"name": "ufc"
},
{
"type": "panel",
"name": "mensaPlan"
},
{
"type": "panel",
"name": "lsfView"
} }
] ]
} }
......
...@@ -23,19 +23,13 @@ ...@@ -23,19 +23,13 @@
"config": { "config": {
"files": [ "files": [
{ {
"filename": "itour2016_0.png", "filename": "SOMEFILE.png",
"enddate": "02.11.2016" "startdate": "NEVER",
},
{
"filename": "DAT_2016_Flyer_DINA6.png",
"enddate": "18.11.2016"
},
{
"filename": "Ankndigung_FVV.png",
"enddate": "30.11.2016" "enddate": "30.11.2016"
}, },
{ {
"filename": "OpenSourceInfoscreen.jpg", "filename": "OpenSourceInfoscreen.jpg",
"startdate": "NEVER",
"enddate": "18.11.2017" "enddate": "18.11.2017"
} }
] ]
......
...@@ -60,34 +60,34 @@ if($SEMESTER == 1){ ...@@ -60,34 +60,34 @@ if($SEMESTER == 1){
// search subject // search subject
$subjects = array (); $subjects = array ();
foreach ( $SUBJECT_LIST as $SUBJECT ) { foreach ( $SUBJECT_LIST as $SUBJECT ) {
echo "Searching ".$SUBJECT->getSearchName()."-"; echo "Searching ".$SUBJECT->getSearchName()."\n";
$html = file_get_html ( $SEARCH_URL."&veranstaltung.dtxt=".str_replace(' ',"+",$SUBJECT->getSearchName())."&veranstaltung.semester=".date("Y").$SEMESTER); $html = file_get_html ( $SEARCH_URL."&veranstaltung.dtxt=".str_replace(' ',"+",$SUBJECT->getSearchName())."&veranstaltung.semester=".date("Y").$SEMESTER);
if ($html != null) { if ($html != null) {
$list = $html->find('a[title="Mehr Informationen zu '.$SUBJECT->getSearchName().'"]'); $list = $html->find('a[title="Mehr Informationen zu '.$SUBJECT->getSearchName().'"]');
if (count($list) != 0) { if (count($list) != 0) {
foreach($list as $a){ foreach($list as $a){
if(removeSpace($a->parent()->parent()->children (2)->innertext) == "Vorlesung") { if(removeSpace($a->parent()->parent()->children (2)->innertext) == "Vorlesung") {
echo "Hit-"; echo " - Hit \n";
$HREF = $a->href; $HREF = $a->href;
$html->clear(); $html->clear();
unset($html); unset($html);
$html = file_get_html ( html_entity_decode($HREF) ); $html = file_get_html ( html_entity_decode($HREF) );
if ($html != null) { if ($html != null) {
array_push ( $subjects, parsSubject ($html,$SUBJECT) ); array_push ( $subjects, parsSubject ($html,$SUBJECT) );
} else { } else {
echo "\"".$SUBJECT->getSearchName()."\"-Site nicht aufrufbar\n"; echo "\"".$SUBJECT->getSearchName()."\"-Site nicht aufrufbar\n";
} }
break; break;
} }
} }
} else {
echo " - \"".$SUBJECT->getSearchName()."\"-Search liefert kein passendes Ergebnis\n";
}
} else { } else {
echo "\"".$SUBJECT->getSearchName()."\"-Search liefert kein passendes Ergebnis\n"; echo " - \"".$SUBJECT->getSearchName()."\"-Search nicht aufrufbar.\n";
}
} else {
echo "\"".$SUBJECT->getSearchName()."\"-Search nicht aufrufbar.\n";
} }
} }
toJsonSubjects ( $subjects, $JSON_NAME_SUBJECTS, $JSON_INC_NAME_SUBJECTS, $JSON_INC_SHORT_SUBJECTS); toJsonSubjects ( $subjects, $JSON_NAME_SUBJECTS, $JSON_INC_NAME_SUBJECTS, $JSON_INC_SHORT_SUBJECTS);
toJsonEvents ( $subjects, $JSON_NAME_EVENTS, $JSON_INC_NAME_EVENTS, $JSON_INC_SHORT_EVENTS); toJsonEvents ( $subjects, $JSON_NAME_EVENTS, $JSON_INC_NAME_EVENTS, $JSON_INC_SHORT_EVENTS);
?> ?>
\ No newline at end of file
this.tabtime=20; this.tabtime=20;
this.checkShowCondition = function() { this.checkShowCondition = function() {
return 3*this.tabtime; return 4*this.tabtime;
} }
this.show = function() { this.show = function() {
...@@ -16,6 +16,9 @@ this.show = function() { ...@@ -16,6 +16,9 @@ this.show = function() {
currentTab = 2; currentTab = 2;
break; break;
case 2: case 2:
currentTab = 3;
break;
case 3:
currentTab = 0; currentTab = 0;
break; break;
default: default:
...@@ -43,7 +46,7 @@ function padTwo(num) { ...@@ -43,7 +46,7 @@ function padTwo(num) {
function isNextDay() { function isNextDay() {
if (new Date().getHours() >= 15) { if (new Date().getHours() >= 15) {
return true; return true;
} }
} }
function calcDateAPI() { function calcDateAPI() {
...@@ -62,9 +65,16 @@ function calcTextDisplay() { ...@@ -62,9 +65,16 @@ function calcTextDisplay() {
} }
} }
function shortenText(titel) { function handleGericht(text) {
titel = titel.replace(/\([^\)]*\)/g, ""); text = text.replace(/\([^\)]*\)/g, ""); // remove zusatzstoffe
return titel text = text.replace(/\s+/g, " "); // fix double Whitespace
text = text.replace(/(\s,|,\s)/g, ","); // fix Komma
text = text.replace(/,/g, ", "); // fix Komma
text = text.replace(/,\sdazu\s\d\sBeilagen\snach\sWahl/g, " "); // remove Beilagen
text = text.replace(/\sund\s\d\sBeilagen\snach\sWahl/g, " "); // remove Beilagen
text = text.replace(/,\sdazu\s/g, " + "); // replace dazu
text = text.replace(/\sund\s/g, " & "); // replace und
return text
} }
this.loaded = function(panel, config) { this.loaded = function(panel, config) {
...@@ -87,58 +97,84 @@ this.loaded = function(panel, config) { ...@@ -87,58 +97,84 @@ this.loaded = function(panel, config) {
var tableBody1 = document.getElementById("mensaPlanTable1Body"); var tableBody1 = document.getElementById("mensaPlanTable1Body");
var tableBody2 = document.getElementById("mensaPlanTable2Body"); var tableBody2 = document.getElementById("mensaPlanTable2Body");
var tableBody3 = document.getElementById("mensaPlanTable3Body"); var tableBody3 = document.getElementById("mensaPlanTable3Body");
var tableBody4 = document.getElementById("mensaPlanTable4Body");
tableBody1.innerHTML = ""; // clear tableBody1.innerHTML = ""; // clear
tableBody2.innerHTML = ""; // clear tableBody2.innerHTML = ""; // clear
tableBody3.innerHTML = ""; // clear tableBody3.innerHTML = ""; // clear
tableBody4.innerHTML = ""; // clear
var a = 0; var a = 0;
var b = 0; var b = 0;
var c = 0; var c = 0;
var d = 0;
for (var i = 0; i < json.length; i++) { for (var i = 0; i < json.length; i++) {
var gericht = json[i]; var gericht = json[i];
var row = ""; var row = "";
switch (gericht.category) { switch (gericht.category) {
case 1: case "1": // Menu 1
var row = tableBody1.insertRow(a); var row = tableBody1.insertRow(a);
a++; a++;
var cell = row.insertCell(0);
cell.innerHTML = handleGericht(gericht.title.de);
break; break;
case 2: case "2": // Menu 2
var row = tableBody1.insertRow(a); var row = tableBody1.insertRow(a);
a++; a++;
var cell = row.insertCell(0);
cell.innerHTML = handleGericht(gericht.title.de);
break; break;
case 3: case "3": // Tagesgericht
var row = tableBody1.insertRow(a); var row = tableBody1.insertRow(a);
a++; a++;
var cell = row.insertCell(0);
cell.innerHTML = handleGericht(gericht.title.de);
break; break;
case 4: case "4": // Vegetarisch
var row = tableBody3.insertRow(c); var row = tableBody3.insertRow(c);
c++; c++;
var cell = row.insertCell(0);
cell.innerHTML = handleGericht(gericht.title.de);
break; break;
case 5: case "5": // Aktionsteller
var row = tableBody1.insertRow(a); var row = tableBody1.insertRow(a);
a++; a++;
breaki; var cell = row.insertCell(0);
case 6: cell.innerHTML = handleGericht(gericht.title.de);
var row = tableBody1.insertRow(a);
a++;
breaki;
case 7:
var row = tableBody2.insertRow(b);
b++;
break; break;
case 8: case "6": // Aktionsteller Fisch
var row = tableBody3.insertRow(c); var row = tableBody3.insertRow(c);
c++; c++;
var cell = row.insertCell(0);
cell.innerHTML = handleGericht(gericht.title.de);
break; break;
case 16: case "7": // Aktionsteller Vegan
var row = tableBody3.insertRow(c); var row = tableBody3.insertRow(c);
c++; c++;
var cell = row.insertCell(0);
cell.innerHTML = handleGericht(gericht.title.de);
break;
case "8": // Grillstation
var row = tableBody2.insertRow(b);
b++;
var cell = row.insertCell(0);
cell.innerHTML = handleGericht(gericht.title.de);
break;
case "16": // Beilagen
var beilagen = gericht.title.de.split(";");
for (var j = 0; j < beilagen.length; j++) {
if(beilagen[j] != "") {
var row = tableBody4.insertRow(d);
d++;
var cell = row.insertCell(0);
cell.innerHTML = handleGericht(beilagen[j]);
}
}
break; break;
default: default:
var row = tableBody3.insertRow(c); var row = tableBody3.insertRow(c);
c++; c++;
var cell = row.insertCell(0);
cell.innerHTML = handleGericht(gericht.title.de);
} }
var cell1 = row.insertCell(0);
cell1.innerHTML = shortenText(gericht.title.de);
} }
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<li><a href="#tab-1">Normale Counter</a></li> <li><a href="#tab-1">Normale Counter</a></li>
<li><a href="#tab-2">Grill Counter</a></li> <li><a href="#tab-2">Grill Counter</a></li>
<li><a href="#tab-3">Sonstige Counter</a></li> <li><a href="#tab-3">Sonstige Counter</a></li>
<li><a href="#tab-4">Beilagen</a></li>
</ul> </ul>
<div id="tab-1"> <div id="tab-1">
<table id="mensaPlanTable1" style="width:100%;height:100%"> <table id="mensaPlanTable1" style="width:100%;height:100%">
...@@ -23,4 +24,10 @@ ...@@ -23,4 +24,10 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div id="tab-4">
<table id="mensaPlanTable4" style="width:100%;height:100%">
<tbody id="mensaPlanTable4Body">
</tbody>
</table>
</div>
</div> </div>
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.
...@@ -11,7 +11,7 @@ this.loaded=function(panel,config) { ...@@ -11,7 +11,7 @@ this.loaded=function(panel,config) {
function setNextWerbung() { function setNextWerbung() {
if(nextWerbung+1<werbung_config.files.length) { if(nextWerbung+1<werbung_config.files.length) {
console.log("Werbung: SETNEXT - (" + nextWerbung + " + 1)"); console.log("Werbung: SETNEXT - (" + nextWerbung + " + 1)");
nextWerbung += 1; nextWerbung += 1;
} else { } else {
console.log("Werbung: SETNEXT - (0)"); console.log("Werbung: SETNEXT - (0)");
nextWerbung = 0; nextWerbung = 0;
...@@ -29,7 +29,10 @@ this.resize=function() { ...@@ -29,7 +29,10 @@ this.resize=function() {
this.hide = function() { this.hide = function() {
} }
function isOver(day, month, year){ function isOverDate(day, month, year){
console.log("DEBUG: input"+day +" "+ month+" "+year);
var d = new Date(); var d = new Date();
if((d.getFullYear() > year) || (d.getFullYear() == year && d.getMonth() > month) || (d.getFullYear() == year && d.getMonth() == month && d.getDate() > day)){ if((d.getFullYear() > year) || (d.getFullYear() == year && d.getMonth() > month) || (d.getFullYear() == year && d.getMonth() == month && d.getDate() > day)){
return true; return true;
...@@ -37,31 +40,34 @@ function isOver(day, month, year){ ...@@ -37,31 +40,34 @@ function isOver(day, month, year){
return false; return false;
} }
} }
this.checkShowCondition = function() { this.checkShowCondition = function() {
var werbungOriginalNext = nextWerbung; var werbungOriginalNext = nextWerbung;
if(werbung_config.files[nextWerbung].enddate == "NEVER"){ var firstNotDone = true
console.log("Werbung: CurrentWerbung = " + nextWerbung + " Infinit"); while(nextWerbung != werbungOriginalNext || firstNotDone){
return 20; if(werbung_config.files[nextWerbung].startdate == "NEVER") {
} else { var skipStartTest = true;
var enddateEl = werbung_config.files[nextWerbung].enddate.split(".");
if(!isOver(enddateEl[2], enddateEl[1], enddateEl[0])) {
console.log("Werbung: CurrentWerbung = " + nextWerbung);
return 20;
} else { } else {
console.log("Werbung: Skipped - Out Of Date - (" + nextWerbung + ")"); var skipStartTest = false;
setNextWerbung();
} }
while(nextWerbung != werbungOriginalNext){ if(werbung_config.files[nextWerbung].enddate == "NEVER") {
enddateEl = werbung_config.files[nextWerbung].enddate.split("."); var skipEndTest = true;
if(!isOver(enddateEl[2], enddateEl[1], enddateEl[0])) { } else {
var skipEndTest = false;
}
if( skipStartTest || isOverDate(werbung_config.files[nextWerbung].startdate.split(".")[0], werbung_config.files[nextWerbung].startdate.split(".")[1], werbung_config.files[nextWerbung].startdate.split(".")[2])) { // did it start
if( skipEndTest || !isOverDate(werbung_config.files[nextWerbung].enddate.split(".")[0], werbung_config.files[nextWerbung].enddate.split(".")[1], werbung_config.files[nextWerbung].enddate.split(".")[2])) { // did it end
console.log("Werbung: CurrentWerbung = " + nextWerbung); console.log("Werbung: CurrentWerbung = " + nextWerbung);
return 20; return 20;
} else { } else {
console.log("Werbung: Skipped - Out Of Date - (" + nextWerbung + ")"); console.log("Werbung: Skipped - Out Of Date - (" + nextWerbung + ")");
setNextWerbung(); setNextWerbung();
} }
} else {
console.log("Werbung: Skipped - Not Started - (" + nextWerbung + ")");
setNextWerbung();
} }
firstDone = false;
} }
return 0; return 0;
} }
test 100644 → 100755
File mode changed from 100644 to 100755
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment