예제 #1
0
 /**
  * 
  * @return type
  */
 public function showDatesEcheanceProcessus()
 {
     //Variables locales
     $blocEcheanceLignes = "";
     $modelFtaProcessusDelai = new FtaProcessusDelaiModel();
     //Parcours et construction de toutes les échéances
     foreach ($this->getModel()->getArrayDataFieldEcheancesForProcessusCycle() as $modelFtaProcessusDelai) {
         //Construction des objets HTML de date
         $recordsetProcessus = new FtaProcessusModel($modelFtaProcessusDelai->getDataField(FtaProcessusDelaiModel::FIELDNAME_ID_FTA_PROCESSUS)->getFieldValue());
         $labelEcheance = "Echéance pour " . $recordsetProcessus->getDataField(FtaProcessusModel::FIELDNAME_NOM)->getFieldValue() . ": ";
         $dataFieldEcheance = $modelFtaProcessusDelai->getDataField(FtaProcessusDelaiModel::FIELDNAME_DATE_ECHEANCE_PROCESSUS);
         $dataFieldEcheance->setLabelCustom($labelEcheance);
         $HtmlElementEcheance = new DataFieldToHtmlInputCalendar($dataFieldEcheance);
         $blocEcheanceLignes .= $HtmlElementEcheance->getHtmlResult();
     }
     return $blocEcheanceLignes;
 }
예제 #2
0
 public function getArrayDataFieldEcheancesForProcessusCycle()
 {
     $dateEcheanceFta = $this->getDataField(FtaModel::FIELDNAME_DATE_ECHEANCE_FTA)->getFieldValue();
     $isEcheanceForThisFtaExist = NULL;
     //Date par processus
     $annee_date_echeance_fta = substr($dateEcheanceFta, 0, 4);
     $mois_date_echeance_fta = substr($dateEcheanceFta, 5, 2);
     $jour_date_echeance_fta = substr($dateEcheanceFta, 8, 2);
     $arrayModelFtaProcessusDelaiByIdProcessus = $this->getArrayModelFtaProcessusDelaiByIdProcessus();
     //Sélection de tous les processus appartenant au cycle de vie de la FTA
     $arrayIdProcessusFromFtaCycleDeVie = $this->getArrayIdProcessusFromFtaCycleDeVie();
     foreach ($arrayIdProcessusFromFtaCycleDeVie as $rows) {
         //Extraction des données du tableau PHP
         $idFtaProcessus = $rows[FtaProcessusModel::KEYNAME];
         $WeekSinceFirstProcessus = $rows[FtaProcessusCycleModel::FIELDNAME_DELAI];
         //Processus défini pour ce cycle de vie
         $modelFtaProcessusForCycle = new FtaProcessusModel($idFtaProcessus);
         //La FTA a-t-elle une échéance de renseignée pour ce processus ?
         if ($arrayModelFtaProcessusDelaiByIdProcessus != NULL) {
             $isEcheanceForThisFtaExist = array_key_exists($modelFtaProcessusForCycle->getKeyValue(), $arrayModelFtaProcessusDelaiByIdProcessus);
         }
         if ($isEcheanceForThisFtaExist) {
             //Si il existe, on récupère ce délai
             $modelFtaProcessusDelai = $arrayModelFtaProcessusDelaiByIdProcessus[$modelFtaProcessusForCycle->getKeyValue()];
         } else {
             //Si il n'existe pas, il faut initialiser l'échéance
             $modelFtaProcessusDelai = new FtaProcessusDelaiModel();
             $modelFtaProcessusDelai->setModelFtaById($this->getKeyValue());
             $modelFtaProcessusDelai->setModelFtaProcessusById($modelFtaProcessusForCycle->getKeyValue());
             //Mise à jour du tableau
             $arrayModelFtaProcessusDelaiByIdProcessus[$modelFtaProcessusForCycle->getDataField(FtaProcessusDelaiModel::FIELDNAME_ID_FTA_PROCESSUS)->getFieldValue()] = $modelFtaProcessusDelai;
         }
         //Récupération de la date d'échéance de la FTA définie pour ce processus
         if (($dateEcheanceFta == NULL or $dateEcheanceFta == "0000-00-00") and parent::getIsEditable()) {
             $modelFtaProcessusDelai->getDataField(FtaProcessusDelaiModel::FIELDNAME_DATE_ECHEANCE_PROCESSUS)->setFieldValue("");
         } else {
             $delai_jour = $WeekSinceFirstProcessus * ModuleConfig::DELAI_ECHEANCE_PROCESSUS_JOUR;
             $timestamp_date_echeance_fta = mktime(0, 0, 0, $mois_date_echeance_fta, $jour_date_echeance_fta - $delai_jour, $annee_date_echeance_fta);
             $dateDefaultEcheance = date("d-m-Y", $timestamp_date_echeance_fta);
             $modelFtaProcessusDelai->getDataField(FtaProcessusDelaiModel::FIELDNAME_DATE_ECHEANCE_PROCESSUS)->setFieldValue($dateDefaultEcheance);
         }
         $modelFtaProcessusDelai->saveToDatabase();
         //            $arrayDataFieldEcheancesForProcessusCycle[] = $modelFtaProcessusDelai->getDataField(FtaProcessusDelaiModel::FIELDNAME_DATE_ECHEANCE_PROCESSUS);
         $arrayDataFieldEcheancesForProcessusCycle[] = $modelFtaProcessusDelai;
         //Construction des objets HTML de date
         //            $labelEcheance = "Echéance pour " . $modelFtaProcessusDelai->getModelFtaProcessus()->getDataField(FtaProcessusModel::FIELDNAME_SERVICE)->getFieldValue() . ": ";
         //            $dataFieldEcheance = $modelFtaProcessusDelai->getDataField(FtaProcessusDelaiModel::FIELDNAME_DATE_ECHEANCE_PROCESSUS);
         //            $dataFieldEcheance->setLabelCustom($labelEcheance);
         //
         //            $HtmlElementEcheance = new DataFieldToHtmlInputCalendar($dataFieldEcheance);
         //
         //            $blocEcheanceLignes .= $HtmlElementEcheance->getHtmlResult();
     }
     return $arrayDataFieldEcheancesForProcessusCycle;
 }