for building a calendar with optional events. It creates an internal array of items to be used by the view layer rather than trying to create HTML.

This is based on work by David Walsh:

The calendar data is stored in systemDateCalendar::$_CalendarData and once built forms a 42 element array (a 7x6 grid), formatted for the week starting on Sunday (PHPs date function numbers the days of the week starting at 0 for Sunday).

Events can be added to a date in the calendar period. Events are stored as systemDateEvent objects.

The calendar can be iterated in the view layer to build a calendar. Empty array data marks an empty day. The day data is an associative array containing: number, day and events where number is the day number, day the long format day name and events an array of events on that day.


public __construct([$inYear = null], [$inMonth = null])

Creates a new calendar instance

public reset()

Resets the object

public isModified()

Returns true if object modified

public setModified([$inStatus = true])

Sets $_Modified to $inStatus

public getYear()

Returns the value of $_Year

public setYear($inYear)

Set value of $_Year

public getMonth()

Returns the value of $_Month

public getLongMonth()

Returns the month name in long format

public setMonth($inMonth)

Set value of $_Month

public getPreviousMonth()

Returns an array containing the year and month of the previous month

public getNextMonth()

Returns an array containing the year and month number of the next month

public getCalendar()

Returns the calendar data, building it if not yet

public buildCalendar()

Builds the calendar data

public addEvent($inDay, $inEvent)

Adds an event to the specified day to be used within this calendar

public removeEvent($inDay, $inEvent)

Remove event from calendar

public getEvents([$inDay = null])

Returns events for the specified day, or all events

public getEventCount()

Returns the total number of events in the calendar

public doesCalendarHaveEvents()

Returns true if there are any events in the calendar

public doesDayHaveEvents($inDay)

Returns true if there are events set of the specified day

<  1  >