Add navigation component to RoomManager

This commit is contained in:
Ivymaster
2026-05-06 11:41:10 +02:00
parent 05814383d4
commit 081703e0f8
10 changed files with 235 additions and 99 deletions
+12 -12
View File
@@ -32,15 +32,15 @@ class Ort extends FHCAPI_Controller
public function __construct()
{
parent::__construct([
'getAllRooms' => self::PERM_LOGGED,
'getAllRooms' => array('basis/ort:r'),
'getRooms' => self::PERM_LOGGED,
'getTypes' => self::PERM_LOGGED,
'ContentID' => self::PERM_LOGGED,
'getOrtKurzbzContent' => self::PERM_LOGGED,
'getRoom' => self::PERM_LOGGED,
'createRoom' => self::PERM_LOGGED,
'updateRoom' => self::PERM_LOGGED,
'deleteRoom' => self::PERM_LOGGED,
'createRoom' => array('basis/ort:rw'),
'updateRoom' => array('basis/ort:rw'),
'deleteRoom' => array('basis/ort:rw'),
]);
$this->load->library('form_validation');
@@ -82,16 +82,16 @@ class Ort extends FHCAPI_Controller
$queryWhereFragments = [];
$searchableIdAttributes = ['standort_id', 'oe_kurzbz', 'gebteil'];
$searchableTextAttributes = ['ort_kurzbz', 'bezeichnung', 'planbezeichnung', 'oe_kurzbz', 'oe_bezeichnung'];
$searchableIdAttributes = ['standort_id', 'gebteil'];
$searchableTextAttributes = ['ort_kurzbz', 'parent_ort_kurzbz', 'bezeichnung', 'planbezeichnung', 'oe_kurzbz', 'oe_bezeichnung'];
$searchableBooleanAttributes = ['lehre', 'reservieren', 'aktiv'];
$searchableNumericAttributes = ['max_person', 'arbeitsplaetze'];
$searchableNumericAttributes = ['max_person', 'arbeitsplaetze', 'kosten', 'stockwerk'];
$searchableNumericSpanAttributes = ['m2'];
foreach ($searchableIdAttributes as $attribute) {
if (isset($filter[$attribute]) && $filter[$attribute] !== '') {
$queryWhereFragments[] = "public.tbl_ort.$attribute = ?";
$filterData[] = $filter[$attribute];
$filterData[] = trim($filter[$attribute]);
}
}
@@ -102,7 +102,7 @@ class Ort extends FHCAPI_Controller
}
if (isset($filter[$attribute]) && $filter[$attribute] !== '') {
$queryWhereFragments[] = "$tableAttribute ILIKE ?";
$filterData[] = '%' . $filter[$attribute] . '%';
$filterData[] = '%' . trim($filter[$attribute]) . '%';
}
}
@@ -116,15 +116,15 @@ class Ort extends FHCAPI_Controller
foreach ($searchableNumericAttributes as $attribute) {
if (isset($filter[$attribute]) && $filter[$attribute] !== '') {
$queryWhereFragments[] = "public.tbl_ort.$attribute = ?";
$filterData[] = $filter[$attribute];
$filterData[] = trim($filter[$attribute]);
}
}
foreach ($searchableNumericSpanAttributes as $attribute) {
if (isset($filter[$attribute]) && $filter[$attribute] !== '') {
$queryWhereFragments[] = "public.tbl_ort.$attribute >= ? AND public.tbl_ort.$attribute <= ?";
$filterData[] = $filter[$attribute] - 1;
$filterData[] = $filter[$attribute] + 1;
$filterData[] = trim($filter[$attribute]) - 1;
$filterData[] = trim($filter[$attribute]) + 1;
}
}
@@ -33,9 +33,9 @@ class RoomToRoomTypeApi extends FHCAPI_Controller
{
// NOTE(chris): additional permission checks will be done in SearchBarLib
parent::__construct([
'getRoomToRoomTypeRelationsByRoomShortCode' => self::PERM_LOGGED,
'createRoomToRoomTypeRelation' => self::PERM_LOGGED,
'deleteRoomToRoomTypeRelation' => self::PERM_LOGGED,
'getRoomToRoomTypeRelationsByRoomShortCode' => array('basis/ort:r'),
'createRoomToRoomTypeRelation' => array('basis/ort:rw'),
'deleteRoomToRoomTypeRelation' => array('basis/ort:rw'),
]);
$this->load->library('form_validation');
@@ -101,6 +101,7 @@ class RoomToRoomTypeApi extends FHCAPI_Controller
public function deleteRoomToRoomTypeRelation() {
$this->form_validation->set_rules('roomShortCode', 'roomShortCode', 'required');
$this->form_validation->set_rules('roomTypeShortCode', 'roomTypeShortCode', 'required');
$this->form_validation->set_rules('hierarchy', 'hierarchy', 'required|integer');
if ($this->form_validation->run() === false) {
return $this->terminateWithError(validation_errors());
@@ -109,6 +110,7 @@ class RoomToRoomTypeApi extends FHCAPI_Controller
$result = $this->OrtRoomTypeModel->db->delete($this->OrtRoomTypeModel->getDbTable(), [
'ort_kurzbz' => $this->input->post('roomShortCode'),
'raumtyp_kurzbz' => $this->input->post('roomTypeShortCode'),
'hierarchie' => $this->input->post('hierarchy'),
]);
if ($result === false) {
@@ -32,8 +32,8 @@ class RoomTypeApi extends FHCAPI_Controller
public function __construct()
{
parent::__construct([
'getAllRoomTypes' => self::PERM_LOGGED,
'createRoomType' => self::PERM_LOGGED,
'getAllRoomTypes' => array('basis/ort:r'),
'createRoomType' => array('basis/ort:rw'),
]);
$this->load->library('form_validation');