'info',
'validated' => 'success',
'refused' => 'danger',
'archived' => 'secondary',
);
if (array_key_exists($params['item']->status, $status2class)) {
$class = $status2class[$params['item']->status];
}
else
$class='danger';
echo "";
echo (
array_key_exists($params['item']->status, $status_list)?
$status_list[$params['item']->status]:
"Inconnu (".$params['item']->status.")"
);
echo "";
}
Tpl :: register_function('item_status','smarty_item_status');
function smarty_format_time($params) {
echo Date :: format($params['time'], (!isset($params['with_time']) || (bool)$params['with_time']));
}
Tpl :: register_function('format_time','smarty_format_time');
function smarty_format_size($params, $smarty) {
if(!isset($params['digit'])) $params['digit'] = 2;
echo format_size($params['size'],$params['digit']);
}
Tpl :: register_function('format_size','smarty_format_size');
function smarty_table_ordered_th($params, $smarty) {
if ($params['order'] && $params['url'] && $params['text'] && is_array($params['search'])) {
$params['url'] = Url::add_url_parameter($params['url'], 'order', $params['order']);
printf("%s", $params['url'], $params['text']);
}
if ($params['order'] == $params['search']['order']) {
printf(
' ',
strtolower($params['search']['order_direction']) == 'asc'?
'up':'down'
);
}
}
Tpl :: register_function('table_ordered_th','smarty_table_ordered_th');
function smarty_encodeJsonBase64($params, $smarty) {
if (isset($params['data']))
echo base64_encode(json_encode($params['data']));
}
Tpl :: register_function('encodeJsonBase64','smarty_encodeJsonBase64');
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab