38 require_once realpath(dirname(__FILE__)).
"/../field_renderers.inc";
57 $value = $this->parent->data->get($field);
60 if ($value AND $value !=
'00:00:00')
62 $text = date(
"h/i/A", strtotime($value));
63 list($hh, $mm, $aa) = explode(
"/", $text);
68 echo
"<input type='text' value='$hh' name='{$field}_hh' size='2' maxlength='2' onkeydown='return maskInput(event);'> : <input type='text' value='$mm' name='{$field}_mm' size='2' maxlength='2' onkeydown='return maskInput(event);'>";
69 echo
" <select name='{$field}_aa'><option";
70 if ($aa ==
'AM') echo
" selected";
71 echo
">AM</option><option";
72 if ($aa ==
'PM') echo
" selected";
73 echo
">PM</option></select>";
80 $prettyName = $this->parent->prettifyFieldName($field);
82 $this->parent->validator->add(
new TimeValidator($field, $label));
93 echo
"<td colspan='2'";
94 if ($this->parent->labelCSS) echo
" class='{$this->parent->labelCSS}'";
95 echo
"><input type='checkbox' value='1' name='$field:$mode'";
96 if ($this->parent->data->get($field))
101 echo $this->parent->prettifyFieldName($field);
102 echo
"</td>\n</tr>\n";
111 echo $this->parent->data->format(
"{{$field}:h:i A}");
120 $aa = $_POST[
"{$field}_aa"];
121 if ($aa !=
"AM" && $aa !=
"PM") die(
"Invalid meridiem");
126 $this->parent->data->set($field, $this->parent->data->reformatToSQLDate(
"00:00"));
130 if ($aa ==
"PM" && $hh !=
"12") $hh += 12;
131 if ($aa ==
"AM" && $hh ==
"12") $hh =
"00";
132 $this->parent->data->set($field,
"$hh:$mm");
FieldRenderer is the abstract base class for all FieldRenderers.
_startField($field, $styles="")
Internal method to generate the starting HTML for the field (including the label)
_endField($field)
Internal method to generate the closing HTML for the field.
FieldRenderer($parent)
Constructor.
Field renderer for time data fields.
TimeFieldRenderer(&$parent)
preProcess($field="")
FieldRenderers can override this method to provide behavior that occurs prior to the saving of the pa...
renderSearchField($field, $mode)
FieldRenderers must override this method to provide the HTML implementation of the control displayed ...
renderField($field)
FieldRenderers must override this method to provide the HTML implementation of the control used to ed...
addValidatorsToForm($field, $required=false)
This method is called by the AutoForm to add any default input validators that are required by the Fi...
checkNumeric($p)
Security helper function.