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

/*
 * Prints the "Create Appointment" button
 */
function print_create_appointment ($shift_pid)
{
    echo '<a href="'.BASE_URL.'create_appointment.php?id=' . $shift_pid . '">Create Appointment</a>';
}

/*
 * Prints the dropdown list for updating an appointment
 */
function print_update ($appt_pid, $cur_status)
{
    ?>
        <form action="redirects/appointments.php" method="post">
            <input type="hidden" name="refer" value="set_status" />
            <input type="hidden" name="pid" value="<?= $appt_pid ?>" />
            <select name="status" onChange="confirm('Change status of this appointment?') ? submit() : reset()" style="width: 8em">
                <option <?= $cur_status == "Scheduled" ? "selected='selected'" : ""; ?> >Scheduled</option>
                <option <?= $cur_status == "Completed" ? "selected='selected'" : ""; ?> >Completed</option>
                <option <?= $cur_status == "Cancelled" ? "selected='selected'" : ""; ?> >Cancelled</option>
            </select>
        </form>
    <?php
}

/*
 * Prints the form for creating appointments
 */
function print_create_form ($shift_pid)
{
    $shift_data = getShiftDetails($shift_pid);
    if (!isset($shift_data))
    {
        echo '<div class="warn">Error: no shift with pid ' . $shift_pid . '!</div>';
        return;
    }
    
    ?>
        <div id="create_appt_title">
            Create appointment on:
            <?= timestamp_to_prettydate($_SESSION['shift_timestamp']) ?>
        </div>
        <div id="create_appt">
            <form action="redirects/appointments.php" method="post">
                <input type="hidden" name="refer" value="create_appt" />
                <input type="hidden" name="position" value="<?php echo $shift_data['position']; ?>" />
                
                <table>
                    <tr>
                        <td>Time:</td>
                        <td>
                            <select name="hour" style="width: 3em">
                                <?php
                                    // Generate list of hours - only include hours between
                                    // the start and end time of the shift
                                    for ($i = $shift_data['start_time']; $i < $shift_data['end_time']; $i += 3600)
                                        echo '<option value="' . date('G', $i) . '">' . date('g', $i) . '  </option>';
                                ?>
                            </select>
                            
                            <select name="minute" style="width: 4em">
                                <?php
                                    // Generate list of minutes - at 5-minute intervals
                                    for ($i = 0; $i < 60; $i += 5)
                                        echo '<option value="' . $i . '">:' . sprintf('%02d', $i) . '  </option>';
                                ?>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>Brief description:</td>
                        <td><input name="desc" size="50" maxlength="50" /></td>
                    </tr>
                    <tr>
                        <td>Case number:</td>
                        <td><input name="ticket" maxlength="7" size="8" /></td>
                    </tr>
                </table>
				<?php
					if (checkPerm($_SESSION, "appointments"))
					{
						?>
		                <p>
							<input type="checkbox" name="appointment_override" />
							Override normal sanity checks (this allows you to create multiple
							appointments per shift, etc).  <span class="warn">WARNING: make sure
							you select a time that is actually during the shift, or the appointment
							will not be visible!</span>
						</p>
						<?php
					}
				?>
                <p><input type="submit" value="Create Appointment" /></p>
            </form>
        </div>
    <?php
}

?>
Return current item: ConPortal