Skip to content
Snippets Groups Projects
Commit bc1adf36 authored by root's avatar root
Browse files

-sqlFeature@Mensaplan|Overkill -FSRStuff|unappreciated

parent 2b9a854d
Branches
No related tags found
No related merge requests found
......@@ -8,14 +8,6 @@ $PARSE_DAYLIST = array (
"donnerstag",
"freitag"
);
$DO_SQL = true;
$DO_JSON = true;
// SQL
$SQL_SERVER = "";
$SQL_USER = "";
$SQL_PW = "";
$SQL_DB = "";
// JSON
$JSON_NAME = "../../tmp/mensaPlan.json";
......
<?php
$mysqli = new mysqli ( "ovanier.de", "info_reader", "7ELZqMyUwU8MaJba", "infoscreen" );
if ($mysqli->connect_errno) {
printf ( "Connect failed: %s\n", $mysqli->connect_error );
exit ();
}
if ($result = $mysqli->query ( "SELECT * FROM City" )) {
$result->close ();
}
$mysqli->close ();
?>
\ No newline at end of file
......@@ -20,26 +20,6 @@ function toJson($tage, $name, $inc_nr, $inc_original, $inc_short, $inc_art, $inc
$json .= "}";
file_put_contents ( $name, $json );
}
function toSql($tage, $server, $user, $pw, $db) {
$mysqli = new mysqli ( $server, $user, $pw, $db );
if ($mysqli->connect_errno) {
printf ( "Connect failed: %s\n", $mysqli->connect_error );
exit ();
}
$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 ( $tag->getGerichte () as $gericht ) {
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 () );
$gericht->getNr ();
$stmt->execute ();
}
}
$stmt->close ();
$mysqli->close ();
}
function parsDay($html, $day) {
$tag = new TAG ( $day, substr ( $html->find ( 'a[href="#' . $day . '"]', 0 )->innertext, - 10, 10 ) );
......
......@@ -14,14 +14,7 @@ if ($html != null) {
}
// CREATE JSON
if ($DO_JSON) {
toJson ( $tage, $JSON_NAME, $JSON_INC_NR, $JSON_INC_ORIGINAL, $JSON_INC_SHORT, $JSON_INC_ART, $JSON_INC_KIND, $JSON_INC_STOFFE, $JSON_INC_COUNTER, $JSON_INC_DATE );
}
// SAVE
if ($DO_SQL) {
toSql ( $tage, $SQL_SERVER, $SQL_USER, $SQL_PW, $SQL_DB );
}
toJson ( $tage, $JSON_NAME, $JSON_INC_NR, $JSON_INC_ORIGINAL, $JSON_INC_SHORT, $JSON_INC_ART, $JSON_INC_KIND, $JSON_INC_STOFFE, $JSON_INC_COUNTER, $JSON_INC_DATE );
} else {
echo "Webseite nicht erreichbar.";
}
......
CREATE TABLE IF NOT EXISTS `gerichte` (
`id` int(255) NOT NULL,
`nr` int(11) NOT NULL,
`originalText` text NOT NULL,
`shortText` text NOT NULL,
`rind` tinyint(1) NOT NULL DEFAULT '0',
`schwein` tinyint(1) NOT NULL DEFAULT '0',
`gefluegel` tinyint(1) NOT NULL DEFAULT '0',
`fisch` tinyint(1) NOT NULL DEFAULT '0',
`vegetarisch` tinyint(1) NOT NULL DEFAULT '0',
`vegan` tinyint(1) NOT NULL DEFAULT '0',
`kinderteller` tinyint(1) NOT NULL DEFAULT '0',
`counter` int(11) DEFAULT '0',
`date` varchar(10) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=162 DEFAULT CHARSET=latin1;
ALTER TABLE `gerichte`
ADD PRIMARY KEY (`nr`,`date`), ADD UNIQUE KEY (`nr`,`date`), ADD KEY `id` (`id`);
\ No newline at end of file
<?php
?>
\ No newline at end of file
this.loaded = function(panel, config) {
addElement("A");
addElement("B");
addElement("C");
addElement("D");
addElement("E");
//removeElement(3);
moveElement(3,1);
}
var lastUpdates;
function pull(){
}
function addElement($text){
var $li = $("<li class='ui-state-default'/>").text($text);
$("#topListSortable").append($li);
$("#topListSortable").sortable();
$("#topListSortable").disableSelection();
$("#topListSortable").sortable('refresh');
}
function moveElement($idO,$idN){
if($idO != $idN) {
if($idO < $idN){
$("#topListSortable li:eq("+$idO+")").insertAfter($("#topListSortable li:eq("+$idN+")"));
} else {
$("#topListSortable li:eq("+$idO+")").insertBefore($("#topListSortable li:eq("+$idN+")"));
}
$("#topListSortable").sortable('refresh');
}
}
function removeElement($id){
$("#topListSortable li:eq(" + $id+")").remove();
$("#topListSortable").sortable('refresh');
}
\ No newline at end of file
#topListe{
position:relative;
width:100%;
height:100%;
}
#currentTop {
background-color: #ffffff;
float:left;
position:relative;
top:0;
width: 100%;
height: 25%;
}
#topName{
float: left;
background-color: #ffffff;
width: 100%;
height: 25%;
font-size: 300%;
text-align: center;
}
#topDescription{
float: left;
background-color: #ffffff;
width: 100%;
height: 25%;
font-size: 200%;
}
#topListAnzeige{
float: left;
width: 100%;
height: 25%;
}
#topListSortable {
font-weight: bold;
color: #ffffff;
list-style-type: decimal;
font-size: 200%;
float:left;
}
<div id="topListe">
<div id="currentTop">
<div id="topName">
TEST1
</div>
<div id="topDescription">
TEST2
</div>
</div>
<div id="topListAnzeige">
<ol id="topListSortable">
</ol>
</div>
</div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment