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)); }
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(); } }