/**
  * Affiche le tableau de récapitulatif des droits d'accès sur le module Fta
  * @return string
  */
 public static function getHtmlArrayAccesRightUser()
 {
     /**
      * Entête du tableau
      */
     $bloc .= "<" . "table " . "border=1 " . "width=100% " . "class=contenu " . ">" . "<th>" . "Utilisateurs" . "</th><th>" . "Accès général" . "</th><th>" . "Diffusion" . "</th><th>" . "Impression" . "</th><th>" . "Espace de travail <br>(Mettre la souris sur un espace de travail pour voir le détail) " . "</th>";
     //lister les utilisateurs concernés
     $arrayUser = self::getArrayUserWithAccesRightsToFta();
     foreach ($arrayUser as $rowsUser) {
         $lienWorkflow = "";
         $listeRole = "";
         $virgule = "";
         $virgule2 = "";
         //Tableau des id intranet actions Fta
         $arrayAction = self::getArrayIdIntranetActionWithAccesRightsToFtaByUser($rowsUser[UserModel::KEYNAME]);
         $bloc .= "<tr class=contenu><td>" . $rowsUser[UserModel::FIELDNAME_PRENOM] . " " . $rowsUser[UserModel::FIELDNAME_NOM] . "</td>";
         /**
          * Vérification des droits d'accès généraux
          */
         $checkModification = FtaController::isValueInArray(IntranetNiveauAccesModel::NIVEAU_FTA_MODIFICATION, $arrayAction);
         $checkConsultation = FtaController::isValueInArray(IntranetNiveauAccesModel::NIVEAU_FTA_CONSULTATION, $arrayAction);
         $checkDiffusion = FtaController::isValueInArray(IntranetNiveauAccesModel::NIVEAU_FTA_DIFFUSION, $arrayAction);
         $checkImpression = FtaController::isValueInArray(IntranetNiveauAccesModel::NIVEAU_FTA_IMPRESSION, $arrayAction);
         /**
          * Si accès Fta Modif
          */
         if ($checkModification) {
             $accesGeneralValue = "Modification";
             $diffusion = "Voir espaces de Travail";
             /**
              * Identification des Id intranet action workflow
              */
             $arrayIdIntranetParents = DatabaseOperation::convertSqlStatementWithoutKeyToArrayComplete(" SELECT " . IntranetActionsModel::KEYNAME . " FROM  " . IntranetActionsModel::TABLENAME . " WHERE " . IntranetActionsModel::FIELDNAME_TAG_INTRANET_ACTIONS . "='" . IntranetActionsModel::VALUE_WORKFLOW . "' ");
             $arrayIdActionWorkflow = array_intersect($arrayIdIntranetParents, $arrayAction);
             if ($arrayIdActionWorkflow) {
                 foreach ($arrayIdActionWorkflow as $rowsIdActionWorkflow) {
                     $listeRole = "";
                     $virgule2 = "";
                     /**
                      * Identification du workflow
                      */
                     $arrayIdIntranetParents = DatabaseOperation::convertSqlStatementWithoutKeyToArrayComplete(" SELECT " . FtaWorkflowModel::FIELDNAME_DESCRIPTION_FTA_WORKFLOW . " FROM  " . FtaWorkflowModel::TABLENAME . " WHERE " . FtaWorkflowModel::FIELDNAME_ID_INTRANET_ACTIONS . "=" . $rowsIdActionWorkflow);
                     /**
                      * Identification des Id intranet action  role du workflow
                      */
                     $arrayIdIntranetRole = DatabaseOperation::convertSqlStatementWithoutKeyToArrayComplete(" SELECT " . IntranetActionsModel::KEYNAME . " FROM  " . IntranetActionsModel::TABLENAME . " WHERE " . IntranetActionsModel::FIELDNAME_TAG_INTRANET_ACTIONS . "='" . IntranetActionsModel::VALUE_ROLE . "' " . " AND " . IntranetActionsModel::FIELDNAME_PARENT_INTRANET_ACTIONS . "=" . $rowsIdActionWorkflow);
                     $arrayIdActionRole = array_intersect($arrayIdIntranetRole, $arrayAction);
                     if ($arrayIdActionRole) {
                         foreach ($arrayIdActionRole as $rowsIdActionRole) {
                             /**
                              * Liste des rôles attribué pour le workflow
                              */
                             $arrayRole = DatabaseOperation::convertSqlStatementWithoutKeyToArrayComplete(" SELECT " . FtaRoleModel::FIELDNAME_DESCRIPTION_FTA_ROLE . " FROM  " . FtaRoleModel::TABLENAME . "," . FtaActionRoleModel::TABLENAME . " WHERE " . FtaActionRoleModel::FIELDNAME_ID_INTRANET_ACTIONS . "=" . $rowsIdActionRole . " AND " . FtaRoleModel::TABLENAME . "." . FtaRoleModel::KEYNAME . "=" . FtaActionRoleModel::TABLENAME . "." . FtaActionRoleModel::FIELDNAME_ID_FTA_ROLE);
                             $listeRole .= $virgule2 . $arrayRole["0"];
                             $virgule2 = ", ";
                         }
                     }
                     $lienWorkflow .= $virgule . "<span title=\" " . $listeRole . " \" >" . $arrayIdIntranetParents["0"] . "</span>";
                     $virgule = ", ";
                 }
             }
             /**
              * Si accès Fta Consultation
              */
         } elseif ($checkConsultation) {
             $accesGeneralValue = "Consultation";
             /**
              * Droits de difussion
              */
             if ($checkDiffusion) {
                 $geoModel = new GeoModel($rowsUser[UserModel::FIELDNAME_LIEU_GEO]);
                 $diffusion = $geoModel->getDataField(GeoModel::FIELDNAME_GEO)->getFieldValue();
             } else {
                 $diffusion = "Non";
             }
             /**
              * Droits de difussion
              */
         } else {
             $accesGeneralValue = "Non";
             if ($checkDiffusion) {
                 $geoModel = new GeoModel($rowsUser[UserModel::FIELDNAME_LIEU_GEO]);
                 $diffusion = $geoModel->getDataField(GeoModel::FIELDNAME_GEO)->getFieldValue();
             } else {
                 $diffusion = "Non";
             }
         }
         /**
          * Droits d'impression
          */
         if ($checkImpression) {
             $impression = "Oui";
         } else {
             $impression = "Non";
         }
         $bloc .= "<td>" . $accesGeneralValue . "</td>" . "<td>" . $diffusion . "</td>" . "<td>" . $impression . "</td>" . "<td>" . $lienWorkflow . "</td></tr>";
     }
     return $bloc;
 }
예제 #2
0
 /**
  * Correction d'une FTA
  * Pour une FTA données, correction d'un chapitre et dévalidation des processus suivants
  * @param type $paramIdFta
  * @param type $paramIdChapitre
  * @param type $option
  * @return int
  */
 public static function buildCorrectionChapitre($paramIdFta, $paramIdChapitre, $option)
 {
     $option['no_message_ecran'];
     //0=affichage à l'ecran, 1=rien
     $option['correction_fta_suivi_projet'];
     //Commentaire justifiant la correction du chapitre
     $option['mail_gestionnaire'];
     //Informe le gestionnaire de la Fta de la mise en correction de sa Fta
     $HtmlResult = new HtmlResult2();
     $globalConfig = new GlobalConfig();
     UserModel::checkUserSessionExpired($globalConfig);
     //Récupération des informations préalables
     //Nom de l'assistante de projet responsable:
     $idUser = $globalConfig->getAuthenticatedUser()->getKeyValue();
     $mailExpediteur = $globalConfig->getAuthenticatedUser()->getDataField(UserModel::FIELDNAME_MAIL)->getFieldValue();
     $nomPrenom = $globalConfig->getAuthenticatedUser()->getPrenomNom();
     $idFtaWorkflowStructure = FtaWorkflowStructureModel::getIdFtaWorkflowStructureByIdFtaAndIdChapitre($paramIdFta, $paramIdChapitre);
     $ftaWorkflowStructureModel = new FtaWorkflowStructureModel($idFtaWorkflowStructure, $paramIdChapitre);
     $idFtaProcessus = $ftaWorkflowStructureModel->getDataField(FtaWorkflowStructureModel::FIELDNAME_ID_FTA_PROCESSUS)->getFieldValue();
     $idFtaWorkflow = $ftaWorkflowStructureModel->getDataField(FtaWorkflowStructureModel::FIELDNAME_ID_FTA_WORKFLOW)->getFieldValue();
     $arrayFtaSuiviCorrection = DatabaseOperation::convertSqlStatementWithoutKeyToArray('SELECT ' . FtaSuiviProjetModel::FIELDNAME_CORRECTION_FTA_SUIVI_PROJET . ',' . FtaSuiviProjetModel::FIELDNAME_NOTIFICATION_FTA_SUIVI_PROJET . ' FROM ' . FtaSuiviProjetModel::TABLENAME . ' WHERE ' . FtaModel::KEYNAME . '=' . $paramIdFta . ' AND ' . FtaSuiviProjetModel::FIELDNAME_ID_FTA_CHAPITRE . '=' . $paramIdChapitre . ' ');
     if ($arrayFtaSuiviCorrection) {
         foreach ($arrayFtaSuiviCorrection as $rowsFtaSuiviCorrection) {
             $current_correction_fta_suivi_projet = $rowsFtaSuiviCorrection[FtaSuiviProjetModel::FIELDNAME_CORRECTION_FTA_SUIVI_PROJET];
             $notificationFtaSuiviProjet = $rowsFtaSuiviCorrection[FtaSuiviProjetModel::FIELDNAME_CORRECTION_FTA_SUIVI_PROJET];
         }
     }
     //Intégration du commentaire de la correction
     if ($current_correction_fta_suivi_projet and $option[FtaSuiviProjetModel::FIELDNAME_CORRECTION_FTA_SUIVI_PROJET]) {
         $fullComment = $option[FtaSuiviProjetModel::FIELDNAME_CORRECTION_FTA_SUIVI_PROJET] . '\\n\\n' . $current_correction_fta_suivi_projet;
         $newCorrectionFtaSuiviProjet = FtaController::getComment("Correction d'une Fta", $nomPrenom, $fullComment);
     }
     //        $newCorrectionFtaSuiviProjet = mysql_real_escape_string($newCorrectionFtaSuiviProjet);
     $newCorrectionFtaSuiviProjet = str_replace("<br/>", "\n", $newCorrectionFtaSuiviProjet);
     //Dévalidation du chapitre en cours
     $reqDevelidationChapitre = " UPDATE " . FtaSuiviProjetModel::TABLENAME . " SET " . FtaSuiviProjetModel::FIELDNAME_SIGNATURE_VALIDATION_SUIVI_PROJET . "=0, " . FtaSuiviProjetModel::FIELDNAME_CORRECTION_FTA_SUIVI_PROJET . "=\"" . $newCorrectionFtaSuiviProjet . "\" " . " WHERE " . FtaModel::KEYNAME . "=" . $paramIdFta . " AND " . FtaSuiviProjetModel::FIELDNAME_ID_FTA_CHAPITRE . "=" . $paramIdChapitre;
     DatabaseOperation::execute($reqDevelidationChapitre);
     /*
      * Mise à jour de la validation de l'échéance du processus
      * fonction non utilisé
      */
     // FtaProcessusDelaiModel::BuildFtaProcessusValidationDelai($paramIdFta, $idFtaProcessus, $idFtaWorkflow);
     //Dévalidation des processus suivants
     $return = FtaChapitreModel::buildDevalidationChapitre($paramIdFta, $idFtaProcessus, $HtmlResult);
     /**
      * Actualisation du pourcentage de validation de la Fta
      */
     $idFtaSuiviProjet = FtaSuiviProjetModel::getIdFtaSuiviProjetByIdFtaAndIdChapitre($paramIdFta, $paramIdChapitre);
     $modelFtaSuiviProjet = new FtaSuiviProjetModel($idFtaSuiviProjet);
     $modelFtaSuiviProjet->unsetSigned();
     $modelFtaSuiviProjet->saveToDatabase();
     //print_r($return['mail']);      //Tableau contenant les adresses emails des personnes concernées par la dévalidation
     if (count($return) > 1) {
         $return['processus'] = array_unique($return['processus']);
         //Tableau contenant les identifiants des processus dévalidés unique
     }
     if (is_string($return['processus'])) {
         $return['processus'] = array('processus' => $return['processus']);
     }
     //Informations
     if ($return['processus']) {
         foreach ($return['processus'] as $id_Fta_Processus) {
             $idFtaProcessus = $id_Fta_Processus;
             $arrayFtaProcessus = DatabaseOperation::convertSqlStatementWithoutKeyToArray('SELECT DISTINCT ' . FtaProcessusModel::FIELDNAME_NOM . ' FROM ' . FtaProcessusModel::TABLENAME . ', ' . FtaWorkflowStructureModel::TABLENAME . ' WHERE ' . FtaWorkflowStructureModel::TABLENAME . '.' . FtaWorkflowStructureModel::FIELDNAME_ID_FTA_PROCESSUS . '=' . FtaProcessusModel::TABLENAME . '.' . FtaProcessusModel::KEYNAME . ' AND ' . FtaWorkflowStructureModel::TABLENAME . '.' . FtaWorkflowStructureModel::FIELDNAME_ID_FTA_PROCESSUS . '=' . $idFtaProcessus . ' AND ' . FtaWorkflowStructureModel::TABLENAME . '.' . FtaWorkflowStructureModel::FIELDNAME_ID_FTA_WORKFLOW . '=' . $idFtaWorkflow);
             if ($arrayFtaProcessus) {
                 foreach ($arrayFtaProcessus as $rowsFtaProcessus) {
                     $message .= $rowsFtaProcessus[FtaProcessusModel::FIELDNAME_NOM] . '<br>';
                 }
             }
         }
         if (!$message) {
             $message = 'Aucun processus n\'a été dévalidé.';
         }
         $titre = 'Liste des Processus dévalidés';
         if (!$option['no_message_ecran']) {
             Lib::showMessage($titre, $message, $redirection);
         }
         //Envoi des mails
         $show_din = FtaModel::showDin($paramIdFta);
         $sujetElements = $show_din;
         if ($return['mail']) {
             $return['mail'] = array_unique($return['mail']);
             foreach ($return['mail'] as $mail) {
                 $sujetmail = 'FTA/Correction: ' . $sujetElements;
                 $destinataire = $mail;
                 $expediteur = $nomPrenom . ' <' . $mailExpediteur . '>';
                 $text = 'Vos chapitres viennent d\'être dévalidés suite à une correction apportée par ' . $nomPrenom . '.\\n\\n' . 'OBJET DE LA CORRECTION:\\n' . '\\t' . stripslashes($option[FtaSuiviProjetModel::FIELDNAME_CORRECTION_FTA_SUIVI_PROJET]);
                 $typeMail = 'Correction';
                 if ($notificationFtaSuiviProjet) {
                     envoismail($sujetmail, $text, $destinataire, $expediteur, $typeMail);
                 }
             }
         }
         /**
          * Génération d'un mail informant le gestionnaire de la Fta
          */
         if ($option['mail_gestionnaire']) {
             $ftaModel = new FtaModel($paramIdFta);
             $idGestionnaire = $ftaModel->getModelCreateur()->getKeyValue();
             //Tableau des id intranet actions Fta
             $arrayAction = IntranetDroitsAccesModel::getArrayIdIntranetActionWithAccesRightsToFtaByUser($idGestionnaire);
             $checkDiffusion = FtaController::isValueInArray(IntranetNiveauAccesModel::NIVEAU_FTA_DIFFUSION, $arrayAction);
             if ($idGestionnaire != $idUser and $checkDiffusion) {
                 $mailGestionnaire = $ftaModel->getModelCreateur()->getDataField(UserModel::FIELDNAME_MAIL)->getFieldValue();
                 $sujetmail = 'FTA/Mise en Correction: ' . $sujetElements . ' par ' . $nomPrenom;
                 $destinataire = $mailGestionnaire;
                 $expediteur = $nomPrenom . ' <' . $mailExpediteur . '>';
                 $text = 'Une nouvelle version vient d\'être crée, la correction apportée par ' . $nomPrenom . ' est au sujet de :\\n' . '\\t' . stripslashes($option[FtaSuiviProjetModel::FIELDNAME_CORRECTION_FTA_SUIVI_PROJET]);
                 $typeMail = 'CorrectionValidation2Modification';
                 envoismail($sujetmail, $text, $destinataire, $expediteur, $typeMail);
             }
         }
     }
     //Fin du traitement des processus suivants
     return 1;
 }