+ $f = get_config('system','birthday_input_format');
+ if(! $f)
+ $f = 'ymd';
+ if($dob === '0000-00-00')
+ $value = '';
+ else
+ $value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d'));
+
+ $age = ((intval($value)) ? age($value, $a->user["timezone"], $a->user["timezone"]) : "");
+
+ $o = replace_macros(get_markup_template("field_input.tpl"), array(
+ '$field' => array(
+ 'dob',
+ t('Birthday:'),
+ $value,
+ (((intval($age)) > 0 ) ? t('Age: ') . $age : ""),
+ '',
+ 'placeholder="' . t('YYYY-MM-DD or MM-DD') . '"'
+ )
+ ));
+
+// if ($dob && $dob != '0000-00-00')
+// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year),'dob');
+// else
+// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),false,'dob');
+
+ return $o;
+}
+
+/**
+ * @brief Returns a date selector
+ *
+ * @param string $format
+ * Format string, e.g. 'ymd' or 'mdy'. Not currently supported
+ * @param string $min
+ * Unix timestamp of minimum date
+ * @param string $max
+ * Unix timestap of maximum date
+ * @param string $default
+ * Unix timestamp of default date
+ * @param string $id
+ * ID and name of datetimepicker (defaults to "datetimepicker")
+ *
+ * @return string Parsed HTML output.
+ */
+function datesel($format, $min, $max, $default, $id = 'datepicker') {
+ return datetimesel($format,$min,$max,$default,'',$id,true,false, '','');
+}
+
+/**
+ * @brief Returns a time selector
+ *
+ * @param string $format
+ * Format string, e.g. 'ymd' or 'mdy'. Not currently supported
+ * @param $h
+ * Already selected hour
+ * @param $m
+ * Already selected minute
+ * @param string $id
+ * ID and name of datetimepicker (defaults to "timepicker")
+ *
+ * @return string Parsed HTML output.
+ */
+function timesel($format, $h, $m, $id='timepicker') {
+ return datetimesel($format,new DateTime(),new DateTime(),new DateTime("$h:$m"),'',$id,false,true);
+}
+
+/**
+ * @brief Returns a datetime selector.
+ *
+ * @param string $format
+ * format string, e.g. 'ymd' or 'mdy'. Not currently supported
+ * @param string $min
+ * unix timestamp of minimum date
+ * @param string $max
+ * unix timestap of maximum date
+ * @param string $default
+ * unix timestamp of default date
+ * @param string $id
+ * id and name of datetimepicker (defaults to "datetimepicker")
+ * @param bool $pickdate
+ * true to show date picker (default)
+ * @param boolean $picktime
+ * true to show time picker (default)
+ * @param $minfrom
+ * set minimum date from picker with id $minfrom (none by default)
+ * @param $maxfrom
+ * set maximum date from picker with id $maxfrom (none by default)
+ * @param bool $required default false
+ *
+ * @return string Parsed HTML output.
+ *
+ * @todo Once browser support is better this could probably be replaced with
+ * native HTML5 date picker.
+ */
+function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false) {
+
+ // First day of the week (0 = Sunday)
+ $firstDay = get_pconfig(local_user(),'system','first_day_of_week');
+ if ($firstDay === false) $firstDay=0;
+
+ $lang = substr(get_browser_language(), 0, 2);
+
+ // Check if the detected language is supported by the picker
+ if (!in_array($lang, array("ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr", "it", "da", "no", "ja", "vi", "sl", "cs", "hu")))
+ $lang = ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en');