本文整理汇总了PHP中Room类的典型用法代码示例。如果您正苦于以下问题:PHP Room类的具体用法?PHP Room怎么用?PHP Room使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Room类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionLogout
/**
* Destroy user session
*/
public function actionLogout()
{
try {
// we might not be signed in actually
$this->user = new User();
} catch (UserNotAuthenticatedException $e) {
$this->flashSuccess = 'You are already logged out';
}
// as we are logging out, leave us from all rooms
if ($this->user != NULL) {
$inRooms = $this->user->inRooms();
if (!empty($inRooms)) {
$time = mktime();
foreach ($inRooms as $room) {
// message about it
$message = new MessageSpeak($room, $time);
$message->leave($room, $time, $this->user->getShortName());
}
// remove us from participants
$room = new Room();
$room->removeParticipant($this->user->getId());
}
$this->flashSuccess = 'You have been logged out';
$this->user->signOut();
}
$this->bag->token = Fari_FormToken::create();
$this->renderAction('login');
}
示例2: Room
/**
* Internal function to return a Room object from a row.
* @param $row array
* @return Room
*/
function &_returnRoomFromRow(&$row)
{
$room = new Room();
$room->setId($row['room_id']);
$room->setBuildingId($row['building_id']);
$this->getDataObjectSettings('room_settings', 'room_id', $row['room_id'], $room);
return $room;
}
示例3: joinRoom
public function joinRoom(Room $room)
{
if ($room->isFull()) {
return;
}
$this->room = $room;
$room->addPlayer($this);
}
示例4: select_group
public function select_group()
{
$group_id = $this->input->post('group_id');
$this->_transaction_isolation();
$this->db->trans_begin();
$group = new Group();
$group->get_by_id($group_id);
if ($group->exists()) {
$course = $group->course->get();
if (is_null($course->groups_change_deadline) || date('U', strtotime($course->groups_change_deadline)) >= time()) {
$student = new Student();
$student->get_by_id($this->usermanager->get_student_id());
if ($student->is_related_to('active_course', $course->id)) {
$participant = new Participant();
$participant->where_related($student);
$participant->where_related($course);
$participant->where('allowed', 1);
$participant->get();
if ($participant->exists()) {
if (!$participant->is_related_to($group)) {
$participant->save($group);
$participant->where_related($course);
$participant->where_related($group);
$participant->where('allowed', 1);
$participants_count = $participant->count();
$room = new Room();
$room->where_related($group)->order_by('capacity', 'asc')->limit(1)->get();
if ($participants_count > intval($room->capacity)) {
$this->db->trans_rollback();
$this->messages->add_message('lang:groups_message_group_is_full', Messages::MESSAGE_TYPE_ERROR);
} else {
$this->db->trans_commit();
$this->messages->add_message(sprintf($this->lang->line('groups_message_group_changed'), $this->lang->text($group->name)), Messages::MESSAGE_TYPE_SUCCESS);
$this->_action_success();
$this->output->set_internal_value('course_id', $participant->course_id);
}
} else {
$this->db->trans_rollback();
$this->messages->add_message('lang:groups_message_you_are_in_group', Messages::MESSAGE_TYPE_ERROR);
}
} else {
$this->db->trans_rollback();
$this->messages->add_message('lang:groups_message_cant_found_participant_record', Messages::MESSAGE_TYPE_ERROR);
}
} else {
$this->db->trans_rollback();
$this->messages->add_message('lang:groups_message_cant_change_group_of_inactive_course', Messages::MESSAGE_TYPE_ERROR);
}
} else {
$this->db->trans_rollback();
$this->messages->add_message('lang:groups_message_groups_switching_disabled', Messages::MESSAGE_TYPE_ERROR);
}
} else {
$this->db->trans_rollback();
$this->messages->add_message('lang:groups_message_group_not_found', Messages::MESSAGE_TYPE_ERROR);
}
redirect(create_internal_url('groups'));
}
示例5: bookRoom
static function bookRoom(Room $room, Reservation $reservation)
{
$room->addReservation($reservation);
$roomNumber = $room->getRoomInfo()->getRoomNumber();
$guest = $reservation->getGuest()->getFullName();
$start = $reservation->getStartDate();
$end = $reservation->getEndDate();
echo "Room <strong>{$roomNumber}</strong> successfully booked for <strong>{$guest}</strong> from <time>{$start}</time> to <time>{$end}</time>!";
}
示例6: bookRoom
public static function bookRoom(Room $room, Reservation $reservation)
{
try {
$room->addReservation($reservation);
echo "\nRoom " . $room->getRoomNumber() . " successfully booked for " . $reservation->getGuest()->getFullName() . " from " . $reservation->getStartDate()->format("d-m-y") . " to " . $reservation->getEndDate()->format("d-m-y");
} catch (EReservationException $ex) {
echo PHP_EOL . $ex->getMessage();
}
}
示例7: bookRoom
public static function bookRoom(Room $room, Reservation $reservation)
{
try {
$room->addReservation($reservation);
$output = "Room <strong>{$room->getRoomNumber()}</strong> successfully booked for " . "<strong>{$reservation->getGuest()}</strong> from " . "<time>{$reservation->getStartDate()->format("d.m.Y")}</time> to " . "<time>{$reservation->getEndDate()->format("d.m.Y")}</time>!";
echo $output;
} catch (EReservationException $e) {
echo $e->getMessage();
}
}
示例8: isEmpty
function isEmpty(Room $room)
{
$quest = new Guest("G", "R", 89466466);
$reservation = new Reservation("15-10-2014", "18-10-2014", $quest);
try {
$room->checkForValidReservation($reservation);
return true;
} catch (EReservationException $ex) {
return false;
}
}
示例9: doDelete
function doDelete()
{
@($id = $_POST['selector']);
$key = count($id);
//multi delete using checkbox as a selector
for ($i = 0; $i < $key; $i++) {
$room = new Room();
$room->delete($id[$i]);
}
message("Room(s) already Deleted!", "info");
redirect('index.php');
}
示例10: bookRoom
static function bookRoom(Room $room, Reservation $reservation)
{
try {
$room->addReservation($reservation);
$startDate = $reservation->getStartDate();
$endDate = $reservation->getEndDate();
$guestName = $reservation->getGuest()->getFistName() . " " . $reservation->getGuest()->getLastName();
echo "\nRoom <strong>" . $room->getRoomId() . "</strong> successfully booked for <strong>" . $guestName . "</strong> from <time>" . date_format($startDate, "d-m-y") . "</time> to <time>" . date_format($endDate, "d-m-y") . "</time>!</br>";
} catch (EReservationException $ex) {
echo $ex->getMessage();
}
}
示例11: executeAdd
public function executeAdd(sfWebRequest $request)
{
if ($request->isMethod('Post')) {
$room = new Room();
$room->setTitle($this->getRequestParameter('title'));
$room->setPrice($this->getRequestParameter('price'));
$room->setStatus(Constant::BED_AVAILABLE);
$room->save();
$this->getUser()->setFlash('SUCCESS_MESSAGE', Constant::RECORD_ADDED_SUCCESSFULLY);
$this->redirect('Room/list');
}
//end if
}
示例12: bookRoom
public static function bookRoom(Room $room, Reservation $reservation)
{
try {
$room->addReservation($reservation);
$successMessage = "Room <strong>" . $room->getRoomNumber() . "</strong> successfully booked ";
$successMessage .= "for <strong>" . $reservation->getGuest();
$successMessage .= "</strong> from <time>" . $reservation->getStarDate()->format("d.m.Y") . "</time> ";
$successMessage .= "to <time>" . $reservation->getEndDate()->format("d.m.Y") . "</time>!";
$successMessage .= "</br>";
echo $successMessage;
} catch (EReservationException $ex) {
echo "<strong>Operation failed.</strong> " . $ex->getMessage() . "</br>";
return;
}
}
示例13: deleteRoom
public function deleteRoom($buildingid, $id)
{
//
$room = Room::find($id);
$room->delete();
return Redirect::to('/building/' . $buildingid);
}
示例14: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Room::create([]);
}
}
示例15: getDelete
public function getDelete($id)
{
$room = Room::find($id);
$room->delete();
Session::flash('message', 'The records are deleted successfully');
return Redirect::to('rooms');
}