com.lokorin.lokorin.lib
[ class tree: com.lokorin.lokorin.lib ] [ index: com.lokorin.lokorin.lib ] [ all elements ]

Class: Calendar

Source Location: /_includes/lib_calendar.php

Class Overview


Describes a calendar that displays a database table as a calendar with


Author(s):

  • Andreas Launila

Variables

Methods


Child classes:

AliasCalendar
Describes a calendar that link to aliases in a ./year/month/day format.

Class Details

[line 111]
Describes a calendar that displays a database table as a calendar with

entries. Users can select specific days from the calendar and view the connected table rows. The calendar gives the user drop downs to select year and month, the days are represented in a grid. Additional filters can also be placed on the calendar.




Tags:

author:  Andreas Launila


[ Top ]


Class Variables

$day =

[line 133]

The currently selected unix timestamp as days. I.e. this is not day of the week, this is timestamp/(3600*24).



Tags:

access:  private

Type:   integer


[ Top ]

$dayMax =

[line 149]

The last day, as an unix timestamp converted into days, that the calendar should display.



Tags:

access:  private

Type:   integer


[ Top ]

$dayMin =

[line 155]

The first day, as an unix timestamp converted into days, that the calendar should display.



Tags:

access:  private

Type:   integer


[ Top ]

$form =

[line 127]

The form that should be displayed to the user along with the calendar grid.



Tags:

access:  private

Type:   Form


[ Top ]

$searcher =

[line 121]

The table searcher that should be used by the calendar.



Tags:

access:  private

Type:   TableSearcher


[ Top ]

$style =

[line 138]

The text that should be included in the calendar's style attribute.



Tags:

access:  private

Type:   string


[ Top ]

$table =

[line 116]

The name of the table that the calendar should display.



Tags:

access:  private

Type:   string


[ Top ]

$timestampField =

[line 143]

The name of the table field that contains the unix timestamp values.



Tags:

access:  private

Type:   string


[ Top ]

$urlRoot =

[line 160]

The root that should be used for all link urls.



Tags:

access:  protected

Type:   string


[ Top ]



Class Methods


constructor __construct [line 173]

Calendar __construct( string $tableToDisplay, string $timestampField, [string $urlRoot = SELF], [string $style = ''])

Constructor for Calendar.



Tags:

access:  public


Overridden in child classes as:

AliasCalendar::__construct()
Constructor for AliasCalendar.

Parameters:

string   $tableToDisplay   The name of the table that the calendar should display.
string   $style   An optional parameter to specify custom style code to use for the calendars "style" attribute.
string   $urlRoot   The root that should be used for all urls presented by the calendar.
string   $timestampField   The name of the field in the specified table that contains the unix timestamps.

[ Top ]

method addFieldPair [line 297]

void addFieldPair( SearchField $searchField, [FormField $formField = null], [string $displayName = ''])

Adds a pair of fields to the calendar. If both fields are spceified then they should be connected, i.e. their request names should be identical.

This can be used to further filter the results shown.




Tags:

access:  public


Parameters:

SearchField   $searchField   The search field that should be added, the search field places restrictions on what will be displayed in the calendar. I.e. only rows that satisfy the search fields are shown.
FormField   $formField   An optional form field that should be associated with $searchField. The form field is shown with the calendar.
string   $displayName   An optional display name for the specified form field.

[ Top ]

method addMonthSelection [line 243]

void addMonthSelection( )

Adds a form selection field to the form. The selection field only contains months that include at least one day in the calendar's range.



Tags:

access:  private


[ Top ]

method addYearSelection [line 218]

void addYearSelection( )

Adds a form selection field to the form. The selection field only contains years that include at least one day in the calendar's range.



Tags:

access:  private


[ Top ]

method doDaysHaveRows [line 509]

array doDaysHaveRows( integer $dayMin, integer $dayMax)

Check if an specified interval of days have updates. Optionally constraints can be placed on the public function so that it only checks for updates of a specific type. This public function should be concidered private.



Tags:

return:  An array with the day index as key and a boolean value as value. The boolean value is true if the corresponding day has rows, false otherwise.
access:  private


Parameters:

integer   $dayMin   The day, as an unix timestamp converted into public function should look at.
integer   $dayMax   The day, as an unix timestamp converted into days, which represents the last day in the interval that the public function should look at.

[ Top ]

method getCalendar [line 330]

string getCalendar( )

Gets the XHTML code that represent the calendar.



Tags:

return:  XHTML compliant code.
access:  public


[ Top ]

method getDayUrl [line 546]

string getDayUrl( integer $day)

Gets the url to a specified day in the calendar.



Tags:

return:  An encoded URL, may be relative to the current page.
access:  protected


Overridden in child classes as:

AliasCalendar::getDayUrl()

Parameters:

integer   $day   The unix timestamp in days for the day that the url should represent.

[ Top ]

method getMonthNavigation [line 402]

string getMonthNavigation( )

Gets an XHTML compliant month navigation. The navigation allows users the move one month forward or backwards or to move to the first or last month.



Tags:

return:  XHTML compliant code describing navigation elements.
access:  private


[ Top ]

method getMonthUrl [line 557]

string getMonthUrl( integer $month, integer $year)

Gets the url to a specified month in the calendar.



Tags:

return:  An encoded URL, may b relative to the current page.
access:  protected


Overridden in child classes as:

AliasCalendar::getMonthUrl()

Parameters:

integer   $month   The month in the year (1-12) that the url should lead to.
integer   $year   the year (four digits) that the url should lead to.

[ Top ]

method getSelectedTimestamp [line 481]

integer getSelectedTimestamp( )

Gets the calendar's selected timestamp. The timestamp has a resolution of 3600*24 seconds, i.e. days.



Tags:

return:  A unix timestamp.
access:  public


[ Top ]

method getSqlSelector [line 317]

string getSqlSelector( )

Gets the sql selector that represents the current configuration of the calendar. The selector describes what rows match the calendar selections.



Tags:

return:  A sql statement describing matching rows.
access:  public


[ Top ]

method hasUserValue [line 491]

boolean hasUserValue( )

Checks if the user has selected a day or not in the calendar. If the user has not then getting results from the calendar should not be attempted.



Tags:

return:  True if the user has selected a day, false otherwise.
access:  public


[ Top ]


Documentation generated on Sun, 16 Apr 2006 21:03:12 +0200 by phpDocumentor 1.3.0RC4