1 | <?php |
---|
2 | |
---|
3 | function creer_relation($pour,$avec,$edit=true){ |
---|
4 | include_spip('inc/cfg_config'); |
---|
5 | ecrire_config("php::assoc/$pour/$avec","ok"); |
---|
6 | if ($edit) echo get_liste_association(); |
---|
7 | } |
---|
8 | |
---|
9 | |
---|
10 | function supprimer_relation($pour,$avec,$edit=true){ |
---|
11 | include_spip('inc/cfg_config'); |
---|
12 | effacer_config("php::assoc/$pour/$avec"); |
---|
13 | if ($edit) echo get_liste_association(); |
---|
14 | } |
---|
15 | |
---|
16 | |
---|
17 | function creer_type($nom){ |
---|
18 | include_spip('inc/cfg_config'); |
---|
19 | ecrire_config("php::type_assoc/$nom","ok"); |
---|
20 | } |
---|
21 | |
---|
22 | function supprimer_type($nom){ |
---|
23 | include_spip('inc/cfg_config'); |
---|
24 | effacer_config("php::type_assoc/$nom"); |
---|
25 | } |
---|
26 | |
---|
27 | |
---|
28 | function get_liste_association(){ |
---|
29 | include_spip('inc/cfg_config'); |
---|
30 | $tab = lire_config("php::assoc"); |
---|
31 | if (count($tab)==0)return; |
---|
32 | $retour = ""; |
---|
33 | foreach ($tab as $cle=>$val) { |
---|
34 | $pour = $cle; |
---|
35 | foreach ($val as $var=>$va) { |
---|
36 | $retour .="<li id='$pour$var'>$pour - $var <span onclick='delete_relation(\"$pour\",\"$var\")' class='delete_relation'> X</span></li>"; |
---|
37 | } |
---|
38 | } |
---|
39 | return $retour; |
---|
40 | } |
---|
41 | |
---|
42 | function get_liste_type_association(){ |
---|
43 | include_spip('inc/cfg_config'); |
---|
44 | $tab = lire_config("php::type_assoc"); |
---|
45 | if (count($tab)==0)return; |
---|
46 | $retour = ""; |
---|
47 | foreach ($tab as $cle=>$val) $retour .="<option value='$cle'>$cle</option>"; |
---|
48 | $retour .= "@".get_liste_association(); |
---|
49 | return $retour; |
---|
50 | } |
---|
51 | |
---|
52 | ?> |
---|