home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / dotproject / modules / calendar / links_events.php < prev    next >
Encoding:
PHP Script  |  2003-07-30  |  1.4 KB  |  35 lines

  1. <?php /* CALENDAR $Id: links_events.php,v 1.6 2003/07/30 15:45:54 revelation7 Exp $ */
  2.  
  3. /**
  4. * Sub-function to collect events within a period
  5. * @param Date the starting date of the period
  6. * @param Date the ending date of the period
  7. * @param array by-ref an array of links to append new items to
  8. * @param int the length to truncate entries by
  9. * @author Andrew Eddie <eddieajau@users.sourceforge.net>
  10. */
  11. function getEventLinks( $startPeriod, $endPeriod, &$links, $strMaxLen ) {
  12.     $events = CEvent::getEventsForPeriod( $startPeriod, $endPeriod );
  13.  
  14.     // assemble the links for the events
  15.     foreach ($events as $row) {
  16.         $start = new CDate( $row['event_start_date'] );
  17.         $end = new CDate( $row['event_end_date'] );
  18.         $date = $start;
  19.  
  20.         for($i=0; $i <= $start->dateDiff($end); $i++) {
  21.         // the link
  22.             $url = '?m=calendar&a=view&event_id=' . $row['event_id'];
  23.             $link['href'] = '';
  24.             $link['alt'] = $row['event_description'];
  25.             $link['text'] = '<table cellspacing="0" cellpadding="0" border="0"><tr>'
  26.                 . '<td><a href=' . $url . '>' . dPshowImage( dPfindImage( 'event'.$row['event_type'].'.png', 'calendar' ), 16, 16, '' )
  27.                 . '</a></td>'
  28.                 . '<td><a href="' . $url . '" title="'.$row['event_description'].'"><span class="event">'.$row['event_title'].'</span></a>'
  29.                 . '</td></tr></table>';
  30.             $links[$date->format( FMT_TIMESTAMP_DATE )][] = $link;
  31.             $date = $date->getNextDay();
  32.         }
  33.     }
  34. }
  35. ?>