Location: PHPKode > projects > ConPortal > conportal/meetings.php
<?php
/*
 *  ConPortal - Pomona College ITS scheduling appplication
 *  Copyright (C) 2005-2006  Pomona College
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of version 2 of the GNU General Public License
 *  as published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

require_once('standard.php');
if (isset($_POST['type']) and isset($_POST['month']) and isset($_POST['day']) and
    isset($_POST['location']) and isset($_POST['status']) and isset($_POST['notes']))
{
    assertPrivilege("manage_meetings");
    $date = mktime(0, 0, 0, $_POST['month'], $_POST['day'], $_POST['year']);
    $pid = isset($_POST['pid']) ? $_POST['pid'] : NULL;
    if ($pid = createUpdateMeeting($pid, $_POST['type'], $date, $_POST['location'],
        $_POST['status'], $_POST['notes']))
    {
        // Successful update: return to details page for the new/updated meeting
        header("Location: " . BASE_URL . "meetings.php?notes=$pid");
        die;
    }
    // Otherwise, an error occurred and the error variables have been set;
    // fall through and the form will be re-displayed
}
elseif (isset($_POST['attendance_pid']))
{
	assertPrivilege("manage_meetings");
	$attendance = array();
	foreach($_POST as $key => $value)
	{
		if (substr($key, 0, 4) == "user")
			$attendance[substr($key, 4)] = $value;
	}
	if (updateMeetingAttendance($_POST['attendance_pid'], $attendance))
	{
		// Successful update: return to details page
		header("Location: " . BASE_URL .
			"meetings.php?notes={$_POST['attendance_pid']}");
		die;
	}
	// Unsuccessful update; fall through and display errors
}

xhtml_header("Meetings");

if (isset($_GET['create']))
{
	assertPrivilege("manage_meetings");
	printMeetingCreateEditForm(NULL);
}
elseif (isset($_GET['edit']))
{
	assertPrivilege("manage_meetings");
	printMeetingCreateEditForm($_GET['edit']);
}
elseif (isset($_GET['attendance']))
{
	assertPrivilege("manage_meetings");
	printMeetingAttendanceForm($_GET['attendance']);
}
elseif (isset($_GET['notes']))
	printMeetingDetails($_GET['notes']);
else
	printMeetingsTable();

xhtml_footer();
?>
Return current item: ConPortal