Skip to content
Snippets Groups Projects
Commit e7f0e311 authored by Michaela Brückner's avatar Michaela Brückner :unicorn:
Browse files

change room name and show category properties, re #1327

parent 0d99c65b
No related branches found
No related tags found
No related merge requests found
...@@ -249,7 +249,9 @@ class Course_RoomRequestsController extends AuthenticatedController ...@@ -249,7 +249,9 @@ class Course_RoomRequestsController extends AuthenticatedController
} }
/*
* Start point to creating a new request
*/
public function new_request_action($request_id = '') public function new_request_action($request_id = '')
{ {
if (!Config::get()->RESOURCES_ALLOW_ROOM_REQUESTS) { if (!Config::get()->RESOURCES_ALLOW_ROOM_REQUESTS) {
...@@ -283,6 +285,9 @@ class Course_RoomRequestsController extends AuthenticatedController ...@@ -283,6 +285,9 @@ class Course_RoomRequestsController extends AuthenticatedController
} }
/*
* Step 1: Either selecting a room category or searching for a room name
*/
public function request_first_step_action($request_id) public function request_first_step_action($request_id)
{ {
$this->request_id = $request_id; $this->request_id = $request_id;
...@@ -298,7 +303,6 @@ class Course_RoomRequestsController extends AuthenticatedController ...@@ -298,7 +303,6 @@ class Course_RoomRequestsController extends AuthenticatedController
$this->category_id = Request::get('category_id'); $this->category_id = Request::get('category_id');
$_SESSION[$request_id]['room_category'] = $this->category_id; $_SESSION[$request_id]['room_category'] = $this->category_id;
$this->search_by_category = Request::submitted('search_by_category'); $this->search_by_category = Request::submitted('search_by_category');
// TODO do we need to delete one of these after step 0?
// user looks for a special room OR for room within a selected category // user looks for a special room OR for room within a selected category
if ($this->room_name != null && $this->search_by_roomname != null) { if ($this->room_name != null && $this->search_by_roomname != null) {
...@@ -336,6 +340,16 @@ class Course_RoomRequestsController extends AuthenticatedController ...@@ -336,6 +340,16 @@ class Course_RoomRequestsController extends AuthenticatedController
// small icons before room name to show whether they are bookable or not // small icons before room name to show whether they are bookable or not
$this->available_room_icons = $this->getRoomBookingIcons($this->available_rooms, $this->request_id); $this->available_room_icons = $this->getRoomBookingIcons($this->available_rooms, $this->request_id);
$this->selected_room = Resource::find($_SESSION[$request_id]['room_id']); $this->selected_room = Resource::find($_SESSION[$request_id]['room_id']);
$this->selected_room_category_id = $this->selected_room->category_id;
$_SESSION[$request_id]['room_category'] = $this->selected_room_category_id;
// for step 2 after choosing a room
if ($step == 2) {
echo"Hallo";
$this->category = ResourceCategory::find($this->selected_room_category_id);
$this->available_properties = $this->category->getRequestableProperties();
}
// after selecting a room, go to next step // after selecting a room, go to next step
if ((Request::submitted('request_second_step'))) { if ((Request::submitted('request_second_step'))) {
...@@ -348,6 +362,15 @@ class Course_RoomRequestsController extends AuthenticatedController ...@@ -348,6 +362,15 @@ class Course_RoomRequestsController extends AuthenticatedController
} }
// we might also search for new rooms and stay within step 1
if (Request::get('room_name') && Request::submitted('search_by_name')) {
$_SESSION[$request_id]['room_name'] = Request::get('room_name');
$this->redirect(
'course/room_requests/find_by_roomname/' . $this->request_id . '/' . $this->step
);
}
} }
public function find_by_category_action($request_id, $step) public function find_by_category_action($request_id, $step)
...@@ -356,9 +379,7 @@ class Course_RoomRequestsController extends AuthenticatedController ...@@ -356,9 +379,7 @@ class Course_RoomRequestsController extends AuthenticatedController
$this->step = $step; $this->step = $step;
$this->room_category_id = $_SESSION[$request_id]['room_category']; $this->room_category_id = $_SESSION[$request_id]['room_category'];
$this->category = ResourceCategory::find($this->room_category_id); $this->category = ResourceCategory::find($this->room_category_id);
$this->request = RoomRequest::find($this->request_id) ? RoomRequest::find($this->request_id) : new RoomRequest($this->request_id); $this->request = RoomRequest::find($this->request_id) ? RoomRequest::find($this->request_id) : new RoomRequest($this->request_id);
RoomManager::findRoomsByRequest($this->request); RoomManager::findRoomsByRequest($this->request);
...@@ -366,11 +387,13 @@ class Course_RoomRequestsController extends AuthenticatedController ...@@ -366,11 +387,13 @@ class Course_RoomRequestsController extends AuthenticatedController
} }
/*
* Step 2: After choosing a category or a room, check the properties
*/
public function request_second_step_action($request_id) public function request_second_step_action($request_id)
{ {
$this->request_id = $request_id; $this->request_id = $request_id;
$this->step = 2; $this->step = 2;
//$this->selected_room = Resource::find($_SESSION[$request_id]['room_id']);
$this->redirect( $this->redirect(
'course/room_requests/find_by_roomname/' . $this->request_id . '/' . $this->step 'course/room_requests/find_by_roomname/' . $this->request_id . '/' . $this->step
...@@ -430,9 +453,6 @@ class Course_RoomRequestsController extends AuthenticatedController ...@@ -430,9 +453,6 @@ class Course_RoomRequestsController extends AuthenticatedController
/************ OLD STUFF *******/ /************ OLD STUFF *******/
/** /**
* This action is the entry point for adding properties to a room request. * This action is the entry point for adding properties to a room request.
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
) ?> ) ?>
<?= \Studip\Button::create(_('Raum auswählen und weiter'), 'request_second_step') ?> <?= \Studip\Button::create(_('Weiter'), 'request_second_step') ?>
<? endif ?> <? endif ?>
......
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
<?= htmlReady($selected_room->name) ?> <?= htmlReady($selected_room->name) ?>
<? endif ?> <? endif ?>
<?= var_dump($selected_room); ?>
...@@ -56,10 +56,25 @@ ...@@ -56,10 +56,25 @@
</span> </span>
</label> </label>
<? endif ?> <? endif ?>
<!-- ROOM CATEGORY PROPERTIES -->
<? if ($available_properties) : ?>
<? foreach ($available_properties as $property) : ?>
<?= $property->toHtmlInput(
$selected_properties[$property->name],
'selected_properties[' . htmlReady($property->name) . ']',
true,
false
) ?>
<? endforeach ?>
<? endif ?>
<? if (!$embedded) : ?> <? if (!$embedded) : ?>
</fieldset> </fieldset>
</div> </div>
<div> <div>
<fieldset> <fieldset>
<legend><?= _('Raumsuche') ?></legend> <legend><?= _('Raumsuche') ?></legend>
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
[ [
'type' => 'image', 'type' => 'image',
'class' => 'text-bottom', 'class' => 'text-bottom',
'name' => 'reset_category', 'name' => 'reset_name',
'style' => 'margin-left: 0.2em; margin-top: 0.6em;' 'style' => 'margin-left: 0.2em; margin-top: 0.6em;'
] ]
) ?> ) ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment