X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=plugins%2Ffunction.select_db_table.php;h=7c598e8ce1547a0234eacf68f37f09da98c2a74a;hb=92630203925015ac6f70faaf4aacd05d26e5924b;hp=1c7f0722b18da155c3f78efc9db6a97b2a592c67;hpb=a3a049fc80d3707bcc76903ab89f73974c470c0c;p=platal.git diff --git a/plugins/function.select_db_table.php b/plugins/function.select_db_table.php index 1c7f072..7c598e8 100644 --- a/plugins/function.select_db_table.php +++ b/plugins/function.select_db_table.php @@ -1,6 +1,6 @@ \n"; + $html.= '\n"; } - while (list($my_id,$my_text) = $res->next()) { - $html .= sprintf("\n", + $optgrp = null; + while (list($my_id,$my_text,$my_grp) = $res->next()) { + if ($my_grp != $optgrp) { + if (!is_null($optgrp)) { + $html .= ''; + } + $html .= ''; + $optgrp = $my_grp; + } + $html .= sprintf("\n", $my_id, ($valeur==$my_id?$sel:""), $my_text); } + if (!is_null($optgrp)) { + $html .= ''; + } return $html; } function smarty_function_select_db_table($params, &$smarty) { if(empty($params['table'])) - return; + return; if(empty($params['champ'])) - $params['champ'] = 'text'; + $params['champ'] = 'text'; if(empty($params['pad']) || !($params['pad'])) - $pad = false; + $pad = false; else - $pad = true; + $pad = true; if(empty($params['where'])) - $params['where'] = ''; - return select_options($params['table'], $params['valeur'], - $params['champ'], $pad, $params['where']); + $params['where'] = ''; + return select_options($params['table'], $params['valeur'], $params['champ'], $pad, + $params['where'], $params['join'], $params['group']); } +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>