include "../include/i_utils.php";
check_security(1); //se trouve dans i_utils.php //Appel de fonction
?>
Réservation des Equipements
// autre procedure
if (!isset($_REQUEST["do_search"])) $do_search = "";
else $do_search = $_REQUEST["do_search"];
if (!isset($_REQUEST["sortby"])) $sortby="";
else $sortby = $_REQUEST["sortby"];
//''' request form keys and inputs
if (!isset($_REQUEST["id"])) $id="";
else $id = $_REQUEST["id"];
if (!isset($_REQUEST["action"])) $action = "";
else $action = strtolower($_REQUEST["action"]);
//':: handle the action
switch($action){
case "select_detail_events" :
//' select the requested key record from database
if ($id <> "") {
db_E_select_detail_Events(); //appel procedure
} else {
$b_error = true;
$error_list["edit_detail_Events"]="Specify record to select.";
}
break;
}
$datedujour=date("j/n/Y"); // echo '$datedujour='.$datedujour;
$partie_datedujour = explode("/", $datedujour);
//':: handle the default case(s) (ignores value of action parameter)
if (!isset($_REQUEST["incDate"])) $incDate="";
else $incDate = $_REQUEST["incDate"];
if (!isset($_REQUEST["mo"])) $mo="";
else $mo = $_REQUEST["mo"];
if (!isset($_REQUEST["yr"])) $yr="";
else $yr = $_REQUEST["yr"];
if ("m/d/Y" == "m/d/Y") {
if (($incDate == "") and ($mo <> "") and ($yr <> "")) $incDate = $mo."/1/".$yr;
}else{
if (($incDate == "") and ($mo <> "") and ($yr <> "")) $incDate = "1/".$mo."/".$yr;
}
if ($action == "detail")
db_E_select_detail_Events(); // appel de procedure
else
$b_display_new_content = true; // voir est-ce procedure ou variable
display_errs(); // appel de procedure dans i_utils.php
display_msg(); // appel de procedure dans i_utils.php
if ($action == "") {
If ($incDate == "") {
// get the current months first day
$incDate = Date("m")."/1/".Date("Y"); // voir ici c quoi date
}
//pixel size for the cell boxes
$boxSize = "40";
$boxSizeLarge = "40";
//' To change the month, Pass in a date with POST or GET of a valid date
//' to a variable named incDate
render_title($incDate); //La fonction est définie plus haut
if (!isset($_REQUEST["wk"])) $wk="";
else $wk = $_REQUEST["wk"];
$partie_incDate = explode("/", $incDate); // mm/jj/yyyy
if (!isset($_REQUEST["CatId"])) $CatId = "";
else $CatId = $_REQUEST["CatId"];
if ($wk == "") {
?>
Dimanche
Lundi
Mardi
Mercredi
Jeudi
Vendredi
Samedi
//'' select events and assign to a_events array
//':: request action
if ($CatId == "") {
$sql = "SELECT eventsequipement.*, eventsequipementoccur.*, admin.NomU FROM eventsequipement, eventsequipementoccur, admin WHERE ";
$sql.= "((";
$sql.= "b_personal = 0) OR (b_personal = 2) OR (b_personal is null) OR (eventsequipement.CodeAdmin = ".$_SESSION["CodeAdmin"].""; //verifier cette requette
$sql.= ")) ";
$sql.= "AND ";
$sql.= "((";
$sql.= "eventsequipement.CodeAdmin = admin.CodeAdmin";
$sql.= ") "; // Verifier toutes ces requetes avec Mysql
$sql.="AND";
$sql.= " (";
$sql.= "eventsequipementoccur.event_id = eventsequipement.event_id";
$sql.= ")";
$sql.= " AND ";
$sql.= "(";
$sql.= "EXTRACT(MONTH FROM dt_occur) = '".$partie_incDate[0]."') AND (EXTRACT(YEAR FROM dt_occur)= '".$partie_incDate[2]."'))";
$sql.= " ORDER BY UNIX_TIMESTAMP(dt_occur)";
//''response.write sql Select les évenements du mois courants
}else{
$sql = "SELECT eventsequipement.*, eventsequipementoccur.*, admin.NomU FROM eventsequipement, eventsequipementoccur, admin WHERE ";
$sql.= "((";
$sql.= "b_personal = 0) OR (b_personal = 2) OR (b_personal IS NULL) OR (EventsEquipement.CodeAdmin = ".to_sql($_SESSION["CodeAdmin"],"number").""; //verifier cette requete
$sql.= "))";
$sql.= "AND";
$sql.= "((";
$sql.= "eventsequipementoccur.catid = ".to_sql($CatId,"number")."";
$sql.= ")";
$sql.= " AND ";
$sql.= "(";
$sql.= "eventsequipement.CodeAdmin = admin.CodeAdmin";
$sql.= ")";
$sql.= " AND ";
$sql.= "(";
$sql.= "eventsequipementoccur.event_id = eventsequipement.event_id";
$sql.= ")";
$sql.= " AND ";
$sql.= "(";
$sql.= "EXTRACT(MONTH FROM dt_occur) = '".$partie_incDate[0]."') AND (EXTRACT(YEAR FROM dt_occur)= '".$partie_incDate[2]."'))";
$sql.= " ORDER BY dt_occur";
//'response.write sql
}
$rs = mysql_query($sql);
if (!$rs) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
$partie_incDate = explode("/", $incDate);
/****************Ajouté pour eviter redondnce**********/
$incday= $partie_incDate[1];
$incmonth= $partie_incDate[0]; // mon ajout
$incyear= $partie_incDate[2];
/**********************************************************************/
$days_in_month = DaysInAnyMonth($incmonth,$incyear); //nombre de jours dans un mois
$lastDateU=mktime(0, 0,0,date("m") , date("d")+$days_in_month-1, date("Y")); //calcul le dernier jour aprés un mois de la date courante en temps Unix
$lastDate=(date("d/m/Y",$lastDateU)); //la date en format j/m/Y
while ($row = mysql_fetch_assoc($rs)) {
$dt_start = $row["dt_start"];
$dt_end = $row["dt_end"];
$location = $row["location"];
$dt_occur = $row["dt_occur"];
$entry_type = $row["entry_type"];
$recurring_end = $row["recurring_end"];
$b_personal = $row["b_personal"];
$CodeAdmin = $row["CodeAdmin"];
$NomU = $row["NomU"];
$ev_start = 0;
$ev_end = 0;
$partie_dt_occur = explode("-",datevalue($dt_occur));
$partie_dt_occur[2]= ltrim($partie_dt_occur[2], "0"); //supprimer le 0 a gauche du jour
if (!isset($a_events[$partie_dt_occur[2]] )) {
$a_events[$partie_dt_occur[2]]="";
}
if ((isset($dt_end)) && ((strtotime($dt_end) == strtotime($dt_start))) || (is_null($dt_end)))
{
if (($b_personal == 2) && ($CodeAdmin <> $_SESSION["CodeAdmin"]))
$a_events[$partie_dt_occur[2]] = $a_events[$partie_dt_occur[2]].$NomU." busy.. ";
}
if ($a_events[$partie_dt_occur[2]]=="")
$a_events[$partie_dt_occur[2]] = $a_events[$partie_dt_occur[2]]."".substr($row["event_name"],0,25);
else
$a_events[$partie_dt_occur[2]] = $a_events[$partie_dt_occur[2]]."\n".substr($row["event_name"],0,25);
} //fin while
mysql_free_result($rs);
$dateCount = $incDate;
$count = 1;
$dispDay = 1;
for ($w = 1; $w <= 6; $w++) {
?>
for ($d = 1; $d <= 7; $d++) {
$partie_incDate = explode("/", $incDate);
/****************Ajouté pour eviter redondance**********/
$incday = $partie_incDate[1];
$incmonth = $partie_incDate[0];
$incyear = $partie_incDate[2];
/**********************************************************************/
$incDateU=mktime(0,0,0, $incmonth,$incday,$incyear); //date unix du jour
if (!($count> Date("w" , $incDateU)) && ($count < 8)) {
?>
$count = $count + 1;
}else{
//':: current date?
If ("m/d/Y" == "m/d/Y") {
$currDy = date("m" , $incDateU)."/".$dispDay."/"; //format mm/jj
$currDay = date("m" , $incDateU)."/".$dispDay."/".date("Y" , $incDateU);
}Else{
$currDy = $dispDay."/".date("m" , $incDateU)."/";
$currDay = $dispDay."/".date("m" , $incDateU)."/".date("Y" , $incDateU);
}
$partie_currDay = explode("/", $currDay);
If (checkdate($partie_currDay[0],$partie_currDay[1],$partie_currDay[2])) {
//':: today
/*************rentre ici quand la date du jour sera egal a $Date, $currDay va du
premier du mois au dernier du mois**************************************/
$partie_currDay = explode("/", $currDay);
/****************Ajouté pour eviter redondance**********/
$curday= $partie_currDay[1];
$curmonth= $partie_currDay[0];
$curyear= $partie_currDay[2];
/**********************************************************************/
$Date=date("n/j/Y");
$partie_Date = explode("/", $Date);
/**************************/
$Dateday= $partie_Date[1];
$Datemonth= $partie_Date[0];
$Dateyear= $partie_Date[2];
If (mktime(0,0,0, $curmonth,$curday,$curyear) == mktime(0,0,0, $Datemonth,$Dateday,$Dateyear)) {
?>
echo "$dispDay";
if (!Empty($a_events[$dispDay])){ ?>
} ?>
}Else{ //c'est la que s'afficheront toutes les journées
//':: other date Autres dates que la date du jour, la date courante
/*************C'est la que saffiche le tableau******/
echo"
$dispDay";
if (!Empty($a_events[$dispDay])) {
echo "
";
}
echo "
";
}
$count = $count + 1;
$dispDay = $dispDay + 1;
}Else{
//':: no date spacer cell
?>
}
}
}
// 'day
?>
}
/***********************CORRECTE********************************/
$lastmoU=dateAdd("m", -1,$incDateU); //la date en format j/m/Y
$lastmo= date("m/d/Y",$lastmoU);
$nextmoU=dateAdd("m", 1,$incDateU); //calcul mois suivant en temps Unix
$nextmo=(date("m/d/Y",$nextmoU)); //la date en format j/m/Y
/**********************************************************************/
if (!isset($_REQUEST["CatId2"])) $CatId2=" ";
else $CatId2 = $_REQUEST["CatId2"];
?>
} //fin else
$count = $count + 1 ;
$dispDay = $dispDay + 1;
}// fin If ligne 602
?>
} //fin for ligne 590
/****************************************** JOURS **********************************/
// day
$lastwkU=DateAdd("d",-8,$incDateU);
$lastwk = date("m/d/Y",$lastwkU);
$nextwkU=DateAdd("d",7,$incDateU);
$nextwk = date("m/d/Y",$nextwkU);
?>
} //fin else ligne 478
}else{ //fin if ligne 136
render_title($incDate);
/*************************************** **************************/
if (isset ($_REQUEST["page_no"]))
$page_no = $_REQUEST["page_no"];
else $page_no = " ";
if ($page_no == "") $page_no = 1;
$detail_Events_sql=db_E_select_detail_Events();
$results = false;
if (!isset($detail_Events_sql))
$detail_Events_sql="";
if ($detail_Events_sql <> "") {
$rs=mysql_query($detail_Events_sql);
if (!$rs) {
echo "Could not successfully run query ($detail_Events_sql) from DB: " . mysql_error();
exit;
}
if ($rs) { //move first
$num_recs = mysql_num_rows($rs);
$results = true;
}else{
$results = false;
mysql_free_result($rs);
}
}else { //else du if ligne 717
$results = false;
}
$rec_count = 0;
///////////////////////////////////////////////////////////////////
$partie_incDate = explode("/", $incDate);
/****************Ajouté pour eviter redondance**********/
$incday= $partie_incDate[1];
$incmonth= $partie_incDate[0]; // mon ajout
$incyear= $partie_incDate[2];
?>