diff --git a/app/Cells/BaseCell.php b/app/Cells/BaseCell.php new file mode 100644 index 0000000..6dee26e --- /dev/null +++ b/app/Cells/BaseCell.php @@ -0,0 +1,14 @@ +_categoryModel = $this->_categoryModel ?: new CategoryModel(); + } +} diff --git a/app/Cells/BoardCell.php b/app/Cells/BoardCell.php index aaaebfd..7bba4ee 100644 --- a/app/Cells/BoardCell.php +++ b/app/Cells/BoardCell.php @@ -2,9 +2,10 @@ namespace App\Cells; +use App\Cells\BaseCell; use App\Models\BoardModel; -class BoardCell +class BoardCell extends BaseCell { private $_boardModel = null; private function getBoardModel(): BoardModel @@ -14,6 +15,7 @@ class BoardCell public function information(array $viewDatas): string { helper('Board'); + $viewDatas['currentCategory'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => __FUNCTION__]); $viewDatas['cellDatas'] = array(); $viewDatas['cellDatas']['entitys'] = $this->getBoardModel()->getEntitys([ 'category_uid' => __FUNCTION__ diff --git a/app/Cells/ProductCell.php b/app/Cells/ProductCell.php index 1d3428f..1416c21 100644 --- a/app/Cells/ProductCell.php +++ b/app/Cells/ProductCell.php @@ -2,14 +2,16 @@ namespace App\Cells; -class ProductCell +use App\Cells\BaseCell; + +class ProductCell extends BaseCell { public function virtual_calculator(array $viewDatas): string { - $viewDatas['cellDatas']=array(); + $viewDatas['cellDatas'] = array(); return view( - 'Views/front/product/cell/' . __FUNCTION__, - ['viewDatas'=>$viewDatas] + 'Views/front/product/cell/' . __FUNCTION__, + ['viewDatas' => $viewDatas] ); } } diff --git a/app/Controllers/Trait/UpDownloadTrait.php b/app/Controllers/Trait/UpDownloadTrait.php index 5f86958..93090d9 100644 --- a/app/Controllers/Trait/UpDownloadTrait.php +++ b/app/Controllers/Trait/UpDownloadTrait.php @@ -7,7 +7,7 @@ use CodeIgniter\HTTP\Files\UploadedFile; trait UpDownloadTrait { //Upload FIle관련 - private function upDownload_file_process(UploadedFile $upfile): ?string + private function upload_file_process(UploadedFile $upfile): ?string { $filename = null; $uploaded_filename = null; diff --git a/app/Helpers/Billing_helper.php b/app/Helpers/Billing_helper.php index 0cb3003..ab5cdfd 100644 --- a/app/Helpers/Billing_helper.php +++ b/app/Helpers/Billing_helper.php @@ -126,7 +126,7 @@ function getFieldIndex_Row_BillingHelper($field, $entity, array $viewDatas): str case 'title': case 'name': return anchor( - current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(), + current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey(), $value, ["target" => "_self"] ); diff --git a/app/Helpers/Board_helper.php b/app/Helpers/Board_helper.php index 21d1f5c..b8d6a91 100644 --- a/app/Helpers/Board_helper.php +++ b/app/Helpers/Board_helper.php @@ -130,12 +130,12 @@ function getFieldIndex_Row_BoardHelper($field, $entity, array $viewDatas): strin $depth .= "    "; } $reply = anchor( - current_url() . '/reply/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(), + current_url() . '/reply/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey(), ICONS['REPLY'], ["target" => "_self"] ); $view = anchor( - current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(), + current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey(), $value, ["target" => "_self"] ); @@ -147,7 +147,7 @@ function getFieldIndex_Row_BoardHelper($field, $entity, array $viewDatas): strin base_url() . $viewDatas['control'] . "/board/download/{$field}/{$entity->getPrimaryKey()}" . - '?category=' . $viewDatas['category']->getPrimaryKey(), + '?category=' . $viewDatas['currentCategory']->getPrimaryKey(), $field ); break; @@ -157,6 +157,25 @@ function getFieldIndex_Row_BoardHelper($field, $entity, array $viewDatas): strin } } // +//Front용 +function getFieldCell_Row_BoardHelper($field, $entity, array $viewDatas): string +{ + $value = $entity->$field ?: DEFAULTS['EMPTY']; + switch ($field) { + case 'title': + case 'name': + return anchor( + $viewDatas['currentCategory']->linkurl . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey(), + $value, + ["target" => "_self"] + ); + break; + default: + return getFieldView_BoardHelper($field, $entity, $viewDatas); + break; + } +} // + //Admin용 function getFieldIndex_Row_BoardHelper_Admin($field, $entity, array $viewDatas): string { diff --git a/app/Helpers/Order_helper.php b/app/Helpers/Order_helper.php index 60214e3..a971397 100644 --- a/app/Helpers/Order_helper.php +++ b/app/Helpers/Order_helper.php @@ -137,7 +137,7 @@ function getFieldIndex_Row_OrderHelper($field, $entity, array $viewDatas): strin case 'name': $uid = lang("{$viewDatas['className']}.label.uid") . ' : ' . str_split($entity->getPrimaryKey(), 4)[0] . '-xx-' . str_split($entity->getPrimaryKey(), 4)[1]; $title = anchor( - current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(), + current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey(), $value, ["target" => "_self"] ); diff --git a/app/Helpers/Product_helper.php b/app/Helpers/Product_helper.php index 405bbb6..b1addd5 100644 --- a/app/Helpers/Product_helper.php +++ b/app/Helpers/Product_helper.php @@ -141,7 +141,7 @@ function getFieldIndex_Row_ProductHelper($field, $entity, array $viewDatas): str case 'title': case 'name': return anchor( - current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(), + current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey(), $value, ["target" => "_self"] ); diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index 96c6e98..6123c43 100644 --- a/app/Models/BaseModel.php +++ b/app/Models/BaseModel.php @@ -73,18 +73,34 @@ abstract class BaseModel extends Model { return $this->where($conditions)->findAll(); } + final public function getUUID() + { + $randomBytes = bin2hex(random_bytes(32)); + return sprintf( + '%08s-%04s-%04x-%04x-%12s', + substr($randomBytes, 0, 8), + substr($randomBytes, 8, 4), + substr($randomBytes, 12, 4), + substr($randomBytes, 16, 4), + substr($randomBytes, 20, 12) + ); + } + final protected function getUUIDFieldRule($condition = 'required'): string + { + return "{$condition}|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]"; + } public function getFieldRule(string $field, array $rules, string $action = ""): array { switch ($field) { case $this->primaryKey: //수동입력인경우 if (!$this->useAutoIncrement) { - $rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]"; + $rules[$field] = $this->getUUIDFieldRule(); $rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : ""; } break; case "user_uid": - $rules[$field] = "if_exist|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]"; + $rules[$field] = $this->getUUIDFieldRule('if_exist'); break; case "passwd": $rules[$field] = "if_exist|trim|string"; @@ -167,19 +183,6 @@ abstract class BaseModel extends Model // return $fieldFormOptions; // } - final public function getUUID() - { - $randomBytes = bin2hex(random_bytes(16)); - return sprintf( - "%s-%s-%s-%s-%s", - substr($randomBytes, 0, 8), - substr($randomBytes, 8, 4), - substr($randomBytes, 12, 4), - substr($randomBytes, 16, 4), - substr($randomBytes, 20) - ); - } - //create , modify 직전 작업용 작업 protected function changeFormData(string $action, string $field, array $formDatas, $entity) { diff --git a/app/Models/BoardModel.php b/app/Models/BoardModel.php index eb6fc13..6f115cc 100644 --- a/app/Models/BoardModel.php +++ b/app/Models/BoardModel.php @@ -32,7 +32,10 @@ class BoardModel extends BaseHierarchyModel { switch ($field) { case "category_uid": - $rules[$field] = "required|numeric"; + $rules[$field] = "required|string"; + break; + case "user_uid": + $rules[$field] = $this->getUUIDFieldRule('required'); break; case $this->getTitleField(): case "content": diff --git a/app/Models/CategoryModel.php b/app/Models/CategoryModel.php index d1dfcef..a995f42 100644 --- a/app/Models/CategoryModel.php +++ b/app/Models/CategoryModel.php @@ -29,6 +29,9 @@ class CategoryModel extends BaseHierarchyModel public function getFieldRule(string $field, array $rules, string $action = ""): array { switch ($field) { + case $this->primaryKey: + $rules[$field] = "required|string"; + break; case $this->getTitleField(): $rules[$field] = "required|trim|string"; $rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : ""; diff --git a/app/Models/OrderBillingModel.php b/app/Models/OrderBillingModel.php index 6c78848..089de51 100644 --- a/app/Models/OrderBillingModel.php +++ b/app/Models/OrderBillingModel.php @@ -23,8 +23,8 @@ class OrderBillingModel extends BaseModel public function getFieldRule(string $field, array $rules, string $action = ""): array { switch ($field) { - case 'order_uid': - $rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]"; + case "order_uid": + $rules[$field] = $this->getUUIDFieldRule('required'); break; case 'billing_uid': $rules[$field] = "required|numeric"; diff --git a/app/Models/OrderModel.php b/app/Models/OrderModel.php index 96c16a7..5bbec4d 100644 --- a/app/Models/OrderModel.php +++ b/app/Models/OrderModel.php @@ -28,8 +28,8 @@ class OrderModel extends BaseModel public function getFieldRule(string $field, array $rules, string $action = ""): array { switch ($field) { - case 'product_uid': - $rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]"; + case "product_uid": + $rules[$field] = $this->getUUIDFieldRule('required'); break; case $this->getTitleField(): $rules[$field] = "required|trim|string"; diff --git a/app/Models/ProductModel.php b/app/Models/ProductModel.php index 020ad2f..aeea6c2 100644 --- a/app/Models/ProductModel.php +++ b/app/Models/ProductModel.php @@ -32,10 +32,10 @@ class ProductModel extends BaseModel { switch ($field) { case "category_uid": - $rules[$field] = "required|numeric"; + $rules[$field] = "required|string"; break; case "user_uid": - $rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]"; + $rules[$field] = $this->getUUIDFieldRule('required'); break; case $this->getTitleField(): $rules[$field] = "required|trim|string"; diff --git a/app/Models/SitepageModel.php b/app/Models/SitepageModel.php index d11cf36..2e80517 100644 --- a/app/Models/SitepageModel.php +++ b/app/Models/SitepageModel.php @@ -32,7 +32,10 @@ class SitepageModel extends BaseModel { switch ($field) { case "category_uid": - $rules[$field] = "required|numeric"; + $rules[$field] = "required|string"; + break; + case "user_uid": + $rules[$field] = $this->getUUIDFieldRule('required'); break; case $this->getTitleField(): case "content": diff --git a/app/Views/front/board/cell/information.php b/app/Views/front/board/cell/information.php index e0d0aa4..54d7481 100644 --- a/app/Views/front/board/cell/information.php +++ b/app/Views/front/board/cell/information.php @@ -1,11 +1,5 @@ - - - - - - - - - - -
\ No newline at end of file + + + + + \ 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 98b79d8..f6a712f 100644 --- a/app/Views/layouts/front/left_menu.php +++ b/app/Views/layouts/front/left_menu.php @@ -7,7 +7,7 @@
parent]['entity']->getTitle() ?>
parent]['childs'] as $child) : ?> -
+
"> getTitle() ?>
diff --git a/app/Views/layouts/front/top_menu.php b/app/Views/layouts/front/top_menu.php index 02e4449..192a2bd 100644 --- a/app/Views/layouts/front/top_menu.php +++ b/app/Views/layouts/front/top_menu.php @@ -19,7 +19,7 @@ diff --git a/public/css/common/left_menu.css b/public/css/common/left_menu.css index f3e2b8d..30bb035 100644 --- a/public/css/common/left_menu.css +++ b/public/css/common/left_menu.css @@ -29,6 +29,9 @@ div#left_menu div.sibling { height:60px; border-bottom:1px solid silver; } +div#left_menu div.active { + background-color:#26417D; +} div#left_menu div.sibling a{ text-decoration: none; color:black; diff --git a/public/css/common/top_menu.css b/public/css/common/top_menu.css index 588263c..de2808b 100644 --- a/public/css/common/top_menu.css +++ b/public/css/common/top_menu.css @@ -54,8 +54,12 @@ text-align:center; text-decoration:none; } -#top_menu div.dropdown-center ul.navbar-nav li.dropdown ul.dropdown-menu li a.active{ - color:#efefef; +#top_menu div.dropdown-center ul.navbar-nav li.dropdown ul.dropdown-menu li.active{ + background-color:#26417D; + /* border:1px solid red; */ +} +#top_menu div.dropdown-center ul.navbar-nav li.dropdown ul.dropdown-menu li.active a{ + color:white; background-color:#26417D; /* border:1px solid red; */ }