Initial Commit of AgileBill Open Source
This commit is contained in:
28
includes/smarty/plugins/function.html_bool.php
Normal file
28
includes/smarty/plugins/function.html_bool.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Smarty plugin
|
||||
* -------------------------------------------------------------
|
||||
* File: function.html_bool
|
||||
* Type: function
|
||||
* Name: html_bool
|
||||
* -------------------------------------------------------------
|
||||
*/
|
||||
function smarty_function_html_bool($params, &$smarty)
|
||||
{
|
||||
extract($params);
|
||||
|
||||
if(empty($id)) $id = $field;
|
||||
if(empty($value)) $value = '1';
|
||||
|
||||
$extra=' ';
|
||||
if(!empty($onclick)) $extra .= ' onClick="'.$onclick.'" ';
|
||||
|
||||
if($default == $value) $extra .= 'checked ';
|
||||
|
||||
$ret = '<input type="checkbox" name="'.$field.'" id="'.$id.'" value="'.$value.'"'.$extra.'/>';
|
||||
|
||||
return $ret;
|
||||
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user