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.

152<br />

CHAPTER 4 ■ BUILD AN EVENTS CALENDAR<br />

*/<br />

$html = "\n\t$cal_month";<br />

for ( $d=0, $labels=NULL; $d_createEventObj();<br />

/*<br />

* Create the calendar markup<br />

*/<br />

$html .= "\n\t"; // Start a new unordered list<br />

for ( $i=1, $c=1, $t=date('j'), $m=date('m'), $y=date('Y');<br />

$c_daysInMonth; ++$i )<br />

{<br />

/*<br />

* Apply a "fill" class to the boxes occurring before<br />

* the first of the month<br />

*/<br />

$class = $i_startDay ? "fill" : NULL;<br />

/*<br />

* Add a "today" class if the current date matches<br />

* the current date<br />

*/<br />

if ( $c+1==$t && $m==$this->_m && $y==$this->_y )<br />

{<br />

$class = "today";<br />

}<br />

/*<br />

* Build the opening <strong>and</strong> closing list item tags<br />

*/<br />

$ls = sprintf("\n\t\t", $class);<br />

$le = "\n\t\t";<br />

/*<br />

* Add the day of the month to identify the calendar box<br />

*/<br />

if ( $this->_startDay_daysInMonth>=$c)<br />

{<br />

/*<br />

* Format events data<br />

*/<br />

$event_info = NULL; // clear the variable

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

Saved successfully!

Ooh no, something went wrong!