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

Class: Calendar_Week

Source Location: Program_Root/Week.php

Class Overview

Calendar
   |
   --Calendar_Week

Represents a Week and builds Days in tabular format

Methods


Inherited Variables

Inherited Methods

Class: Calendar

Calendar::Calendar()
Constructs the Calendar
Calendar::build()
Abstract method for building the children of a calendar object.
Calendar::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.
Calendar::fetchAll()
Fetches all child from the current collection of children
Calendar::getTimestamp()
Returns a timestamp from the current date / time values. Format of
Calendar::getValidator()
Returns an instance of Calendar_Validator
Calendar::isSelected()
True if the calendar subclass object is selected (e.g. today)
Calendar::isValid()
Determine whether this date is valid, with the bounds determined by
Calendar::nextDay()
Returns the value for the next day
Calendar::nextHour()
Returns the value for the next hour
Calendar::nextMinute()
Returns the value for the next minute
Calendar::nextMonth()
Returns the value for next month
Calendar::nextSecond()
Returns the value for the next second
Calendar::nextYear()
Returns the value for next year
Calendar::prevDay()
Returns the value for the previous day
Calendar::prevHour()
Returns the value for the previous hour
Calendar::prevMinute()
Returns the value for the previous minute
Calendar::prevMonth()
Returns the value for the previous month
Calendar::prevSecond()
Returns the value for the previous second
Calendar::prevYear()
Returns the value for the previous year
Calendar::setSelected()
Defines calendar object as selected (e.g. for today)
Calendar::setSelection()
Abstract method for selected data objects called from build
Calendar::setTimestamp()
Defines the calendar by a Unix timestamp, replacing values
Calendar::size()
Get the number Calendar subclass objects stored in the internal collection.
Calendar::thisDay()
Returns the value for this day
Calendar::thisHour()
Returns the value for this hour
Calendar::thisMinute()
Returns the value for this minute
Calendar::thisMonth()
Returns the value for this month
Calendar::thisSecond()
Returns the value for this second
Calendar::thisYear()
Returns the value for this year

Class Details

Represents a Week and builds Days in tabular format


1 require_once('Calendar/Week.php');
2 $Week = & new Calendar_Week(2003,10,1); Oct 2003, 1st tabular week
3 echo '<tr>';
4 while ($Day = & $Week->fetch()) {
5 if ($Day->isEmpty()) {
6 echo '<td>&nbsp;</td>';
7 } else {
8 echo '<td>'.$Day->thisDay().'</td>';
9 }
10 }
11 echo '</tr>';

access:  public

Class Methods


constructor Calendar_Week

Constructs Week

Calendar_Week Calendar_Week( int $y, int $m, int $w, [int $firstDay = false])

API Tags:

access:  public

Parameters:

int   $y   year e.g. 2003
int   $m   month e.g. 5
int   $w   tabular week of month e.g. 3
int   $firstDay   (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)

method build

Builds Calendar_Day objects for this Week

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

API Tags:

access:  public
Overrides Calendar::build() (Abstract method for building the children of a calendar object.)

Parameters:

array   $sDates   (optional) Calendar_Day objects representing selected dates

method getHelper

Returns the instance of Calendar_Table_Helper.

Called from Calendar_Validator::isValidWeek



Calendar_Table_Helper &getHelper( )

API Tags:

access:  protected

method getTimestamp

Returns a timestamp from the current date / time values

Note: overrides parent method as Week must determine the first day in the collection.
Note: calling this method also calls the build() method, if it has not already called.



int getTimestamp( )

API Tags:

return:  Unix timestamp
access:  public
Overrides Calendar::getTimestamp() (Returns a timestamp from the current date / time values. Format of)

method nextDay

Returns the value for the next day

int nextDay( [boolean $asTs = false])

API Tags:

return:  e.g. 12 or timestamp
access:  public
Overrides Calendar::nextDay() (Returns the value for the next day)

Parameters:

boolean   $asTs   set to true to return a timestamp (optional)

method nextWeek

Gets the numeric value of the next week in the month

or NULL if this is the last week of the month



int nextWeek( [mixed $asTs = FALSE])

API Tags:

access:  public

method prevDay

Returns the value for the previous day

int prevDay( [boolean $asTs = false])

API Tags:

return:  e.g. 10 or timestamp
access:  public
Overrides Calendar::prevDay() (Returns the value for the previous day)

Parameters:

boolean   $asTs   set to true to return a timestamp (optional)

method prevWeek

Gets the numeric value of the previous week in the month

or NULL if this is the first week of the month



int prevWeek( [mixed $asTs = FALSE])

API Tags:

access:  public

method thisDay

Returns the value for this day

int thisDay( [boolean $asTs = false])

API Tags:

return:  e.g. 11 or timestamp
access:  public
Overrides Calendar::thisDay() (Returns the value for this day)

Parameters:

boolean   $asTs   set to true to return a timestamp (optional)

method thisWeek

Gets the numeric value of the week in the month

int thisWeek( [mixed $asTs = FALSE])

API Tags:

access:  public
Released under the PHP license (http://www.php.net/license/3_0.txt)
Documentation generated on Thu, 30 Oct 2003 16:36:11 +0100 by phpDocumentor 1.2.2