Exemplo n.º 1
0
function form_date_dropdowns($year = 0, $month = 0, $day = 0, $prefix = false, $start_year = 0)
{
    // the end of 2037 is more or less the maximum time that
    // can be represented as a UNIX timestamp currently
    if (is_numeric($start_year) && $start_year > 0 && $start_year < 2037) {
        $years = array('&nbsp;') + range_keys($start_year, 2037);
    } else {
        $years = array('&nbsp;') + range_keys(date('Y', time()), 2037);
    }
    $days = array_merge(array('&nbsp;'), range(1, 31));
    $months = array_merge(array('&nbsp;'), lang_get_month_names());
    $output = form_dropdown_array("{$prefix}day", $days, $day) . "&nbsp;";
    $output .= form_dropdown_array("{$prefix}month", $months, $month) . "&nbsp;";
    $output .= form_dropdown_array("{$prefix}year", $years, $year) . "&nbsp;";
    return $output;
}
Exemplo n.º 2
0
function light_form_dob_dropdowns($dob_year, $dob_month, $dob_day, $show_blank = true, $custom_html = null)
{
    if ($show_blank) {
        $birthday_days = array_merge(array('&nbsp;'), range(1, 31));
        $birthday_months = array_merge(array('&nbsp;'), lang_get_month_names());
        $birthday_years = array('&nbsp;') + range_keys(1900, date('Y', time()));
    } else {
        $birthday_days = range_keys(1, 31);
        $birthday_months = lang_get_month_names();
        $birthday_years = range_keys(1900, date('Y', time()));
    }
    $output = light_form_dropdown_array("dob_day", $birthday_days, $dob_day, $custom_html) . "&nbsp;";
    $output .= light_form_dropdown_array("dob_month", $birthday_months, $dob_month, $custom_html) . "&nbsp;";
    $output .= light_form_dropdown_array("dob_year", $birthday_years, $dob_year, $custom_html) . "&nbsp;";
    return $output;
}