/** * Retrieves the data that should be populated into the table. */ private function getItems() { $floorplans = new ilRoomSharingFloorPlans($this->pool_id, new ilRoomsharingDatabase($this->pool_id)); $data = $floorplans->getAllFloorPlans($this->pool_id); $this->setMaxCount(count($data)); $this->setData($data); }
/** * This function saves the updated information of a floorplan. In order for * this function to be called a user has to click the 'save' button in the * edit form. */ public function updateObject() { if (!$this->permission->checkPrivilege(PRIVC::EDIT_FLOORPLANS)) { ilUtil::sendFailure($this->lng->txt("rep_robj_xrs_no_permission_for_action")); $this->ctrl->redirectByClass('ilinfoscreengui', 'showSummary', 'showSummary'); return false; } $file_id = (int) $_POST['file_id']; $form = $this->initForm($a_mode = "edit", $file_id); if ($form->checkInput()) { $fplan = new ilRoomSharingFloorPlans($this->pool_id, new ilRoomsharingDatabase($this->pool_id)); $title_new = $form->getInput("title"); $desc_new = $form->getInput("description"); try { if ($form->getInput("file_mode") === "keep") { $fplan->updateFloorPlanInfos($file_id, $title_new, $desc_new); } else { $file_new = $form->getInput("upload_file"); $fplan->updateFloorPlanInfosAndFile($file_id, $title_new, $desc_new, $file_new); } ilUtil::sendSuccess($this->lng->txt("rep_robj_xrs_floor_plans_edited"), true); $this->renderObject(); } catch (ilRoomSharingFloorplanException $exc) { ilUtil::sendFailure($this->lng->txt($exc->getMessage()), true); $this->resetView($form); } } else { $this->resetView($form); } }
/** * @covers ilRoomSharingFloorPlans::addFloorPlan * @expectedException ilRoomSharingFloorplanException * @expectedExceptionMessage rep_robj_xrs_floor_plans_upload_error */ public function testAddFloorPlanEmptyFile() { $this->prepareAddFloorPlan(); $newfile = array("format" => "image/bmp", "filename" => "NewFloorplan", "size" => 0); self::$floorPlans->addFloorPlan("Videossas", "Newest plan", $newfile); }