X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=plugins%2Ffunction.select_db_table.php;h=1c7f0722b18da155c3f78efc9db6a97b2a592c67;hb=cab0809050d58f8484608e91f7555ebd69dcb451;hp=47103f3553423af3e693e648fe6984b7531590a3;hpb=50a40a33a496131e817df875607ea5542d096a64;p=platal.git
diff --git a/plugins/function.select_db_table.php b/plugins/function.select_db_table.php
index 47103f3..1c7f072 100644
--- a/plugins/function.select_db_table.php
+++ b/plugins/function.select_db_table.php
@@ -21,9 +21,8 @@
function select_options($table,$valeur,$champ="text",$pad=false,$where="") {
- global $globals;
$sql = "SELECT id,$champ FROM $table $where ORDER BY $champ";
- $res = $globals->xdb->iterRow($sql);
+ $res = XDB::iterRow($sql);
$sel = ' selected="selected"';
// on ajoute une entree vide si $pad est vrai
@@ -32,7 +31,8 @@ function select_options($table,$valeur,$champ="text",$pad=false,$where="") {
$html.= '\n";
}
while (list($my_id,$my_text) = $res->next()) {
- $html .= sprintf("\n",$my_id,($valeur==$my_id?$sel:""),$my_text);
+ $html .= sprintf("\n",
+ $my_id, ($valeur==$my_id?$sel:""), $my_text);
}
return $html;
}
@@ -48,7 +48,8 @@ function smarty_function_select_db_table($params, &$smarty) {
$pad = true;
if(empty($params['where']))
$params['where'] = '';
- return select_options($params['table'], $params['valeur'], $params['champ'], $pad, $params['where']);
+ return select_options($params['table'], $params['valeur'],
+ $params['champ'], $pad, $params['where']);
}
?>