本文整理汇总了PHP中Room::fetchFromDb方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::fetchFromDb方法的具体用法?PHP Room::fetchFromDb怎么用?PHP Room::fetchFromDb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room::fetchFromDb方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRoom
public function getRoom()
{
global $logger;
$logger->LogDebug(__METHOD__ . "Getting room for booking with room id: " . $this->roomId);
$room = Room::fetchFromDb($this->roomId);
if ($room == null) {
$logger->LogError("There is no room with id: " . $this->roomId);
$this->errors = Room::$staticErrors;
} else {
$logger->LogDebug("Found room with id: " . $this->clientId);
}
return $room;
}
示例2: header
$systemConfiguration->assertReferer();
$logger->LogInfo("Getting session object ...");
if (!isset($_SESSION['bookingDetails'])) {
$logger->LogError("Session object is not set!");
header("Location: booking-failure.php?error_code=9");
}
// Get booking details from session
$bookingDetails = unserialize($_SESSION['bookingDetails']);
// Get selected room
$logger->LogInfo("Getting selected room ...");
if (!isset($_POST['roomId']) || !is_numeric($_POST['roomId'])) {
$logger->LogError("No roomId variable in POST!");
$_SESSION['errors'] = array(0 => BOOKING_FAILURE_INVALID_REQUEST);
header("Location: booking-failure.php");
}
$selectedRoom = Room::fetchFromDb(intval($_POST['roomId']));
if (is_null($selectedRoom) || is_null($bookingDetails->searchCriteria)) {
$logger->LogError("No room for roomId: " . $_POST['roomId'] . " could be foudn in the database!");
$_SESSION['errors'] = array(0 => BOOKING_FAILURE_INVALID_REQUEST);
header("Location: booking-failure.php");
}
$logger->LogInfo("Selected room is: " . $selectedRoom->roomName . " #" . $selectedRoom->roomNumber);
$bookingDetails->room = $selectedRoom;
// Save booking details to session
$bookingDetailsSerialized = serialize($bookingDetails);
$_SESSION['bookingDetails'] = $bookingDetailsSerialized;
// Get all extra services
$logger->LogInfo("Fetching all extra services ...");
$extraServices = ExtraService::fetchAllFromDb();
$logger->LogInfo("Fetched " . count($extraServices) . " extra services.");
// If there are no extra bed option or other services available, skip
示例3: session_start
session_start();
global $systemConfiguration;
global $logger;
if (!isset($_SESSION['bookingDetailsAdmin'])) {
$_SESSION['errors'] = array(0 => "Invalid request: could not find search data in session");
header("Location: error.php");
}
// Get booking details from session
$bookingDetails = unserialize($_SESSION['bookingDetailsAdmin']);
// Get selected room
if (!isset($_POST['roomId']) || !is_numeric($_POST['roomId'])) {
$_SESSION['errors'] = array(0 => "Invalid request: could not find selected room to book");
header("Location: booking-failure.php");
}
$roomId = intval($_POST['roomId']);
$selectedRoom = Room::fetchFromDb($roomId);
if ($selectedRoom == null) {
$_SESSION['errors'] = array(0 => "Invalid request: there is no room/apartment with id {$roomId}");
header("Location: error.php");
}
$bookingDetails->room = $selectedRoom;
// Save booking details to session
$bookingDetailsSerialized = serialize($bookingDetails);
$_SESSION['bookingDetailsAdmin'] = $bookingDetailsSerialized;
// Get all extra services
$extraServices = ExtraService::fetchAllFromDb();
// If there are no extra bed option or other services available, skip
if (!$bookingDetails->room->hasExtraBed == 0 && sizeof($extraServices) == 0) {
header("Location booking_step4.php");
}
$logger->LogDebug("booking-services date:");
示例4: array
<?php
// TODO: umcomment
include "access.php";
require_once "../includes/SystemConfiguration.class.php";
global $systemConfiguration;
global $logger;
$errors = array();
$roomImages = array();
$roomId = 0;
if (isset($_GET['room_id']) && is_numeric($_GET['room_id'])) {
$roomId = intval($_GET['room_id']);
$room = Room::fetchFromDb($roomId);
if ($room == null) {
$errors[] = "There is no room with id: {$roomId}";
} else {
$logger->LogDebug("Fetching room images for room id {$roomId} ...");
//$roomImages = RoomImage::fetchFromDbForRoom($roomId);
$roomImages = $room->getImages();
}
} else {
$errors[] = "Invalid room id";
}
$logger->LogDebug("Fetching default language ...");
$defaultLanguage = Language::fetchDefaultLangauge();
if ($defaultLanguage == null) {
$logger->LogError("There were errors fetching default language.");
foreach (Language::$staticErrors as $error) {
$logger->LogError($error);
$errors[] = $error;
}
示例5: foreach
$logger->LogError("Error saving room.");
foreach ($room->errors as $error) {
$logger->LogError($error);
$errors[] = $error;
}
} else {
header("Location: rooms_list.php");
$message = "Values were updated successfully!";
}
}
} else {
if (isset($_REQUEST['id']) && is_numeric($_REQUEST['id'])) {
$logger->LogInfo("Page was called for edit of id: " . $_REQUEST['id']);
$id = intval($_REQUEST['id']);
$logger->LogDebug("Numeric id is: {$id}");
$room = Room::fetchFromDb($id);
if ($room == null) {
$logger->LogError("Invalid request. No room with id: {$id} exists.");
$errors[] = "Invalid request. No room with id: {$id} exists.";
} else {
$roomPricePlan = $room->getDefaultPricePlan();
if ($roomPricePlan == null) {
$logger->LogError("Invalid configuration. No default price plan exists fro room with id: {$roomId}.");
$errors[] = "Invalid configuration. No default price plan exists fro room with id: {$roomId}.";
}
}
}
}
$defaultLanguage = Language::fetchDefaultLangauge();
include "header.php";
?>