Update PicoTools

This commit is contained in:
Frederic Guillot 2013-05-26 13:05:53 -04:00
parent c50275cd7d
commit 8cdb47b003
2 changed files with 31 additions and 0 deletions

View File

@ -164,6 +164,25 @@ function form_select($name, array $options, $values = array(), array $errors = a
} }
function form_radios($name, array $options, array $values = array())
{
$html = '';
foreach ($options as $value => $label) {
$html .= form_radio($name, $label, $value, isset($values[$name]) && $values[$name] == $value);
}
return $html;
}
function form_radio($name, $label, $value, $selected = false, $class = '')
{
return '<label><input type="radio" name="'.$name.'" class="'.$class.'" value="'.escape($value).'" '.($selected ? 'selected="selected"' : '').'>'.escape($label).'</label>';
}
function form_label($label, $name, $class = '') function form_label($label, $name, $class = '')
{ {
return '<label for="form-'.$name.'" class="'.$class.'">'.escape($label).'</label>'; return '<label for="form-'.$name.'" class="'.$class.'">'.escape($label).'</label>';

View File

@ -128,6 +128,18 @@ namespace {
} }
function c() {
return call_user_func_array('\PicoTools\Translator\currency', func_get_args());
}
function n() {
return call_user_func_array('\PicoTools\Translator\number', func_get_args());
}
function dt() { function dt() {
return call_user_func_array('\PicoTools\Translator\datetime', func_get_args()); return call_user_func_array('\PicoTools\Translator\datetime', func_get_args());