Exemplo n.º 1
0
 public function execute($input)
 {
     $historique = requetemysql::liste_garde(array('debut' => $input['date_debut'], 'fin' => $input['date_fin']));
     $absent = requetemysql::liste_absent(array('debut' => $input['date_debut'], 'fin' => $input['date_fin']));
     $var_retour = [];
     $var_retour[0] = $historique;
     $var_retour[1] = $absent;
     // do something
     return $var_retour;
 }
 public function zone_garde()
 {
     $info_tour = requetemysql::info_tour(array('login' => $_SESSION['login2']));
     if (empty($info_tour)) {
         throw new Exception("Aucun tour dans la base de donnée !");
     }
     $liste_jour = array(array(nom => "lundi", valeur => 1), array(nom => "mardi", valeur => 2), array(nom => "mercredi", valeur => 3), array(nom => "jeudi", valeur => 4), array(nom => "vendredi", valeur => 5), array(nom => "samedi", valeur => 6), array(nom => "dimanche", valeur => 0));
     $recherche_tot_garde = array(array(nom => "points total", valeur => 0), array(nom => "nuit semaine", valeur => 1), array(nom => "nuit week-end", valeur => 2), array(nom => "jour week-end", valeur => 3));
     $liste_moment = array(array(nom => "nuit", valeur => array(debut => 19, fin => 8), commentaire => "nuit : 19h - 8h(J+1)", nuit => "oui", temps => 13), array(nom => "après-midi", valeur => array(debut => 14, fin => 19), commentaire => "après-midi : 14h - 19h", nuit => "non", temps => 13), array(nom => "journée", valeur => array(debut => 8, fin => 19), commentaire => "journée : 8h - 19h", nuit => "non", temps => 11), array(nom => "matinée", valeur => array(debut => 8, fin => 12), commentaire => "matinée : 8h - 12h", nuit => "non", temps => 4), array(nom => "soirée", valeur => array(debut => 19, fin => 23), commentaire => "soirée : 19h - 23h", nuit => "non", temps => 4), array(nom => "aprem+nuit", valeur => array(debut => 12, fin => 8), commentaire => "aprem+nuit : 12h - 8h(J+1)", nuit => "oui", temps => 20));
     // Les catégories dans le planning de garde doivent correspondre aux catégories présente sur la page :
     // - recherclient.controllers.php
     $liste_cat_planning = array(array(nom => "garde", abr => "G", valeur => 0), array(nom => "astreinte", abr => "A", valeur => 1));
     $liste_indispo_cat = array(array(nom => "tous les jours", valeur => 0), array(nom => "les semaines paires", valeur => 1), array(nom => "les semaines impaires", valeur => 2), array(nom => "les vacances scolaires", valeur => 3));
     $liste_equipe = array(array(nom => "1 véto de garde et 1 d'astreinte", valeur => array(garde => 1, astreinte => 1)), array(nom => "1 véto de garde", valeur => array(garde => 1, astreinte => 0)), array(nom => "1 véto d'astreinte", valeur => array(garde => 0, astreinte => 1)), array(nom => "2 vétos de garde et 1 d'astreinte", valeur => array(garde => 2, astreinte => 1)), array(nom => "2 vétos de garde et 0 d'astreinte", valeur => array(garde => 2, astreinte => 0)));
     $liste_rythme = array(array(nom => "1 sem/2", mon_index => 0, valeur => array(rythme => 1, base => 2)), array(nom => "1 sem/4", mon_index => 1, valeur => array(rythme => 1, base => 4)), array(nom => "toutes les semaines", mon_index => 2, valeur => array(rythme => 1, base => 1)), array(nom => "1 sem/3", mon_index => 3, valeur => array(rythme => 1, base => 3)), array(nom => "1 sem/5", mon_index => 4, valeur => array(rythme => 1, base => 5)));
     $vetos = requetemysql::listevetos();
     if (empty($vetos)) {
         throw new Exception("Pas de vetos dans la base");
     }
     $date_debut = mktime(0, 0, 0, date("m"), 1, date("Y"));
     $date_fin = mktime(0, 0, 0, date("m") + 1, 1, date("Y"));
     $planning = requetemysql::liste_garde(array('debut' => $date_debut, 'fin' => $date_fin));
     render('_tourdegarde', array('title' => "Tour de garde: zone de gestion", 'liste_moment' => $liste_moment, 'liste_jour' => $liste_jour, 'liste_equipe' => $liste_equipe, 'liste_membre' => $vetos, 'liste_rythme' => $liste_rythme, 'liste_cat_planning' => $liste_cat_planning, 'info_tour' => $info_tour, 'planning' => $planning, 'liste_indispo_cat' => $liste_indispo_cat, 'recherche_tot_garde' => $recherche_tot_garde));
 }
 public function find()
 {
     try {
         $mes_infos2 = requetemysql::mes_infos();
         if (empty($mes_infos2)) {
             throw new Exception("Vous êtes introuvables dans la bdd identification!");
         }
         $mes_infos = json_decode($mes_infos2, true);
         $afficher_telecom = $mes_infos[0]['telecom'];
         if ($afficher_telecom == 1) {
             $telephone = requetemysql::mes_appels_entrants();
             if (empty($telephone)) {
                 throw new Exception("Error in mes_appels_entrants function");
             }
         } else {
             $telephone = json_encode('');
         }
         $utiliser_sms = $mes_infos[0]['sms'];
         $afficher_ecran_def = $mes_infos[0]['ecran_def'];
         $video_attente = $mes_infos[0]['video_attente'];
         if ($mes_infos[0]['ecran_def'] == 1) {
             $ecran_def = requetemysql::mes_messages_defilant(array('permission' => $_SESSION['login']));
             if (empty($ecran_def)) {
                 throw new Exception("Error in mes_messages_defilant function");
             }
         } else {
             $ecran_def = json_encode('');
         }
         if ($mes_infos[0]['video_attente'] == 1) {
             $camera_adresse = requetemysql::search_list_cam_ip($_SESSION['login']);
             if (empty($camera_adresse)) {
                 throw new Exception("Error in search_list_cam_ip function");
             }
         } else {
             $camera_adresse = json_encode('');
         }
         $client = requetemysql::findclient("client");
         if (empty($client)) {
             throw new Exception("Error in findclient function , client part !");
         }
         $animaux = requetemysql::findclient("ax");
         if (empty($animaux)) {
             throw new Exception("Error in findclient function, ax part !");
         }
         $salle_attente = requetemysql::salle_attente("general");
         if (empty($salle_attente)) {
             throw new Exception("Error in salle_attente function, general part !");
         }
         $rapport_ref = requetemysql::rapport_ref("general");
         if (empty($rapport_ref)) {
             throw new Exception("Error in rapport_ref function, general part !");
         }
         $rapport_redige = requetemysql::rapport_redige("general");
         if (empty($rapport_redige)) {
             throw new Exception("Error in rapport_redige function, general part !");
         }
         $rapport_refere = requetemysql::rapport_refere("general");
         if (empty($rapport_refere)) {
             throw new Exception("Error in rapport_refere fonction, general part !");
         }
         $liste_mur = requetemysql::liste_mur("general");
         if (empty($liste_mur)) {
             throw new Exception("Error in liste_mur fonction, general part !");
         }
         // liste des vétos du tour de garde
         $vetos = requetemysql::listevetos();
         if (empty($vetos)) {
             throw new Exception("Error in listevetos fonction !");
         }
         $liste_message_recu_perso = requetemysql::liste_message(array('login' => $_SESSION['login2'], 'choix' => 'recu'));
         if (empty($liste_message_recu_perso)) {
             throw new Exception("Error in liste_message function ! param : login: "******" choix: recu");
         }
         $liste_message_recu_garde = requetemysql::liste_message(array('login' => $_SESSION['login'], 'choix' => 'recu'));
         if (empty($liste_message_recu_garde)) {
             throw new Exception("Error in liste_message function ! param : login: "******" choix: recu");
         }
         $liste_message_emis = requetemysql::liste_message(array('login' => $_SESSION['login2'], 'choix' => 'emis'));
         if (empty($liste_message_emis)) {
             throw new Exception("Error in liste_message function ! param : login: "******" choix: emis");
         }
         $historique = requetemysql::brouillard(array('choix' => 'historique2'));
         if (empty($historique)) {
             throw new Exception("Error in brouillard function ! param : choix : historique");
         }
         $date_debut = mktime(0, 0, 0, date("m"), 1, date("Y"));
         $date_fin = mktime(0, 0, 0, date("m") + 1, 1, date("Y"));
         $planning = requetemysql::liste_garde(array('debut' => $date_debut, 'fin' => $date_fin));
         $info_tour = requetemysql::info_tour2(array('login' => $_SESSION['tour']));
         if (empty($info_tour)) {
             throw new Exception("Aucun tour dans la base de donnée !");
         }
         $info_tour_deco = json_decode($info_tour, true);
         if ($info_tour_deco[0]['envoi_mail'] == 0) {
             $date_envoi_mail = mktime(0, 0, 0, date("m"), date("d") + $info_tour_deco[0]['jour'], date("Y"));
             $deja_envoye = requetemysql::mail_allready_send(array('ma_date' => $date_envoi_mail));
             if (count($deja_envoye) == 0 && date("H") >= 7 && date("H") <= 23) {
                 $envoyer_mail = requetemysql::envoyer_mail(array('ma_date' => $date_envoi_mail));
                 $mail_envoye = requetemysql::mail_send(array('ma_date' => $date_envoi_mail));
             }
         }
         //envoi sms automatique au veterinaire de garde
         $liste_cat_planning = array(array(nom => "garde", abr => "G", valeur => 0), array(nom => "astreinte", abr => "A", valeur => 1));
         if ($mes_infos[0]['sms'] == 1 && $info_tour_deco[0]['envoi_sms'] == 0) {
             $date_envoi_sms = mktime(0, 0, 0, date("m"), date("d") + $info_tour_deco[0]['jour2'], date("Y"));
             $deja_envoye_sms = requetemysql::sms_allready_send(array('ma_date' => $date_envoi_sms, 'nature' => 1));
             if (count($deja_envoye_sms) == 0 && date("H") >= 7 && date("H") <= 23) {
                 $envoyer_sms = requetemysql::envoyer_sms(array('ma_date' => $date_envoi_sms, 'liste_cat' => $liste_cat_planning));
                 $sms_envoye = requetemysql::sms_send(array('ma_date' => $date_envoi_sms));
             }
         }
         $liste_choix_ecran = array(array(nom => TXT_RECHERCHECLIENT_CONTROLLER_WAIT2MIN, choix => 0, temps => 2), array(nom => TXT_RECHERCHECLIENT_CONTROLLER_WAIT5MIN, choix => 0, temps => 5), array(nom => TXT_RECHERCHECLIENT_CONTROLLER_WAIT10MIN, choix => 0, temps => 10), array(nom => TXT_RECHERCHECLIENT_CONTROLLER_WAIT20MIN, choix => 0, temps => 20), array(nom => TXT_RECHERCHECLIENT_CONTROLLER_WAIT30MIN, choix => 0, temps => 30), array(nom => TXT_RECHERCHECLIENT_CONTROLLER_WAIT60MIN, choix => 0, temps => 60), array(nom => TXT_RECHERCHECLIENT_CONTROLLER_CONSULTATION_RENDEZ_VOUS, choix => 1, temps => 300));
         //	$planning = requetemysql::planning(array('tour'=>$_SESSION['tour'], 'date_debut'=>$date_debut, 'date_fin'=>$date_fin, 'nature'=>1));
         //		if(empty($planning)){
         //			throw new Exception("Error in planning function ! param : tour :"+$_SESSION['tour']+" date_debut : "+$date_debut+" date_fin : "+$date_fin+" nature : 1");
         //		}
         //	$planning2 = requetemysql::planning(array('tour'=>$_SESSION['tour'], 'date_debut'=>$date_debut, 'date_fin'=>$date_fin, 'nature'=>2));
         //		if(empty($planning2)){
         //			throw new Exception("Error in planning function ! param : tour :"+$_SESSION['tour']+" date_debut : "+$date_debut+" date_fin : "+$date_fin+" nature : 2");
         //		}
         render('_accueil', array('title' => TXT_RECHERCHECLIENT_CONTROLLER_TITTLE, 'texte_recherche' => TXT_RECHERCHECLIENT_CONTROLLER_SEARCH1, 'texte_recherche2' => TXT_RECHERCHECLIENT_CONTROLLER_SEARCH2, 'client' => $client, 'animaux' => $animaux, 'salle_attente' => $salle_attente, 'rapport_ref' => $rapport_ref, 'rapport_redige' => $rapport_redige, 'casrefere' => $rapport_refere, 'liste_vetos' => $vetos, 'liste_message_recu_perso' => $liste_message_recu_perso, 'liste_message_recu_garde' => $liste_message_recu_garde, 'liste_message_emis' => $liste_message_emis, 'planning' => $planning, 'historique' => $historique, 'liste_mur' => $liste_mur, 'info_veto' => $mes_infos2, 'telecom' => $afficher_telecom, 'telephone' => $telephone, 'afficher_ecran_def' => $afficher_ecran_def, 'liste_ecran_def' => $liste_choix_ecran, 'ecran_def' => $ecran_def, 'utiliser_sms' => $utiliser_sms, 'video_attente' => $video_attente, 'liste_cat_planning' => $liste_cat_planning, 'camera_adresse' => $camera_adresse));
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
Exemplo n.º 4
0
        }
    }
    echo json_encode($liste_point);
} elseif ($_GET['action'] == 'modif_veto') {
    $id_garde = json_decode($_POST['id_garde'], true);
    while (list($key, $value) = each($id_garde)) {
        if ($key == 0 && $_POST['cas'] == 1) {
            $envoi_mail = 1;
        } else {
            $envoi_mail = 0;
        }
        $modif_veto = requetemysql::modif_veto(array('login' => $_POST['login'], 'id_garde' => $value, 'cas' => $envoi_mail, 'liste_cat_planning' => $_POST['liste_cat_planning'], 'date_fin_garde' => $_POST['date_fin_garde']));
    }
    echo $modif_veto;
} elseif ($_GET['action'] == 'recup_historique') {
    $liste_garde = requetemysql::liste_garde(array('permission' => $_SESSION['login'], 'debut' => $_POST['date_debut'], 'fin' => $_POST['date_fin']));
    echo json_encode($liste_garde);
} elseif ($_GET['action'] == 'recup_historique2') {
    $liste_garde = requetemysql::liste_garde2(array('permission' => $_SESSION['login'], 'debut' => $_POST['date_debut'], 'fin' => $_POST['date_fin']));
    echo $liste_garde;
} elseif ($_GET['action'] == 'supr_planning') {
    $st = $db->prepare("DELETE FROM `aerogard2`.`tourdegarde` where id='" . $_POST['supr_id'] . "'");
    $st->execute();
    echo json_encode("ok");
} elseif ($_GET['action'] == 'save_planning2') {
    $planning2 = json_decode($_POST['planning2'], true);
    $sql = "INSERT INTO `aerogard2`.`tourdegarde` (`login`, `from`, `date`, `nature`, `tour`, `permission`, `date_debut`, `date_fin`)\n\t VALUES ";
    $qPart = array_fill(0, count($planning2), "(?, ?, FROM_UNIXTIME(?/1000), ?, ?, ?, FROM_UNIXTIME(?/1000), FROM_UNIXTIME(?/1000))");
    $sql .= implode(",", $qPart);
    $stmt = $db->prepare($sql);
    $i = 1;
Exemplo n.º 5
0
        echo $save_tel_client;
    } elseif ($_GET['action'] == 'save_list_tel_part') {
        $save_list_tel_part = requetemysql::save_list_tel_part(array('numero' => $_POST['numero'], 'description' => $_POST['description']));
        if (empty($save_list_tel_part)) {
            throw new Exception("erreur : sauvegarde du numero particulier");
        }
        echo $save_list_tel_part;
    } elseif ($_GET['action'] == 'changement') {
        $st = $db->prepare("DELETE FROM `aerogard2`.`tourdegarde` where date=FROM_UNIXTIME('" . $_POST['ma_date'] . "'/1000,'%Y/%m/%d') and tour='" . $_SESSION['tour'] . "' and nature='" . $_POST['valeur'] . "'");
        $st->execute();
        $st->closeCursor();
        $sql = "INSERT INTO `aerogard2`.`tourdegarde` (`id`, `login`, `from`, `date`, `nature`, `tour`) VALUES ('', :login, :from, FROM_UNIXTIME(:date/1000,'%Y/%m/%d'), :nature, :tour )";
        $sth = $db->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
        $sth->execute(array(':login' => $_POST['veto'], ':from' => $_SESSION['login2'], ':date' => $_POST['ma_date'], ':nature' => $_POST['valeur'], ':tour' => $_SESSION['tour']));
        $st->closeCursor();
        echo json_encode("ok");
    } elseif ($_GET['action'] == 'deplacement') {
        $date_debut = mktime(0, 0, 0, date("m", $_POST['ma_date'] / 1000), 1, date("Y", $_POST['ma_date'] / 1000));
        $date_fin = mktime(0, 0, 0, date("m", $_POST['ma_date'] / 1000) + 1, 1, date("Y", $_POST['ma_date'] / 1000));
        $planning = requetemysql::planning(array('tour' => $_SESSION['tour'], 'date_debut' => $date_debut, 'date_fin' => $date_fin, 'nature' => 1));
        $planning2 = requetemysql::planning(array('tour' => $_SESSION['tour'], 'date_debut' => $date_debut, 'date_fin' => $date_fin, 'nature' => 2));
        $super_planning = array($planning, $planning2);
        echo json_encode($super_planning);
    } elseif ($_GET['action'] == 'recherche_consult') {
        $recherche_consult = requetemysql::recherche_consult($_POST['consult']);
        echo $recherche_consult;
    } elseif ($_GET['action'] == 'recup_historique') {
        $liste_garde = requetemysql::liste_garde(array('debut' => $_POST['date_debut'], 'fin' => $_POST['date_fin']));
        echo json_encode($liste_garde);
    }
}
Exemplo n.º 6
0
 /**
  * variable send to external javascript and collected by AJAX request
  * 
  * @param int $cas 1 if superuser(master shift) or no login 2 if member of the shift
  * @return array container for all variables send to js at the beginnning
  * 
  */
 public function _php_to_js($cas)
 {
     /**
      * list of type for the shift. Exemple : penalty or guard
      * @var array $liste_cat_planning
      */
     if (!empty($_SESSION['login'])) {
         if ($cas == 1) {
             $chargement_premiere_partie = requetemysql::chargement_premiere_partie(array('permission' => $_SESSION['login2']));
         } else {
             if ($cas == 2) {
                 $chargement_premiere_partie = requetemysql::chargement_premiere_partie(array('permission' => $_SESSION['tour']));
             }
         }
         //	var_error_log($chargement_premiere_partie );
         if (count($chargement_premiere_partie) == 0) {
             $chargement_premiere_partie[0] = array('cat_planning' => json_encode([]), 'j_normal' => json_encode([]), 'j_ferie' => json_encode([]), 'moment' => json_encode([]));
         }
         $liste_cat_planning = $chargement_premiere_partie[0]['cat_planning'];
     } else {
         $liste_cat_planning = requetemysql::liste_cat_planning();
     }
     /**
      * array of hour in the day : 0h to 23h
      * 
      * @var $liste_heure
      */
     $liste_heure = array(array('nom' => TXT_CHARGEMENT_CONTROLLER_H0, 'valeur' => 0), array('nom' => TXT_CHARGEMENT_CONTROLLER_H1, 'valeur' => 1), array('nom' => TXT_CHARGEMENT_CONTROLLER_H2, 'valeur' => 2), array('nom' => TXT_CHARGEMENT_CONTROLLER_H3, 'valeur' => 3), array('nom' => TXT_CHARGEMENT_CONTROLLER_H4, 'valeur' => 4), array('nom' => TXT_CHARGEMENT_CONTROLLER_H5, 'valeur' => 5), array('nom' => TXT_CHARGEMENT_CONTROLLER_H6, 'valeur' => 6), array('nom' => TXT_CHARGEMENT_CONTROLLER_H7, 'valeur' => 7), array('nom' => TXT_CHARGEMENT_CONTROLLER_H8, 'valeur' => 8), array('nom' => TXT_CHARGEMENT_CONTROLLER_H9, 'valeur' => 9), array('nom' => TXT_CHARGEMENT_CONTROLLER_H10, 'valeur' => 10), array('nom' => TXT_CHARGEMENT_CONTROLLER_H11, 'valeur' => 11), array('nom' => TXT_CHARGEMENT_CONTROLLER_H12, 'valeur' => 12), array('nom' => TXT_CHARGEMENT_CONTROLLER_H13, 'valeur' => 13), array('nom' => TXT_CHARGEMENT_CONTROLLER_H14, 'valeur' => 14), array('nom' => TXT_CHARGEMENT_CONTROLLER_H15, 'valeur' => 15), array('nom' => TXT_CHARGEMENT_CONTROLLER_H16, 'valeur' => 16), array('nom' => TXT_CHARGEMENT_CONTROLLER_H17, 'valeur' => 17), array('nom' => TXT_CHARGEMENT_CONTROLLER_H18, 'valeur' => 18), array('nom' => TXT_CHARGEMENT_CONTROLLER_H19, 'valeur' => 19), array('nom' => TXT_CHARGEMENT_CONTROLLER_H20, 'valeur' => 20), array('nom' => TXT_CHARGEMENT_CONTROLLER_H21, 'valeur' => 21), array('nom' => TXT_CHARGEMENT_CONTROLLER_H22, 'valeur' => 22), array('nom' => TXT_CHARGEMENT_CONTROLLER_H23, 'valeur' => 23));
     /**
      * array for end's date when day is not same at beginning 
      * for exemple : end : 5h D+1
      * 
      * @var array $liste_jour_fin
      */
     $liste_jour_fin = array(array('nom' => TXT_CHARGEMENT_CONTROLLER_D0, 'valeur' => 0), array('nom' => TXT_CHARGEMENT_CONTROLLER_D1, 'valeur' => 1));
     /**
      * list of week's day
      * @var array $liste_jour
      */
     $liste_jour = array(array('nom' => TXT_CHARGEMENT_CONTROLLER_DAY1, 'valeur' => 1), array('nom' => TXT_CHARGEMENT_CONTROLLER_DAY2, 'valeur' => 2), array('nom' => TXT_CHARGEMENT_CONTROLLER_DAY3, 'valeur' => 3), array('nom' => TXT_CHARGEMENT_CONTROLLER_DAY4, 'valeur' => 4), array('nom' => TXT_CHARGEMENT_CONTROLLER_DAY5, 'valeur' => 5), array('nom' => TXT_CHARGEMENT_CONTROLLER_DAY6, 'valeur' => 6), array('nom' => TXT_CHARGEMENT_CONTROLLER_DAY7, 'valeur' => 0));
     /**
      * list of week's day with only 1 letter
      * @var array $liste_jour_short
      */
     $liste_jour_short = array(TXT_CHARGEMENT_CONTROLLER_SHORTDAY7, TXT_CHARGEMENT_CONTROLLER_SHORTDAY1, TXT_CHARGEMENT_CONTROLLER_SHORTDAY2, TXT_CHARGEMENT_CONTROLLER_SHORTDAY3, TXT_CHARGEMENT_CONTROLLER_SHORTDAY4, TXT_CHARGEMENT_CONTROLLER_SHORTDAY5, TXT_CHARGEMENT_CONTROLLER_SHORTDAY6);
     /**
      * caracterisitic of a period in the shift. Exemple : nom: Day, deb_h 8h, deb_f 19h, deb_j 0
      * @var array $liste_moment
      */
     if (!empty($_SESSION['login'])) {
         $liste_moment = $chargement_premiere_partie[0]['moment'];
     } else {
         $liste_moment = requetemysql::liste_moment();
     }
     /**
      * numeric choice for the person's number in a time slot
      */
     $compteur = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20);
     /** @var array $month list of month's name's abbreviation */
     $month = array(TXT_CHARGEMENT_CONTROLLER_MONTH_1, TXT_CHARGEMENT_CONTROLLER_MONTH_2, TXT_CHARGEMENT_CONTROLLER_MONTH_3, TXT_CHARGEMENT_CONTROLLER_MONTH_4, TXT_CHARGEMENT_CONTROLLER_MONTH_5, TXT_CHARGEMENT_CONTROLLER_MONTH_6, TXT_CHARGEMENT_CONTROLLER_MONTH_7, TXT_CHARGEMENT_CONTROLLER_MONTH_8, TXT_CHARGEMENT_CONTROLLER_MONTH_9, TXT_CHARGEMENT_CONTROLLER_MONTH_10, TXT_CHARGEMENT_CONTROLLER_MONTH_11, TXT_CHARGEMENT_CONTROLLER_MONTH_12);
     if (!empty($_SESSION['login'])) {
         /** @var array $vetos list the staff and caracteristic like adress, tel, email... */
         if ($cas == 1) {
             $chargement_seconde_partie = requetemysql::chargement_seconde_partie(array('permission' => $_SESSION['login2']));
         } else {
             if ($cas == 2) {
                 $chargement_seconde_partie = requetemysql::chargement_seconde_partie(array('permission' => $_SESSION['tour']));
             }
         }
         $chargement_seconde_partie = json_decode($chargement_seconde_partie, true);
         if (count($chargement_seconde_partie) == 0) {
             $vetos = requetemysql::listevetos();
             $vetos2 = json_encode(array());
             $vetos3 = requetemysql::listevetos();
             $team_action = json_encode(array());
             $delais = 0;
             $memoire = 0;
             $memoire2 = true;
             $memoire3 = mktime(0, 0, 0, date("m"), 1, date("Y")) * 1000;
             $couleur_entre_deux = "#ff00ff";
             $couleur_absent = "#0000ff";
             $couleur_max = "#c2d6d6";
             $couleur_wedding = "#33CC00";
             $couleur_clash = "#FF3300";
             $interval_for_unavailable = false;
             $date_deb_unavailable = mktime(0, 0, 0, date("m"), 1, date("Y")) * 1000;
             $date_fin_unavailable = mktime(0, 0, 0, date("m") + 2, 1, date("Y")) * 1000;
             $limit_number_unavailable = false;
             $max_unavailable = 10;
             $limit_pourcent_unavailable = false;
             $pourcent_unavailable = 50;
             $couleur_limit_unavailable = "#FFFF00";
         } else {
             $vetos = $chargement_seconde_partie[0]['team'];
             $vetos2 = $chargement_seconde_partie[0]['team2'];
             $vetos3 = requetemysql::listevetos();
             $team_action = $chargement_seconde_partie[0]['team_action'];
             $delais = $chargement_seconde_partie[0]['delais'];
             $memoire = $chargement_seconde_partie[0]['memoire'];
             $memoire2 = $chargement_seconde_partie[0]['interval_or_date'] ? true : false;
             $memoire3 = $chargement_seconde_partie[0]['date_memoire'] * 1000;
             $couleur_entre_deux = $chargement_seconde_partie[0]['couleur_entre_deux'];
             $couleur_absent = $chargement_seconde_partie[0]['couleur_absent'];
             $couleur_max = $chargement_seconde_partie[0]['couleur_max'];
             $couleur_wedding = $chargement_seconde_partie[0]['couleur_wedding'];
             $couleur_clash = $chargement_seconde_partie[0]['couleur_clash'];
             $interval_for_unavailable = $chargement_seconde_partie[0]['interval_for_unavailable'] ? true : false;
             $date_deb_unavailable = $chargement_seconde_partie[0]['date_deb_unavailable'] * 1000;
             $date_fin_unavailable = $chargement_seconde_partie[0]['date_fin_unavailable'] * 1000;
             $limit_number_unavailable = $chargement_seconde_partie[0]['limit_number_unavailable'] ? true : false;
             $max_unavailable = $chargement_seconde_partie[0]['max_unavailable'];
             $limit_pourcent_unavailable = $chargement_seconde_partie[0]['limit_pourcent_unavailable'] ? true : false;
             $pourcent_unavailable = $chargement_seconde_partie[0]['pourcent_unavailable'];
             $couleur_limit_unavailable = $chargement_seconde_partie[0]['couleur_limit_unavailable'];
         }
     } else {
         $vetos = json_encode(array());
         $vetos2 = json_encode(array());
         $vetos3 = json_encode(array());
         $team_action = json_encode(array());
         $delais = 0;
         $memoire = 0;
         $memoire2 = true;
         $memoire3 = mktime(0, 0, 0, date("m"), 1, date("Y")) * 1000;
         $couleur_entre_deux = "#ff00ff";
         $couleur_absent = "#0000ff";
         $couleur_max = "#c2d6d6";
         $couleur_wedding = "#33CC00";
         $couleur_clash = "#FF3300";
         $interval_for_unavailable = false;
         $date_deb_unavailable = mktime(0, 0, 0, date("m"), 1, date("Y")) * 1000;
         $date_fin_unavailable = mktime(0, 0, 0, date("m") + 2, 1, date("Y")) * 1000;
         $limit_number_unavailable = false;
         $max_unavailable = 10;
         $limit_pourcent_unavailable = false;
         $pourcent_unavailable = 50;
         $couleur_limit_unavailable = "#FFFF00";
     }
     $date_debut = mktime(0, 0, 0, date("m"), 1, date("Y"));
     $date_fin = mktime(0, 0, 0, date("m") + 1, 1, date("Y"));
     if (!empty($_SESSION['login'])) {
         /** @var array $historique list of the shift sort by day in the month... */
         if ($cas == 1) {
             $historique = requetemysql::liste_garde(array('debut' => $date_debut, 'fin' => $date_fin));
         } else {
             if ($cas == 2) {
                 $historique = array();
             }
         }
         $absent = requetemysql::liste_absent(array('debut' => $date_debut, 'fin' => $date_fin));
     } else {
         $historique = array();
         $absent = array();
     }
     /** @var array $jour_ajoutees_feries caracteristics of public holiday (ma_date : date:date, assignment_defaut : array:caracteristic of shift job, period_defaut : array:time caracteristics of the shift, compteur_defaut: int:number of staff) */
     if (!empty($_SESSION['login'])) {
         $jour_ajoutees_feries = $chargement_premiere_partie[0]['j_ferie'];
     } else {
         $jour_ajoutees_feries = json_encode([]);
     }
     /** @var array $jour_ajoutees caracteristics of normal day in the shift (ma_date : date:date, assignment_defaut : array:caracteristic of shift job, period_defaut : array:time caracteristics of the shift, compteur_defaut: int:number of staff) */
     if (!empty($_SESSION['login'])) {
         $jour_ajoutees = $chargement_premiere_partie[0]['j_normal'];
     } else {
         $jour_ajoutees = json_encode([]);
     }
     if ($memoire2) {
         $date_debut_historique = mktime(0, 0, 0, date("m") - $memoire, 1, date("Y"));
         $date_fin_historique = mktime(0, 0, 0, date("m"), 1, date("Y"));
     } else {
         $date_debut_historique = mktime(0, 0, 0, date("m", $memoire3), 1, date("Y", $memoire3));
         $date_fin_historique = mktime(0, 0, 0, date("m"), 1, date("Y"));
     }
     /** @var array $point_historique score of each member of the team (number of job) for  each sort of job in function time historic period selected */
     if (!empty($_SESSION['login'])) {
         if ($cas == 1) {
             $obj2 = array();
             foreach (json_decode($jour_ajoutees, true) as $key => $item) {
                 $obj2[$item['jour']] = isset($obj2[$item['jour']]) ? $obj2[$item['jour']] : array();
                 $obj2[$item['jour']][$item['period_defaut']['defaut_heure_debut']] = isset($obj2[$item['jour']][$item['period_defaut']['defaut_heure_debut']]) ? $obj2[$item['jour']][$item['period_defaut']['defaut_heure_debut']] : array();
                 $obj2[$item['jour']][$item['period_defaut']['defaut_heure_debut']][$item['period_defaut']['defaut_heure_fin']] = isset($obj2[$item['jour']][$item['period_defaut']['defaut_heure_debut']][$item['period_defaut']['defaut_heure_fin']]) ? $obj2[$item['jour']][$item['period_defaut']['defaut_heure_debut']][$item['period_defaut']['defaut_heure_fin']] : array();
                 $obj2[$item['jour']][$item['period_defaut']['defaut_heure_debut']][$item['period_defaut']['defaut_heure_fin']][$item['assignment_defaut']['valeur']] = $item['assignment_defaut']['nom'];
             }
             $obj = array();
             foreach (json_decode($jour_ajoutees_feries, true) as $key => $item) {
                 $ma_date = strtotime($item['ma_date']);
                 $obj[$ma_date] = isset($obj[$ma_date]) ? $obj[$ma_date] : array();
                 $obj[$ma_date][$item['period_defaut']['defaut_heure_debut']] = isset($obj[$ma_date][$item['period_defaut']['defaut_heure_debut']]) ? $obj[$ma_date][$item['period_defaut']['defaut_heure_debut']] : array();
                 $obj[$ma_date][$item['period_defaut']['defaut_heure_debut']][$item['period_defaut']['defaut_heure_fin']] = isset($obj[$ma_date][$item['period_defaut']['defaut_heure_debut']][$item['period_defaut']['defaut_heure_fin']]) ? $obj[$ma_date][$item['period_defaut']['defaut_heure_debut']][$item['period_defaut']['defaut_heure_fin']] : array();
                 $obj[$ma_date][$item['period_defaut']['defaut_heure_debut']][$item['period_defaut']['defaut_heure_fin']][$item['assignment_defaut']['valeur']] = $item['assignment_defaut']['nom'];
             }
             $point_historique = requetemysql::point_historique(array('jour_ajoutees' => json_encode($obj2), 'jour_ajoutees_feries' => json_encode($obj), 'debut' => $date_debut_historique, 'fin' => $date_fin_historique, 'categorie' => $liste_cat_planning, 'team' => $vetos2));
             //		$point_historique = json_encode([[],[],[],[],[],[]]);
         } else {
             if ($cas == 2) {
                 $point_historique = json_encode([[], [], [], [], [], [], [], [], []]);
             }
         }
     } else {
         $point_historique = json_encode([[], [], [], [], [], [], [], [], []]);
     }
     /**
      * array of day's number for exemple minimum interval between two penalty
      *
      * @var $liste_entre_2
      */
     $liste_entre_2 = array(array('nom' => TXT_CHARGEMENT_CONTROLLER_NOTIMELIMIT, 'valeur' => 0), array('nom' => "1" . " " . TXT_CHARGEMENT_CONTROLLER_DAY, 'valeur' => 1), array('nom' => "2" . " " . TXT_CHARGEMENT_CONTROLLER_DAYS, 'valeur' => 2), array('nom' => "3" . " " . TXT_CHARGEMENT_CONTROLLER_DAYS, 'valeur' => 3), array('nom' => "4" . " " . TXT_CHARGEMENT_CONTROLLER_DAYS, 'valeur' => 4), array('nom' => "5" . " " . TXT_CHARGEMENT_CONTROLLER_DAYS, 'valeur' => 5), array('nom' => "6" . " " . TXT_CHARGEMENT_CONTROLLER_DAYS, 'valeur' => 6), array('nom' => "7" . " " . TXT_CHARGEMENT_CONTROLLER_DAYS, 'valeur' => 7), array('nom' => "10" . " " . TXT_CHARGEMENT_CONTROLLER_DAYS, 'valeur' => 10), array('nom' => "15" . " " . TXT_CHARGEMENT_CONTROLLER_DAYS, 'valeur' => 15), array('nom' => "21" . " " . TXT_CHARGEMENT_CONTROLLER_DAYS, 'valeur' => 21), array('nom' => "30" . " " . TXT_CHARGEMENT_CONTROLLER_DAYS, 'valeur' => 30), array('nom' => "45" . " " . TXT_CHARGEMENT_CONTROLLER_DAYS, 'valeur' => 45), array('nom' => "60" . " " . TXT_CHARGEMENT_CONTROLLER_DAYS, 'valeur' => 60), array('nom' => "90" . " " . TXT_CHARGEMENT_CONTROLLER_DAYS, 'valeur' => 90));
     /**
      * array of month's number for equalized number of jobs between team
      *
      * @var $liste_memoire
      */
     $liste_memoire = array(array('nom' => TXT_CHARGEMENT_CONTROLLER_NOMONTHLIMIT, 'valeur' => 0), array('nom' => "1" . " " . TXT_CHARGEMENT_CONTROLLER_MONTH, 'valeur' => 1), array('nom' => "2" . " " . TXT_CHARGEMENT_CONTROLLER_MONTH, 'valeur' => 2), array('nom' => "6" . " " . TXT_CHARGEMENT_CONTROLLER_MONTH, 'valeur' => 6), array('nom' => "12" . " " . TXT_CHARGEMENT_CONTROLLER_MONTH, 'valeur' => 12), array('nom' => "24" . " " . TXT_CHARGEMENT_CONTROLLER_MONTH, 'valeur' => 24));
     /**
      * array of choice to gather or split teamm (conflicting or wedding)
      * @var array $liste_action
      */
     $liste_action = array(array('nom' => TXT_CHARGEMENT_CONTROLLER_NEVER, 'valeur' => 1), array('nom' => TXT_CHARGEMENT_CONTROLLER_ALLWAYS, 'valeur' => 2));
     $mon_texte = array('incomptabilite' => TXT_CHARGEMENT_CONTROLLER_INCOMPTABILITY, 'begin' => TXT_CHARGEMENT_CONTROLLER_BEGIN, 'end' => TXT_CHARGEMENT_CONTROLLER_END, 'paire' => TXT_CHARGEMENT_CONTROLLER_WEDDING, 'impossible_select1' => TXT_CHARGEMENT_CONTROLLER_IMPOSSIBLE_SELECT1, 'impossible_select2' => TXT_CHARGEMENT_CONTROLLER_IMPOSSIBLE_SELECT2, 'impossible_select3' => TXT_CHARGEMENT_CONTROLLER_IMPOSSIBLE_SELECT3, 'impossible_select4' => TXT_CHARGEMENT_CONTROLLER_IMPOSSIBLE_SELECT4, 'impossible_select5' => TXT_CHARGEMENT_CONTROLLER_IMPOSSIBLE_SELECT5, 'mail_send' => TXT_CHARGEMENT_CONTROLLER_MAIL_SEND, 'shift_created' => TXT_CHARGEMENT_CONTROLLER_SHIFT_CREATED, 'personnal_data_changed' => TXT_CHARGEMENT_CONTROLLER_PERSONNAL_DATA_CHANGED, 'log_in_ok' => TXT_CHARGEMENT_CONTROLLER_LOG_IN_OK);
     if (isset($_SESSION['login2'])) {
         $login = $_SESSION['login2'];
     } else {
         $login = "";
     }
     return array('staff3' => $vetos3, 'interval_for_unavailable' => $interval_for_unavailable, 'date_deb_unavailable' => $date_deb_unavailable, 'date_fin_unavailable' => $date_fin_unavailable, 'limit_number_unavailable' => $limit_number_unavailable, 'max_unavailable' => $max_unavailable, 'limit_pourcent_unavailable' => $limit_pourcent_unavailable, 'pourcent_unavailable' => $pourcent_unavailable, 'couleur_limit_unavailable' => $couleur_limit_unavailable, 'memoire2' => $memoire2, 'memoire3' => $memoire3, 'absent' => $absent, 'staff2' => $vetos2, 'jour_ajoutees' => $jour_ajoutees, 'liste_cat_planning' => $liste_cat_planning, 'liste_jour' => $liste_jour, 'liste_jour_fin' => $liste_jour_fin, 'liste_heure' => $liste_heure, 'liste_moment' => $liste_moment, 'compteur' => $compteur, 'mois' => $month, 'staff' => $vetos, 'liste_jour_short' => $liste_jour_short, 'historique' => $historique, 'jour_ajoutees_feries' => $jour_ajoutees_feries, 'jour_ajoutees' => $jour_ajoutees, 'liste_entre_2' => $liste_entre_2, 'liste_memoire' => $liste_memoire, 'delais' => $delais, 'memoire' => $memoire, 'point_historique' => $point_historique, 'couleur_entre_deux' => $couleur_entre_deux, 'couleur_absent' => $couleur_absent, 'couleur_max' => $couleur_max, 'liste_action' => $liste_action, 'team_action' => $team_action, 'mot_recherche' => TXT_CHARGEMENT_REPARTITION3, 'login' => $login, 'couleur_wedding' => $couleur_wedding, 'couleur_clash' => $couleur_clash, 'mon_texte' => $mon_texte);
 }