コード例 #1
0
ファイル: clFoRmX_manip.php プロジェクト: jeromecc/tuv2
 function genCase($bubulle, $droit = 'form_non_spe')
 {
     global $tool;
     global $session;
     global $options;
     if ($this->droit) {
         $droit = $this->droit;
     }
     // Chargement du template ModeliXe.
     $mod = new ModeliXe("FX_blocActions.mxt");
     $mod->SetModeliXe();
     $padaction = true;
     //la en fait on ne genere pas un lien, qui serait la solution la plus simple, mais l'enjeu est de tout gerer (Post, variables de la classe...) lors de la création de la classe. On ne touche pas aux variables de navigation. Donc on va créer un champ qui - pour l'utilisateur - ressemble comme deux gouttes d'eau à un lien mais qui en fait est un appel javascript remplissant un champ caché par une variable donnée.
     $data = $this->ListFromIds(array('I', 'E', 'F'));
     if (!isset($data[id_instance][0])) {
         $mod->MxBloc('actions.frep', 'delete');
     }
     if ($session->getDroit($droit, 'r')) {
         for ($i = 0; isset($data[id_instance][$i]); $i++) {
             //chargement
             $newInstance = new clFoRmX_manip($this->ids, 'NO_POST_THREAT');
             $newInstance->loadInstance($data[id_instance][$i]);
             $xml = $newInstance->XMLCore;
             //test sur les droits
             if ($xml['access'] && !$session->getDroit(utf8_decode((string) $xml['access']), 'r')) {
                 continue;
             } elseif (!$xml['access'] && !$session->getDroit($this->droit, 'r')) {
                 continue;
             }
             $padaction = false;
             $libelle = $data[libelle][$i];
             $id = $data['idformx'][$i];
             //$creation = $tool->date_simple($data['dt_creation'][$i]) ;
             //$modif = $tool->date_simple($data['dt_modif'][$i]) ;
             $dateCr = new clDate($data['dt_creation'][$i]);
             $mod->MxText("actions.dateForm", $dateCr->getDate("d/m/y H:i"));
             if (!$libelle) {
                 $libelle = $data[idformx][$i];
             }
             switch ($data[status][$i]) {
                 case 'I':
                     $mod->MxText("actions.statut", "<span  style='color:red'>Initialisée</span>");
                     break;
                 case 'E':
                     $mod->MxText("actions.statut", "<span  style='color:orange'>En cours</span>");
                     break;
                 case 'F':
                     $mod->MxText("actions.statut", "<span  style='color:green'>Fini</span>");
                     break;
                 default:
                     $mod->MxText("actions.statut", "<span  style='color:blue'>Inconnu</span>");
                     break;
             }
             //$mod -> MxText ( "actions.creation", $creation ) ;
             //$mod -> MxText ( "actions.modif", $modif ) ;
             $mod->MxText("actions.libelle", $libelle);
             //eko($id);
             if (!eregi('Radio', $libelle) and !eregi('Bio', $libelle) and !eregi('Spécialisée', $libelle)) {
                 $mod->MxBloc('actions.frep', 'delete');
             } else {
                 if (eregi('Radio', $libelle)) {
                     $libelleC = 'radio';
                 } elseif (eregi('Bio', $libelle) && eregi('2009', $libelle)) {
                     $libelleC = 'bio2009';
                 } elseif (eregi('Bio', $libelle)) {
                     $libelleC = 'labo';
                 } else {
                     $libelleC = 'spe';
                 }
                 //$mod->Mxattribut("actions.frep.code","document.FoRmXcase.Formulaire2print.value = '".$libelleC."';document.FoRmXcase.submit();");
                 if (!$options->getOption("imprRadioRadio") && ereg('Radio', $libelle) && ereg('radio', $libelle) || !$options->getOption("imprRadioScanner") && ereg('Radio', $libelle) && ereg('scanner', $libelle) || !$options->getOption("imprRadioEcho") && ereg('Radio', $libelle) && ereg('échographie', $libelle)) {
                     $mod->MxBloc("actions.frep", "delete");
                 } else {
                     $mod->MxText("actions.frep.lienPrint", "<a href=\"" . URLNAVI . $session->genNavi($session->getNavi(0), $session->getNavi(1), $session->getNavi(2)) . "&Formulaire2print={$libelleC}&FormX_ext_goto_=" . $data[id_instance][$i] . "&act_print=1\" target=\"_blank\">");
                 }
             }
             $resume = addslashes(str_replace('"', "'", $newInstance->gen_resume()));
             $mod->Mxattribut("actions.codemouseover", "return overlib('" . $resume . "', CAPTION, '" . addslashes($data[libelle][$i]) . "');");
             unset($newInstance);
             $mod->Mxattribut("actions.codemouseout", "return nd()");
             $mod->Mxattribut("actions.code", "document.FoRmXcase.FormX_ext_goto_.value = '" . $data[id_instance][$i] . "';document.FoRmXcase.submit();");
             if ($session->getDroit($droit, 'd')) {
                 $mod->Mxattribut("actions.frem.code", "document.FoRmXcase.FormX_ext_goto_.value = 'RM" . $data[id_instance][$i] . "';document.FoRmXcase.submit();");
             } else {
                 $mod->MxBloc("actions.frem", "delete");
             }
             if ($session->getDroit($droit, 'a') && $data[status][$i] == 'F') {
                 $mod->Mxattribut("actions.fed.code", "document.FoRmXcase.FormX_ext_goto_.value = 'ED" . $data[id_instance][$i] . "';document.FoRmXcase.submit();");
             } else {
                 $mod->MxBloc("actions.fed", "delete");
             }
             $mod->MxBloc("actions", "loop");
         }
     }
     if ($padaction) {
         $mod->MxBloc("actions.frem", "delete");
         $mod->MxBloc("actions.fed", "delete");
         $mod->MxBloc("titre", "delete");
     } else {
         $mod->MxBloc("padetitre", "delete");
     }
     //le bouton de creation de nouvelle instance d'action
     if ($session->getDroit($droit, 'w')) {
         $mod->Mxattribut("nouveauF.newact_code", "document.FoRmXcase.FormX_ext_goto_.value = 'new';document.FoRmXcase.submit();");
         global $options;
         if ($options->getOption("racBonRadio")) {
             $mod->Mxattribut("racbonradio.newRadio", "document.FoRmXcase.FormX_to_open_.value = 'Formulaire_Radio';document.FoRmXcase.FoRmX_selValid.value = 'on';document.FoRmXcase.FoRmX_selValid_x.value = 'on';document.FoRmXcase.ids.value = '" . $this->ids . "';document.FoRmXcase.submit();");
         } else {
             $mod->MxBloc("racbonradio", "delete");
         }
         if ($options->getOption("racBonLabo")) {
             $options->getOption("bio2009") ? $f = "Formulaire_Bio2009" : ($f = "Formulaire_Bio");
             $mod->Mxattribut("racbonlabo.newLabo", "document.FoRmXcase.FormX_to_open_.value = '" . $f . "';document.FoRmXcase.FoRmX_selValid.value = 'on';document.FoRmXcase.FoRmX_selValid_x.value = 'on';document.FoRmXcase.ids.value = '" . $this->ids . "';document.FoRmXcase.submit();");
         } else {
             $mod->MxBloc("racbonlabo", "delete");
         }
         if ($options->getOption("racBonConSpe")) {
             $mod->Mxattribut("racboncs.newCS", "document.FoRmXcase.FormX_to_open_.value = 'Formulaire_Consultation_Specialisee';document.FoRmXcase.FoRmX_selValid.value = 'on';document.FoRmXcase.FoRmX_selValid_x.value = 'on';document.FoRmXcase.ids.value = '" . $this->ids . "';document.FoRmXcase.submit();");
         } else {
             $mod->MxBloc("racboncs", "delete");
         }
         if ($options->getOption("racBonRadioRadio")) {
             $mod->Mxattribut("racbonradioradio.newRadioRadio", "document.FoRmXcase.FormX_to_open_.value = 'Formulaire_Radio_Partie_Radio';document.FoRmXcase.FoRmX_selValid.value = 'on';document.FoRmXcase.FoRmX_selValid_x.value = 'on';document.FoRmXcase.ids.value = '" . $this->ids . "';document.FoRmXcase.submit();");
         } else {
             $mod->MxBloc("racbonradioradio", "delete");
         }
         if ($options->getOption("racBonRadioScanner")) {
             $mod->Mxattribut("racbonradioscanner.newRadioScanner", "document.FoRmXcase.FormX_to_open_.value = 'Formulaire_Radio_Partie_Scanner';document.FoRmXcase.FoRmX_selValid.value = 'on';document.FoRmXcase.FoRmX_selValid_x.value = 'on';document.FoRmXcase.ids.value = '" . $this->ids . "';document.FoRmXcase.submit();");
         } else {
             $mod->MxBloc("racbonradioscanner", "delete");
         }
         if ($options->getOption("racBonRadioEcho")) {
             $mod->Mxattribut("racbonradioecho.newRadioEcho", "document.FoRmXcase.FormX_to_open_.value = 'Formulaire_Radio_Partie_Echographies';document.FoRmXcase.FoRmX_selValid.value = 'on';document.FoRmXcase.FoRmX_selValid_x.value = 'on';document.FoRmXcase.ids.value = '" . $this->ids . "';document.FoRmXcase.submit();");
         } else {
             $mod->MxBloc("racbonradioecho", "delete");
         }
         if ($options->getOption("DoubleEtablissement")) {
             $mod->Mxattribut("transfert.newT", "document.FoRmXcase.FormX_to_open_.value = 'Formulaire_Transfert';document.FoRmXcase.FoRmX_selValid.value = 'on';document.FoRmXcase.FoRmX_selValid_x.value = 'on';document.FoRmXcase.ids.value = '" . $this->ids . "';document.FoRmXcase.submit();");
         } else {
             $mod->MxBloc("transfert", "delete");
         }
     } else {
         $mod->MxBloc("nouveauF", "delete");
     }
     if ($bubulle) {
         $bubulle->addBulle("nv_action", "Créez une nouvelle action sur ce patient");
     }
     // Variable de navigation.
     $mod->MxHidden("hidden", "navi=" . $session->genNavi($session->getNavi(0), $session->getNavi(1), $session->getNavi(2)));
     return $mod->MxWrite("1");
 }