02.06.2013 Views

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Figure 4-5. The markup as generated <strong>by</strong> buildCalendar()<br />

Displaying Events in the Calendar<br />

CHAPTER 4 ■ BUILD AN EVENTS CALENDAR<br />

Adding the events to the calendar display is as easy as loading the events array from _createEventObj()<br />

<strong>and</strong> looping through the events stored in the index that matches the current day if any exist. Add event<br />

data to the calendar markup using the following bold code:<br />

public function buildCalendar()<br />

{<br />

/*<br />

* Determine the calendar month <strong>and</strong> create an array of<br />

* weekday abbreviations to label the calendar columns<br />

*/<br />

$cal_month = date('F Y', strtotime($this->_useDate));<br />

$weekdays = array('Sun', 'Mon', 'Tue',<br />

'Wed', 'Thu', 'Fri', 'Sat');<br />

/*<br />

* Add a header to the calendar markup<br />

151

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!