function render_title($incDate) {
global $wk;
$partie_incDate = explode("/", $incDate); //pour partager jj mm yyyy
$incDateU=mktime(0,0,0, $partie_incDate[0],$partie_incDate[1],$partie_incDate[2]);
?>
}
/*******************************************************************************/
/*******************************************************************************/
function request_detail_events(){
//''' request form inputs from this form
$event_id = $_REQUEST["event_id"] ;
$dt_end = $_REQUEST["dt_end"];
$CodeAdmin = $_REQUEST["CodeAdmin"];
$dt_start = $_REQUEST["dt_start"];
$id = $_REQUEST["id"];
$b_personal = $_REQUEST["b_personal"];
$description = $_REQUEST["description"];
$tm_start = $_REQUEST["tm_start"];
$tm_end = $_REQUEST["tm_end"];
// '********
$location = $_REQUEST["location"];
// '********
$event_name = $_REQUEST["event_name"];
$Cat = $_REQUEST["Cat"];
$NomU = $_REQUEST["NomU"];
}
/**********************************************************************************/
/**********************************************************************************/
function validate_detail_events() {
//''' request and validate data entered from this form
$event_id = trim($_REQUEST["event_id"]);
$dt_end = trim($_REQUEST["dt_end"]);
$CodeAdmin = trim($_REQUEST["CodeAdmin"]);
$dt_start = trim($_REQUEST["dt_start"]);
$id = trim($_REQUEST["id"]);
$b_personal = trim($_REQUEST["b_personal"]);
$description = trim($_REQUEST["description"]);
$tm_start = trim($_REQUEST["tm_start"]);
$tm_end = trim($_REQUEST["tm_end"]);
//'********
$location = trim($_REQUEST["location"]);
//'********
$event_name = trim($_REQUEST["event_name"]);
$Cat = trim($_REQUEST["Cat"]);
$NomU = trim($_REQUEST["NomU"]);
}
/*************************************************************************************/
/*************************************************************************************/
function db_select_detail_Events(){
global $incDate;
$incDate1 = str_replace("'", "''", $incDate);
$partie_incDate = explode("/", $incDate1);
/****************Ajouté pour eviter redondance**********/
$incday= $partie_incDate[1];
$incmonth= $partie_incDate[0]; // mon ajout
$incyear= $partie_incDate[2];
if ($incday<10) $incday="0".$incday;
$incDate1= $incyear."-".$incmonth."-".$incday." 00:00:00";
$codeadmin=to_sql($_SESSION["CodeAdmin"],"number");
$detail_Events_sql = "SELECT Events.dt_end, Events.CodeAdmin,Events.dt_start, EventsOccur.id,TIME(EventsOccur.tm_start) tm_start1, TIME(EventsOccur.tm_end) tm_end1, EventsOccur.location, Events.event_id, Admin.NomU, EventsOccur.event_name, EventsOccur.description, Events.b_personal
FROM Events,EventsOccur,Admin WHERE ((Events.CodeAdmin = Admin.CodeAdmin) AND (Events.event_id = EventsOccur.event_id) AND ((b_personal = 0)OR (b_personal = 2) OR (b_personal is null)) AND (Events.CodeAdmin = '".$codeadmin."') AND (EventsOccur.dt_occur = '".$incDate1."')) ORDER BY UNIX_TIMESTAMP(EventsOccur.tm_start)" ;
return($detail_Events_sql);
}
/*************************************************************************************/
/**************************************************************************************/
function db_delete_detail_Events(){ //procedure
$sql = "DELETE FROM EventsOccur WHERE id =".$id."";
// 'response.write sql
// on error resume next A voir plus tard
mysql_query($sql);
if (mysql_errno()) {
$message = 'Requête invalide : ' . mysql_error() . "\n";
die($message);
}
}
/**************************************************************************************/
/**************************************************************************************/
Function GetDateName($monthNumber){ // Voir ou mettre cette fonction pour l'appeler plus tard
Switch($monthNumber){
Case "1":
$GetDateName = "Janvier";
break;
Case "2":
$GetDateName = "Février";
break;
Case "3":
$GetDateName = "Mars";
break;
Case "4":
$GetDateName = "Avril";
break;
Case "5":
$GetDateName = "Mai";
break;
Case "6":
$GetDateName = "Juin";
break;
Case "7";
$GetDateName = "Juillet";
break;
Case "8":
$GetDateName = "Août";
break;
Case "9":
$GetDateName = "Septembre";
break;
Case "10":
$GetDateName = "Octobre";
break;
Case "11":
$GetDateName = "Novembre";
break;
Case "12":
$GetDateName = "Décembre";
break;
default :
$GetDateName="";
}
return($GetDateName);
}
/*******************************************************************************/
/*******************************************************************************/
function DaysInAnyMonth($iMonth, $iYear) {
$dTemp = DateAdd("d", -1, mktime(0,0,0,$iMonth + 1,1,$iYear));
// voir equivalent de cette fonction en php
$DaysInAnyMonth= Date("j",$dTemp); //idem
return($DaysInAnyMonth);
}
function WeekdayNameOfFirstOfMonth($iMonth, $iYear) {
$dTemp=date("w",mktime(01, $iMonth,$iYear)); //à verifier
//$dTemp = WeekdayName(Weekday($iMonth."/01/".$iYear,VBSunday)); // voir aussi ces fonctions et le VBSunday
$FirstWeekdayOfMonth = $dTemp;
return($dTemp);
//'response.write "
1st day of " & iMonth & "/" & iYear & " is a: " & dTemp & "
"
}
/***********************************************************************************/
/***********************************************************************************/
function DateFirstWeekdayFallsOn($iMonth, $iYear, $iWeekdayNumber) {
$dTemp = $iWeekdayNumber - date("w",mktime($iMonth,01,$iYear)); //verifier ces fonctions numero du jour dans la semaine c'est w+
if ($dTemp < 0) $dTemp = 0;
$dTemp = DateAdd("d",$dTemp,$iMonth."/01/".$iYear); // cette fonction est dans i_utils.php
$DateFirstWeekdayFallsOn = $dTemp;
//'response.write "
The 1st " & WeekdayName(iWeekdayNumber) & " of " & iMonth & "/" & iYear & " is on: " & dTemp & "
"
}
/************************************************************************************/
/*****************************upd_events functions*****************************************/
/* Fonctions de upd_events.php */
/******************************************************************************************/
function db_select_edit_Events() {
global $dTmp,$dt_start, $recurring_end, $recurring, $CodeAdmin, $description, $dt_end, $event_id,$tm_start, $tm_end, $event_name, $location, $Organisme, $NomC, $PrenomC, $TelC, $EmailC, $Cout, $Tax, $b_register, $b_personal, $time_start, $recurring_update, $id, $rs,$dt_occur;
$sql = "SELECT ";
$sql.="Events.event_id,";
$sql.="tm_end, ";
$sql.="id, ";
$sql.="recurring_end, ";
$sql.="CodeAdmin, ";
$sql.="event_name, ";
$sql.="location, ";
$sql.="Organisme, ";
$sql.="NomC, ";
$sql.="PrenomC, ";
$sql.="TelC, ";
$sql.="EmailC, ";
$sql.="Cout, ";
$sql.="Tax, ";
$sql.="description,";
$sql.="dt_start, ";
$sql.="tm_start, ";
$sql.="b_personal, ";
$sql.="b_register, ";
$sql.="recurring, ";
$sql.="dt_end, ";
$sql.="dt_occur FROM (Events RIGHT JOIN EventsOccur ON Events.event_id = EventsOccur.event_id) WHERE ";
$sql.="EventsOccur.id = ".to_sql($id,"number")."";
$rs = mysql_query($sql);
if (!$rs) {
echo "Could not successfully run query ($sql) from DB: " .mysql_error();
$b_error = true;
$error_list["select_data_edit_Events"]="The data selection failed. ".mysql_error();
exit;
}elseif (mysql_num_fields($rs)==0) {
$b_results = false;
$msg_list["select_data_edit_Events"]= "Supprimer.";
} elseif ($row = mysql_fetch_assoc($rs)) {
/* if err.number <> 0 then
b_error = true
error_list.add "select_data_edit_Events", "The data selection failed. " & err.description
elseif rs.EOF then
b_results = false
msg_list.add "select_data_edit_Events", "Supprimer."
else */
$tm_end = $row["tm_end"];
$id = $row["id"];
$recurring_end = $row["recurring_end"];
$event_id = $row["event_id"];
$CodeAdmin = $row["CodeAdmin"];
$event_name = $row["event_name"];
$location = $row["location"];
$Organisme = $row["Organisme"];
$NomC = $row["NomC"];
$PrenomC = $row["PrenomC"];
$TelC = $row["TelC"];
$EmailC = $row["EmailC"];
$Cout = $row["Cout"];
$Tax = $row["Tax"];
$b_register = $row["b_register"];
$description = $row["description"];
$dt_start = $row["dt_start"];
$tm_start = $row["tm_start"];
$b_personal = $row["b_personal"];
$recurring = $row["recurring"];
$dt_occur = $row["dt_occur"];
$dt_end= $row["dt_end"];
//$recurring_update = $row["recurring_update"]; //c'est moi qui l'ai enlevé car il n'existe pas comme index dans la requete (a voir)
}
mysql_free_result($rs);
// on error goto 0
}
/******************************************************************************/
function validate_time() {
global $dTmp,$dt_start, $recurring_end, $recurring, $CodeAdmin, $description, $dt_end, $event_id,$tm_start, $tm_end, $event_name, $location, $Organisme, $NomC, $PrenomC, $TelC, $EmailC, $Cout, $Tax, $b_register, $b_personal, $b_error;
// '*******validation des entree**************
if ($b_error==true)
If ((is_nan((float)$Cout)) AND (Cout <> "")){
$error_list["startendtime"]="Entrer un numero dans le Coût";
$b_error = true;
}
//'********valide heures**********************
if ((empty($tm_start)) || (empty($tm_end))) {
$error_list["startendtime"]= "Les heures de location et la date sont obligatoires";
$b_error = true;
}
if ((empty($_REQUEST["moisd"])) || (empty($_REQUEST["jourd"])) || (empty($_REQUEST["anneed"]))) {
$error_list["starttime"]="Entrer la date de location .";
$b_error = true;
}
//':: requests and validates event start and end time
if (strlen($tm_start) > 0) $tm_start = $tm_start.":".$_REQUEST["minute_start"];
if (strlen($tm_end) > 0) $tm_end = $tm_end.":".$_REQUEST["minute_end"];
if (strlen($tm_end) > 0) {
$debut = "07:00"; // 07 AM
if ((TimeValue($tm_start) < TimeValue($debut)) or (TimeValue($tm_end) < TimeValue($debut)) or (TimeValue($tm_start) > TimeValue($tm_end))) {
$error_list["startendtime"]= "l'heure de réservation doit être entre 7h et 23h.";
$b_error = true;
}
if ((isset($dt_end))AND (strtotime($dt_start)==strtotime($dt_end)) AND (TimeValue($tm_start) > TimeValue($tm_end))) {
$error_list["startendtime"]= "Heure de fin (".$tm_end.") n'est pas aprés l'heure de début (".$tm_start.")";
$b_error = true;
}
}
$tm_start="1899-12-30 ".$tm_start.":00"; //tm_start et tm_end doivent etre tjs au
$tm_end="1899-12-30 ".$tm_end.":00"; //format "1899-12-30 yyyy-mm-jj"
}
/**************************************************************************************/
function validate_reservation() {
global $dt_start, $dt_end, $recurring_end, $recurring,$location,$tm_start,$tm_end,$event_id,$dTmp, $b_error, $msg_list;
$blnReservation = false;
$dTmp=$dt_start; echo "ligne 354********** dTmp=".$dTmp;
$exit=false;
for ($j = 1; $j < 300; $j++) {
if (strtotime($dTmp) <= strtotime($recurring_end)) {
$blnReservation=verification($location,$tm_start,$tm_end,$dTmp); // avoir
if ($blnReservation) {
$msg_list["startendtime"]="Le local n'est pas disponible de ".substr(TimePart($tm_start),0, 5)." à ".substr(TimePart($tm_end),0,5).".";
$b_error = true;
}
}else {
$exit=true;
}
if($exit) break;
if ($recurring == 0) $dTmp = dateadd("d",1,$dTmp);
elseif ($recurring < 30) $dTmp = dateadd("d",$recurring,$dTmp);
elseif ($recurring == 30) $dTmp = dateadd("m",1,$dTmp);
else $dTmp = dateadd("yyyy",$recurring,$dTmp);
}
}
/***************************************************************************************/
function validate_Update() {
global $dTmp,$dt_start, $recurring_end, $recurring, $CodeAdmin, $description, $dt_end, $event_id,$tm_start, $tm_end, $event_name, $location, $Organisme, $NomC, $PrenomC, $TelC, $EmailC, $Cout, $Tax, $b_register, $b_personal, $b_error;
//'********************************
$blnReservation = false;
$exit=false;
$dTmp = datevalue($dt_start);
for ($j = 1; $j<300; $j++) {
if ((strtotime($dTmp) - strtotime($recurring_end))<=0) { //comparer deux dates
/*********************************Autre probleme ici*******************************/
$blnReservation=verificationUpdate($location,$tm_start,$tm_end,$dTmp,$event_id);
/**************************************************************************************/
if ($blnReservation == true) {
$error_list["startendtime"]="Le local n'est pas disponible. (".$tm_start."),(".$tm_end.")";
$b_error = true;
}
}else{
$exit=true;
}
if($exit) break;
if ($recurring == 0)
$dTmp = dateadd("d",1,$dTmp);
elseif ($recurring < 30) $dTmp = dateadd("d",$recurring,$dTmp);
elseif ($recurring == 30) $dTmp = dateadd("m",1,$dTmp);
else $dTmp = dateadd("Y",1,$dTmp);
}
}
/**************************************************************************************/
function add_eventoccurs() {
global $dTmp,$dt_start, $recurring_end, $recurring, $CodeAdmin, $description, $dt_end, $event_id,$tm_start, $tm_end, $event_name, $location, $Organisme, $NomC, $PrenomC, $TelC, $EmailC, $Cout, $Tax, $b_register, $b_personal;
// '*******************************
$exit=false;
$dTmp = $dt_start; //supposé etre datevalue($dt_start)
$dTmpU=tomktime($dTmp);
$recurring_endU=tomktime($recurring_end);
for ($i = 1; $i<300; $i++) {
if ($dTmpU <= $recurring_endU){
$b_register=0;
$alert=0;
$dTmp=date("Y-n-j",$dTmpU);
$dTmp=$dTmp." 00:00:00";
$sql="INSERT INTO eventsoccur ";
$sql.="VALUES (";
$sql.="NULL,"; //pour generer un ID autoincrement
$sql.="$event_id,";
$sql.="'".$dTmp."', ";
$sql.="'".$tm_start."', ";
$sql.="'".$tm_end."', ";
$sql.="'".$event_name."', ";
$sql.="'".$description."', ";
$sql.="".$location.", ";
$sql.="".$Organisme.", ";
$sql.="'".$NomC."', ";
$sql.="'".$PrenomC."', ";
$sql.="'".$TelC."', ";
$sql.="'".$EmailC."', ";
$sql.="'".$Cout."', ";
$sql.="$Tax, ";
$sql.="$b_register,";
$sql.="$alert)";
mysql_query($sql)
or DIE ("Could not perform Insert to table ".mysql_errno().": ".mysql_error());
}else
$exit=true;
if ($exit) break;
if ($recurring == 0) // A voir ici le dateadd
$dTmpU = dateadd("d",1,$dTmpU);
elseif ($recurring < 30)
$dTmpU = dateadd("d",$recurring,$dTmpU);
elseif ($recurring == 30)
$dTmpU = dateadd("m",1,$dTmpU);
else $dTmpU = dateadd("Y",1,$dTmpU);
}
}
/**************************************************************************************/
function request_edit_events() {
global $dTmp,$dt_start, $recurring_end, $recurring, $CodeAdmin, $description, $dt_end, $event_id,$tm_start, $tm_end, $event_name, $location, $Organisme, $NomC, $PrenomC, $TelC, $EmailC, $Cout, $Tax, $b_register, $b_personal, $b_error;
//''' request form inputs from this form
if (isset($_REQUEST["tm_end"])) $tm_end = $_REQUEST["tm_end"];
// else $tm_end= "";
if (isset($_REQUEST["id"])) $id = $_REQUEST["id"];
//else $id= "";
//'recurring_end = request("recurring_end")
if (($_POST["moisend"]<> "") && ($_POST["jourend"] <> "") && ($_POST["anneeend"]<> ""))
$recurring_end = $_REQUEST["moisend"]."/".$_REQUEST["jourend"]."/".$_REQUEST["anneeend"];
$event_id = $_REQUEST["event_id"];
$CodeAdmin = $_REQUEST["CodeAdmin"];
$event_name = $_REQUEST["event_name"];
$location = $_REQUEST["location"];
$Organisme = $_REQUEST["Organisme"];
$NomC = $_REQUEST["NomC"];
$PrenomC = $_REQUEST["PrenomC"];
$TelC = $_REQUEST["TelC"];
$EmailC = $_REQUEST["EmailC"];
$Cout = $_REQUEST["Cout"];
$Tax = $_REQUEST["Tax"];
$b_register = NULL;
$description = $_REQUEST["description"];
//'dt_start = $_REQUEST["dt_start")
if (($_POST["moisd"] <> "") && ($_POST["jourd"] <> "") && ($_POST["anneed"]<> ""))
$dt_start = $_REQUEST["anneed"]."-".$_REQUEST["moisd"]."-".$_REQUEST["jourd"];
$tm_start = $_REQUEST["tm_start"];
$b_personal = $_REQUEST["b_personal"];
$recurring = $_REQUEST["recurring"];
$dt_occur = $_REQUEST["dt_occur"];
// $recurring_update = $_REQUEST["recurring_update"];
}
/****************************************************************************************/
function validate_edit_events() {
global $dTmp,$dt_start, $recurring_end, $recurring, $CodeAdmin, $description, $dt_end,
$event_id,$tm_start, $tm_end, $event_name, $location, $Organisme, $NomC, $PrenomC, $TelC,
$EmailC, $Cout, $Tax, $b_register, $b_personal, $b_error;
//''' request and validate data entered from this form
$b_error=false;
$id= trim($_REQUEST["id"]);
if (($_POST["moisend"]<> "") && ($_POST["jourend"] <> "") && ($_POST["anneeend"]<> ""))
$recurring_end = trim($_REQUEST["anneeend"]."-".$_REQUEST["moisend"]."-".$_REQUEST["jourend"]);
$event_id= trim($_REQUEST["event_id"]);
if (isset($_REQUEST["CodeAdmin"]))
$CodeAdmin= trim($_REQUEST["CodeAdmin"]);
if ($CodeAdmin == "") {
$error_list["661037"]="Le code est obligatoire.";
$b_error = true;
}
$event_name= trim($_REQUEST["event_name"]);
if ($event_name == "") {
$error_list["661038"]="Le titre est obligatoire.";
$b_error = true;
}
if (isset($_REQUEST["location"]))
$location = trim($_REQUEST["location"]);
if (isset($_REQUEST["event_name"]))
$event_name = trim($_REQUEST["event_name"]);
if (isset($_REQUEST["Organisme"]))
$Organisme = trim($_REQUEST["Organisme"]);
else $Organisme="";
if (isset($_REQUEST["NomC"]))
$NomC = trim($_REQUEST["NomC"]);
else $NomC="";
if (isset($_REQUEST["PrenomC"]))
$PrenomC = trim($_REQUEST["PrenomC"]);
else $PrenomC="";
if (isset($_REQUEST["EmailC"]))
$EmailC = trim($_REQUEST["EmailC"]);
else $EmailC="";
if (isset($_REQUEST["TelC"]))
$TelC = trim($_REQUEST["TelC"]);
else $TelC="";
if (isset($_REQUEST["Tax"]))
$Tax = trim($_REQUEST["Tax"]);
else $Tax="";
if (isset($_REQUEST["Cout"]))
$Cout = trim($_REQUEST["Cout"]);
else $Cout="";
if (isset($_REQUEST["description"]))
$description = trim($_REQUEST["description"]);
else $description="";
if (isset($_REQUEST["b_register"])) /*********stop********/
$b_register = trim($_REQUEST["b_register"]);
else $b_register="";
if (($_POST["moisd"]<> "") && ($_POST["jourd"] <> "") && ($_POST["anneed"]<> ""))
$dt_start = trim($_REQUEST["anneed"]."-".$_REQUEST["moisd"]."-".$_REQUEST["jourd"]);
if ($dt_start == "") {
$error_list["661040"]="La date de début est obligatoire..";
$b_error = true;
}
$b_personal = trim($_REQUEST["b_personal"]);
$recurring = trim($_REQUEST["recurring"]);
$dt_occur = trim($_REQUEST["dt_occur"]);
if (isset($_REQUEST["recurring_update"]))
$recurring_update = trim($_REQUEST["recurring_update"]);
else $recurring_update="";
}
/********************************************************************************************/
function get_defaults_edit_events() {
//''' set default values for this form
if (isset($_REQUEST["incDate"]))
$dt_start = "".$_REQUEST["incDate"]."";
else $dt_start = "";
$b_personal = 0;
$recurring_update = "0";
}
/*******************************************************************************************/
/***********************************************************************************/
function db_insert_edit_Events() {
global $dt_start, $dt_end,$event_id, $recurring_end, $recurring,$CodeAdmin,$b_personal,$location, $msg_list;
if (!isset($dt_end)) {
$sql = "INSERT INTO Events (";
$sql.="CodeAdmin,";
$sql.="dt_start,";
$sql.="recurring,";
$sql.="recurring_end,";
$sql.="b_personal";
$sql.=") VALUES (".$CodeAdmin.",";
$sql.="'".$dt_start."',";
$sql.="'".$recurring."',";
$sql.="'".$recurring_end."',";
$sql.="'".$b_personal."')";
}
else {
$sql = "INSERT INTO Events (";
$sql.="CodeAdmin,";
$sql.="dt_start,";
$sql.="dt_end,";
$sql.="recurring,";
$sql.="recurring_end,";
$sql.="b_personal";
$sql.=") VALUES (".$CodeAdmin.",";
$sql.="'".$dt_start."',";
$sql.="'".$dt_end."',";
$sql.="'".$recurring."',";
$sql.="'".$recurring_end."',";
$sql.="'".$b_personal."')";
}
//'response.write sql
//on error resume next
mysql_query($sql)
or DIE ("Could not perform INSERT to table ".mysql_errno().": ".mysql_error());
if (mysql_errno()) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
else {
$rs = mysql_query("SELECT @@IDENTITY");
if ($row = mysql_fetch_row($rs)){
$event_id = $row[0];
}
mysql_free_result($rs);
$msg_list["db_insert_edit_Events"]="Réservation ajoutée.";
}
}
/*******************************************************************************/
function db_update_edit_Events() {
global $dTmp,$dt_start, $recurring_end, $recurring, $CodeAdmin, $description, $dt_end, $event_id,$tm_start, $tm_end, $event_name, $location, $Organisme, $NomC, $PrenomC, $TelC, $EmailC, $Cout, $Tax, $b_register, $b_personal, $b_error;
$b_personal=0;
$dt_start=datevalue($dt_start)." 00:00:00";
//request_edit_events();
$sql ="UPDATE Events SET ";
$sql.="CodeAdmin = ".$CodeAdmin.", ";
$sql.="dt_start ='".$dt_start."', ";
$sql.="dt_end = '".$dt_end."', ";
$sql.="recurring = '".$recurring."', ";
$sql.="recurring_end = '".$recurring_end."', ";
$sql.="b_personal = ".$b_personal." WHERE ";
$sql.="event_id = ".$event_id."";
mysql_query($sql) or DIE ("Could not perform UPDATE to table ".mysql_errno().": ".mysql_error());
}
/*******************************************************************************/
function db_delete_edit_Events() {
global $dTmp,$dt_start, $recurring_end, $recurring, $CodeAdmin, $description, $dt_end, $event_id,$tm_start, $tm_end, $event_name, $location, $Organisme, $NomC, $PrenomC, $TelC, $EmailC, $Cout, $Tax, $b_register, $b_personal, $b_error, $id, $msg_list;
$sql = "DELETE FROM EventsOccur";
$sql.=" WHERE ";
$sql.="id = ".$id."";
//'response.write sql
//on error resume next
mysql_query($sql)
or DIE ("Could not perform DELETE to table ".mysql_errno().": ".mysql_error());
if (mysql_errno()) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
else
$msg_list["db_delete_edit_Events"]="Le champ a été supprimé.";
}
/****************************fonctions verification.php**********************************/
function verification($salleid,$hhdebut,$hhfin,$dTmp) {
$blnReserve=false;
$blnLoop=false;
if ($hhdebut <> "") {
$H_debut = strtotime(TimePart($hhdebut));
}
if ($hhfin <> "")
$H_fin = strtotime(TimePart($hhfin));
echo "ligne 738 dTmp=".$dTmp;
$partie_dTmp = explode("-", $dTmp);
$dTmp=$dTmp." 00:00:00";
$jour= $partie_dTmp[2];
$mois= $partie_dTmp[1]; // mon ajout
$annee= $partie_dTmp[0];
$strSQL = "SELECT * FROM eventsoccur WHERE ((UNIX_TIMESTAMP(dt_occur)=".strtotime($dTmp).") AND (location = ".(int)$salleid."))";
$rs = mysql_query($strSQL);
if (!$rs) {
echo "Could not successfully run query ($strSQL) from DB: ".mysql_error();
exit;
}
$blnLoop=false;
while ($row = mysql_fetch_assoc($rs)) {
If ((($H_debut >= strtotime(TimePart($row["tm_start"]))) AND ($H_fin <= strtotime(TimePart($row["tm_end"])))) OR (( $H_debut >= strtotime(TimePart($row["tm_start"]))) AND ($H_debut < strtotime(TimePart($row["tm_end"])))) OR (( $H_debut < strtotime(TimePart($row["tm_start"]))) AND ($H_fin >strtotime(TimePart($row["tm_start"]))))) {
$blnReserve=true;
$blnLoop=true;
}
if ($blnLoop) break;
}
mysql_free_result($rs);
$verification=$blnReserve;
return($verification);
}
//********************************************************************************/
function verificationUpdate($salleid,$hhdebut,$hhfin,$dTmp,$event_id) {
$blnReserve=false;
$blnLoop=false;
$hhdebut=$hhdebut.":00";
$hhfin=$hhfin.":00";
$H_debut = strtotime($hhdebut);
$H_fin = strtotime($hhfin);
$strSQL = "SELECT * FROM eventsoccur WHERE ((LEFT(dt_occur,10) = '".$dTmp."') AND (event_id <> ".$event_id.") AND (location=".(int)$salleid."))";
$rs = mysql_query($strSQL);
if (!$rs) {
echo "Could not successfully run query ($strSQL) from DB: " .mysql_error();
exit;
}
$blnLoop=false;
while ($row = mysql_fetch_assoc($rs)) {
If (($H_debut >= strtotime(TimePart($row["tm_start"]))) AND ($H_fin <= strtotime(TimePart($row["tm_end"]))) OR ( $H_debut >= strtotime(TimePart($row["tm_start"]))) AND ($H_debut < strtotime(TimePart($row["tm_end"]))) OR ( $H_debut < strtotime(TimePart($row["tm_start"]))) AND ($H_fin > strtotime(TimePart($row["tm_start"])))) {
$blnReserve=true;
$blnLoop=true;
}
if ($blnLoop) exit;
}
mysql_free_result($rs);
$verificationUpdate=$blnReserve;
return($verificationUpdate);
}
/**************************************************************************************/
?>