Schudle:\n"; function SaveSchedule() { global $RoomID, $RoomName; global $con; if( isset($_GET["PSIDXML"]) && isset($_GET["DateXML"]) && isset($_GET["RIDXML"]) && isset($_GET["LenXML"]) && isset($_GET["ManXML"]) && isset($_GET["URLXML"]) ) { //erzeuge von `DateE` $TimeStart = substr( $_GET["DateXML"], 11, 2) + (substr($_GET["DateXML"], 14, 2)/60); $TimeEnd = ($_GET["LenXML"] + $TimeStart) * 60; $TimeM = $TimeEnd % 60; $TimeH = ($TimeEnd - $TimeM)/60; if( $TimeH>=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"; //Namen ermitteln $_GET["RIDXML"] = $RoomName[$_GET["RIDXML"]]; //Update OR insert ? $SQL1 = "Select `SID` FROM `Shifts` WHERE `PSID`='". $_GET["PSIDXML"]. "';"; $Erg1 = mysql_query($SQL1, $con); if( mysql_num_rows($Erg1)==0) $SQL= "INSERT INTO `Shifts` (`PSID`, `DateS`, `DateE`, `Len`, `RID`, `Man`, `URL`) ". "VALUES ('". $_GET["PSIDXML"]. "', ". "'". $_GET["DateXML"]. "', ". "'". $DateEnd. "', ". "'". $_GET["LenXML"]. "', ". "'". $_GET["RIDXML"]. "', ". "'". mysql_escape_string($_GET["ManXML"]). "', ". "'". $_GET["URLXML"]. "'". ");"; else $SQL= "UPDATE `Shifts` SET ". "`DateS` = '". $_GET["DateXML"]. "', ". "`DateE` = '". $DateEnd. "', ". "`Len` = '". $_GET["LenXML"]. "', ". "`RID` = '". $_GET["RIDXML"]. "', ". "`Man` = '". mysql_escape_string($_GET["ManXML"]). "', ". "`URL`= '". $_GET["URLXML"]. "' ". "WHERE `PSID` = '". $_GET["PSIDXML"]. "' LIMIT 1;"; $Erg = mysql_query($SQL, $con); if( $Erg ) { echo "Aenderung, am Schedule '". $_GET["PSIDXML"]. "', war erfogreich
\n"; if( mysql_num_rows($Erg1)==0) { echo "-->Create Shifts:
\n"; //SID auslesen $SQL1 = "Select `SID` FROM `Shifts` WHERE `PSID`='". $_GET["PSIDXML"]. "';"; $Erg1 = mysql_query($SQL1, $con); // erstellt ein Array der Reume $sql2 = "SELECT * FROM `Room` ". "WHERE `RID`='".$_GET["RIDXML"]. "' ". "ORDER BY `Number`, `Name`;"; $Erg2 = mysql_query( $sql2, $con); for( $j=0; $j 0 ) { echo "---->Create engeltype: ". substr( mysql_field_name($Erg2, $j), 12). " ". mysql_result($Erg2, 0, $j). "x
\n"; for( $i=0; $i < mysql_result($Erg2, 0, $j); $i++ ) { $SQL3 = "INSERT INTO `ShiftEntry` (`SID`, `TID`) VALUES (". "'". mysql_result($Erg1, 0, 0). "', ". "'". substr( mysql_field_name($Erg2, $j), 12). "');"; $Erg3 = mysql_query($SQL3, $con); if ($Erg3 == 1) echo "------>pass
\n"; else echo "------>fail ". mysql_error($con). "($SQL3)
\n"; } } echo "
\n"; } } else echo "Aenderung, am Schedule '". $_GET["PSIDXML"]. "', 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"; if( $EnableSchudle) foreach($XMLmain->sub as $EventKey => $Event) { if( $Event->name == "VEVENT") { echo "\n"; echo "\t\n"; $PSIDXML = getXMLsubData( $Event, "UID"); $DateXML = substr( getXMLsubData( $Event, "DTSTART"), 0, 4). "-". substr( getXMLsubData( $Event, "DTSTART"), 4, 2). "-". substr( getXMLsubData( $Event, "DTSTART"), 6, 2). " ". substr( getXMLsubData( $Event, "DTSTART"), 9, 2). ":". substr( getXMLsubData( $Event, "DTSTART"), 11,2). ":00"; $LenXML = substr( getXMLsubData( $Event, "DURATION"), 0, strlen(getXMLsubData( $Event, "DURATION"))-1); $RIDXML = getXMLsubData( $Event, "LOCATION"); $ManXML = getXMLsubData( $Event, "SUMMARY"); $URLXML = getXMLsubData( $Event, "URL"); if( isset($_GET["UpdateALL"])) { $_GET["PSIDXML"] = $PSIDXML; $_GET["DateXML"] = $DateXML; $_GET["LenXML"] = $LenXML; $_GET["RIDXML"] = $RIDXML; $_GET["ManXML"] = $ManXML; $_GET["URLXML"] = $URLXML; SaveSchedule(); } $SQL = "SELECT * FROM `Shifts` WHERE `PSID`='$PSIDXML'"; $Erg = mysql_query($SQL, $con); if(mysql_num_rows($Erg)>0) { $SIDDB = mysql_result($Erg, 0, "SID"); $PSIDDB = mysql_result($Erg, 0, "PSID"); $TimeDB = mysql_result($Erg, 0, "DateS"); $LenDB = mysql_result($Erg, 0, "Len"); if( isset($RoomID[mysql_result($Erg, 0, "RID")])) $RIDDB = $RoomID[mysql_result($Erg, 0, "RID")]; else $RIDDB = "RID". mysql_result($Erg, 0, "RID"); $ManDB = mysql_result($Erg, 0, "Man"); $URLDB = mysql_result($Erg, 0, "URL"); } else $SIDDB = $PSIDDB = $TimeDB = $LenDB = $RIDDB = $ManDB = $URLDB = ""; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; echo "\t\n"; if( !( $PSIDXML==$PSIDDB && $DateXML==$TimeDB && $RIDXML==$RIDDB && $LenXML==$LenDB && $ManXML==$ManDB && $URLXML==$URLDB) ) { echo "\t\n"; $DS_KO++; } else { echo "\t\n"; $DS_OK++; } echo "\t\n"; echo "\n"; $Where.= " OR `PSID`='$PSIDXML'"; } } echo "\n"; //Anzeige von nicht im XML File vorkommende entraege if( $Where =="") $SQL2 = "SELECT * FROM `Shifts` WHERE NOT `PSID`='';"; else $SQL2 = "SELECT * FROM `Shifts` WHERE NOT (".substr( $Where, 4). ") AND NOT PSID = '';"; $Erg2 = mysql_query($SQL2, $con); echo mysql_error($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"); if( isset($RoomID[ mysql_result($Erg2, $i, "RID")])) $RID = $RoomID[ mysql_result($Erg2, $i, "RID")]; else $RID = "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 "
PSIDDateRoomLenNamestate
XML - DBXML - DBXML - DBXML - DBXML - DB
\n\t\t". "\n\t\t". "\n\t\t". "\n\t\t". "edit
status: $DS_KO/$DS_OK nicht Aktuel.
\n\t\t". "\n\t\t". "\n\t\t". "\n\t\t". "edit
"; ?>