diff --git a/app/Cells/BoardCell.php b/app/Cells/BoardCell.php
index 7bba4ee..e20ec0a 100644
--- a/app/Cells/BoardCell.php
+++ b/app/Cells/BoardCell.php
@@ -18,7 +18,7 @@ class BoardCell extends BaseCell
$viewDatas['currentCategory'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => __FUNCTION__]);
$viewDatas['cellDatas'] = array();
$viewDatas['cellDatas']['entitys'] = $this->getBoardModel()->getEntitys([
- 'category_uid' => __FUNCTION__
+ 'category' => __FUNCTION__
]);
return view(
'Views/front/board/cell/' . __FUNCTION__,
diff --git a/app/Config/Constants.php b/app/Config/Constants.php
index 97b7787..18c2b5f 100644
--- a/app/Config/Constants.php
+++ b/app/Config/Constants.php
@@ -238,6 +238,7 @@ define('CLASS_ICONS', [
'SITEPAGE' => ' ',
'CATEGORY' => ' ',
'PRODUCT' => ' ',
+ 'DEVICE' => ' ',
'ORDER' => ' ',
'BILLING' => ' ',
'CART' => ' ',
diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 4bc1331..c8c4912 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -103,6 +103,18 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->get('toggle/(:num)/(:hash)', 'SitepageController::toggle/$1/$2');
$routes->post('batchjob', 'SitepageController::batchjob');
});
+ $routes->group('device', static function ($routes) {
+ $routes->get('', 'DeviceController::index');
+ $routes->get('excel', 'DeviceController::excel');
+ $routes->get('insert', 'DeviceController::insert_form');
+ $routes->post('insert', 'DeviceController::insert');
+ $routes->get('update/(:uuid)', 'DeviceController::update_form/$1');
+ $routes->post('update/(:uuid)', 'DeviceController::update/$1');
+ $routes->get('view/(:uuid)', 'DeviceController::view/$1');
+ $routes->get('delete/(:uuid)', 'DeviceController::delete/$1', ['filter' => 'authFilter:master']);
+ $routes->get('toggle/(:uuid)/(:hash)', 'DeviceController::toggle/$1/$2');
+ $routes->post('batchjob', 'DeviceController::batchjob');
+ });
$routes->group('product', static function ($routes) {
$routes->get('', 'ProductController::index');
$routes->get('excel', 'ProductController::excel');
diff --git a/app/Controllers/Admin/BoardController.php b/app/Controllers/Admin/BoardController.php
index dfe7d1d..758bccf 100644
--- a/app/Controllers/Admin/BoardController.php
+++ b/app/Controllers/Admin/BoardController.php
@@ -25,14 +25,14 @@ class BoardController extends AdminController
public function getFields(string $action = ""): array
{
- $fields = ["category_uid", 'title', "board_file", "passwd", "status", "content"];
+ $fields = ["category", 'title', "board_file", "passwd", "status", "content"];
switch ($action) {
case "index":
case "excel":
- return ["category_uid", "user_uid", 'title', "board_file", "view_cnt", "status", "created_at"];
+ return ["category", "user_uid", 'title', "board_file", "view_cnt", "status", "created_at"];
break;
case "view":
- return ["category_uid", "user_uid", 'title', "board_file", "view_cnt", "status", "created_at", "content"];
+ return ["category", "user_uid", 'title', "board_file", "view_cnt", "status", "created_at", "content"];
break;
default:
return $fields;
@@ -41,7 +41,7 @@ class BoardController extends AdminController
}
public function getFieldFilters(): array
{
- return ["category_uid", "user_uid", "status"];
+ return ["category", "user_uid", "status"];
}
public function getFieldBatchFilters(): array
{
@@ -66,7 +66,7 @@ class BoardController extends AdminController
private function build_notice()
{
- $entitys = $this->_model->getEntitys(['category_uid' => $this->_category_notice, 'status' => DEFAULTS['STATUS']]);
+ $entitys = $this->_model->getEntitys(['category' => $this->_category_notice, 'status' => DEFAULTS['STATUS']]);
$temps = array("
");
foreach ($entitys as $entity) {
array_push($temps, sprintf(
@@ -86,7 +86,7 @@ class BoardController extends AdminController
protected function insert_process()
{
$entity = parent::insert_process();
- if ($entity->category_uid == $this->_category_notice) {
+ if ($entity->category == $this->_category_notice) {
$this->build_notice();
}
return $entity;
@@ -95,7 +95,7 @@ class BoardController extends AdminController
protected function update_process($entity)
{
$entity = parent::update_process($entity);
- if ($entity->category_uid == $this->_category_notice) {
+ if ($entity->category == $this->_category_notice) {
$this->build_notice();
}
return $entity;
@@ -104,7 +104,7 @@ class BoardController extends AdminController
protected function toggle_process($entity)
{
$entity = parent::toggle_process($entity);
- if ($entity->category_uid == $this->_category_notice) {
+ if ($entity->category == $this->_category_notice) {
$this->build_notice();
}
return $entity;
@@ -113,7 +113,7 @@ class BoardController extends AdminController
protected function delete_process($entity)
{
$entity = parent::delete_process($entity);
- if ($entity->category_uid->$this->_category_notice) {
+ if ($entity->category->$this->_category_notice) {
$this->build_notice();
}
return $entity;
diff --git a/app/Controllers/Admin/DeviceController.php b/app/Controllers/Admin/DeviceController.php
new file mode 100644
index 0000000..65df63b
--- /dev/null
+++ b/app/Controllers/Admin/DeviceController.php
@@ -0,0 +1,47 @@
+_model = new DeviceModel();
+ $this->_viewDatas["className"] = "Device";
+ $this->_viewPath .= strtolower($this->_viewDatas["className"]);
+ $this->_viewDatas["title"] = lang($this->_viewDatas["className"] . ".title");
+ $this->_viewDatas["class_icon"] = CLASS_ICONS[strtoupper($this->_viewDatas["className"])];
+ helper($this->_viewDatas["className"]);
+ }
+
+ public function getFields(string $action = ""): array
+ {
+ $fields = ["type", "name", "cost", "price", "sale", "stock", "status", "content",];
+ switch ($action) {
+ case "index":
+ case "excel":
+ return ["type", "name", "cost", "price", "sale", "stock", "status", "created_at"];
+ break;
+ case "view":
+ return [...$fields, "created_at"];
+ break;
+ default:
+ return $fields;
+ break;
+ }
+ }
+ public function getFieldFilters(): array
+ {
+ return ["type", "status"];
+ }
+ public function getFieldBatchFilters(): array
+ {
+ return parent::getFieldBatchFilters();
+ }
+}
diff --git a/app/Controllers/Admin/SitepageController.php b/app/Controllers/Admin/SitepageController.php
index 8e4d287..7dae460 100644
--- a/app/Controllers/Admin/SitepageController.php
+++ b/app/Controllers/Admin/SitepageController.php
@@ -22,14 +22,14 @@ class SitepageController extends AdminController
public function getFields(string $action = ""): array
{
- $fields = ["category_uid", 'title', "status", "content"];
+ $fields = ["category", 'title', "status", "content"];
switch ($action) {
case "index":
case "excel":
- return ["category_uid", "user_uid", 'title', "status", "created_at"];
+ return ["category", "user_uid", 'title', "status", "created_at"];
break;
case "view":
- return ["category_uid", "user_uid", 'title', "status", "created_at", "content"];
+ return ["category", "user_uid", 'title', "status", "created_at", "content"];
break;
default:
return $fields;
@@ -38,7 +38,7 @@ class SitepageController extends AdminController
}
public function getFieldFilters(): array
{
- return ["category_uid", "user_uid", "status"];
+ return ["category", "user_uid", "status"];
}
public function getFieldBatchFilters(): array
{
diff --git a/app/Database/base.sql b/app/Database/base.sql
index 4dd4032..f2a0ba3 100644
--- a/app/Database/base.sql
+++ b/app/Database/base.sql
@@ -42,7 +42,6 @@ DROP TABLE IF EXISTS vhost.tw_category;
CREATE TABLE vhost.tw_category (
uid varchar(50) NOT NULL,
- classname varchar(50) NOT NULL DEFAULT 'Sitepage',
grpno int(10) unsigned NOT NULL DEFAULT 1 COMMENT 'Group번호: 상위가없을시 기본 uid와 같음,항상 숫자여야함',
grporder int(5) unsigned NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작',
grpdepth int(3) unsigned NOT NULL DEFAULT 1 COMMENT 'Group깊이: 상위가없을시 1부터시작 , 상위 grpdepth+1씩 추가필요',
@@ -77,7 +76,7 @@ CREATE TABLE vhost.tw_board (
grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작',
grpdepth int(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group깊이: 상위가없을시 1부터시작 , 상위 grpdepth+1씩 추가필요',
parent int(10) UNSIGNED NULL COMMENT '부모UID',
- category_uid varchar(50) NOT NULL COMMENT '범주_UID',
+ category varchar(20) NOT NULL COMMENT '구분',
user_uid varchar(36) NULL COMMENT '작성자 정보',
title varchar(255) NOT NULL COMMENT '제목',
content text NOT NULL COMMENT '내용',
@@ -89,15 +88,14 @@ CREATE TABLE vhost.tw_board (
created_at timestamp NOT NULL DEFAULT current_timestamp(),
deleted_at timestamp NULL DEFAULT NULL,
PRIMARY KEY (uid),
- CONSTRAINT FOREIGN KEY (category_uid) REFERENCES tw_category (uid),
- CONSTRAINT FOREIGN KEY (user_uid) REFERENCES tw_user (uid)
+ CONSTRAINT tw_board_ibfk_1 FOREIGN KEY (user_uid) REFERENCES tw_user (uid)
) ENGINE = InnoDB CHARSET = utf8 COLLATE = utf8_general_ci COMMENT = '게시물 정보';
DROP TABLE IF EXISTS vhost.tw_sitepage;
CREATE TABLE vhost.tw_sitepage (
uid int(10) unsigned NOT NULL AUTO_INCREMENT,
- category_uid varchar(50) NOT NULL COMMENT '범주_UID',
+ category varchar(20) NOT NULL COMMENT '구분',
user_uid varchar(36) DEFAULT NULL COMMENT '작성자 정보',
title varchar(255) NOT NULL COMMENT '제목',
content text NOT NULL COMMENT '내용',
@@ -108,8 +106,7 @@ CREATE TABLE vhost.tw_sitepage (
PRIMARY KEY (uid),
KEY category_uid (category_uid),
KEY user_uid (user_uid),
- CONSTRAINT tw_sitepage_ibfk_1 FOREIGN KEY (category_uid) REFERENCES tw_category (uid),
- CONSTRAINT tw_sitepage_ibfk_2 FOREIGN KEY (user_uid) REFERENCES tw_user (uid)
+ CONSTRAINT tw_sitepage_ibfk_1 FOREIGN KEY (user_uid) REFERENCES tw_user (uid)
) ENGINE = InnoDB CHARSET = utf8 COLLATE = utf8_general_ci COMMENT '사이트페이지';
DROP TABLE IF EXISTS vhost.tw_product;
@@ -127,7 +124,7 @@ CREATE TABLE vhost.tw_product (
stock int(5) unsigned NOT NULL DEFAULT 1 COMMENT '재고수량',
view_cnt int(4) unsigned NOT NULL DEFAULT 1 COMMENT '조회수',
content text NOT NULL COMMENT '상품내용',
- status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 판매, unuse: 판매않함, soldout:상품부족 등등',
+ status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 판매, unuse: 판매중지, soldout:매진, outofstock:재고부족 등등',
updated_at timestamp NULL DEFAULT NULL,
created_at timestamp NOT NULL DEFAULT current_timestamp(),
deleted_at timestamp NULL DEFAULT NULL,
@@ -148,8 +145,8 @@ CREATE TABLE vhost.tw_device (
price int(10) unsigned NOT NULL DEFAULT 0 COMMENT '판매가',
sale int(10) unsigned NOT NULL DEFAULT 0 COMMENT '할인가',
stock int(5) unsigned NOT NULL DEFAULT 1 COMMENT '재고수량',
- status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 판매중 unuse: 판매않함, soldout:상품부족 등등',
content text NOT NULL COMMENT '장비내용',
+ status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 판매중 unuse: 판매중지, soldout:매진, outofstock:재고부족 등등',
updated_at timestamp NULL DEFAULT NULL,
created_at timestamp NOT NULL DEFAULT current_timestamp(),
deleted_at timestamp NULL DEFAULT NULL,
diff --git a/app/Database/vhost-20240515.sql b/app/Database/vhost-20240515.sql
new file mode 100644
index 0000000..c0f8853
Binary files /dev/null and b/app/Database/vhost-20240515.sql differ
diff --git a/app/Entities/DeviceEntity.php b/app/Entities/DeviceEntity.php
new file mode 100644
index 0000000..d55a9f2
--- /dev/null
+++ b/app/Entities/DeviceEntity.php
@@ -0,0 +1,17 @@
+attributes['name'];
+ }
+ //추가기능
+}
diff --git a/app/Helpers/Board_helper.php b/app/Helpers/Board_helper.php
index 13bd108..1b26567 100644
--- a/app/Helpers/Board_helper.php
+++ b/app/Helpers/Board_helper.php
@@ -45,6 +45,7 @@ function getFieldForm_BoardHelper($field, $value, array $viewDatas, array $attri
case 'view_cnt':
return form_input($field, $value, ['type' => 'number']);
break;
+ case "category":
case "status":
$viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]];
return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, $attributes);
diff --git a/app/Helpers/Device_helper.php b/app/Helpers/Device_helper.php
new file mode 100644
index 0000000..9346552
--- /dev/null
+++ b/app/Helpers/Device_helper.php
@@ -0,0 +1,163 @@
+%s", implode(" ", $attributes), lang("{$viewDatas['className']}.label.{$field}"));
+ break;
+ }
+}
+//header.php에서 getFieldForm_Helper사용
+function getFieldForm_DeviceHelper($field, $value, array $viewDatas, array $attributes = array())
+{
+ $value = $value ?: DEFAULTS['EMPTY'];
+ switch ($field) {
+ case 'category_uid':
+ case 'user_uid':
+ $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]];
+ return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, [...$attributes, 'class' => "select-field"]);
+ // // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
+ // foreach ($viewDatas['fieldFormOptions'][$field] as $key => $label) {
+ // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label;
+ // }
+ // return implode(" ", $checkboxs);
+ break;
+ case 'title':
+ case 'name':
+ return form_input($field, $value, ["placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]);
+ break;
+ case 'content':
+ case 'head':
+ case 'tail':
+ return form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']);
+ break;
+ case "status":
+ case "type":
+ $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]];
+ return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, $attributes);
+ break;
+ case 'updated_at':
+ case 'created_at':
+ return form_input($field, $value, ['class' => 'calender']);
+ break;
+ default:
+ return form_input($field, $value);
+ break;
+ }
+} //
+
+function getFieldView_DeviceHelper($field, $entity, array $viewDatas)
+{
+ $value = $entity->$field ?: DEFAULTS['EMPTY'];
+ switch ($field) {
+ case 'category_uid':
+ foreach (array_values($viewDatas['fieldFormOptions'][$field]) as $category_2depths) {
+ foreach ($category_2depths as $key => $label) {
+ if ($key == $value) {
+ return $label;
+ }
+ }
+ }
+ return $value;
+ break;
+ case 'cost':
+ case 'price':
+ case 'sale':
+ return number_format(!$value ? 0 : $value) . "원";
+ break;
+ case 'stock':
+ case 'view_cnt':
+ return number_format(!$value ? 0 : $value);
+ break;
+ case 'content':
+ return html_entity_decode($value);
+ break;
+ case 'updated_at':
+ case 'created_at':
+ return $value ? str_split($value, 10)[0] : "";
+ break;
+ default:
+ return in_array($field, $viewDatas['fieldFilters']) && $value ? $viewDatas['fieldFormOptions'][$field][$value] : $value;
+ break;
+ }
+} //
+
+function getFieldFilter_DeviceHelper($field, $value, array $viewDatas)
+{
+ $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]];
+ return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, ['class' => "select-field"]);
+} //
+
+function getFieldIndex_Column_DeviceHelper($field, array $viewDatas)
+{
+ $label = lang("{$viewDatas['className']}.label.{$field}");
+ if ($field == $viewDatas['order_field']) {
+ $label .= $viewDatas['order_value'] == 'ASC' ? ICONS['UP'] : ICONS['DOWN'];
+ }
+ $value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
+ $viewDatas['uri']->addQuery('order_field', $field);
+ $viewDatas['uri']->addQuery('order_value', $value);
+ $columnData = anchor((string)$viewDatas['uri'], $label);
+ switch ($field) {
+ case 'title':
+ case 'name':
+ return sprintf("%s ", $columnData);
+ break;
+ default:
+ return sprintf("%s ", $columnData);
+ break;
+ }
+} //
+
+//Front용
+function getFieldIndex_Row_DeviceHelper($field, $entity, array $viewDatas): string
+{
+ $value = $entity->$field ?: DEFAULTS['EMPTY'];
+ //front는 table을 사용하지 않는 점 주의
+ switch ($field) {
+ case 'title':
+ case 'name':
+ return anchor(
+ current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey(),
+ $value,
+ ["target" => "_self"]
+ );
+ break;
+ default:
+ return getFieldView_DeviceHelper($field, $entity, $viewDatas);
+ break;
+ }
+} //
+//Admin용
+function getFieldIndex_Row_DeviceHelper_Admin($field, $entity, array $viewDatas): string
+{
+ $value = $entity->$field ?: DEFAULTS['EMPTY'];
+ switch ($field) {
+ case 'title':
+ case 'name':
+ return anchor(
+ current_url() . '/view/' . $entity->getPrimaryKey(),
+ $value,
+ ["target" => "_self"]
+ );
+ break;
+ default:
+ if (in_array($field, $viewDatas['fieldFilters'])) {
+ $attributes["onChange"] = sprintf(
+ 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
+ current_url(),
+ $entity->getPrimaryKey(),
+ $field,
+ $field
+ );
+ return getFieldForm_DeviceHelper($field, $entity->$field, $viewDatas, $attributes);
+ }
+ //front는 table을 사용하지 않는 점 주의
+ return getFieldIndex_Row_DeviceHelper($field, $entity, $viewDatas);
+ break;
+ }
+} //
\ No newline at end of file
diff --git a/app/Helpers/Sitepage_helper.php b/app/Helpers/Sitepage_helper.php
index 5d5aaa6..8b387d7 100644
--- a/app/Helpers/Sitepage_helper.php
+++ b/app/Helpers/Sitepage_helper.php
@@ -45,6 +45,7 @@ function getFieldForm_SitepageHelper($field, $value, array $viewDatas, array $at
case 'view_cnt':
return form_input($field, $value, ['type' => 'number']);
break;
+ case "category":
case "status":
$viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]];
return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, $attributes);
diff --git a/app/Language/ko/Board.php b/app/Language/ko/Board.php
index 2ceec00..3c7b3f5 100644
--- a/app/Language/ko/Board.php
+++ b/app/Language/ko/Board.php
@@ -6,7 +6,7 @@ return [
'grpno' => "그룹번호",
'grpord' => "부모번호",
'grpdpt' => "그룸Depth",
- 'category_uid' => "분류",
+ 'category' => "분류",
'user_uid' => "작성자",
'title' => "제목",
'content' => "내용",
@@ -18,5 +18,9 @@ return [
'updated_at' => "수정일",
'created_at' => "작성일"
],
+ "CATEGORY" => [
+ 'information' => '공지사항',
+ 'reference' => '자료실'
+ ],
'STATUS' => ['use' => '사용', 'unuse' => '사용않함'],
];
diff --git a/app/Language/ko/Device.php b/app/Language/ko/Device.php
new file mode 100644
index 0000000..3c61853
--- /dev/null
+++ b/app/Language/ko/Device.php
@@ -0,0 +1,36 @@
+ "장비 정보",
+ 'label' => [
+ 'uid' => "번호",
+ 'type' => '형식',
+ 'name' => "모델명",
+ 'cost' => "판매원가",
+ 'price' => "판매금액",
+ 'sale' => "할인금액",
+ 'stock' => "재고",
+ 'content' => "장비정보",
+ 'status' => "상태",
+ 'updated_at' => "수정일",
+ 'created_at' => "생성일"
+ ],
+ "TYPE" => [
+ 'beremetal' => '실서버',
+ 'kvm' => '가상서버',
+ 'container' => '콘테이너',
+ 'cpu' => 'CPU',
+ 'memory' => 'Memory',
+ 'ssd' => 'SSD',
+ 'nvme' => 'NVME',
+ 'nic' => 'LANCARD',
+ 'windows' => 'Windows',
+ 'linux' => 'Linux',
+ 'publicip' => '공인IP'
+ ],
+ "STATUS" => [
+ "use" => "판매중",
+ "unuse" => "판매중지",
+ "soldout" => "매진",
+ "outofstock" => "재고부족",
+ ]
+];
diff --git a/app/Language/ko/Product.php b/app/Language/ko/Product.php
index 063ffb3..54df923 100644
--- a/app/Language/ko/Product.php
+++ b/app/Language/ko/Product.php
@@ -24,7 +24,8 @@ return [
],
"STATUS" => [
"use" => "판매중",
- "unuse" => "판매일시중지",
+ "unuse" => "판매중지",
+ "soldout" => "매진",
"outofstock" => "재고부족",
]
];
diff --git a/app/Language/ko/Sitepage.php b/app/Language/ko/Sitepage.php
index b0b8210..5e0b98b 100644
--- a/app/Language/ko/Sitepage.php
+++ b/app/Language/ko/Sitepage.php
@@ -3,7 +3,7 @@ return [
'title' => "사이트페이지 정보",
'label' => [
'uid' => "번호",
- 'category_uid' => "분류",
+ 'category' => "분류",
'user_uid' => "작성자",
'title' => "제목",
'content' => "내용",
@@ -11,5 +11,12 @@ return [
'updated_at' => "수정일",
'created_at' => "작성일"
],
+ "CATEGORY" => [
+ 'greeting' => '인사말',
+ 'companyinfo' => '회사소개',
+ 'beremetal' => '단독서버',
+ 'line' => '회선',
+ 'vpn' => '기타서비스'
+ ],
'STATUS' => ['use' => '사용', 'unuse' => '사용않함'],
];
diff --git a/app/Models/BoardModel.php b/app/Models/BoardModel.php
index fa34bbf..626dd7b 100644
--- a/app/Models/BoardModel.php
+++ b/app/Models/BoardModel.php
@@ -13,7 +13,7 @@ class BoardModel extends BaseHierarchyModel
parent::__construct('Board');
$this->allowedFields = [
...$this->allowedFields,
- "category_uid",
+ "category",
"user_uid", 'title', "content",
"passwd", "board_file", "view_cnt", "status"
];
@@ -30,7 +30,7 @@ class BoardModel extends BaseHierarchyModel
public function getFieldRule(string $field, array $rules, string $action = ""): array
{
switch ($field) {
- case "category_uid":
+ case "category":
$rules[$field] = "required|string";
break;
case "user_uid":
diff --git a/app/Models/DeviceModel.php b/app/Models/DeviceModel.php
new file mode 100644
index 0000000..9174149
--- /dev/null
+++ b/app/Models/DeviceModel.php
@@ -0,0 +1,82 @@
+allowedFields = [
+ ...$this->allowedFields,
+ 'type', 'name', "photo", "cost", "price", "sale",
+ "stock", "content", "status"
+ ];
+ $this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
+ }
+ public function getTitleField(): string
+ {
+ return 'name';
+ }
+
+ public function getFieldRule(string $field, array $rules, string $action = ""): array
+ {
+ switch ($field) {
+ case $this->getTitleField():
+ $rules[$field] = "required|trim|string";
+ break;
+ case 'type':
+ $rules[$field] = "required|string";
+ break;
+ case 'photo':
+ $rules[$field] = !$action ? "if_exist|string" : "is_image[{$field}]|mime_in[{$field},image/jpg,image/jpeg,image/gif,image/png,image/webp]|max_size[{$field},300]|max_dims[{$field},2048,768]";
+ break;
+ case 'cost':
+ case 'price':
+ case 'stock':
+ $rules[$field] = "required|numeric";
+ break;
+ case 'sale':
+ $rules[$field] = "if_exist|numeric";
+ break;
+ case "content":
+ $rules[$field] = "required|string";
+ break;
+ default:
+ $rules = parent::getFieldRule($field, $rules, $action);
+ break;
+ }
+ return $rules;
+ }
+
+ public function getEntity($conditions): DeviceEntity
+ {
+ return $this->where($conditions)->first() ?: throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 해당 데이터가 없습니다.");
+ }
+ public function create(array $formDatas): DeviceEntity
+ {
+ return $this->create_process(new DeviceEntity(), $formDatas);
+ }
+ public function modify(DeviceEntity $entity, array $formDatas): DeviceEntity
+ {
+ return $this->modify_process($entity, $formDatas);
+ }
+
+ //Index관련
+ public function setIndexWordFilter(string $word)
+ {
+ if ($word !== DEFAULTS['EMPTY']) {
+ parent::setIndexWordFilter($word);
+ $this->orLike($this->getTitleField(), $word, "both");
+ $this->orLike("content", $word, "both"); //befor , after , both
+ }
+ }
+}
diff --git a/app/Models/ProductModel.php b/app/Models/ProductModel.php
index ce7258e..7ddcc93 100644
--- a/app/Models/ProductModel.php
+++ b/app/Models/ProductModel.php
@@ -7,6 +7,7 @@ use App\Entities\ProductEntity;
class ProductModel extends BaseModel
{
const STATUS_OUTOFSTOCK = "outofstock";
+ const STATUS_SOLDOUT = "soldout";
protected $table = "tw_product";
protected $useAutoIncrement = false;
protected $returnType = ProductEntity::class;
diff --git a/app/Models/SitepageModel.php b/app/Models/SitepageModel.php
index d531ff4..630f88c 100644
--- a/app/Models/SitepageModel.php
+++ b/app/Models/SitepageModel.php
@@ -13,7 +13,7 @@ class SitepageModel extends BaseModel
parent::__construct('Sitepage');
$this->allowedFields = [
...$this->allowedFields,
- "category_uid",
+ "category",
"user_uid", 'title', "content",
"status"
];
@@ -30,7 +30,7 @@ class SitepageModel extends BaseModel
public function getFieldRule(string $field, array $rules, string $action = ""): array
{
switch ($field) {
- case "category_uid":
+ case "category":
$rules[$field] = "required|string";
break;
case "user_uid":
diff --git a/app/Views/admin/device/index.php b/app/Views/admin/device/index.php
new file mode 100644
index 0000000..50806a8
--- /dev/null
+++ b/app/Views/admin/device/index.php
@@ -0,0 +1,48 @@
+= $this->extend('layouts/admin') ?>
+= $this->section('content') ?>
+
+
+
+
+ 조건검색:= getFieldFilter_DeviceHelper($field, $viewDatas[$field], $viewDatas) ?>
+
+ = $this->include('templates/admin/index_head') ?>
+
+ = form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
+
+
+
+ #
+ = getFieldIndex_Column_DeviceHelper($field, $viewDatas) ?>
+ @
+
+
+
+
+
+ status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
+
+ = form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
+ = anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
+
+
+ = getFieldIndex_Row_DeviceHelper_Admin($field, $entity, $viewDatas) ?>
+
+ = anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
+
+
+
+
+
+
+
+ = form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL
+ = getFieldFilter_DeviceHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
+ = form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")) ?>
+ = anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
+
+ = $viewDatas['pagination'] ?>
+
+ = form_close() ?>
+
+= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/device/insert.php b/app/Views/admin/device/insert.php
new file mode 100644
index 0000000..52b5b7b
--- /dev/null
+++ b/app/Views/admin/device/insert.php
@@ -0,0 +1,24 @@
+= $this->extend('layouts/admin') ?>
+= $this->section('content') ?>
+
+
+ = form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
+
+
+= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/device/update.php b/app/Views/admin/device/update.php
new file mode 100644
index 0000000..cd3e86d
--- /dev/null
+++ b/app/Views/admin/device/update.php
@@ -0,0 +1,24 @@
+= $this->extend('layouts/admin') ?>
+= $this->section('content') ?>
+
+
+ = form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
+
+
+= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/device/view.php b/app/Views/admin/device/view.php
new file mode 100644
index 0000000..1f1118f
--- /dev/null
+++ b/app/Views/admin/device/view.php
@@ -0,0 +1,19 @@
+= $this->extend('layouts/admin') ?>
+= $this->section('content') ?>
+
+
+= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/layouts/admin/left_menu/shoppingmall.php b/app/Views/layouts/admin/left_menu/shoppingmall.php
index 666f50a..b5c75e4 100644
--- a/app/Views/layouts/admin/left_menu/shoppingmall.php
+++ b/app/Views/layouts/admin/left_menu/shoppingmall.php
@@ -3,6 +3,9 @@
상점관리