Location: PHPKode > projects > ConPortal > conportal/edit_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_privileged('Edit an existing punch', 'punch_tracking');

echo "<h1 class='center'>Editing a Punch</h1>\n";

echo "<br><br>The way this works is to specify a user and a time range; you'll then be taken to a form which lists punches for that user in that range.  You then can pick the one you want, and from there, you can edit it.<br><br>";

//get user list and set up date stuff
$users = sortUsersByName(getAllUserDetails()); 
$time = strtotime("-2 weeks");
$start_month = isset($_POST['start_month']) ? $_POST['start_month'] : date('n', $time);
$start_day   = isset($_POST['start_day'])   ? $_POST['start_day']   : date('d', $time);
$start_year  = isset($_POST['start_year'])  ? $_POST['start_year']  : date('Y', $time);
?>
<form method='post' action='redirects/edit_punch.php' id='editPunch'><div>
  <input type='hidden' name='super_pid' value='<?= $SESSION['pid']?>' />
	<br><label for='pid'>User: </label><p>
    <select name='pid' id='pid'><?
    foreach ($users as $s) {
            echo "\n    <option value='".$s['pid']."'>".$s['name']."</option>";
    }
?>
	</select>
	   Starting on <select name='start_month' style='width: 8em'>
        <? print_month_options($start_month) ?>
    </select>
    <select name='start_day' style='width: 3.5em'>
        <? print_day_options($start_day) ?>
    </select>
    <select name='start_year' style='width: 4.6em'>
        <? print_year_options($start_year) ?>
    </select>
    for <select name='length' style='width: 3.5em'>
<?
    $sel = isset($_POST['length']) ? $_POST['length'] : 14;
    for($i = 1; $i <= 30; ++$i) {
        if ($i == $sel)
            echo "<option selected='selected'>$i</option>\n";
        else
            echo "<option>$i</option>\n";
    }
?></select> days.  <br><br>
	<input type="submit" value="Show me the punches!" />
<?	
xhtml_footer();
?>
Return current item: ConPortal