2008-11-26 22:50:40 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* AgileBill - Open Billing Software
|
|
|
|
*
|
|
|
|
* This body of work is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the Open AgileBill License
|
|
|
|
* License as published at http://www.agileco.com/agilebill/license1-4.txt
|
2009-08-03 04:10:16 +00:00
|
|
|
*
|
|
|
|
* Originally authored by Tony Landis, AgileBill LLC
|
|
|
|
*
|
|
|
|
* Recent modifications by Deon George
|
|
|
|
*
|
|
|
|
* @author Deon George <deonATleenooksDOTnet>
|
|
|
|
* @copyright 2009 Deon George
|
|
|
|
* @link http://osb.leenooks.net
|
2008-11-26 22:50:40 +00:00
|
|
|
*
|
|
|
|
* @link http://www.agileco.com/
|
|
|
|
* @copyright 2004-2008 Agileco, LLC.
|
|
|
|
* @license http://www.agileco.com/agilebill/license1-4.txt
|
2009-08-03 04:10:16 +00:00
|
|
|
* @author Tony Landis <tony@agileco.com>
|
|
|
|
* @package AgileBill
|
|
|
|
* @subpackage Template:Calendar
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The main AgileBill Template Calendar Method
|
|
|
|
*
|
2008-11-26 22:50:40 +00:00
|
|
|
* @package AgileBill
|
2009-08-03 04:10:16 +00:00
|
|
|
* @subpackage Template:Calendar
|
2008-11-26 22:50:40 +00:00
|
|
|
*/
|
2009-08-03 04:10:16 +00:00
|
|
|
|
|
|
|
function list_calender_add($field,$default,$css,$fid) {
|
|
|
|
# Set the date to current date if 'now' is set as $default
|
|
|
|
if ($default == 'now')
|
|
|
|
$default = date(UNIX_DATE_FORMAT,time());
|
2008-11-26 22:50:40 +00:00
|
|
|
|
|
|
|
$id = rand(9,999);
|
2009-08-03 04:10:16 +00:00
|
|
|
$ret = '';
|
|
|
|
if ($fid)
|
|
|
|
$ret .= sprintf('<input type="text" id="data_%s_%s_%s" name="%s[%s]" class="%s" size="10" value="%s"/> ',$field,$fid,$id,$field,$fid,$css,$default);
|
|
|
|
else
|
|
|
|
$ret .= sprintf('<input type="text" id="data_%s_%s_%s" name="%s" class="%s" size="10" value="%s"/> ',$field,$fid,$id,$field,$css,$default);
|
|
|
|
$ret .= sprintf('<input type="button" id="trigger_%s_%s_%s" value="+"/>',$field,$fid,$id);
|
|
|
|
$ret .= '<script type="text/javascript">Calendar.setup({';
|
|
|
|
$ret .= sprintf('inputField : "data_%s_%s_%s",',$field,$fid,$id);
|
|
|
|
$ret .= sprintf('ifFormat : "%s",',DEFAULT_DATE_FORMAT);
|
|
|
|
$ret .= sprintf('button : "trigger_%s_%s_%s"',$field,$fid,$id);
|
|
|
|
$ret .= '});</script>';
|
|
|
|
|
2008-11-26 22:50:40 +00:00
|
|
|
return $ret;
|
2009-08-03 04:10:16 +00:00
|
|
|
}
|
2008-11-26 22:50:40 +00:00
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
# @todo Remove?
|
|
|
|
function list_calender_add_static($field,$default,$css) {
|
|
|
|
return list_calender_add($field,$default,$css,'');
|
2008-11-26 22:50:40 +00:00
|
|
|
|
2009-08-03 04:10:16 +00:00
|
|
|
# Set the date to current date if 'now' is set as $default
|
|
|
|
if ($default == 'now')
|
|
|
|
$default = date(UNIX_DATE_FORMAT);
|
2008-11-26 22:50:40 +00:00
|
|
|
|
|
|
|
$id = rand(9,999);
|
|
|
|
$ret = '
|
2009-08-03 04:10:16 +00:00
|
|
|
<input type="text" id="data_'.$field.'_'.$id.'" name="'.$field.'" class="'.$css.'" size="10" value="'.$default.'" />
|
2008-11-26 22:50:40 +00:00
|
|
|
<input type="button" id="trigger_'.$field.'_'.$id.'" value="+">
|
|
|
|
<script type="text/javascript">
|
|
|
|
Calendar.setup(
|
|
|
|
{
|
|
|
|
inputField : "data_'.$field.'_'.$id.'",
|
|
|
|
ifFormat : "'.DEFAULT_DATE_FORMAT.'",
|
|
|
|
button : "trigger_'.$field.'_'.$id.'"
|
|
|
|
}
|
|
|
|
);
|
|
|
|
</script>
|
|
|
|
';
|
|
|
|
return $ret;
|
|
|
|
}
|
2009-08-03 04:10:16 +00:00
|
|
|
?>
|