_model === null) { return $this->_model = new FileModel(); } return $this->_model; } public function getFileEntity(): FileEntity { return new FileEntity(); } public function getUser(): UserEntity { if ($this->_user === null) { throw new \Exception("사용자정보가 없습니다."); } return $this->_user; } public function setUser(UserEntity $user): void { $this->_user = $user; } public function getBoardName(): string { if ($this->_boardName === null) { throw new \Exception("BoardModel이 지정되지 않았습니다."); } return $this->_boardName; } public function setBoardName(string $boardName): void { $this->_boardName = $boardName; } public function getBoardTable(): string { if ($this->_boardTable === null) { throw new \Exception("BoardModel이 지정되지 않았습니다."); } return $this->_boardTable; } public function setBoardTable(string $boardTable): void { $this->_boardTable = $boardTable; } public function getBoardLevel(): int { if ($this->_boardLevel === null) { throw new \Exception("BoardModel Level이 지정되지 않았습니다."); } return intval($this->_boardLevel); } public function setBoardLevel(string $boardLevel): void { $this->_boardLevel = $boardLevel; } private function create_small_image(FileEntity $entity, int $file_sequence): FileEntity { $fullPath = WRITEPATH . $this->getUploadPath() . DIRECTORY_SEPARATOR . $this->getPath(); $image = new ImageLibrary( $fullPath, $fullPath . DIRECTORY_SEPARATOR . "small" ); $image->setDebug($this->getDebug()); //Small 디렉토리 생성 $image->makeDirectory($image->getDestinationPath()); $dstfile = $image->make_small_image($entity->getTitle()); log_message("notice", __FUNCTION__ . " {$file_sequence}번째 {$dstfile} 작업 완료"); return $entity; } //망보드 파일관리 table에 등록 private function create_db(FileEntity $entity, int $file_sequence): FileEntity { // log_message("debug", $this->getModel()->getTable() . " Table에 {$file_sequence}번째 등록 준비->{$entity->getTitle()}|{$entity->getMimeType()}"); $entity->user_pid = $this->getUser()->getPK(); $entity->user_name = $this->getUser()->getTitle(); $entity->board_name = $this->getBoardName(); $entity->table_name = $this->getBoardTable(); $entity->reg_date = date("Y-m-d H:i:s"); $entity->file_caption = $entity->getTitle(); $entity->file_alt = $entity->getTitle(); $entity->file_description = "Filedata"; $entity = $this->getModel()->create($entity); log_message("notice", __FUNCTION__ . " {$file_sequence}번째 작업 완료"); return $entity; } public function save(string $fileName, string $mediaType, string $content, int $file_sequence): FileEntity { $entity = parent::save($fileName, $mediaType, $content, $file_sequence); $entity = $this->create_small_image($entity, $file_sequence); $entity = $this->create_db($entity, $file_sequence); return $entity; } public function setBoardPID(array $fileEntitys, int $board_pid) { //망보드 파일관리툴에 등록된 파일게시물에 등록한 게시판번호 수정하기 foreach ($fileEntitys as $fileEntity) { $fileEntity->board_pid = $board_pid; $this->getModel()->modify($fileEntity); } log_message("notice", __FUNCTION__ . " 작업 완료"); } }