diff --git a/.gitignore b/.gitignore
index 0017aa0..84a6914 100644
--- a/.gitignore
+++ b/.gitignore
@@ -79,6 +79,7 @@ public/upload_images/*
#leftmenu 파일
layouts/front/left_menu/*
+layouts/main/board.php
#-------------------------
# User Guide Temp Files
diff --git a/app/Controllers/Admin/BoardController.php b/app/Controllers/Admin/BoardController.php
index 43c0535..dfe7d1d 100644
--- a/app/Controllers/Admin/BoardController.php
+++ b/app/Controllers/Admin/BoardController.php
@@ -11,6 +11,7 @@ use Psr\Log\LoggerInterface;
class BoardController extends AdminController
{
use UpDownloadTrait;
+ private $_category_notice = 3;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@@ -62,4 +63,59 @@ class BoardController extends AdminController
}
return $this->_viewDatas['fieldDatas'];
}
+
+ private function build_notice()
+ {
+ $entitys = $this->_model->getEntitys(['category_uid' => $this->_category_notice, 'status' => DEFAULTS['STATUS']]);
+ $temps = array("
");
+ foreach ($entitys as $entity) {
+ array_push($temps, sprintf(
+ "- %s%s
",
+ $entity->getPrimaryKey(),
+ $entity->getTitle(),
+ $entity->created_at ? str_split($entity->created_at, 10)[0] : "",
+ ));
+ }
+ array_push($temps, "
");
+ // echo var_export($temps, true);
+ // exit;
+ file_put_contents(APPPATH . 'Views' . "/layouts/main/board.php", implode("\n", $temps));
+ }
+
+ //Insert관련
+ protected function insert_process()
+ {
+ $entity = parent::insert_process();
+ if ($entity->category_uid == $this->_category_notice) {
+ $this->build_notice();
+ }
+ return $entity;
+ }
+ //Update관련
+ protected function update_process($entity)
+ {
+ $entity = parent::update_process($entity);
+ if ($entity->category_uid == $this->_category_notice) {
+ $this->build_notice();
+ }
+ return $entity;
+ }
+ //Toggle관련
+ protected function toggle_process($entity)
+ {
+ $entity = parent::toggle_process($entity);
+ if ($entity->category_uid == $this->_category_notice) {
+ $this->build_notice();
+ }
+ return $entity;
+ }
+ //Delete 관련
+ protected function delete_process($entity)
+ {
+ $entity = parent::delete_process($entity);
+ if ($entity->category_uid->$this->_category_notice) {
+ $this->build_notice();
+ }
+ return $entity;
+ }
}
diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php
index ac50b3c..f142d81 100644
--- a/app/Controllers/Home.php
+++ b/app/Controllers/Home.php
@@ -2,6 +2,7 @@
namespace App\Controllers;
+use App\Entities\CategoryEntity;
use App\Models\CategoryModel;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\RequestInterface;
@@ -10,8 +11,6 @@ use Psr\Log\LoggerInterface;
class Home extends Controller
{
- private $_category = null;
- private $_categoryModel = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@@ -33,15 +32,9 @@ class Home extends Controller
$this->_viewDatas['currentRoles'] = is_array($currentRoles) ? $currentRoles : [DEFAULTS["ROLE"]];
}
//Default 회원정보 Category
- $this->_category = DEFAULTS['ORDER_CATEGORY'];
- $this->_viewDatas['category'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => $this->_category]);
- // $this->_viewDatas['parent_category'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => $this->_viewDatas['category']->getHierarchy_ParentUID()]);
+ $this->_viewDatas['category'] = new CategoryEntity(['uid' => 1]);
}
- final protected function getCategoryModel(): CategoryModel
- {
- return $this->_categoryModel = $this->_categoryModel ?: new CategoryModel();
- }
public function index()
{
diff --git a/app/Views/layouts/main/board.php b/app/Views/layouts/main/board.php
new file mode 100644
index 0000000..15007e7
--- /dev/null
+++ b/app/Views/layouts/main/board.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/app/Views/welcome_message.php b/app/Views/welcome_message.php
index 8890d00..eafbf8f 100644
--- a/app/Views/welcome_message.php
+++ b/app/Views/welcome_message.php
@@ -180,7 +180,6 @@
-
-
@@ -217,13 +215,7 @@
-
+ = $this->include($viewDatas['layout']['path'] . '/board'); ?>
diff --git a/public/css/main.css b/public/css/main.css
index 3fff5b4..251a7c5 100644
--- a/public/css/main.css
+++ b/public/css/main.css
@@ -190,7 +190,7 @@ h1,h2,h3,h4,h5,h6,strong,th,.bold{font-weight:500;}
.main-notice .title dl dd {font-size:16px; line-height:1.4em; color:#cbcfd9;}
.main-notice .list {float:left; width:688px; height:276px; background:#fff; border:1px solid #ddd; border-left:0; box-sizing:border-box;}
.main-notice .list ul {padding:15px 40px 0;}
-.main-notice .list ul li {font-size:16px; line-height:49px; height:49px; border-bottom:1px solid #ddd; position:relative;}
+.main-notice .list ul li {line-height:49px; height:49px; border-bottom:1px solid silver; position:relative;}
.main-notice .list ul li:last-child {border-bottom:0}
-.main-notice .list ul li a {display:inline-block; width:500px; height:49px; white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
+.main-notice .list ul li a {display:inline-block; font-size:16px; font-weight:bold; width:500px; height:49px; white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.main-notice .list span {position:absolute; top:0; right:0; font-size:14px; color:#959595;}
\ No newline at end of file