\n") { $info = $this->_getInfo($name, $value, $attribs, $options, $listsep); extract($info); // name, id, value, attribs, options, listsep, disable // now start building the XHTML. $disabled = ''; if (true === $disable) { $disabled = ' disabled="disabled"'; } $elementNamesArray = $this->getDayMonthYearTimeFieldNames($name); $valueDay = $valueMonth = $valueYear = $valueHour = $valueMinutes = $valueAmPm = null; if ($value !== null) { $valueExploded = explode(' ', $value); $dateValueExploded = explode('-', $valueExploded[0]); if (!isset($dateValueExploded[2])) { $value = null; } else { $valueDay = (int) $dateValueExploded[2]; $valueMonth = (int) $dateValueExploded[1]; $valueYear = (int) $dateValueExploded[0]; } $timeValueExploded = explode(':', $valueExploded[1]); $valueHour = $timeValueExploded[0]; if ($valueHour > 12) { $valueHour -= 12; $valueAmPm = 'pm'; } elseif ($valueHour == 0) { $valueHour = 12; $valueAmPm = 'am'; } else { $valueAmPm = 'am'; } $valueMinutes = (int) $timeValueExploded[1]; } // Build the surrounding day element first. $xhtml = '"; // Build the month next $xhtml .= ' "; // Build the years next $xhtml .= ' "; // Build the hours next $xhtml .= '   "; // Build the minutes next $xhtml .= '"; // Build the ampm next $xhtml .= '"; return $xhtml; } protected function getDayMonthYearTimeFieldNames($value) { if (empty($value) || !is_string($value)) { return $value; } $ret = array( 'day' => $value . '_day', 'month' => $value . '_month', 'year' => $value . '_year', 'hour' => $value . '_hour', 'minutes' => $value . '_minutes', 'ampm' => $value . '_ampm', ); if (strstr($value, '[')) { $endPos = strlen($value) - 1; if (']' != $value[$endPos]) { return $ret; } $start = strrpos($value, '[') + 1; $name = substr($value, $start, $endPos - $start); $arrayName = substr($value, 0, $start-1); $ret = array( 'day' => $arrayName . '[' . $name . '_day' . ']', 'month' => $arrayName . '[' . $name . '_month' . ']', 'year' => $arrayName . '[' . $name . '_year' . ']', 'hour' => $arrayName . '[' . $name . '_hour' . ']', 'minutes' => $arrayName . '[' . $name . '_minutes' . ']', 'ampm' => $arrayName . '[' . $name . '_ampm' . ']', ); } return $ret; } }