\n

XML File:

\n"; if( isset($_POST["PentabarfUser"]) && isset($_POST["PentabarfPasswd"]) && isset($_POST["PentabarfURL"])) { echo "Update XML-File from Pentabarf.."; /* $Command = "wget --http-user=". $_POST["PentabarfUser"]. " --http-passwd=".$_POST["PentabarfPasswd"]. " ". $_POST["PentabarfURL"]. " --output-file=/tmp/engelXMLwgetLog --output-document=/tmp/engelXML"; */ $Command = "lynx -auth=". $_POST["PentabarfUser"]. ":".$_POST["PentabarfPasswd"]. " -dump ". $_POST["PentabarfURL"]. " > /tmp/engelXML"; echo system( $Command, $Status); if( $Status==0) echo "OK.
"; else echo "fail ($Status)($Command).
"; } else { echo "
\n"; echo "\n"; echo "\t". "\n"; echo "\t". "\n"; echo "\t". "\n"; echo "\t\n"; echo "
XML-File:
Username:
Password:
\n"; echo "
\n"; } //readXMLfile("xml.php.xml"); readXMLfile("/tmp/engelXML"); /* echo "

"; echo $XMLmain->name; echo "
"; //print_r(array_values ($XMLmain->sub)); echo "
"; $Feld=7; echo "$Feld#". $XMLmain->sub[$Feld]->name. "
"; echo "$Feld#". $XMLmain->sub[$Feld]->sub; //print_r(array_values ($XMLmain->sub[$Feld]->sub)); while(list($key, $value) = each($XMLmain->sub[$Feld]->sub)) echo "?ID".$value->sub[1]->data. "=". $value->sub[2]->data. "\n"; echo "
"; */ /*############################################################################################## V e r s i o n ##############################################################################################*/ echo "
\n"; $XMLrelease = getXMLsubPease( $XMLmain, "RELEASE"); echo "release: ". $XMLrelease->data. "
\n"; $XMLreleaseDate = getXMLsubPease( $XMLmain, "RELEASE-DATE"); echo "release date: ". $XMLreleaseDate->data. "
\n"; echo "
\n"; /*############################################################################################## R o o m ##############################################################################################*/ echo "\n\n
\n

Rooms:

\n"; function saveRoomData() { include ("./inc/db.php"); if( isset($_GET["RID"]) && isset($_GET["NumberXML"]) && isset($_GET["NameXML"])) { $SQL1 = "SELECT `RID` FROM `Room` ". "WHERE `RID` = '". $_GET["RID"]. "';"; $Erg1 = mysql_query($SQL1, $con); if( mysql_num_rows($Erg1)==1 ) $SQL= "UPDATE `Room` SET `Name` = '". mysql_escape_string($_GET["NameXML"]). "', `FromPentabarf`='Y', `Number`='". $_GET["NumberXML"]. "' ". "WHERE `RID` = '". $_GET["RID"]. "' LIMIT 1;"; else $SQL= "INSERT INTO `Room` ( `RID` , `Name`, `FromPentabarf`, `Number` ) ". "VALUES ('". $_GET["RID"]. "', '". mysql_escape_string($_GET["NameXML"]). "', 'Y', ". $_GET["NumberXML"]. ");"; $Erg = mysql_query($SQL, $con); if( $Erg ) echo "Aenderung, an Raum ". $_GET["NameXML"]. ", war erfogreich
"; else echo "Aenderung, an Raum ". $_GET["NameXML"]. ", war nicht erfogreich.(". mysql_error($con). ")
[$SQL]
"; } else echo "Fehler in den Parametern!
"; } /*function saveRoomData*/ function getDBRoomName( $RID) { include ("./inc/db.php"); $SQL = "SELECT Name FROM `Room` WHERE RID=$RID"; $Erg = mysql_query($SQL, $con); if(mysql_num_rows($Erg)>0) return mysql_result($Erg, 0, 0); else return ""; } /*function getDBRoomName*/ function getDBRoomNumber( $RID) { include ("./inc/db.php"); $SQL = "SELECT Number FROM `Room` WHERE RID=$RID"; $Erg = mysql_query($SQL, $con); if(mysql_num_rows($Erg)>0) return mysql_result($Erg, 0, 0); else return ""; } /*function getDBRoomNumber*/ if( isset($_GET["RoomUpdate"])) saveRoomData(); //INIT Status counter $DS_OK = 0; $DS_KO = 0; $Where = ""; //Ausgabe echo "\n"; echo "\n"; $XMLroom = getXMLsubPease( $XMLmain, "ROOMS"); while( (list($key, $value) = each($XMLroom->sub)) && $EnableRooms) { $XMLRID = getXMLsubPease( $value, "ID"); $RID = $XMLRID->data; $XMLNumber = getXMLsubPease( $value, "NUMBER"); $NumberXML = trim($XMLNumber->data); $XMLName = getXMLsubPease( $value, "NAME"); $NameXML = trim($XMLName->data); if( isset($_GET["UpdateALL"])) { $_GET["NameXML"] = $NameXML; $_GET["NumberXML"] = $NumberXML; $_GET["RID"] = $RID; saveRoomData(); } $NameDB = convertValues(getDBRoomName($RID)); $NumberDB = convertValues(getDBRoomNumber($RID)); echo "\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; if( !( $NameXML==$NameDB && $NumberXML==$NumberDB) ) { echo "\t\n"; $DS_KO++; } else { echo "\t\n"; $DS_OK++; } echo "\t\n"; echo "\n"; $Where.= " OR RID=$RID"; } echo "\n"; //Anzeige von nicht im XML File vorkommende entraege $SQL2 = "SELECT * FROM `Room` WHERE NOT (".substr( $Where, 4). ") AND FromPentabarf = 'Y';"; $Erg2 = mysql_query($SQL2, $con); if( mysql_num_rows($Erg2)>0 && $EnableRoomsDB ) for( $i=0; $i\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; } echo "
RIDNumberXMLNumberDBNameXMLNameDBstate
OK
status: $DS_KO/$DS_OK nicht Aktuel.
edit
\n"; /*############################################################################################## S c h e d u l e ##############################################################################################*/ echo "\n\n

Schudle:

\n"; // erstellt ein Array der Reume $sql = "SELECT * FROM `Room` ". "ORDER BY `Number`, `Name`;"; $Erg = mysql_query($sql, $con); for( $i=0; $i=24 ) { $TimeH -= 24; $DateEnd = substr($_GET["DateXML"], 0, 8). (substr($_GET["DateXML"], 8, 2)+1). " "; } else $DateEnd = substr($_GET["DateXML"], 0, 11); $DateEnd .= "$TimeH:$TimeM:00"; //Update OR insert ? $SQL1 = "Select `SID` FROM `Shifts` WHERE `SID`='". $_GET["SIDXML"]. "';"; $Erg1 = mysql_query($SQL1, $con); if( mysql_num_rows($Erg1)==0) $SQL= "INSERT INTO `Shifts` (`SID`, `DateS`, `DateE`, `Len`, `RID`, `Man`, `FromPentabarf`) ". "VALUES ('". $_GET["SIDXML"]. "', '". $_GET["DateXML"]. "', '". $DateEnd. "', '". $_GET["LenXML"]. "', '". $_GET["RIDXML"]. "', '". mysql_escape_string($_GET["ManXML"]). "', 'Y');"; else $SQL= "UPDATE `Shifts` SET ". "`DateS` = '". $_GET["DateXML"]. "', ". "`DateE` = '". $DateEnd. "', ". "`Len` = '". $_GET["LenXML"]. "', ". "`RID` = '". $_GET["RIDXML"]. "', ". "`Man` = '". mysql_escape_string($_GET["ManXML"]). "', ". "`FromPentabarf`= 'Y' ". "WHERE `SID` = '". $_GET["SIDXML"]. "' LIMIT 1;"; $Erg = mysql_query($SQL, $con); if( $Erg ) { echo "Aenderung, am Schedule '". $_GET["SIDXML"]. "', war erfogreich
\n"; if( mysql_num_rows($Erg1)==0) { echo "-->Create Shifts:
\n"; foreach ($RoomID[ $_GET["RIDXML"]] as $Key => $Value) if( substr( $Key, 0, 12)=="DEFAULT_EID_" && $Value > 0 ) { echo "---->Create engeltype: ". substr( $Key, 12). " ". $Value. "x
\n"; $i=0; while( $i++ < $Value ) { $SQL3 = "INSERT INTO `ShiftEntry` (`SID`, `TID`) VALUES (". "'". $_GET["SIDXML"]. "', '". substr( $Key, 12). "');"; $Erg = mysql_query($SQL3, $con); if ($Erg == 1) echo "------>pass
\n"; else echo "------>fail ". mysql_error($con). "($SQL3)
\n"; } } echo "
\n"; } } else echo "Aenderung, am Schedule '". $_GET["SIDXML"]. "', war nicht erfogreich.(". mysql_error($con). ")
[$SQL]
\n"; } else echo "Fehler in den Parametern!
"; } /*SaveSchedule*/ if( isset($_GET["ScheduleUpdate"])) SaveSchedule(); //INIT Status counter $DS_OK = 0; $DS_KO = 0; $Where = ""; //ausgabe echo "\n"; echo "". "\n"; echo "". "\n"; $XMLevents = getXMLsubPease( $XMLmain, "EVENTS"); while( (list($EventKey, $Event) = each($XMLevents->sub)) && $EnableSchudle) { echo "\n"; echo "\t\n"; $DateXML = substr($Event->attributes["START"], 0, 10). " ". substr($Event->attributes["START"], 11). ":00"; $LenXML = $Event->attributes["DURATION"]; $LenXML = substr( $LenXML, 0, 2) + (substr($LenXML, 3, 2)/60); $XMLeventID = getXMLsubPease( $Event, "ID"); $SIDXML = $XMLeventID->data; $RIDXML = $Event->attributes["ROOM-ID"]; $XMLTitle = getXMLsubPease( $Event, "TITLE"); $ManXML = $XMLTitle->data; if( isset($_GET["UpdateALL"])) { $_GET["SIDXML"] = $SIDXML; $_GET["DateXML"] = "$DateXML $TimeXML"; $_GET["LenXML"] = $LenXML; $_GET["RIDXML"] = $RIDXML; $_GET["ManXML"] = $ManXML; SaveSchedule(); } $SQL = "SELECT * FROM `Shifts` WHERE SID=$SIDXML"; $Erg = mysql_query($SQL, $con); if(mysql_num_rows($Erg)>0) { $SIDDB = mysql_result($Erg, 0, "SID"); $TimeDB = mysql_result($Erg, 0, "DateS"); $LenDB = mysql_result($Erg, 0, "Len"); $RIDDB = mysql_result($Erg, 0, "RID"); $ManDB = mysql_result($Erg, 0, "Man"); } else $SIDDB = $TimeDB = $LenDB = $RIDDB = $ManDB= ""; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; if( !( $SIDXML==$SIDDB && $DateXML==$TimeDB && $RIDXML==$RIDDB && $LenXML==$LenDB && $ManXML==$ManDB) ) { echo "\t\n"; $DS_KO++; } else { echo "\t\n"; $DS_OK++; } echo "\t\n"; echo "\n"; $Where.= " OR SID=$SIDXML"; } echo "\n"; //Anzeige von nicht im XML File vorkommende entraege $SQL2 = "SELECT * FROM `Shifts` WHERE NOT (".substr( $Where, 4). ") AND FromPentabarf = 'Y';"; $Erg2 = mysql_query($SQL2, $con); if(mysql_num_rows($Erg2)>0 && $EnableSchudleDB ) for( $i=0; $i\n"; $SID = mysql_result($Erg2, $i, "SID"); $Time = mysql_result($Erg2, $i, "DateS"); $Len = mysql_result($Erg2, $i, "Len"); $RID = mysql_result($Erg2, $i, "RID"); $Man = mysql_result($Erg2, $i, "Man"); echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; } echo "
SIDDateRoomLenNamestate
XML - DBXML - DBXML - DBXML - DBXML - DB
\n\t\t". "\n\t\t". "\n\t\t". "\n\t\t". "OK
status: $DS_KO/$DS_OK nicht Aktuel.
\n\t\t". "\n\t\t". "\n\t\t". "\n\t\t". "edit
"; /*############################################################################################## U P D A T E A L L ##############################################################################################*/ echo "\n\n
\n

Update ALL:

\n"; echo "
\n"; echo "\t\n"; echo "
\n"; include ("./inc/footer.php"); ?>