Page 1 of 1

Please add birthdays option to the Calendar module

Posted: Thu Dec 22, 2005 1:34 pm
by katon
I have been using the calendar module in our corporate web site to display the list of birthdays in the current month.  However, to achieve the necessary format, I had to add the following section.  Please consider adding something like this in the module.  You will need to make minor adjustments in other parts of the module code, too.

Code: Select all

               elseif($display == 'birthdays')
                {
                        if($rs->RowCount() > 0)
                        {
                                if($day == -1)
                                        $title_string = strftime($list_title_format, strtotime($start));
                                else
                                        $title_string = strftime($date_format, strtotime($start));
                                echo "<div id='$table_id'><h1>$title_string</h1>\n";
                                while($event = $rs->FetchRow())
                                {
                                        unset($event_date_end);
                                        extract($event);

                                        $event_date_start_time = strtotime($event_date_start);
                                        $event_date_start_string = strftime('%d %B', $event_date_start_time);

                                        echo <<<EOT
                                        <div class='calendar-event' id='$table_id'>
                                        $event_date_start_string: $event_title
                                        <p class='calendar-details'>$event_details</p>
                                        </div>\n
EOT;
                                }

                                echo '</div>';
                        }

                        $prevyear = $year;
                        $prevmonth = $month - 1;
                        if($prevmonth < 1)
                        {
                                $prevmonth = 12;
                                $prevyear --;
                        }

                        $next = $this->CreateReturnLink($id, $returnid, '', array('year'=>$nextyear, 'month'=>$nextmonth), true);
                        $next = str_replace('&', '&', $next);
                        $prev = $this->CreateReturnLink($id, $returnid, '', array('year'=>$prevyear, 'month'=>$prevmonth), true);
                        $prev = str_replace('&', '&', $prev);
                        $pn = array('« Prev'=>$prev, 'Next »'=>$next);

                        @list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable
                        if($p) $p = '<span class="calendar-prev">'.($pl ? '<a href="'.htmlspecialchars($pl).'">'.$p.'</a>' : $p).'</span>&
nbsp;';
                        if($n) $n = ' <span class="calendar-next">'.($nl ? '<a href="'.htmlspecialchars($nl).'">'.$n.'</a>' : $n).'</
span>';
                        echo "\n\n<!--Start navigation-->\n\n";
                        echo '<br>' . $p.($month_href ? '<a href="'.htmlspecialchars($month_href).'">'.$title.'</a>' : $title).$n."\n";

                }