shoppingmallv2 init...

This commit is contained in:
최준흠 2023-08-15 09:48:58 +09:00
parent f3ae29281b
commit ec8a2bad59
6 changed files with 65 additions and 20 deletions

1
.gitignore vendored
View File

@ -79,6 +79,7 @@ public/upload_images/*
#leftmenu 파일
layouts/front/left_menu/*
layouts/main/board.php
#-------------------------
# User Guide Temp Files

View File

@ -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("<ul>");
foreach ($entitys as $entity) {
array_push($temps, sprintf(
"<li><a href=\"/front/board/view/%s?category=3\">%s</a><span>%s</span></li>",
$entity->getPrimaryKey(),
$entity->getTitle(),
$entity->created_at ? str_split($entity->created_at, 10)[0] : "",
));
}
array_push($temps, "</ul>");
// 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;
}
}

View File

@ -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()
{

View File

@ -0,0 +1,3 @@
<ul>
<li><a href="/front/board/view/1?category=3">공지사항글입니다.</a><span>2023-08-04</span></li>
</ul>

View File

@ -180,7 +180,6 @@
</div>
</div>
</div>
<div class="main-service">
<div class="contain">
<div class="col" style="padding-left:300px;">
@ -207,7 +206,6 @@
</div>
</div>
</div>
<div class="main-notice">
<div class="contain">
<div class="title">
@ -217,13 +215,7 @@
</dl>
</div>
<div class="list">
<ul>
<li><a href="#">IT Solution에서 공지드립니다.</a> <span>2018-10-22</span></li>
<li><a href="#">IT Solution에서 공지드립니다.</a> <span>2018-10-22</span></li>
<li><a href="#">IT Solution에서 공지드립니다.</a> <span>2018-10-22</span></li>
<li><a href="#">안녕하세요. 관리자입니다. 공지안내드립니다. 안녕하세요. 관리자입니다. 공지안내드립니다.</a> <span>2018-10-22</span></li>
<li><a href="#">IT Solution에서 공지드립니다.</a> <span>2018-10-22</span></li>
</ul>
<?= $this->include($viewDatas['layout']['path'] . '/board'); ?>
</div>
</div>
</div>

View File

@ -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;}