/** * Before deleting a floor plan, the user has to confirm it via a * confirmation GUI which is created in this function. */ public function confirmDeleteObject() { if (!$this->permission->checkPrivilege(PRIVC::DELETE_FLOORPLANS)) { ilUtil::sendFailure($this->lng->txt("rep_robj_xrs_no_permission_for_action")); $this->ctrl->redirectByClass('ilinfoscreengui', 'showSummary', 'showSummary'); return false; } $this->tabs->clearTargets(); $this->tabs->setBackTarget($this->lng->txt('rep_robj_xrs_back_to_floor_plans'), $this->ctrl->getLinkTarget($this, 'render')); $cgui = new ilConfirmationGUI(); $cgui->setFormAction($this->ctrl->getFormAction($this)); $fplan = $fplan = new ilRoomSharingFloorPlans($this->pool_id, new ilRoomsharingDatabase($this->pool_id)); // check if floorplan is associated to a room $allRooms = $fplan->getRoomsWithFloorplan((int) $_GET['file_id']); foreach ($allRooms as $room) { $rooms[] = $room["name"]; } if (empty($rooms)) { $cgui->setHeaderText($this->lng->txt("info_delete_sure")); } else { $roomsWithPlan = implode(", ", $rooms); $cgui->setHeaderText($this->lng->txt("info_delete_sure") . '<br>' . $this->lng->txt("rep_robj_xrs_floor_plans_room_assoc") . ' ' . $roomsWithPlan); } // the buttons for confirming and cancelling the deletion $cgui->setCancel($this->lng->txt("cancel"), "render"); $cgui->setConfirm($this->lng->txt("delete"), "removeFloorplan"); // the table which includes the thumbnail picture and the title $mobj = new ilObjMediaObject((int) $_GET['file_id']); $med = $mobj->getMediaItem("Standard"); $target = $med->getThumbnailTarget(); $cgui->addItem('file_id', (int) $_GET['file_id'], $mobj->getTitle(), $target); $this->tpl->setContent($cgui->getHTML()); }
/** * @covers ilRoomSharingFloorPlans::getRoomsWithFloorplan */ public function testGetRoomsWithFloorplan() { $roomIDs = array(1, 2, 3); self::$DBMock->method("getRoomsWithFloorplan")->willReturn($roomIDs); self::assertEquals($roomIDs, self::$floorPlans->getRoomsWithFloorplan(342)); }