function html() { global $wgUser, $wgStylePath, $wgOut; $sk =& $wgUser->getSkin(); // this breaks the "return some html" model, but what can we do? $wgOut->addScript("<link rel=\"stylesheet\" type=\"text/css\"\n\t\t\thref=\"{$wgStylePath}/common/calendar_extension.css\" />\n"); $output = array(); // to be joined into one string in the end. $output[] = '<!-- Upcoming Events -->'; $output[] = '<div class="upcoming_events">'; $output[] = '<h4>Upcoming Events</h4>'; $output[] = $this->elem('ul', 'list'); foreach (ncUpcomingMonths($this->number_of_months) as $date) { $y = $date['Y']; $m = $date['m']; $events = Event::eventsIn($this->calendar_category, true, $y, $m); $output[] = $this->elem('li', 'month_name'); $output[] = self::$month_names[(int) $m]; $output[] = '</li>'; $output[] = $this->elem('ul', 'month_sublist'); if (count($events) == 0) { $output[] = $this->elem('li', 'event') . $this->elem('em', 'no_event_message') . 'No events.</em></li>'; } /*else*/ foreach ($events as $e) { $output[] = $this->elem('li', 'event'); $output[] = $this->elem('strong', 'day') . $e->dateDay() . ': </strong>'; $output[] = $sk->makeKnownLinkObj($e->title(), $e->title()->getText()); $output[] = '</li>'; } $output[] = '</ul>'; } $add_event_title = Title::newFromText('Special:AddEvent'); $query = 'came_from=' . $this->page_title->getPrefixedURL() . '&category=' . $this->calendar_category; $output[] = $this->elem('li', 'add_event'); $output[] = $sk->makeKnownLinkObj($add_event_title, 'Add an Event', $query); $output[] = '</li>'; $output[] = '</ul>'; $output[] = '</div>'; $output[] = '<!-- / Upcoming Events -->'; return join('', $output); }