format = EDIT_FORMAT_DATE;
}
function addJSFiles()
{
$dateEditType = $this->pageObject->pSetEdit->getDateEditType($this->field);
if( $dateEditType == EDIT_DATE_SIMPLE_INLINE || $dateEditType == EDIT_DATE_DD_INLINE )
{
$this->pageObject->AddJSFile("include/jquery-ui/jquery-ui-1.10.2.custom.min.js");
}
}
function addCSSFiles()
{
$dateEditType = $this->pageObject->pSetEdit->getDateEditType($this->field);
if( $dateEditType == EDIT_DATE_SIMPLE_INLINE || $dateEditType == EDIT_DATE_DD_INLINE )
$this->pageObject->AddCSSFile("include/jquery-ui/smoothness/jquery-ui-1.10.2.custom.min.css");
}
function buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data)
{
global $locale_info;
parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data);
if($fieldNum)
$this->cfield = "value".$fieldNum."_".GoodFieldName($this->field).'_'.$this->id;
echo '';
if($this->pageObject->pageType == PAGE_LIST)
$pSet = new ProjectSettings($this->pageObject->tName, PAGE_SEARCH);
else
$pSet = $this->pageObject->pSetEdit;
$tvalue = $value;
$time = db2time($tvalue);
if(!count($time))
$time = array(0, 0, 0, 0, 0, 0);
$dp = 0;
$hasImgCal = true;
$showTime = $pSet->dateEditShowTime($this->field);
switch($pSet->getDateEditType($this->field))
{
case EDIT_DATE_SIMPLE_INLINE:
$hasImgCal = false;
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";
else if($locale_info["LOCALE_IDATE"] == 0)
$fmt = "MM".$locale_info["LOCALE_SDATE"]."dd".$locale_info["LOCALE_SDATE"]."yyyy";
else
$fmt = "yyyy".$locale_info["LOCALE_SDATE"]."MM".$locale_info["LOCALE_SDATE"]."dd";
if($showTime || $time[3] || $time[4] || $time[5])
$fmt.= " HH:mm:ss";
if($time[0])
$ovalue = format_datetime_custom($time, $fmt);
$ovalue1 = $time[2]."-".$time[1]."-".$time[0];
if($showTime || $time[3] || $time[4] || $time[5])
$ovalue1.= " ".$time[3].":".$time[4].":".$time[5];
// need to create date control object to use it with datePicker
$ret= 'inputStyle.' type="Text" name="'.$this->cfield.'" value="'.$ovalue.'">';
$ret.= ' ';
if ($hasImgCal)
$ret.= ' ';
echo $ret;
break;
case EDIT_DATE_DD_INLINE:
case EDIT_DATE_DD_DP:
$dp=1;
case EDIT_DATE_DD:
$controlWidth = $pSet->getControlWidth($this->field);
if($controlWidth > 0)
{
$controlWidth -= 10;
$yearWidth = floor($controlWidth * 0.3);
$yearStyle = 'style="min-width: '.$yearWidth.'px; ';
$dayWidth = floor($controlWidth * 0.2);
$dayStyle = 'style="min-width: '.$dayWidth.'px; margin-right:5px;" ';
$mothWidth = $controlWidth - $yearWidth - $dayWidth;
$monthStyle = 'style="min-width: '.$mothWidth.'px; margin-right:5px;" ';
}
else
{
$dayStyle = '';
$monthStyle = '';
$yearStyle = '';
}
$alt = ($mode == MODE_INLINE_EDIT || $mode==MODE_INLINE_ADD) && $this->is508 ? 'alt="'.$this->strLabel.'" ' : '';
$retday='';
$retmonth='';
$retyear='';
$space = ($controlWidth > 0 ? '' : " ");
if($locale_info["LOCALE_ILONGDATE"] == 1)
$ret = $retday.$space.$retmonth.$space.$retyear;
else if($locale_info["LOCALE_ILONGDATE"] == 0)
$ret = $retmonth.$space.$retday.$space.$retyear;
else
$ret = $retyear.$space.$retmonth.$space.$retday;
if($time[0] && $time[1] && $time[2])
$ret.="cfield."\" type=hidden name=\"".$this->cfield."\" value=\"".$time[0]."-".$time[1]."-".$time[2]."\">";
else
$ret.="cfield."\" type=hidden name=\"".$this->cfield."\" value=\"\">";
// calendar handling for three DD
if($dp)
{
$ret.=' '.
'';
}
echo $ret;
break;
default: // case EDIT_DATE_SIMPLE:
$ovalue = $value;
if($time[0])
{
if($showTime || $time[3] || $time[4] || $time[5])
$ovalue = str_format_datetime($time);
else
$ovalue = format_shortdate($time);
}
echo 'inputStyle.' value="'.runner_htmlspecialchars($ovalue).'">';
}
$this->buildControlEnd($validate);
}
}
?>