Calendar multiple payload during hour.

From: Date: Thu, 03 Nov 2005 20:11:17 +0000
Subject: Calendar multiple payload during hour.
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21759@lists.php.net to get a copy of this message
I cant seem to get build to give me multiple payloads for an hour. I created a decorator to add multiple entries (like the bugs database says) but i still only get 1 event per hour. <?php class Daily_Dec extends Calendar_Decorator { var $entries = array(); function Daily_Dec($calendar) { Calendar_Decorator::Calendar_Decorator($calendar); } function addEntry($entry) { $this->entries[] = $entry; return count($this->entries); } function getEntry() { $entry = each($this->entries); if ($entry) { return $entry['value']; } else { reset($this->entries); return false; } } } $events = array(); while($ob = mysql_fetch_object($result)) { $events[] = array( 'start' => mktime(date('g',$ob->dateToComp),0,0, date('m', $ob->dateToComp), date('d', $ob->dateToComp), date('Y', $ob->dateToComp)), 'end' => strtotime('+2 hours', $ob->dateToComp), 'desc' => $ob->regarding, 'id' => $ob->pendingId ); } $Daily = & new Calendar_Day(date('Y', $timestamp), date('n', $timestamp), date('d', $timestamp)); $selection = array(); foreach ($events as $row) { $Hour = & new Calendar_Hour(2000,1,1,1); $Hour->setTimeStamp($row['start']); $DiaryEvent = new Daily_Dec($Hour); $DiaryEvent->addEntry($row['desc']);//I want to pass the whole $row array and do $selection[] = $DiaryEvent; // while($e = $Hour->getEntry()){ print $e['desc']; } } // to give myself flexability (is this a problem?) $Daily->build($selection); //Begin HTML--- print '<h4>'.date('l, M jS', $timestamp).'</h4>'; print '<table class="dialyTable">'; while ( $Hour = & $Daily->fetch() ) { $hour = $Hour->thisHour(); $minute = $Hour->thisMinute(); if ( $hour >= 7 && $hour <= 18 ) { echo ( "<tr>\n" ); echo ( "<td class='hour'>".date('g A',$Hour->getTimeStamp())."</td>\n" ); if ( $Hour->isSelected() ) { print "<td class='hourActivitySel'>"; print "<ul class='activities'>"; while ($entry = $Hour->getEntry()) { print "<li>".$entry.'</li>'; } print "</ul>"; print "</td>"; } else { echo ( "<td class='hourActivity'>&nbsp;</td>\n" ); } echo ( "</tr>\n" ); } } print "</table>"; ?>

« previous php.pear.general (#21759) next »