public static function calendar_view($day = null, $month = null, $year = null, $calendar_type = null) { global $uid; if (!is_null($calendar_type) && ($calendar_type == 'day' || $calendar_type == 'week' || $calendar_type == 'month')) { Calendar_Events::set_calendar_view_preference($calendar_type); $view_func = $calendar_type . "_calendar"; } else { $view_func = Calendar_Events::$calsettings->view_type . "_calendar"; } if (is_null($month) || is_null($year) || $month < 0 || $month > 12 || $year < 1990 || $year > 2099) { $today = getdate(); $day = $today['mday']; $month = $today['mon']; $year = $today['year']; } if ($calendar_type == 'small') { return Calendar_Events::small_month_calendar($day, $month, $year); } else { return Calendar_Events::$view_func($day, $month, $year); } }