Skip to Content

Upcoming Events

function curl_get_file_contents($URL) { $c = curl_init(); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); curl_setopt($c, CURLOPT_URL, $URL); $contents = curl_exec($c); curl_close($c); if ($contents) return $contents; else return FALSE; } /* draws a calendar */ function draw_calendar($month,$year){ /* draw table */ $calendar = ''; /* table headings */ $headings = array('SUN','MON','TUE','WED','THU','FRI','SAT'); $calendar.= ''; /* days and weeks vars now ... */ $running_day = date('w',mktime(0,0,0,$month,1,$year)); $days_in_month = date('t',mktime(0,0,0,$month,1,$year)); $days_in_this_week = 1; $day_counter = 0; $dates_array = array(); /* row for week one */ $calendar.= ''; /* print "blank" days until the first of the current week */ for($x = 0; $x < $running_day; $x++){ $calendar.= ''; $days_in_this_week++; } /* keep going with days.... */ for($list_day = 1; $list_day <= $days_in_month; $list_day++){ /* add in the day number */ $events = curl_get_file_contents("http://".$_SERVER['HTTP_HOST']."/academics/business-administration/undergraduate-majors/accounting/news--events/upcoming-events/?m=".$month."&y=".$year."&d=".$list_day); if (strlen($events) > 0) { $calendar.= ''; if($running_day == 6){ $calendar.= ''; if(($day_counter+1) != $days_in_month){ $calendar.= ''; } $running_day = -1; $days_in_this_week = 0; } $days_in_this_week++; $running_day++; $day_counter++; } /* finish the rest of the days in the week */ if($days_in_this_week < 8){ for($x = 1; $x <= (8 - $days_in_this_week); $x++){ $calendar.= ''; } } /* final row */ $calendar.= ''; /* end the table */ $calendar.= '
'.implode('',$headings).'
'; $calendar.= '
'.$list_day.'
'; $calendar.= '
'; } else { $calendar.= '
'; $calendar.= '
'.$list_day.'
'; } $calendar.= '
'; /* all done, return result */ return $calendar; } function previousButton($month,$year) { if ($month == 1) { $month = 12; $year = $year - 1; } else { $month = $month - 1; } $output = '   '; return $output; } function nextButton($month,$year) { if ($month == 12) { $month = 1; $year = $year + 1; } else { $month = $month + 1; } $output = '   '; return $output; } function findToday($month,$day,$year) { date_default_timezone_set('American/Chicago'); $testdate = getDate(); if ($testdate['mon'] == $month && $testdate['mday'] == $day && $testdate['year'] == $year) { return TRUE; } return FALSE; } /* sample usages */ echo '
'.$_GET['y'].' ▼
2014
2015
2016
'; echo '
'; echo previousButton($_GET['m'],$_GET['y']); echo ''.date("M", mktime(0, 0, 0, $_GET['m'], 10)).''; echo nextButton($_GET['m'],$_GET['y']); echo '
January
February
March
April
May
June
July
August
September
October
November
December

'; echo draw_calendar($_GET['m'],$_GET['y']);