Now all modules are in core modules folder
This commit is contained in:
parent
5ba1cdfa0b
commit
05b6a91b0c
1907 changed files with 0 additions and 0 deletions
137
modules/date/help/date-api-functions.html
Normal file
137
modules/date/help/date-api-functions.html
Normal file
|
@ -0,0 +1,137 @@
|
|||
<h3>Preconfigured arrays</h3>
|
||||
<p>
|
||||
Both translated and untranslated values are available. The date_week_days_ordered()
|
||||
function will shift an array of week day names so it starts with the site's
|
||||
first day of the week, otherwise the weekday names start with Sunday as the first
|
||||
value, the expected order for many php and sql functions.
|
||||
</p>
|
||||
<ul style="color: rgb(0, 0, 187);">
|
||||
<li>
|
||||
date_month_names();
|
||||
</li><li>
|
||||
date_month_names_abbr();
|
||||
</li><li>
|
||||
date_month_names_untranslated();
|
||||
</li><li>
|
||||
date_week_days();
|
||||
</li><li>
|
||||
date_week_days_abbr();
|
||||
</li><li>
|
||||
date_week_days_untranslated();
|
||||
</li><li>
|
||||
date_week_days_ordered();
|
||||
</li><li>
|
||||
date_years();
|
||||
</li><li>
|
||||
date_hours();
|
||||
</li><li>
|
||||
date_minutes();
|
||||
</li><li>
|
||||
date_seconds();
|
||||
</li><li>
|
||||
date_timezone_names();
|
||||
</li><li>
|
||||
date_ampm();
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Miscellaneous date manipulation functions </h3>
|
||||
<p>
|
||||
Pre-defined constants and functions that will handle pre-1970 and post-2038
|
||||
dates in both PHP 4 and PHP 5, in any OS. Dates can be converted from one
|
||||
type to another and date parts can be extracted from any date type.
|
||||
</p>
|
||||
<ul style="color: rgb(0, 0, 187);">
|
||||
<li>
|
||||
DATE_DATETIME
|
||||
</li><li>
|
||||
DATE_ISO
|
||||
</li><li>
|
||||
DATE_UNIX
|
||||
</li><li>
|
||||
DATE_ARRAY
|
||||
</li><li>
|
||||
DATE_OBJECT
|
||||
</li><li>
|
||||
DATE_ICAL
|
||||
</li><li>
|
||||
date_convert()
|
||||
</li><li>
|
||||
date_is_valid();
|
||||
</li><li>
|
||||
date_part_is_valid();
|
||||
</li><li>
|
||||
date_part_extract();
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Date calculation and navigation</h3>
|
||||
<p>
|
||||
date_diff() will find the time difference between any two days, measured
|
||||
in seconds, minutes, hours, days, months, weeks, or years.
|
||||
</p>
|
||||
|
||||
<ul style="color: rgb(0, 0, 187);">
|
||||
<li>
|
||||
date_days_in_month();
|
||||
</li><li>
|
||||
date_days_in_year();
|
||||
</li><li>
|
||||
date_weeks_in_year();
|
||||
</li><li>
|
||||
date_last_day_of_month();
|
||||
</li><li>
|
||||
date_day_of_week();
|
||||
</li><li>
|
||||
date_day_of_week_name();
|
||||
</li><li>
|
||||
date_diff();
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Date regex and format helpers </h3>
|
||||
<p>
|
||||
Pre-defined constants, an array of date format strings and their
|
||||
equivalent regex strings.
|
||||
</p>
|
||||
<p>
|
||||
DATE_REGEX_LOOSE is a very loose regex that will pull date parts out
|
||||
of an ISO date with or without separators, using either 'T' or a space
|
||||
to separate date and time, and with or without time.
|
||||
</p>
|
||||
<p>
|
||||
date_format_date() is similar to format_date(), except it takes a
|
||||
date object instead of a timestamp as the first parameter.
|
||||
</p>
|
||||
|
||||
<ul style="color: rgb(0, 0, 187);">
|
||||
<li>
|
||||
DATE_FORMAT_ISO
|
||||
</li><li>
|
||||
DATE_FORMAT_DATETIME
|
||||
</li><li>
|
||||
DATE_FORMAT_UNIX
|
||||
</li><li>
|
||||
DATE_FORMAT_ICAL
|
||||
</li><li>
|
||||
|
||||
DATE_REGEX_ISO
|
||||
</li><li>
|
||||
DATE_REGEX_DATETIME
|
||||
</li><li>
|
||||
DATE_REGEX_LOOSE
|
||||
</li><li>
|
||||
|
||||
date_format_date();
|
||||
</li><li>
|
||||
date_t()
|
||||
</li><li>
|
||||
date_short_formats();
|
||||
</li><li>
|
||||
date_medium_formats();
|
||||
</li><li>
|
||||
date_long_formats();
|
||||
</li><li>
|
||||
date_format_patterns();
|
||||
</li>
|
||||
</ul>
|
23
modules/date/help/date-api.html
Normal file
23
modules/date/help/date-api.html
Normal file
|
@ -0,0 +1,23 @@
|
|||
<p>
|
||||
Once the Date API is installed, all functions in the API are available to be used
|
||||
anywhere by any module. If the Date Timezone module is installed, the system site
|
||||
timezone selector and the user timezone selectors are overwritten to allow the
|
||||
selection of timezone names instead of offsets. Proper timezone conversion
|
||||
requires knowledge of those timezone names, something that is not currently
|
||||
available in Drupal core, and the change in selectors makes it possible to track it.
|
||||
</p>
|
||||
<p>
|
||||
In most cases, you should enable the Date Timezone module any time you use the
|
||||
Date API to be able to set the site and user timezone names. It is not enabled by
|
||||
default in case another module is setting timezone names in the database.
|
||||
</p>
|
||||
<p>
|
||||
The API uses the PHP 5.2 date functions to create and manipulate dates, and
|
||||
contains an option module that will emulate those functions in earlier versions
|
||||
of PHP.
|
||||
</p>
|
||||
<p>
|
||||
If you are using PHP 4 or PHP 5.0 or 5.1, native date handling won't work right.
|
||||
Install the Date_PHP4 module to enable wrapper functions so this code will work
|
||||
in old PHP versions.
|
||||
</p>
|
31
modules/date/help/date-argument.html
Normal file
31
modules/date/help/date-argument.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
<p>The generic date argument is based on ISO 8601 date duration and time interval standards, and allows you to create an flexible argument for any date range for any date field.
|
||||
|
||||
</p><p>The argument expects a value like 2006-01-01--2006-01-15, or 2006-W24, or @P1W. Separate from and to dates or date and period with a double hyphen (--)
|
||||
|
||||
</p><p>From and to dates in argument are ISO dates, but can be shortened and missing parts will be added. Omitted parts of ISO dates will be assumed to be the first possible (for the from date) or the last possible (for the to date) value in that time period.
|
||||
|
||||
</p><p>The 'to' portion of the argument can be eliminated if it is the same as the 'from' portion Use @ instead of a date to substitute in the current date and time.
|
||||
|
||||
</p><p>Shortcuts are available:
|
||||
|
||||
</p><p>Use periods (P1H, P1D, P1W, P1M, P1Y) to get next hour/day/week/month/year from now. Use date before P sign to get next hour/day/week/month/year from that date. The ISO standard calls for a separator (--) between a date and the P, but the separator is optional between a start date and a period in this argument to make the result easier to read.
|
||||
|
||||
</p><p>Use format like 2006-W24 to find ISO week number 24 in year 2006.</p>
|
||||
<h3>Examples:</h3>
|
||||
<table border="1">
|
||||
<tr><th>ARGUMENT</th><th>RESULTING QUERY RANGE</th></tr>
|
||||
<tr><td>2006-W24</td><td>24th ISO week in 2006</td>
|
||||
</tr><tr><td>2006</td><td>the whole year of 2006</td>
|
||||
</tr><tr><td>2006-03</td><td>the whole month of Mar 2006</td>
|
||||
</tr><tr><td>2006-02--2007-03</td><td>Feb 1 2006 to Mar 31 2006</td>
|
||||
</tr><tr><td>2006-08-31T14--2006-08-31T16</td><td>the 14th to 16th hours of Aug 8 2006</td>
|
||||
</tr><tr><td>@--2006-12-31</td><td>NOW to 2006-12-31T23:59:59</td>
|
||||
</tr><tr><td>@P3H</td><td>NOW to three hours from now</td>
|
||||
</tr><tr><td>@P1Y90D</td><td>NOW to 1 year and 90 days from now</td>
|
||||
</tr><tr><td>2006-03-05P1W</td><td>the week starting Mar 5 2006</td>
|
||||
</tr><tr><td>2006-01P3M</td><td>3 months starting Jan 2006</td>
|
||||
</tr></table>
|
||||
|
||||
<p>See <a href="http://en.wikipedia.org/wiki/ISO_8601#Week_dates">http://en.wikipedia.org/wiki/ISO_8601#Week_dates</a> for definitions of ISO weeks See <a href="http://en.wikipedia.org/wiki/ISO_8601#Duration">http://en.wikipedia.org/wiki/ISO_8601#Duration</a> for definitions of ISO duration and time interval.
|
||||
|
||||
</p>
|
13
modules/date/help/date-copy.html
Normal file
13
modules/date/help/date-copy.html
Normal file
|
@ -0,0 +1,13 @@
|
|||
The Date Copy module allows you to import date data into CCK nodes. Currently you can convert Event nodes to CCK nodes or import date data from an iCal feed.
|
||||
|
||||
<h3>Importing from Event Nodes</h3>
|
||||
If you currently have date information in Event nodes and want to get the event dates into CCK Date fields instead, you can do this using the Date Copy module included with the Date module.
|
||||
|
||||
<ol>
|
||||
<li>First, create the content type you want to import your events into and make sure the content type has a CCK date field and a field to hold the event description (either a body or a text field). You can create a new content type for this purpose or add a CCK date field to the current event type, depending on whether you want to create new nodes and nids or use the current ones.</li>
|
||||
<li>Make sure you set up the CCK date field to have both a 'From Date' and a 'To Date'. If your events have event-specific timezones, make sure the CCK date field is set up to use the date's timezone.</li>
|
||||
<li>Go to Admin >> Content management >> Date Import/Export >> Import >> Events and select 'Events' as the content type to import from and your new content type as the type to import to. Only content types that have date fields will appear in the list of available content types.</li>
|
||||
<li>If you have added the new date fields to the current content type, be sure to select the option to NOT delete the old node after the import. If you have created a new content type, you will probably want to delete the old nodes.</li>
|
||||
<li>You can select the number of items to import and the starting nid (import will be done in ascending nid order). Use that to import a single node as a test to be sure the results are what you want.</li>
|
||||
<li>Once your nodes seem to be importing correctly, go ahead and import more of them. You may want to do them in batches to keep the server from timing out.</li>
|
||||
</ol>
|
21
modules/date/help/date-create.html
Normal file
21
modules/date/help/date-create.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
<p>The DateTime object is defined in PHP versions 5.2 and greater. Full documentation can be found at <a href="http://php.net/datetime">php.net/datetime</a>.</p>
|
||||
|
||||
<p>PHP's <strong>print_r()</strong>, <a href="http://drupal.org/project/devel">Devel module</a>'s <strong>dpm()</strong>, and similar functions and most debuggers are not able to show the properties of DateTime objects. The <strong>date_format()</strong> function provides a good alternate method to debug DateTime objects. An example of its usage follows, including some common DateTime manipulation functions;</p>
|
||||
|
||||
<p>
|
||||
<!-- PHP colorized by input filter on Drupal.org, from http://drupal.org/node/337764#comment-1132868 -->
|
||||
<span style="color: rgb(0, 0, 0);"><span style="color: rgb(0, 0, 187);"><?php<br /></span><span style="color: rgb(255, 128, 0);">// Create a DateTime object for 11 November 2008, 5pm, Chicago time.<br /></span><span style="color: rgb(0, 0, 187);">$date</span> <span style="color: rgb(0, 119, 0);">=</span> <span style="color: rgb(0, 0, 187);">date_create</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'2008-11-11 17:00:00'</span><span style="color: rgb(0, 119, 0);">,</span> <span style="color: rgb(0, 0, 187);">timezone_open</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'America/Chicago'</span><span style="color: rgb(0, 119, 0);">));<br />
|
||||
<br /></span><span style="color: rgb(255, 128, 0);">// Find out what time it is in New York.<br /></span><span style="color: rgb(0, 0, 187);">date_timezone_set</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$date</span><span style="color: rgb(0, 119, 0);">,</span> <span style="color: rgb(0, 0, 187);">timezone_open</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(221, 0, 0);">'America/New_York'</span><span style="color: rgb(0, 119, 0);">));<br />
|
||||
<br /></span><span style="color: rgb(255, 128, 0);">// Now move it ahead to the following Tuesday.<br /></span><span style="color: rgb(0, 0, 187);">date_modify</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$date</span><span style="color: rgb(0, 119, 0);">,</span> <span style="color: rgb(221, 0, 0);">'+1 Tuesday'</span><span style="color: rgb(0, 119, 0);">);<br />
|
||||
<br /></span><span style="color: rgb(255, 128, 0);">// Print out the result.<br /></span><span style="color: rgb(0, 119, 0);">print</span> <span style="color: rgb(0, 0, 187);">date_format</span><span style="color: rgb(0, 119, 0);">(</span><span style="color: rgb(0, 0, 187);">$date</span><span style="color: rgb(0, 119, 0);">,</span> <span style="color: rgb(221, 0, 0);">'l r'</span><span style="color: rgb(0, 119, 0);">);
|
||||
<br /></span><span style="color: rgb(255, 128, 0);">// "Tuesday Tue, 18 Nov 2008 18:00:00 -0500"
|
||||
<br /></span><span style="color: rgb(0, 0, 187);">?></span></span><br />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The Date API provides a helper function, <span style="color: rgb(0, 0, 187);">date_make_date($string, $timezone, $type)</span>,
|
||||
where $string is a unixtimestamp, an ISO date, or a string like YYYY-MM-DD HH:MM:SS,
|
||||
$timezone is the name of the timezone this date is in, and $type is the type
|
||||
of date it is (DATE_UNIX, DATE_ISO, or DATE_DATETIME). It creates and return
|
||||
a date object set to the right date and timezone.
|
||||
</p>
|
59
modules/date/help/date-display.html
Normal file
59
modules/date/help/date-display.html
Normal file
|
@ -0,0 +1,59 @@
|
|||
<p>The date field can be displayed, or formatted, several ways, some configurable in the date settings, others that are automatically provided as options.</p>
|
||||
<p>You'll see these formatters as options on the 'Display fields' screen and when you add the fields to Views. You can also use these formatters in custom code by doing something like:</p>
|
||||
<pre>
|
||||
print content_format('field_date', $node->field_date[0], 'iso');
|
||||
</pre>
|
||||
|
||||
<h3>Formatter settings</h3>
|
||||
<p>In many places you can further control the way multiple value dates will be displayed with formatter settings. The formatter settings look like:</p>
|
||||
|
||||
<div class="form-item" id="">
|
||||
<select name="" class="form-select" id="" ><option value="default" selected="selected">Default</option><option value="format_interval">As Time Ago</option><option value="long">Long</option><option value="medium">Medium</option><option value="short">Short</option><option value="date">Date only</option><option value="time">Time only</option><option value="hidden"><Hidden></option></select>
|
||||
|
||||
</div>
|
||||
<div class="form-item" id="">
|
||||
<select name="" class="form-select" id="" ><option value="both" selected="selected">Display From and To dates</option><option value="value">Display From date only</option><option value="value2">Display To date only</option></select>
|
||||
</div>
|
||||
<div class="form-item" id="">
|
||||
<span class="field-prefix">Show </span> <input type="text" maxlength="128" name="" id="" size="5" value="5" class="form-text" /> <span class="field-suffix"> value(s)</span>
|
||||
</div>
|
||||
|
||||
<div class="form-item" id="">
|
||||
<span class="field-prefix">starting from </span> <input type="text" maxlength="128" name="" id="" size="15" value="now" class="form-text" /> <span class="field-suffix"></span>
|
||||
</div>
|
||||
<div class="form-item" id="">
|
||||
<span class="field-prefix">ending on </span> <input type="text" maxlength="128" name="" id="" size="15" value="now +2 weeks" class="form-text" /> <span class="field-suffix"></span>
|
||||
</div>
|
||||
<div class="form-item" id="">
|
||||
<select name="" class="form-select" id="" ><option value="show" selected="selected">Display repeat rule</option><option value="hide">Hide repeat rule</option></select>
|
||||
</div>
|
||||
|
||||
<p>The number of values should be a numeric value, or blank to show all dates that match your other options.
|
||||
'Starting from' and 'Ending on' can be a fixed dates in ISO format (like 2009-03-03T10:30:00) or relative times like 'now' or 'now +1 day'.
|
||||
</p>
|
||||
|
||||
<h3>Formats and Format Types</h3>
|
||||
<p>Formatter options include:</p>
|
||||
<dl>
|
||||
<dt>default</dt>
|
||||
<dd>The main way to display this date, configured in the Date settings, defaults to the site short format.</dd>
|
||||
<dt>short</dt>
|
||||
<dd>The site short format.</dd>
|
||||
<dt>medium</dt>
|
||||
<dd>The site medium format.</dd>
|
||||
<dt>long</dt>
|
||||
<dd>The site long format.</dd>
|
||||
<dt>time</dt>
|
||||
<dd>Display the date time only, using the time format in the default display.</dd>
|
||||
<dt>time_timezone</dt>
|
||||
<dd>Display the date time and timezone, using the time format in the default display.</dd>
|
||||
<dt>iso</dt>
|
||||
<dd>Display the date in the standard ISO format of YYYY-MM-DDTHH:MM:SS.</dd>
|
||||
<dt>ical</dt>
|
||||
<dd>Display the date in the standard iCal format of YYYYMMDDTHHMMSS.</dd>
|
||||
<dt>timestamp</dt>
|
||||
<dd>Display the date as the Unix timestamp value.</dd>
|
||||
<dt>format_interval</dt>
|
||||
<dd>Display the date as 'XX days, XX hours ago' or 'XX months, XX days from now'.</dd>
|
||||
</dl>
|
||||
<p> To set up custom formats and formatters, go to <a href="&base_url&admin/settings/date-time/formats">admin/settings/date-time/formats</a>. You can either use a pre-configured display format, or create your own formatters and formats. Define a php date format string like 'm-d-Y H:i' (see <a href="http://php.net/date">http://php.net/date</a> for more details on custom format strings.)</p>
|
1
modules/date/help/date-filter.html
Normal file
1
modules/date/help/date-filter.html
Normal file
|
@ -0,0 +1 @@
|
|||
<p>The Date API provides a generic Date filter that can filter on any Views date field.</p>
|
41
modules/date/help/date-php4.html
Normal file
41
modules/date/help/date-php4.html
Normal file
|
@ -0,0 +1,41 @@
|
|||
<p><strong>Note:</strong> The Date API is designed to use the new PHP date and timezone functions that are available in PHP 5.2 and above. If you're using an earlier version of PHP, you'll need to enable the Date PHP4 module which provides some wrapper code to emulate those functions. The wrapper code is slower and less efficient than the native date functions, so if at all possible, you will want to run on a server that uses PHP 5.2 or higher for the best performance. Some distros, like Red Hat, use PHP 5.1 instead. See <a href="http://bluhaloit.wordpress.com/2008/03/13/installing-php-52x-on-redhat-es5-centos-5-etc/">Installing PHP 5.2 on RedHat</a> for ideas on how to update that.</p>
|
||||
|
||||
<p>PHP 4 substitutions for the PHP 5 date functions are supplied if the Date PHP4 module is enabled. Use the PHP 5
|
||||
functions in your code as they would normally be used and the PHP 4
|
||||
alternatives will be automatically be substituted in when needed.
|
||||
</p>
|
||||
<p>
|
||||
You cannot do everything with these functions that can be done in PHP 5, but
|
||||
you can create dates, find timezone offsets, and format the results.
|
||||
Timezone handling uses native PHP 5 functions when available and degrades
|
||||
automatically for PHP 4 to use substitutions like those
|
||||
provided in previous versions of the Date and Event modules.
|
||||
</p>
|
||||
<p>
|
||||
Read the doxygen documentation in this module for more information
|
||||
about using the functions in ways that will work in PHP 4.
|
||||
</p>
|
||||
<p>
|
||||
The following functions are emulated in PHP4:
|
||||
</p>
|
||||
<ul style="color: rgb(0, 0, 187);">
|
||||
<li>
|
||||
date_create()
|
||||
</li><li>
|
||||
date_date_set()
|
||||
</li><li>
|
||||
date_format()
|
||||
</li><li>
|
||||
date_offset_get()
|
||||
</li><li>
|
||||
date_timezone_set()
|
||||
</li><li>
|
||||
timezone_abbreviations_list()
|
||||
</li><li>
|
||||
timezone_identifiers_list()
|
||||
</li><li>
|
||||
timezone_offset_get()
|
||||
</li><li>
|
||||
timezone_open()
|
||||
</li>
|
||||
</ul>
|
8
modules/date/help/date-repeat-form.html
Normal file
8
modules/date/help/date-repeat-form.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
<p>Dates will match any selection within the same box [January OR June]. When more than one box has criteria selected, all of them are combined to create repeats [[January OR June] AND [Day 1 OR Day 15]]. Positive numbers count from the beginning of the period. Negative numbers count from the end of the period, i.e. -1 is the last, -2 is the next to last, etc.</p>
|
||||
<ul>
|
||||
<li>If you select 'Every Year' above, and 'March' from 'Month' and '1' and '15' from 'Day of Month' in the Advanced options you will be selecting the 1st and 15th days of March of every year.</li>
|
||||
<li>If you select 'Every other Month' above, and 'Second Tuesday' in the Advanced options you will be selecting the second Tuesday of every other month.</li>
|
||||
<li>If you select 'Every Year' above, and 'Second Tuesday' in the Advanced options you will be selecting the second Tuesday of every year.</li>
|
||||
<li>If you select 'Every Month' above, and 'January' and 'June' and 'First Saturday' in the Advanced options, you will be selecting the first Saturday in January or June.</li>
|
||||
<li>If you select 'Every Month' above, and '-1' from 'Day of Month' in the Advanced options you will be selecting the last day of every month.</li>
|
||||
</ul>
|
447
modules/date/help/date-timezones.html
Normal file
447
modules/date/help/date-timezones.html
Normal file
|
@ -0,0 +1,447 @@
|
|||
<h2>Creating a timezone form item using Date API</h2>
|
||||
<p>
|
||||
This is simple. Just use the 'date_timezone' type, which is provided by date_api.module.
|
||||
</p>
|
||||
<pre>
|
||||
<?php
|
||||
$form['timezone'] = array(
|
||||
'#type' => 'date_timezone',
|
||||
'#default_value' => $timezone,
|
||||
'#description' => "Select a timezone if all the events will happen in the same place. Select that place's timezone",
|
||||
);
|
||||
?>
|
||||
</pre>
|
||||
<h2>Converting to and from UTC</h2>
|
||||
<p>
|
||||
In the new system you just need to know the timezone name and either the UTC or local time. We store the UTC time and the timezone name in the database (in two separate fields). We retrieve that data and do:
|
||||
</p>
|
||||
<pre>
|
||||
<?php
|
||||
$date = the UTC value from the database
|
||||
$local_zone = the name of the local timezone
|
||||
$type = the type of date value, DATE_DATETIME, DATE_ISO, or DATE_UNIX
|
||||
|
||||
$date = date_make_date($date, 'UTC', $type);
|
||||
date_timezone_set($date, timezone_open($local_zone);
|
||||
|
||||
$date now contains the local value of the date.
|
||||
Output it like:
|
||||
|
||||
print date_format_date($date, 'custom', 'm/d/Y H:i');
|
||||
?>
|
||||
</pre>
|
||||
<p>
|
||||
To convert a local date back to UTC to store it in the database, do:
|
||||
</p>
|
||||
<pre>
|
||||
<?php
|
||||
$date = local date value
|
||||
$local_zone = the name of the local timezone
|
||||
$type = the type of date value, DATE_DATETIME, DATE_ISO, or DATE_UNIX
|
||||
|
||||
$date = date_make_date($date, $local_zone, $type);
|
||||
date_timezone_set($date, timezone_open('UTC');
|
||||
|
||||
$date now contains the UTC value of the date.
|
||||
Output it like:
|
||||
|
||||
print date_format_date($date, 'custom', 'm/d/Y H:i');
|
||||
?>
|
||||
</pre>
|
||||
|
||||
<h2>Use of timezone abbreviations</h2>
|
||||
<p>
|
||||
The API doesn't handle <a href="http://www.timeanddate.com/library/abbreviations/timezones/">timezone abbreviations</a> at all, there's no way to do it right because they are not unique (EST could be Eastern Standard Time or European Summer Time). We need the full, undeprecated timezone name, which looks like 'America/Chicago'. It is comprised of the name of the continent and the major city in the timezone. Older names like 'US/Central' are deprecated because the area names change, but city names rarely do. Some good info about timezones is at http://en.wikipedia.org/wiki/Zoneinfo.
|
||||
</p><p>
|
||||
Also, we do not use spaces in the timezone names, so we use America/New_York, not America/New York. The PHP 5.2 date functions and MYSQL native timezone handling all expect names without spaces in them to work correctly.
|
||||
</p><p>
|
||||
You can use the <a href="http://php.net/manual/en/function.timezone-name-from-abbr.php">php function <code>timezone_name_from_abbr()</code></a> to try to translate to and from abbreviations, but it's not entirely reliable, as noted above. If we have the current offset and we know if it's currently daylight savings time or not, you can combine that with the abbreviation to get the timezone name, but that's a lot of 'if's.
|
||||
</p>
|
||||
<h2>Timezone Names</h2>
|
||||
<p>
|
||||
The complete list of allowed, undeprecated timezone names is:
|
||||
</p>
|
||||
<pre>
|
||||
Africa/Algiers
|
||||
Africa/Asmera
|
||||
Africa/Bangui
|
||||
Africa/Blantyre
|
||||
Africa/Brazzaville
|
||||
Africa/Bujumbura
|
||||
Africa/Cairo
|
||||
Africa/Ceuta
|
||||
Africa/Dar_es_Salaam
|
||||
Africa/Djibouti
|
||||
Africa/Douala
|
||||
Africa/Gaborone
|
||||
Africa/Harare
|
||||
Africa/Johannesburg
|
||||
Africa/Kampala
|
||||
Africa/Khartoum
|
||||
Africa/Kigali
|
||||
Africa/Kinshasa
|
||||
Africa/Lagos
|
||||
Africa/Libreville
|
||||
Africa/Luanda
|
||||
Africa/Lubumbashi
|
||||
Africa/Lusaka
|
||||
Africa/Malabo
|
||||
Africa/Maputo
|
||||
Africa/Maseru
|
||||
Africa/Mbabane
|
||||
Africa/Mogadishu
|
||||
Africa/Nairobi
|
||||
Africa/Ndjamena
|
||||
Africa/Niamey
|
||||
Africa/Porto-Novo
|
||||
Africa/Tripoli
|
||||
Africa/Tunis
|
||||
Africa/Windhoek
|
||||
America/Adak
|
||||
America/Anchorage
|
||||
America/Anguilla
|
||||
America/Antigua
|
||||
America/Araguaina
|
||||
America/Aruba
|
||||
America/Asuncion
|
||||
America/Atka
|
||||
America/Barbados
|
||||
America/Belem
|
||||
America/Belize
|
||||
America/Boa_Vista
|
||||
America/Bogota
|
||||
America/Boise
|
||||
America/Buenos_Aires
|
||||
America/Cambridge_Bay
|
||||
America/Cancun
|
||||
America/Caracas
|
||||
America/Catamarca
|
||||
America/Cayenne
|
||||
America/Cayman
|
||||
America/Chicago
|
||||
America/Chihuahua
|
||||
America/Cordoba
|
||||
America/Costa_Rica
|
||||
America/Cuiaba
|
||||
America/Curacao
|
||||
America/Dawson
|
||||
America/Dawson_Creek
|
||||
America/Denver
|
||||
America/Detroit
|
||||
America/Dominica
|
||||
America/Edmonton
|
||||
America/Eirunepe
|
||||
America/El_Salvador
|
||||
America/Ensenada
|
||||
America/Fort_Wayne
|
||||
America/Fortaleza
|
||||
America/Glace_Bay
|
||||
America/Godthab
|
||||
America/Goose_Bay
|
||||
America/Grand_Turk
|
||||
America/Grenada
|
||||
America/Guadeloupe
|
||||
America/Guatemala
|
||||
America/Guayaquil
|
||||
America/Guyana
|
||||
America/Halifax
|
||||
America/Havana
|
||||
America/Hermosillo
|
||||
America/Indiana/Indianapolis
|
||||
America/Indiana/Knox
|
||||
America/Indiana/Marengo
|
||||
America/Indiana/Vevay
|
||||
America/Indianapolis
|
||||
America/Inuvik
|
||||
America/Iqaluit
|
||||
America/Jamaica
|
||||
America/Jujuy
|
||||
America/Juneau
|
||||
America/Kentucky/Louisville
|
||||
America/Kentucky/Monticello
|
||||
America/Knox_IN
|
||||
America/La_Paz
|
||||
America/Lima
|
||||
America/Los_Angeles
|
||||
America/Louisville
|
||||
America/Maceio
|
||||
America/Managua
|
||||
America/Manaus
|
||||
America/Martinique
|
||||
America/Mazatlan
|
||||
America/Mendoza
|
||||
America/Menominee
|
||||
America/Merida
|
||||
America/Mexico_City
|
||||
America/Miquelon
|
||||
America/Monterrey
|
||||
America/Montevideo
|
||||
America/Montreal
|
||||
America/Montserrat
|
||||
America/Nassau
|
||||
America/New_York
|
||||
America/Nipigon
|
||||
America/Nome
|
||||
America/Noronha
|
||||
America/Panama
|
||||
America/Pangnirtung
|
||||
America/Paramaribo
|
||||
America/Phoenix
|
||||
America/Port-au-Prince
|
||||
America/Port_of_Spain
|
||||
America/Porto_Acre
|
||||
America/Porto_Velho
|
||||
America/Puerto_Rico
|
||||
America/Rainy_River
|
||||
America/Rankin_Inlet
|
||||
America/Recife
|
||||
America/Regina
|
||||
America/Rio_Branco
|
||||
America/Rosario
|
||||
America/Santiago
|
||||
America/Santo_Domingo
|
||||
America/Sao_Paulo
|
||||
America/Scoresbysund
|
||||
America/Shiprock
|
||||
America/St_Johns
|
||||
America/St_Kitts
|
||||
America/St_Lucia
|
||||
America/St_Thomas
|
||||
America/St_Vincent
|
||||
America/Swift_Current
|
||||
America/Tegucigalpa
|
||||
America/Thule
|
||||
America/Thunder_Bay
|
||||
America/Tijuana
|
||||
America/Tortola
|
||||
America/Vancouver
|
||||
America/Virgin
|
||||
America/Whitehorse
|
||||
America/Winnipeg
|
||||
America/Yakutat
|
||||
America/Yellowknife
|
||||
Antarctica/Casey
|
||||
Antarctica/Davis
|
||||
Antarctica/DumontDUrville
|
||||
Antarctica/Mawson
|
||||
Antarctica/McMurdo
|
||||
Antarctica/Palmer
|
||||
Antarctica/South_Pole
|
||||
Antarctica/Syowa
|
||||
Antarctica/Vostok
|
||||
Arctic/Longyearbyen
|
||||
Asia/Aden
|
||||
Asia/Almaty
|
||||
Asia/Amman
|
||||
Asia/Anadyr
|
||||
Asia/Aqtau
|
||||
Asia/Aqtobe
|
||||
Asia/Ashgabat
|
||||
Asia/Ashkhabad
|
||||
Asia/Baghdad
|
||||
Asia/Bahrain
|
||||
Asia/Baku
|
||||
Asia/Bangkok
|
||||
Asia/Beirut
|
||||
Asia/Bishkek
|
||||
Asia/Brunei
|
||||
Asia/Calcutta
|
||||
Asia/Chungking
|
||||
Asia/Colombo
|
||||
Asia/Dacca
|
||||
Asia/Damascus
|
||||
Asia/Dhaka
|
||||
Asia/Dili
|
||||
Asia/Dubai
|
||||
Asia/Dushanbe
|
||||
Asia/Gaza
|
||||
Asia/Harbin
|
||||
Asia/Hong_Kong
|
||||
Asia/Hovd
|
||||
Asia/Irkutsk
|
||||
Asia/Istanbul
|
||||
Asia/Jakarta
|
||||
Asia/Jayapura
|
||||
Asia/Jerusalem
|
||||
Asia/Kabul
|
||||
Asia/Kamchatka
|
||||
Asia/Karachi
|
||||
Asia/Kashgar
|
||||
Asia/Katmandu
|
||||
Asia/Krasnoyarsk
|
||||
Asia/Kuala_Lumpur
|
||||
Asia/Kuching
|
||||
Asia/Kuwait
|
||||
Asia/Macao
|
||||
Asia/Magadan
|
||||
Asia/Manila
|
||||
Asia/Muscat
|
||||
Asia/Nicosia
|
||||
Asia/Novosibirsk
|
||||
Asia/Omsk
|
||||
Asia/Phnom_Penh
|
||||
Asia/Pyongyang
|
||||
Asia/Qatar
|
||||
Asia/Rangoon
|
||||
Asia/Riyadh
|
||||
Asia/Riyadh87
|
||||
Asia/Riyadh88
|
||||
Asia/Riyadh89
|
||||
Asia/Saigon
|
||||
Asia/Samarkand
|
||||
Asia/Seoul
|
||||
Asia/Shanghai
|
||||
Asia/Singapore
|
||||
Asia/Taipei
|
||||
Asia/Tashkent
|
||||
Asia/Tbilisi
|
||||
Asia/Tehran
|
||||
Asia/Tel_Aviv
|
||||
Asia/Thimbu
|
||||
Asia/Thimphu
|
||||
Asia/Tokyo
|
||||
Asia/Ujung_Pandang
|
||||
Asia/Ulaanbaatar
|
||||
Asia/Ulan_Bator
|
||||
Asia/Urumqi
|
||||
Asia/Vientiane
|
||||
Asia/Vladivostok
|
||||
Asia/Yakutsk
|
||||
Asia/Yekaterinburg
|
||||
Asia/Yerevan
|
||||
Atlantic/Azores
|
||||
Atlantic/Bermuda
|
||||
Atlantic/Canary
|
||||
Atlantic/Cape_Verde
|
||||
Atlantic/Faeroe
|
||||
Atlantic/Jan_Mayen
|
||||
Atlantic/Madeira
|
||||
Atlantic/South_Georgia
|
||||
Atlantic/Stanley
|
||||
Australia/ACT
|
||||
Australia/Adelaide
|
||||
Australia/Brisbane
|
||||
Australia/Broken_Hill
|
||||
Australia/Canberra
|
||||
Australia/Darwin
|
||||
Australia/Hobart
|
||||
Australia/LHI
|
||||
Australia/Lindeman
|
||||
Australia/Lord_Howe
|
||||
Australia/Melbourne
|
||||
Australia/NSW
|
||||
Australia/North
|
||||
Australia/Perth
|
||||
Australia/Queensland
|
||||
Australia/South
|
||||
Australia/Sydney
|
||||
Australia/Tasmania
|
||||
Australia/Victoria
|
||||
Australia/West
|
||||
Australia/Yancowinna
|
||||
Europe/Amsterdam
|
||||
Europe/Andorra
|
||||
Europe/Athens
|
||||
Europe/Belfast
|
||||
Europe/Belgrade
|
||||
Europe/Berlin
|
||||
Europe/Bratislava
|
||||
Europe/Brussels
|
||||
Europe/Bucharest
|
||||
Europe/Budapest
|
||||
Europe/Chisinau
|
||||
Europe/Copenhagen
|
||||
Europe/Dublin
|
||||
Europe/Gibraltar
|
||||
Europe/Helsinki
|
||||
Europe/Istanbul
|
||||
Europe/Kaliningrad
|
||||
Europe/Kiev
|
||||
Europe/Lisbon
|
||||
Europe/Ljubljana
|
||||
Europe/London
|
||||
Europe/Luxembourg
|
||||
Europe/Madrid
|
||||
Europe/Malta
|
||||
Europe/Minsk
|
||||
Europe/Monaco
|
||||
Europe/Moscow
|
||||
Europe/Nicosia
|
||||
Europe/Oslo
|
||||
Europe/Paris
|
||||
Europe/Prague
|
||||
Europe/Riga
|
||||
Europe/Rome
|
||||
Europe/Samara
|
||||
Europe/San_Marino
|
||||
Europe/Sarajevo
|
||||
Europe/Simferopol
|
||||
Europe/Skopje
|
||||
Europe/Sofia
|
||||
Europe/Stockholm
|
||||
Europe/Tallinn
|
||||
Europe/Tirane
|
||||
Europe/Tiraspol
|
||||
Europe/Uzhgorod
|
||||
Europe/Vaduz
|
||||
Europe/Vatican
|
||||
Europe/Vienna
|
||||
Europe/Vilnius
|
||||
Europe/Warsaw
|
||||
Europe/Zagreb
|
||||
Europe/Zaporozhye
|
||||
Europe/Zurich
|
||||
Indian/Antananarivo
|
||||
Indian/Chagos
|
||||
Indian/Christmas
|
||||
Indian/Cocos
|
||||
Indian/Comoro
|
||||
Indian/Kerguelen
|
||||
Indian/Mahe
|
||||
Indian/Maldives
|
||||
Indian/Mauritius
|
||||
Indian/Mayotte
|
||||
Indian/Reunion
|
||||
Pacific/Apia
|
||||
Pacific/Auckland
|
||||
Pacific/Chatham
|
||||
Pacific/Easter
|
||||
Pacific/Efate
|
||||
Pacific/Enderbury
|
||||
Pacific/Fakaofo
|
||||
Pacific/Fiji
|
||||
Pacific/Funafuti
|
||||
Pacific/Galapagos
|
||||
Pacific/Gambier
|
||||
Pacific/Guadalcanal
|
||||
Pacific/Guam
|
||||
Pacific/Honolulu
|
||||
Pacific/Johnston
|
||||
Pacific/Kiritimati
|
||||
Pacific/Kosrae
|
||||
Pacific/Kwajalein
|
||||
Pacific/Majuro
|
||||
Pacific/Marquesas
|
||||
Pacific/Midway
|
||||
Pacific/Nauru
|
||||
Pacific/Niue
|
||||
Pacific/Norfolk
|
||||
Pacific/Noumea
|
||||
Pacific/Pago_Pago
|
||||
Pacific/Palau
|
||||
Pacific/Pitcairn
|
||||
Pacific/Ponape
|
||||
Pacific/Port_Moresby
|
||||
Pacific/Rarotonga
|
||||
Pacific/Saipan
|
||||
Pacific/Samoa
|
||||
Pacific/Tahiti
|
||||
Pacific/Tarawa
|
||||
Pacific/Tongatapu
|
||||
Pacific/Truk
|
||||
Pacific/Wake
|
||||
Pacific/Wallis
|
||||
Pacific/Yap
|
||||
Pacific/French_Polynesia-Marquesas_Islands
|
||||
UTC
|
||||
</pre>
|
39
modules/date/help/date-types.html
Normal file
39
modules/date/help/date-types.html
Normal file
|
@ -0,0 +1,39 @@
|
|||
<h3>Date Fields</h3>
|
||||
<p>The CCK Date field uses the <a href="topic:date_api/overview">Date API</a> to create date fields and widgets.</p>
|
||||
<p>You have a choice of creating an ISO date or a unix timestamp. If you are porting information from another application you may want to create a field using a type that matches the source data. Some advantages and disadvantages of each include:</p>
|
||||
<dl>
|
||||
<dt>Datestamp (Unix Timestamp)</dt>
|
||||
<dd><ul>
|
||||
<li>Stores the date as an integer.</li>
|
||||
<li>Takes up less room in the database because it's smaller.</li>
|
||||
<li>Often easier to use for date calculations because you can increase or decrease it just by adding or subtracting seconds.</li>
|
||||
<li>It is the format used by php date functions.</li>
|
||||
<li>It must be filled with a complete date -- year, month, day, hour, minute, second, so you sometimes have to arbitrarily set some of these values even if they are not applicable.</li>
|
||||
</ul></dd>
|
||||
|
||||
<dt>Date (ISO Date)</dt>
|
||||
<dd><ul>
|
||||
<li>Stores the date in an ISO format (YYYY-MM-DDTHH:MM:SS).</li>
|
||||
<li>The data is in a human-readable form.</li>
|
||||
<li>You can use it for incomplete dates, i.e. only a year or only a year and a month, and pad the other values with zeros, so it does not appear to be any more precise than it really is.</li>
|
||||
<li>It is a format that is internationally-recognized, and it is used as-is on many web sites and in many applications.</li>
|
||||
</ul></dd>
|
||||
|
||||
<dt>Datetime</dt>
|
||||
<dd><ul>
|
||||
<li>Stores the date in the database's native date format (YYYY-MM-DD HH:MM:SS).</li>
|
||||
<li>The data is in a human-readable form.</li>
|
||||
<li>You can use it for incomplete dates, i.e. only a year or only a year and a month, and pad the other values with zeros, so it does not appear to be any more precise than it really is.</li>
|
||||
<li>It can take advantage of the database's date handling functions without any conversion.</li>
|
||||
</ul></dd>
|
||||
</dl>
|
||||
<h3>Date Widgets</h3>
|
||||
<p>There are several widgets to choose from to control how users can enter data for this field.</p>
|
||||
<dl>
|
||||
<dt>Text Field</dt><dd>The Text Field date widget uses a custom format set in the field settings, like '31.12.2008'. As a fallback the widget will try to accept input allowed by the php <a href="http://www.php.net/manual/en/function.strtotime.php">strtotime function</a>. This allows the user to type a date in in many natural formats, like 'March 31, 1980'.
|
||||
There are limitations to strtotime, so setting a custom format is more reliable. The strtotime function will assume date shortcuts are in American format (MM/DD/YY), and strtotime will not work for dates prior to 1970.
|
||||
</dd>
|
||||
<dt>Select List</dt><dd>The Select List date widget presents users with a drop-down list or textfield for each part of the date (year, month, day, hour, etc.). The whole selector is collapsed onto a single line using css (except for the timezone selector, if date-specific timezones are collected). The selector is highly configurable and you can set it up to use 5, 10, or 15 minute increments for minutes and seconds, or make some parts of the selector use textfields instead of drop-downs, useful to allow any year without creating a huge drop-down selector.</dd>
|
||||
<dt>jQuery Pop-up Calendar</dt><dd>The Javascript Pop-up Calendar is offered as an input alternative if the Date Popup module is installed. The date is split into date and time fields, and the date field uses a jQuery popup calendar and the time field uses a jQuery timeselector widget that only allows valid time input.
|
||||
</dl>
|
||||
<p>If you have the Date Repeat module enabled, you will also see options for each of those widgets that include a repeat options selection form that will allow the user to choose values like 'Every week' or 'The last Tuesday'.</p>
|
45
modules/date/help/date-views-dates.html
Normal file
45
modules/date/help/date-views-dates.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
<p>Custom modules and add their own dates to the list the <a href="&topic:date_api/date-filter&">Date API Views filter</a> and <a href="&topic:date_api/date-argument&">Date API Views argument</a> can handle. See the following example for the way that core dates have been added:</p>
|
||||
<pre>
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
function date_api_date_api_fields($field) {
|
||||
$values = array(
|
||||
// The type of date: DATE_UNIX, DATE_ISO, DATE_DATETIME.
|
||||
'sql_type' => DATE_UNIX,
|
||||
// Timezone handling options: 'none', 'site', 'date', 'utc'.
|
||||
'tz_handling' => 'site',
|
||||
// Needed only for dates that use 'date' tz_handling.
|
||||
'timezone_field' => '',
|
||||
// Needed only for dates that use 'date' tz_handling.
|
||||
'offset_field' => '',
|
||||
// Array of "table.field" values for related fields that should be
|
||||
// loaded automatically in the Views SQL.
|
||||
'related_fields' => array(),
|
||||
// Granularity of this date field's db data.
|
||||
'granularity' => array('year', 'month', 'day', 'hour', 'minute', 'second'),
|
||||
);
|
||||
|
||||
switch ($field) {
|
||||
case 'users.created':
|
||||
case 'users.access':
|
||||
case 'users.login':
|
||||
case 'node.created':
|
||||
case 'node.changed':
|
||||
case 'node_revisions.timestamp':
|
||||
case 'files.timestamp':
|
||||
case 'node_counter.timestamp':
|
||||
case 'accesslog.timestamp':
|
||||
case 'comments.timestamp':
|
||||
case 'node_comment_statistics.last_comment_timestamp':
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
</pre>
|
0
modules/date/help/date-views.html
Normal file
0
modules/date/help/date-views.html
Normal file
2
modules/date/help/date.html
Normal file
2
modules/date/help/date.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
<p>The CCK Date field is one of the <a href="&topic:content/fields&">Content Construction Kit (CCK) Field modules</a>. It uses the <a href="topic:date_api/overview">Date API</a> to create date fields and widgets.</p>
|
||||
<p>There are a number of <a href="&topic:date_api/date-types&">Date fields and widgets</a> you can create with this module. </p>
|
90
modules/date/help/date_api.help.ini
Normal file
90
modules/date/help/date_api.help.ini
Normal file
|
@ -0,0 +1,90 @@
|
|||
|
||||
[advanced help settings]
|
||||
name = Date API
|
||||
index name = "Date API"
|
||||
|
||||
[overview]
|
||||
title = Overview
|
||||
|
||||
[date-api]
|
||||
title = Date API
|
||||
parent = overview
|
||||
weight = 20
|
||||
|
||||
[new-features]
|
||||
title = New Features
|
||||
parent = overview
|
||||
weight = -10
|
||||
|
||||
[date]
|
||||
title = Date field
|
||||
parent = overview
|
||||
|
||||
[date-php4]
|
||||
title = Date PHP4
|
||||
parent = overview
|
||||
weight = 2
|
||||
|
||||
[date-types]
|
||||
title = Date field
|
||||
parent = content%fields
|
||||
weight = -10
|
||||
|
||||
[date-display]
|
||||
title = Date formatter display
|
||||
parent = date
|
||||
weight = 1
|
||||
|
||||
[date-copy]
|
||||
title = Date Copy
|
||||
parent = overview
|
||||
weight = 1
|
||||
|
||||
[date-views]
|
||||
title = Views Integration
|
||||
parent = overview
|
||||
weight = -5
|
||||
|
||||
[date-argument]
|
||||
title = Generic date argument
|
||||
parent = date-views
|
||||
weight = 2
|
||||
|
||||
[date-filter]
|
||||
title = Generic date filter
|
||||
parent = date-views
|
||||
weight = 3
|
||||
|
||||
[embedding]
|
||||
title = Embedding Views
|
||||
parent = date-views
|
||||
weight = 4
|
||||
|
||||
[date-repeat-form]
|
||||
title = Repeating date options
|
||||
parent = date
|
||||
|
||||
[date-create]
|
||||
title = The PHP DateTime Object
|
||||
parent = date-api
|
||||
weight = 1
|
||||
|
||||
[date-api-functions]
|
||||
title = Date API Functions
|
||||
parent = date-api
|
||||
weight = 3
|
||||
|
||||
[form-elements]
|
||||
title = Form Elements
|
||||
parent = date-api
|
||||
weight = 4
|
||||
|
||||
[date-timezones]
|
||||
title = Timezone Handling
|
||||
parent = date-api
|
||||
weight = 5
|
||||
|
||||
[date-views-dates]
|
||||
title = Views Date Handling
|
||||
parent = date-api
|
||||
weight = 7
|
16
modules/date/help/embedding.html
Normal file
16
modules/date/help/embedding.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
<h3>Embedding Views</h3>
|
||||
<p>Embed a date browser view anywhere using the format:</p>
|
||||
<pre>date_embed_view($view_name, $display_name, $settings, $args)</pre>
|
||||
<p>Settings are used to override some values of the view.</p>
|
||||
<p>The primary setting that is useful here is a setting for 'block_identifier'. The view's block_identifier is used to control individual instances of regular and embedded views that contain date navigation so that they move separately or together. All views that use the same identifier will move together.
|
||||
All views that use different identifiers will move independently. The identifier will show up in the url as a querystring, like node/275?mini=calendar/2008-10.
|
||||
</p>
|
||||
<h3>Examples:</h3>
|
||||
<dl>
|
||||
<dt><?php print date_embed_view('myview', 'page_1'); ?></dt>
|
||||
<dd>This will embed the first page display in the view 'myview'.</dd>
|
||||
<dt><?php print date_embed_view('myview', 'page_1', array('block_identifer' => 'embedded'), array('2008-W45')); ?></dt>
|
||||
<dd>This will embed the first page display of the view and use 'embedded' as an identifier, set to show the week view for week 45 of 2008.</dd>
|
||||
<dt><?php print date_embed_view('myview', 'block_1', array('block_identifier' => 'mini'), array('2008-07')); ?></dt>
|
||||
<dd>This will embed the first block view of the view and use 'mini' as an identifier, set to show the month view for July 2008.</dd>
|
||||
</dl>
|
50
modules/date/help/form-elements.html
Normal file
50
modules/date/help/form-elements.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
<h3>Usage example of date elements within forms</h3>
|
||||
<p>
|
||||
* Enable the Date API module (you might want to add a dependency in the .info file of your module).
|
||||
* Date API uses <a href="http://api.drupal.org/api/function/hook_elements">hook_elements()</a> to create custom form types. You can check the file date_api_elements.inc for the list of form types available, and for other configuration options.
|
||||
</p>
|
||||
<p>
|
||||
Adding a date form element is then easy.
|
||||
<pre>
|
||||
<?php
|
||||
/**
|
||||
* Your form builder.
|
||||
*/
|
||||
function mymodule_form($form_state) {
|
||||
$form = array();
|
||||
|
||||
// [...snip...] add many fields to your form
|
||||
|
||||
// Creating the date/time element starts here
|
||||
|
||||
// Provide a default date in the format YYYY-MM-DD HH:MM:SS.
|
||||
$date = '2008-12-31 00:00:00';
|
||||
|
||||
// Provide a format using regular PHP format parts (see documentation on php.net).
|
||||
// If you're using a date_select, the format will control the order of the date parts in the selector,
|
||||
// rearrange them any way you like. Parts left out of the format will not be displayed to the user.
|
||||
$format = 'Y-m-d H:i';
|
||||
|
||||
$form['date2'] = array(
|
||||
'#type' => 'date_select', // types 'date_text' and 'date_timezone' are also supported. See .inc file.
|
||||
'#title' => 'select a date',
|
||||
'#default_value' => $date,
|
||||
'#date_format' => $format,
|
||||
'#date_label_position' => 'within', // See other available attributes and what they do in date_api_elements.inc
|
||||
'#date_timezone' => 'America/Chicago', // Optional, if your date has a timezone other than the site timezone.
|
||||
'#date_increment' => 15, // Optional, used by the date_select and date_popup elements to increment minutes and seconds.
|
||||
'#date_year_range' => '-3:+3', // Optional, used to set the year range (back 3 years and forward 3 years is the default).
|
||||
);
|
||||
|
||||
// [...snip...] more fields, including the 'submit' button.
|
||||
|
||||
return $form;
|
||||
}
|
||||
?>
|
||||
</pre>
|
||||
<p>These are self-validating elements, you shouldn't need to do anything except include them in your form. You pass them parameters for the timezone, format, and a default value in the format YYYY-MM-DD HH:MM:SS, and it will convert your input into the format the element wants, split the date and time into different fields as needed, then accept and validate the user input and convert it back into a string in the same format you originally provided (YYYY-MM-DD HH:MM:SS). So you pass it a string and it will pass back a string by the time you get to your own validation function.
|
||||
</p><p>
|
||||
You are responsible for doing your own timezone conversion, the element uses the timezone just so it can create a date object with the right timezone for doing its formatting. So if you need to do timezone conversion, you pull your UTC date out of the database and convert it to a local date, pass that value to the Date element, then take what it returns and convert it back to UTC and store it in the database again.
|
||||
</p><p>
|
||||
If the Date Popup module is enabled, a date_popup element can be used. It works like the other elements, but splits the date and time into separate parts. You control whether it uses date or date and time by the format you supply in #date_format. If you don't have any time parts in the format, you won't get a time element. Note that the jquery widget (the 'date' part of the popup) can only accept a limited number of formats, things like Y-m-d or m/d/Y or d.m.Y.
|
||||
</p>
|
11
modules/date/help/new-features.html
Normal file
11
modules/date/help/new-features.html
Normal file
|
@ -0,0 +1,11 @@
|
|||
<ul>
|
||||
<li>The Date API now uses PHP 5.2 date functions for better date and timezone handling (and has PHP 4 emulations for those functions so the module will work in PHP4). Although the code will work with PHP 4, it is <strong>significantly</strong> faster and more efficient under PHP 5.2 or higher, so PHP 5.2 is highly recommended.</li>
|
||||
<li>The database query handling has been completely re-worked to take advantage of database timezone handling when available, with a fallback to the older and less reliable method of using offsets to do timezone adjustments.</li>
|
||||
<li>No more need for the adodb date library, historical dates earlier than 1970 and later than 2038 are handled without any external code.</li>
|
||||
<li> iCal integration is greatly improved, an iCal parser can parse events, alarms, most types of dates and timezones, duration, repeat rules, and more.</lI>
|
||||
<li>The Date API creates date elements that can be used by any module, including 'date_select', 'date_textfield', and 'date_timezone'.</li>
|
||||
<li> A new Date Timezone module overrides the site and user timezone selectors to allow you to select a timezone name instead of a timezone offset, and that stored name is used to properly adjust date values. It also detects the user's timezone name automatically and updates the user record with that name.</li>
|
||||
<li>A new Date Popup module creates a jQuery popup calendar date picker and time picker, and the element is available to other modules as a form type of 'date_popup'. </li>
|
||||
<li>The Date module now has lots of new ways to define default values -- you can set a the default to 'blank', 'now', or 'relative', where relative is something like '+90 days'. The To date has a separate default value, which can be the same as the From date or do something different.</li>
|
||||
<li>A Date Repeat API module has been added which can be used by any other module. The CCK Date module uses it to allow you to select 'repeating' as a type of multiple date, present the user with a form to select the repeat rules for their date, and then create all the multiple values that match those rules.</li>
|
||||
</ul>
|
2
modules/date/help/overview.html
Normal file
2
modules/date/help/overview.html
Normal file
|
@ -0,0 +1,2 @@
|
|||
<p>The <a href="http://drupal.org/project/date">date module</a> defines a highly configurable date/time field type for the content module and a date API that can be used by other applications.
|
||||
</p>
|
Reference in a new issue