Exemple #1
0
function heure_simple($str)
{
    $date = new clDate($str);
    $hours = $date->getHours();
    $mins = 15 * floor($date->getMinutes() / 15);
    return two_dec($hours) . ':' . two_dec($mins);
}
Exemple #2
0
function heure_moins_trois()
{
    $date = new clDate('');
    $date->addHours(-3);
    $hours = $date->getHours();
    $mins = 15 * floor($date->getMinutes() / 15);
    return two_dec($hours) . ':' . two_dec($mins);
}
function get_heure_pecm_default($formx)
{
    global $patient;
    $dateArrivee = new clDate($patient->getDateAdmission());
    $dateArrivee->addHours(1);
    $hours = $dateArrivee->getHours();
    $mins = 15 * floor($dateArrivee->getMinutes() / 15);
    return two_dec($hours) . ':' . two_dec($mins);
}
Exemple #4
0
 function __construct()
 {
     $date = new clDate();
     $this->af .= "<div style=\"padding:20px 40px 40px 40px;\"><h4>Alertes automatiques</h4>";
     if (($date->getHours() == "7" or $date->getHours() == "15") and $date->getMinutes() == 0) {
         $this->launchAES();
         $this->af .= "Lancement des alertes AES : automatique à 7h et 15h.";
     } else {
         $this->af .= "Lancement des alertes AES : automatique à 7h et 15h.";
         //$this->launchAES ( ) ;
     }
     $this->af .= "<div/>";
 }
Exemple #5
0
 function checkImport()
 {
     global $options;
     // Si nous sommes en mode manuel, on vérifie seulement que l'option d'import est activée.
     if ($this->type) {
         if ($options->getOption("ImportsAutomatiques")) {
             return 1;
         }
     } else {
         // Lancement automatique des alertes
         $al = new clAlertes();
         // Sinon, on vérifie que l'interval entre deux exécutions automatiques est respecté.
         $date = new clDate();
         // Conversion en minutes
         $secs = 60 * $date->getHours() + $date->getMinutes();
         // Purge journalière des répertoires.
         if ($date->getHours() == 1 and $date->getMinutes() == 0) {
             $purge = new clPurge();
         }
         // Données ARH
         if ($date->getHours() == $options->getOption("ARH_Heure") and $options->getOption("ARH_Actif") and $date->getMinutes() == 0) {
             $arh = new clEnvoiARH();
         }
         // RPU
         if ($date->getHours() == $options->getOption("RPU_Heure") and $options->getOption("RPU_Actif") and $date->getMinutes() == 0) {
             $_REQUEST['EnvoyerRPU'] = 1;
             $rpu = new clRPU();
         }
         // Calcul avec un modulo de l'interval requis... et on vérifie que l'option est bien activée.
         if (!($secs % $options->getOption("ImportsDelai")) and $options->getOption("ImportsAutomatiques")) {
             return 1;
         }
     }
 }
Exemple #6
0
 function genBlocEtatCivil($nomBloc, $mod, $droit, $date = '', $sortie = '')
 {
     global $session;
     global $options;
     // Initialisation des objets et des variables utilisées.
     // Pour générer des formulaires plus loin.
     $form = new clForm();
     // Date d'exécution.
     $now = new clDate();
     // Récupération des options.
     $retourmax = $options->getOption("Dates Patient");
     $tranches = $options->getOption("DatesDécoup Patient");
     // Récupération de la valeur actuelle du bloc.
     $res = '';
     eval("\$res = \$this->patient->get{$nomBloc} ( ) ;");
     // Si une date a été transmise et qu'elle n'est pas nulle, on initialise $res avec cette valeur.
     if ($date) {
         if ($res != "0000-00-00 00:00:00") {
             $res = $date->getDate("d-m-Y H:i");
         } else {
             $res = '';
         }
     }
     // Si toutes ces conditions sont réunies, alors on fait transiter le patient sorti vers la table des patients présents.
     if ($session->getNavi(3) == "mod" . $nomBloc and ($_POST['AnnulerSortie'] or $_POST['AnnulerSortie_x']) and $session->getDroit($this->type . "_EtatCivil", $droit)) {
         $modif = "0000-00-00 00:00:00";
         $this->patient->setAttribut($nomBloc, $modif);
         $this->patient = new clPatient($this->idpatient, "Sortis");
         $this->patient->entrerPatient();
         if ($options->getOption("Module_CCAM")) {
             $ccam = new clCCAMCotationActesDiags($this->paramCCAM);
             $ccam->deleteBAL();
             if ($options->getOption('HprimXML_Actif')) {
                 $hprimXml = new clHprimXML();
             }
         }
         $res = "";
         // Si ces conditions sont réunies, alors on change la date du champs avec la valeur transmise.
     } elseif ($session->getNavi(3) == "mod" . $nomBloc and ($_POST['Valider'] or $_POST['Valider_x']) and $session->getDroit($this->type . "_EtatCivil", $droit)) {
         if ($date) {
             if ($_POST['ValiderMaintenant'] or $_POST['ValiderMaintenant_x']) {
                 $newdate = new clDate();
             } elseif ($_POST["mod" . $nomBloc] == "now") {
                 $newdate = new clDate();
             } else {
                 $newdate = new clDate($_POST["mod" . $nomBloc]);
             }
             $modif = $newdate->getDatetime();
             $res = $newdate->getDate("d-m-Y H:i");
             // Si le paramètre $sortie est vrai, alors on fait transiter le patient présent vers la table des patients sortis.
             if ($sortie) {
                 $this->patient->setAttribut($nomBloc, $modif);
                 $this->patient = new clPatient($this->idpatient, "Presents");
                 clFoRmX_manip::rangerDossMedChrono($this->patient);
                 clFoRmX_manip::rangerDossMedAEV($this->patient);
                 $this->patient->sortirPatient();
                 if ($options->getOption("Module_CCAM")) {
                     $this->paramCCAM["dtFinInterv"] = $this->patient->getDateSortie();
                     $ccam = new clCCAMCotationActesDiags($this->paramCCAM);
                     $ccam->writeBALSorti();
                     if ($options->getOption('HprimXML_Actif')) {
                         $hprimXml = new clHprimXML();
                     }
                 }
                 $this->rien = "sortie";
             }
             // Dans le dernier cas, il s'agit d'un bloc de type "textarea" tout simple à mettre à jour.
         } else {
             $modif = $_POST["mod" . $nomBloc];
             $res = $modif;
         }
         // Mise à jour du patient.
         $session->setLogSup("Modification du bloc {$nomBloc}");
         $this->patient->setAttribut($nomBloc, $modif);
         $this->patient = new clPatient($this->idpatient, $this->type);
         // Dans ce cas, nous devons afficher le formulaire adéquate à la modification du bloc.
     } elseif ($session->getNavi(3) == "mod" . $nomBloc and !$_POST['Annuler'] and !$_POST['Annuler_x']) {
         // Cas des champs de type date.
         $session->setLogSup("Demande de modification du bloc {$nomBloc}");
         if ($date) {
             if ($sortie and $this->patient->getDateExamen() != '0000-00-00 00:00:00') {
                 $dateMin = new clDate($this->patient->getDateExamen());
             } else {
                 $dateMin = new clDate($this->patient->getDateAdmission());
             }
             $dateNow = new clDate();
             if ($tranches >= 5) {
                 $minutes = $dateNow->getMinutes();
                 $minutesless = $minutes % 5;
                 $dateNow->addMinutes(-$minutesless);
             }
             $data[now] = 'Maintenant';
             $min = $dateMin->getTimestamp();
             $t = $dateNow->getTimestamp();
             $data[$t] = $dateNow->getDate("d-m-Y H:i");
             // On limite la taille du select
             $d1 = new clDate();
             $d2 = new clDate($dateMin->getDatetime());
             $duree = new clDuree($d1->getDifference($d2));
             $duree->invertNegatif();
             //if ( $duree->getDays() > 50 ) {
             //    $d1 -> addDays ( -50 ) ;
             //    $min = $d1 -> getTimestamp ( ) ;
             //}
             // On parcourt les dates en fonctions des options.
             for ($i = 0; $dateNow->getTimestamp() >= $min; $i += $tranches) {
                 $t = $dateNow->getTimestamp();
                 $data[$t] = $dateNow->getDate("d-m-Y H:i");
                 $dateNow->addMinutes(-$tranches);
             }
             $f .= $res . "<br />" . $form->genForm(URL);
             /*
             // Préparation de la première date de la liste.
             $now -> addHours ( -$retourmax ) ;
             $min = $now -> getTimestamp ( ) ;
             $now -> addHours ( $retourmax ) ;
             if ( $tranches >= 5 ) {
             	  		$minutes = $now -> getMinutes ( ) ;
             	  		$minutesless = ( $minutes % 5 ) ;
             	  		$now -> addMinutes ( -$minutesless ) ;
             }
             $data[now] = 'Maintenant' ;
             $t = $now -> getTimestamp ( ) ;
             $data[$t] = $now -> getDate ( "d-m-Y H:i" ) ;
             // On parcourt les dates en fonctions des options.
             for ( $i = 0 ; $now -> getTimestamp ( ) >= $min ; $i += $tranches ) {
             	  		$t = $now -> getTimestamp ( ) ;
             	  		$data[$t] = $now -> getDate ( "d-m-Y H:i" ) ;
             	  		$now -> addMinutes ( -$tranches ) ;
             }
             $f .= $res."<br />".$form -> genForm ( URL ) ;
             */
             // S'il ne s'agit pas de la date de sortie et que le patient est sorti,
             // alors on affiche le select contenant la liste des dates possibles.
             if (!($this->type == "Sortis" and $sortie)) {
                 $f .= $form->genSelect("mod" . $nomBloc, 1, $data);
             }
         } else {
             // Cas d'un formulaire de type "textarea" tout simple.
             $f .= $form->genForm(URL);
             $f .= $form->genTextArea("mod" . $nomBloc, $res) . "<br /><center>";
         }
         // Cas d'une date.
         if ($date) {
             // Cas de la date de sortie.
             if ($sortie) {
                 // Cas d'un patient déjà sorti : On affiche seulement un bouton d'annulation de sortie.
                 if ($this->type == "Sortis") {
                     $f .= $form->genImage("AnnulerSortie", "Annuler la sortie", URLIMG . "annulerSortie.gif");
                     $f .= $form->genHidden("navi", $session->genNavi("Liste_Presents", $session->getNavi(1), $session->getNavi(2), "mod" . $nomBloc));
                     $f .= $form->genEndForm();
                     // $f .= $form -> genForm ( URL ) ;
                     // $f .= $form -> genImage ( "RetourPatient", "Retour du patient", URLIMGRET ) ;
                     // $f .= $form -> genHidden ( "navi", $session->genNavi ( "Liste_Presents", $this->patient->getID ( ) ) ) ;
                     // Dans les autres cas, on affiche les boutons de validation / annulation de la sortie.
                 } else {
                     $contraintes = new clContraintes($this->patient->getID(), $this->paramCCAM);
                     //formulaire(s) à remplir bloquant la sortie ( pré-contraintes ) ?
                     if (clTuFormxTrigger::getWatcher($this->patient)->isTriggersOnOut()) {
                         $enquetes = clTuFormxTriggerWatcher::getInstance($this->patient);
                         $enquetes->launchTriggersOnOut();
                         //eko("trigers lances, sortie de la fenetre bloquante");
                         return '';
                     } else {
                         if (clTuFormxTrigger::getWatcher($this->patient)->isTriggersWaitingForLauch()) {
                             //eko("watchers en cours, sortie de la fenetre bloquante");
                             return '';
                         } else {
                             if ($contraintes->runCheck()) {
                                 $f .= $form->genImage("Valider", "Valider", URLIMGVAL, 'style="border: 0px; background-color: #FFFF99;"');
                                 $f .= $form->genHidden("navi", $session->genNavi($session->getNavi(0), $session->getNavi(1), $session->getNavi(2), "mod" . $nomBloc));
                                 $f .= $form->genEndForm();
                                 $f .= $form->genForm(URL);
                                 $f .= $form->genImage("Annuler", "Annuler", URLIMGANN, 'style="border: 0px; background-color: #FFFF99;"');
                                 $f .= $form->genHidden("navi", $session->genNavi($session->getNavi(0), $session->getNavi(1), $session->getNavi(2), "mod" . $nomBloc));
                             } else {
                                 $session->setLogSup('Contraintes non respectées pour la sortie');
                                 $this->af .= $contraintes->getContraintes();
                             }
                         }
                     }
                 }
                 // Cas d'un champs date normal : affichage des boutons valider et annuler.
             } else {
                 $f .= $form->genImage("Valider", "Valider", URLIMGVAL, 'style="border: 0px; background-color: #FFFF99;"');
                 $f .= $form->genHidden("navi", $session->genNavi($session->getNavi(0), $session->getNavi(1), $session->getNavi(2), "mod" . $nomBloc));
                 $f .= $form->genEndForm();
                 $f .= $form->genForm(URL);
                 $f .= $form->genImage("Annuler", "Annuler", URLIMGANN, 'style="border: 0px; background-color: #FFFF99;"');
                 $f .= $form->genHidden("navi", $session->genNavi($session->getNavi(0), $session->getNavi(1), $session->getNavi(2), "mod" . $nomBloc));
             }
             // Cas d'un champs normal : affichage des boutons valider et annuler.
         } else {
             $f .= $form->genImage("Valider", "Valider", URLIMGVAL, 'style="border: 0px; background-color: #FFFF99;"');
             $f .= $form->genHidden("navi", $session->genNavi($session->getNavi(0), $session->getNavi(1), $session->getNavi(2), "mod" . $nomBloc));
             $f .= $form->genEndForm();
             $f .= $form->genForm(URL);
             $f .= $form->genImage("Annuler", "Annuler", URLIMGANN, 'style="border: 0px; background-color: #FFFF99;"');
             $f .= $form->genHidden("navi", $session->genNavi($session->getNavi(0), $session->getNavi(1), $session->getNavi(2), "mod" . $nomBloc));
         }
         // On ferme la balise du formulaire.
         $f .= "</center>" . $form->genEndForm();
         // On modifie le bloc ModeliXe passé en paramètres.
         $mod->MxText($nomBloc, $f);
         // On signale que le bloc a été modifié.
         $af = 1;
     }
     // S'il n'y a pas eu d'affichage jusqu'à maintenant, il ne s'agit que d'afficher la valeur contenue dans ce bloc.
     if (!$af) {
         // Si le droit de modification est présent, alors nous affichons le lien pour modifier le bloc.
         if ($session->getDroit($this->type . "_EtatCivil", $droit)) {
             if ($date) {
                 $image = URLIMGHOR;
             } else {
                 $image = URLIMGMOD;
             }
             if ($nomBloc == "DateExamen" and $_POST['Medecin'] and $this->patient->getDateExamen() == "0000-00-00 00:00:00" and !$this->patient->getMedecin()) {
                 $date = new clDate();
                 $dateA = new clDate($this->patient->getDateAdmission());
                 if ($date->getTimestamp() > $dateA->getTimestamp()) {
                     $this->patient->setAttribut("DateExamen", $date->getDatetime());
                     $res = $date->getDate("d-m-Y H:i");
                 } else {
                     $dateA->addSeconds(1);
                     $this->patient->setAttribut("DateExamen", $dateA->getDatetime());
                     $res = $dateA->getDate("d-m-Y H:i");
                 }
             }
             if ($nomBloc == "DateExamen" and isset($_POST['Medecin']) and !$_POST['Medecin']) {
                 $this->patient->setAttribut("DateExamen", "0000-00-00 00:00:00");
                 $res = "--";
             }
             if (!$this->export) {
                 if ($nomBloc == "DateSortie") {
                     $retour = '';
                     if ($options->getOption('EnqueteRadio')) {
                         $retour = clListeRadios::getRetour($this->patient->getID(), IDAPPLICATION);
                     }
                     if ($retour) {
                         $mod->MxText("retourRadio", $retour);
                     } else {
                         $questionSortie = $this->getQuestionSortie();
                         if ($questionSortie) {
                             $mod->MxText("retourRadio", $questionSortie);
                         } else {
                             $mod->MxImage("imgModifier" . $nomBloc, $image, "Modifier {$nomBloc}");
                             $mod->MxUrl("lien" . $nomBloc, URLNAVI . $session->genNavi($session->getNavi(0), $session->getNavi(1), $session->getNavi(2), "mod" . $nomBloc));
                         }
                     }
                 } else {
                     $mod->MxImage("imgModifier" . $nomBloc, $image, "Modifier {$nomBloc}");
                     $mod->MxUrl("lien" . $nomBloc, URLNAVI . $session->genNavi($session->getNavi(0), $session->getNavi(1), $session->getNavi(2), "mod" . $nomBloc));
                 }
             }
         }
         // Affichage du contenu du bloc s'il existe sinon on affiche la valeur par défaut.
         if ($res) {
             $mod->MxText($nomBloc, nl2br($res));
         } else {
             $mod->MxText($nomBloc, VIDEDEFAUT);
         }
     }
 }
Exemple #7
-1
 function getContraintes()
 {
     global $session;
     global $options;
     // Chargement du template.
     $mod = new ModeliXe("ErreursSortie.mxt");
     $mod->SetModeliXe();
     // Génération du lien pour fermer.
     $mod->MxImage("imgCloseErreurs", URLIMGFER, "Fermer");
     $mod->MxUrl("lienCloseErreurs", URLNAVI . $session->genNavi($session->getNavi(0), $session->getNavi(1), $session->getNavi(2)));
     // Variable de navigation.
     $mod->MxHidden("hidden", "navi=" . $session->genNavi($session->getNavi(0), $session->getNavi(1), $session->getNavi(2)));
     $tab = $this->messages;
     // Parcours et affichage des messages d'erreur.
     while (list($key, $val) = each($tab)) {
         $mod->MxText("erreur.nom", $key);
         $mod->MxText("erreur.description", $val);
         $mod->MxBloc("erreur", "loop");
     }
     if ($session->getDroit("Presents_EtatCivil", "a")) {
         $mod->MxHidden("forcer.hiddenForcer", "navi=" . $session->genNavi($session->getNavi(0), $session->getNavi(1), $session->getNavi(2), "modDateSortie"));
         // Pour générer des formulaires plus loin.
         $form = new clForm();
         // Date d'exécution.
         $now = new clDate();
         // Récupération des options.
         $retourmax = $options->getOption("Dates Patient");
         $tranches = $options->getOption("DatesDécoup Patient");
         // Préparation de la première date de la liste.
         $now->addHours(-$retourmax);
         $min = $now->getTimestamp();
         $now->addHours($retourmax);
         if ($tranches >= 5) {
             $minutes = $now->getMinutes();
             $minutesless = $minutes % 5;
             $now->addMinutes(-$minutesless);
         }
         $data[now] = 'Maintenant';
         $t = $now->getTimestamp();
         $data[$t] = $now->getDate("d-m-Y H:i");
         // On parcourt les dates en fonctions des options.
         for ($i = 0; $now->getTimestamp() >= $min; $i += $tranches) {
             $t = $now->getTimestamp();
             $data[$t] = $now->getDate("d-m-Y H:i");
             $now->addMinutes(-$tranches);
         }
         // On génère le select contenant la liste des dates possibles.
         $mod->MxText("forcer.date", $form->genSelect("modDateSortie", 1, $data));
     } else {
         $mod->MxBloc("forcer", "modify", " ");
     }
     // Récupération du code HTML généré.
     $af .= $mod->MxWrite("1");
     return $af;
 }