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

Class: Calendar_Week

Source Location: /Calendar-0.5.5/Week.php

Class Overview

Calendar
   |
   --Calendar_Week

Represents a Week and builds Days in tabular format


Author(s):

Copyright:

  • 2003-2007 Harry Fuecks, Lorenzo Alberton

Methods


Inherited Variables

Inherited Methods

Class: Calendar

Calendar::Calendar()
Constructs the Calendar
Calendar::adjust()
Adjusts the date (helper method)
Calendar::build()
Abstract method for building the children of a calendar object.
Calendar::defineFirstDayOfWeek()
Set the CALENDAR_FIRST_DAY_OF_WEEK constant to the $firstDay value if the constant is not set yet.
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::getEngine()
Returns a reference to the current Calendar_Engine being used. Useful for Calendar_Table_Helper and Calendar_Validator
Calendar::getTimestamp()
Returns a timestamp from the current date / time values. Format of timestamp depends on Calendar_Engine implementation being used
Calendar::getValidator()
Returns an instance of Calendar_Validator
Calendar::isSelected()
True if the calendar subclass object is selected (e.g. today)
Calendar::isToday()
Checks if the current Calendar object is today's date
Calendar::isValid()
Determine whether this date is valid, with the bounds determined by the Calendar_Engine. The call is passed on to Calendar_Validator::isValid
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 timestamp (Unix or ISO-8601), replacing values passed to the constructor
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
Calendar::toArray()
Returns the date as an associative array (helper method)

Class Details

[line 77]
Represents a Week and builds Days in tabular format

  1.  require_once 'Calendar/Week.php';
  2.  $Week = new Calendar_Week(2003101); Oct 20031st 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>';



[ Top ]


Method Detail

Calendar_Week (Constructor)   [line 138]

Calendar_Week Calendar_Week( int $y, int $m, int $d, [int $firstDay = null])

Constructs Week
  • Access: public

Parameters:

int   $y     year e.g. 2003
int   $m     month e.g. 5
int   $d     a day of the desired week
int   $firstDay     (optional) first day of week (e.g. 0 for Sunday, 2 for Tuesday etc.)

[ Top ]

build   [line 212]

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

Builds Calendar_Day objects for this Week
  • 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

[ Top ]

getHelper   [line 446]

Calendar_Table_Helper &getHelper( )

Returns the instance of Calendar_Table_Helper.

Called from Calendar_Validator::isValidWeek

  • Access: protected

[ Top ]

nextWeek   [line 417]

mixed nextWeek( [string $format = 'n_in_month'])

Gets the value of the following week, according to the requested format
  • Access: public

Parameters:

string   $format     ['timestamp' | 'n_in_month' | 'n_in_year' | 'array']

[ Top ]

prevWeek   [line 344]

mixed prevWeek( [string $format = 'n_in_month'])

Gets the value of the previous week, according to the requested format
  • Access: public

Parameters:

string   $format     ['timestamp' | 'n_in_month' | 'n_in_year' | 'array']

[ Top ]

setTimestamp   [line 176]

void setTimestamp( int|string $ts)

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

Overrides Calendar::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 ]

thisWeek   [line 374]

mixed thisWeek( [string $format = 'n_in_month'])

Gets the value of the current week, according to the requested format
  • Access: public

Parameters:

string   $format     ['timestamp' | 'n_in_month' | 'n_in_year' | 'array']

[ Top ]

thisYear   [line 314]

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

Returns the value for this year

When a on the first/last week of the year, the year of the week is calculated according to ISO-8601

  • Return: e.g. 2003 or timestamp
  • Access: public

Overrides Calendar::thisYear() (Returns the value for this year)

Parameters:

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

[ Top ]


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