1 | <?php |
---|
2 | // +-------------------------------------------------+ |
---|
3 | // © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) |
---|
4 | // +-------------------------------------------------+ |
---|
5 | // $Id: param_func.inc.php,v 1.20 2015-04-03 11:16:28 jpermanne Exp $ |
---|
6 | |
---|
7 | if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) die("no access"); |
---|
8 | |
---|
9 | // affichage du form de création/modification paramêtres |
---|
10 | |
---|
11 | require_once($include_path."/parser.inc.php"); |
---|
12 | |
---|
13 | function param_form($id_param=0, $type_param="", $sstype_param="", $valeur_param="", $comment_param="") { |
---|
14 | global $msg; |
---|
15 | global $admin_param_form; |
---|
16 | global $charset; |
---|
17 | |
---|
18 | $title = $msg[1606]; // modification |
---|
19 | |
---|
20 | $admin_param_form = str_replace('!!form_title!!', $title, $admin_param_form); |
---|
21 | $admin_param_form = str_replace('!!id_param!!', $id_param, $admin_param_form); |
---|
22 | $admin_param_form = str_replace('!!type_param!!', $type_param, $admin_param_form); |
---|
23 | $admin_param_form = str_replace('!!sstype_param!!', $sstype_param, $admin_param_form); |
---|
24 | $admin_param_form = str_replace('!!valeur_param!!', htmlentities($valeur_param,ENT_QUOTES,$charset), $admin_param_form); |
---|
25 | $admin_param_form = str_replace('!!comment_param!!', htmlentities($comment_param,ENT_QUOTES,$charset), $admin_param_form); |
---|
26 | |
---|
27 | print $admin_param_form; |
---|
28 | |
---|
29 | } |
---|
30 | |
---|
31 | function _section_($param) { |
---|
32 | global $section_table; |
---|
33 | |
---|
34 | $section_table[$param["NAME"]]["LIB"]=$param["value"]; |
---|
35 | $section_table[$param["NAME"]]["ORDER"]=$param["ORDER"]; |
---|
36 | } |
---|
37 | |
---|
38 | function show_param($dbh) { |
---|
39 | |
---|
40 | global $msg; |
---|
41 | global $begin_result_liste; |
---|
42 | global $form_type_param, $form_sstype_param ; // si modif , ces valeurs sont connues, on va faire une ancre avec |
---|
43 | global $lang; |
---|
44 | global $include_path; |
---|
45 | global $section_table; |
---|
46 | |
---|
47 | $allow_section=0; |
---|
48 | |
---|
49 | if (file_exists($include_path."/section_param/$lang.xml")) { |
---|
50 | _parser_($include_path."/section_param/$lang.xml",array("SECTION"=>"_section_"),"PMBSECTIONS"); |
---|
51 | $allow_section=1; |
---|
52 | } |
---|
53 | print $begin_result_liste ; |
---|
54 | |
---|
55 | $requete = "select * from parametres where gestion=0 order by type_param, section_param, sstype_param "; |
---|
56 | $res = pmb_mysql_query($requete, $dbh); |
---|
57 | $i=0; |
---|
58 | while($param=pmb_mysql_fetch_object($res)) { |
---|
59 | if (!$type_param) { |
---|
60 | $type_param=$param->type_param; |
---|
61 | $creer = 1; |
---|
62 | $fincreer = 0; |
---|
63 | $odd_even=0; |
---|
64 | } elseif ($type_param!=$param->type_param) { |
---|
65 | $type_param=$param->type_param; |
---|
66 | $creer = 1; |
---|
67 | $fincreer = 1; |
---|
68 | $odd_even=0; |
---|
69 | } else { |
---|
70 | $creer = 0; |
---|
71 | $fincreer = 0; |
---|
72 | } |
---|
73 | if (($section_param!=$param->section_param)&&($allow_section)) { |
---|
74 | $section_param=$param->section_param; |
---|
75 | $creer_section=1; |
---|
76 | } else $creer_section=0; |
---|
77 | |
---|
78 | |
---|
79 | if ($fincreer) { |
---|
80 | print "\n</table></div>"; |
---|
81 | } |
---|
82 | if ($creer) { |
---|
83 | |
---|
84 | $lab_param = $msg["param_".$type_param]; |
---|
85 | if ($lab_param=="") $lab_param=$type_param; |
---|
86 | |
---|
87 | print "\n<div id=\"el".$type_param."Parent\" class='parent' width=\"100%\"> |
---|
88 | <img src=\"./images/plus.gif\" class=\"img_plus\" name=\"imEx\" id=\"el".$type_param."Img\" title=\"".$msg['admin_param_detail']."\" border=\"0\" onClick=\"expandBase('el".$type_param."', true); return false;\" hspace=\"3\"> |
---|
89 | <span class='heada'>".$lab_param."</span> |
---|
90 | <br /> |
---|
91 | </div>\n |
---|
92 | <div id=\"el".$type_param."Child\" class=\"child\" style=\"margin-bottom:6px;display:none;\""; |
---|
93 | if ($form_type_param==$type_param) { |
---|
94 | print " startOpen='Yes' " ; |
---|
95 | } |
---|
96 | print ">"; |
---|
97 | print "\n<table><tr>"; |
---|
98 | print " |
---|
99 | <th>".$msg[1603]."</th> |
---|
100 | <th>".$msg[1604]."</th> |
---|
101 | <th>".$msg['param_explication']."</th></tr>"; |
---|
102 | } |
---|
103 | if ($odd_even==0) { |
---|
104 | $class_liste="odd"; |
---|
105 | $odd_even=1; |
---|
106 | } else if ($odd_even==1) { |
---|
107 | $class_liste="even"; |
---|
108 | $odd_even=0; |
---|
109 | } |
---|
110 | $surbrillance = "surbrillance"; |
---|
111 | if ( $param->type_param==$form_type_param && $param->sstype_param==$form_sstype_param) { |
---|
112 | $class_liste.=" justmodified"; |
---|
113 | $surbrillance.=" justmodified"; |
---|
114 | } |
---|
115 | $tr_javascript=" onmouseover=\"this.className='$surbrillance'\" onmouseout=\"this.className='$class_liste'\" onmousedown=\"document.location='./admin.php?categ=param&action=modif&id_param=".$param->id_param."';\" "; |
---|
116 | if ($creer_section) { print "\n<tr><th colspan='3'><b>".$section_table[$section_param]["LIB"]."</b></th></tr>"; } |
---|
117 | if ( $param->type_param==$form_type_param && $param->sstype_param==$form_sstype_param) { |
---|
118 | print "\n<tr class='$class_liste' $tr_javascript style='cursor: pointer;'> |
---|
119 | <td valign='top'><a name='justmodified'></a>$param->sstype_param</td>"; |
---|
120 | } else { |
---|
121 | print "\n<tr class='$class_liste' $tr_javascript style='cursor: pointer'> |
---|
122 | <td valign='top'>$param->sstype_param</td>"; |
---|
123 | } |
---|
124 | print "<td class='ligne_data'>$param->valeur_param</td><td valign='top'>$param->comment_param</td>\n</tr>"; |
---|
125 | } // fin while |
---|
126 | print "</table></div>"; |
---|
127 | |
---|
128 | } |
---|