feature/template #6
@@ -2,6 +2,7 @@
|
|||||||
namespace App\Controllers\board;
|
namespace App\Controllers\board;
|
||||||
|
|
||||||
use App\Controllers\BaseController;
|
use App\Controllers\BaseController;
|
||||||
|
use App\Libraries\MyUpload;
|
||||||
use App\Models\board\NoticeModel;
|
use App\Models\board\NoticeModel;
|
||||||
|
|
||||||
class Notice extends BaseController
|
class Notice extends BaseController
|
||||||
@@ -108,7 +109,7 @@ class Notice extends BaseController
|
|||||||
// 공지사항 작성
|
// 공지사항 작성
|
||||||
public function actWrite()
|
public function actWrite()
|
||||||
{
|
{
|
||||||
|
$lib = new MyUpload();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -125,6 +126,37 @@ class Notice extends BaseController
|
|||||||
$file = $this->request->getFile('file');
|
$file = $this->request->getFile('file');
|
||||||
|
|
||||||
if ($file && $file->isValid() && !$file->hasMoved()) {
|
if ($file && $file->isValid() && !$file->hasMoved()) {
|
||||||
|
|
||||||
|
$uploadPath = "/upload/notice/" . date('Ymd') . "/";
|
||||||
|
|
||||||
|
$arrUploadfile = [];
|
||||||
|
if ($file->isValid() && !$file->hasMoved()) {
|
||||||
|
$uploadData = $lib->do_upload2($file, $uploadPath);
|
||||||
|
|
||||||
|
if ($uploadData !== false) {
|
||||||
|
$arrUploadfile[] = $uploadData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($arrUploadfile)) {
|
||||||
|
foreach ($arrUploadfile as $key => $uploadFile) {
|
||||||
|
$data['file'] = [
|
||||||
|
'file_sq' => $this->request->getPost('file_sq'),
|
||||||
|
'orig_name' => $uploadFile['origin_name'],
|
||||||
|
'new_name' => $uploadFile['file_name'],
|
||||||
|
'file_path' => $uploadPath, // 필요에 따라 상대경로로만 저장
|
||||||
|
'ext' => '.' . $uploadFile['ext'],
|
||||||
|
'size' => $file->getSize(),
|
||||||
|
'img_yn' => null,
|
||||||
|
// 높이/폭은 나중에 getimagesize 등으로 구해도 됨
|
||||||
|
'img_height' => null,
|
||||||
|
'img_width' => null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
$origName = $file->getClientName();
|
$origName = $file->getClientName();
|
||||||
$ext = $file->getClientExtension();
|
$ext = $file->getClientExtension();
|
||||||
$size = $file->getSize();
|
$size = $file->getSize();
|
||||||
@@ -154,6 +186,8 @@ class Notice extends BaseController
|
|||||||
'img_height' => null,
|
'img_height' => null,
|
||||||
'img_width' => null,
|
'img_width' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -201,6 +235,8 @@ class Notice extends BaseController
|
|||||||
// 공지사항 수정요청
|
// 공지사항 수정요청
|
||||||
public function actModify()
|
public function actModify()
|
||||||
{
|
{
|
||||||
|
$lib = new MyUpload();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
@@ -216,6 +252,36 @@ class Notice extends BaseController
|
|||||||
$file = $this->request->getFile('file');
|
$file = $this->request->getFile('file');
|
||||||
|
|
||||||
if ($file && $file->isValid() && !$file->hasMoved()) {
|
if ($file && $file->isValid() && !$file->hasMoved()) {
|
||||||
|
$uploadPath = "/upload/notice/" . date('Ymd') . "/";
|
||||||
|
|
||||||
|
$arrUploadfile = [];
|
||||||
|
if ($file->isValid() && !$file->hasMoved()) {
|
||||||
|
$uploadData = $lib->do_upload2($file, $uploadPath);
|
||||||
|
|
||||||
|
if ($uploadData !== false) {
|
||||||
|
$arrUploadfile[] = $uploadData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($arrUploadfile)) {
|
||||||
|
foreach ($arrUploadfile as $key => $uploadFile) {
|
||||||
|
$data['file'] = [
|
||||||
|
'file_sq' => $this->request->getPost('file_sq'),
|
||||||
|
'orig_name' => $uploadFile['origin_name'],
|
||||||
|
'new_name' => $uploadFile['file_name'],
|
||||||
|
'file_path' => $uploadPath, // 필요에 따라 상대경로로만 저장
|
||||||
|
'ext' => '.' . $uploadFile['ext'],
|
||||||
|
'size' => $file->getSize(),
|
||||||
|
'img_yn' => null,
|
||||||
|
// 높이/폭은 나중에 getimagesize 등으로 구해도 됨
|
||||||
|
'img_height' => null,
|
||||||
|
'img_width' => null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
$origName = $file->getClientName();
|
$origName = $file->getClientName();
|
||||||
$ext = $file->getClientExtension();
|
$ext = $file->getClientExtension();
|
||||||
$size = $file->getSize();
|
$size = $file->getSize();
|
||||||
@@ -247,6 +313,8 @@ class Notice extends BaseController
|
|||||||
'img_height' => null,
|
'img_height' => null,
|
||||||
'img_width' => null,
|
'img_width' => null,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ class NoticeModel extends Model
|
|||||||
$query = $this->db->query($sql, [$id]);
|
$query = $this->db->query($sql, [$id]);
|
||||||
$notice = $query->getRowArray();
|
$notice = $query->getRowArray();
|
||||||
|
|
||||||
$sql = "SELECT bbs_sq, file_sq, file_name, file_path, file_ext, file_size, img_yn, img_height, img_width, orig_name FROM bbs_file_notice WHERE bbs_sq = ?" .
|
$sql = "SELECT bbs_sq, file_sq, file_name, file_path, file_ext, file_size, img_yn, img_height, img_width, orig_name, cloud_upload_yn FROM bbs_file_notice WHERE bbs_sq = ?" .
|
||||||
" and use_yn = 'Y'";
|
" and use_yn = 'Y'";
|
||||||
$query = $this->db->query($sql, [$id]);
|
$query = $this->db->query($sql, [$id]);
|
||||||
$files = $query->getRowArray();
|
$files = $query->getRowArray();
|
||||||
@@ -152,7 +152,7 @@ class NoticeModel extends Model
|
|||||||
$f = $data['file'];
|
$f = $data['file'];
|
||||||
|
|
||||||
$sql = "INSERT INTO bbs_file_notice
|
$sql = "INSERT INTO bbs_file_notice
|
||||||
(bbs_sq, file_name, file_path, file_ext, file_size, img_yn, img_height, img_width, orig_name)
|
(bbs_sq, file_name, file_path, file_ext, file_size, img_yn, img_height, img_width, orig_name, cloud_upload_yn)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
|
|
||||||
$this->db->query($sql, [
|
$this->db->query($sql, [
|
||||||
@@ -165,6 +165,7 @@ class NoticeModel extends Model
|
|||||||
$f['img_height'] ?? null,
|
$f['img_height'] ?? null,
|
||||||
$f['img_width'] ?? null,
|
$f['img_width'] ?? null,
|
||||||
$f['orig_name'] ?? '',
|
$f['orig_name'] ?? '',
|
||||||
|
'Y'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +202,7 @@ class NoticeModel extends Model
|
|||||||
|
|
||||||
if (empty($f['file_sq'])) {
|
if (empty($f['file_sq'])) {
|
||||||
$sql = "INSERT INTO bbs_file_notice
|
$sql = "INSERT INTO bbs_file_notice
|
||||||
(bbs_sq, file_name, file_path, file_ext, file_size, img_yn, img_height, img_width, orig_name)
|
(bbs_sq, file_name, file_path, file_ext, file_size, img_yn, img_height, img_width, orig_name, cloud_upload_yn)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
|
|
||||||
$this->db->query($sql, [
|
$this->db->query($sql, [
|
||||||
@@ -214,6 +215,7 @@ class NoticeModel extends Model
|
|||||||
$f['img_height'] ?? null,
|
$f['img_height'] ?? null,
|
||||||
$f['img_width'] ?? null,
|
$f['img_width'] ?? null,
|
||||||
$f['orig_name'] ?? '',
|
$f['orig_name'] ?? '',
|
||||||
|
'Y'
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$sql = "UPDATE bbs_file_notice SET
|
$sql = "UPDATE bbs_file_notice SET
|
||||||
|
|||||||
@@ -101,6 +101,11 @@
|
|||||||
// 3. 끝 슬래시 정리
|
// 3. 끝 슬래시 정리
|
||||||
$path = rtrim($path, '/');
|
$path = rtrim($path, '/');
|
||||||
switch ($path) {
|
switch ($path) {
|
||||||
|
case "/board/notice/write":
|
||||||
|
case "/board/notice/modify":
|
||||||
|
case "/board/notice/detail":
|
||||||
|
$path = "/board/notice/lists";
|
||||||
|
break;
|
||||||
case "/article/apt/detail":
|
case "/article/apt/detail":
|
||||||
$path = "/article/apt/lists";
|
$path = "/article/apt/lists";
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -33,9 +33,16 @@
|
|||||||
<th>첨부파일</th>
|
<th>첨부파일</th>
|
||||||
<td colspan="5" style="min-height: 200px;">
|
<td colspan="5" style="min-height: 200px;">
|
||||||
<div>
|
<div>
|
||||||
<a href="<?= site_url('/board/notice/download/' . $files['file_sq']) ?>">
|
<?php if ($files['cloud_upload_yn'] === "Y"): ?>
|
||||||
<?= esc($files['orig_name']) ?>
|
<?php $link = NCLOUD_OBJECT_STORAGE_URL . $files['file_path'] . $files['file_name']; ?>
|
||||||
</a>
|
<a href="<?= $link ?>" download="<?= $files['orig_name'] ?>">
|
||||||
|
<?= esc($files['orig_name']) ?>
|
||||||
|
</a>
|
||||||
|
<?php else: ?>
|
||||||
|
<a href="<?= site_url('/board/notice/download/' . $files['file_sq']) ?>">
|
||||||
|
<?= esc($files['orig_name']) ?>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 130 KiB |
|
Before Width: | Height: | Size: 130 KiB |