Table of Contents

Date / Time Select Functions

datetime_select

Syntax:

$form_options_helper->datetime_select ( $object_name,  $column_name, [ $options ])

Description:
Produces select tags for a year, a month, a day, an hour, and a minute for multi-parameter assignment to an Active Record object.
$object_name references the source of pre-selected data.
$column_name references the column of the pre-selection data.
$options = array(). They may be:

Examples:
$date_helper→datetime_select(“post”, “written_on”);
$date_helper→datetime_select(“post”, “written_on”, array('start_year' ⇒ 1995));

date_select

Syntax:

$form_options_helper->date_select ( $object_name,  $column_name, [ $options = array()])

Description:
Produces select tags for a year, a month and a day for multi-parameter assignment to an Active Record object.
$object_name references the source of pre-selected data.
$column_name references the column of the pre-selection data.
$options = array(). They may be:

Examples:

$date_helper->date_select("post", "written_on");
$date_helper->date_select("post", "written_on", array('start_year' => 1995));
$date_helper->date_select("post", "written_on", array('start_year' => 1995, 
    'use_month_numbers' => true, 'discard_day' => true, 'include_blank' => true)));
$date_helper->date_select("post", "written_on", array('order' => array('day', 'month', 'year')));
$date_helper->date_select("user", "birthday", array('order' => array('month', 'day')));

select_date

Syntax:

$form_options_helper->select_date( [ $date = null], [ $options = array()])

Description:
Returns a set of html select tags: year, month and day pre-selected with the $date or the current date (now). $options = array(). They may be:

select_datetime

Syntax:

$form_options_helper->select_datetime( [ $datetime = null], [ $options = array()])

Description:
Returns a set of html select tags: year, month, day, hour and minute pre-selected with the $datetime or the current date/time (now). $options = array(). They may be:

select_day

Syntax:

$form_options_helper->select_day( $date, [ $options ])

Description:
Returns a select tag with options for each of the days 1 through 31 with the day in $date selected.
$options = array(). They may be:

select_hour

Syntax:

$form_options_helper->select_hour( $datetime, [ $options ])

Description:
Returns a select tag with options for each of the hours 0 through 23 with the hour in $datetime selected.
$options = array(). They may be:

select_minute

Syntax:

$form_options_helper->select_minute( $datetime, [ $options ])

Description:
Returns a select tag with options for each of the minutes 0 through 59 with the minute in $datetime selected.
$options = array(). They may be:

select_month

Syntax:

$form_options_helper->select_month( [ $date ], [ $options ])

Description:
Returns a select tag with options for each of the months January through December with the month in $date (if any) selected.
$options = array(). They may be:

Examples:

// Will use keys like "January", "March"
$date_helper->select_month(Ak::getDate()); 
// Will use keys like "1", "3"
$date_helper->select_month(Ak::getDate(), array('use_month_numbers' => true)); 
// Will use keys like "1 - January", "3 - March"
$date_helper->select_month(Ak::getDate(), array('add_month_numbers' => true));

select_second

Syntax:

$form_options_helper->select_second( $datetime, [ $options ])

Description:
Returns a select tag with options for each of the seconds 0 through 59 with the value in $datetime selected.
$options = array(). They may be:

select_time

Syntax:

$form_options_helper->select_time( [ $datetime ], [ $options ])

Description:
Returns html select tags for an hour and for a minute. The hour select tag will have options from 0 to 23 with the value in $datetime (if any) selected. The minute select tag will have options from 0 to 59 with the value in $datetime (if any) selected.
$options = array(). They may be:

select_year

Syntax:

$form_options_helper->select_year( [ $date ], [ $options ])

Description:
Returns a select tag with options for each of the five years on each side of the year. If $date is provided, it may have one of two types which will determine the selected year:

The five year radius can be changed using the start_year and end_year options.
$options = array(). They may be:

Examples:

// ascending year values
$date_helper->select_year(Ak::getDate(), array('start_year' => 1992, 'end_year' => 2007));
// descending year values
$date_helper->select_year(Ak::getDate(), array('start_year' => 2005, 'end_year' => 1900));

_select_for

Syntax:

$form_options_helper->_select_for( 
    $select_type,$range,$date_format,$datetime,[ $options ],[ $unit_format_callback ])

Description:
$options is an array.

$unit_format_callback defaults to '_leading_zero_on_single_digits'.

_select_html

Syntax:

$form_options_helper->_select_html( 
    $type,$options,[ $prefix ],[ $include_blank],[ $discard_type ],[ $disabled])

Description:
$include_blank, $discard_type and $disabled all default to false.