本文整理汇总了PHP中readOnly函数的典型用法代码示例。如果您正苦于以下问题:PHP readOnly函数的具体用法?PHP readOnly怎么用?PHP readOnly使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了readOnly函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: writeCell
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
}
示例2: writeCell
function writeCell($conn, $date, $period, $table)
{
// checks if available
$minibuscodes = ["jbx", "jha", "lle", "yhj"];
$name = checkAvailable($conn, $date, $period, $table);
// if something is returned, then it is booked
if ($name) {
// sql to get the booking description of the booking
$sqlGetDescription = "SELECT BookingDesc FROM {$table}\n WHERE BookingDate={$date} AND BookingPeriod={$period}";
$resultGetDescription = mysqli_query($conn, $sqlGetDescription);
if (!$resultGetDescription) {
$bookingdesc = "Unable to get booking description";
} else {
$row = mysqli_fetch_assoc($resultGetDescription);
$bookingdesc = $row["BookingDesc"];
}
// on hover replaces the text with the description using JQuery
echo "<td class='booked'><span class='bookedtext'>" . $bookingdesc . "</a></span>\n <input type='hidden' id='description' value=\"{$bookingdesc}\"' /></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 (canBookVehicles($conn)) {
// else write a form containing a button to POST
echo "<form method='POST' action='all_vehicles.php' id={$date},{$period},{$table}>";
echo "<td class='available'>";
echo "<input type='hidden' id='hiddenbooking,{$date},{$period},{$table}' name='hiddenbookingdesc' value='' runat='server'>";
echo "<input type='hidden' id='{$date},{$period}' name='table' value='{$table}' runat='server'>";
echo "</form>";
} else {
echo "<td class='available'></td>";
}
} else {
// if read-only, does not write book button
echo "<td class='available'></td>";
}
// else
}
// else
}
// else
}
示例3: writeCell
function writeCell($conn, $date, $period)
{
// checks if available
$name = checkAvailable($conn, $date, $period);
// if something is returned, then it is booked
if ($name) {
// sql to get the booking description of the booking
$sqlGetDescription = "SELECT BookingDesc FROM minibusyhj\n WHERE BookingDate={$date} AND BookingPeriod={$period}";
$resultGetDescription = mysqli_query($conn, $sqlGetDescription);
if (!$resultGetDescription) {
$bookingdesc = "Unable to get booking description";
} else {
$row = mysqli_fetch_assoc($resultGetDescription);
$bookingdesc = $row["BookingDesc"];
}
// on hover replaces the text with the description using JQuery
echo "<b><td class='booked'><span class='bookedtext' style='font-weight:bold'>" . $name . "</a></span>\n <input type='hidden' id='description' value=\"{$bookingdesc}\"' /></td></b>";
} 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 (canBookVehicles($conn)) {
// else write a form containing a button to POST
echo "<form method='POST' action='minibusyhj.php' id={$date},{$period}>";
echo "<td class='available'>";
echo "<input type='hidden' id='hiddenbooking,{$date},{$period}' name='hiddenbookingdesc' value='' runat='server'>";
echo "<button type='submit' id='availablebtn' name='book' ";
echo "onclick=\"getBookingDescription({$date},{$period}); return confirm('" . writeDialog("Minibus YHJ", $date, $period) . "');\"";
echo "value='" . $date . "," . $period . "'>Book</button></td>";
echo "</form>";
} else {
echo "<td class='available'></td>";
}
} else {
// if read-only, does not write book button
echo "<td class='available'></td>";
}
// else
}
// else
}
// else
}
示例4: writeLogInOut
// Function to write a log in/ log out link
// depending on whether the user is currently
// logged in or out
function writeLogInOut()
{
if (isset($_SESSION['loggedin'])) {
echo "<a id='' href='/logout.php'>Log out</a>";
} else {
echo "<a id='' href='/login.php'>Log in</a>";
}
}
// writeLogInOut
$today = date('l, jS \\of F Y');
echo "Today's date is {$today}. <br><br>";
// if user is read only / guest
if (readOnly($conn)) {
echo "You are logged in as a guest.<br>\n This means that you cannot make bookings, only view them.<br>\n To make a booking, log out and log in using a user account.";
} else {
// Calls function to write today's bookings
printTodayBookings();
}
// Function to check if the user has any bookings for today
// If they have, prints them sequentially in a styled format
// If not, prints a message to say that they have no bookings
function printTodayBookings()
{
try {
// Sets today's date in form YYYYMMDD for searching
$today = date("Ymd");
// Start by initialising an array, which will be used to loop through
// to check each table for bookings