This commit is contained in:
135
app/Views/pages/board/notice.php
Normal file
135
app/Views/pages/board/notice.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?= $this->extend('layouts/main') ?>
|
||||
|
||||
<?= $this->section('content') ?>
|
||||
<style>
|
||||
#noticeList tbody tr {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 col-xl-12">
|
||||
<div class="main-card mb-3 card">
|
||||
<div class="card-body">
|
||||
<form class="row g-3 align-items-center" id="frm_srch_info" onsubmit="return false;">
|
||||
|
||||
<!-- 검색타입 -->
|
||||
<div class="col-md-2">
|
||||
<select class="form-control" name="srchType">
|
||||
<option value="">선택</option>
|
||||
<option value="1">제목</option>
|
||||
<option value="2">작성자</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- 검색어 -->
|
||||
<div class="col-md-2">
|
||||
<input name="srchTxt" type="text" class="form-control" placeholder="검색어 입력">
|
||||
</div>
|
||||
|
||||
<!-- 버튼 -->
|
||||
<div class="col-md-1">
|
||||
<button type="button" class="btn btn-success btn-transition w-100" id="btnSearch">
|
||||
검색
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12 col-xl-12">
|
||||
<div class="main-card mb-3 card">
|
||||
<div class="card-header">공지사항</div>
|
||||
<div class="card-body">
|
||||
<table id="noticeList" class="table table-hover table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>번호</th>
|
||||
<th>제목</th>
|
||||
<th>글쓴이</th>
|
||||
<th>날짜</th>
|
||||
<th>조회</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!-- 여기는 비워둠: AJAX로 채움 -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button class="mb-2 me-2 btn-transition btn btn-outline-primary"
|
||||
onclick="location.href='/board/notice/write'">글쓰기</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css" />
|
||||
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
|
||||
<script defer src="/architectui/assets/js/datatable.kor.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function () {
|
||||
|
||||
// 혹시 기존 데모가 자동으로 초기화했다면 파괴 후 다시 초기화
|
||||
// if ($.fn.DataTable.isDataTable('#noticeList')) {
|
||||
// $('#noticeList').DataTable().destroy();
|
||||
// }
|
||||
|
||||
let table = $('#noticeList').DataTable({
|
||||
language: lang_kor,
|
||||
processing: true,
|
||||
serverSide: false,
|
||||
ajax: {
|
||||
url: '/board/notice/getNoticeList',
|
||||
type: 'GET',
|
||||
data: function (d) {
|
||||
d.srchType = $("#frm_srch_info [name=srchType]").val()
|
||||
d.srchTxt = $("#frm_srch_info [name=srchTxt]").val()
|
||||
|
||||
d.start = d.start || 0
|
||||
d.length = d.length || 10
|
||||
}
|
||||
},
|
||||
"columnDefs": [
|
||||
{ 'targets': '_all', "defaultContent": "" },
|
||||
{ 'className': 'text-center', 'targets': [0, 2, 3, 4] },
|
||||
],
|
||||
columns: [
|
||||
{
|
||||
"data": null,
|
||||
"width": "50px",
|
||||
"render": function (data, type, row, meta) {
|
||||
return meta.row + meta.settings._iDisplayStart + 1;
|
||||
}
|
||||
},
|
||||
{ data: 'subject' },
|
||||
{ data: 'insert_nm', "width": "100px" },
|
||||
{ data: 'insert_tm', "width": "150px" },
|
||||
{ data: 'hit', "width": "100px" }
|
||||
],
|
||||
// 옵션들 예시
|
||||
paging: true,
|
||||
searching: false,
|
||||
ordering: false,
|
||||
serverSide: true,
|
||||
order: [[3, 'desc']]
|
||||
});
|
||||
|
||||
|
||||
$('#noticeList tbody').on('click', 'tr', function () {
|
||||
const rowData = table.row(this).data();
|
||||
if (!rowData) return;
|
||||
|
||||
const id = rowData.bbs_sq;
|
||||
location.href = "<?= site_url('board/notice/detail') ?>/" + id;
|
||||
});
|
||||
|
||||
// [검색] 버튼 눌렀을 때 다시 조회
|
||||
$('#btnSearch').on('click', function () {
|
||||
table.ajax.reload();
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<?= $this->endSection() ?>
|
||||
127
app/Views/pages/board/noticeDetail.php
Normal file
127
app/Views/pages/board/noticeDetail.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?= $this->extend('layouts/main') ?>
|
||||
|
||||
<?= $this->section('content') ?>
|
||||
|
||||
<h1>공지사항</h1>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12 col-xl-12">
|
||||
<div class="main-card mb-3 card">
|
||||
<div class="card-body">
|
||||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th style="width:150px;">제목</th>
|
||||
<td colspan="5"><?= $notice['subject'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>작성자</th>
|
||||
<td><?= $notice['insert_nm'] ?></td>
|
||||
<th style="width:150px;">작성일</th>
|
||||
<td><?= $notice['insert_tm'] ?></td>
|
||||
<th>조회수</th>
|
||||
<td><?= $notice['hit'] ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>내용</th>
|
||||
<td colspan="5" style="min-height: 200px;">
|
||||
<?= $notice['content'] ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if (!empty($files)): ?>
|
||||
<tr>
|
||||
<th>첨부파일</th>
|
||||
<td colspan="5" style="min-height: 200px;">
|
||||
<div>
|
||||
<a href="<?= site_url('/board/notice/download/' . $files['file_sq']) ?>">
|
||||
<?= esc($files['orig_name']) ?>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button class="mb-2 me-2 btn-transition btn btn-outline-primary"
|
||||
onclick="location.href='/board/notice/lists'">목록</button>
|
||||
<button class="mb-2 me-2 btn-transition btn btn-outline-primary"
|
||||
onclick="location.href='/board/notice/modify/<?= $notice['bbs_sq'] ?>'">수정</button>
|
||||
<button class="mb-2 me-2 btn-transition btn btn-outline-primary" id="btn_remove">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
const tpl = document.querySelector('.my-loader-template');
|
||||
|
||||
$(function () {
|
||||
|
||||
$("#btn_remove").on("click", function () {
|
||||
|
||||
swal.fire({
|
||||
text: "삭제 하시겠습니까?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "예",
|
||||
cancelButtonText: "아니오",
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: '/board/notice/remove',
|
||||
contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
|
||||
method: 'POST',
|
||||
data: { bbs_sq: <?= $notice['bbs_sq'] ?> },
|
||||
beforeSend: function () {
|
||||
blockUI.blockPage({
|
||||
message: tpl
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
blockUI.unblockPage()
|
||||
},
|
||||
error: function (xhr, error, thrown) {
|
||||
blockUI.unblockPage()
|
||||
var msg = "";
|
||||
if (xhr.responseText != null) {
|
||||
msg = xhr.responseText
|
||||
} else {
|
||||
msg = "잠시후 다시 시도해 주세요."
|
||||
}
|
||||
|
||||
Swal.fire({
|
||||
title: msg,
|
||||
icon: "error",
|
||||
draggable: true
|
||||
})
|
||||
},
|
||||
success: function (result) {
|
||||
|
||||
if (result.code == '0') {
|
||||
location.replace('/board/notice/lists')
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: result.msg,
|
||||
icon: "error",
|
||||
draggable: true
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
<?= $this->endSection() ?>
|
||||
134
app/Views/pages/board/noticeModify.php
Normal file
134
app/Views/pages/board/noticeModify.php
Normal file
@@ -0,0 +1,134 @@
|
||||
<?= $this->extend('layouts/main') ?>
|
||||
|
||||
<?= $this->section('content') ?>
|
||||
|
||||
<h1>공지사항</h1>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12 col-xl-12">
|
||||
<div class="main-card mb-3 card">
|
||||
<div class="card-body">
|
||||
<form class="form-control" id="frm_board_info" enctype="multipart/form-data">
|
||||
<input type="hidden" name="bbs_sq" value="<?= $notice['bbs_sq'] ?>">
|
||||
<div class="position-relative mb-3">
|
||||
<label for="subject" class="form-label">제목</label>
|
||||
<input name="subject" id="subject" type="text" class="form-control"
|
||||
value="<?= $notice['subject'] ?>">
|
||||
</div>
|
||||
<div class="position-relative mb-3">
|
||||
<label for="subject" class="form-label">내용</label>
|
||||
<textarea class="form-control" name="content" id="content" rows="10"
|
||||
cols="100"><?= $notice['content'] ?></textarea>
|
||||
</div>
|
||||
<div class="position-relative mb-3">
|
||||
<label for="file" class="form-label">첨부파일</label>
|
||||
<input name="file" id="file" type="file" class="form-control">
|
||||
</div>
|
||||
<?php if (!empty($files)): ?>
|
||||
<input type="hidden" name="file_sq" value="<?= $files['file_sq'] ?>">
|
||||
<div class="position-relative mb-3">
|
||||
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button class="mb-2 me-2 btn btn-primary" id="btn_save">저장</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<link href="https://cdn.jsdelivr.net/npm/froala-editor@latest/css/froala_editor.pkgd.min.css" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<script type="text/javascript"
|
||||
src="https://cdn.jsdelivr.net/npm/froala-editor@latest/js/froala_editor.pkgd.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
const editorKey = '5OA4gF4D3I3G3B6C4D-13TMIBDIa2NTMNZFFPFZe2a1Id1f1I1fA8D6C4F4G3H3I2A18A15A6==';
|
||||
const tpl = document.querySelector('.my-loader-template');
|
||||
|
||||
$(function () {
|
||||
editor = new FroalaEditor("#content", {
|
||||
fileUpload: true
|
||||
, 'key': editorKey
|
||||
, 'height': 150
|
||||
, toolbarButtons: [
|
||||
'bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript', 'fontFamily', 'fontSize',
|
||||
'color', 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', 'quote', 'insertHR',
|
||||
'undo', 'redo', 'clearFormatting', 'selectAll', 'html'
|
||||
]
|
||||
, toolbarButtonsXS: [
|
||||
'bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript', 'fontFamily', 'fontSize',
|
||||
'color', 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', 'quote', 'insertHR',
|
||||
'undo', 'redo', 'clearFormatting', 'selectAll', 'html'
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
$("#btn_save").on("click", function () {
|
||||
|
||||
swal.fire({
|
||||
text: "저장 하시겠습니까?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "예",
|
||||
cancelButtonText: "아니오",
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: '/board/notice/actModify',
|
||||
method: 'POST',
|
||||
data: new FormData($("#frm_board_info")[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
beforeSend: function () {
|
||||
blockUI.blockPage({
|
||||
message: tpl
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
blockUI.unblockPage()
|
||||
},
|
||||
error: function (xhr, error, thrown) {
|
||||
blockUI.unblockPage()
|
||||
var msg = "";
|
||||
if (xhr.responseText != null) {
|
||||
msg = xhr.responseText
|
||||
} else {
|
||||
msg = "잠시후 다시 시도해 주세요."
|
||||
}
|
||||
|
||||
Swal.fire({
|
||||
title: msg,
|
||||
icon: "error",
|
||||
draggable: true
|
||||
})
|
||||
},
|
||||
success: function (result) {
|
||||
|
||||
if (result.code == '0') {
|
||||
location.replace('/board/notice/lists')
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: result.msg,
|
||||
icon: "error",
|
||||
draggable: true
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
});
|
||||
</script>
|
||||
<?= $this->endSection() ?>
|
||||
126
app/Views/pages/board/noticeWrite.php
Normal file
126
app/Views/pages/board/noticeWrite.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?= $this->extend('layouts/main') ?>
|
||||
|
||||
<?= $this->section('content') ?>
|
||||
|
||||
<h1>공지사항</h1>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12 col-xl-12">
|
||||
<div class="main-card mb-3 card">
|
||||
<div class="card-body">
|
||||
<form class="form-control" id="frm_board_info" enctype="multipart/form-data">
|
||||
<div class="position-relative mb-3">
|
||||
<label for="subject" class="form-label">제목</label>
|
||||
<input name="subject" id="subject" type="text" class="form-control">
|
||||
</div>
|
||||
<div class="position-relative mb-3">
|
||||
<label for="subject" class="form-label">내용</label>
|
||||
<textarea class="form-control" name="content" id="content" rows="10" cols="100"></textarea>
|
||||
</div>
|
||||
<div class="position-relative mb-3">
|
||||
<label for="file" class="form-label">첨부파일</label>
|
||||
<input name="file" id="file" type="file" class="form-control">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button class="mb-2 me-2 btn btn-primary" id="btn_save">저장</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- <script src="https://cdn.ckeditor.com/4.12.1/standard/ckeditor.js"></script> -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/froala-editor@latest/css/froala_editor.pkgd.min.css" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<script type="text/javascript"
|
||||
src="https://cdn.jsdelivr.net/npm/froala-editor@latest/js/froala_editor.pkgd.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
const editorKey = '5OA4gF4D3I3G3B6C4D-13TMIBDIa2NTMNZFFPFZe2a1Id1f1I1fA8D6C4F4G3H3I2A18A15A6==';
|
||||
const tpl = document.querySelector('.my-loader-template');
|
||||
|
||||
$(function () {
|
||||
editor = new FroalaEditor("#content", {
|
||||
fileUpload: true
|
||||
, 'key': editorKey
|
||||
, 'height': 150
|
||||
, toolbarButtons: [
|
||||
'bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript', 'fontFamily', 'fontSize',
|
||||
'color', 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', 'quote', 'insertHR',
|
||||
'undo', 'redo', 'clearFormatting', 'selectAll', 'html'
|
||||
]
|
||||
, toolbarButtonsXS: [
|
||||
'bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript', 'fontFamily', 'fontSize',
|
||||
'color', 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', 'quote', 'insertHR',
|
||||
'undo', 'redo', 'clearFormatting', 'selectAll', 'html'
|
||||
]
|
||||
})
|
||||
|
||||
|
||||
$("#btn_save").on("click", function () {
|
||||
|
||||
swal.fire({
|
||||
text: "저장 하시겠습니까?",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonText: "예",
|
||||
cancelButtonText: "아니오",
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: '/board/notice/actWrite',
|
||||
method: 'POST',
|
||||
data: new FormData($("#frm_board_info")[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
beforeSend: function () {
|
||||
blockUI.blockPage({
|
||||
message: tpl
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
blockUI.unblockPage()
|
||||
},
|
||||
error: function (xhr, error, thrown) {
|
||||
blockUI.unblockPage()
|
||||
var msg = "";
|
||||
if (xhr.responseText != null) {
|
||||
msg = xhr.responseText
|
||||
} else {
|
||||
msg = "잠시후 다시 시도해 주세요."
|
||||
}
|
||||
|
||||
Swal.fire({
|
||||
title: msg,
|
||||
icon: "error",
|
||||
draggable: true
|
||||
})
|
||||
},
|
||||
success: function (result) {
|
||||
|
||||
if (result.code == '0') {
|
||||
location.replace('/board/notice/lists')
|
||||
} else {
|
||||
Swal.fire({
|
||||
title: result.msg,
|
||||
icon: "error",
|
||||
draggable: true
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<?= $this->endSection() ?>
|
||||
Reference in New Issue
Block a user