# This is the seminar page for the seminers website.
# It uses helper.php (variables) to define the configuration options
# Make sure that it is included with every page.
include("helper.php");
# Header
######################################################################
include("templates/header.php");
if ( isset($_POST['action']))
{ $action = $_POST['action']; }
if ( isset($_GET['action']))
{ $action = $_GET['action']; }
if ( isset($_POST['semester']))
{ $semester = $_POST['semester']; }
if ( isset($_GET['semester']))
{ $semester = $_GET['semester']; }
# Page Content
######################################################################
?>
List of Seminars
Subscribe
$current_year = date('Y');
$next_year = date('Y') + 1 ;
echo ' ';
?>
switch ($action) {
case "list" : seminar_list("$semester");
break;
case "find" : seminar_search("$id");
break;
default : seminar_list("$semester");
}
?>
|
|
# Footer
######################################################################
include("templates/footer.php");
##########################################################################
# Functions
##########################################################################
# Print 'Seminar List'.
function seminar_list($semester) {
if (!$semester) {
$current_year = date('Y');
$month = date('m');
if ( $month > 2 and $month < 6 )
{ #spring
$semester = 'Spring ' . $year ;
}
elseif ( $month > 5 and $month < 9 )
{ #Summer
$semester = 'Summer ' . $year ;
}
elseif ( $month > 8 and $month < 12 )
{ #Fall
$semester = 'Fall ' . $year ;
}
elseif ( $month > 11 or $month < 3 )
{ # Winter
$semester = 'Winter '. $year ;
}
# $semester = "Fall ".$current_year;
$query = db_query("SELECT *
FROM seminars
WHERE semester = '$semester' order by Startdate");
}
elseif ($semester == "all") {
$query = db_query("SELECT *
FROM seminars where Enddate > DATE_SUB(CURDATE(),INTERVAL 5 DAY) order by Startdate") ;
}
else {
$query = db_query("SELECT *
FROM seminars
WHERE semester = '$semester' order by startdate ");
}
echo "Seminars for ".$semester." season.";
$count = 0;
while ($seminar = db_fetch_object($query)) {
include("templates/seminar_list.php");
$count++;
}
if ($count == 0) {
echo "No seminars were found for $semester semester(s).
";
}
}
function seminar_search($id) {
$query = db_query("SELECT *
FROM seminars
WHERE ID = '$id' LIMIT 1");
echo "Seminars for ".$title.".";
$count = 0;
while ($seminar = db_fetch_object($query)) {
include("templates/seminar_info.php");
$count++;
}
if ($count == 0) {
echo "No seminars were found for $title.
";
}
}
?>