private static function recuperationDesDonneesDeRecherche($module, $url_page_depart, $module_table, $champ_retour, $nb_limite_resultat, $nbligne, $nbcol, $champ_recherche, $operateur_recherche, $texte_recherche, $champ_courant, $operateur_courant, $texte_courant, $nb_col_courant, $nb_ligne_courant, $ajout_col) { // Dictionnaire des variables $nbligne; // Nombre de lignes totales $nbcol; // nombre de colonnes de la ligne courante $champ_recherche; //tableau des identifiants des champs choisis $operateur_recherche; //tableau des identifiants des operateurs choisis $texte_recherche; //table au des valeurs entrées par l'utilisateur $champ_courant; // Valeur de l'identifiant du champ qui vient juste d'etre saisie par l'utilisateur $operateur_courant; // Valeur de l'identifiant de l'operateur qui vient juste d'etre saisie par l'utilisateur $texte_courant; // Valeur du texte qui vient juste d'etre saisie par l'utilisateur $nb_col_courant; // numero de la colonne courante $nb_ligne_courant; // numero de la ligne courante $ajout_col; //si $ajout_col = 1 : ajout d'une colonne dans la ligne courante $champ_retour; $champ_retour; // Initialisation du nombre de lignes et de colones à 1 si il n'est pas déjà défini $tableau_affichage = Lib::isDefined("tableau_affichage"); $name_operateur_recherche = Lib::isDefined("name_operateur_recherche"); $return = Lib::isDefined("return"); // Initialisation du nombre de lignes et de colones à 1 //si il n'est pas déjà défini if (!isset($nbligne) || $nbligne == '') { $nbligne = 1; } if (!isset($nbcol) || $nbcol == '') { $nbcol = 1; } $url = substr($url_page_depart, 1); $url = substr($url, 0, strlen($url) - 1); // Découpage des tableaux //Les lignes étant séparées par || et les colonnes par ;; $champ_recherche = explode('||', $champ_recherche); $operateur_recherche = explode('||', $operateur_recherche); $texte_recherche = explode('||', $texte_recherche); for ($i = 0; $i < $nbligne; $i++) { $champ_recherche[$i] = explode(';;', $champ_recherche[$i]); $operateur_recherche[$i] = explode(';;', $operateur_recherche[$i]); $texte_recherche[$i] = explode(';;', $texte_recherche[$i]); } // insertion de la valeur choisie par l'utilisateur dans une //des listes déroulantes if ($champ_courant != '') { $champ_recherche[$nb_ligne_courant][$nb_col_courant] = $champ_courant; } if ($operateur_courant != '') { $operateur_recherche[$nb_ligne_courant][$nb_col_courant] = $operateur_courant; } // Transformation des tableaux en une chaine de caratères //Les lignes étant séparées par || et les colonnes par ;; // on les stoke dans des tableaux auxiliaires if ($nbligne == 1) { // Si une seule ligne if ($champ_recherche[0][0] != '') { $champ_recherche_aux = implode(';;', $champ_recherche[0]); } if ($operateur_recherche[0][0] != '') { $operateur_recherche_aux = implode(';;', $operateur_recherche[0]); } if ($texte_recherche[0][0] != '') { $texte_recherche_aux = implode(';;', $texte_recherche[0]); } } else { for ($i = 0; $i < $nbligne; $i++) { $champ_recherche_aux .= implode(';;', $champ_recherche[$i]); $champ_recherche_aux .= '||'; $operateur_recherche_aux .= implode(';;', $operateur_recherche[$i]); $operateur_recherche_aux .= '||'; $texte_recherche_aux .= implode(';;', $texte_recherche[$i]); $texte_recherche_aux .= '||'; } } // Initialisation des compteurs pour les lignes et pour les colonnes $cpt_col = 0; // compteur sur les colonnes $cpt_ligne = 0; // compteur sur les lignes while ($cpt_ligne < $nbligne) { // parcours des lignes // Calcul du nombre de colones de la ligne courante $nbcol = count($champ_recherche[$cpt_ligne]); if ($cpt_ligne == $nb_ligne_courant) { $nbcol = count($champ_recherche[$cpt_ligne]) + $ajout_col; } if (!isset($nbcol) || $nbcol == '') { $nbcol = 1; } while ($cpt_col < $nbcol) { // parcours des colonnes $tableau_affichage[$cpt_ligne][$cpt_col] = ""; // Nom du formulaire courant $name_form = 'recherche_' . $cpt_ligne . '_' . $cpt_col; // creation du formulaire $tableau_affichage[$cpt_ligne][$cpt_col] .= "<form name={$name_form} method=post action=../lib/action.php>"; // nom de la premiere liste deroulante $name_champ_recherche = "selection_champ_recherche_" . $cpt_ligne . '_' . $cpt_col; // $liste_champ = "<select name=$name_champ_recherche onChange=lien_selection('$name_form','$name_champ_recherche')>"; // creation de la liste déroulante $liste_champ = "<select name={$name_champ_recherche} onChange=lien_selection('{$name_form}','{$name_champ_recherche}','{$name_operateur_recherche}')>"; // nom de la table ou sont repertorié les champs possibles de recherches $t = $module_table; $t .= '_moteur_de_recherche'; // pour les champs avec priorité haute $desc = " SELECT * FROM " . $t . " WHERE priorite_moteur_de_recherche = 1" . " ORDER BY nom_champ_usuel_moteur_de_recherche "; $resultat = DatabaseOperation::convertSqlStatementKeyAndOneFieldToArray($desc) or die('Erreur SQL !' . $desc . '<br>' . PDO::errorInfo()); if (!strstr($url_page_depart, '?')) { $lien = $url . "?url_page_depart={$url_page_depart}&nb_limite_resultat={$nb_limite_resultat}&champ_recherche='{$champ_recherche_aux}'&operateur_recherche='{$operateur_recherche_aux}'&texte_recherche='{$texte_recherche_aux}'&nbligne={$nbligne}&nbcol={$nbcol}&nb_col_courant={$cpt_col}&nb_ligne_courant={$cpt_ligne}&champ_courant="; } else { $lien = $url . "&url_page_depart={$url_page_depart}&nb_limite_resultat={$nb_limite_resultat}&champ_recherche='{$champ_recherche_aux}'&operateur_recherche='{$operateur_recherche_aux}'&texte_recherche='{$texte_recherche_aux}'&nbligne={$nbligne}&nbcol={$nbcol}&nb_col_courant={$cpt_col}&nb_ligne_courant={$cpt_ligne}&champ_courant="; } // remplissage de la première liste déroulante $liste_champ .= "<option value" . $lien; $liste_champ .= "=>Selectionnez </option>"; foreach ($resultat as $enr) { if ($champ_recherche[$cpt_ligne][$cpt_col] != '') { // Si la categorie est déja selectionnée if ($enr[0] == $champ_recherche[$cpt_ligne][$cpt_col]) { $selected = 'selected'; } else { $selected = ''; } } $liste_champ .= "<option value=" . $lien . $enr[0] . " " . $selected; $liste_champ .= ">{$enr['3']}</option>"; } $liste_champ .= "<option value=" . $lien; $liste_champ .= ">==================================</option>"; // pour les autres champs $desc = " SELECT *\n FROM {$t}\n WHERE priorite_moteur_de_recherche = 0\n order by nom_champ_usuel_moteur_de_recherche"; $resultat = DatabaseOperation::convertSqlStatementKeyAndOneFieldToArray($desc) or die('Erreur SQL !' . $desc . '<br>' . PDO::errorInfo()); foreach ($resultat as $enr) { if ($champ_recherche[$cpt_ligne][$cpt_col] != '') { // Si la categorie est déja selectionnée if ($enr[0] == $champ_recherche[$cpt_ligne][$cpt_col]) { $selected = 'selected'; } else { $selected = ''; } } if (!strstr($url_page_depart, '?')) { $lien = $url . "?url_page_depart={$url_page_depart}&nb_limite_resultat={$nb_limite_resultat}&champ_recherche={$champ_recherche_aux}&operateur_recherche={$operateur_recherche_aux}&texte_recherche={$texte_recherche_aux}&nbligne={$nbligne}&nbcol={$nbcol}&nb_col_courant={$cpt_col}&nb_ligne_courant={$cpt_ligne}&champ_courant="; } else { $lien = $url . "&url_page_depart={$url_page_depart}&nb_limite_resultat={$nb_limite_resultat}&champ_recherche={$champ_recherche_aux}&operateur_recherche={$operateur_recherche_aux}&texte_recherche={$texte_recherche_aux}&nbligne={$nbligne}&nbcol={$nbcol}&nb_col_courant={$cpt_col}&nb_ligne_courant={$cpt_ligne}&champ_courant="; } $liste_champ .= "<option value=" . $lien . $enr[0] . " " . $selected; $liste_champ .= ">{$enr['3']}</option>"; } $liste_champ .= "</select>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= $liste_champ; // Création de la deuxieme liste deroulante en fonction de la première // Elle va contenir les operateurs de recherches // nom de la liste deroulante $name_operateur_recherche = "selection_operateur_recherche_" . $cpt_ligne . '_' . $cpt_col; // creation de la liste $liste_operateur = "<select name={$name_operateur_recherche} onChange=lien_selection('{$name_form}','{$name_operateur_recherche}')>"; $liste_operateur .= "<option value=''>Selectionnez </option>"; if ($champ_recherche[$cpt_ligne][$cpt_col] != '') { // si une valeur a ete saisie dans la premiere liste // recuperation du nom de la table et du nom du champ // sur lequel on veut faire la recherche $t = $module_table; $t .= '_moteur_de_recherche'; $aux = 'table_'; //$aux.=$t; $aux .= 'moteur_de_recherche'; $aux2 = 'nom_champ_'; //$aux2.=$t; $aux2 .= 'moteur_de_recherche'; $aux3 = 'id_'; //$aux3.=$t; $aux3 .= 'moteur_de_recherche'; $aux4 = str_replace("'", "", $champ_recherche[$cpt_ligne][$cpt_col]); $desc5 = " SELECT " . $aux . "," . $aux2 . " FROM " . $t . " WHERE " . $aux3 . " = " . $aux4 . ""; $result1 = DatabaseOperation::convertSqlStatementKeyAndOneFieldToArray($desc5) or die('Erreur SQL !' . $desc5 . '<br>' . PDO::errorInfo()); foreach ($result1 as $rows1) { $aux5 = $rows1; } $nom_table = $aux5[0]; $nom_champ = $aux5[1]; // Chercher le type de $nom_champ dans $nom_table $rech_type = " SELECT " . $nom_champ . " FROM " . $nom_table; $rech_type_res = DatabaseOperation::queryPDO($rech_type) or die('Erreur SQL !' . $rech_type . '<br>' . PDO::errorInfo()); // type du champ sur lequel on fait la recherche $type = $rech_type_res->getColumnMeta(0); /** * le type de champs diffère entre PDO et Mysql modifier la table intranet_moteur_de_recherche_type_de_champ */ // recherche de l'identifiant du type : $rech_id_type = " SELECT id_intranet_moteur_de_recherche_type_de_champ\nFROM intranet_moteur_de_recherche_type_de_champ\nWHERE type_intranet_moteur_de_recherche_type_de_champ = '" . $type["native_type"] . "'"; $rech_id_type_res = DatabaseOperation::convertSqlStatementKeyAndOneFieldToArray($rech_id_type) or die('Erreur SQL !' . $rech_id_type . '<br>' . PDO::errorInfo()); foreach ($rech_id_type_res as $rowsrech_id_type_res) { $tmp = $rowsrech_id_type_res; } // identifiant du type du champ sur lequel on fait la recheche $id_type = $tmp[0]; // en fonction du type du champ recherche des operateurs de recherche // possibles $sql = " SELECT op_intranet_moteur_de_recherche_association_type_operateur\nFROM intranet_moteur_de_recherche_association_type_operateur\nWHERE type_intranet_moteur_de_recherche_association_type_operateur = '{$id_type}'"; $resultat2 = DatabaseOperation::convertSqlStatementKeyAndOneFieldToArray($sql) or die('Erreur SQL !' . $sql . '<br>' . PDO::errorInfo()); foreach ($resultat2 as $enr2) { $sql2 = " SELECT intranet_moteur_de_recherche_operateur_sur_champ.*\nFROM intranet_moteur_de_recherche_operateur_sur_champ\nWHERE id_intranet_moteur_de_recherche_operateur_sur_champ = '{$enr2['0']}'"; $resultat3 = DatabaseOperation::convertSqlStatementKeyAndOneFieldToArray($sql2) or die('Erreur SQL !' . $sql2 . '<br>' . PDO::errorInfo()); foreach ($resultat3 as $enr3) { if ($operateur_recherche[$cpt_ligne][$cpt_col] != '') { if ($enr3[0] == $operateur_recherche[$cpt_ligne][$cpt_col]) { $selected = 'selected'; } else { $selected = ''; } } } // remplissage de la deuxieme liste deroulante if (!strstr($url_page_depart, '?')) { $lien = $url . "?url_page_depart=" . $url_page_depart . "&nb_limite_resultat=" . $nb_limite_resultat . "&champ_recherche=" . $champ_recherche_aux . "&operateur_recherche=" . $operateur_recherche_aux . "&texte_recherche=" . $texte_recherche_aux . "&nbligne=" . $nbligne . "&nbcol=" . $nbcol . "&nb_col_courant=" . $cpt_col . "&nb_ligne_courant=" . $cpt_ligne . "&operateur_courant="; } else { $lien = $url . "&url_page_depart=" . $url_page_depart . "&nb_limite_resultat=" . $nb_limite_resultat . "&champ_recherche=" . $champ_recherche_aux . "&operateur_recherche=" . $operateur_recherche_aux . "&texte_recherche=" . $texte_recherche_aux . "&nbligne=" . $nbligne . "&nbcol =" . $nbcol . "&nb_col_courant=" . $cpt_col . "&nb_ligne_courant=" . $cpt_ligne . "&operateur_courant="; } $liste_operateur .= "<option value = '" . $lien . $enr3[0] . "' " . $selected; $liste_operateur .= " >{$enr3['1']}</option>"; } //création de l'espace de saisie // nom de l'espace de saisie $name_val = 'val_' . $cpt_ligne . '_' . $cpt_col; // si on a deja saisie une valeur : $temp = $texte_recherche[$cpt_ligne][$cpt_col]; // on regarde si c'est une date if (strchr($temp, '-')) { $a = substr($temp, 0, 4); $mois = substr($temp, 5, -3); $j = substr($temp, 8, 10); } switch (TRUE) { case $operateur_recherche[$cpt_ligne][$cpt_col] == 9: //Liste $req_temp = "SELECT DISTINCT {$nom_champ} FROM {$nom_table} ORDER BY {$nom_champ}"; $result_temp = DatabaseOperation::convertSqlStatementKeyAndOneFieldToArray($req_temp); $saisie_utilisateur = "<select size = 1 name = {$name_val} value = {$temp}>"; $verrou = 0; $oui_non = 1; foreach ($result_temp as $rows) { if ($rows[0] == $temp) { //echo "$temp"; $select = "selected"; } else { $select = ""; } if ($rows[0] != "1" and $rows[0] != "0") { $oui_non = 0; } //Vérification de la tailles des entées if (strlen($rows[0]) < 50) { if ($rows[0] != "") { $saisie_utilisateur .= "<option value = {$rows['0']} {$select}> {$rows['0']} </option>"; } } else { $verrou = 1; } } $saisie_utilisateur .= "</select>"; if ($verrou) { $saisie_utilisateur .= "<img src = images/exclamation.png title = 'Certaines données ne peuvent pas être affichées car trop grandes' width = 20 height = 20 border = 0 />"; } //Bouton radio Oui/Non if ($oui_non) { switch ($temp) { case 0: $checked_oui = ""; $checked_non = "selected"; break; case 01: $checked_oui = "selected"; $checked_non = ""; break; } $saisie_utilisateur = "<select size = 1 name = {$name_val} value = {$temp}>" . "<option value = 1 {$checked_oui}>Oui</option>" . "<option value = 0 {$checked_non}>Non</option>" . "</select>"; } break; case $id_type == "5": // si le type du champ choisi dans la premiere liste deroulante // est une date on affiche 3 cases pour la saisie $name_val_j = $name_val . '_jour'; $saisie_utilisateur = "<INPUT type = 'text' size = 2 maxlength = 2 name = '{$name_val_j}'value = {$j}>"; $saisie_utilisateur .= "/"; $name_val_m = $name_val . '_mois'; $saisie_utilisateur .= "<INPUT type = 'text' size = 2 maxlength = 2 name = '{$name_val_m}'value = {$mois}>"; $saisie_utilisateur .= "/"; $name_val_a = $name_val . '_annee'; $saisie_utilisateur .= "<INPUT type = 'text' size = 4 maxlength = 4 name = '{$name_val_a}'value = {$a}>"; break; default: // sinon on affiche un champ de texte $saisie_utilisateur = "<INPUT type = 'text' size = 10 name = '{$name_val}' value = '{$temp}'>"; } } $liste_operateur .= "</select>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= $liste_operateur; $tableau_affichage[$cpt_ligne][$cpt_col] .= $saisie_utilisateur; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<br>"; $action = 'ajout'; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = url_page_depart value = {$url_page_depart}>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = module value = {$module}>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = module_table value = {$module_table}>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = champ_retour value = {$champ_retour}>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = action value = {$action}>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = champ_recherche value = {$champ_recherche_aux}>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = operateur_recherche value = {$operateur_recherche_aux}>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = texte_recherche value = {$texte_recherche_aux}>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = nb_ligne_courant value = {$cpt_ligne}>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = nb_col_courant value = {$cpt_col}>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = texte_courant value = {$texte_courant}>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = nbligne value = {$nbligne}>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = nbcol value = {$nbcol}>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = name_val value = {$name_val}>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = hidden name = nb_limite_resultat value = {$nb_limite_resultat}>"; // creation des boutons de choix une fois la saisie de la recherche terminée $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = radio value = et name = boutton_operateur>Et<br>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = radio value = ou name = boutton_operateur >Ou<br>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = radio value = Ou_avec name = boutton_operateur >Ou (avec recopie)<br>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = radio value = 'Suppr'name = boutton_operateur >Supprimer<br>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = radio value = fin name = boutton_operateur checked>Fin de saisie<br>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "<input type = submit value = Ok name = ok>"; $tableau_affichage[$cpt_ligne][$cpt_col] .= "</form>"; $cpt_col++; } $cpt_col = 0; $cpt_ligne++; } //$tableau_affichage[$cpt_ligne][$cpt_col].= '</form>'; $tableau_affichage[$cpt_ligne][$cpt_col] = '</form>'; /* Création de l'interface HTML */ // affichage du formulaire $return .= '<table class=contenu>'; for ($i = 0; $i < $nbligne; $i++) { $return .= '<tr>'; for ($j = 0; $j < count($tableau_affichage[$i]); $j++) { $return .= '<td>'; $return .= $tableau_affichage[$i][$j]; $return .= "</td>"; if ($j < count($tableau_affichage[$i]) - 1) { $op = 'ET'; $return .= '<td>'; $return .= "<img src = ../lib/moteur_de_recherche_image.php?op = {$op}>"; $return .= '</td>'; } } $return .= '</tr>'; if ($i < $nbligne - 1) { $op = 'OU'; $return .= '<td>'; $return .= "<img src = ../lib/moteur_de_recherche_image.php?op = {$op}><br><br>"; $return .= '</td>'; } } $return .= '</table>'; return $return; }
/** * Retourne l'enregistrement de la base de données. * Attention, ne gère que les tables 'mono-clef' * @param string $paramTableName Nom de la table * @param mixed $paramKeyValue Valeur de la clef * @return resource Résultat SQL */ public static function getSqlResultFromOneKeyValue($paramTableName, $paramKeyValue) { return DatabaseOperation::queryPDO(DatabaseOperation::getSqlQueryFromOneKeyValue($paramTableName, $paramKeyValue)); }
protected static function RecupChapitre($paramT_Liste_Processus) { $page_default = "modification_fiche"; $first = ""; /* * Nous récupérons les chapitres obligatoirement présent ce qui implique que les autre chapitres doivent être attribués. */ $reqRecup = 'SELECT ' . FtaChapitreModel::TABLENAME . '.' . FtaChapitreModel::KEYNAME . ', ' . FtaChapitreModel::TABLENAME . '.' . FtaChapitreModel::FIELDNAME_NOM_USUEL_CHAPITRE . ', ' . FtaWorkflowStructureModel::TABLENAME . '.' . FtaWorkflowStructureModel::FIELDNAME_ID_FTA_PROCESSUS . ', ' . FtaWorkflowStructureModel::TABLENAME . '.' . FtaWorkflowStructureModel::FIELDNAME_ID_FTA_ROLE . ' FROM ' . FtaChapitreModel::TABLENAME . ' LEFT JOIN ' . FtaWorkflowStructureModel::TABLENAME . ' ON ' . FtaWorkflowStructureModel::TABLENAME . '.' . FtaWorkflowStructureModel::FIELDNAME_ID_FTA_CHAPITRE . '=' . FtaChapitreModel::TABLENAME . '.' . FtaChapitreModel::KEYNAME . ' WHERE ( ' . FtaWorkflowStructureModel::TABLENAME . '.' . FtaWorkflowStructureModel::FIELDNAME_ID_FTA_ROLE . ' =' . FtaRoleModel::ID_FTA_ROLE_COMMUN; foreach ($paramT_Liste_Processus as $value) { $reqRecup .= ' OR ' . FtaWorkflowStructureModel::TABLENAME . '.' . FtaWorkflowStructureModel::FIELDNAME_ID_FTA_PROCESSUS . '=\'' . $value . '\''; } $reqRecup .= ' ) AND ' . FtaWorkflowStructureModel::FIELDNAME_ID_FTA_WORKFLOW . '=' . self::$id_fta_workflow . ' ORDER BY ' . FtaWorkflowStructureModel::TABLENAME . '.' . FtaWorkflowStructureModel::FIELDNAME_ID_FTA_ROLE . ',' . FtaWorkflowStructureModel::TABLENAME . '.' . FtaWorkflowStructureModel::FIELDNAME_ID_FTA_PROCESSUS . ',' . FtaChapitreModel::TABLENAME . '.' . FtaChapitreModel::KEYNAME; $arrayRecup = DatabaseOperation::convertSqlStatementWithoutKeyToArray($reqRecup); //Balyage des chapitres trouvés foreach ($arrayRecup as $rowsRecup) { $id_fta_chapitre = $rowsRecup[FtaChapitreModel::KEYNAME]; $nom_usuel_fta_chapitre = $rowsRecup[FtaChapitreModel::FIELDNAME_NOM_USUEL_CHAPITRE]; $idFtaProcessus = $rowsRecup[FtaWorkflowStructureModel::FIELDNAME_ID_FTA_PROCESSUS]; $idFtaRole = $rowsRecup[FtaWorkflowStructureModel::FIELDNAME_ID_FTA_ROLE]; //Dans le cas où il n'y a pas de chapitre sélectionné, sélection du chapitre identité if (!self::$id_fta_chapitre_encours) { self::$id_fta_chapitre_encours = $id_fta_chapitre; } if (self::$id_fta_chapitre_encours == $id_fta_chapitre and !self::$selectionChap) { $font_size = "size=" . self::FONT_SIZE_CHAPITRE_ENCOURS; $font_flash_color = "color=" . self::FONT_COLOR_CHAPITRE_ENCOURS; $font_flash = "<font " . $font_size . " " . $font_flash_color . ">"; $image_flash1 = $font_flash . '[ ' . "</font>"; $image_flash2 = $font_flash . ' ]' . "</font>"; $num = 1; } else { $font_size = ""; $image_flash1 = '- '; $image_flash2 = ' -'; } //Ce chapitre est-il public? if ($idFtaProcessus == 0) { $font_color = "color=" . self::FONT_COLOR_CHAPITRE_PUBLIC; $link = TRUE; $num = 1; } else { //Le chapitre est-il validé ? $req1 = 'SELECT ' . FtaSuiviProjetModel::KEYNAME . ' FROM ' . FtaSuiviProjetModel::TABLENAME . ' WHERE ' . FtaSuiviProjetModel::FIELDNAME_ID_FTA . '=' . self::$id_fta . ' AND ' . FtaSuiviProjetModel::FIELDNAME_ID_FTA_CHAPITRE . '=' . $id_fta_chapitre . ' AND ' . FtaSuiviProjetModel::FIELDNAME_SIGNATURE_VALIDATION_SUIVI_PROJET . '<> ' . FtaSuiviProjetModel::SIGNATURE_VALIDATION_SUIVI_PROJET_FALSE; $result1 = DatabaseOperation::queryPDO($req1); $num = DatabaseOperation::getSqlNumRows($result1); switch ($num) { case 0: /** * Chapitre pas encore validé * - Chapitre encours en rouge * - Chapitre non accessible en noir */ if (in_array($idFtaProcessus, self::$id_fta_processus)) { $font_color = "color=" . self::FONT_COLOR_CHAPITRE_NON_VALIDEE; $link = TRUE; $i = ""; $iEnd = ""; } elseif (self::$id_fta_role == $idFtaRole) { $font_color = "color=" . self::FONT_COLOR_CHAPITRE_NON_ACCESSIBLE; $link = FALSE; $i = ""; $iEnd = ""; } else { $font_color = "color=" . self::FONT_COLOR_CHAPITRE_AUTRE_ROLE; $i = " <i> "; $iEnd = " </i> "; $link = FALSE; } break; case 1: //Chapitre validé $font_color = "color=" . self::FONT_COLOR_CHAPITRE_VALIDEE; $link = TRUE; $i = ""; $iEnd = ""; break; default: //Anomalie $titre = 'Erreur Grave !'; $message = 'La fonction afficher_navigation() vient de trouver des doublons de validation des chapitres dans la table fta_suivi_projet'; Lib::showMessage($titre, $message, $redirection); break; } } //Fin du test public //}//Fin de la colorisation if ($num == 0 and self::$synthese_action === 'attente') { } else { $b = $i . "<font " . $font_size . " " . $font_color . ">"; $menu_navigation .= $image_flash1; if ($link) { $menu_navigation .= '<a href=' . $page_default . '.php?' . 'id_fta=' . self::$id_fta . '&id_fta_chapitre_encours=' . $id_fta_chapitre . '&synthese_action=' . self::$synthese_action . '&id_fta_etat=' . self::$id_fta_etat . '&abreviation_fta_etat=' . self::$abreviation_etat . '&id_fta_role=' . self::$id_fta_role . '>'; } $menu_navigation .= $b . ' ' . $nom_usuel_fta_chapitre; $menu_navigation .= '</a>'; $menu_navigation .= '</font> ' . $iEnd . $image_flash2; /** * Mise en forme des chapitres de la barre de navigation regroupé par Rôle */ if ($idFtaRoleTmp == $idFtaRole or !$first) { $roleMenu .= $menu_navigation; $menu_navigation = ""; $idFtaRoleTmp = $idFtaRole; $first = "1"; } else { $color = FtaRoleModel::getColorByRole($idFtaRoleTmp); $border = FtaRoleModel::getBoderByRole($idFtaRoleTmp, self::$id_fta_role_encours); $roleMenuFinal .= "<td style='border-style:solid; border-bottom-width: {$border}; border-color: " . $color . "' >" . $roleMenu . "</td>"; $roleMenu = $menu_navigation; $menu_navigation = ""; $idFtaRoleTmp = $idFtaRole; } } } $color = FtaRoleModel::getColorByRole($idFtaRoleTmp); $border = FtaRoleModel::getBoderByRole($idFtaRoleTmp, self::$id_fta_role_encours); $roleMenuFinal .= "<td style='border-style:solid; border-bottom-width: {$border}; border-color: " . $color . "' >" . $roleMenu . "</td>"; return $roleMenuFinal; }
/* Dérogationc Colis */ $type_derogation = "<select name=\"type_derogation\" size=\"1\">\n <option value=1>Réduire</option>\n <option value=2>Augmenter</option>\n </select>\n "; //Listes déroulantes //Selection de l'Article Validés et Actifs $req_liste_agrologic = "SELECT id_access_arti2" . ", CONCAT_WS(' - ', CODE_ARTICLE, LIBELLE) " . "FROM access_arti2 " . "WHERE CODE_ARTICLE IS NOT NULL AND actif=-1 " . "ORDER BY CODE_ARTICLE "; $id_defaut = $id_access_arti2; $liste_article = AccueilFta::afficherRequeteEnListeDeroulante($req_liste_agrologic, $id_defaut, "id_access_arti2", TRUE); $liste_id_agrologic = $liste_article . $liste_produit; //Liste des dérogations $bloc = "<{$html_table}>" . "<tr class=titre_principal><td>" . DatabaseDescription::getFieldDocLabel("fta_derogation_duree_vie", "date_fta_derogation_duree_vie") . "</td><td>" . DatabaseDescription::getFieldDocLabel("fta_derogation_duree_vie", "createur_fta_derogation_duree_vie") . "</td><td>" . DatabaseDescription::getFieldDocLabel("fta_derogation_duree_vie", "id_agrologic_fta_derogation_duree_vie") . "</td><td>" . DatabaseDescription::getFieldDocLabel("fta_derogation_duree_vie", "lot_fta_derogation_duree_vie") . "</td><td>" . DatabaseDescription::getFieldDocLabel("fta_derogation_duree_vie", "duree_vie_production_fta_derogation_duree_vie") . "</td><td>" . DatabaseDescription::getFieldDocLabel("fta_derogation_duree_vie", "utilise_fta_derogation_duree_vie") . "</td></tr>" . "<tr class=contenu><td>" . date("Y-m-d") . "<input type=\"hidden\" name=\"date_fta_derogation_duree_vie\" value=\"" . date("Y-m-d") . "\" />" . "</td><td>" . $prenom . " " . $nom_famille_ses . "<input type=hidden name=createur_fta_derogation_duree_vie value={$id_user}>" . "</td><td>" . $liste_id_agrologic . "</td><td>" . $type_derogation . "</td><td>" . "<input type=submit value='Ajouter'>" . "</td><td>" . "</td><td>" . "</td></tr>"; $message = "?"; $url = "index.php"; $req = "SELECT * " . "FROM fta_derogation_duree_vie " . "ORDER BY type_fta_derogation_duree_vie ASC, date_fta_derogation_duree_vie DESC "; $result = DatabaseOperation::queryPDO($req); $bloc .= "<tr class=titre_principal><td colspan=7>" . "Dérogations Colis" . "</td></tr>"; $passage_produit = 0; foreach ($result as $rows) { //Mise en forme du tableau //Ajout du Titre des dérogations Produits if ($passage_produit == 0 and $rows["type_fta_derogation_duree_vie"] == 1) { $bloc .= "<tr class=titre_principal><td colspan=7>" . "Dérogations Sachets" . "</td></tr>"; $passage_produit = 1; } //type_fta_derogation_duree_vie //Préparation des données if ($rows["createur_fta_derogation_duree_vie"]) { //Nom du créateur de la dérogation $req = "SELECT prenom, nom FROM salaries WHERE id_user='******' "; $result_login = DatabaseOperation::convertSqlStatementWithoutKeyToArray($req);