Location: PHPKode > projects > ConPortal > conportal/create_shiftgroup.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');
assertPrivilege('manage_shifts');

if (isset($_POST['name']) and isset($_POST['start_month']) and isset($_POST['start_day']) and isset($_POST['start_year']) and
	isset($_POST['end_month']) and isset($_POST['end_day']) and isset($_POST['end_year']))
{
	if (strlen(trim($_POST['name'])) == 0)
	{
		error("You did not enter a name.");
	}
	else
	{
		$startDate = mktime(0, 0, 0, $_POST['start_month'], $_POST['start_day'], $_POST['start_year']);
		$endDate   = mktime(0, 0, 0, $_POST['end_month'],   $_POST['end_day'],   $_POST['end_year']);
		if ($endDate < $startDate)
		{
			error("End date cannot be before the start date.");
		}
		else
			createShiftgroup($_POST['name'], $startDate, $endDate);
	}
}

xhtml_header("Create Shiftgroup");
printCreateShiftgroupForm();
xhtml_footer();

?>
Return current item: ConPortal