function display_buttons($row, $is_series) { global $PHP_SELF; global $user, $reminder_interval; $last_reminded = empty($row['reminded']) ? $row['last_updated'] : $row['reminded']; $returl = $PHP_SELF; $target_id = $is_series ? $row['repeat_id'] : $row['id']; // When we're going to view_entry.php we need to pass the id and series // in a query string rather than as hidden inputs. That's because some // pages called by view_entry use HTTP_REFERER to form a return URL, and // view_entry needs to have a valid id. $query_string = "id={$target_id}"; $query_string .= $is_series ? "&series=1" : ""; if (auth_book_admin($user, $row['room_id'])) { // accept echo "<form action=\"confirm_entry_handler.php\" method=\"post\">\n"; echo "<div>\n"; echo "<input type=\"hidden\" name=\"action\" value=\"accept\">\n"; echo "<input type=\"hidden\" name=\"id\" value=\"{$target_id}\">\n"; echo "<input type=\"hidden\" name=\"series\" value=\"{$is_series}\">\n"; echo "<input type=\"hidden\" name=\"returl\" value=\"" . htmlspecialchars($returl) . "\">\n"; echo "<input type=\"submit\" value=\"" . get_vocab("accept") . "\">\n"; echo "</div>\n"; echo "</form>\n"; // reject echo "<form action=\"view_entry.php?{$query_string}\" method=\"post\">\n"; echo "<div>\n"; echo "<input type=\"hidden\" name=\"action\" value=\"reject\">\n"; echo "<input type=\"hidden\" name=\"returl\" value=\"" . htmlspecialchars($returl) . "\">\n"; echo "<input type=\"submit\" value=\"" . get_vocab("reject") . "\">\n"; echo "</div>\n"; echo "</form>\n"; // more info echo "<form action=\"view_entry.php?{$query_string}\" method=\"post\">\n"; echo "<div>\n"; echo "<input type=\"hidden\" name=\"action\" value=\"more_info\">\n"; echo "<input type=\"hidden\" name=\"returl\" value=\"" . htmlspecialchars($returl) . "\">\n"; echo "<input type=\"submit\" value=\"" . get_vocab("more_info") . "\">\n"; echo "</div>\n"; echo "</form>\n"; } else { // Work out whether enough time has elapsed since the last reminder $not_yet_time = working_time_diff(time(), $last_reminded) < $reminder_interval; // if enough time has passed since the last reminder // output a "Remind Admin" button, otherwise nothing if ($not_yet_time) { echo " "; } else { echo "<form action=\"confirm_entry_handler.php\" method=\"post\">\n"; echo "<div>\n"; echo "<input type=\"hidden\" name=\"action\" value=\"remind_admin\">\n"; echo "<input type=\"hidden\" name=\"id\" value=\"" . $row['id'] . "\">\n"; echo "<input type=\"hidden\" name=\"returl\" value=\"" . htmlspecialchars($returl) . "\">\n"; echo "<input type=\"submit\" value=\"" . get_vocab("remind_admin") . "\">\n"; echo "</div>\n"; echo "</form>\n"; } } }
function generateOwnerButtons($id, $series) { global $user, $create_by, $status, $area; global $PHP_SELF, $reminders_enabled, $last_reminded, $reminder_interval; $this_page = basename($PHP_SELF); // Remind button if you're the owner AND there's a booking awaiting // approval AND sufficient time has passed since the last reminder // AND we want reminders in the first place if ($reminders_enabled && $user == $create_by && $status & STATUS_AWAITING_APPROVAL && working_time_diff(time(), $last_reminded) >= $reminder_interval) { echo "<tr>\n"; echo "<td> </td>\n"; echo "<td>\n"; generateButton("approve_entry_handler.php", $id, $series, "remind", $this_page . "?id={$id}&area={$area}", get_vocab("remind_admin")); echo "</td>\n"; echo "</tr>\n"; } }
function display_buttons($row, $is_series) { global $PHP_SELF; global $user, $reminders_enabled, $reminder_interval; $last_reminded = empty($row['reminded']) ? $row['last_updated'] : $row['reminded']; $returl = $PHP_SELF; $target_id = $is_series ? $row['repeat_id'] : $row['id']; // When we're going to view_entry.php we need to pass the id and series // in a query string rather than as hidden inputs. That's because some // pages called by view_entry use HTTP_REFERER to form a return URL, and // view_entry needs to have a valid id. $query_string = "id={$target_id}"; $query_string .= $is_series ? "&series=1" : ""; if (auth_book_admin($user, $row['room_id'])) { // approve echo "<form action=\"approve_entry_handler.php\" method=\"post\">\n"; echo "<div>\n"; echo "<input type=\"hidden\" name=\"action\" value=\"approve\">\n"; echo "<input type=\"hidden\" name=\"id\" value=\"{$target_id}\">\n"; echo "<input type=\"hidden\" name=\"series\" value=\"{$is_series}\">\n"; echo "<input type=\"hidden\" name=\"returl\" value=\"" . htmlspecialchars($returl) . "\">\n"; echo "<input type=\"submit\" value=\"" . get_vocab("approve") . "\">\n"; echo "</div>\n"; echo "</form>\n"; // reject echo "<form action=\"view_entry.php?{$query_string}\" method=\"post\">\n"; echo "<div>\n"; echo "<input type=\"hidden\" name=\"action\" value=\"reject\">\n"; echo "<input type=\"hidden\" name=\"returl\" value=\"" . htmlspecialchars($returl) . "\">\n"; echo "<input type=\"submit\" value=\"" . get_vocab("reject") . "\">\n"; echo "</div>\n"; echo "</form>\n"; // more info $info_time = $is_series ? $row['repeat_info_time'] : $row['entry_info_time']; $info_user = $is_series ? $row['repeat_info_user'] : $row['entry_info_user']; if (empty($info_time)) { $info_title = get_vocab("no_request_yet"); } else { $info_title = get_vocab("last_request") . ' ' . time_date_string($info_time); if (!empty($info_user)) { $info_title .= " " . get_vocab("by") . " {$info_user}"; } } echo "<form action=\"view_entry.php?{$query_string}\" method=\"post\">\n"; echo "<div>\n"; echo "<input type=\"hidden\" name=\"action\" value=\"more_info\">\n"; echo "<input type=\"hidden\" name=\"returl\" value=\"" . htmlspecialchars($returl) . "\">\n"; echo "<input type=\"submit\" title=\"" . htmlspecialchars($info_title) . "\" value=\"" . get_vocab("more_info") . "\">\n"; echo "</div>\n"; echo "</form>\n"; } else { // get the area settings for this room get_area_settings(get_area($row['room_id'])); // if enough time has passed since the last reminder // output a "Remind Admin" button, otherwise nothing if ($reminders_enabled && working_time_diff(time(), $last_reminded) >= $reminder_interval) { echo "<form action=\"approve_entry_handler.php\" method=\"post\">\n"; echo "<div>\n"; echo "<input type=\"hidden\" name=\"action\" value=\"remind_admin\">\n"; echo "<input type=\"hidden\" name=\"id\" value=\"" . $row['id'] . "\">\n"; echo "<input type=\"hidden\" name=\"returl\" value=\"" . htmlspecialchars($returl) . "\">\n"; echo "<input type=\"submit\" value=\"" . get_vocab("remind_admin") . "\">\n"; echo "</div>\n"; echo "</form>\n"; } else { echo " "; } } }