Location: PHPKode > projects > ConPortal > conportal/redirects/meeting_punch.php
<?php
/*
 *  ConPortal - Pomona College ITS & Bucknell University ISR scheduling appplication
 *  Copyright (C) 2005-2007  Pomona College, Bucknell University
 *
 *  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');

xhtml_header('Processing Meeting Punches'); 

$super_name = getNameForUser($_SESSION['pid']);

//build timestamps

$timeIn = return_ymd_timestamp_string($_POST['year_in'], $_POST['month_in'], $_POST['day_in']) . " " . 
		return_hm_timestamp_string($_POST['hour_in'], $_POST['min_in'], $_POST['AMPM_in']);

$timeOut = return_ymd_timestamp_string($_POST['year_out'], $_POST['month_out'], $_POST['day_out']) . " " . 
		return_hm_timestamp_string($_POST['hour_out'], $_POST['min_out'], $_POST['AMPM_out']);

//check if strings are sane
if( is_valid_timestamp_string($timeIn) && is_valid_timestamp_string($timeOut) )
{
	//at least one user selected?  if so, loop through them, adding punches.  
	//Assumption: the person entering this doesn't want the users to be left logged in!
	if (isset($_POST['selusers'])) 
	{
		echo "<center><h2>Punches created by mass punch functionality</h2><table class='shift_history'><tr><th>User</th><th>UserID</th><th>Time In</th><th>Time Out</th></tr>";

		foreach($_POST['selusers'] as $a_user)
		{
			$result = addPunchForUser($a_user, $timeIn, $timeOut, $super_name);
			//if add worked
			if($result)
			{
				echo "<tr><td>" . getNameForUser($a_user) . "</td><td>" . $a_user . "</td><td>" . $timeIn . "</td><td>" . $timeOut . "</td></tr>";
			}
			else
			{
				echo "<tr><td>ERROR ADDING USER</td><td>" . $a_user . "</td><td>" . $timeIn . "</td><td>" . $timeOut . "</td></tr>";
			}
			
		}
		
		echo "</table><br /><br /><a href=\"" . BASE_URL . "\">Click here to go to the landing page.</a>";
		echo "<br /><br /><a href=\"" . BASE_URL . "punch_tracking.php\">Click here to go to the punch tracking page.</a></center>";
    	        //header("Location: " . BASE_URL . "punch_tracking.php");	
	}	
	else
	{
 	  error("No users selected!");
  	 display_errors();
	}
}
else
{
	$errStr = "timeIn and/or timeOut did not have sensible values - " . $timeIn . " and " . $timeOut;
 	error($errStr);
  	display_errors();
}

xhtml_footer();
?>
Return current item: ConPortal