Location: PHPKode > projects > ConPortal > conportal/inc/shiftgroups/display.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
 */

function printCreateShiftgroupForm ()
{
    $start_month = isset($_POST['start_month']) ? $_POST['start_month'] : date('n');
    $start_day   = isset($_POST['start_day'])   ? $_POST['start_day']   : date('j');
    $start_year  = isset($_POST['start_year'])  ? $_POST['start_year']  : date('Y');
    $end_month = isset($_POST['end_month']) ? $_POST['end_month'] : date('n');
    $end_day   = isset($_POST['end_day'])   ? $_POST['end_day']   : date('j');
    $end_year  = isset($_POST['end_year'])  ? $_POST['end_year']  : date('Y');

	?>
		<form action="#" method="post">
			<table>
				<tr><td>Name:</td>
					<td><input type="text" name="name" size="20" maxlength="30" value="" /></td>
				</tr>
				<tr><td>Start date:</td>
					<td>
						<select name="start_month"><?php print_month_options($start_month) ?></select>
						<select name="start_day">  <?php print_day_options($start_day)   ?></select>
						<select name="start_year"> <?php print_year_options($start_year)  ?></select>
					</td>
				</tr>
				<tr><td>End date:</td>
					<td>
						<select name="end_month"><?php print_month_options($end_month) ?></select>
						<select name="end_day">  <?php print_day_options($end_day)     ?></select>
						<select name="end_year"> <?php print_year_options($end_year)   ?></select>
					</td>
				</tr>
			</table>
			<p><input type="submit" value="Create Shiftgroup" /></p>
		</form>
	<?php
}

function printShiftgroupExtendedInfo()
{
	$info = getShiftgroupExtendedInfo();
	?>
	<table class='shift_history'><tr>
	<th>Shiftgroup</th><th>Start Date</th><th>End Date</th><th>Send Email?</th><th>Hours per week</th><th>Group</th></tr>
	<?
	$row = array();

	foreach($info as $row)
	{
		echo "<tr><td>" . $row['sgname'] . "</td><td>" . $row['sgstart'] . "</td><td>" .
			$row['sgend'] . "</td><td>" . $row['email'] . "</td><td>" . $row['hours'] . 
			"</td><td>" . $row['groupn'] . "</td></tr>";
	}
	?>
	</table>
	<?
}

function printShiftgroupHoursPerWeekForm()
{
// get lists of Shiftgroups and Groups
$shiftgroups = getShiftgroupsPidsAndNames();
$groups = getPrimaryGroups();

?>

<form method='post' action='redirects/shiftgroup_hours_per_week.php' id='shiftgroupHPW'><div>
<table>
	<tr>
		<td>Shift Group:</td>
		<td><select name='shift_group'>
		<?
		foreach ($shiftgroups as $shift)
		{
		echo "<option value='" .$shift['pid']."'>".$shift['name']."</option>\n";
		}
		?>
		</select></td>
	</tr>
	<tr>
		<td>User Group:</td>
		<td><select name='group' id='group'>	
<?
    		foreach ($groups as $g) {
       		$i = getGroupDetails($g);
		echo "\n    <option value='$g'>" . $i['description']."</option>";
   		 }
?>		
		</select></td>
	</tr>
	<tr>
		<td>Hours per week:</td>
		<td><input type='text' name='hours' id='hours' size='4'/>
		</td>
	</tr>
</table>
<input type="submit" value="Set the hours-per-week for the selected group during the selected shiftgroup" />
<?

}

function printShiftgroupSetEmailForm()
{
	$shiftgroups = getShiftgroupsForEmailOrFirstWeekForm();
	$numSG = count($shiftgroups);
	
?>
<form method='post' action='redirects/shiftgroup_email.php' id='shiftgroupemail'><div>
<table>
	<tr><th>Shift Group:</th><th>Send email?</th></tr>
<?php
		for($i=0; $i<$numSG; $i++)
		{
			echo "<tr><td>" . $shiftgroups[$i]['name'] . "</td><td>";
			?>
			<input type="checkbox" name="
			<?php 
				echo $i . "\"";
				if($shiftgroups[$i]['send_email'])
				{
					echo "checked=\"true\"";
				}
				echo ">";
			?> 
		</td>
	</tr>
	<?php 
		}
	?>
</table>
<input type="submit" value="Enable emailing of takes & drops for all checked groups" />
<?
}

//added 1/8/2009, pretty much a mirror of the above
function printShiftgroupSetFirstWeekProtectionForm()
{
	$shiftgroups = getShiftgroupsForEmailOrFirstWeekForm();
	$numSG = count($shiftgroups);
	
?>
<form method='post' action='redirects/shiftgroup_first_week_protection.php' id='shiftgroupfirstweekprotection'><div>
<table>
	<tr><th>Shift Group:</th><th>Enable First Week Protection?</th></tr>
<?php
		for($i=0; $i<$numSG; $i++)
		{
			echo "<tr><td>" . $shiftgroups[$i]['name'] . "</td><td>";
			?>
			<input type="checkbox" name="
			<?php 
				echo $i . "\"";
				if($shiftgroups[$i]['first_week_protection'])
				{
					echo "checked=\"true\"";
				}
				echo ">";
			?> 
		</td>
	</tr>
	<?php 
		}
	?>
</table>
<input type="submit" value="Enable first week protection for all checked groups" />
<?

}

Return current item: ConPortal