public function zone_agenda($id_c, $choix) { try { if ($id_c != 0) { $animal = requetemysql::findunanimal2(array('id_ani' => $id_c)); if (empty($animal)) { throw new Exception("Error in findunanimal2 function ! param : id_ani: " + $id_c); } } else { $animal = json_encode($id_c); } // liste des vétos du tour de garde $vetos = requetemysql::listevetos(); if (empty($vetos)) { throw new Exception("Error in listevetos fonction !"); } if ($choix == "week") { render('_agenda', array('title' => 'Agenda partagé du tour de garde', 'animal' => $animal, 'liste_vetos' => $vetos)); } elseif ($choix == "day") { render('_agenda2', array('title' => 'Agenda du ' + date("d/m/y"), 'animal' => $animal, 'liste_vetos' => $vetos)); } } catch (Exception $e) { echo $e->getMessage(); } }
public function execute($input) { $chargement_seconde_partie = requetemysql::chargement_seconde_partie(array('permission' => $_SESSION['login2'])); $chargement_seconde_partie = json_decode($chargement_seconde_partie, true); $vetos3 = requetemysql::listevetos(); $chargement_seconde_partie[0]['staff3'] = $vetos3; // do something return $chargement_seconde_partie[0]; }
public function execute($input) { if (!empty($_SESSION['login'])) { /** @var array $vetos list the staff and caracteristic like adress, tel, email... */ $vetos = requetemysql::listevetos(); $vetos = json_decode($vetos, true); } else { $vetos = array(); } // do something return $vetos; }
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 historique($id_consult, $origin) { $mes_infos = requetemysql::mes_infos(); if (empty($mes_infos)) { throw new Exception("Vous êtes introuvables dans la bdd identification!"); } $mes_infos = json_decode($mes_infos, true); $tva = $mes_infos[0]['tva']; $marge_medic = $mes_infos[0]['marge']; $mes_infos2 = requetemysql::mes_infos2(); if (empty($mes_infos2)) { throw new Exception("Vous êtes introuvables dans la bdd identification!"); } $mes_infos2 = json_decode($mes_infos2, true); $afficher_facture = $mes_infos2[0]['facture']; $afficher_resume = $mes_infos2[0]['resume']; $salle_attente = requetemysql::recup_element_consult($id_consult); if (empty($salle_attente)) { throw new Exception("Aucun animal dans la salle d'attente !"); } $salle_attente2 = json_decode($salle_attente, true); $id_pro = $salle_attente2[0]['id_pro']; $id_ani = $salle_attente2[0]['id_ani']; $animal = requetemysql::findunanimal(array('id_pro' => $id_pro, 'id_ani' => $id_ani)); if (json_decode($animal) == '') { header('HTTP/1.1 403 Forbidden'); exit(utf8_decode("Cette consultation n'existe plus. Elle a déjà été modifiée par le vétérinaire qui en est responsable. Elle porte maintenant un autre numéro.")); //throw new Exception("Aucun animal de cet id dans la base de donnée !"); } $veto_repartition = requetemysql::repartition(array('id_consult' => $id_consult)); if (empty($veto_repartition)) { throw new Exception("Erreur dans la recherche de la répartition des honoraires"); } $historique = requetemysql::historique(array('id' => $id_ani)); if (empty($historique)) { throw new Exception("Erreur dans la recherche des antécédents de l animal"); } $client = requetemysql::findunclient(array('id' => $id_pro)); if (empty($client)) { throw new Exception("Aucun client dans la base de donnée !"); } $animal2 = json_decode($animal, true); $datenais = $animal2[0]['datenais']; $tarif = requetemysql::info_tarif(); if (empty($tarif)) { throw new Exception("Aucun tarif dans la base de donnée !"); } // recherche dans la base de donnee les differents règlements pour le client $restedu = requetemysql::restedu(array('id_pro' => $id_pro)); if (empty($restedu)) { throw new Exception("Pas de règlement dans la base"); } $vetos = requetemysql::listevetos(); if (empty($vetos)) { throw new Exception("Pas de vetos dans la base"); } $liste_resume = array(array(nom => "Vaccin", valeur => 5), array(nom => "Gastrite", valeur => 3), array(nom => "Enterite", valeur => 4), array(nom => "Abattement", valeur => 2), array(nom => "boiterie", valeur => 4), array(nom => "Certificat", valeur => 1), array(nom => "Anorexie", valeur => 3), array(nom => "Otite", valeur => 2), array(nom => "Piroplasmose", valeur => 2), array(nom => "Epillet oreille", valeur => 3), array(nom => "Ovarioectomie", valeur => 1), array(nom => "Castration", valeur => 1), array(nom => "Difficultés respiratoires", valeur => 1), array(nom => "Cardiaque", valeur => 3), array(nom => "Achat", valeur => 5), array(nom => "Arthrose", valeur => 3)); $liste_motif_relance = array(array(nom => "Vaccin", valeur => 1), array(nom => "Anovulatoire", valeur => 2), array(nom => "Vermifuge", valeur => 3)); $liste_analyse = array(array(nom => "Urée", unite => "g/l", base => "< 0.7g/l", methode => "reflotron"), array(nom => "Glucose", unite => "g/l", base => "< 1.3g/l", methode => "reflotron"), array(nom => "PAL", unite => "UI/l", base => "< 200UI/l", methode => "reflotron"), array(nom => "Globules Blancs", unite => "m/l", base => "< 15000m/l", methode => "MS4"), array(nom => "Hémathocrite", unite => "g/l", base => "> 8g/l", methode => "MS4")); $liste_radio = array(array(nom => "thorax profil petit chien", kV => "70", mAS => "5", sec => "5"), array(nom => "abdomen face petit chien", kV => "80", mAS => "10", sec => "6"), array(nom => "Carpe gros chien", kV => "20", mAS => "3", sec => "7"), array(nom => "bassin petit chat", kV => "60", mAS => "7", sec => "8")); // $efface_salle_attente = requetemysql::supr_salle_attente($id_attente); // if(empty($efface_salle_attente)){ // throw new Exception("Effaçage de la salle d attente impossible !"); // } render('_nouvelleconsultation', array('title' => 'Fiche Animal', 'id_pro' => $id_pro, 'id_ani' => $id_ani, 'animal' => $animal, 'client' => $client, 'origin' => $origin, 'liste_resume' => $liste_resume, 'liste_motif_relance' => $liste_motif_relance, 'liste_analyse' => $liste_analyse, 'liste_radio' => $liste_radio, 'liste_vetos' => $vetos, 'veto' => $_SESSION['login'], 'historique' => $historique, 'datenaissance' => $datenais, 'tarif' => $tarif, 'tva' => $tva, 'restedu' => $restedu, 'marge_medic' => $marge_medic, 'afficher_facture' => $afficher_facture, 'afficher_resume' => $afficher_resume, 'salle_attente_donnee' => $salle_attente, 'themechargement' => 'b', 'cas' => 'historique', 'consult' => $id_consult, 'veto_repartition' => $veto_repartition, 'liste_tournures' => ordo_settings_tourn(), 'liste_cat_delivre' => ordo_settings_cat(), 'info_veto' => info_clini(), 'textechargement' => 'enregistrement en cours')); }
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(); } }
/** * 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); }