From 3ce028ef6e9bfafbe5071e89ae5e7abce01d3b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Mon, 7 Aug 2023 15:33:02 +0900 Subject: [PATCH] shoppingmallv2 init... --- app/Config/Constants.php | 1 + app/Controllers/Admin/CategoryController.php | 19 +++- app/Controllers/Front/FrontController.php | 5 +- app/Database/shoppingmall.sql | 1 + app/Entities/CategoryEntity.php | 18 +++- app/Entities/ProductEntity.php | 12 ++- app/Helpers/Category_helper.php | 5 + app/Helpers/Product_helper.php | 2 +- app/Language/ko/Category.php | 1 + app/Models/BaseHierarchyModel.php | 4 + app/Models/CategoryModel.php | 5 +- app/Models/ProductModel.php | 2 +- app/Views/front/product/index.php | 2 +- app/Views/front/product/index_list.php | 2 +- app/Views/layouts/admin/top_menu.php | 20 ---- app/Views/layouts/front.php | 42 +++++---- app/Views/layouts/front/copyright.php | 18 ++-- app/Views/layouts/front/left_menu.php | 15 +-- app/Views/layouts/front/left_menu/base.php | 6 -- app/Views/layouts/front/left_menu/board.php | 6 -- .../layouts/front/left_menu/shoppingmall.php | 32 ------- app/Views/layouts/front/top_menu.php | 87 ++++++------------ .../front/top_menu/top_menu_aboutus.php | 13 +++ .../front/top_menu/top_menu_computer.php | 13 +++ .../layouts/front/top_menu/top_menu_life.php | 13 +++ .../front/top_menu/top_menu_support.php | 13 +++ app/Views/layouts/front/top_navigator.php | 5 +- app/Views/templates/front/header.php | 12 ++- public/css/front.css | 18 ++-- public/css/front/copyright.css | 7 ++ public/css/front/left_menu.css | 39 ++++++-- public/css/front/top_menu.css | 58 +++++++++++- public/css/front/top_navigator.css | 4 + public/images/common/hpdl360g6.jpg | Bin 0 -> 29965 bytes public/images/sub/sub_visual1.jpg | Bin 0 -> 156725 bytes public/images/sub/sub_visual2.jpg | Bin 0 -> 65350 bytes public/images/sub/sub_visual3.jpg | Bin 0 -> 181277 bytes public/images/sub/sub_visual4.jpg | Bin 0 -> 103135 bytes 38 files changed, 318 insertions(+), 182 deletions(-) delete mode 100644 app/Views/layouts/admin/top_menu.php delete mode 100644 app/Views/layouts/front/left_menu/base.php delete mode 100644 app/Views/layouts/front/left_menu/board.php delete mode 100644 app/Views/layouts/front/left_menu/shoppingmall.php create mode 100644 app/Views/layouts/front/top_menu/top_menu_aboutus.php create mode 100644 app/Views/layouts/front/top_menu/top_menu_computer.php create mode 100644 app/Views/layouts/front/top_menu/top_menu_life.php create mode 100644 app/Views/layouts/front/top_menu/top_menu_support.php create mode 100644 public/css/front/copyright.css create mode 100644 public/css/front/top_navigator.css create mode 100644 public/images/common/hpdl360g6.jpg create mode 100644 public/images/sub/sub_visual1.jpg create mode 100644 public/images/sub/sub_visual2.jpg create mode 100644 public/images/sub/sub_visual3.jpg create mode 100644 public/images/sub/sub_visual4.jpg diff --git a/app/Config/Constants.php b/app/Config/Constants.php index 5101cd8..ce16c0c 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -206,6 +206,7 @@ define('ICONS', [ 'FLAG' => '', 'SEARCH' => '', 'EXCEL' => '', + 'HOME' => '', 'IMAGE_FILE' => '', ]); define('CLASS_ICONS', [ diff --git a/app/Controllers/Admin/CategoryController.php b/app/Controllers/Admin/CategoryController.php index beb9b89..ebdad7e 100644 --- a/app/Controllers/Admin/CategoryController.php +++ b/app/Controllers/Admin/CategoryController.php @@ -2,6 +2,7 @@ namespace App\Controllers\Admin; +use App\Controllers\Trait\UpDownloadTrait; use App\Models\CategoryModel; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; @@ -9,6 +10,7 @@ use Psr\Log\LoggerInterface; class CategoryController extends AdminController { + use UpDownloadTrait; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { $this->_model = new CategoryModel(); @@ -19,14 +21,14 @@ class CategoryController extends AdminController public function getFields(string $action = ""): array { $fields = [ - 'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", + 'name', "photo", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", "status", "head", "tail", ]; switch ($action) { case "index": case "excel": return [ - 'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", + 'name', 'photo', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", "status", "created_at" ]; break; @@ -46,6 +48,19 @@ class CategoryController extends AdminController { return parent::getFieldBatchFilters(); } + //Field별 Form Datas 처리용 + protected function getFieldFormData(string $field, $entity = null): array + { + switch ($field) { + case 'photo': + $this->_viewDatas['fieldDatas'][$field] = $this->upload_image_procedure($field); + break; + default: + return parent::getFieldFormData($field, $entity); + break; + } + return $this->_viewDatas['fieldDatas']; + } // private function build_leftmenu() // { diff --git a/app/Controllers/Front/FrontController.php b/app/Controllers/Front/FrontController.php index c39edc3..b830078 100644 --- a/app/Controllers/Front/FrontController.php +++ b/app/Controllers/Front/FrontController.php @@ -3,10 +3,10 @@ namespace App\Controllers\Front; use App\Controllers\BaseController; +use App\Models\CategoryModel; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; -use App\Models\CategoryModel; abstract class FrontController extends BaseController { @@ -29,6 +29,9 @@ abstract class FrontController extends BaseController { $this->_category = !is_null($entity) ? $entity->getCategory_Uid() : ($this->request->getVar('category') ?: throw new \Exception("범주를 지정하지 않으셨습니다.")); $this->_viewDatas['category'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => $this->_category]); + $categorys = $this->getCategoryModel()->getSiblingEntitys($this->_viewDatas['category']); + $this->_viewDatas['parent_category'] = array_shift($categorys); + $this->_viewDatas['sibling_categorys'] = $categorys; switch ($action) { case 'insert': $category_field = CATEGORY_ROLE_FIELDS['WRITE']; diff --git a/app/Database/shoppingmall.sql b/app/Database/shoppingmall.sql index 3aaf112..45b3e42 100644 --- a/app/Database/shoppingmall.sql +++ b/app/Database/shoppingmall.sql @@ -50,6 +50,7 @@ CREATE TABLE shoppingmall.tw_category ( grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작', grpdepth int(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group깊이: 상위가없을시 1부터시작 , 상위 grpdepth+1씩 추가필요', name varchar(255) NOT NULL COMMENT '범주명', + photo varchar(255) NULL COMMENT '이미지', isaccess varchar(30) NOT NULL DEFAULT 'guest' COMMENT '접근권한', isread varchar(30) NOT NULL DEFAULT 'guest' COMMENT '읽기권한', iswrite varchar(30) NOT NULL DEFAULT 'guest' COMMENT '쓰기권한', diff --git a/app/Entities/CategoryEntity.php b/app/Entities/CategoryEntity.php index 8f92b43..1f117c6 100644 --- a/app/Entities/CategoryEntity.php +++ b/app/Entities/CategoryEntity.php @@ -2,8 +2,6 @@ namespace App\Entities; -use App\Entities\Trait\HierarchyTrait; - class CategoryEntity extends BaseHierarchyEntity { protected $datamap = []; @@ -40,4 +38,20 @@ class CategoryEntity extends BaseHierarchyEntity $this->attributes ) ? $this->attributes[$field] : DEFAULTS['ROLE']; } + public function getPhoto() + { + return $this->attributes['photo']; + } + public function getPhotoFileName($size = false) + { + $photo = $this->getPhoto(); + if (is_null($photo)) { + return ""; + } + return sprintf( + "", + $size ? $size . '_' : '', + explode(DEFAULTS['DELIMITER_FILE'], $this->getPhoto())[1] + ); + } } diff --git a/app/Entities/ProductEntity.php b/app/Entities/ProductEntity.php index 9fef019..bcf634b 100644 --- a/app/Entities/ProductEntity.php +++ b/app/Entities/ProductEntity.php @@ -47,9 +47,17 @@ class ProductEntity extends BaseEntity { return $this->attributes['photo']; } - public function getPhotoFileName($size = 'small') + public function getPhotoFileName($size = false) { - return $size . '_' . explode(DEFAULTS['DELIMITER_FILE'], $this->getPhoto())[1]; + $photo = $this->getPhoto(); + if (is_null($photo)) { + return ""; + } + return sprintf( + "", + $size ? $size . '_' : '', + explode(DEFAULTS['DELIMITER_FILE'], $this->getPhoto())[1] + ); } public function getContent() { diff --git a/app/Helpers/Category_helper.php b/app/Helpers/Category_helper.php index f4d16f9..5c7e801 100644 --- a/app/Helpers/Category_helper.php +++ b/app/Helpers/Category_helper.php @@ -44,6 +44,7 @@ function getFieldForm_CategoryHelper($field, $value, array $viewDatas, array $at break; case 'upload_file': case 'board_file': + case 'photo': return form_upload($field); break; case 'view_cnt': @@ -90,6 +91,10 @@ function getFieldView_CategoryHelper($field, $entity, array $viewDatas) case 'upload_file': return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]); break; + case 'photo': + // return $entity->getPhotoFileName(); + return $entity->getPhotoFileName('middle'); + break; case 'view_cnt': return number_format(!$value ? 0 : $value); break; diff --git a/app/Helpers/Product_helper.php b/app/Helpers/Product_helper.php index f2e4752..8656220 100644 --- a/app/Helpers/Product_helper.php +++ b/app/Helpers/Product_helper.php @@ -93,7 +93,7 @@ function getFieldView_ProductHelper($field, $entity, array $viewDatas) break; case 'photo': // return $entity->getPhotoFileName(); - return "getPhotoFileName() . "\">"; + return $entity->getPhotoFileName('middle'); break; case 'cost': case 'price': diff --git a/app/Language/ko/Category.php b/app/Language/ko/Category.php index 548bc6e..3e26440 100644 --- a/app/Language/ko/Category.php +++ b/app/Language/ko/Category.php @@ -9,6 +9,7 @@ return [ 'label' => [ 'uid' => "번호", 'name' => "범주제목", + 'photo' => "이미지", 'isaccess' => "접속권한", 'isread' => "읽기권한", 'iswrite' => "쓰기권한", diff --git a/app/Models/BaseHierarchyModel.php b/app/Models/BaseHierarchyModel.php index d56cdce..2d3f41e 100644 --- a/app/Models/BaseHierarchyModel.php +++ b/app/Models/BaseHierarchyModel.php @@ -15,6 +15,10 @@ abstract class BaseHierarchyModel extends BaseModel } abstract public function getContentField(); abstract public function reply($parent_entity, array $formDatas): BaseEntity; + public function getSiblingEntitys($entity) + { + return $this->getEntitys(['grpno' => $entity->getHierarchy_No()]); + } protected function getFieldRule(string $field, array $rules, string $action = ""): array { switch ($field) { diff --git a/app/Models/CategoryModel.php b/app/Models/CategoryModel.php index 50b7108..b09b430 100644 --- a/app/Models/CategoryModel.php +++ b/app/Models/CategoryModel.php @@ -13,7 +13,7 @@ class CategoryModel extends BaseHierarchyModel parent::__construct('Category'); $this->allowedFields = [ ...$this->allowedFields, - 'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", + 'name', "photo", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload", "head", "tail", "status" ]; $this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),]; @@ -33,6 +33,9 @@ class CategoryModel extends BaseHierarchyModel $rules[$field] = "required|trim|string"; $rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : ""; 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 "isaccess": case "isread": case "iswrite": diff --git a/app/Models/ProductModel.php b/app/Models/ProductModel.php index 2a6848c..d3e921b 100644 --- a/app/Models/ProductModel.php +++ b/app/Models/ProductModel.php @@ -41,7 +41,7 @@ class ProductModel extends BaseModel $rules[$field] = "required|trim|string"; break; case 'photo': - $rules[$field] = !$action ? "if_exist|string" : "uploaded[$field]|is_image[{$field}]|mime_in[{$field},image/jpg,image/jpeg,image/gif,image/png,image/webp]|max_size[{$field},100]|max_dims[{$field},1024,768]"; + $rules[$field] = !$action ? "if_exist|string" : "uploaded[$field]|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': diff --git a/app/Views/front/product/index.php b/app/Views/front/product/index.php index 77717e4..f9e34d2 100644 --- a/app/Views/front/product/index.php +++ b/app/Views/front/product/index.php @@ -2,7 +2,7 @@ section('content') ?>
getHead()) ?>
- +
getPrimaryKey() . 'order_field=price,order_value=ASC', '판매가순', ["class" => "btn btn-sm btn-info btn-circle", "target" => "_self"]) ?> diff --git a/app/Views/front/product/index_list.php b/app/Views/front/product/index_list.php index 608bf72..30fdb9f 100644 --- a/app/Views/front/product/index_list.php +++ b/app/Views/front/product/index_list.php @@ -2,7 +2,7 @@ section('content') ?>
getHead()) ?>
- +
getPrimaryKey() . 'order_field=price,order_value=ASC', '판매가순', ["class" => "btn btn-sm btn-info btn-circle", "target" => "_self"]) ?> diff --git a/app/Views/layouts/admin/top_menu.php b/app/Views/layouts/admin/top_menu.php deleted file mode 100644 index 9a55593..0000000 --- a/app/Views/layouts/admin/top_menu.php +++ /dev/null @@ -1,20 +0,0 @@ - \ No newline at end of file diff --git a/app/Views/layouts/front.php b/app/Views/layouts/front.php index ca2ac72..8f1755e 100644 --- a/app/Views/layouts/front.php +++ b/app/Views/layouts/front.php @@ -30,23 +30,33 @@ - include($viewDatas['layout']['path'] . '/top_navigator'); ?> - include($viewDatas['layout']['path'] . '/top_menu'); ?> - - - - - -
- include($viewDatas['layout']['path'] . '/left_menu'); ?> - - include('templates/admin/header'); ?> - renderSection('content') ?> - include('templates/admin/footer'); ?> -
-
- include($viewDatas['layout']['path'] . '/copyright'); ?> + +
+ +
+ \ No newline at end of file diff --git a/app/Views/layouts/front/copyright.php b/app/Views/layouts/front/copyright.php index 1569397..ce88747 100644 --- a/app/Views/layouts/front/copyright.php +++ b/app/Views/layouts/front/copyright.php @@ -1,11 +1,15 @@ -
- -
-
- 社名 : 株式会社 DUNAMIS 代表者 : 天 海 照 彩 住所 : 東京都江東区亀戸5丁-1-2 事業者登録番号 : 0400-01-082327 Tel : 1661-0577
+ +
-
+
+ +
\ No newline at end of file diff --git a/app/Views/layouts/front/left_menu.php b/app/Views/layouts/front/left_menu.php index fb8fcb4..b5a4fec 100644 --- a/app/Views/layouts/front/left_menu.php +++ b/app/Views/layouts/front/left_menu.php @@ -1,10 +1,13 @@ - -
-
- include($viewDatas['layout']['path'] . '/left_menu/base'); ?> - include($viewDatas['layout']['path'] . '/left_menu/board'); ?> - include($viewDatas['layout']['path'] . '/left_menu/shoppingmall'); ?> +
+
+
-
+
getTitle() ?>
+ + +
\ No newline at end of file diff --git a/app/Views/layouts/front/left_menu/base.php b/app/Views/layouts/front/left_menu/base.php deleted file mode 100644 index df3a6f3..0000000 --- a/app/Views/layouts/front/left_menu/base.php +++ /dev/null @@ -1,6 +0,0 @@ -
-

Main

-
- \ No newline at end of file diff --git a/app/Views/layouts/front/left_menu/board.php b/app/Views/layouts/front/left_menu/board.php deleted file mode 100644 index e67fce4..0000000 --- a/app/Views/layouts/front/left_menu/board.php +++ /dev/null @@ -1,6 +0,0 @@ - -
-

FAQ

-
\ No newline at end of file diff --git a/app/Views/layouts/front/left_menu/shoppingmall.php b/app/Views/layouts/front/left_menu/shoppingmall.php deleted file mode 100644 index ccb2e84..0000000 --- a/app/Views/layouts/front/left_menu/shoppingmall.php +++ /dev/null @@ -1,32 +0,0 @@ - - -
-

- -

-
-
-

가구

-
- -
-
-
-

- -

-
- - -
-
\ No newline at end of file diff --git a/app/Views/layouts/front/top_menu.php b/app/Views/layouts/front/top_menu.php index 0152ee3..19ae193 100644 --- a/app/Views/layouts/front/top_menu.php +++ b/app/Views/layouts/front/top_menu.php @@ -1,59 +1,32 @@ -
- Navbar - - \ No newline at end of file + \ No newline at end of file diff --git a/app/Views/layouts/front/top_menu/top_menu_aboutus.php b/app/Views/layouts/front/top_menu/top_menu_aboutus.php new file mode 100644 index 0000000..acd00a7 --- /dev/null +++ b/app/Views/layouts/front/top_menu/top_menu_aboutus.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/app/Views/layouts/front/top_menu/top_menu_computer.php b/app/Views/layouts/front/top_menu/top_menu_computer.php new file mode 100644 index 0000000..64e1968 --- /dev/null +++ b/app/Views/layouts/front/top_menu/top_menu_computer.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/app/Views/layouts/front/top_menu/top_menu_life.php b/app/Views/layouts/front/top_menu/top_menu_life.php new file mode 100644 index 0000000..4f5ef75 --- /dev/null +++ b/app/Views/layouts/front/top_menu/top_menu_life.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/app/Views/layouts/front/top_menu/top_menu_support.php b/app/Views/layouts/front/top_menu/top_menu_support.php new file mode 100644 index 0000000..bac1aed --- /dev/null +++ b/app/Views/layouts/front/top_menu/top_menu_support.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/app/Views/layouts/front/top_navigator.php b/app/Views/layouts/front/top_navigator.php index 979f872..7569091 100644 --- a/app/Views/layouts/front/top_navigator.php +++ b/app/Views/layouts/front/top_navigator.php @@ -1,5 +1,6 @@ -