Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

BaseCalendar Class Reference
[Object Managers]

Inheritance diagram for BaseCalendar:

MyManager ObjectManager MyModule BaseModule List of all members.

Detailed Description

Manage events with calendar functionality.

A calendar based manager for dealing with events. Has calendar view, day view, upcoming, past, etc. Very handy.

BaseCalendar uses a heavily modified version of the Calendar class from http://www.cascade.org.uk/software/php/calendar/index.php

Definition at line 12 of file base-calendar.inc.php.

Public Member Functions

 __construct ($class= 'Event')
 setup our calendar object
 getPagesXml ()
 add our calendar pages in
 getSearchParamXml ()
 get params for search page
 getSearchSelect ($params)
 special select SQL
 getSearchFrom ($params)
 special from SQL, join on guest table
 getSearchWhere ($params)
 special where SQL: dates, etc.
 getSearchOrder ($params)
 special order SQL
 getSearchGroupBy ($params)
 group by our event id
 search ($params, $limit=null)
 do our search.
 findDate ()
 setup a default month / date thingie based on params
 initMainPage ()
 prep main page, redirect to calendar
 initSearchPage ()
 prep search page
 initCalendarPage ()
 prep our calendar page
 initDatePage ()
 prep our date page
 initUpcomingPage ()
 prep our upcoming page
 initPopularPage ()
 prep our popular page
 initPastPage ()
 prep our past page
 drawDatePage ()
 draw our date page
 drawCalendarPage ()
 draw our calendar page
 drawUpcomingPage ()
 draw our upcoming events page
 drawPopularPage ()
 draw our popular events page
 drawPastPage ()
 draw our past events page
 drawCalendar ($month, $year, $size= 'big')
 draw our calendar table html
 getDayNames ()
 Get the array of strings used to label the days of the week.
 setDayNames ($names)
 Set the array of strings used to label the days of the week.
 getMonthNames ()
 Get the array of strings used to label the months of the year.
 setMonthNames ($names)
 Set the array of strings used to label the months of the year.
 getStartDay ()
 Gets the start day of the week.
 setStartDay ($day)
 Sets the start day of the week.
 getStartMonth ()
 Gets the start month of the year.
 setStartMonth ($month)
 Sets the start month of the year.
 getCalendarLink ($month, $year)
 Return the URL to link to in order to display a calendar for a given month/year.
 getDateLink ($day, $month, $year)
 Return the URL to link to for a given date.
 getDateContent ($day, $month, $year)
 get content to put in the calendar day box for that day.
 getMonthView ($month, $year, $showYear=true)
 Return the calendar HTML for a specified month.
 getMonthHeader ($month, $year, $showYear=true)
 Format the month header row.
 dayHasEvent ($d)
 do we have an event on this day on our calendar?
 getYearView ($year)
 Return the HTML for a specified year.

Public Attributes

 $startDay = 0
 The start day of the week.
 $startMonth = 1
 The start month of the year.
 $dayNames = array("S", "M", "T", "W", "T", "F", "S")
 The labels to display for the days of the week.
 $monthNames
 The labels to display for the months of the year.
 $daysInMonth = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
 The number of days in each month.
 $day = 0
 what day it is
 $dayCount = array()
 this is where we store the day => count of events in that day
 $size
 what size of calendar are we showing? large or small
 $events = null
 our array of BaseEvent objects

Protected Member Functions

 getSortFieldsArray ()
 get fields to sort by
 getMonthEvents ($month, $year)
 get all the events for this month
 setMonthEvents ($month, $year)
 setup our month events and per day counts
 getMonthBody ($month, $year)
 get the html markup for a month
 getDaysInMonth ($month, $year)
 Calculate the number of days in a month, taking into account leap years.
 getYearHTML ($year)
 Generate the HTML for a given year.
 adjustDate ($month, $year)
 Adjust dates to allow months > 12 and < 0.


Member Function Documentation

BaseCalendar::__construct class = 'Event'  ) 
 

setup our calendar object

See also:
ObjectManager::__construct()

Definition at line 72 of file base-calendar.inc.php.

BaseCalendar::adjustDate month,
year
[protected]
 

Adjust dates to allow months > 12 and < 0.

Just adjust the years appropriately. e.g. Month 14 of the year 2001 is actually month 2 of year 2002.

Parameters:
$month the month to adjust
$year the year to adjust
Returns:
an array with index 0 as the proper month, and index 1 as the proper year

Definition at line 901 of file base-calendar.inc.php.

Referenced by getMonthHeader(), and getMonthView().

BaseCalendar::dayHasEvent d  ) 
 

do we have an event on this day on our calendar?

Parameters:
$d the day to check (1-31)
Returns:
boolean result

Definition at line 787 of file base-calendar.inc.php.

Referenced by getDateContent(), and getMonthBody().

BaseCalendar::drawCalendar month,
year,
size = 'big'
 

draw our calendar table html

Parameters:
$month the month to draw (1-12)
$year the year to draw (4 digit year)
$size the size of the calendar. big or small

Definition at line 422 of file base-calendar.inc.php.

References getMonthView(), and setMonthEvents().

Referenced by drawCalendarPage().

BaseCalendar::drawCalendarPage  ) 
 

draw our calendar page

Definition at line 378 of file base-calendar.inc.php.

References $events, drawCalendar(), ObjectManager::drawResults(), ObjectManager::drawSearchForm(), getMonthEvents(), and BaseModule::params().

BaseCalendar::drawDatePage  ) 
 

draw our date page

Definition at line 357 of file base-calendar.inc.php.

References $day, ObjectManager::drawResults(), BaseModule::getLink(), BaseModule::params(), and search().

BaseCalendar::drawPastPage  ) 
 

draw our past events page

Definition at line 410 of file base-calendar.inc.php.

References ObjectManager::drawSearchPage().

BaseCalendar::drawPopularPage  ) 
 

draw our popular events page

Definition at line 402 of file base-calendar.inc.php.

References ObjectManager::drawSearchPage().

BaseCalendar::drawUpcomingPage  ) 
 

draw our upcoming events page

Definition at line 394 of file base-calendar.inc.php.

References ObjectManager::drawSearchPage().

BaseCalendar::findDate  ) 
 

setup a default month / date thingie based on params

Definition at line 256 of file base-calendar.inc.php.

References $day, BaseModule::params(), and BaseModule::setParam().

Referenced by initCalendarPage().

BaseCalendar::getCalendarLink month,
year
 

Return the URL to link to in order to display a calendar for a given month/year.

You must override this method if you want to activate the "forward" and "back" feature of the calendar.

Note: If you return an empty string from this function, no navigation link will be displayed. This is the default behaviour.

If the calendar is being displayed in "year" view, $month will be set to zero.

Parameters:
$month the month to link to
$year the year to link to
the html tag link

Definition at line 586 of file base-calendar.inc.php.

References BaseModule::getUrl().

Referenced by getMonthHeader(), and getYearView().

BaseCalendar::getDateContent day,
month,
year
 

get content to put in the calendar day box for that day.

defaults to the number of events on that day.

Parameters:
$day the day of content
$month the month to check
$year the year to check
Returns:
the content you want to display on that day.

Definition at line 618 of file base-calendar.inc.php.

References $s, dayHasEvent(), and Util::pluralize().

Referenced by getMonthBody().

BaseCalendar::getDateLink day,
month,
year
 

Return the URL to link to for a given date.

You must override this method if you want to activate the date linking feature of the calendar.

Note: If you return an empty string from this function, no navigation link will be displayed. This is the default behaviour.

Parameters:
$day the day to link to
$month the month to link to
$year the year to link to
the html link tag

Definition at line 603 of file base-calendar.inc.php.

References BaseModule::getUrl().

Referenced by getMonthBody().

BaseCalendar::getDayNames  ) 
 

Get the array of strings used to label the days of the week.

This array contains seven elements, one for each day of the week. The first entry in this array represents Sunday.

Returns:
an array of day names

Definition at line 484 of file base-calendar.inc.php.

BaseCalendar::getDaysInMonth month,
year
[protected]
 

Calculate the number of days in a month, taking into account leap years.

Parameters:
$month the month to count
$year the year to count
Returns:
the number of days in a month

Definition at line 848 of file base-calendar.inc.php.

Referenced by getMonthBody().

BaseCalendar::getMonthBody month,
year
[protected]
 

get the html markup for a month

Parameters:
$month the month to get
$year the year to get

Definition at line 715 of file base-calendar.inc.php.

References $daysInMonth, $s, dayHasEvent(), getDateContent(), getDateLink(), and getDaysInMonth().

Referenced by getMonthView().

BaseCalendar::getMonthEvents month,
year
[protected]
 

get all the events for this month

Parameters:
$month the month to look up (1-12)
$year the year to look up (4 digit year)
Returns:
an array of BaseEvent objects

Definition at line 441 of file base-calendar.inc.php.

References search().

Referenced by drawCalendarPage(), and setMonthEvents().

BaseCalendar::getMonthHeader month,
year,
showYear = true
 

Format the month header row.

Parameters:
$month the month to draw
$year the year to draw
$showYear show the year or not
Returns:
an html formatted string.

Definition at line 666 of file base-calendar.inc.php.

References $s, adjustDate(), and getCalendarLink().

Referenced by getMonthView().

BaseCalendar::getMonthNames  ) 
 

Get the array of strings used to label the months of the year.

This array contains twelve elements, one for each month of the year. The first entry in this array represents January.

Returns:
an array of month names

Definition at line 509 of file base-calendar.inc.php.

BaseCalendar::getMonthView month,
year,
showYear = true
 

Return the calendar HTML for a specified month.

Parameters:
$month the month to display
$year the year to display
$showYear do we show the year or not
Returns:
the markup for that calendar month

Definition at line 638 of file base-calendar.inc.php.

References $s, adjustDate(), getMonthBody(), and getMonthHeader().

Referenced by drawCalendar().

BaseCalendar::getPagesXml  ) 
 

add our calendar pages in

upcoming - events in the future past - events in the past popular - popular events calendar - show calendar / month view date - show events on a date

Reimplemented from ObjectManager.

Definition at line 89 of file base-calendar.inc.php.

BaseCalendar::getSearchFrom params  ) 
 

special from SQL, join on guest table

See also:
ObjectManager::getSearchFrom()

Reimplemented from ObjectManager.

Definition at line 144 of file base-calendar.inc.php.

BaseCalendar::getSearchGroupBy params  ) 
 

group by our event id

Reimplemented from ObjectManager.

Definition at line 238 of file base-calendar.inc.php.

BaseCalendar::getSearchOrder params  ) 
 

special order SQL

See also:
ObjectManager::getSearchOrder()

Reimplemented from ObjectManager.

Definition at line 204 of file base-calendar.inc.php.

BaseCalendar::getSearchParamXml  ) 
 

get params for search page

montth, day, year, event start, and stop are all added

Reimplemented from ObjectManager.

Definition at line 112 of file base-calendar.inc.php.

BaseCalendar::getSearchSelect params  ) 
 

special select SQL

See also:
ObjectManager::getSearchSelect()

Reimplemented from ObjectManager.

Definition at line 130 of file base-calendar.inc.php.

BaseCalendar::getSearchWhere params  ) 
 

special where SQL: dates, etc.

See also:
ObjectManager::getSearchWhere()

Reimplemented from ObjectManager.

Definition at line 158 of file base-calendar.inc.php.

References $day.

BaseCalendar::getSortFieldsArray  )  [protected]
 

get fields to sort by

See also:
ObjectManager::getSortFieldsArray()

Reimplemented from ObjectManager.

Definition at line 223 of file base-calendar.inc.php.

BaseCalendar::getStartDay  ) 
 

Gets the start day of the week.

This is the day that appears in the first column of the calendar. Sunday = 0.

Returns:
the start day

Definition at line 532 of file base-calendar.inc.php.

BaseCalendar::getStartMonth  ) 
 

Gets the start month of the year.

This is the month that appears first in the year view. January = 1.

Returns:
the start month

Definition at line 555 of file base-calendar.inc.php.

BaseCalendar::getYearHTML year  )  [protected]
 

Generate the HTML for a given year.

Todo:
remove this or make it work
Parameters:
$year the year to get
Returns:
the html code to display the year

Definition at line 888 of file base-calendar.inc.php.

BaseCalendar::getYearView year  ) 
 

Return the HTML for a specified year.

Parameters:
$year the year to draw
Returns:
html for displaying n entire year of calendar

Definition at line 798 of file base-calendar.inc.php.

References $s, and getCalendarLink().

BaseCalendar::initCalendarPage  ) 
 

prep our calendar page

find date, title, etc.

Definition at line 297 of file base-calendar.inc.php.

References findDate(), and BaseModule::params().

BaseCalendar::initDatePage  ) 
 

prep our date page

Definition at line 309 of file base-calendar.inc.php.

References BaseModule::params().

BaseCalendar::initMainPage  ) 
 

prep main page, redirect to calendar

Reimplemented from ObjectManager.

Definition at line 277 of file base-calendar.inc.php.

References Util::redirect().

BaseCalendar::initPastPage  ) 
 

prep our past page

Definition at line 345 of file base-calendar.inc.php.

References initSearchPage(), and BaseModule::setParam().

BaseCalendar::initPopularPage  ) 
 

prep our popular page

Definition at line 331 of file base-calendar.inc.php.

References initSearchPage(), and BaseModule::setParam().

BaseCalendar::initSearchPage  ) 
 

prep search page

Reimplemented from ObjectManager.

Definition at line 285 of file base-calendar.inc.php.

Referenced by initPastPage(), initPopularPage(), and initUpcomingPage().

BaseCalendar::initUpcomingPage  ) 
 

prep our upcoming page

Definition at line 319 of file base-calendar.inc.php.

References initSearchPage(), and BaseModule::setParam().

BaseCalendar::search params,
limit = null
 

do our search.

See also:
ObjectManager::search()

Reimplemented from ObjectManager.

Definition at line 246 of file base-calendar.inc.php.

Referenced by drawDatePage(), and getMonthEvents().

BaseCalendar::setDayNames names  ) 
 

Set the array of strings used to label the days of the week.

This array must contain seven elements, one for each day of the week. The first entry in this array represents Sunday.

Parameters:
$names an array of day names

Definition at line 497 of file base-calendar.inc.php.

BaseCalendar::setMonthEvents month,
year
[protected]
 

setup our month events and per day counts

Parameters:
$month month of year (1-12)
$year the year to lookup (4 digit number)

Definition at line 461 of file base-calendar.inc.php.

References getMonthEvents().

Referenced by drawCalendar().

BaseCalendar::setMonthNames names  ) 
 

Set the array of strings used to label the months of the year.

This array must contain twelve elements, one for each month of the year. The first entry in this array represents January.

Parameters:
$names an array of month names

Definition at line 521 of file base-calendar.inc.php.

BaseCalendar::setStartDay day  ) 
 

Sets the start day of the week.

This is the day that appears in the first column of the calendar. Sunday = 0.

Parameters:
$day the start day

Definition at line 543 of file base-calendar.inc.php.

BaseCalendar::setStartMonth month  ) 
 

Sets the start month of the year.

This is the month that appears first in the year view. January = 1.

Parameters:
$month the start month

Definition at line 566 of file base-calendar.inc.php.


Member Data Documentation

BaseCalendar::$day = 0
 

what day it is

Todo:
wtf is this for?

Definition at line 50 of file base-calendar.inc.php.

Referenced by drawDatePage(), findDate(), and getSearchWhere().

BaseCalendar::$dayCount = array()
 

this is where we store the day => count of events in that day

Definition at line 55 of file base-calendar.inc.php.

BaseCalendar::$dayNames = array("S", "M", "T", "W", "T", "F", "S")
 

The labels to display for the days of the week.

The first entry in this array represents Sunday.

Definition at line 30 of file base-calendar.inc.php.

BaseCalendar::$daysInMonth = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
 

The number of days in each month.

You're unlikely to want to change this... The first entry in this array represents January.

Definition at line 43 of file base-calendar.inc.php.

Referenced by getMonthBody().

BaseCalendar::$events = null
 

our array of BaseEvent objects

Definition at line 65 of file base-calendar.inc.php.

Referenced by drawCalendarPage().

BaseCalendar::$monthNames
 

Initial value:

 array("January", "February", "March", "April", "May", "June",
                            "July", "August", "September", "October", "November", "December")
The labels to display for the months of the year.

The first entry in this array represents January.

Definition at line 36 of file base-calendar.inc.php.

BaseCalendar::$size
 

what size of calendar are we showing? large or small

Definition at line 60 of file base-calendar.inc.php.

BaseCalendar::$startDay = 0
 

The start day of the week.

This is the day that appears in the first column of the calendar. Sunday = 0.

Definition at line 18 of file base-calendar.inc.php.

BaseCalendar::$startMonth = 1
 

The start month of the year.

This is the month that appears in the first slot of the calendar in the year view. January = 1.

Definition at line 24 of file base-calendar.inc.php.


The documentation for this class was generated from the following file:
Generated on Fri Oct 27 12:26:40 2006 for BaseJumper by doxygen 1.3.9.1