From fd8b37610cbd0f2096aa0fb145012a5e8a508743 Mon Sep 17 00:00:00 2001 From: cookie Date: Sat, 26 Aug 2006 11:14:22 +0000 Subject: [PATCH] erstellt fuer asterisk git-svn-id: svn://svn.cccv.de/engel-system@133 29ba0400-6e00-0410-a75a-ca02368028f8 --- www-ssl/admin/dect_cron_asterisk.php | 120 +++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100755 www-ssl/admin/dect_cron_asterisk.php diff --git a/www-ssl/admin/dect_cron_asterisk.php b/www-ssl/admin/dect_cron_asterisk.php new file mode 100755 index 00000000..06ff2d50 --- /dev/null +++ b/www-ssl/admin/dect_cron_asterisk.php @@ -0,0 +1,120 @@ +\n"; +} + +function UID2DECT($UID) +{ + global $con; + $SQL = "SELECT DECT FROM `User` WHERE UID='$UID'"; + $Erg = mysql_query($SQL, $con); + return mysql_result($Erg, 0); +} +function RID2Room($RID) +{ + global $con; + $SQL = "SELECT Name FROM `Room` WHERE RID='$RID'"; + $Erg = mysql_query($SQL, $con); + return mysql_result($Erg, 0); +} + +function TID2Engeltype($TID) +{ + global $con; + $SQL = "SELECT Name FROM `EngelType` WHERE TID='$TID'"; + $Erg = mysql_query($SQL, $con); + return mysql_result($Erg, 0); +} + + + +$SQL = "SELECT Shifts.DateS, Shifts.RID, ShiftEntry.UID, ShiftEntry.TID ". + "FROM `Shifts` INNER JOIN `ShiftEntry` ON `Shifts`.`SID` = `ShiftEntry`.`SID` "; +if( $DebugDECT) + $SQL .= "WHERE (Shifts.DateS>'2004-12-27 10:45:00' AND ". + "Shifts.DateS<='2004-12-27 11:00:00');"; +else + $SQL .= "WHERE ((`Shifts`.`DateS`>'". gmdate("Y-m-d H:i:s", time()+3600+120). "') AND ". + "(`Shifts`.`DateS`<='". gmdate("Y-m-d H:i:s", time()+3600+120+$StartTimeBeforEvent). "') );"; + +$Erg = mysql_query($SQL, $con); + +echo mysql_error($con); + +for( $i=0; $i0) + { + $SQL2 = "SELECT DECT FROM `User` WHERE ( `UID`='". mysql_result($Erg, $i, "UID"). "');"; + $Erg2 = mysql_query($SQL2, $con); + + $Number = mysql_result($Erg2, 0, "DECT"); + if( $Number!="") + { + $TimeH = substr( mysql_result($Erg, $i, "DateS"), 11, 2); + $TimeM = substr( mysql_result($Erg, $i, "DateS"), 14, 2); + $TimeM = substr( mysql_result($Erg, $i, "DateS"), 14, 2) - 5; + if( $TimeM < 0 ) + { + $TimeM += 60; + $TimeH -= 1; + } + if( $TimeH < 0 ) + $TimeH += 24; + + if( strlen( $TimeH) == 1) + $TimeH = "0".$TimeH; + + $Room = RID2Room( mysql_result($Erg, $i, "RID")); + $EngelType = TID2Engeltype( mysql_result($Erg, $i, "TID")); + DialNumber( $Number, $TimeH, $TimeM, $Room, $EngelType); + } + } +} + +return 0; + + +?> +