= 4) { expandItems(); } popUp(500,375); echo "
"; // calendar month selection bar echo "
"; for ($i = "01"; $i <= 12; $i++) { if ($i < 10 AND !ereg("^0",$i)) { $i = "0".$i; } if ($i == $Month) { echo "\n"; } else { echo "\n"; } } // increase the year if we've already passed the selected month if ($Month >= date("m") AND !$Year) { $Year = date("Y"); } elseif (!$Year) { $Year = date("Y") + 1; } // set the view, figure out the number of days in the month and the weekday of the first $showMonth = date("F Y", mktime(0,0,0,$Month,1,$Year)); $numDays = date("t",mktime(0,0,0,$Month,1,$Year)); $startDay = date("w",mktime(0,0,0,$Month,1,$Year)); // set an array with they names of the days of week $days = array( "0" => "Sunday", "1" => "Monday", "2" => "Tuesday", "3" => "Wednesday", "4" => "Thursday", "5" => "Friday", "6" => "Saturday"); // show the month and year $prevMonth = date("m", mktime(0,0,0,($Month - 1), 01, $Year)); $prevYear = date("Y", mktime(0,0,0,($Month - 1), 01, $Year)); $nextMonth = date("m", mktime(0,0,0,($Month + 1), 01, $Year)); $nextYear = date("Y", mktime(0,0,0,($Month + 1), 01, $Year)); echo"
Monthly calendar for
$showMonth

"; if ($glbl_AllowMonth == 1) { echo "
"; } else { echo ""; } if ($glbl_AllowWeek == 1) { echo ""; } else { echo ""; } if ($glbl_AllowDay == 1) { echo ""; } else { echo ""; } echo "
 Month View   Week View   Day View      << Previous Month  Next Month >>
\n\n"; // start the table ?>

0) { echo "\n"; } $j = 1; for ($i = $startDay; $i <= 6; $i++) { $qr = 0; // the day = $i, so set a number & query the DB for this day if ($j < 10 AND !ereg("^0",$j)) { $q = "0".$j; } else { $q = $j; } // this is the query results counter $qr = 0; echo ""; $j++; } echo ""; // the other rows $z = 0; echo ""; for ($i = $j; $i <= $numDays; $i++) { $qr=0; if ($z == 7) { echo ""; $z = 0; } // the day = $i, so set a number & query the DB for this day if ($i < 10 AND !ereg("^0",$i)) { $q = "0".$i; } else { $q = $i; } $queryDate = $Year."-".$Month."-".$q; $todaysDay = date("w", mktime(0,0,0,$Month, $q, $Year)); echo ""; $z++; } // finish last row $colSpan = 7 - $z; if ($colSpan > 0) { echo "\n"; } ?>
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
  $j

"; $queryDate = $Year."-".$Month."-".$q; $todaysDay = date("w", mktime(0,0,0,$Month, $q, $Year)); // how many of today have happened this month? assume at least one $numOfTodays = 1; if ( date("m", mktime(0,0,0,$Month, $q, $Year)) == date("m", mktime(0,0,0,$Month, ($q - 7), $Year)) ) { $numOfTodays = 2; } if ( date("m", mktime(0,0,0,$Month, $q, $Year)) == date("m", mktime(0,0,0,$Month, ($q - 14), $Year)) ) { $numOfTodays = 3; } if ( date("m", mktime(0,0,0,$Month, $q, $Year)) == date("m", mktime(0,0,0,$Month, ($q - 21), $Year)) ) { $numOfTodays = 4; } if ( date("m", mktime(0,0,0,$Month, $q, $Year)) == date("m", mktime(0,0,0,$Month, ($q - 28), $Year)) ) { $numOfTodays = 5; } // we need to pre-query and then sort // query the CalendarDaily table $result = mysql("$DBName","SELECT CalendarDetailsID FROM phpCalendar_Daily WHERE ".$LocQuery." AND Active = '1' AND ( ('$queryDate' = StartDate AND StopDate = '0000-00-00') OR (StopDate != '0000-00-00' AND '$queryDate' BETWEEN StartDate AND StopDate) )") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $gotResults[$qr] = $row[0]; $qr++; } // query the CalendarWeekly table $result = mysql("$DBName","SELECT CalendarDetailsID, DaysOfWeek FROM phpCalendar_Weekly WHERE ".$LocQuery." AND Active = '1' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '0000-00-00') OR (DisplayStop != '0000-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) )") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CalendarDetailsID = $row[0]; $DaysOfWeek = $row[1]; if ($DaysOfWeek == $todaysDay) { $gotResults[$qr] = $CalendarDetailsID; $qr++; } else { $split = explode("|", $DaysOfWeek); for ($x = 0; $split[$x]; $x++) { if ($split[$x] == $todaysDay) { $gotResults[$qr] = $CalendarDetailsID; $qr++; } } while ($split[0]) { array_pop($split); } } } // query the CalendarMonthly table $result = mysql("$DBName","SELECT CalendarDetailsID FROM phpCalendar_Monthly WHERE ".$LocQuery." AND Active = '1' AND DayOfMonth = '$q' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '0000-00-00') OR (DisplayStop != '0000-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) )") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $gotResults[$qr] = $row[0]; $qr++; } // query the CalendarYearly table $result = mysql("$DBName","SELECT CalendarDetailsID FROM phpCalendar_Yearly WHERE ".$LocQuery." AND Active = '1' AND DayOfMonth = '$q' AND Month = '$Month' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '0000-00-00') OR (DisplayStop != '0000-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) )") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $gotResults[$qr] = $row[0]; $qr++; } // query the CalendarPeriodicalMonthly table $result = mysql("$DBName","SELECT CalendarDetailsID, WeekDays FROM phpCalendar_PeriodicalMonthly WHERE ".$LocQuery." AND Active = '1' AND WeekNumber = '$numOfTodays' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '0000-00-00') OR (DisplayStop != '0000-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) )") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CalendarDetailsID = $row[0]; $WeekDays = $row[1]; if ($WeekDays == $todaysDay) { $gotResults[$qr] = $CalendarDetailsID; $qr++; } else { $split = explode("|", $WeekDays); for ($x = 0; $split[$x]; $x++) { if ($split[$x] == $todaysDay) { $gotResults[$qr] = $CalendarDetailsID; $qr++; } } while ($split[0]) { array_pop($split); } } } // query the CalendarPeriodicalYearly table $result = mysql("$DBName","SELECT CalendarDetailsID, WeekDays FROM phpCalendar_PeriodicalYearly WHERE ".$LocQuery." AND Active = '1' AND WeekNumber = '$numOfTodays' AND Month = '$Month' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '0000-00-00') OR (DisplayStop != '0000-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) )") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CalendarDetailsID = $row[0]; $WeekDays = $row[1]; if ($WeekDays == $todaysDay) { $gotResults[$qr] = $CalendarDetailsID; $qr++; } else { $split = explode("|", $WeekDays); for ($x = 0; $split[$x]; $x++) { if ($split[$x] == $todaysDay) { $gotResults[$qr] = $CalendarDetailsID; $qr++; } } while ($split[0]) { array_pop($split); } } } for ($g = 0; $gotResults[$g]; $g++) { $query .= " OR CalendarDetailsID = '$gotResults[$g]'"; } while ($gotResults[0]) { array_pop($gotResults); } if ($query) { $query = "(".ereg_replace("^ OR ","",$query).")"; $result = mysql("$DBName","SELECT Title, CalendarDetailsID FROM phpCalendar_Details WHERE $query ORDER BY StartTime, StopTime") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CDTi = $row[0]; $CDCI = $row[1]; $len = strlen($CDTi); if ($len > ($glbl_TruncateLength + 3)) { $showName = substr($CDTi,0,$glbl_TruncateLength)."..."; } else { $showName = $CDTi; } if ($ver >= 4) { echo "
\n"; getEventIE($CDCI, $CDTi, "$showName", $queryDate); } else { echo "
\n"; getEvent($CDCI, "$showName", $queryDate); } } } $query = ""; echo "
"; echo "

$i

"; // how many of today have happened this month? assume at least one $numOfTodays = 1; if ( date("m", mktime(0,0,0,$Month, $q, $Year)) == date("m", mktime(0,0,0,$Month, ($q - 7), $Year)) ) { $numOfTodays = 2; } if ( date("m", mktime(0,0,0,$Month, $q, $Year)) == date("m", mktime(0,0,0,$Month, ($q - 14), $Year)) ) { $numOfTodays = 3; } if ( date("m", mktime(0,0,0,$Month, $q, $Year)) == date("m", mktime(0,0,0,$Month, ($q - 21), $Year)) ) { $numOfTodays = 4; } if ( date("m", mktime(0,0,0,$Month, $q, $Year)) == date("m", mktime(0,0,0,$Month, ($q - 28), $Year)) ) { $numOfTodays = 5; } // we need to pre-query and then sort // query the CalendarDaily table $result = mysql("$DBName","SELECT CalendarDetailsID FROM phpCalendar_Daily WHERE ".$LocQuery." AND Active = '1' AND ( ('$queryDate' = StartDate AND StopDate = '0000-00-00') OR (StopDate != '0000-00-00' AND '$queryDate' BETWEEN StartDate AND StopDate) )") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $gotResults[$qr] = $row[0]; $qr++; } // query the CalendarWeekly table $result = mysql("$DBName","SELECT CalendarDetailsID, DaysOfWeek FROM phpCalendar_Weekly WHERE ".$LocQuery." AND Active = '1' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '0000-00-00') OR (DisplayStop != '0000-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) )") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CalendarDetailsID = $row[0]; $DaysOfWeek = $row[1]; if ($DaysOfWeek == $todaysDay) { $gotResults[$qr] = $CalendarDetailsID; $qr++; } else { $split = explode("|", $DaysOfWeek); for ($f = 0; $split[$f]; $f++) { if ($split[$f] == $todaysDay) { $gotResults[$qr] = $CalendarDetailsID; $qr++; } } // while ($split[0]) { // array_pop($split); // } } } // query the CalendarMonthly table $result = mysql("$DBName","SELECT CalendarDetailsID FROM phpCalendar_Monthly WHERE ".$LocQuery." AND Active = '1' AND DayOfMonth = '$q' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '0000-00-00') OR (DisplayStop != '0000-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) )") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $gotResults[$qr] = $row[0]; $qr++; } // query the CalendarYearly table $result = mysql("$DBName","SELECT CalendarDetailsID FROM phpCalendar_Yearly WHERE ".$LocQuery." AND Active = '1' AND DayOfMonth = '$q' AND Month = '$Month' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '0000-00-00') OR (DisplayStop != '0000-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) )") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $gotResults[$qr] = $row[0]; $qr++; } // query the CalendarPeriodicalMonthly table $result = mysql("$DBName","SELECT CalendarDetailsID, WeekDays FROM phpCalendar_PeriodicalMonthly WHERE ".$LocQuery." AND Active = '1' AND WeekNumber = '$numOfTodays' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '0000-00-00') OR (DisplayStop != '0000-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) )") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CalendarDetailsID = $row[0]; $WeekDays = $row[1]; if ($WeekDays == $todaysDay) { $gotResults[$qr] = $CalendarDetailsID; $qr++; } else { $split = explode("|", $WeekDays); for ($x = 0; $split[$x]; $x++) { if ($split[$x] == $todaysDay) { $gotResults[$qr] = $CalendarDetailsID; $qr++; } } while ($split[0]) { array_pop($split); } } } // query the CalendarPeriodicalYearly table $result = mysql("$DBName","SELECT CalendarDetailsID, WeekDays FROM phpCalendar_PeriodicalYearly WHERE ".$LocQuery." AND Active = '1' AND WeekNumber = '$numOfTodays' AND Month = '$Month' AND ( ('$queryDate' >= DisplayStart AND DisplayStop = '0000-00-00') OR (DisplayStop != '0000-00-00' AND '$queryDate' BETWEEN DisplayStart AND DisplayStop) )") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CalendarDetailsID = $row[0]; $WeekDays = $row[1]; if ($WeekDays == $todaysDay) { $gotResults[$qr] = $CalendarDetailsID; $qr++; } else { $split = explode("|", $WeekDays); for ($x = 0; $split[$x]; $x++) { if ($split[$x] == $todaysDay) { $gotResults[$qr] = $CalendarDetailsID; $qr++; } } while ($split[0]) { array_pop($split); } } } for ($g = 0; $gotResults[$g]; $g++) { $query .= " OR CalendarDetailsID = '$gotResults[$g]'"; } while ($gotResults[0]) { array_pop($gotResults); } if ($query) { $query = "(".ereg_replace("^ OR ","",$query).")"; $result = mysql("$DBName","SELECT Title, CalendarDetailsID FROM phpCalendar_Details WHERE $query ORDER BY StartTime, StopTime") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $CDTi = $row[0]; $CDCI = $row[1]; $len = strlen($CDTi); if ($len > ($glbl_TruncateLength + 3)) { $showName = substr($CDTi,0,$glbl_TruncateLength)."..."; } else { $showName = $CDTi; } if ($ver >= 4) { echo "
\n"; getEventIE($CDCI, $CDTi, "$showName", $queryDate); } else { echo "
\n"; getEvent($CDCI, "$showName", $queryDate); } } } $query = ""; echo "
"; echo "

 

 
Submit A Calendar Event"; } ?>

0) { $result = mysql("$DBName","SELECT Name FROM phpCalendar_Locations WHERE LocationID = '$LocationID'") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $LoName = $row[0]; } if (!$LoName) { $LoName = "All Events"; } echo "Current $glbl_LocationTitle: $LoName
You may switch to:

All Events
"; $result = mysql("$DBName","SELECT Name, LocationID FROM phpCalendar_Locations WHERE LocationID != '$LocationID' ORDER BY Name") or die(mysql_error()); while ($row = mysql_fetch_row($result)) { $LoName = $row[0]; $LoLocationID = $row[1]; echo "$LoName
\n"; } echo "

"; } if ($glbl_AllowPublicSubmission == 1) { echo "

Submit An Event

"; } commonFooter(); ?>