diff --git a/app/Config/Constants.php b/app/Config/Constants.php index ce16c0c..eae28c3 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -212,8 +212,8 @@ define('ICONS', [ define('CLASS_ICONS', [ 'USER' => '', 'USERSNS' => '', - 'BOARDCONFIG' => '', 'BOARD' => '', + 'SITEPAGE' => '', 'CATEGORY' => '', 'PRODUCT' => '', 'CART' => '', diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 5bcea36..da230c7 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -97,6 +97,18 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au $routes->post('batchjob', 'BoardController::batchjob'); $routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2'); }); + $routes->group('sitepage', static function ($routes) { + $routes->get('', 'SitepageController::index'); + $routes->get('excel', 'SitepageController::excel/$1'); + $routes->get('insert', 'SitepageController::insert_form'); + $routes->post('insert', 'SitepageController::insert'); + $routes->get('update/(:num)', 'SitepageController::update_form/$1'); + $routes->post('update/(:num)', 'SitepageController::update/$1'); + $routes->get('view/(:num)', 'SitepageController::view/$1'); + $routes->get('delete/(:num)', 'SitepageController::delete/$1', ['filter' => 'authFilter:master']); + $routes->get('toggle/(:num)/(:hash)', 'SitepageController::toggle/$1/$2'); + $routes->post('batchjob', 'SitepageController::batchjob'); + }); $routes->group('product', static function ($routes) { $routes->get('', 'ProductController::index'); $routes->get('excel', 'ProductController::excel/$1'); @@ -137,6 +149,9 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou $routes->get('delete/(:num)', 'BoardController::delete/$1'); $routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2'); }); + $routes->group('sitepage', static function ($routes) { + $routes->get('', 'SitepageController::index'); + }); $routes->group('product', static function ($routes) { $routes->get('', 'ProductController::index'); $routes->get('excel', 'ProductController::excel/$1'); diff --git a/app/Config/Routes_Shoppinmall.php b/app/Config/Routes_Shoppinmall.php index bf4af24..da230c7 100644 --- a/app/Config/Routes_Shoppinmall.php +++ b/app/Config/Routes_Shoppinmall.php @@ -46,7 +46,7 @@ $routes->group('ecommerce', ['namespace' => 'App\Controllers'], function ($route $routes->get('cancelCart', 'EcommerceController::cancelCart'); }); // authGuard는 App\Config\Filters.php의 $aliases에 선언한 이름이어야 함 -$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:master,director,cloudflare,manager'], static function ($routes) { +$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:manager'], static function ($routes) { $routes->get('/', 'Home::index'); $routes->group('user', static function ($routes) { $routes->get('', 'UserController::index'); @@ -57,16 +57,16 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au $routes->post('update/(:uuid)', 'UserController::update/$1'); $routes->get('view/(:uuid)', 'UserController::view/$1'); $routes->get('delete/(:uuid)', 'UserController::delete/$1', ['filter' => 'authFilter:master']); - $routes->get('toggle/(:uuid)/(:hash)', 'UserController::toggle/$1/$2'); - $routes->post('batchjob', 'UserController::batchjob'); + $routes->get('toggle/(:uuid)/(:hash)', 'UserController::toggle/$1/$2', ['filter' => 'authFilter:master']); + $routes->post('batchjob', 'UserController::batchjob', ['filter' => 'authFilter:master']); }); $routes->group('usersns', static function ($routes) { $routes->get('', 'UserSNSController::index'); $routes->get('excel', 'UserSNSController::excel'); $routes->get('view/(:num)', 'UserSNSController::view/$1'); - $routes->get('delete/(:num)', 'UserSNSController::delete/$1'); - $routes->get('toggle/(:num)/(:hash)', 'UserSNSController::toggle/$1/$2'); - $routes->post('batchjob', 'UserSNSController::batchjob'); + $routes->get('delete/(:num)', 'UserSNSController::delete/$1', ['filter' => 'authFilter:master']); + $routes->get('toggle/(:num)/(:hash)', 'UserSNSController::toggle/$1/$2', ['filter' => 'authFilter:master']); + $routes->post('batchjob', 'UserSNSController::batchjob', ['filter' => 'authFilter:master']); }); $routes->group('category', static function ($routes) { $routes->get('', 'CategoryController::index'); @@ -97,6 +97,18 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au $routes->post('batchjob', 'BoardController::batchjob'); $routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2'); }); + $routes->group('sitepage', static function ($routes) { + $routes->get('', 'SitepageController::index'); + $routes->get('excel', 'SitepageController::excel/$1'); + $routes->get('insert', 'SitepageController::insert_form'); + $routes->post('insert', 'SitepageController::insert'); + $routes->get('update/(:num)', 'SitepageController::update_form/$1'); + $routes->post('update/(:num)', 'SitepageController::update/$1'); + $routes->get('view/(:num)', 'SitepageController::view/$1'); + $routes->get('delete/(:num)', 'SitepageController::delete/$1', ['filter' => 'authFilter:master']); + $routes->get('toggle/(:num)/(:hash)', 'SitepageController::toggle/$1/$2'); + $routes->post('batchjob', 'SitepageController::batchjob'); + }); $routes->group('product', static function ($routes) { $routes->get('', 'ProductController::index'); $routes->get('excel', 'ProductController::excel/$1'); @@ -119,7 +131,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au }); }); $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($routes) { - $routes->group('user', ['namespace' => 'App\Controllers\Front', 'filter' => 'authFilter:master,director,cloudflare,manager,gold,silver,brone,vip,user'], static function ($routes) { + $routes->group('user', ['namespace' => 'App\Controllers\Front', 'filter' => 'authFilter:user'], static function ($routes) { $routes->get('update/(:uuid)', 'UserController::update_form/$1'); $routes->post('update/(:uuid)', 'UserController::update/R1'); $routes->get('view/(:uuid)', 'UserController::view/$1'); @@ -134,9 +146,12 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou $routes->get('view/(:num)', 'BoardController::view/$1'); $routes->get('reply/(:num)', 'BoardController::reply_form/$1'); $routes->post('reply/(:num)', 'BoardController::reply/$1'); - $routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']); + $routes->get('delete/(:num)', 'BoardController::delete/$1'); $routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2'); }); + $routes->group('sitepage', static function ($routes) { + $routes->get('', 'SitepageController::index'); + }); $routes->group('product', static function ($routes) { $routes->get('', 'ProductController::index'); $routes->get('excel', 'ProductController::excel/$1'); diff --git a/app/Controllers/Admin/SitepageController.php b/app/Controllers/Admin/SitepageController.php new file mode 100644 index 0000000..af1d591 --- /dev/null +++ b/app/Controllers/Admin/SitepageController.php @@ -0,0 +1,43 @@ +_model = new SitepageModel(); + parent::initController($request, $response, $logger); + $this->_viewPath .= strtolower($this->_model->getClassName()); + } + + public function getFields(string $action = ""): array + { + $fields = ["category_uid", 'title', "status", "content"]; + switch ($action) { + case "index": + case "excel": + return ["category_uid", "user_uid", 'title', "status", "created_at"]; + break; + case "view": + return ["category_uid", "user_uid", 'title', "status", "created_at", "content"]; + break; + default: + return $fields; + break; + } + } + public function getFieldFilters(): array + { + return ["category_uid", "user_uid", "status"]; + } + public function getFieldBatchFilters(): array + { + return parent::getFieldBatchFilters(); + } +} diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 5e81ec0..903cfd3 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -337,12 +337,13 @@ abstract class BaseController extends Controller public function batchjob() { $msg = ""; + $uids = array(); $entitys = array(); $batchjobs = array(); try { //fields 해당하는 field중 선택된 값이 있는경우만 fields로 정의 $fields = array(); - foreach ($this->_model->getFieldBatchFilters() as $field) { + foreach ($this->getFieldBatchFilters() as $field) { if ($this->request->getVar($field)) { array_push($fields, $field); } @@ -386,6 +387,7 @@ abstract class BaseController extends Controller count($entitys), count($uids) - count($entitys), __FUNCTION__, + $e->getMessage() ); log_message("error", $e->getMessage()); return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); diff --git a/app/Controllers/EcommerceController.php b/app/Controllers/EcommerceController.php index f0d8cd6..8fb8b89 100644 --- a/app/Controllers/EcommerceController.php +++ b/app/Controllers/EcommerceController.php @@ -51,7 +51,7 @@ class EcommerceController extends Controller } private function getOrderModel() { - return $this->_orderModel = $this->_orderModel ?: new OrderModel(["product_uid", "quantity", "price", "status"]); + return $this->_orderModel = $this->_orderModel ?: new OrderModel(); } private function getProductModel() { @@ -76,7 +76,7 @@ class EcommerceController extends Controller { $msg = ""; try { - $this->_viewDatas['fields'] = ["product_uid", "quantity", "price", "status"]; + $this->_viewDatas['fields'] = ["product_uid", "quantity", "price"]; $this->_viewDatas['fieldRules'] = $this->getOrderModel()->getFieldRules($this->_viewDatas['fields']); //Transaction 시작 $this->getOrderModel()->transStart(); diff --git a/app/Controllers/Front/FrontController.php b/app/Controllers/Front/FrontController.php index b7b08d7..d62c89a 100644 --- a/app/Controllers/Front/FrontController.php +++ b/app/Controllers/Front/FrontController.php @@ -28,7 +28,10 @@ abstract class FrontController extends BaseController //권한체크 final protected function isRole($action, $entity = null) { - $this->_category = !is_null($entity) ? $entity->category_uid : ($this->request->getVar('category') ?: throw new \Exception("범주를 지정하지 않으셨습니다.")); + $this->_category = $this->request->getVar('category'); + if (is_null($this->_category)) { + $this->_category = !is_null($entity) ? $entity->category_uid : 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); diff --git a/app/Controllers/Front/OrderController.php b/app/Controllers/Front/OrderController.php index 2a2f6ed..ea00975 100644 --- a/app/Controllers/Front/OrderController.php +++ b/app/Controllers/Front/OrderController.php @@ -39,10 +39,23 @@ class OrderController extends FrontController return ["status"]; } + //View관련 + protected function view_process($entity) + { + //권한체크 + $this->isRole('view', $entity); + return parent::view_process($entity); + } + //Index관련 + protected function index_process() + { + //권한체크 + $this->isRole('index'); + return parent::index_process(); + } protected function index_setCondition() { - parent::index_setCondition(); //세션에 Cart정보(order_uids)가 있으면 $uids = $this->_session->get(SESSION_NAMES['CART']) ?: array('NONE'); //또는 Login했으면 사용자정보(user_uid)에 맞는 Order정보 가져오기 @@ -54,5 +67,6 @@ class OrderController extends FrontController } elseif (count($uids)) { $this->_model->whereIn('uid', $uids); } + parent::index_setCondition(); } } diff --git a/app/Controllers/Front/SitepageController.php b/app/Controllers/Front/SitepageController.php new file mode 100644 index 0000000..70a67cf --- /dev/null +++ b/app/Controllers/Front/SitepageController.php @@ -0,0 +1,56 @@ +_model = new SitepageModel($this->getFields()); + parent::initController($request, $response, $logger); + $this->_viewPath .= strtolower($this->_model->getClassName()); + } + public function getFields(string $action = ""): array + { + $fields = ["content"]; + switch ($action) { + case "index": + case "excel": + return ['title', "created_at"]; + break; + case "view": + return ['title', "created_at", "content"]; + break; + default: + return $fields; + break; + } + } + public function getFieldFilters(): array + { + return []; + } + public function getFieldBatchFilters(): array + { + return parent::getFieldBatchFilters(); + } + //Index관련 + protected function index_process() + { + //권한체크 + $this->isRole('index'); + return parent::index_process(); + } + //Category 및 Status 조건추가 + protected function index_setCondition() + { + $this->_model->where("category_uid", $this->_viewDatas['category']->getPrimaryKey()); + $this->_model->where("status", DEFAULTS['STATUS']); + parent::index_setCondition(); + } +} diff --git a/app/Database/shoppingmall.sql b/app/Database/shoppingmall.sql index 45b3e42..7bab674 100644 --- a/app/Database/shoppingmall.sql +++ b/app/Database/shoppingmall.sql @@ -16,7 +16,6 @@ CREATE TABLE shoppingmall.tw_user ( UNIQUE KEY (email) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='사용자 정보'; -- insert into tw_user (uid,id,passwd,name,email,role,status) select uuid(),id,passwd,name,email,role,status from cfmgr.user; -DROP TABLE IF EXISTS shoppingmall.tw_user_profile; DROP TABLE IF EXISTS shoppingmall.tw_user_sns; @@ -94,6 +93,22 @@ CREATE TABLE shoppingmall.tw_board ( CONSTRAINT FOREIGN KEY (user_uid) REFERENCES tw_user (uid) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='게시물 정보'; +DROP TABLE IF EXISTS shoppingmall.tw_sitepage; +CREATE TABLE shoppingmall.tw_sitepage ( + uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + category_uid int(10) UNSIGNED NOT NULL COMMENT '범주 UID', + user_uid varchar(36) NULL COMMENT '작성자 정보', + title varchar(255) NOT NULL COMMENT '제목', + content text NOT NULL COMMENT '내용', + status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 사용, unuse: 사용않함 등등', + updated_at timestamp NULL DEFAULT NULL, + 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) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='사이트페이지 정보'; + DROP TABLE IF EXISTS shoppingmall.tw_product; CREATE TABLE shoppingmall.tw_product ( uid varchar(36) NOT NULL, diff --git a/app/Entities/SitepageEntity.php b/app/Entities/SitepageEntity.php new file mode 100644 index 0000000..e8e289a --- /dev/null +++ b/app/Entities/SitepageEntity.php @@ -0,0 +1,17 @@ +attributes['title']; + } + //추가기능 +} diff --git a/app/Helpers/Order_helper.php b/app/Helpers/Order_helper.php index 27be7da..ce28b72 100644 --- a/app/Helpers/Order_helper.php +++ b/app/Helpers/Order_helper.php @@ -103,7 +103,7 @@ function getFieldIndex_Row_OrderHelper($field, $entity, array $viewDatas): strin case 'title': case 'name': return anchor( - current_url() . '/view/' . $entity->getPrimaryKey(), + current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(), $value, ["target" => "_self"] ); diff --git a/app/Helpers/Sitepage_helper.php b/app/Helpers/Sitepage_helper.php new file mode 100644 index 0000000..c2b6cb7 --- /dev/null +++ b/app/Helpers/Sitepage_helper.php @@ -0,0 +1,150 @@ +%s", implode(" ", $attributes), lang("{$viewDatas['className']}.label.{$field}")); + break; + } +} +//header.php에서 getFieldForm_Helper사용 +function getFieldForm_SitepageHelper($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"]); + break; + case 'title': + case 'name': + return form_input($field, $value, ["placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]); + break; + case 'passwd': + return sprintf( + "%s %s %s", + form_password($field, DEFAULTS['EMPTY']), + lang("{$viewDatas['className']}.label.confirmpassword"), + form_password('confirmpassword', DEFAULTS['EMPTY']), + ); + break; + case 'content': + case 'head': + case 'tail': + return form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']); + break; + case 'upload_file': + case 'board_file': + return form_upload($field); + break; + case 'view_cnt': + return form_input($field, $value, ['type' => 'number']); + break; + case "status": + $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_SitepageHelper($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 'board_file': + case 'upload_file': + return $entity->getFileDownload(base_url() . $viewDatas['control'] . '/board', $field); + break; + case 'photo': + return $entity->getFileImage('middle', $field); + break; + 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_SitepageHelper($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_SitepageHelper($field, array $viewDatas) +{ + $label = lang("{$viewDatas['className']}.label.{$field}"); + $label = $field == $viewDatas['order_field'] ? sprintf('%s ', $label, $viewDatas['order_value'] == 'ASC' ? "up" : "down") : $label; + $value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; + return anchor(current_url() . "?order_field={$field}&order_value={$value}", $label); +} // + +//Front용 +function getFieldIndex_Row_SitepageHelper($field, $entity, array $viewDatas): string +{ + $value = $entity->$field ?: DEFAULTS['EMPTY']; + switch ($field) { + case 'title': + case 'name': + return anchor( + current_url() . '/view/' . $entity->getPrimaryKey(), + $value ? str_split($value, 66)[0] . "..." : "", + ["target" => "_self"] + ); + break; + default: + return getFieldView_SitepageHelper($field, $entity, $viewDatas); + break; + } +} // + +//Admin용 +function getFieldIndex_Row_SitepageHelper_Admin($field, $entity, array $viewDatas): string +{ + switch ($field) { + 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_SitepageHelper($field, $entity->$field, $viewDatas, $attributes); + } + return getFieldIndex_Row_SitepageHelper($field, $entity, $viewDatas); + break; + } +} // \ No newline at end of file diff --git a/app/Language/ko/Board.php b/app/Language/ko/Board.php index 1bd2233..2ceec00 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_uid' => "분류", 'user_uid' => "작성자", 'title' => "제목", 'content' => "내용", diff --git a/app/Language/ko/Sitepage.php b/app/Language/ko/Sitepage.php new file mode 100644 index 0000000..b0b8210 --- /dev/null +++ b/app/Language/ko/Sitepage.php @@ -0,0 +1,15 @@ + "사이트페이지 정보", + 'label' => [ + 'uid' => "번호", + 'category_uid' => "분류", + 'user_uid' => "작성자", + 'title' => "제목", + 'content' => "내용", + 'status' => "상태", + 'updated_at' => "수정일", + 'created_at' => "작성일" + ], + 'STATUS' => ['use' => '사용', 'unuse' => '사용않함'], +]; diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index 43b51f5..f2abc3d 100644 --- a/app/Models/BaseModel.php +++ b/app/Models/BaseModel.php @@ -230,7 +230,7 @@ abstract class BaseModel extends Model } protected function create_process($entity, array $formDatas) { - foreach ($this->formDatas as $field => $value) { + foreach (array_keys($formDatas) as $field) { $entity = $this->changeFormData('create', $field, $formDatas, $entity); } //primaryKey가 수동입력이면 diff --git a/app/Models/SitepageModel.php b/app/Models/SitepageModel.php new file mode 100644 index 0000000..f04b8c6 --- /dev/null +++ b/app/Models/SitepageModel.php @@ -0,0 +1,90 @@ +allowedFields = [ + ...$this->allowedFields, + "category_uid", + "user_uid", 'title', "content", + "status" + ]; + $this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),]; + } + public function getTitleField(): string + { + return 'title'; + } + public function getContentField(): string + { + return 'content'; + } + protected function getFieldRule(string $field, array $rules, string $action = ""): array + { + switch ($field) { + case "category_uid": + $rules[$field] = "required|numeric"; + break; + case $this->getTitleField(): + case "content": + $rules[$field] = "required|string"; + break; + default: + $rules = parent::getFieldRule($field, $rules, $action); + break; + } + return $rules; + } + //Field별 Form Option용 + public function getFieldFormOption(string $field): array + { + switch ($field) { + case 'category_uid': + if (is_null($this->_category_options)) { + $categoryModel = new CategoryModel(); + $this->_category_options = $categoryModel->getOptions(); + } + $options = $this->_category_options; + break; + default: + return parent::getFieldFormOption($field); + break; + } + if (!is_array($options)) { + throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 Field:{$field}의 FormOptionData가 array가 아닙니다.\n" . var_export($options, true)); + } + return $options; + } + public function getEntity($conditions): SitepageEntity + { + return $this->where($conditions)->first() ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); + } + + public function create(array $formDatas): SitepageEntity + { + return $this->create_process(new SitepageEntity(), $formDatas); + } + public function modify(SitepageEntity $entity, array $formDatas): SitepageEntity + { + 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/Views/admin/sitepage/index.php b/app/Views/admin/sitepage/index.php new file mode 100644 index 0000000..7805d1f --- /dev/null +++ b/app/Views/admin/sitepage/index.php @@ -0,0 +1,49 @@ +extend('layouts/admin') ?> +section('content') ?> +
+
+ "get")) ?> + + +
+ + + + + + + + + + + + + status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> + + + + + + + + + +
번호작업
+ "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?> + getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?> + getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
+
+ + +
+ +
+endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/sitepage/insert.php b/app/Views/admin/sitepage/insert.php new file mode 100644 index 0000000..a074776 --- /dev/null +++ b/app/Views/admin/sitepage/insert.php @@ -0,0 +1,21 @@ +extend('layouts/admin') ?> +section('content') ?> +
+ + + + + + + + + + + +
+ + +
"btn btn-outline btn-primary")); ?>
+ +
+endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/sitepage/update.php b/app/Views/admin/sitepage/update.php new file mode 100644 index 0000000..22d6346 --- /dev/null +++ b/app/Views/admin/sitepage/update.php @@ -0,0 +1,21 @@ +extend('layouts/admin') ?> +section('content') ?> +
+ + + + + + + + + + + +
+ $field ?: DEFAULTS['EMPTY']), $viewDatas) ?> + +
"btn btn-outline btn-primary")); ?>
+ +
+endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/sitepage/view.php b/app/Views/admin/sitepage/view.php new file mode 100644 index 0000000..4eeb5da --- /dev/null +++ b/app/Views/admin/sitepage/view.php @@ -0,0 +1,16 @@ +extend('layouts/admin') ?> +section('content') ?> +
+ + + + + + + +
+ + +
+
+endSection() ?> \ No newline at end of file diff --git a/app/Views/front/order/index.php b/app/Views/front/order/index.php index ece232a..2782f5b 100644 --- a/app/Views/front/order/index.php +++ b/app/Views/front/order/index.php @@ -2,20 +2,9 @@ section('content') ?>
+
head) ?>
include('templates/front/index_head') ?> -
@@ -40,5 +29,6 @@
+
tail) ?>
endSection() ?> \ No newline at end of file diff --git a/app/Views/front/order/view.php b/app/Views/front/order/view.php index 907ba07..1da17c3 100644 --- a/app/Views/front/order/view.php +++ b/app/Views/front/order/view.php @@ -1,7 +1,9 @@ extend('layouts/front') ?> section('content') ?> - + +
+
head) ?>
@@ -15,5 +17,6 @@
+
tail) ?>
endSection() ?> \ No newline at end of file diff --git a/app/Views/front/sitepage/index.php b/app/Views/front/sitepage/index.php new file mode 100644 index 0000000..e31e7e2 --- /dev/null +++ b/app/Views/front/sitepage/index.php @@ -0,0 +1,17 @@ +extend('layouts/front') ?> +section('content') ?> + +
+
head) ?>
+
+ include('templates/front/index_head') ?> +
+ + + + + +
+
tail) ?>
+
+endSection() ?> \ No newline at end of file diff --git a/app/Views/front/user/update.php b/app/Views/front/user/update.php index 84abebe..95465be 100644 --- a/app/Views/front/user/update.php +++ b/app/Views/front/user/update.php @@ -2,6 +2,7 @@ section('content') ?>
+
head) ?>
@@ -18,5 +19,6 @@
+
head) ?>
endSection() ?> \ No newline at end of file diff --git a/app/Views/layouts/admin/left_menu/board.php b/app/Views/layouts/admin/left_menu/board.php index 0ad5d5c..29799bc 100644 --- a/app/Views/layouts/admin/left_menu/board.php +++ b/app/Views/layouts/admin/left_menu/board.php @@ -4,10 +4,13 @@
-

범주 관리

+

분류 관리

게시글 관리

+
+

SitePage 관리

+
\ 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 index acd00a7..44954c3 100644 --- a/app/Views/layouts/front/top_menu/top_menu_aboutus.php +++ b/app/Views/layouts/front/top_menu/top_menu_aboutus.php @@ -5,8 +5,8 @@ About US