Calendar
[ class tree: Calendar ] [ index: Calendar ] [ all elements ]

Class: Calendar

Source Location: /Calendar-0.5.5/Calendar.php

Class Overview


Base class for Calendar API. This class should not be instantiated directly.


Author(s):

Copyright:

  • 2003-2007 Harry Fuecks, Lorenzo Alberton

Methods


Child classes:

Calendar_Minute
Represents a Minute and builds Seconds
Calendar_Week
Represents a Week and builds Days in tabular format
Calendar_Month
Represents a Month and builds Days
Calendar_Hour
Represents an Hour and builds Minutes
Calendar_Second
Represents a Second
Note: Seconds do not build other objects so related methods are overridden to return NULL
Calendar_Year
Represents a Year and builds Months
Calendar_Day
Represents a Day and builds Hours.

Inherited Variables

Inherited Methods


Class Details

[line 120]
Base class for Calendar API. This class should not be instantiated directly.


[ Top ]


Method Detail

Calendar (Constructor)   [line 206]

Calendar Calendar( [int $y = 2000], [int $m = 1], [int $d = 1], [int $h = 0], [int $i = 0], [int $s = 0])

Constructs the Calendar
  • Access: protected

Parameters:

int   $y     year
int   $m     month
int   $d     day
int   $h     hour
int   $i     minute
int   $s     second

[ Top ]

adjust   [line 295]

void adjust( )

Adjusts the date (helper method)
  • Access: public

[ Top ]

build   [line 369]

boolean build( [array $sDates = array()])

Abstract method for building the children of a calendar object.

Implemented by Calendar subclasses

  • Abstract:
  • Access: public

Overridden in child classes as:

Calendar_Minute::build()
Builds the Calendar_Second objects
Calendar_Week::build()
Builds Calendar_Day objects for this Week
Calendar_Month::build()
Builds Day objects for this Month. Creates as many Calendar_Day objects as there are days in the month
Calendar_Month_Weeks::build()
Builds Calendar_Week objects for the Month. Note that Calendar_Week builds Calendar_Day object in tabular form (with Calendar_Day->empty)
Calendar_Month_Weekdays::build()
Builds Day objects in tabular form, to allow display of calendar month with empty cells if the first day of the week does not fall on the first day of the month.
Calendar_Hour::build()
Builds the Minutes in the Hour
Calendar_Second::build()
Overwrite build
Calendar_Year::build()
Builds the Months of the Year.
Calendar_Day::build()
Builds the Hours of the Day

Parameters:

array   $sDates     array containing Calendar objects to select (optional)

[ Top ]

defineFirstDayOfWeek   [line 489]

integer defineFirstDayOfWeek( [integer $firstDay = null])

Set the CALENDAR_FIRST_DAY_OF_WEEK constant to the $firstDay value if the constant is not set yet.
  • Throws: E_USER_WARNING this method throws a WARNING if the CALENDAR_FIRST_DAY_OF_WEEK constant is already defined and the $firstDay parameter is set to a different value
  • Access: protected

Parameters:

integer   $firstDay     first day of the week (0=sunday, 1=monday, ...)

[ Top ]

fetch   [line 404]

mixed fetch( )

Iterator method for fetching child Calendar subclass objects (e.g. a minute from an hour object). On reaching the end of the collection, returns false and resets the collection for further iteratations.
  • Return: either an object subclass of Calendar or false
  • Access: public

Overridden in child classes as:

Calendar_Second::fetch()
Overwrite fetch

[ Top ]

fetchAll   [line 421]

array fetchAll( )

Fetches all child from the current collection of children
  • Access: public

Overridden in child classes as:

Calendar_Second::fetchAll()
Overwrite fetchAll

[ Top ]

getEngine   [line 472]

object implementing &getEngine( )

Returns a reference to the current Calendar_Engine being used. Useful for Calendar_Table_Helper and Calendar_Validator
  • Return: Calendar_Engine_Inteface
  • Access: protected

[ Top ]

getTimestamp   [line 247]

int|string getTimestamp( )

Returns a timestamp from the current date / time values. Format of timestamp depends on Calendar_Engine implementation being used
  • Return: timestamp
  • Access: public

[ Top ]

getValidator   [line 456]

Calendar_Validator &getValidator( )

Returns an instance of Calendar_Validator
  • Access: public

[ Top ]

isSelected   [line 273]

boolean isSelected( )

True if the calendar subclass object is selected (e.g. today)
  • Access: public

[ Top ]

isToday   [line 284]

boolean isToday( )

Checks if the current Calendar object is today's date
  • Access: public

[ Top ]

isValid   [line 444]

boolean isValid( )

Determine whether this date is valid, with the bounds determined by the Calendar_Engine. The call is passed on to Calendar_Validator::isValid
  • Access: public

[ Top ]

nextDay   [line 632]

int nextDay( [string $format = 'int'])

Returns the value for the next day
  • Return: e.g. 12 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

nextHour   [line 677]

int nextHour( [string $format = 'int'])

Returns the value for the next hour
  • Return: e.g. 14 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

nextMinute   [line 724]

int nextMinute( [string $format = 'int'])

Returns the value for the next minute
  • Return: e.g. 25 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

nextMonth   [line 588]

int nextMonth( [string $format = 'int'])

Returns the value for next month
  • Return: e.g. 6 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

nextSecond   [line 772]

int nextSecond( [string $format = 'int'])

Returns the value for the next second
  • Return: e.g. 45 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

nextYear   [line 546]

int nextYear( [string $format = 'int'])

Returns the value for next year
  • Return: e.g. 2004 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

prevDay   [line 602]

int prevDay( [string $format = 'int'])

Returns the value for the previous day
  • Return: e.g. 10 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

prevHour   [line 647]

int prevHour( [string $format = 'int'])

Returns the value for the previous hour
  • Return: e.g. 13 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

prevMinute   [line 692]

int prevMinute( [string $format = 'int'])

Returns the value for the previous minute
  • Return: e.g. 23 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

prevMonth   [line 560]

int prevMonth( [string $format = 'int'])

Returns the value for the previous month
  • Return: e.g. 4 or Unix timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

prevSecond   [line 740]

int prevSecond( [string $format = 'int'])

Returns the value for the previous second
  • Return: e.g. 43 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

prevYear   [line 518]

int prevYear( [string $format = 'int'])

Returns the value for the previous year
  • Return: e.g. 2002 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

setSelected   [line 262]

void setSelected( [boolean $state = true])

Defines calendar object as selected (e.g. for today)
  • Access: public

Parameters:

boolean   $state     whether Calendar subclass

[ Top ]

setSelection   [line 386]

boolean setSelection( array $sDates)

Abstract method for selected data objects called from build
  • Abstract:
  • Access: public

Parameters:

array   $sDates     array of Calendar objects to select

[ Top ]

setTimestamp   [line 230]

void setTimestamp( int|string $ts)

Defines the calendar by a timestamp (Unix or ISO-8601), replacing values passed to the constructor
  • Access: public

Overridden in child classes as:

Calendar_Week::setTimestamp()
Defines the calendar by a timestamp (Unix or ISO-8601), replacing values passed to the constructor

Parameters:

int|string   $ts     Unix or ISO-8601 timestamp

[ Top ]

size   [line 432]

int size( )

Get the number Calendar subclass objects stored in the internal collection
  • Access: public

Overridden in child classes as:

Calendar_Second::size()
Overwrite size

[ Top ]

thisDay   [line 617]

int thisDay( [string $format = 'int'])

Returns the value for this day
  • Return: e.g. 11 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

thisHour   [line 662]

int thisHour( [string $format = 'int'])

Returns the value for this hour
  • Return: e.g. 14 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

thisMinute   [line 708]

int thisMinute( [string $format = 'int'])

Returns the value for this minute
  • Return: e.g. 24 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

thisMonth   [line 574]

int thisMonth( [string $format = 'int'])

Returns the value for this month
  • Return: e.g. 5 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

thisSecond   [line 756]

int thisSecond( [string $format = 'int'])

Returns the value for this second
  • Return: e.g. 44 or timestamp
  • Access: public

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

thisYear   [line 532]

int thisYear( [string $format = 'int'])

Returns the value for this year
  • Return: e.g. 2003 or timestamp
  • Access: public

Overridden in child classes as:

Calendar_Week::thisYear()
Returns the value for this year

Parameters:

string   $format     return value format ['int'|'timestamp'|'object'|'array']

[ Top ]

toArray   [line 314]

array toArray( [mixed $stamp = null])

Returns the date as an associative array (helper method)
  • Access: public

Parameters:

mixed   $stamp     timestamp (leave empty for current timestamp)

[ Top ]


Documentation generated on Thu, 24 Jun 2010 14:00:08 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.