Beispiel #1
0
function showTimeSelector($inputName, $input1, $input2, $required = true)
{
    echo '<select name="' . $inputName . '1" ';
    if ($required) {
        showInputBoxError();
    }
    echo '>';
    echo '<option value=""></option>';
    for ($i = 00; $i <= 23; $i++) {
        if ($i == $input1 && !empty($input1)) {
            echo '<option value="' . str_pad($i, 2, "0", STR_PAD_LEFT) . '" SELECTED >' . str_pad($i, 2, "0", STR_PAD_LEFT) . '</option>';
        } else {
            echo '<option value="' . str_pad($i, 2, "0", STR_PAD_LEFT) . '">' . str_pad($i, 2, "0", STR_PAD_LEFT) . '</option>';
        }
    }
    echo '</select> : ';
    echo '<select name="' . $inputName . '2" ';
    if ($required) {
        showInputBoxError();
    }
    echo '>';
    echo '<option value=""></option>';
    for ($i = 00; $i <= 59; $i++) {
        if ($i == $input2 && !empty($input2)) {
            echo '<option value="' . str_pad($i, 2, "0", STR_PAD_LEFT) . '" SELECTED >' . str_pad($i, 2, "0", STR_PAD_LEFT) . '</option>';
        } else {
            echo '<option value="' . str_pad($i, 2, "0", STR_PAD_LEFT) . '">' . str_pad($i, 2, "0", STR_PAD_LEFT) . '</option>';
        }
    }
    echo '</select>';
}
function displayDateSelect($inputName, $id, $oldValue = false, $required = false, $today = false, $submitForm = false)
{
    ?>
    <link type="text/css" href="bin/jQuery/css/smoothness/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
    <script type="text/javascript" src="bin/jQuery/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="bin/jQuery/js/jquery-ui-1.8.21.custom.min.js"></script>
    <script type="text/javascript">
        $(function() {
            // Datepicker
            $('.datepicker').datepicker({
                    inline: true,
                    <?php 
    if ($submitForm) {
        echo 'onSelect: function(){
                            var _form = document.getElementById("secLog");
                            var _goBtn = document.getElementById("goBtn");
                            _goBtn.click();
                            _form.submit();
                            
                            },';
    }
    ?>
                    changeYear: true,
                    yearRange: "-100:+100"
            });
        });
    </script>
    <input name="<?php 
    echo $inputName;
    ?>
" type="text" class="datepicker" <?php 
    if ($today && !$oldValue) {
        echo 'value="' . date('m/d/Y', strtotime('today')) . '"';
    }
    ?>
 id="<?php 
    echo $id;
    ?>
" <?php 
    if (!$oldValue) {
        if ($required) {
            showInputBoxError();
        }
    } else {
        echo 'value="' . $oldValue . '"';
    }
    //            if($submitForm)
    //                echo ' onchange="submitSecLog();this.form.submit()"';
    echo ' />';
}
function showAddReserve($config)
{
    if ($config->adminLvl >= 75) {
        $mysqli = connectToSQL($reserveDB = TRUE);
        $saveBtn = isset($_POST['saveBtn']) ? true : false;
        if ($saveBtn) {
            $group = isset($_POST['resGroup']) ? $mysqli->real_escape_string($_POST['resGroup']) : "";
            $fName = isset($_POST['foundUserFNAME']) ? $mysqli->real_escape_string($_POST['foundUserFNAME']) : "";
            $lName = isset($_POST['foundUserLNAME']) ? $mysqli->real_escape_string($_POST['foundUserLNAME']) : "";
            $radio = isset($_POST['radioNum']) ? $mysqli->real_escape_string($_POST['radioNum']) : "";
            $address = isset($_POST['address']) ? $mysqli->real_escape_string($_POST['address']) : "";
            $city = isset($_POST['city']) ? $mysqli->real_escape_string($_POST['city']) : "";
            $state = isset($_POST['state']) ? $mysqli->real_escape_string($_POST['state']) : "";
            $zip = isset($_POST['zip']) ? $mysqli->real_escape_string($_POST['zip']) : "";
            $hPhone = isset($_POST['hPhone']) ? $mysqli->real_escape_string($_POST['hPhone']) : "";
            $cPhone = isset($_POST['cPhone']) ? $mysqli->real_escape_string($_POST['cPhone']) : "";
            $wPhone = isset($_POST['wPhone']) ? $mysqli->real_escape_string($_POST['wPhone']) : "";
            $tis = isset($_POST['tis']) ? $mysqli->real_escape_string($_POST['tis']) : "";
            $agency = isset($_POST['agency']) ? $mysqli->real_escape_string($_POST['agency']) : "";
            $notes = isset($_POST['notes']) ? $mysqli->real_escape_string($_POST['notes']) : "";
            if (empty($fName) || empty($lName) || empty($group)) {
                echo '<br />Must provide all the highlighted items<br /> Did not Save<br />';
                $saveBtn = false;
            } else {
                $myq = "INSERT INTO `RESERVE`.`RESERVE` (`GRP` ,`LNAME` ,`FNAME` ,`RADIO` ,`ADDRESS` ,`CITY` ,`ST` ,`ZIP` ,`HOMEPH` ,`CELLPH` ,`WORKPH` ,`TIS` ,`AGENCY` ,`NOTES` ,`IDNUM`)\r\n                    VALUES (\r\n                    " . $group . ",\r\n                    '" . $lName . "',\r\n                    '" . $fName . "',\r\n                    '" . $radio . "',\r\n                    '" . $address . "',\r\n                    '" . $city . "',\r\n                    '" . $state . "',\r\n                    '" . $zip . "',\r\n                    '" . $hPhone . "',\r\n                    '" . $cPhone . "',\r\n                    '" . $wPhone . "',\r\n                    '" . $tis . "',\r\n                    '" . $agency . "',\r\n                    '" . $notes . "',\r\n                    NULL\r\n                    );";
                $result = $mysqli->query($myq);
                SQLerrorCatch($mysqli, $result);
                $reserveAddedID = $mysqli->insert_id;
                addLog($config, 'Reserve ID ' . $secLogID . ' Added');
                echo 'Successfully Saved Reserve with ID: ' . $reserveAddedID . '<br />';
                reserveDetails($config, $mysqli->insert_id);
            }
        }
        if (!$saveBtn) {
            echo '</div><div align="left" class="login"><table>';
            echo '<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;</td><td>
                First Name: </td><td><input type="text" name="foundUserFNAME" ';
            echo showInputBoxError();
            echo ' /></td></tr>';
            echo '<tr><td></td><td>Last Name: </td><td><input type="text" name="foundUserLNAME" ';
            echo showInputBoxError();
            echo '/></td></tr>';
            echo '<tr><td></td><td>Group: </td><td><select name="resGroup" ';
            echo showInputBoxError();
            echo '>
                <option value="">Select Group</option>
                <option value="1">Group 1</option>
                <option value="2">Group 2</option>
                <option value="3">Group 3</option>
                <option value="4">Group 4</option>
                <option value="5">Group 5</option>
                </select></td></tr>';
            echo '<tr><td></td><td>Radio#: </td><td><input type="text" name="radioNum" /></td></tr>';
            echo '<tr><td></td><td>Address: </td><td><input type="text" name="address" /></td></tr>';
            echo '<tr><td></td><td>City: </td><td><input type="text" name="city" /></td></tr>';
            echo '<tr><td></td><td>State: </td><td><input type="text" name="state" /></td></tr>';
            echo '<tr><td></td><td>ZIP: </td><td><input type="text" name="zip" /></td></tr>';
            echo '<tr><td></td><td>Home Phone: </td><td><input type="text" name="hPhone" /></td></tr>';
            echo '<tr><td></td><td>Cell Phone: </td><td><input type="text" name="cPhone" /></td></tr>';
            echo '<tr><td></td><td>Work Phone: </td><td><input type="text" name="wPhone" /></td></tr>';
            echo '<tr><td></td><td>Time in Service: </td><td>';
            displayDateSelect("tis", "tis", false, false, true);
            echo '</td></tr>';
            echo '<tr><td></td><td>Agency: </td><td><input type="text" name="agency" /></td></tr>';
            echo '<tr><td></td><td>Additional Notes: </td><td><input type="text" name="notes" /></td></tr><tr><td></td></tr>';
            echo '<tr><td></td><td><input type="submit" name="saveBtn" value="Save" /></td><td>';
            echo '<input type="hidden" name="addBtn" value="true" />';
            echo '<input type="submit" name="goBackBtn" value="Back To Reserves" /></td></tr>';
            echo '</table></div>';
        }
    }
}