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($login_veto, $tour_veto, $choix) { $list_tel_part = requetemysql::search_list_tel_part($login_veto); if (empty($list_tel_part)) { throw new Exception("Error in tel_list_part function, param" . $login_veto); } $list_cam_ip = requetemysql::search_list_cam_ip($login_veto); if (empty($list_cam_ip)) { throw new Exception("Error in search_list_cam_ip function, param" . $login_veto); } $mes_infos = requetemysql::mes_infos3($login_veto); if (empty($mes_infos)) { throw new Exception("Error in mes_infos3 function, param " . $login_veto); } $mes_infos_array = json_decode($mes_infos, true); if ($mes_infos_array[0]['tour'] != $_SESSION['login2'] && $choix == 2) { throw new Exception("Vous n'êtes pas autorisé à voir ces informations"); } $info_tour = requetemysql::info_tour(array('login' => $tour_veto)); if (empty($info_tour)) { throw new Exception("Aucun tour dans la base de donnée !"); } $info_tour_array = json_decode($info_tour, true); $garde_dispo_affichage = 0; $garde_dispo = array(); $parti_deco = json_decode($info_tour_array[0]['participant']); foreach ($parti_deco as $obj) { if ($obj->login == $login_veto) { $garde_dispo_affichage = 1; $garde_dispo_new = array(login => $obj->login, jour_evi => $obj->jour_evi, jour_evi2 => $obj->jour_evi2); array_push($garde_dispo, $garde_dispo_new); } } $info_tour_array[0]['participant'] = json_encode($garde_dispo); $garde_vac = array(); $vac_deco = json_decode($info_tour_array[0]['vacances']); foreach ($vac_deco as $obj) { if ($obj->login == $login_veto) { array_push($garde_vac, $obj); } } // while (list($key, $value) = each($info_tour_array[0]['vacances'])) // { // if($value['login']==$_SESSION['login2']){ // array_push($garde_vac, $value); // } // } $info_tour_array[0]['vacances'] = json_encode($garde_vac); $info_tour_array[0]['importance'] = '[]'; $info_tour_array[0]['liaison'] = '[]'; $info_tour_array = json_encode($info_tour_array); $mes_specialites = requetemysql::mes_specialites2($login_veto); if (empty($mes_specialites)) { throw new Exception("Error in mes_specialites function, no param"); } $tarif = requetemysql::info_tarif3($login_veto); if (empty($tarif)) { throw new Exception("Error in info_tarif function, no param"); } $tarif = json_decode($tarif); $tarif2 = requetemysql::info_tarif4($login_veto); while (list($key_paiement, $value_paiement) = each($tarif)) { $tarif[$key_paiement]->id_select = $key_paiement; } $tarif = json_encode($tarif); if (empty($tarif2)) { throw new Exception("Error in info_tarif2 function, no param"); } $tarif2 = json_decode($tarif2); while (list($key_paiement, $value_paiement) = each($tarif2)) { $tarif2[$key_paiement]->id_select = $key_paiement; } $tarif2 = json_encode($tarif2); $tarif_medoc = requetemysql::info_tarif_medoc2($login_veto); if (empty($tarif_medoc)) { throw new Exception("Error in info_tarif_medoc function, no param"); } $tarif_medoc = json_decode($tarif_medoc); while (list($key_medoc, $value_medoc) = each($tarif_medoc)) { $tarif_medoc[$key_medoc]->id_select = $key_medoc; } $tarif_medoc = json_encode($tarif_medoc); $sms_param = requetemysql::sms_param($login_veto); if (empty($sms_param)) { throw new Exception("Error in sms_param function, param : login"); } $sms_historique = requetemysql::sms_historique($login_veto); if (empty($sms_historique)) { throw new Exception("Error in sms_historique function, param : login"); } $mail_historique = requetemysql::mail_historique($login_veto); if (empty($mail_historique)) { throw new Exception("Error in mail_historique function, param : login"); } $superviseur = requetemysql::superviseur($login_veto); if (empty($superviseur)) { throw new Exception("Error in superviseur function, param : login"); } $mes_infos_array = json_decode($mes_infos, true); $mes_infos_array2 = json_decode($superviseur, true); $mes_infos_array[0]['superviseur'] = $mes_infos_array2[0]['manager_tour']; $mes_infos = json_encode($mes_infos_array); $liste_specialite = array(array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_GENERALSURGERY), array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_BEHAVIOR), array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_ULTRASOUND), array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_ULTRASOUNDHEART), array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_ENDOSCOPY), array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_HORSE), array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_INTERNALMEDICINE), array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_NEWPET), array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_OPHTALMOLOGY), array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_ORTHOPEDY), array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_SCANNER)); $liste_conduite = array(array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_RETURNTOME), array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_GOTOTHESPECIALISTNOPB), array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_GOTOTHESPECIALISTFORSURGERY), array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_GOTOTHESPECIALISTFORRADIOGRAPHY), array(nom => TXT_MODIFICATIONMEMBRE_CONTROLLER_GOTOTHESPECIALISTIFMOREPERSONNALNEED)); render('_modificationmembre', array('title' => TXT_MODIFICATIONMEMBRE_CONTROLLER_ABOUTME, 'mes_infos' => $mes_infos, 'liste_specialite' => $liste_specialite, 'liste_conduite' => $liste_conduite, 'tarif' => $tarif, 'tarif2' => $tarif2, 'mes_specialite' => $mes_specialites, 'tarif_medoc' => $tarif_medoc, 'garde_dispo_affichage' => $garde_dispo_affichage, 'info_tour_array' => $info_tour_array, 'login_veto' => $login_veto, 'list_tel_part' => $list_tel_part, 'tour_veto' => $tour_veto, 'sms_param' => $sms_param, 'sms_historique' => $sms_historique, 'mail_historique' => $mail_historique, 'list_cam_ip' => $list_cam_ip)); }
if (count($tarif_medic) > 0) { $sql = "INSERT INTO `medicament` (`nom`, `centrale`, `prixht`, `lot`, `permission`) VALUES "; $qPart = array_fill(0, count($tarif_medic), "(?, ?, ?, ?, ?)"); $sql .= implode(",", $qPart); $stmt = $db->prepare($sql); $i = 1; foreach ($tarif_medic as $item) { $stmt->bindParam($i++, $item['nom']); $stmt->bindParam($i++, $item['centrale']); $stmt->bindParam($i++, $item['prixht']); $stmt->bindParam($i++, $item['lot']); $stmt->bindParam($i++, $login_veto); } $stmt->execute(); } $info_tour = requetemysql::info_tour(array('login' => $tour_veto)); if (empty($info_tour)) { throw new Exception("Erreur dans la fonction info_tour de requetemysql.php"); } $info_tour_array = json_decode($info_tour, true); if (count($info_tour_array) != 0) { $parti_deco = json_decode($info_tour_array[0]['participant']); while (list($key, $value) = each($parti_deco)) { if ($value->login == $indispo['login']) { $parti_deco[$key]->jour_evi = $indispo['jour_evi']; $parti_deco[$key]->jour_evi2 = $indispo['jour_evi2']; } } $parti_deco_enco = json_encode($parti_deco); // while (list($key, $value) = each($info_tour_array['participant'])) // {