AkActionViewHelper | --DateHelper
Located in File: /AkActionView/helpers/date_helper.php
* <tt>:prefix</tt> - overwrites the default prefix of "date" used for the select names. So specifying "birthday" would give birthday[month] instead of date[month] if passed to the select_month method. * <tt>:include_blank</tt> - set to true if it should be possible to set an empty date. * <tt>:discard_type</tt> - set to true if you want to discard the type part of the select name. If set to true, the select_month method would use simply "date" (which can be overwritten using <tt>:prefix</tt>) instead of "date[month]".
Method datetime_select (line 164)
datetime_select("post", "written_on"); datetime_select("post", "written_on", array('start_year' => 1995));
The selects are prepared for multi-parameter assignment to an Active Record object.
Method date_select (line 121)
+column_name+) on an object assigned to the template (identified by +object+). It's possible to tailor the selects through the +options+ array, which accepts all the keys that each of the individual select builders do (like 'use_month_numbers' for select_month) as well as a range of discard options. The discard options are <tt>'discard_year'</tt>, <tt>'discard_month'</tt> and <tt>'discard_day'</tt>. Set to true, they'll drop the respective select. Discarding the month select will also automatically discard the day select. It's also possible to explicitly set the order of the tags using the <tt>'order'</tt> option with an array(<tt>'year'</tt>, <tt>'month'</tt> and <tt>'day')</tt> in the desired order.
Passing 'disabled' => true as part of the +options+ will make elements inaccessible for change.
NOTE: Discarded selects will default to 1. So if no month select is available, January will be assumed.
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')));
The selects are prepared for multi-parameter assignment to an Active Record object.
Method distance_of_time_in_words (line 48)
For example, if the distance is 47 minutes, it'll return "about 1 hour". See the source for the complete wording list.
Integers are interpreted as seconds. So, <tt>$date_helper->distance_of_time_in_words(50)</tt> returns "less than a minute".
Set <tt>include_seconds</tt> to true if you want more detailed approximations if distance < 1 minute
Method distance_of_time_in_words_to_now (line 92)
Method locale_date (line 380)
Method locale_date_time (line 369)
Method select_date (line 202)
Method select_datetime (line 211)
Method select_day (line 263)
The <tt>date</tt> can also be substituted for a hour number. Override the field name using the <tt>field_name</tt> option, 'day' by default.
Method select_hour (line 253)
The <tt>hour</tt> can also be substituted for a hour number. Override the field name using the <tt>:field_name</tt> option, 'hour' by default
Method select_minute (line 243)
Also can return a select tag with options by <tt>minute_step</tt> from 0 through 59 with the 00 minute selected The <tt>minute</tt> can also be substituted for a minute number. Override the field name using the <tt>field_name</tt> option, 'minute' by default.
Method select_month (line 284)
The month names are presented as keys (what's shown to the user) and the month numbers (1-12) are used as values (what's submitted to the server). It's also possible to use month numbers for the presentation instead of names -- set the <tt>use_month_numbers</tt> key in +options+ to true for this to happen. If you want both numbers and names, set the <tt>add_month_numbers</tt> key in +options+ to true. Examples:
$date_helper->select_month(Ak::getDate()); // Will use keys like "January", "March" $date_helper->select_month(Ak::getDate(), array('use_month_numbers' => true)); // Will use keys like "1", "3" $date_helper->select_month(Ak::getDate(), array('add_month_numbers' => true)); // Will use keys like "1 - January", "3 - March"
Override the field name using the <tt>field_name</tt> option, 'month' by default.
If you would prefer to show month names as abbreviations, set the <tt>use_short_month</tt> key in +options+ to true.
Method select_second (line 232)
The <tt>second</tt> can also be substituted for a second number. Override the field name using the <tt>field_name</tt> option, 'second' by default.
Method select_time (line 220)
Method select_year (line 313)
can be changed using the <tt>:start_year</tt> and <tt>:end_year</tt> keys in the +options+. Both ascending and descending year lists are supported by making <tt>start_year</tt> less than or greater than <tt>end_year</tt>. The <tt>date</tt> can also be substituted for a year given as a number. Example:
$date_helper->select_year(Ak::getDate(), array('start_year' => 1992, 'end_year' => 2007)); // ascending year values $date_helper->select_year(Ak::getDate(), array('start_year' => 2005, 'end_year' => 1900)); // descending year values
Override the field name using the <tt>field_name</tt> option, 'year' by default.
Method time_ago_in_words (line 88)
Method _leading_zero_on_single_digits (line 354)
Method _select_for (line 326)
Method _select_html (line 345)
AkActionViewHelper::$locales_namespace -
AkActionViewHelper::AkActionViewHelper() -
AkActionViewHelper::addObject() -
AkActionViewHelper::getObject() -
AkActionViewHelper::setController() -
AkActionViewHelper::t() -