Exemplo n.º 1
0
function writeCell($conn, $date, $period)
{
    // checks if available
    $name = checkAvailable($conn, $date, $period);
    // if something is returned, then it is booked
    if ($name) {
        echo "<td class='booked'><b>" . $name . "</b></td>";
    } else {
        // check if the date is in the past
        if (checkIfInThePast($date)) {
            //if in the past, write a cell
            echo "<td class='past'></td>";
        } else {
            // checks if user is read only or not
            if (!readOnly($conn)) {
                if (canBookSLT($conn)) {
                    // else write a form containing a button to POST
                    echo "<form method='POST' action='slt_clip.php'>";
                    echo "<td class='available'><button type='submit' id='availablebtn' name='book'";
                    echo "onclick=\"return confirm('" . writeDialog("CLIP", $date, $period) . "');\"";
                    echo "value='" . $date . "," . $period . "'>Book</button></td>";
                    echo "</form>";
                } else {
                    // if can't book vehicles, does not write book button
                    echo "<td class='available'></td>";
                }
                // else
            } else {
                // if read-only, does not write book button
                echo "<td class='available'></td>";
            }
            // else
        }
        // else
    }
    // else
}
Exemplo n.º 2
0
        ?>
            <form method="POST" action="admin.php">
            <!--Has a confirm box to make sure user can cancel action-->
            <button type="submit" id="bookvehicles" name="bookvehicles" onclick="return confirm('Are you sure you want to allow this user to book vehicles?');" value=<?php 
        echo "'" . $row["Username"] . "'";
        ?>
>Allow</button>
            <?php 
    }
    ?>
            </form>
          </td>
          <?php 
    echo "<td>" . $row["isSLT"] . "</td>";
    echo "<td>";
    if (!canBookSLT($conn, $row["Username"])) {
        ?>
            <form method="POST" action="admin.php">
            <!--Has a confirm box to make sure user can cancel action-->
            <button type="submit" id="bookslt" name="bookslt" onclick="return confirm('Are you sure you want to make this user Speech &amp; Language?');" value=<?php 
        echo "'" . $row["Username"] . "'";
        ?>
>Allow</button>
            <?php 
    }
    ?>
          <td>
            <form method="POST" action="admin.php">
            <!--Has a confirm box to make sure user can cancel action-->
            <button type="submit" id="deleteuser" name="deleteuser" onclick="return confirm('Are you sure you want to delete this record?');" value=<?php 
    echo "'" . $row["Username"] . "'";