[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/date/ -> date_api_elements.inc (summary)

(no description)

File Size: 634 lines (25 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 11 functions

  _date_api_elements()
  date_timezone_process()
  date_text_process()
  date_select_process()
  date_parts_element()
  date_select_validate()
  date_select_input_value()
  date_text_validate()
  date_text_input_value()
  date_timezone_validate()
  date_convert_from_custom()

Functions
Functions that are not part of a class:

_date_api_elements()   X-Ref
Implementation of hook_elements().

Parameters for date form elements, designed to have sane defaults so any
or all can be omitted.

Fill the element #default_value with a date in datetime format,
(YYYY-MM-DD HH:MM:SS), adjusted to the proper local timezone.

NOTE - Converting a date stored in the database from UTC to the local zone
and converting it back to UTC before storing it is not handled by this
element and must be done in pre-form and post-form processing!!

The date_select element will create a collection of form elements, with a
separate select or textfield for each date part. The whole collection will
get re-formatted back into a date value of the requested type during validation.

The date_text element will create a textfield that can contain a whole
date or any part of a date as text. The user input value will be re-formatted
back into a date value of the requested type during validation.

The date_timezone element will create a drop-down selector to pick a
timezone name.

#date_timezone
The local timezone to be used to create this date.

#date_format
A format string that describes the format and order of date parts to
display in the edit form for this element. This makes it possible
to show date parts in a custom order, or to leave some of them out.
Be sure to add 'A' or 'a' to get an am/pm selector. Defaults to the
short site default format.

#date_label_position
Handling option for date part labels, like 'Year', 'Month', and 'Day',
can be 'above' the date part, 'within' it, or 'none', default is 'above'.
The 'within' option shows the label as the first option in a select list
or the default value for an empty textfield, taking up less screen space.

#date_increment
Increment minutes and seconds by this amount, default is 1.

#date_year_range
The number of years to go back and forward in a year selector,
default is -3:+3 (3 back and 3 forward).

#date_text_parts
Array of date parts that should use textfields instead of selects
i.e. array('year') will format the year as a textfield and other
date parts as drop-down selects.

date_timezone_process($element, $edit, $form_state, $form)   X-Ref
Create a timezone form element.

param: array $element
return: array

date_text_process($element, $edit, $form_state, $form)   X-Ref
Text date input form.

Display all or part of a date in a single textfield.

The exact parts displayed in the field are those in #date_granularity.
The display of each part comes from #date_format.

In regular FAPI processing $element['#value'] will contain a string
value before the form is submitted, and an array during submission.

In regular FAPI processing $edit is empty until the form is submitted
when it will contain an array.

Views widget processing now receives the same values as normal FAPI
processing (that was not true in Views 1).


date_select_process($element, $edit, $form_state, $form)   X-Ref
Flexible date/time drop-down selector.

Splits date into a collection of date and time sub-elements, one
for each date part. Each sub-element can be either a textfield or a
select, based on the value of ['#date_settings']['text_fields'].

The exact parts displayed in the field are those in #date_granularity.
The display of each part comes from ['#date_settings']['format'].

In regular FAPI processing $element['#value'] will contain a string
value before the form is submitted, and an array during submission.

In regular FAPI processing $edit is empty until the form is submitted
when it will contain an array.

Views widget processing now receives the same values as normal FAPI
processing (that was not true in Views 1).


date_parts_element($element, $date, $format)   X-Ref
Create form elements for one or more date parts.

Get the order of date elements from the provided format.
If the format order omits any date parts in the granularity, alter the
granularity array to match the format, then flip the $order array
to get the position for each element. Then iterate through the
elements and create a sub-form for each part.

param: array $element
param: object $date
param: array $granularity
param: string $format
return: array

date_select_validate($element, &$form_state)   X-Ref
Validation function for date selector.

When used as a Views widget, the validation step always gets triggered,
even with no form submission. Before form submission $element['#value']
contains a string, after submission it contains an array.


date_select_input_value($element)   X-Ref
Helper function for extracting a date value out of user input.


date_text_validate($element, &$form_state)   X-Ref
Validation for text input.

When used as a Views widget, the validation step always gets triggered,
even with no form submission. Before form submission $element['#value']
contains a string, after submission it contains an array.


date_text_input_value($element)   X-Ref
Helper function for extracting a date value out of user input.


date_timezone_validate($element, &$form_state)   X-Ref
Validation for timezone input

Move the timezone value from the nested field back to the original field.

date_convert_from_custom($date, $format)   X-Ref
Convert a date input in a custom format to a standard date type

Handles conversion of translated month names (i.e. turns t('Mar') or
t('March') into 3). Also properly handles dates input in European style
short formats, like DD/MM/YYYY. Works by parsing the format string
to create a regex that can be used on the input value.

The original code to do this was created by Yves Chedemois (yched).

param: string $date
param: string $format
return: mixed



Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7