63 $label = isset($this->label) ? $this->label : $this->parent->prettifyFieldName(
$field);
65 $this->parent->validator->add(
new DateValidator(
$field, $label));
66 $this->parent->validator->add(
new TimeValidator(
$field, $label));
70 $this->parent->validator->add(
new RequiredValidator(
$field, $label));
71 if($this->requireTime)
72 $this->parent->validator->add(
new RequiredTimeValidator(
$field, $label .
" Time"));
82 <script type=
"text/javascript">
84 window.addEvent(
'domready',
function(){
85 new Picker.Date(document.id(
'{$this->parent->id}_{$field}'),
88 positionOffset: {x: 5, y: 0},
89 pickerClass:
'datepicker_{$theme}',
90 useFadeInOut: !Browser.ie
101 $obj = $this->parent->data;
106 if($value AND $value !=
'0000-00-00 00:00:00')
107 $date = DateTimeTypeRenderer::format(
$obj->reformatFromSQLDate($value),
"m/d/Y");
109 $this->_startField(
$field);
110 echo
"<input id='{$this->parent->id}_{$field}' type='text' name='$field' value='$date' size='12'> <img src='{$this->parent->componentPath}/calendar/calendar.gif' alt='Popup Calendar' align='absmiddle' border='0' onclick='{$field}_calendar.toggle(this)'>\n";
190 $this->_startField(
$field);
192 echo $this->format(
$field);
196 if (!$this->parent->readOnlyForm)
198 $obj = $this->parent->data;
200 echo
"<input type='hidden' name='$field' value='{$value}'/>";
208 $hh = checkNumeric(
$_POST[
"{$field}_hh"]);
209 if(intval($hh) == 0) $hh =
"00";
210 $mm = checkNumeric(
$_POST[
"{$field}_mm"]);
211 if(intval($mm) == 0) $mm =
"00";
212 $aa =
$_POST[
"{$field}_aa"];
217 $this->parent->data->set(
$field, $this->parent->data->reformatToSQLDate(
"00/00/0000 00:00:00"));
220 if($hh ==
"00" && $mm ==
"00")
222 $this->parent->data->set(
$field, $this->parent->data->reformatToSQLDate(
"$dd"));
226 if ($aa !=
"AM" && $aa !=
"PM")
throw new FakoliException(
"Invalid meridiem");
227 if ($aa ==
"PM" && $hh !=
"12") $hh += 12;
228 if ($aa ==
"AM" && $hh ==
"12") $hh =
"00";
229 $this->parent->data->set(
$field, $this->parent->data->reformatToSQLDate(
"$dd $hh:$mm:00"));
234 return DateTimeTypeRenderer::format($this->parent->data->get(
$field), $this->template);
FakoliException is the base exception class for all Fakoli errors.
static usingFeature()
Uses the specified framework feature(s).
static getValue($component, $name)
Retrieve the value of the specified Setting.