[ Index ]
 

Code source de PHPonTrax 2.6.6-svn

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/vendor/trax/action_view/helpers/ -> date_helper.php (sommaire)

File containing the DateHelper class and support functions (PHP 5)

Copyright: (c) 2005 John Peterson
Version: $Id: date_helper.php 230 2006-07-18 18:47:39Z john $
Poids: 1629 lignes (71 kb)
Inclus ou requis: 1 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

DateHelper:: (34 méthodes):
  __construct()
  check_request_for_value()
  select_html()
  leading_zero_on_single_digits()
  value()
  expiration_date_select()
  datetime_select()
  date_select()
  select_expiration_date()
  select_date()
  select_datetime()
  select_time()
  select_second()
  select_minute()
  select_hour()
  select_day()
  select_month()
  select_year()
  year_option()
  to_date_select_tag()
  to_datetime_select_tag()
  to_expiration_date_select_tag()
  time_select()
  year_select()
  select_date()
  select_datetime()
  select_expiration_date()
  datetime_select()
  date_select()
  year_select()
  time_select()
  expiration_date_select()
  select_month()
  select_day()


Classe: DateHelper  - X-Ref

Utility to help build HTML pulldown menus for date and time

__construct($object_name = null, $attribute_name = null)   X-Ref
Constructor

Construct an instance of Helpers with the same arguments
param: string Name of an ActiveRecord subclass
param: string Name of an attribute of $object

check_request_for_value()   X-Ref
Check whether $_REQUEST holds value for this attribute

Called with the name of an ActiveRecord subclass in
$this->object_name and the name of one of its attributes in
$this->attribute_name.  Check whether $_REQUEST contains a
value for this attribute; if so return it.
return: mixed String value if attribute was found in

select_html($type, $options, $prefix = null,$include_blank = false,$discard_type = false)   X-Ref
Generate HTML/XML for select to enclose option list

param: string   Name attribute for <samp><select name=... ></samp>
param: string   <samp><option>...</option><samp> list
param: string   Prefix of name attribute, to be enclosed in
param: boolean  Whether to include a blank in the list of
param: boolean  Whether to discard the type
return: string  Generated HTML

leading_zero_on_single_digits($number)   X-Ref
Prefix a leading zero to single digit numbers

param: string   A number
return: string  Number with zero prefix if value <= 9

value()   X-Ref
Get attribute value from $_REQUEST if there, otherwise from database

When called, {@link $object_name} describes the
{@link ActiveRecord} subclass and {@link $attribute_name}
describes the attribute whose value is desired.

An attempt is made to find the value in $_REQUEST, where it
would be found after the browser POSTed a form.  If no value
is found there, then the database is accessed for the value.
When accessing the database, the assumption is made that the
{@link ActionController} object refers to a single
{@link ActiveRecord} subclass object which correctly
identifies the table and record containing the attribute
value.
return: mixed Attribute value if found

expiration_date_select($options = array()   X-Ref
Call to_expiration_date_select_tag()

Alias for {@link to_expiration_date_select_tag()}
param: mixed[]  Output format options
return: string Generated HTML

datetime_select($options = array()   X-Ref
Call to_datetime_select_tag()

Alias for {@link to_datetime_select_tag()}
param: mixed[]  Output format options
return: string Generated HTML

date_select($options = array()   X-Ref
Call to_date_select_tag()

Alias for {@link to_date_select_tag()}
param: mixed[]  Output format options
return: string Generated HTML

select_expiration_date($date = null, $options = array()   X-Ref
Generate HTML/XML for expiration month and year selector
pulldowns

Generates HTML for a month and year pulldown.  The year
pulldown has a range of years from the initially selected year
to seven years after.

When called, $_REQUEST[] may have initial date values in
fields with default names of 'expiration_month' and
'expiration_year'.  If these values exist they override the
first parameter.
param: string   Date to display as initially selected if none
param: mixed[]  Output format options:
return: string Generated HTML

select_date($date = null, $options = array()   X-Ref
Generate HTML/XML for year, month and day selector pull-down menus

Returns <samp><select>...</select></samp> HTML with options
for a number of years, months and days.  The first argument,
if present, specifies the initially selected date.  The second
argument controls the format of the generated HTML.

Examples:
<ul>
<li><samp>select_date();</samp><br /> Generates a group of
three pulldown menus in the order year, month and day with
the current date initially selected.</li>
<li>
<samp>select_date('August 4, 1998');</samp><br /> Generates a
group of   three pulldown menus in the order year, month and
day with the date August 4, 1998 initially selected.</li>
</ul>

param: string   Date to display as initially selected if none
param: mixed[] Output format options are all of the options of
return: string  Generated HTML

select_datetime($datetime = null, $options = array()   X-Ref
Generate HTML/XML for year-month-day-hour-minute selector pulldowns

Returns <samp><select>...</select></samp> HTML with options
for a number of years, months, days, hours and minutes.  The
first argument, if present, specifies the initially selected
date.  The second argument controls the format of the
generated HTML.

Examples:
<ul>
<li><samp>select_datetime();</samp><br /> Generates a group of
five pulldown menus in the order year, month, day, hour and
minute with the current date and time initially
selected.</li>
<li>
<samp>select_datetime('1998-04-08 13:21:17');</samp><br />
Generates a group of five pulldown menus in the order year,
month, day, hour and minute with the date/time
1998 August 4 13:21 initially selected.</li>
</ul>

param: string   Date/time to display as initially selected.
param: mixed[] Output format options are all of the options of
return: string  Generated HTML

select_time($datetime = null, $options = array()   X-Ref
Generate HTML/XML for hour, minute and second selector pull-down menus

Returns <samp><select>...</select></samp> HTML with options
for a number of hours, minutes and seconds.  The first argument,
if present, specifies the initially selected time.  The second
argument controls the format of the generated HTML.

Examples:
<ul>
<li><samp>select_time();</samp><br /> Generates two pulldown
menus in the order hour : minute with
the current time initially selected.</li>
<li>
<samp>select_time('August 4, 1998 8:12');</samp><br /> Generates
two pulldown menus in the order hour : minute with the
time 8:12 initially selected.</li>
</ul>

param: string   Time to display as initially selected if none
param: mixed[] Output format options are all of the options of
return: string  Generated HTML

select_second($datetime=null, $options = array()   X-Ref
Generate HTML/XML for second selector pull-down menu

Returns <samp><select>...</select></samp> HTML with an option
for each of the sixty seconds.  The first argument, if
present, specifies the initially selected second.  The second
argument controls the format of the generated HTML.

Examples:
<ul>
<li><samp>select_second();</samp><br />
Generates menu '00', '01', ..., '59'.  Initially selected
second is the second in
{@link $request_seconds}[{@link $attribute_name}], or if that
is not defined, the current second.</li>
<li><samp>select_second(null,array('include_blank' => true));</samp>
<br />Generates menu ' ', '00', '01',..., '59'.  Initially
selected second same as above.</li>
</ul>

param: string  Initially selected second as two-digit number.
param: mixed[] Output format options:
return: string  Generated HTML

select_minute($datetime=null, $options = array()   X-Ref
Generate HTML/XML for minute selector pull-down menu

Returns <samp><select>...</select></samp> HTML with an option
for each of the sixty minutes.  The first argument, if
present, specifies the initially selected minute.  The second
argument controls the format of the generated HTML.

Examples:
<ul>
<li><samp>select_minute();</samp><br />
Generates menu '00', '01', ..., '59'.  Initially selected
minute is the minute in
{@link $request_minutes}[{@link $attribute_name}], or if that
is not defined, the current minute.</li>
<li><samp>select_minute(null,array('include_blank' => true));</samp>
<br />Generates menu ' ', '00', '01',..., '59'.  Initially
selected minute same as above.</li>
</ul>

param: string  Initially selected minute as two-digit number.
param: mixed[] Output format options:
return: string  Generated HTML

select_hour($datetime=null, $options = array()   X-Ref
Generate HTML/XML for hour selector pull-down menu

Returns <samp><select>...</select></samp> HTML with an option
for each of the twenty-four hours.  The first argument, if
present, specifies the initially selected hour.  The second
argument controls the format of the generated HTML.

Examples:
<ul>
<li><samp>select_hour();</samp><br />
Generates menu '00', '01', ..., '23'.  Initially selected
hour is the hour in
{@link $request_hours}[{@link $attribute_name}], or if that
is not defined, the current hour.</li>
<li><samp>select_hour(null,array('include_blank' => true));</samp>
<br />Generates menu ' ', '00', '01',..., '23'.  Initially
selected hour same as above.</li>
</ul>

param: string  Initially selected hour as two-digit number.
param: mixed[] Output format options:
return: string  Generated HTML

select_day($datetime=null, $options = array()   X-Ref
Generate HTML/XML for day selector pull-down menu

Returns <samp><select>...</select></samp> HTML with an option
for each of the thirty-one days.  The first argument, if
present, specifies the initially selected day.  The second
argument controls the format of the generated HTML.


Examples:
<ul>
<li><samp>select_day();</samp><br />
Generates menu '01', '02', ..., '31'.  Initially selected
day is the day in
{@link $request_days}[{@link $attribute_name}], or if that
is not defined, the current calendar day.</li>
<li><samp>select_day(null,array('include_blank' => true));</samp>
<br />Generates menu ' ', '01', '02',..., '31'.  Initially
selected day same as above.</li>
</ul>

param: string  Initially selected day as two-digit number.
param: mixed[] Output format options:
return: string  Generated HTML

select_month($date = null, $options = array()   X-Ref
Generate HTML/XML for month selector pull-down menu

Returns <samp><select>...</select></samp> HTML with an option
for each of the twelve months.  The first argument, if
present, specifies the initially selected month.  The second
argument controls the format of the generated HTML.


Examples:
<ul>
<li><samp>select_month();</samp> Generates menu January,
February etc.</li>
<li><samp>select_month(null,array('use_month_number' => true));</samp>
Generates menu 1, 2 etc.</li>
<li><samp>select_month(null,array('add_month_number' => true));</samp>
Generates menu 1 - January, 2 - February etc.</li>
</ul>

param: string  Initially selected month as two-digit number.
param: mixed[] Output format options:
return: string  Generated HTML

select_year($date=null, $options = array()   X-Ref
Generate HTML/XML for year selector pull-down menu

Returns <samp><select>...</select></samp> HTML with options
for a number of years.  The first argument, if present,
specifies the initially selected year.  The second
argument controls the format of the generated HTML.

Examples:
<ul>
<li><samp>select_year();</samp><br /> Generates a pulldown menu with
with a range of +/- five years.  If a year is specified in
{@link $request_years}[{@link $attribute_name}] then it is
selected initially, otherwise the current calendar year is
selected.</li>
<li>
<samp>select_year(null,array('start_year' => '1900));</samp><br />
Generates year options from 1900 to five years after the
initially selected year, which is chosen as in the previous
example.</li>
<li><samp>select_year(null,array('start_year'=>date('Y')+5, 'end_year'=>date('Y')-5);</samp><br />
Generates year options starting five years after the current year,
ending five years before the current year.
</ul>

param: string   Year to display as initially selected if none
param: mixed[] Output format options:
return: string  Generated HTML

year_option($year, $date_year)   X-Ref
Return one HTML/XML year option, selected if so specified

param: integer Year to put in the option
param: integer Year that should be selected
return: string HTML for one year option

to_date_select_tag($options = array()   X-Ref
Generate HTML/XML for day/month/year selector pull-down menus

When called, {@link $object_name} describes the
{@link ActiveRecord} subclass and {@link $attribute_name}
describes the attribute whose value will be set by the
generated pull-down menus.  The value to be displayed
initially in each menu is from $_REQUEST if present, otherwise
from the database.

param: mixed[] Output format options
return: string Generated HTML

to_datetime_select_tag($options = array()   X-Ref
Generate HTML/XML for date/time pulldown menus

Returns <samp><select>...</select></samp> HTML with options
for a number of years, months, days, hours and minutes.  The
first argument, if present, specifies the initially selected
date.  The second argument controls the format of the
generated HTML.

Examples:
<ul>
<li><samp>to_datetime_select_tag();</samp><br /> Generates a
group of five pulldown menus in the order year, month, day,
hour and minute with the current date and time initially
selected.</li>
<li>
<li><samp>to_datetime_select_tag(array('discard_second' => false);</samp><br />
Generates a group of six pulldown menus in the order year,
month, day, hour, minute and second with the current date
and time initially selected.</li>
<li>
<samp>to_datetime_select_tag('1998-04-08 13:21:17');</samp><br />
Generates a group of five pulldown menus in the order year,
month, day, hour and minute with the date/time
1998 August 4 13:21 initially selected.</li>
</ul>

param: string   Date/time to display as initially selected.
param: mixed[] Output format options:
return: string Generated HTML

to_expiration_date_select_tag($options = array()   X-Ref
Generate HTML/XML for expiration month and year pulldown.

Calls {@link to_date_select_tag()} with options for month with
number, followed by year starting this year and going seven
years in the future.
param: mixed[] Output format options
return: string Generated HTML

time_select($options=array()   X-Ref
Generate HTML/XML for time pulldown

When called, {@link $object_name} describes the
{@link ActiveRecord} subclass and {@link $attribute_name}
describes the attribute whose value will be set by the
generated pull-down menu.  The value to be displayed initially
is from $_REQUEST if present, otherwise from the database.

param: mixed[] Output format options
return: string Generated HTML

year_select($options=array()   X-Ref
Generate HTML/XML for year pulldown

When called, {@link $object_name} describes the
{@link ActiveRecord} subclass and {@link $attribute_name}
describes the attribute whose value will be set by the
generated pull-down menu.  The value to be displayed initially
is from $_REQUEST if present, otherwise from the database.

param: mixed[] Output format options
return: string Generated HTML

select_date()   X-Ref
Make a new DateHelper object and call its select_date() method


select_datetime()   X-Ref
Make a new DateHelper object and call its select_datetime() method


select_expiration_date()   X-Ref
Make a new DateHelper object and call its select_expiration_date() method


datetime_select($object, $attribute, $options = array()   X-Ref
Make a new DateHelper object and call its datetime_select() method

param: string Name of an ActiveRecord subclass
param: string Name of an attribute of $object
param: mixed[] Format options

date_select($object, $attribute, $options = array()   X-Ref
Make a new DateHelper object and call its date_select() method

param: string Name of an ActiveRecord subclass
param: string Name of an attribute of $object
param: mixed[]  Output format options
return: string Generated HTML

year_select($object, $attribute, $options = array()   X-Ref
Make a new DateHelper object and call its year_select() method

param: string Name of an ActiveRecord subclass
param: string Name of an attribute of $object
param: mixed[] Format options

time_select($object, $attribute, $options = array()   X-Ref
Make a new DateHelper object and call its select_time() method

param: string Name of an ActiveRecord subclass
param: string Name of an attribute of $object
param: mixed[] Format options

expiration_date_select($object, $attribute, $options = array()   X-Ref
Make a new DateHelper object and call its expiration_date_select() method

param: string Name of an ActiveRecord subclass
param: string Name of an attribute of $object
param: mixed[] Format options

select_month()   X-Ref
Make a new DateHelper object and call its select_month() method

Generate HTML/XML for month selector pull-down menu using only
explicit month specification.<br />
<b>NB:</b>  An attempt to get value of an attribute will always
fail because there is no way to set
{@link DateHelper::object_name} and
{@link DateHelper::attribute_name}.

select_day()   X-Ref
Make a new DateHelper object and call its select_day() method




Généré le : Sun Feb 25 20:04:38 2007 par Balluche grâce à PHPXref 0.7