[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/date/ -> date_api.module (summary)

(no description)

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

Defines 101 functions

  date_api_init()
  date_api_menu()
  date_api_menu_alter()
  date_type_format()
  date_month_names_untranslated()
  date_month_names()
  date_month_names_abbr()
  date_week_days_untranslated()
  date_week_days()
  date_week_days_abbr()
  date_week_days_ordered()
  date_years()
  date_days()
  date_hours()
  date_minutes()
  date_seconds()
  date_ampm()
  date_api_date_formats()
  date_api_date_format_types()
  date_format_patterns()
  date_granularity_names()
  date_granularity_array_from_precision()
  date_granularity_precision()
  date_granularity_format()
  date_timezone_names()
  date_timezone_abbr()
  date_t()
  date_t_strings()
  date_format_date()
  date_format_interval()
  date_now()
  date_make_date()
  date_timezone_is_valid()
  date_default_timezone_name()
  date_default_timezone()
  date_days_in_month()
  date_days_in_year()
  date_iso_weeks_in_year()
  date_day_of_week()
  date_day_of_week_name()
  date_difference()
  date_week_range()
  date_iso_week_range()
  date_weeks_in_year()
  date_week()
  date_convert()
  date_fuzzy_datetime()
  date_iso_array()
  date_array()
  date_part_extract()
  date_is_valid()
  date_valid_year()
  date_valid_month()
  date_valid_day()
  date_pad()
  date_has_time()
  date_has_date()
  date_limit_value()
  date_limit_format()
  date_format_order()
  date_nongranularity()
  date_api_simpletest()
  date_api_elements()
  date_api_theme()
  date_api_set_db_timezone()
  date_get_timezone()
  date_get_timezone_db()
  date_api_views_fetch_fields()
  date_get_formats()
  date_get_format()
  date_get_format_types()
  date_api_flush_caches()
  date_formats_rebuild()
  date_format_type_save()
  date_format_type_delete()
  date_format_save()
  date_format_delete()
  _date_format_types_build()
  _date_formats_build()
  date_format_locale()
  date_order_translated()
  date_order()
  date_api_views_api()
  date_api_date_api_fields()
  date_api_views_clear()
  date_embed_view()
  date_real_url()
  date_querystring()
  date_block_identifier()
  date_api_form_system_modules_alter()
  date_api_system_modules_submit()
  date_api_form_system_date_time_settings_alter()
  date_api_form_system_settings_validate()
  date_api_add_system_javascript()
  date_api_date_time_lookup()
  date_range_valid()
  date_range_years()
  date_range_string()
  date_api_date_api_tables()
  date_is_all_day()
  date_get_nested_elements()

Functions
Functions that are not part of a class:

date_api_init()   X-Ref
Implementation of hook_init().


date_api_menu()   X-Ref
Implementation of hook_menu().


date_api_menu_alter(&$callbacks)   X-Ref
Implementation of hook_menu_alter().


date_type_format($type)   X-Ref
Helper function for getting the format string for a date type.


date_month_names_untranslated()   X-Ref
An untranslated array of month names

Needed for css, translation functions, strtotime(), and other places
that use the English versions of these words.

return:

date_month_names($required = FALSE)   X-Ref
A translated array of month names

param: $required
return:

date_month_names_abbr($required = FALSE)   X-Ref
A translated array of month name abbreviations

param: $required
return:

date_week_days_untranslated($refresh = TRUE)   X-Ref
An untranslated array of week days

Needed for css, translation functions, strtotime(), and other places
that use the English versions of these words.

return:

date_week_days($required = FALSE, $refresh = TRUE)   X-Ref
A translated array of week days

param: $required
return:

date_week_days_abbr($required = FALSE, $refresh = TRUE, $length = 3)   X-Ref
An translated array of week day abbreviations.

param: $required
return:

date_week_days_ordered($weekdays)   X-Ref
Order weekdays
Correct weekdays array so first day in array matches the first day of
the week. Use to create things like calendar headers.

param: array $weekdays
return: array

date_years($min = 0, $max = 0, $required = FALSE)   X-Ref
An array of years.

param: int $min
param: int $max
param: $required
return:

date_days($required = FALSE, $month = NULL, $year = NULL)   X-Ref
An array of days.

param: $required
param: integer $month (optional)
param: integer $year (optional)
return:

date_hours($format = 'H', $required = FALSE)   X-Ref
An array of hours.

param: string $format
param: $required
return:

date_minutes($format = 'i', $required = FALSE, $increment = 1)   X-Ref
An array of minutes.

param: string $format
param: $required
return:

date_seconds($format = 's', $required = FALSE, $increment = 1)   X-Ref
An array of seconds.

param: string $format
param: $required
return: array an array of seconds in the selected format.

date_ampm($required = FALSE)   X-Ref
An array of am and pm options.

param: $required
return: array an array of am pm options.

date_api_date_formats()   X-Ref
Implementation of hook_date_formats().

return:

date_api_date_format_types()   X-Ref
Implementation of hook_date_format_types().


date_format_patterns($strict = FALSE)   X-Ref
Array of regex replacement strings for date format elements.
Used to allow input in custom formats. Based on work done for
the Date module by Yves Chedemois (yched).

return: array of date() format letters and their regex equivalents.

date_granularity_names()   X-Ref
Array of granularity options and their labels

return: array

date_granularity_array_from_precision($precision)   X-Ref
Give a granularity $precision, return an array of
all the possible granularity elements.


date_granularity_precision($granularity_array)   X-Ref
Give a granularity array, return the highest precision.


date_granularity_format($granularity)   X-Ref
Construct an appropriate DATETIME format string for the granularity of an item.


date_timezone_names($required = FALSE, $refresh = FALSE)   X-Ref
A translated array of timezone names.
Cache the untranslated array, make the translated array a static variable.

param: $required
return:

date_timezone_abbr($refresh = FALSE)   X-Ref
An array of timezone abbreviations that the system allows.
Cache an array of just the abbreviation names because the
whole timezone_abbreviations_list is huge so we don't want
to get it more than necessary.

return: array

date_t($string, $context, $langcode = NULL)   X-Ref
A function to translate ambiguous short date strings.

Example: Pass in 'Monday', 'day_abbr' and get the translated
abbreviation for Monday.

param: string $string
param: string $context
param: int $langcode
return: translated value of the string

date_t_strings(&$replace, $langcode)   X-Ref
Construct translation arrays from pipe-delimited strings.

Combining these strings into a single t() gives them the context needed
for better translation.

date_format_date($date, $type = 'medium', $format = '', $langcode = NULL)   X-Ref
Reworked from Drupal's format_date function to handle pre-1970 and
post-2038 dates and accept a date object instead of a timestamp as input.

Translates formatted date results, unlike PHP function date_format().

param: $oject
param: $type
param: $format
return:

date_format_interval($date, $granularity = 2)   X-Ref
An override for interval formatting that adds past and future context

param: DateTime $date
param: integer $granularity
return: formatted string

date_now($timezone = NULL)   X-Ref
A date object for the current time.

param: $timezone
return: object date

date_make_date($date, $timezone = NULL, $type = DATE_DATETIME, $granularity = array('year', 'month', 'day', 'hour', 'minute')   X-Ref
Convert a date of any type or an array of date parts into a valid date
object.

param: $date
param: $timezone
param: $type
param: $granularity

date_timezone_is_valid($timezone)   X-Ref
No description

date_default_timezone_name($check_user = TRUE)   X-Ref
Return a timezone name to use as a default.

return: a timezone name

date_default_timezone($check_user = TRUE)   X-Ref
A timezone object for the default timezone.

return: a timezone name

date_days_in_month($year, $month)   X-Ref
Identify the number of days in a month for a date.


date_days_in_year($date = NULL, $type = DATE_OBJECT)   X-Ref
Identify the number of days in a year for a date.

param: mixed $date
param: string $type
return: integer

date_iso_weeks_in_year($date = NULL, $type = DATE_OBJECT)   X-Ref
Identify the number of ISO weeks in a year for a date.

December 28 is always in the last ISO week of the year.

param: mixed $date
param: string $type
return: integer

date_day_of_week($date = NULL, $type = DATE_OBJECT)   X-Ref
Returns day of week for a given date (0 = Sunday).

param: mixed  $date
param: string  $type
return:

date_day_of_week_name($date = NULL, $abbr = TRUE, $type = DATE_DATETIME)   X-Ref
Returns translated name of the day of week for a given date.

param: mixed  $date
param: string  $type
param: string $abbr
return:

date_difference($date1_in, $date2_in, $measure = 'seconds', $type = DATE_OBJECT)   X-Ref
Compute difference between two days using a given measure.

param: mixed $date1
param: mixed $date2
param: string $measure
param: string $type

date_week_range($week, $year)   X-Ref
Start and end dates for a calendar week, adjusted to use the
chosen first day of week for this site.


date_iso_week_range($week, $year)   X-Ref
Start and end dates for an ISO week.


date_weeks_in_year($year)   X-Ref
The number of calendar weeks in a year.

PHP week functions return the ISO week, not the calendar week.

param: int $year
return: int number of calendar weeks in selected year.

date_week($date)   X-Ref
The calendar week number for a date.

PHP week functions return the ISO week, not the calendar week.

param: string $date, in the format Y-m-d
return: int calendar week number.

date_convert($date, $from_type, $to_type, $tz = 'UTC')   X-Ref
Date conversion helper function.

A variety of ways to convert dates from one type to another.
No timezone conversion is done in this operation, except
when handling timestamps because create_date() assumes
timestamps hold the UTC value for the time.

param: mixed $date
param: string $from_type
param: string $to_type
param: string $tz

date_fuzzy_datetime($date)   X-Ref
Create valid datetime value from incomplete ISO dates or arrays.


date_iso_array($date)   X-Ref
Create an array of date parts from an ISO date.


date_array($obj)   X-Ref
Create an array of values from a date object. Structured like the
results of getdate() but not limited to the 32-bit signed range.

param: object $obj
return: array

date_part_extract($date, $part, $type = DATE_DATETIME, $tz = 'UTC')   X-Ref
Extract integer value of any date part from any type of date.

Example:
date_part_extract('2007-03-15 00:00', 'month', DATE_DATETIME)
returns: 3

param: mixed $date
param: string $part
param: string $type
return: integer

date_is_valid($date, $type = DATE_DATETIME, $granularity = array('year', 'month', 'day', 'hour', 'minute')   X-Ref
Functions to test the validity of a date in various formats.
Has special case for ISO dates and arrays which can be missing
month and day and still be valid.

param: $type
param: $granularity

date_valid_year($year)   X-Ref
No description

date_valid_month($month)   X-Ref
No description

date_valid_day($day, $month = NULL, $year = NULL)   X-Ref
No description

date_pad($value, $size = 2)   X-Ref
Helper function to left pad date parts with zeros.
Provided because this is needed so often with dates.

param: int $value
param: int $size
return: string the padded value

date_has_time($granularity)   X-Ref
Function to figure out if any time data is to be collected or displayed.

param: granularity

date_has_date($granularity)   X-Ref
No description

date_limit_value($date, $granularity, $type = DATE_DATETIME)   X-Ref
Recalculate a date so it only includes elements from a granularity
array. Helps prevent errors when unwanted values round up and ensures
that unwanted date part values don't get stored in the database.

Example:
date_limit_value('2007-05-15 04:45:59', array('year', 'month', 'day'))
returns '2007-05-15 00:00:00'

param: $date
param: $granularity
param: $type
return:

date_limit_format($format, $granularity)   X-Ref
Rewrite a format string so it only includes elements from a
specified granularity array.

Example:
date_limit_format('F j, Y - H:i', array('year', 'month', 'day'));
returns 'F j, Y'

param: $format
param: $granularity
return:

date_format_order($format)   X-Ref
Convert a format to an ordered array of granularity parts.

Example:
date_format_order('m/d/Y H:i')
returns
array(
0 => 'month',
1 => 'day',
2 => 'year',
3 => 'hour',
4 => 'minute',
);

param: string $format
return: array of ordered granularity elements in this format string

date_nongranularity($granularity)   X-Ref
An difference array of granularity elements that are NOT in the
granularity array. Used by functions that strip unwanted
granularity elements out of formats and values.

param: $granularity

date_api_simpletest()   X-Ref
Implementation of hook_simpletest().


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


date_api_theme()   X-Ref
No description

date_api_set_db_timezone($offset = '+00:00')   X-Ref
Wrapper around date handler setting for timezone.


date_get_timezone($handling, $timezone = '')   X-Ref
Function to figure out which local timezone applies to a date and select it


date_get_timezone_db($handling, $timezone = '')   X-Ref
Function to figure out which db timezone applies to a date and select it


date_api_views_fetch_fields($base, $type)   X-Ref
Wrapper function to make sure this function will always work.


date_get_formats($type = NULL, $reset = FALSE)   X-Ref
Get the list of date formats for a particular format length.

param: $type
param: $reset
return:

date_get_format($dfid)   X-Ref
Get the format details for a particular id.

param: $dfid
return:

date_get_format_types($type = NULL, $reset = FALSE)   X-Ref
Get the list of available date format types and attributes.

param: $type
param: $reset
return:

date_api_flush_caches()   X-Ref
Implementation of hook_flush_caches().


date_formats_rebuild()   X-Ref
Resets the database cache of date formats, and saves all new date formats to
the database.


date_format_type_save($date_format_type)   X-Ref
Save a date format type to the database.

param: $date_format_type

date_format_type_delete($date_format_type)   X-Ref
Delete a date format type from the database.

param: $date_format_type

date_format_save($date_format)   X-Ref
Save a date format to the database.

param: $date_format

date_format_delete($date_format_id)   X-Ref
Delete a date format from the database.

param: $date_format_id

_date_format_types_build()   X-Ref
Builds and returns the list of available date format types.

return:

_date_formats_build()   X-Ref
Builds and returns the list of available date formats.

return:

date_format_locale($langcode = NULL, $type = NULL, $reset = FALSE)   X-Ref
Get the appropriate date format for a type and locale.

param: $langcode
param: $type
param: $reset
return:

date_order_translated()   X-Ref
Helper function for BYDAY options in Date Repeat
and for converting back and forth from '+1' to 'First'.


date_order()   X-Ref
No description

date_api_views_api()   X-Ref
Implementation of hook_views_api().

This one is used as the base to reduce errors when updating.

date_api_date_api_fields($field)   X-Ref
Implementation of hook_date_api_fields().
on behalf of core fields.

All modules that create custom fields that use the
'views_handler_field_date' handler can provide
additional information here about the type of
date they create so the date can be used by
the Date API views date argument and date filter.

date_api_views_clear()   X-Ref
Rebuild the theme registry and all the caches.
needed to pick up changes created by updated Views API
and other changes to Views definitions.


date_embed_view($name, $display_id = 'default', $settings = array()   X-Ref
Embed a view using a PHP snippet.

This function is meant to be called from PHP snippets, should one wish to
embed a view in a node or something. It's meant to provide the simplest
solution and doesn't really offer a lot of options, but breaking the function
apart is pretty easy, and this provides a worthwhile guide to doing so.

Note that this function does NOT display the title of the view. If you want
to do that, you will need to do what this function does manually, by
loading the view, getting the preview and then getting $view->get_title().

param: $name
param: $display_id
param: $settings
param: ...

date_real_url($view, $date_type = NULL, $date_arg = NULL, $force_view_url = FALSE)   X-Ref
Figure out the URL of the date view we're currently looking at,
adapted to various date types or specific date arguments.

param: $date_type
param: $date_arg
param: $force_view_url
return:

date_querystring($view, $extra_params = array()   X-Ref
Pick up filter and sort info from url.


date_block_identifier($view)   X-Ref
No description

date_api_form_system_modules_alter(&$form, $form_state, $form_id = 'system_modules')   X-Ref
Implementation of hook_form_alter().

Add new submit handler for system_modules form.

date_api_system_modules_submit($form, &$form_state)   X-Ref
Rebuild list of date formats when modules list is saved.


date_api_form_system_date_time_settings_alter(&$form, $form_state, $form_id = 'system_date_time_settings')   X-Ref
Implementation of hook_form_alter().

Remove the 'date_formats' section from the 'admin/settings/date-time' page.
This form section is now part of the form at 'admin/settings/date-time/formats'.
We add the formats as values to the form to avoid errors on submission
of the form when expected values are missing in system_date_time_settings_submit().

Add a form element to configure whether or not week numbers are ISO-8601 (default: FALSE == US/UK/AUS norm).

date_api_form_system_settings_validate(&$form, &$form_state)   X-Ref
Validate that the option to use ISO weeks matches first day of week choice.


date_api_add_system_javascript()   X-Ref
Helper function; add system.js and javascript settings.


date_api_date_time_lookup()   X-Ref
Return the date for a given format string via Ajax.


date_range_valid($string)   X-Ref
No description

date_range_years($string, $date = NULL)   X-Ref
Split a string like -3:+3 or 2001:2010 into
an array of min and max years.

Center the range around the current year, if any, but expand it far
enough so it will pick up the year value in the field in case
the value in the field is outside the initial range.

date_range_string($years)   X-Ref
Convert a min and max year into a string like '-3:+1'.

param: unknown_type $years
return: unknown

date_api_date_api_tables()   X-Ref
Implement hook_date_api_tables().


date_is_all_day($string1, $string2, $granularity = 'second', $increment = 1)   X-Ref
Determine if a from/to date combination qualify as 'All day'.

param: object $date1, a string date in datetime format for the 'from' date.
param: object $date2, a string date in datetime format for the 'to' date.
return: TRUE or FALSE.

date_get_nested_elements(&$form, $field_name)   X-Ref
Return the nested form elements for a field by name.
This can be used either to retrieve the entire sub-element
for a field by name, no matter how deeply nested it is within
fieldgroups or multigroups, or to find the multiple value
sub-elements within a field element by name (i.e. 'value' or
'rrule'). You can also use this function to see if an item exists
in a form (the return will be an empty array if it does not exist).

The function returns an array of results. A field will generally
only exist once in a form but the function can also be used to
locate all the 'value' elements within a multiple value field,
so the result is always returned as an array of values.

For example, for a field named field_custom,  the following will
pluck out the form elements for this field from the node form,
no matter how deeply it is nested within fieldgroups or fieldsets:

$elements = content_get_nested_elements($node_form, 'field_custom');

You can prefix the function with '&' to retrieve the element by
reference to alter it directly:

$elements = &content_get_nested_elements($form, 'field_custom');
foreach ($elements as $element) {
$element['#after_build'][] = 'my_field_afterbuild';
}

During the #after_build you could then do something like the
following to alter each individual part of a multiple value field:

$sub_elements = &content_get_nested_elements($element, 'value');
foreach ($sub_elements as $sub_element) {
$sub_element['#element_validate'][] = 'custom_validation';
}

param: $form
param: $field_name
return:



Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7