Oops!"; echo "

The date you selected is not valid. We can display only current and future months.

"; echo "

The current calendar is $currentMonthName $currentYear."; include("error_footer.inc"); return false; } } //If the month is set, but the year is not set - this alerts the user elseif (isset ($_GET['month']) && !isset ($_GET['year'])) { include("error_header.inc"); echo "

The date you selected is not valid. Please make sure you include a year for the month you entered.

"; echo "

The current calendar is $currentMonthName $currentYear."; include("error_footer.inc"); return false; } //If the year is set, but the month is not set - this alerts the user elseif (!isset ($_GET['month']) && isset ($_GET['year'])) { include("error_header.inc"); echo "

The date you selected is not valid. Please make sure you include a month for the year you entered.

"; echo "

The current calendar is $currentMonthName $currentYear."; include("error_footer.inc"); return false; } //If the date is passed, we explode the string and assign its component parts to //$day, $month, $year. The last part is used to get the month name. It creates a //unix timestamp and then breaks that timestamp into an array. elseif (isset ($_GET['date'])) { $date = $_GET['date']; $date = str_replace("/","-",$date); $datecomponents = explode("-",$date); $month = $datecomponents[1]; $year = $datecomponents[0]; $day = $datecomponents[2]; $dateTimestamp = mktime("0","0","0",$month, $day, $year); $dateParts = getdate($dateTimestamp); $monthName = $dateParts['month']; //Here we are validating the date passed within the URL. Using the checkdate() function //we can tell whether or not the date is a valid date, and the last conditional //checks to make sure that the date is not older than the current month. if ((!checkdate($month,$day,$year)) || ($month<$currentMonth && $year==$currentYear) || ($year<$currentYear)) { include("error_header.inc"); echo "

The date you selected is not valid. We can display only current and future months.

"; echo "

The current calendar is $currentMonthName $currentYear."; include("error_footer.inc"); return false; } } //If none of the variables are passed in the URL, then we use the current date to bring //up the current calendar. elseif ((!isset ($_GET['month']) && !isset ($_GET['year'])) || (!isset ($_GET['date']))) { $fullDate = getdate(); $month = $fullDate['mon']; $year = $fullDate['year']; $monthName = $fullDate['month']; } //This section will print the events found 1) on a single day where there is more than //one event or 2) in a single month. ?>

=CURDATE() will weed //them out. Only those events that are either today or in the future //will be displayed. $query = "SELECT dayofmonth(eventDate) as eventDate FROM events where month(eventDate)=$month and year(eventDate)=$year and eventDate>=CURDATE()"; $result = mysql_query($query); $num_events = mysql_num_rows($result); //This if else statement takes care of the case when there are no events //for a certain month. If there are results from the query, then the //build_calendar_fns function is called. If there are no results from the //query, the build_calendar_no_dates function is called. if ($num_events == 0) { echo build_calendar_no_dates($month,$year); //This if else statement finds out whether or not the month calendar is the current //month. If it is, then only the "list all events" link is printed. Otherwise //a link that will return you to the "home" month is included. if ($month==$currentMonth && $year==$currentYear) { echo "

List all events for the semester

"; } else { echo "

Display current month

"; echo "

List all events for the semester

"; } } else { //If there are results, this part will loop through the results and //create the dataArray. This basically has a list of all the days of the //month that have events in the db. The dataArray is used by the //build_calendar function to determine which dates to make hotlinks. for ($i=0; $i<$num_events; $i++) { $row = mysql_fetch_array($result); $dateArray[] = $row['eventDate']; } echo build_calendar($month,$year,$dateArray); //This if else statement finds out whether or not the month calendar is the current //month. If it is, then only the "list all events" link is printed. Otherwise //a link that will return you to the "home" month is included. if ($month==$currentMonth && $year==$currentYear) { echo "

List all events for the semester

"; } else { echo "

Display current month

"; echo "

List all events for the semester

"; } } ?>
Main Image dino

EVENTS CALENDAR

0) { echo "

Events for ".(stripslashes($monthName))." ".(stripslashes($day)).", ".(stripslashes($year))."

"; echo "

There is more than one event for the date you selected. Click on an event title for more detailed information!

"; echo "
    "; while (list($eventID,$eventDay,$eventDate,$eventTime,$title) = mysql_fetch_row($eventResult)) { echo "
  • ".(stripslashes($monthName))." ".(stripslashes($eventDay)).", ".(stripslashes($eventTime))." ".(stripslashes($title))."
     
  • "; } echo "
"; } //if there are no events for a particular day, then we print out the following. else { echo "

There are no events scheduled for the date you provided.

"; echo "

The current calendar is $currentMonthName $currentYear."; include("error_footer.inc"); return false; } } //If either the first or the last elseif statement is true and a month/year combo or nothing //was passed in the URL then the following is executed. This will print out all the //events for a particular month. Each of the titles will be hotlinks to the eventsdetail.php //script. If nothing was passed in the URL then the current month calendar will be used. else { echo "

Check out what's going on at the University of Colorado Museum of Natural History!

"; echo "

All events are free and open to the public unless otherwise noted. If you would like to receive monthly updates about events at the Museum, please subscribe to the CU Museum Update.

"; echo "

Indian Peaks Chapter of the Colorado Archaeology Society (IPCAS) meets at 7:00 p.m. in the Paleontology Hall on the second Thursday of every month. Its meetings and membership are open to the public.

"; echo "

Events for $monthName $year

"; //Querying the DB for all the events that occur in the particular month. They must //also occur on or after the current date $eventQuery = "SELECT eventID, dayofmonth(eventDate) as eventDay, eventDate, eventTime, title FROM events WHERE month(eventDate) = '$month' and year(eventDate) = '$year' and eventDate>=CURDATE() order by eventDate, eventID asc"; $eventResult = mysql_query($eventQuery); //If there are events for a particular month, then we print out the titles. if (mysql_num_rows($eventResult) > 0) { echo "
    "; while (list($eventID,$eventDay,$eventDate,$eventTime,$title) = mysql_fetch_row($eventResult)) { echo "
  • ".(stripslashes($monthName))." ".(stripslashes($eventDay)).", ".(stripslashes($eventTime))." ".(stripslashes($title))."
     
  • "; } echo "
"; } //if there are no events for a particular month, then we print out the following. else { echo "

There are no events scheduled for this month.

"; } } ?>