|
|
@ -22,8 +22,8 @@ function admin_rooms()
|
|
|
|
foreach ($rooms_source as $room) {
|
|
|
|
foreach ($rooms_source as $room) {
|
|
|
|
$rooms[] = [
|
|
|
|
$rooms[] = [
|
|
|
|
'name' => Room_name_render($room),
|
|
|
|
'name' => Room_name_render($room),
|
|
|
|
'from_pentabarf' => glyph_bool($room['FromPentabarf'] == 'Y'),
|
|
|
|
'from_frab' => glyph_bool($room['from_frab']),
|
|
|
|
'public' => glyph_bool($room['show'] == 'Y'),
|
|
|
|
'map_url' => glyph_bool(!empty($room['map_url'])),
|
|
|
|
'actions' => table_buttons([
|
|
|
|
'actions' => table_buttons([
|
|
|
|
button(page_link_to('admin_rooms', ['show' => 'edit', 'id' => $room['RID']]), _('edit'), 'btn-xs'),
|
|
|
|
button(page_link_to('admin_rooms', ['show' => 'edit', 'id' => $room['RID']]), _('edit'), 'btn-xs'),
|
|
|
|
button(page_link_to('admin_rooms', ['show' => 'delete', 'id' => $room['RID']]), _('delete'), 'btn-xs')
|
|
|
|
button(page_link_to('admin_rooms', ['show' => 'delete', 'id' => $room['RID']]), _('delete'), 'btn-xs')
|
|
|
@ -35,9 +35,9 @@ function admin_rooms()
|
|
|
|
if ($request->has('show')) {
|
|
|
|
if ($request->has('show')) {
|
|
|
|
$msg = '';
|
|
|
|
$msg = '';
|
|
|
|
$name = '';
|
|
|
|
$name = '';
|
|
|
|
$from_pentabarf = '';
|
|
|
|
$from_frab = false;
|
|
|
|
$public = 'Y';
|
|
|
|
$map_url = null;
|
|
|
|
$number = '';
|
|
|
|
$description = null;
|
|
|
|
$room_id = 0;
|
|
|
|
$room_id = 0;
|
|
|
|
|
|
|
|
|
|
|
|
$angeltypes_source = DB::select('SELECT `id`, `name` FROM `AngelTypes` ORDER BY `name`');
|
|
|
|
$angeltypes_source = DB::select('SELECT `id`, `name` FROM `AngelTypes` ORDER BY `name`');
|
|
|
@ -49,16 +49,16 @@ function admin_rooms()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (test_request_int('id')) {
|
|
|
|
if (test_request_int('id')) {
|
|
|
|
$room = Room($request->input('id'), false);
|
|
|
|
$room = Room($request->input('id'));
|
|
|
|
if ($room == null) {
|
|
|
|
if ($room == null) {
|
|
|
|
redirect(page_link_to('admin_rooms'));
|
|
|
|
redirect(page_link_to('admin_rooms'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$room_id = $request->input('id');
|
|
|
|
$room_id = $request->input('id');
|
|
|
|
$name = $room['Name'];
|
|
|
|
$name = $room['Name'];
|
|
|
|
$from_pentabarf = $room['FromPentabarf'];
|
|
|
|
$from_frab = $room['from_frab'];
|
|
|
|
$public = $room['show'];
|
|
|
|
$map_url = $room['map_url'];
|
|
|
|
$number = $room['Number'];
|
|
|
|
$description = $room['description'];
|
|
|
|
|
|
|
|
|
|
|
|
$needed_angeltypes = DB::select(
|
|
|
|
$needed_angeltypes = DB::select(
|
|
|
|
'SELECT `angel_type_id`, `count` FROM `NeededAngelTypes` WHERE `room_id`=?',
|
|
|
|
'SELECT `angel_type_id`, `count` FROM `NeededAngelTypes` WHERE `room_id`=?',
|
|
|
@ -90,20 +90,14 @@ function admin_rooms()
|
|
|
|
$msg .= error(_('Please enter a name.'), true);
|
|
|
|
$msg .= error(_('Please enter a name.'), true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$from_pentabarf = '';
|
|
|
|
$from_frab = $request->has('from_frab');
|
|
|
|
if ($request->has('from_pentabarf')) {
|
|
|
|
|
|
|
|
$from_pentabarf = 'Y';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$public = '';
|
|
|
|
if ($request->has('map_url')) {
|
|
|
|
if ($request->has('public')) {
|
|
|
|
$map_url = strip_request_item('map_url');
|
|
|
|
$public = 'Y';
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($request->has('number')) {
|
|
|
|
if ($request->has('description')) {
|
|
|
|
$number = strip_request_item('number');
|
|
|
|
$description= strip_request_item_nl('description');
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$valid = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($angeltypes as $angeltype_id => $angeltype) {
|
|
|
|
foreach ($angeltypes as $angeltype_id => $angeltype) {
|
|
|
@ -127,33 +121,32 @@ function admin_rooms()
|
|
|
|
UPDATE `Room`
|
|
|
|
UPDATE `Room`
|
|
|
|
SET
|
|
|
|
SET
|
|
|
|
`Name`=?,
|
|
|
|
`Name`=?,
|
|
|
|
`FromPentabarf`=?,
|
|
|
|
`from_frab`=?,
|
|
|
|
`show`=?,
|
|
|
|
`map_url`=?,
|
|
|
|
`Number`=?
|
|
|
|
`description`=?
|
|
|
|
WHERE `RID`=?
|
|
|
|
WHERE `RID`=?
|
|
|
|
LIMIT 1
|
|
|
|
LIMIT 1
|
|
|
|
', [
|
|
|
|
', [
|
|
|
|
$name,
|
|
|
|
$name,
|
|
|
|
$from_pentabarf,
|
|
|
|
(int) $from_frab,
|
|
|
|
$public,
|
|
|
|
$map_url,
|
|
|
|
$number,
|
|
|
|
$description,
|
|
|
|
$room_id,
|
|
|
|
$room_id,
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
engelsystem_log(
|
|
|
|
engelsystem_log(
|
|
|
|
'Room updated: ' . $name
|
|
|
|
'Room updated: ' . $name
|
|
|
|
. ', pentabarf import: ' . $from_pentabarf
|
|
|
|
. ', frab import: ' . ($from_frab ? 'Yes' : '')
|
|
|
|
. ', public: ' . $public
|
|
|
|
. ', map_url: ' . $map_url
|
|
|
|
. ', number: ' . $number
|
|
|
|
. ', description: ' . $description
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$room_id = Room_create($name, $from_pentabarf, $public, $number);
|
|
|
|
$room_id = Room_create($name, $from_frab, $map_url, $description);
|
|
|
|
|
|
|
|
|
|
|
|
engelsystem_log(
|
|
|
|
engelsystem_log(
|
|
|
|
'Room created: ' . $name
|
|
|
|
'Room created: ' . $name
|
|
|
|
. ', pentabarf import: '
|
|
|
|
. ', frab import: ' . ($from_frab ? 'Yes' : '')
|
|
|
|
. $from_pentabarf
|
|
|
|
. ', map_url: ' . $map_url
|
|
|
|
. ', public: ' . $public
|
|
|
|
. ', description: ' . $description
|
|
|
|
. ', number: ' . $number
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -191,9 +184,11 @@ function admin_rooms()
|
|
|
|
div('row', [
|
|
|
|
div('row', [
|
|
|
|
div('col-md-6', [
|
|
|
|
div('col-md-6', [
|
|
|
|
form_text('name', _('Name'), $name),
|
|
|
|
form_text('name', _('Name'), $name),
|
|
|
|
form_checkbox('from_pentabarf', _('Frab import'), $from_pentabarf),
|
|
|
|
form_checkbox('from_frab', _('Frab import'), $from_frab),
|
|
|
|
form_checkbox('public', _('Public'), $public),
|
|
|
|
form_text('map_url', _('Map URL'), $map_url),
|
|
|
|
form_text('number', _('Room number'), $number)
|
|
|
|
form_info('', _('The map url is used to display an iframe on the room page.')),
|
|
|
|
|
|
|
|
form_textarea('description', _('Description'), $description),
|
|
|
|
|
|
|
|
form_info('', _('Please use markdown for the description.')),
|
|
|
|
]),
|
|
|
|
]),
|
|
|
|
div('col-md-6', [
|
|
|
|
div('col-md-6', [
|
|
|
|
div('row', [
|
|
|
|
div('row', [
|
|
|
@ -239,8 +234,8 @@ function admin_rooms()
|
|
|
|
msg(),
|
|
|
|
msg(),
|
|
|
|
table([
|
|
|
|
table([
|
|
|
|
'name' => _('Name'),
|
|
|
|
'name' => _('Name'),
|
|
|
|
'from_pentabarf' => _('Frab import'),
|
|
|
|
'from_frab' => _('Frab import'),
|
|
|
|
'public' => _('Public'),
|
|
|
|
'map_url' => _('Map'),
|
|
|
|
'actions' => ''
|
|
|
|
'actions' => ''
|
|
|
|
], $rooms)
|
|
|
|
], $rooms)
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|