diff options
Diffstat (limited to 'includes/pages')
-rw-r--r-- | includes/pages/admin_import.php | 6 | ||||
-rw-r--r-- | includes/pages/admin_rooms.php | 73 | ||||
-rw-r--r-- | includes/pages/user_shifts.php | 2 |
3 files changed, 38 insertions, 43 deletions
diff --git a/includes/pages/admin_import.php b/includes/pages/admin_import.php index e97f95e1..dcf4e0d1 100644 --- a/includes/pages/admin_import.php +++ b/includes/pages/admin_import.php @@ -251,7 +251,7 @@ function admin_import() list($rooms_new, $rooms_deleted) = prepare_rooms($import_file); foreach ($rooms_new as $room) { - $result = Room_create($room, true, true); + $result = Room_create($room, true, null, null); $rooms_import[trim($room)] = $result; } @@ -309,7 +309,7 @@ function prepare_rooms($file) $data = read_xml($file); // Load rooms from db for compare with input - $rooms = DB::select('SELECT `Name`, `RID` FROM `Room` WHERE `FromPentabarf`=\'Y\''); + $rooms = DB::select('SELECT `Name`, `RID` FROM `Room` WHERE `from_frab`=TRUE'); $rooms_db = []; $rooms_import = []; foreach ($rooms as $room) { @@ -348,7 +348,7 @@ function prepare_events($file, $shifttype_id, $add_minutes_start, $add_minutes_e global $rooms_import; $data = read_xml($file); - $rooms = Rooms(true); + $rooms = Rooms(); $rooms_db = []; foreach ($rooms as $room) { $rooms_db[$room['Name']] = $room['RID']; diff --git a/includes/pages/admin_rooms.php b/includes/pages/admin_rooms.php index 9e153bf1..c5b7b610 100644 --- a/includes/pages/admin_rooms.php +++ b/includes/pages/admin_rooms.php @@ -22,8 +22,8 @@ function admin_rooms() foreach ($rooms_source as $room) { $rooms[] = [ 'name' => Room_name_render($room), - 'from_pentabarf' => glyph_bool($room['FromPentabarf'] == 'Y'), - 'public' => glyph_bool($room['show'] == 'Y'), + 'from_frab' => glyph_bool($room['from_frab']), + 'map_url' => glyph_bool(!empty($room['map_url'])), 'actions' => table_buttons([ 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') @@ -35,9 +35,9 @@ function admin_rooms() if ($request->has('show')) { $msg = ''; $name = ''; - $from_pentabarf = ''; - $public = 'Y'; - $number = ''; + $from_frab = false; + $map_url = null; + $description = null; $room_id = 0; $angeltypes_source = DB::select('SELECT `id`, `name` FROM `AngelTypes` ORDER BY `name`'); @@ -49,16 +49,16 @@ function admin_rooms() } if (test_request_int('id')) { - $room = Room($request->input('id'), false); + $room = Room($request->input('id')); if ($room == null) { redirect(page_link_to('admin_rooms')); } $room_id = $request->input('id'); $name = $room['Name']; - $from_pentabarf = $room['FromPentabarf']; - $public = $room['show']; - $number = $room['Number']; + $from_frab = $room['from_frab']; + $map_url = $room['map_url']; + $description = $room['description']; $needed_angeltypes = DB::select( 'SELECT `angel_type_id`, `count` FROM `NeededAngelTypes` WHERE `room_id`=?', @@ -90,20 +90,14 @@ function admin_rooms() $msg .= error(_('Please enter a name.'), true); } - $from_pentabarf = ''; - if ($request->has('from_pentabarf')) { - $from_pentabarf = 'Y'; - } + $from_frab = $request->has('from_frab'); - $public = ''; - if ($request->has('public')) { - $public = 'Y'; + if ($request->has('map_url')) { + $map_url = strip_request_item('map_url'); } - if ($request->has('number')) { - $number = strip_request_item('number'); - } else { - $valid = false; + if ($request->has('description')) { + $description= strip_request_item_nl('description'); } foreach ($angeltypes as $angeltype_id => $angeltype) { @@ -127,33 +121,32 @@ function admin_rooms() UPDATE `Room` SET `Name`=?, - `FromPentabarf`=?, - `show`=?, - `Number`=? + `from_frab`=?, + `map_url`=?, + `description`=? WHERE `RID`=? LIMIT 1 ', [ $name, - $from_pentabarf, - $public, - $number, + (int) $from_frab, + $map_url, + $description, $room_id, ]); engelsystem_log( 'Room updated: ' . $name - . ', pentabarf import: ' . $from_pentabarf - . ', public: ' . $public - . ', number: ' . $number + . ', frab import: ' . ($from_frab ? 'Yes' : '') + . ', map_url: ' . $map_url + . ', description: ' . $description ); } else { - $room_id = Room_create($name, $from_pentabarf, $public, $number); + $room_id = Room_create($name, $from_frab, $map_url, $description); engelsystem_log( 'Room created: ' . $name - . ', pentabarf import: ' - . $from_pentabarf - . ', public: ' . $public - . ', number: ' . $number + . ', frab import: ' . ($from_frab ? 'Yes' : '') + . ', map_url: ' . $map_url + . ', description: ' . $description ); } @@ -191,9 +184,11 @@ function admin_rooms() div('row', [ div('col-md-6', [ form_text('name', _('Name'), $name), - form_checkbox('from_pentabarf', _('Frab import'), $from_pentabarf), - form_checkbox('public', _('Public'), $public), - form_text('number', _('Room number'), $number) + form_checkbox('from_frab', _('Frab import'), $from_frab), + form_text('map_url', _('Map URL'), $map_url), + 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('row', [ @@ -239,8 +234,8 @@ function admin_rooms() msg(), table([ 'name' => _('Name'), - 'from_pentabarf' => _('Frab import'), - 'public' => _('Public'), + 'from_frab' => _('Frab import'), + 'map_url' => _('Map'), 'actions' => '' ], $rooms) ]); diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index ef21ff1b..2871ceb5 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -92,7 +92,7 @@ function update_ShiftsFilter(ShiftsFilter $shiftsFilter, $user_shifts_admin, $da function load_rooms() { $rooms = DB::select( - 'SELECT `RID` AS `id`, `Name` AS `name` FROM `Room` WHERE `show`=\'Y\' ORDER BY `Name`' + 'SELECT `RID` AS `id`, `Name` AS `name` FROM `Room` ORDER BY `Name`' ); if (empty($rooms)) { error(_('The administration has not configured any rooms yet.')); |