ajout du gamutable générique
This commit is contained in:
parent
36622355fb
commit
d173900903
4 changed files with 96 additions and 1 deletions
17
content/voir_gamutable.html
Normal file
17
content/voir_gamutable.html
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#CACHE{0}
|
||||||
|
|
||||||
|
<div class="conf-inner">
|
||||||
|
<h2 class="text-center">Configuration de #ENV{objet}</h2>
|
||||||
|
<div class="tableau">
|
||||||
|
[(#SET{lien,<a class="popin btn--osdve" href="[(#URL_PAGE{editer_gamuform}|parametre_url{objet,#ENV{objet}}|parametre_url{redirect,#SELF})]"><i class="osdve-plus-circle"></i> Nouveau</a>})]
|
||||||
|
|
||||||
|
#SET{url,spip.php?page=json_gamuform.json&objet=}
|
||||||
|
#SET{url,#GET{url}|concat{#ENV{objet}}}
|
||||||
|
<INCLURE{fond=inclure/gamutable,
|
||||||
|
apiuri=#GET{url},
|
||||||
|
includespip=#GET{lien},
|
||||||
|
env
|
||||||
|
}>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
|
@ -37,3 +37,31 @@ function gamuform_recup_champ($objet) {
|
||||||
}
|
}
|
||||||
return $c;
|
return $c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function gamuform_recup_valeurs($objet, $id_objet = 0):array {
|
||||||
|
$r = [];
|
||||||
|
if (gamuform_objet_autoriser($objet)) {
|
||||||
|
$table = table_objet_sql($objet);
|
||||||
|
$id = id_table_objet($objet);
|
||||||
|
$s = gamuform_recup_champ($objet);
|
||||||
|
|
||||||
|
$s[] = $id;
|
||||||
|
if (intval($id_objet)) {
|
||||||
|
$valeurs = sql_fetsel($s, $table, "$id=".intval($id_objet));
|
||||||
|
$valeurs['id'] = $valeurs[$id];
|
||||||
|
if (!empty($valeurs)) {
|
||||||
|
$r[0] = $valeurs;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$T = sql_allfetsel($s, $table, 1);
|
||||||
|
if (!empty($T)) {
|
||||||
|
foreach ($T as $t) {
|
||||||
|
$t['id'] = $t[$id];
|
||||||
|
$r[] = $t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $r;
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
|
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<div class="ajax">
|
<div class="ajax">
|
||||||
[(#FORMULAIRE_EDITER_GAMUFORM{#ENV{id}, #ENV{objet}, #ENV{redirect}})]
|
[(#FORMULAIRE_EDITER_GAMUFORM{#ENV{id_objet}, #ENV{objet}, #ENV{redirect}})]
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
50
json_gamuform.json.html
Normal file
50
json_gamuform.json.html
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
#HTTP_HEADER{Content-Type: application/json; charset=#CHARSET}
|
||||||
|
|
||||||
|
#SET{header,#ENV{objet}|gamuform_recup_champ}
|
||||||
|
[{
|
||||||
|
"header":{
|
||||||
|
"id": "id",
|
||||||
|
"edit": "",
|
||||||
|
<BOUCLE_header(DATA){source table,#GET{header}}{','}>
|
||||||
|
"#VALEUR" : "#VALEUR"
|
||||||
|
</BOUCLE_header>
|
||||||
|
},
|
||||||
|
"crayons":{
|
||||||
|
},
|
||||||
|
"filtreCol" : {
|
||||||
|
},
|
||||||
|
"classes" : {
|
||||||
|
"id": "w80p",
|
||||||
|
"edit": "w80p"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
<B_gamuform>
|
||||||
|
,
|
||||||
|
<BOUCLE_gamuform(DATA){source table, #ENV{objet}|gamuform_recup_valeurs{#ENV{id}}}{','}>
|
||||||
|
#SET{ligne,#VALEUR}
|
||||||
|
[(#SET{edit, <a class="modalbox"
|
||||||
|
href="[(#URL_PAGE{editer_gamuform}
|
||||||
|
|parametre_url{id_objet,#GET{ligne/id}}
|
||||||
|
|parametre_url{objet,#ENV{objet}}
|
||||||
|
|parametre_url{redirect,gamutable})]">
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a> })]
|
||||||
|
{
|
||||||
|
"html": {
|
||||||
|
"id": #GET{ligne/id},
|
||||||
|
"edit": [(#GET{edit}|json_encode)],
|
||||||
|
<BOUCLE_headerB(DATA){source table,#GET{header}}{','}>
|
||||||
|
"#VALEUR" : [(#GET{ligne/#VALEUR}|json_encode)]
|
||||||
|
</BOUCLE_headerB>
|
||||||
|
},
|
||||||
|
"search": {
|
||||||
|
"id": #GET{ligne/id},
|
||||||
|
"edit": "",
|
||||||
|
<BOUCLE_headerC(DATA){source table,#GET{header}}{','}>
|
||||||
|
"#VALEUR" : [(#GET{ligne/#VALEUR}|textebrut|json_encode)]
|
||||||
|
</BOUCLE_headerC>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</BOUCLE_gamuform>
|
||||||
|
]
|
||||||
|
|
Loading…
Add table
Reference in a new issue