[size="3"]I have someone who wants to use the day-month-year calendar dropdown instead of the javascript calendar.
Since it starts with 1910 that is a lot of unnecessary scrolling!
I have seen other scripts that let you specify the start year such as "myDate.setFullYear(2010,0,14);" would start the dating at January 14, 2010.
To make the dropdown calendar in PHPRunner 5.3 easier to use is there a way to modify the default script?
Say if I want the dropdown calendar to start with January 01, 2011 ?
Thank you![/size]
from output/commonfunctions.php
// returns HTML code that represents required Date edit control
function GetDateEdit($field, $value, $type, $fieldNum=0,$search=MODE_EDIT,$record_id="",&$pageObj)
{
global $cYearRadius, $locale_info, $jscode, $strTableName;
$is508=isEnableSection508();
$strLabel=Label($field);
$cfieldname=GoodFieldName($field);
$cfield="value_".GoodFieldName($field).'_'.$record_id;
if($fieldNum)
$cfield="value".$fieldNum."_".GoodFieldName($field).'_'.$record_id;
$tvalue=$value;
$time=db2time($tvalue);
if(!count($time))
$time=array(0,0,0,0,0,0);
$dp=0;
switch($type)
{
case EDIT_DATE_SIMPLE_DP:
$ovalue=$value;
if($locale_info["LOCALE_IDATE"]==1)
{
$fmt="dd".$locale_info["LOCALE_SDATE"]."MM".$locale_info["LOCALE_SDATE"]."yyyy";
$sundayfirst="false";
}
else if($locale_info["LOCALE_IDATE"]==0)
{
$fmt="MM".$locale_info["LOCALE_SDATE"]."dd".$locale_info["LOCALE_SDATE"]."yyyy";
$sundayfirst="true";
}
else
{
$fmt="yyyy".$locale_info["LOCALE_SDATE"]."MM".$locale_info["LOCALE_SDATE"]."dd";
$sundayfirst="false";
}
if($time[5])
$fmt.=" HH:mm:ss";
else if($time[3] || $time[4])
$fmt.=" HH:mm";
if($time[0])
$ovalue=format_datetime_custom($time,$fmt);
$ovalue1=$time[2]."-".$time[1]."-".$time[0];
$showtime="false";
if(DateEditShowTime($field))
{
$showtime="true";
$ovalue1.=" ".$time[3].":".$time[4].":".$time[5];
}
// need to create date control object to use it with datePicker
$ret='<input id="'.$cfield.'" type="Text" name="'.$cfield.'" size="20" value="'.$ovalue.'">';
$ret.='<input id="ts'.$cfield.'" type="Hidden" name="ts'.$cfield.'" value="'.$ovalue1.'"> ';
//$ret.=' <img src="images/cal.gif" width=16 height=16 border=0 alt="'."Click Here to Pick up the date".'">';
$ret.=' <a href="#" id="imgCal_'.$cfield.'">'.
'<img src="images/cal.gif" width=16 height=16 border=0 alt="'."Click Here to Pick up the date".'"></a>';
echo $ret;
return;
case EDIT_DATE_DD_DP:
$dp=1;
case EDIT_DATE_DD:
$retday='<select id="day'.$cfield.'" '.(($search == MODE_INLINE_EDIT || $search==MODE_INLINE_ADD) && $is508==true ? 'alt="'.$strLabel.'" ' : '').'name="day'.$cfield.'" ></select>';
$retmonth='<select id="month'.$cfield.'" '.(($search == MODE_INLINE_EDIT || $search==MODE_INLINE_ADD) && $is508==true ? 'alt="'.$strLabel.'" ' : '').'name="month'.$cfield.'" ></select>';
$retyear='<select id="year'.$cfield.'" '.(($search == MODE_INLINE_EDIT || $search==MODE_INLINE_ADD) && $is508==true ? 'alt="'.$strLabel.'" ' : '').'name="year'.$cfield.'" ></select>';
$sundayfirst="false";
if($locale_info["LOCALE_ILONGDATE"]==1)
$ret=$retday." ".$retmonth." ".$retyear;
else if($locale_info["LOCALE_ILONGDATE"]==0)
{
$ret=$retmonth." ".$retday." ".$retyear;
$sundayfirst="true";
}
else
$ret=$retyear." ".$retmonth." ".$retday;
if($time[0] && $time[1] && $time[2])
$ret.="<input id=\"".$cfield."\" type=hidden name=\"".$cfield."\" value=\"".$time[0]."-".$time[1]."-".$time[2]."\">";
else
$ret.="<input id=\"".$cfield."\" type=hidden name=\"".$cfield."\" value=\"\">";
// calendar handling for three DD
if($dp)
{
$ret.=' <a href="#" id="imgCal_'.$cfield.'">'.
'<img src="images/cal.gif" width=16 height=16 border=0 alt="Click Here to Pick up the date"></a>'.
'<input id="ts'.$cfield.'" type=hidden name="ts'.$cfield.'" value="'.$time[2].'-'.$time[1].'-'.$time[0].'">';
//$ret.=' <img src="images/cal.gif" width=16 height=16 border=0 alt="Click Here to Pick up the date"><input id="ts'.$cfield.'" type=hidden name="ts'.$cfield.'" value="'.$time[2].'-'.$time[1].'-'.$time[0].'">';
}
echo $ret;
return;
// case EDIT_DATE_SIMPLE:
default:
$ovalue=$value;
if($time[0])
{
if($time[3] || $time[4] || $time[5])
$ovalue=str_format_datetime($time);
else
$ovalue=format_shortdate($time);
}
echo '<input id="'.$cfield.'" type=text name="'.$cfield.'" size="20" value="'.htmlspecialchars($ovalue).'">';
return;;
}
}