1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
$db = new DB();
$rdvs = $db->query("SELECT * FROM rendez_vous ORDER BY date,heure");
$rappels = $db->query("SELECT * FROM rappels WHERE assigned_to='".$_SESSION['id_user']."' ORDER BY date,heure");
$events = "" ;
$event_id = 1 ;
$nb_events = mysql_num_rows($rdvs);
$nb_rappels = mysql_num_rows($rappels);
$nb = $nb_events + $nb_rappels ;
$rdv = mysql_fetch_array($rdvs);
$rappel = mysql_fetch_array($rappels);
for($i = 0 ; $i < $nb ; $i++)
{
$date_rdv = strtotime($rdv['date']." ".$rdv['heure']);
$date_rappel = strtotime($rappel['date']." ".$rappel['heure']);
if(!empty($date_rdv) && !empty($date_rappel))
{
if($date_rappel < $date_rdv )
{
// Ajout rappel
$annee = substr($rappel['date'],0,4) ;
$mois = substr($rappel['date'],5,2)-1 ;
$jour = substr($rappel['date'],8,2)-1+1;
$title = substr($rappel['heure'],0,5)." - ".$rappel['titre'] ;
$events .= "{ \"EventID\":\"".$event_id."\", \"Date\": new Date(".$annee.",".$mois.",".$jour."), \"Title\":\"".$title."\", \"view_URL\": \"includes/content/accueil/popup/view_rappel.php?id_event=".$rappel['id_rappel']."\",\"edit_URL\": \"includes/content/accueil/popup/edit_rappel.php?id_event=".$rappel['id_rappel']."\",\"del_URL\": \"includes/content/accueil/popup/delete_rappel.php?id_event=".$rappel['id_rappel']."\", \"CssClass\":\"Remind\" }" ;
if($event_id!=$nb)
$events .= ",";
$event_id++ ;
$rappel = mysql_fetch_array($rappels);
}
elseif($date_rappel == $date_rdv)
{
// ajout rappel
$annee = substr($rappel['date'],0,4) ;
$mois = substr($rappel['date'],5,2)-1 ;
$jour = substr($rappel['date'],8,2)-1+1;
$title = substr($rappel['heure'],0,5)." - ".$rappel['titre'] ;
$events .= "{ \"EventID\":\"".$event_id."\", \"Date\": new Date(".$annee.",".$mois.",".$jour."), \"Title\":\"".$title."\", \"view_URL\": \"includes/content/accueil/popup/view_rappel.php?id_event=".$rappel['id_rappel']."\",\"edit_URL\": \"includes/content/accueil/popup/edit_rappel.php?id_event=".$rappel['id_rappel']."\",\"del_URL\": \"includes/content/accueil/popup/delete_rappel.php?id_event=".$rappel['id_rappel']."\", \"CssClass\":\"Remind\" }" ;
if($event_id!=$nb)
$events .= ",";
$event_id++ ;
$rappel = mysql_fetch_array($rappels);
// Ajout rdv
$annee = substr($rdv['date'],0,4) ;
$mois = substr($rdv['date'],5,2)-1 ;
$jour = substr($rdv['date'],8,2)-1+1;
$title = substr($rdv['heure'],0,5)." - ".$rdv['ville'] ;
$events .= "{ \"EventID\":\"".$event_id."\", \"Date\": new Date(".$annee.",".$mois.",".$jour."), \"Title\":\"".$title."\", \"view_URL\": \"includes/content/accueil/popup/view_event.php?id_event=".$rdv['id_rdv']."\",\"edit_URL\": \"includes/content/accueil/popup/edit_event.php?id_event=".$rdv['id_rdv']."\",\"del_URL\": \"includes/content/accueil/popup/delete_event.php?id_event=".$rdv['id_rdv']."\", \"CssClass\":\"Event\" }" ;
if($event_id!=$nb)
$events .= ",";
$event_id++ ;
$rdv = mysql_fetch_array($rdv);
}
else
{
// Ajout rdv
$annee = substr($rdv['date'],0,4) ;
$mois = substr($rdv['date'],5,2)-1 ;
$jour = substr($rdv['date'],8,2)-1+1;
$title = substr($rdv['heure'],0,5)." - ".$rdv['ville'] ;
$events .= "{ \"EventID\":\"".$event_id."\", \"Date\": new Date(".$annee.",".$mois.",".$jour."), \"Title\":\"".$title."\", \"view_URL\": \"includes/content/accueil/popup/view_event.php?id_event=".$rdv['id_rdv']."\",\"edit_URL\": \"includes/content/accueil/popup/edit_event.php?id_event=".$rdv['id_rdv']."\",\"del_URL\": \"includes/content/accueil/popup/delete_event.php?id_event=".$rdv['id_rdv']."\", \"CssClass\":\"Event\" }" ;
if($event_id!=$nb)
$events .= ",";
$event_id++ ;
$rdv = mysql_fetch_array($rdvs);
}
}
elseif(empty($date_rdv) && !empty($date_rappel))
{
// Ajout rappel
$annee = substr($rappel['date'],0,4) ;
$mois = substr($rappel['date'],5,2)-1 ;
$jour = substr($rappel['date'],8,2)-1+1;
$title = substr($rappel['heure'],0,5)." - ".$rappel['titre'] ;
$events .= "{ \"EventID\":\"".$event_id."\", \"Date\": new Date(".$annee.",".$mois.",".$jour."), \"Title\":\"".$title."\", \"view_URL\": \"includes/content/accueil/popup/view_rappel.php?id_event=".$rappel['id_rappel']."\",\"edit_URL\": \"includes/content/accueil/popup/edit_rappel.php?id_event=".$rappel['id_rappel']."\",\"del_URL\": \"includes/content/accueil/popup/delete_rappel.php?id_event=".$rappel['id_rappel']."\", \"CssClass\":\"Remind\" }" ;
if($event_id!=$nb)
$events .= ",";
$event_id++ ;
$rappel = mysql_fetch_array($rappels);
}
elseif(!empty($date_rdv) && empty($date_rappel))
{
// Ajout rdv
$annee = substr($rdv['date'],0,4) ;
$mois = substr($rdv['date'],5,2)-1 ;
$jour = substr($rdv['date'],8,2)-1+1;
$title = substr($rdv['heure'],0,5)." - ".$rdv['ville'] ;
$events .= "{ \"EventID\":\"".$event_id."\", \"Date\": new Date(".$annee.",".$mois.",".$jour."), \"Title\":\"".$title."\", \"view_URL\": \"includes/content/accueil/popup/view_event.php?id_event=".$rdv['id_rdv']."\",\"edit_URL\": \"includes/content/accueil/popup/edit_event.php?id_event=".$rdv['id_rdv']."\",\"del_URL\": \"includes/content/accueil/popup/delete_event.php?id_event=".$rdv['id_rdv']."\", \"CssClass\":\"Event\" }" ;
if($event_id!=$nb)
$events .= ",";
$event_id++ ;
$rdv = mysql_fetch_array($rdvs);
}
} |
Partager