} } else { //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ ADD. /*SUIVI DES MODIFICATIONS ET UPDATE*/ $liste_champs = ''; foreach ($aColumnsTot[$id_page] as $key => $val) { if ($val['modifiable'] == 't' and $val['table_champ'] == "ddd" and $val['nom_champ'] != "id_from") { /*récupération des champs modifiables*/ $liste_champs .= "\"" . $val['champ_interface'] . "\","; /*construction de l'update*/ if ($val['type'] == 'string') { $values .= sql_format_quote($_POST[$val['champ_interface']], 'do') . ","; } if ($val['type'] == 'val') { $values .= sql_format_quote($_POST[$val['champ_interface']], 'do') . ","; } if ($val['type'] == 'bool') { $values .= sql_format_bool($_POST[$val['champ_interface']]) . ","; } if ($val['type'] == 'int') { $values .= sql_format_num($_POST[$val['champ_interface']]) . ","; } } } $insert = "INSERT INTO fsd.ddd (" . rtrim($liste_champs, ',') . ") VALUES (" . rtrim($values, ',') . ") RETURNING uid"; /*INSERT*/ if (DEBUG) { echo "<br>" . $insert; } $result = pg_query($db, $insert) or die("Erreur pgSQL : " . pg_result_error($result));
echo "<label class=\"preField_calc\">Discussion sur la fiche</label>"; } else { echo "<label class=\"preField\">Discussion sur la fiche</label>"; } if ($niveau < 64) { echo "<textarea name=\"commentaire_eval\" {$disa} style=\"width:100em;background-color: #EFEFEF;\" rows=\"4\" ></textarea><br><br>"; } else { echo "<textarea name=\"commentaire_eval\" style=\"width:100em;\" rows=\"4\" ></textarea><br><br>"; } echo "<table>"; while ($val = pg_fetch_row($discussion)) { echo "<tr valign=top style=\"border-bottom:1pt solid #D0C5AA;\">"; if (empty($val)) { echo "<td>Pas de commentaire à ce jour</td>"; } else { echo "<td style=\"padding-right: 10px\";>{$val['0']} :</td><td>" . sql_format_quote($val[1], 'undo_hmtl') . "</td>"; } echo "</tr>"; } echo "</table>"; echo "</fieldset>"; echo "</div>"; } /* ----------------------------------------------------------------------------- EDIT SAVE*/ echo "<div style=\"float:right;\"><br>"; if ($mode == "edit") { echo "<button id=\"enregistrer2-edit-button\">" . $lang[$lang_select]['enregistrer'] . "</button> "; echo "<button id=\"retour2-button\">" . $lang[$lang_select]['liste_taxons'] . "</button> "; } else { echo "<button id=\"retour4-button\">" . $lang[$lang_select]['retour'] . "</button> "; }
/*--------------------------------------------------*/ /*ici ajouter la GESTION DES MODIFICATIONS ET SUIVI*/ /*-------------------------------------------------*/ } else { // ADD //------------------------------------------------------------------------------ Valeurs numériques if ($_POST['etape'] == "") { $_POST['etape'] = 2; } //------------------------------------------------------------------------------ /*Paramètre à ajouter*/ $in["cd_ref"] = sql_format_num($_POST["cd_ref"]); $in["famille"] = sql_format_quote($_POST["famille"], 'do'); $in["nom_sci"] = sql_format_quote($_POST["nom_sci"], 'do'); $in["cd_rang"] = sql_format($_POST["cd_rang"]); $in["nom_verna"] = sql_format_quote($_POST["nom_verna"], 'do'); $in["hybride"] = sql_format_bool($_POST["hybride"], 'do'); $rub[$id_page] = 'true'; $uid = add_taxon($in, $rub); add_suivi2($_POST["etape"], $id_user, $uid, "taxons", "nom", null, sql_format_num($_POST["nom_sci"]), 'applications', 'manuel', 'ajout'); add_suivi2($_POST["etape"], $id_user, $uid, "taxons", "uid", null, $uid, 'applications', 'manuel', 'ajout'); } /* if (!DEBUG) { echo ("<script language=\"javascript\" type=\"text/javascript\">"); echo ("window.location.replace ( \"index.php\")"); echo ("</script>"); } */ pg_close($db); return true;
} else { if ($key == 'checkbox') { $sOutput .= '"<input type=checkbox class=\\"liste-one\\" name=id[] value=\\"' . $row['uid'] . '\\" >",'; } else { if (!empty($ref[$key])) { $sOutput .= '"' . $ref[$key][$row[$key]] . '",'; } elseif ($value["type"] == "bool") { if ($row[$key] == 't') { $sOutput .= '"oui",'; } elseif ($row[$key] == 'f') { $sOutput .= '"non",'; } else { $sOutput .= '"' . $row[$key] . '",'; } } else { $sOutput .= '"' . sql_format_quote($row[$key], 'undo_table') . '",'; } } } } } } /*---------------*/ /*dernières colonnes*/ /*---------------*/ $sOutput = trim($sOutput, ','); $sOutput .= "],"; } $sOutput = substr_replace($sOutput, "", -1); $sOutput .= '] }'; echo $sOutput;
pg_free_result($result3); if (pg_num_rows($result1)) { echo "<br>"; //------------------------------------------------------------------------------ echo "<fieldset><LEGEND>" . $lang[$lang_select]['groupe_lsi_1'] . "</LEGEND>"; metaform_text("Titre", null, 70, null, "title", sql_format_quote(pg_result($result1, 0, "title"), 'undo_text')); metaform_text("Date", null, 20, null, "date", sql_format_quote(pg_result($result1, 0, "date"), 'undo_text')); metaform_sel("Sujet", "", "", $subject, "id_subject", pg_result($result1, 0, "sub")); echo "<br>"; echo "<label class=\"preField\">Extrait</label><textarea name=\"abstract\" id=\"abstract\" cols=\"150\" rows=\"2\" />" . sql_format_quote(pg_result($result1, 0, "abstract"), 'undo') . "</textarea> "; echo "<br><br>"; metaform_sel_multi("TAG", "", 5, "width: 120px;", "OnDblClick='javascript: deplacer( this.form.tag, this.form.tag_select);' ", $tag, "tag", ""); metaform_sel_multi("TAG Selectionné(s)", "", 5, "width: 120px;", "OnDblClick='javascript: deplacer( this.form.tag_select, this.form.tag);'", $tag_select, "tag_select", ""); echo "<br><br>"; metaform_text("Lien hypertexte", null, 150, null, "link", sql_format_quote(pg_result($result1, 0, "link"), 'undo_text')); metaform_text("Lien hypertexte 2", null, 150, null, "link_2", sql_format_quote(pg_result($result1, 0, "link_2"), 'undo_text')); echo "</fieldset>"; //------------------------------------------------------------------------------ echo "<br>"; echo "<div style=\"float:right;\">"; if ($mode == "edit") { echo "<button id=\"enregistrer2-edit-button\";>" . $lang[$lang_select]['enregistrer'] . "</button> "; echo "<button id=\"retour2-button\">" . $lang[$lang_select]['lsi'] . "</button> "; } else { echo "<button id=\"retour4-button\">" . $lang[$lang_select]['retour'] . "</button> "; } echo "</div>"; echo "</form>"; echo "<div id=\"fiche\" >"; echo "<fieldset><LEGEND>Ajouter un tag</LEGEND>"; echo "<form method=\"POST\" id=\"form_add\" class=\"form_add\" name=\"edit\" action=\"\">";
$result = pg_query($db, $insert) or die("Erreur pgSQL : " . pg_result_error($result)); add_suivi2($etape, $id_user, $id, "discussion", "commentaire_eval", "", sql_format_quote($_POST[commentaire_eval], 'do'), $id_page, 'manuel', "ajout"); } } } } else { /*Nothing ==> go Refnat*/ } /*Avancement*/ $query = "UPDATE lr.evaluation SET avancement = 2 WHERE uid = {$id};"; $result = pg_query($db, $query) or die("Erreur pgSQL : " . pg_result_error($result)); break; case "validation": $id = $_GET['id']; $class_valid = $_GET['class_valid']; $val_com = sql_format_quote($_GET['val_com'], 'do'); $id_user = $_SESSION['id_user']; $db = sql_connect(SQL_base); foreach ($id as $uid) { //------------------------------------------------------------------------------ Query $query = "SELECT evaluation.etape, evaluation.version,evaluation.avancement, validation FROM lr.evaluation \n\tLEFT JOIN lr.validation ON evaluation.uid = validation.uid\n\tWHERE evaluation.uid={$uid} ;"; $result = pg_query($db, $query) or die("Erreur pgSQL : " . pg_result_error($result)); $row = pg_fetch_assoc($result); //------------------------------------------------------------------------------ MAIN if ($row['avancement'] == 3 and $class_valid == 'valid') { if ($row['validation'] == null) { $query = "INSERT INTO lr.validation(uid, etape_val, version_val, id_user, validation, val_com, dat_val) VALUES ({$uid}, '" . $row['etape'] . "', " . $row['version'] . ", '{$id_user}', 'valid', null, NOW());"; } else { $query = "UPDATE lr.validation SET validation='valid', val_com=null, dat_val=NOW() WHERE uid={$uid} AND etape_val= " . $row['etape'] . " AND version_val=" . $row['version'] . " AND id_user='******';"; } echo "<BR>{$uid} validé";
if (!empty($_POST['idCatalogue2'])) { add_suivi2($_POST["etape"], $id_user, sql_format_quote($uid, 'do'), "st_catalogue_description", "identifiantCatalogue", null, $_POST["idCatalogue2"], 'syntaxa', 'manuel', 'ajout'); add_suivi2($_POST["etape"], $id_user, sql_format_quote($uid, 'do'), "st_catalogue_description", "libelleCatalogue", null, $_POST["libelleCatalogue2"], 'syntaxa', 'manuel', 'ajout'); } } else { echo "</br> pas d'insertion de nouveau catalogue dans st_catalogue_description"; } add_suivi2($_POST["etape"], $id_user, sql_format_quote($uid, 'do'), "st_syntaxon", "idCatalogue", null, $_POST["idCatalogue"], 'syntaxa', 'manuel', 'ajout'); add_suivi2($_POST["etape"], $id_user, sql_format_quote($uid, 'do'), "st_chorologie", "idTerritoire", null, $_POST["idTerritoireObligatoire"], 'syntaxa', 'manuel', 'ajout'); add_suivi2($_POST["etape"], $id_user, sql_format_quote($uid, 'do'), "st_chorologie", "idChorologie", null, $id_chrologie, 'syntaxa', 'manuel', 'ajout'); add_suivi2($_POST["etape"], $id_user, sql_format_quote($uid, 'do'), "st_chorologie", "statutChorologie", null, $_POST["statutChorologie"], 'syntaxa', 'manuel', 'ajout'); add_suivi2($_POST["etape"], $id_user, sql_format_quote($uid, 'do'), "st_syntaxon", "codeEnregistrementSyntax", null, $uid, 'syntaxa', 'manuel', 'ajout'); add_suivi2($_POST["etape"], $id_user, sql_format_quote($uid, 'do'), "st_syntaxon", "idSyntaxon", null, $_POST["idSyntaxon"], 'syntaxa', 'manuel', 'ajout'); add_suivi2($_POST["etape"], $id_user, sql_format_quote($uid, 'do'), "st_syntaxon", "nomSyntaxon", null, $_POST["nomSyntaxon"], 'syntaxa', 'manuel', 'ajout'); add_suivi2($_POST["etape"], $id_user, sql_format_quote($uid, 'do'), "st_syntaxon", "auteurSyntaxon", null, $_POST["auteurSyntaxon"], 'syntaxa', 'manuel', 'ajout'); add_suivi2($_POST["etape"], $id_user, sql_format_quote($uid, 'do'), "st_syntaxon", "nomCompletSyntaxon", null, $_POST['nomSyntaxon'] . " " . $_POST['auteurSyntaxon'], 'syntaxa', 'manuel', 'ajout'); add_suivi2($_POST["etape"], $id_user, sql_format_quote($uid, 'do'), "st_syntaxon", "rangSyntaxon", null, $_POST["rangSyntaxon"], 'syntaxa', 'manuel', 'ajout'); /* if (!DEBUG) { echo ("<script language=\"javascript\" type=\"text/javascript\">"); echo ("window.location.replace ( \"index.php\")"); echo ("</script>"); } */ } pg_close($db); return true; //------------------------------------------------------------------------------ SI PAS ACCES } else { require "../commun/access_denied.php"; }
metaform_text("Identifiant du syntaxon", " bloque", 20, "", "idSyntaxon", pg_result($result, 0, "\"{$colname3}\""), pg_fetch_result(pg_query($db, $query_description . "'{$colname3}'" . ";"), 0, "description")); echo "</td><td>"; metaform_text("Identifiant du syntaxon retenu", " bloque", 20, "", "idSyntaxonRetenu", pg_result($result, 0, "\"{$colname10}\""), pg_fetch_result(pg_query($db, $query_description . "'{$colname10}'" . ";"), 0, "description")); echo "</td></tr></table>"; echo "<table border=0 width=\"100%\"><tr valign=top >"; echo "<td style=\"width: 800px;\">"; //metaform_text ("Code de l'enregistrement"," ",20,"","codeEnregistrementSyntax",sql_format_quote(pg_result($result,0,"\"$colname1\"" ),'undo_text')); metaform_text("Nom du syntaxon", "", 100, "", "nomSyntaxon", pg_result($result, 0, "\"{$colname2}\""), pg_fetch_result(pg_query($db, $query_description . "'{$colname2}'" . ";"), 0, "description")); metaform_text("Auteur du syntaxon", "", 100, "", "auteurSyntaxon", sql_format_quote(pg_result($result, 0, "\"{$colname4}\""), 'undo_text'), pg_fetch_result(pg_query($db, $query_description . "'{$colname4}'" . ";"), 0, "description")); metaform_text("Nom complet du syntaxon", " bloque", 100, "", "nomCompletSyntaxon", pg_result($result, 0, "\"{$colname5}\""), pg_fetch_result(pg_query($db, $query_description . "'{$colname5}'" . ";"), 0, "description")); metaform_text("Nom raccourcit", " bloque", 100, "", "nomSyntaxonRaccourci", pg_result($result, 0, "\"{$colname6}\""), pg_fetch_result(pg_query($db, $query_description . "'{$colname6}'" . ";"), 0, "description")); metaform_sel("Type de synonymie", "", 100, $ref[$champ_ref['typeSynonymie']], "typeSynonymie", pg_result($result, 0, "\"{$colname8}\""), pg_fetch_result(pg_query($db, $query_description . "'{$colname8}'" . ";"), 0, "description")); metaform_text("Nom syntaxon retenu", " bloque", 100, "", "nomSyntaxonRetenu", pg_result($result, 0, "\"{$colname9}\""), pg_fetch_result(pg_query($db, $query_description . "'{$colname9}'" . ";"), 0, "description")); echo "</td></tr></table>"; $tooltip = pg_fetch_result(pg_query($db, $query_description . "'{$colname7}'" . ";"), 0, "description"); echo "<br><label title= \"{$tooltip}\" class=\"preField\">Remarque nomenclaturale</label><textarea name=\"rqNomenclaturale\" style=\"width:70em;\" rows=\"2\" >" . sql_format_quote(pg_result($result, 0, "\"{$colname7}\""), 'undo_hmtl') . "</textarea><br><br>"; echo "<table border=0 width=\"100%\"><tr valign=top >"; echo "</td><td style=\"width:300px;\">"; //metaform_text ("Code REF."," bloque",8,"","cd_ref",pg_result($result,0,"cd_ref")); metaform_sel("Rang syntaxon", "", "", $ref[$champ_ref[$colname11]], "rangSyntaxon", pg_result($result, 0, "\"{$colname11}\""), pg_fetch_result(pg_query($db, $query_description . "'{$colname11}'" . ";"), 0, "description")); /* //bout de code a utiliser si on veut aller vers une fiche taxon dans refnat echo ("</td><td>"); if ($niveau >= 128) echo ("<a href = \"../refnat/index.php?m=edit&id=$id\" class=edit id=\"modif_taxon\" ><img src=\"../../_GRAPH/psuiv.gif\" title=\"Accès rapide Refnat\" ></a>"); */ echo "</td></tr></table>"; echo "</fieldset>"; /*------------------------------------------------------------------------------ EDIT fieldset2*/ echo "<fieldset><LEGEND>Bibliographie</LEGEND>"; echo "<div id=\"p_scents\">\n\t\t\t\t<p><TABLE BORDER=\"0\"> <caption align=\"left\"> Correspondance des habitats </caption> \n\t\t\t\t<tr valign=top ><th> Typologie </th> <th> Code habitat </th> </tr> \n\t\t\t\t<tr>\n\t\t\t\t<th> <label for=\"p_scnts\"><input type=\"text\" id=\"p_scnt_code\" size=\"20\" name=\"code\" value=\"\" placeholder=\"Valeur de l'input\" /> </label></th> \n\t\t\t\t<th> <label for=\"p_scnts\"><input type=\"text\" id=\"p_scnt_typo\" size=\"20\" name=\"typo\" value=\"\" placeholder=\"Valeur de l''input\" /> </label></th> \n\t\t\t\t</tr> </TABLE></p> </div>"; echo "<p colspan=\"4\" align=\"left\"><button type=\"button\" href=\"#\" id=\"addScnt\">Ajouter un habitat</button></p>";
$result = pg_query($db, $query) or die("Erreur pgSQL : " . pg_result_error($result)); } if (!empty($add)) { foreach ($add as $field => $val) { $query = $query . "INSERT INTO lsi.coor_news_tag VALUES ({$id},{$val}); "; } if (DEBUG) { echo "<br>" . $query; } $result = pg_query($db, $query) or die("Erreur pgSQL : " . pg_result_error($result)); } //------------------------------------------------------------------------------ } else { // ADD //------------------------------------------------------------------------------ $query = "INSERT INTO lsi.news (abstract,link,link_2,id_subject,date,title) \n\t\tVALUES (\n\t\t" . sql_format_quote($_POST["abstract"], 'do') . ",\n\t\t" . sql_format_quote($_POST["link"], 'do') . ",\n\t\t" . sql_format_quote($_POST["link_2"], 'do') . ",\n\t\t" . sql_format_num($_POST["id_subject"]) . ",\n\t\t" . sql_format($_POST["date"]) . ",\n\t\t" . sql_format_quote($_POST["title"], 'do') . ") RETURNING id;"; // echo $query; if (DEBUG) { echo "<br>" . $query; } $result = pg_query($db, $query) or die("Erreur pgSQL : " . pg_result_error($result)); $id = pg_result($result, 0, "id"); $add = $_POST["tag_select"]; $query = ''; if (!empty($add)) { foreach ($add as $field => $val) { $query .= "INSERT INTO lsi.coor_news_tag VALUES ({$id},{$val}); "; } if ($query != '') { $result = pg_query($db, $query) or die("Erreur pgSQL : " . pg_result_error($result)); }
if ($row['nbm5_post1990_est'] != '') { $sOutput .= '"' . $row['nbm5_post1990_est'] . '",'; } else { $sOutput .= '"' . $row['nbm5_post1990'] . '",'; } } else { if ($key == 'notes') { if ($row['notes'] != '') { $sOutput .= '"<a id=\\"' . $row['uid'] . '\\" ><img src=\\"../../_GRAPH/mini/info-icon.png\\" title=\\"' . sql_format_quote($row['notes'], "undo_list") . '\\" ></a>",'; } else { $sOutput .= '"",'; } } else { if ($key == 'val_com') { if ($row['val_com'] != '') { $sOutput .= '"<a id=\\"' . $row['uid'] . '\\" ><img src=\\"../../_GRAPH/mini/info-icon.png\\" title=\\"' . sql_format_quote($row['val_com'], "undo_list") . '\\" ></a>",'; } else { $sOutput .= '"",'; } } else { if ($key == 'bouton') { if ($droit['edit_fiche']) { $sOutput .= '"' . bt_edit($row['uid']) . '",'; } elseif ($droit['view_fiche']) { $sOutput .= '"' . bt_view($row['uid']) . '",'; } else { $sOutput .= '"",'; } } else { if ($key == 'checkbox') { $sOutput .= '"<input type=checkbox class=\\"liste-one\\" name=id[] value=\\"' . $row['uid'] . '\\" >",';
echo "<br> plusieurs cases cochées"; } $pairs = explode("&", str_replace('%5B%5D', '[]', $_POST['select'])); foreach ($pairs as $key => $value) { $id = ltrim($value, "id[]="); $where .= "\"codeEnregistrementSyntax\"='" . $id . "' OR "; $where2 .= "\"codeEnregistrement\"='" . $id . "' OR "; $where3 .= "\"codeEnregistrementSyntaxon\"='" . $id . "' OR "; add_suivi2(1, $id_user, sql_format_quote($id, 'do'), 'st_syntaxon', 'codeEnregistrementSyntax', $id, null, $id_page, 'manuel', 'suppr'); add_suivi2(1, $id_user, sql_format_quote($id, 'do'), 'st_chorologie', 'codeEnregistrement', $id, null, $id_page, 'manuel', 'suppr'); add_suivi2(1, $id_user, sql_format_quote($id, 'do'), "st_biblio", "codeEnregistrement", $id, null, $id_page, 'manuel', 'suppr'); add_suivi2(1, $id_user, sql_format_quote($id, 'do'), "st_correspondance_pvf", "codeEnregistrementSyntaxon", $id, null, $id_page, 'manuel', 'suppr'); add_suivi2(1, $id_user, sql_format_quote($id, 'do'), "st_correspondance_eunis", "codeEnregistrement", $id, null, $id_page, 'manuel', 'suppr'); add_suivi2(1, $id_user, sql_format_quote($id, 'do'), "st_correspondance_hic", "codeEnregistrement", $id, null, $id_page, 'manuel', 'suppr'); add_suivi2(1, $id_user, sql_format_quote($id, 'do'), "st_etage_veg", "codeEnregistrement", $id, null, $id_page, 'manuel', 'suppr'); add_suivi2(1, $id_user, sql_format_quote($id, 'do'), "st_etage_bioclim", "codeEnregistrement", $id, null, $id_page, 'manuel', 'suppr'); } $where = rtrim($where, "OR "); $where2 = rtrim($where2, "OR "); $where3 = rtrim($where3, "OR "); $query = "\n\tDELETE FROM syntaxa.st_syntaxon WHERE {$where};\n\tDELETE FROM syntaxa.st_chorologie WHERE {$where2};\n\tDELETE FROM syntaxa.st_biblio WHERE {$where2};\n\tDELETE FROM syntaxa.st_correspondance_pvf WHERE {$where3};\n\tDELETE FROM syntaxa.st_correspondance_eunis WHERE {$where2};\n\tDELETE FROM syntaxa.st_correspondance_hic WHERE {$where2};\n\tDELETE FROM syntaxa.st_etage_veg WHERE {$where2};\n\tDELETE FROM syntaxa.st_etage_bioclim WHERE {$where2};\n\t"; if (DEBUG) { echo "<br> effacé de st_syntaxon=" . $where; } if (DEBUG) { echo "<br> effacé de st_chorologie et biblio=" . $where2; } if (DEBUG) { echo "<br> effacé de st_correspondance_pvf where3=" . $where3; } echo $query;
// echo "<BR>"; metaform_text("Jeu de données", " bloque", 40, "", "typ_jdd", sql_format_quote($row["typ_jdd"], "undo")); // echo "<BR>"; metaform_text("Identifiant du champ", " bloque", 40, "", "cd_ddd", sql_format_quote($row["cd_ddd"], "undo")); echo "<BR>"; metaform_text("Ordre de la table", $desc, 10, "", "ordre_table", sql_format_quote($row["ordre_table"], "undo")); metaform_text("Code de la table", $desc, 40, "", "cd_table", sql_format_quote($row["cd_table"], "undo")); echo "<BR>"; metaform_text("Ordre du champ", $desc, 10, "", "ordre_champ", sql_format_quote($row["ordre_champ"], "undo")); metaform_text("Code du champ", $desc, 40, "", "cd_champ", sql_format_quote($row["cd_champ"], "undo")); echo "<BR>"; metaform_text("Obligation", $desc, 10, "", "obligation", sql_format_quote($row["obligation"], "undo")); metaform_text("Unicité", $desc, 10, "", "unicite", sql_format_quote($row["unicite"], "undo")); echo "<BR>"; echo "<label class=\"preField\">Règles de renseignement</label>"; echo "<textarea name=\"regle\" {$disa} style=\"width:80%;{$gris}\" rows=\"3\" >" . sql_format_quote($row["regle"], "undo") . "</textarea><br><br>"; // metaform_text ("Bonne pratique",$desc,60,"","regle",sql_format_quote($row["regle"],"undo")); echo "<BR>"; echo "</fieldset>"; echo "</div>"; } /* ------------------------------------------------------------------------------ EDIT catnat SAVE*/ echo "<div style=\"float:right;\"><br>"; if ($mode == "fsd") { echo "<button id=\"enregistrer2-edit-button\">" . $lang[$lang_select]['enregistrer'] . "</button> "; echo "<button id=\"retour2-button\">" . $lang[$lang_select]['liste_champ'] . "</button> "; } else { echo "<button id=\"retour4-button\">" . $lang[$lang_select]['retour'] . "</button> "; } echo "</div>"; echo "</form>";
echo "<fieldset><LEGEND> Bug ou remarque </LEGEND>"; echo "<label class=\"preField_calc\">Type</label>"; echo "<select id=\"cat\" name=\"cat\" readonly disabled>"; for ($i = 0; $i < sizeof($cat_txt); $i++) { echo "<option value=\"{$i}\" " . ($i == pg_result($result, 0, "cat") ? "SELECTED" : "") . ">" . $cat_txt[$i] . "</option>"; } echo "</select><br>"; // echo ("<label class=\"preField\">Date</label><input type=\"text\" size=\"10\" maxlength=\"10\" value=\"".$date_bug."\" readonly /><br>"); metaform_text("Date", $desc, 10, null, "date", $arr["date_bug"]); // echo ("<label class=\"preField\">Auteur</label><input type=\"text\" size=\"40\" value=\"".$arr["nom"]." ".$arr["prenom"]."\" readonly /><br>"); metaform_text("Auteur", $desc, 40, "", "auteur", $arr["nom"] . " " . $arr["prenom"]); echo "<label class=\"preField_calc\">Rubrique</label><select id=\"id_rubrique\" name=\"id_rubrique\" readonly disabled>"; for ($i = 0; $i < sizeof($rubriques_txt); $i++) { echo "<option value=\"{$i}\" " . ($i == pg_result($result, 0, "id_rubrique") ? "SELECTED" : "") . ">" . $rubriques_txt[$i] . "</option>"; } echo "</select><br>"; echo "<label class=\"preField\">Description</label><textarea name=\"descr\" id=\"descr\" style=\"width:30em;\" rows=\"2\">" . sql_format_quote(pg_result($result, 0, "descr"), 'undo_hmtl') . "</textarea><br>"; echo "</fieldset>"; echo "<fieldset><LEGEND> Gestion (ADMIN.)</LEGEND>"; echo "<label class=\"preField\">Statut</label><select id=\"statut\" name=\"statut\" >"; for ($i = 0; $i < sizeof($statut_txt); $i++) { echo "<option value=\"{$i}\" " . ($i == pg_result($result, 0, "statut") ? "SELECTED" : "") . ">" . $statut_txt[$i] . "</option>"; } echo "</select><br>"; echo "<label class=\"preField\">Commentaire</label><textarea name=\"statut_descr\" id=\"statut_descr\" style=\"width:30em;\" rows=\"2\" >" . sql_format_quote(pg_result($result, 0, "statut_descr"), 'undo_hmtl') . "</textarea><br>"; echo "</fieldset>"; } else { die("ID " . $id . " > Pas de résultats !"); } } echo "</form>";
function frt($field, $value) { /*Cette fonction a pour objectif de transformer les valeur passer dans les formulaire depuis des champ text en valeurs adapté pour la base de données De plus il utilise la fonction sql_format_quote pour s'occuper des soucis potentiels d'apostrophe et de guillemets Par exemple, un champ texte vide sera transformé de '' en null */ global $aColumnsTot; $type = $aColumnsTot[$_SESSION['page']][$field]['type']; echo "<BR> type {$type}"; if ($type == 'string' and $value == '') { $value = "NULL"; } else { if ($type == 'string') { $value = sql_format_quote($value, 'do'); } else { if ($type == 'int' and $value == null) { $value = pg_escape_string($value); $value = "NULL"; } else { if ($type == 'int') { $value = $value; } else { if ($type == 'val') { $value = $value; } else { if ($type == 'bool' and $value == 'oui') { $value = "true"; } else { if ($type == 'bool' and $value == 'non') { $value = "false"; } else { if ($type == 'bool' and $value == null) { $value = "NULL"; } else { if ($type == 'bool' and $value == 0) { $value = "NULL"; } else { if ($type == 'bool') { $value = $value; } else { $value = $value; } } } } } } } } } } return $value; }
echo "</fieldset>"; /*------------------------------------------------------------------------------ EDIT fieldset6*/ //---------6eme encadré de la page echo "<fieldset><LEGEND>Phénologie, physionomie, écologie</LEGEND>"; /*écologie générale*/ metaform_text_area("Description écologie", "", 57, 50, "", "descriptionEcologie", sql_format_quote(pg_result($result_syntaxon, 0, "\"descriptionEcologie\""), 'undo'), pg_fetch_result(pg_query($db, $query_description . "'descriptionEcologie'" . ";"), 0, "description")); echo "<table><tr><td width=33%>"; metaform_sel("Type physionomique)", "", 30, $ref[$champ_ref['typePhysionomique']], "typePhysionomique", pg_result($result_syntaxon, 0, "\"typePhysionomique\""), pg_fetch_result(pg_query($db, $query_description . "'typePhysionomique'" . ";"), 0, "description")); echo "</td><td width=33%>"; metaform_text("Type biologique dominant", "", 30, "width=100%", "typeBiologiqueDom", sql_format_quote(pg_result($result_syntaxon, 0, "\"typeBiologiqueDom\""), 'undo'), pg_fetch_result(pg_query($db, $query_description . "'typeBiologiqueDom'" . ";"), 0, "description")); echo "</td><td width=33%>"; metaform_text("Aire minimale d'expression (m2)", "", 30, "width=100%", "aireMinimale", sql_format_quote(pg_result($result_syntaxon, 0, "\"aireMinimale\""), 'undo'), pg_fetch_result(pg_query($db, $query_description . "'aireMinimale'" . ";"), 0, "description")); echo "</td></tr></table>"; echo "<br>"; echo "<table><tr><td width=33%>"; metaform_text_area("Remarque phénologie", "", 57, 50, "", "rqPhenologie", sql_format_quote(pg_result($result_syntaxon, 0, "\"rqPhenologie\""), 'undo'), pg_fetch_result(pg_query($db, $query_description . "'rqPhenologie'" . ";"), 0, "description")); echo "</td><td width=33%>"; metaform_sel("Début de période optimale", "", 30, $ref[$champ_ref['periodeDebObsOptimale']], "periodeDebObsOptimale", pg_result($result_syntaxon, 0, "\"periodeDebObsOptimale\""), pg_fetch_result(pg_query($db, $query_description . "'periodeDebObsOptimale'" . ";"), 0, "description")); echo "</td><td width=33%>"; metaform_sel("Fin de période optimale", "", 30, $ref[$champ_ref['periodeFinObsOptimale']], "periodeFinObsOptimale", pg_result($result_syntaxon, 0, "\"periodeFinObsOptimale\""), pg_fetch_result(pg_query($db, $query_description . "'periodeFinObsOptimale'" . ";"), 0, "description")); echo "</td></tr></table>"; echo "<br>"; echo "<table><tr><td width=50%>"; metaform_sel("Humidité principale", "", 30, $ref[$champ_ref['humiditePrincipale']], "humiditePrincipale", pg_result($result_syntaxon, 0, "\"humiditePrincipale\""), pg_fetch_result(pg_query($db, $query_description . "'humiditePrincipale'" . ";"), 0, "description")); echo "</td><td width=50%>"; metaform_sel("Humidité secondaire", "", 30, $ref[$champ_ref['humiditeSecondaire']], "humiditeSecondaire", pg_result($result_syntaxon, 0, "\"humiditeSecondaire\""), pg_fetch_result(pg_query($db, $query_description . "'humiditeSecondaire'" . ";"), 0, "description")); echo "</td></tr></table>"; echo "<br>"; echo "<table><tr><td width=50%>"; metaform_sel("Ph principal", "", 30, $ref[$champ_ref['phPrincipal']], "phPrincipal", pg_result($result_syntaxon, 0, "\"phPrincipal\""), pg_fetch_result(pg_query($db, $query_description . "'phPrincipal'" . ";"), 0, "description")); echo "</td><td width=50%>";
// Version 1.10 10/08/14 - MaJ pgSQL // //------------------------------------------------------------------------------// //----------------------------------------------------------------------------- INIT. include "../../_INCLUDE/config_sql.inc.php"; include "../../_INCLUDE/fonctions.inc.php"; //------------------------------------------------------------------------------ PARMS. $id = $_POST['id']; //------------------------------------------------------------------------------ VAR. //------------------------------------------------------------------------------ CONNEXION SERVEUR PostgreSQL $db = sql_connect(SQL_base); if (!$db) { fatal_error("Impossible de se connecter au serveur PostgreSQL.", false); } //------------------------------------------------------------------------------ MAIN if (!empty($id)) { $query = "UPDATE " . SQL_schema_app . ".bug SET "; foreach ($_POST as $field => $val) { if ($field == "descr") { $query .= $field . "=" . sql_format_quote($val, 'do') . ","; } elseif ($field == "statut_descr") { $query .= $field . "=" . sql_format_quote($val, 'do') . ","; } elseif ($field != "id") { $query .= $field . "=" . sql_format($val) . ","; } } $query = rtrim($query, ","); $query .= " WHERE id_bug=" . $id; $result = pg_query($db, $query) or die("Erreur pgSQL : " . pg_result_error($result)); } //------------------------------------------------------------------------------ FONCTIONS pg_close();
$sOutput = '{'; $sOutput .= '"sEcho": ' . intval($_GET['sEcho']) . ', '; $sOutput .= '"iTotalRecords": ' . $iTotal . ', '; // $sOutput .= '"iTotalDisplayRecords": '.$iFilteredTotal.', '; $sOutput .= '"iTotalDisplayRecords": ' . $aResultTotal . ', '; $sOutput .= '"aaData": [ '; while ($row = pg_fetch_array($result, NULL, PGSQL_ASSOC)) { $sOutput .= "["; $sOutput .= '"' . $row['uid'] . '",'; $sOutput .= '"<b>' . $row['id_user'] . '</b><br>' . $row['u.nom'] . ' ' . $row['prenom'] . '",'; $sOutput .= '"' . $row['lib_cbn'] . '",'; $sOutput .= '"' . $row['cd_ref'] . '",'; $sOutput .= '"' . $row['nom_scien'] . '",'; $sOutput .= '"' . $row['rubrique'] . '",'; $sOutput .= '"' . $row['type_modif'] . '",'; $sOutput .= '"' . $row['methode'] . '",'; $sOutput .= '"' . $row['description'] . '",'; // $sOutput .= '"'.$row['libelle_1'].'",'; // $sOutput .= '"'.$row['libelle_2'].'",'; $sOutput .= '"' . sql_format_quote($row['libelle_1'], 'undo_hmtl') . '",'; $sOutput .= '"' . sql_format_quote($row['libelle_2'], 'undo_hmtl') . '",'; $sOutput .= '"' . strftime("%d/%m/%Y", strtotime($row['datetime'])) . '",'; $sOutput .= '"' . substr($row['datetime'], 11, 5) . '",'; $sOutput .= '"' . $row['id_suivi'] . '",'; $sOutput .= '"<input type=checkbox class=\\"admin-suivi-liste-one\\" name=id value=\\"' . $row['id_suivi'] . '\\" >"'; $sOutput .= "],"; } $sOutput = substr_replace($sOutput, "", -1); $sOutput .= '] }'; echo $sOutput; //------------------------------------------------------------------------------ FONCTIONS
$modif = check_modif($val_1, $val_2, $field); if ($modif != 'vide' and $modif != 'identiques') { add_suivi2($_POST["etape"], $id_user, $id, "taxons", $field, $val_1, $val_2, 'eee', 'manuel', $modif); /*Suivi*/ sql_assoc("UPDATE eee.taxons SET {$field} = " . frt($field, $val_2) . " WHERE uid={$id};", false); } } /*Commentaire sur la fiche*/ if (isset($_POST['commentaire_eval'])) { if (!empty($_POST['commentaire_eval'])) { $result = pg_query($db, $query_user . " AND id_user = '******'") or die("Erreur pgSQL : " . pg_result_error($result)); $user = pg_fetch_array($result, NULL, PGSQL_ASSOC); $insert = "INSERT INTO eee.discussion (uid,id_user,nom,prenom,id_cbn,commentaire_eval,datetime) \n\t\t\t\tVALUES ({$id},'{$user['id_user']}','{$user['nom']}','{$user['prenom']}',{$user['id_cbn']}," . sql_format_quote($_POST[commentaire_eval], 'do') . ",NOW())"; // echo $insert; $result = pg_query($db, $insert) or die("Erreur pgSQL : " . pg_result_error($result)); add_suivi2($etape, $id_user, $id, "discussion", "commentaire_eval", "", sql_format_quote($_POST[commentaire_eval], 'do'), $id_page, 'manuel', "ajout"); } } } } else { //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ ADD. /*Nothing ==> go Refnat*/ } /* if (!DEBUG) { echo ("<script language=\"javascript\" type=\"text/javascript\">"); echo ("window.location.replace ( \"index.php\")"); echo ("</script>"); } */
$sOutput .= '"aaData": [ '; while ($row = pg_fetch_array($result, NULL, PGSQL_ASSOC)) { $sOutput .= "["; $sOutput .= '"' . $row['id_bug'] . '",'; if ($row["cat"] != 0) { $sOutput .= '"<img src=\\"../../_GRAPH/mini/cat_' . $row["cat"] . '.png\\" title=\\"' . $cat_txt[$row["cat"]] . '\\" />",'; } else { $sOutput .= '"",'; } $sOutput .= '"' . date("d/m/Y", strtotime($row['date_bug'])) . '",'; $sOutput .= '"' . str_replace('"', '\\"', $row['auteur']) . '",'; $sOutput .= '"<b>' . $rubriques_txt[$row['id_rubrique']] . '</b>",'; $sOutput .= '"' . sql_format_quote($row['descr'], "undo_list") . '",'; $sOutput .= '"<b>' . $statut_txt[$row['statut']] . '</b>",'; if (strlen($row['statut_descr']) > 1) { $sOutput .= '"' . sql_format_quote($row['statut_descr'], "undo_list") . '",'; } else { $sOutput .= '"",'; } $sOutput .= '"' . $row['statut'] . '",'; if ($niveau == 255) { $sOutput .= '"<a class=bug-ok-edit id=\\"' . $row['id_bug'] . '\\" ><img src=\\"../../_GRAPH/mini/edit-icon.png\\" title=\\"Modifier\\" ></a><a class=bug-ok-del id=\\"' . $row['id_bug'] . '\\" ><img src=\\"../../_GRAPH/mini/del-icon.png\\" title=\\"Supprimer\\" ></a>"'; } else { $sOutput .= '""'; } $sOutput .= "],"; } $sOutput = substr_replace($sOutput, "", -1); $sOutput .= '] }'; echo $sOutput; ?>
echo "</fieldset>"; echo "</form>"; switch ($action) { default: break; case "add": $query = "INSERT INTO " . SQL_schema_app . ".bug ("; foreach ($_POST as $field => $val) { if ($field != "action") { $query .= $field . ","; } } $query .= "date_bug) VALUES ("; foreach ($_POST as $field => $val) { if ($field == "descr") { $query .= sql_format_quote($val, 'do') . ","; } elseif ($field != "action") { $query .= sql_format($val) . ","; } } $query .= "NOW())"; // echo $query; $result = pg_query($db, $query) or fatal_error("Erreur pgSQL : " . pg_result_error($result), false); break; } $id_page = "bug-encours"; echo "<div id=\"" . $id_page . "-dialog\"></div>"; aff_table($id_page . "-liste", true, false); echo "</div>"; //------------------------------------------------------------------------------ #Traités echo "<div id=\"tab-ok\" style=\"margin:0;padding:5;min-height:700px;\">";