From 46364d42d37db0c07def867c2c7389f18621b67b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0git=20config=20git=20config=20-?= =?UTF-8?q?-helpgit=20config=20--global=20user=2Ename=20=EC=B5=9C=EC=A4=80?= =?UTF-8?q?=ED=9D=A0?= Date: Wed, 26 Jul 2023 05:22:09 +0900 Subject: [PATCH 1/3] servermgrv2 init... --- app/Config/Routes.php | 15 ----- app/Controllers/Admin/Home.php | 2 +- app/Controllers/BaseController.php | 23 +++---- app/Entities/BaseEntity.php | 1 + app/Entities/BoardConfigEntity.php | 7 ++ app/Entities/BoardEntity.php | 7 ++ app/Entities/UserEntity.php | 7 ++ app/Entities/UserSNSEntity.php | 7 ++ app/Helpers/Admin/BoardConfig_helper.php | 85 +++++++++--------------- app/Helpers/Admin/Board_helper.php | 59 ++++++++-------- app/Helpers/Admin/UserSNS_helper.php | 59 +++++++++++----- app/Helpers/Admin/User_helper.php | 72 ++++++++++---------- app/Models/BaseModel.php | 1 + app/Models/BoardConfigModel.php | 7 +- app/Models/BoardModel.php | 7 +- app/Models/UserModel.php | 7 +- app/Models/UserSNSModel.php | 9 +-- app/Views/admin/board/index.php | 12 ++-- app/Views/admin/board/insert.php | 11 +-- app/Views/admin/board/reply.php | 10 +-- app/Views/admin/board/update.php | 10 +-- app/Views/admin/boardconfig/index.php | 12 ++-- app/Views/admin/boardconfig/insert.php | 9 +-- app/Views/admin/boardconfig/update.php | 10 +-- app/Views/admin/user/index.php | 12 ++-- app/Views/admin/user/insert.php | 2 +- app/Views/admin/user/update.php | 10 +-- app/Views/admin/usersns/index.php | 10 +-- app/Views/layouts/admin/left_menu.php | 1 - app/Views/templates/admin/footer.php | 57 +++++++++------- 30 files changed, 266 insertions(+), 275 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 0382be8..277620f 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -93,21 +93,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au $routes->post('batchjob', 'BoardController::batchjob'); $routes->get('download/(:num)', 'BoardController::download/$1'); }); - $routes->group('hpilo', static function ($routes) { - $routes->get('', 'HPILOController::index'); - $routes->get('excel', 'HPILOController::excel'); - $routes->get('insert', 'HPILOController::insert_form'); - $routes->post('insert', 'HPILOController::insert'); - $routes->get('update/(:num)', 'HPILOController::update_form/$1'); - $routes->post('update/(:num)', 'HPILOController::update/$1'); - $routes->get('view/(:num)', 'HPILOController::view/$1'); - $routes->get('delete/(:num)', 'HPILOController::delete/$1', ['filter' => 'authFilter:master']); - $routes->get('toggle/(:num)/(:hash)', 'HPILOController::toggle/$1/$2'); - $routes->post('batchjob', 'HPILOController::batchjob'); - $routes->get('console/(:num)', 'HPILOController::console/$1'); - $routes->get('reset/(:num)/(:alpha)', 'HPILOController::reset/$1/$2'); - $routes->get('reload/(:num)', 'HPILOController::reload/$1'); - }); }); /* * -------------------------------------------------------------------- diff --git a/app/Controllers/Admin/Home.php b/app/Controllers/Admin/Home.php index 1307846..a17e738 100644 --- a/app/Controllers/Admin/Home.php +++ b/app/Controllers/Admin/Home.php @@ -21,5 +21,5 @@ class Home extends AdminController public function index() { return view($this->_viewPath . '/welcome_message', $this->_viewDatas); - } + } } diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 4fd2f0b..d88e1c3 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -233,7 +233,7 @@ abstract class BaseController extends Controller final public function update_form($uid) { try { - $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); + $entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); $this->_viewDatas['fields'] = $this->_model->getFields('update'); $this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], 'update'); $this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters(); @@ -268,7 +268,7 @@ abstract class BaseController extends Controller { $message = ""; try { - $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); + $entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); $this->_viewDatas['fields'] = $this->_model->getFields('update'); $this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], 'update'); $this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters(); @@ -300,7 +300,7 @@ abstract class BaseController extends Controller { $message = ""; try { - $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); + $entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); $this->_viewDatas['fields'] = [$field]; $this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], 'toggle'); $this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters(); @@ -350,7 +350,7 @@ abstract class BaseController extends Controller $this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters(); $entitys = array(); foreach ($uids as $uid) { - $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); + $entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); try { $entity = $this->batchjob_validate($entity); array_push($entitys, $this->batchjob_process($entity)); @@ -384,7 +384,7 @@ abstract class BaseController extends Controller { $message = ""; try { - $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); + $entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); $this->delete_process($entity); $message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다."; log_message("info", "{$this->_viewDatas['title']} {$message}"); @@ -439,7 +439,7 @@ abstract class BaseController extends Controller $this->_model->setIndexDateFilter($start, $end); } } - protected function index_getRows(int $page = 0, int $per_page = 0): array + protected function index_getEntitys(int $page = 0, int $per_page = 0): array { //Totalcount 처리 $this->index_setCondition(); @@ -451,9 +451,9 @@ abstract class BaseController extends Controller $order_value = $this->request->getVar('order_value') ?: 'DESC'; $this->_model->setIndexOrderBy($order_field, $order_value); //Limit - $rows = $per_page ? $this->_model->findAll($per_page, $page * $per_page - $per_page) : $this->_model->findAll(); + $entitys = $per_page ? $this->_model->findAll($per_page, $page * $per_page - $per_page) : $this->_model->findAll(); // log_message("debug", __METHOD__ . "에서 호출[{$per_page}:{$page}=>{$page}*{$per_page}-{$per_page}]\n" . $this->_model->getLastQuery()); - return $rows; + return $entitys; } private function index_getPagination($pager_group = 'default', int $segment = 0, $template = 'bootstrap_full'): string { @@ -477,7 +477,7 @@ abstract class BaseController extends Controller protected function index_process() { //모델 처리 - $this->_viewDatas['rows'] = $this->index_getRows((int)$this->_viewDatas['page'], (int)$this->_viewDatas['per_page']); + $this->_viewDatas['entitys'] = $this->index_getEntitys((int)$this->_viewDatas['page'], (int)$this->_viewDatas['per_page']); //줄수 처리용 $this->_viewDatas['pageOptions'] = array("" => "줄수선택"); for ($i = 10; $i <= $this->_viewDatas['total_count'] + $this->_viewDatas['per_page']; $i += 10) { @@ -528,11 +528,10 @@ abstract class BaseController extends Controller } //본문용 $line = 2; - foreach ($this->index_getRows() as $row) { + foreach ($this->index_getEntitys() as $entity) { $column = 'A'; foreach ($this->_viewDatas['fields'] as $field) { - // echo "\n
".var_export($this->_fieldFilters,true)."\n
".var_export($fieldFormOptions,true);exit; - $value = in_array($field, $this->_viewDatas['fieldFilters']) ? $this->_viewDatas['fieldFormOptions'][$field][$row[$field]] : $row[$field]; + $value = in_array($field, $this->_viewDatas['fieldFilters']) ? $this->_viewDatas['fieldFormOptions'][$field][$entity->$field] : $entity->$field; $sheet->setCellValue($column . $line, $value); $column++; } diff --git a/app/Entities/BaseEntity.php b/app/Entities/BaseEntity.php index f88ec67..6354677 100644 --- a/app/Entities/BaseEntity.php +++ b/app/Entities/BaseEntity.php @@ -8,4 +8,5 @@ abstract class BaseEntity extends Entity { abstract public function getPrimaryKey(); abstract public function getTitle(); + abstract public function getStatus(); } diff --git a/app/Entities/BoardConfigEntity.php b/app/Entities/BoardConfigEntity.php index 59f9cda..02e9b19 100644 --- a/app/Entities/BoardConfigEntity.php +++ b/app/Entities/BoardConfigEntity.php @@ -10,6 +10,7 @@ class BoardConfigEntity extends BaseEntity protected $dates = ['created_at', 'updated_at', 'deleted_at']; protected $casts = []; + //기본기능 public function getPrimaryKey() { return $this->attributes['uid']; @@ -18,6 +19,12 @@ class BoardConfigEntity extends BaseEntity { return $this->attributes['name']; } + public function getStatus() + { + return $this->attributes['status']; + } + + //추가기능 public function getHead() { return $this->attributes['head']; diff --git a/app/Entities/BoardEntity.php b/app/Entities/BoardEntity.php index 34074ed..f090724 100644 --- a/app/Entities/BoardEntity.php +++ b/app/Entities/BoardEntity.php @@ -10,6 +10,7 @@ class BoardEntity extends BaseEntity protected $dates = ['created_at', 'updated_at', 'deleted_at']; protected $casts = []; + //기본기능 public function getPrimaryKey() { return $this->attributes['uid']; @@ -18,6 +19,12 @@ class BoardEntity extends BaseEntity { return $this->attributes['title']; } + public function getStatus() + { + return $this->attributes['status']; + } + + //추가기능 public function getPassword() { return $this->attributes['passwd']; diff --git a/app/Entities/UserEntity.php b/app/Entities/UserEntity.php index c3b8031..9f44fde 100644 --- a/app/Entities/UserEntity.php +++ b/app/Entities/UserEntity.php @@ -10,6 +10,7 @@ class UserEntity extends BaseEntity protected $dates = ['created_at', 'updated_at', 'deleted_at']; protected $casts = []; + //기본기능 public function getPrimaryKey() { return $this->attributes['uid']; @@ -18,6 +19,12 @@ class UserEntity extends BaseEntity { return $this->attributes['name']; } + public function getStatus() + { + return $this->attributes['status']; + } + + //추가기능 public function getRole() { return $this->attributes['role']; diff --git a/app/Entities/UserSNSEntity.php b/app/Entities/UserSNSEntity.php index 01ccc62..12699d6 100644 --- a/app/Entities/UserSNSEntity.php +++ b/app/Entities/UserSNSEntity.php @@ -10,6 +10,7 @@ class UserSNSEntity extends BaseEntity protected $dates = ['created_at', 'updated_at', 'deleted_at']; protected $casts = []; + //기본기능 public function getPrimaryKey() { return $this->attributes['uid']; @@ -18,4 +19,10 @@ class UserSNSEntity extends BaseEntity { return $this->attributes['name']; } + public function getStatus() + { + return $this->attributes['status']; + } + + //추가기능 } diff --git a/app/Helpers/Admin/BoardConfig_helper.php b/app/Helpers/Admin/BoardConfig_helper.php index 9fed9a1..1b85dce 100644 --- a/app/Helpers/Admin/BoardConfig_helper.php +++ b/app/Helpers/Admin/BoardConfig_helper.php @@ -6,7 +6,7 @@ function getFieldLabel_BoardConfigHelper($field, array $fieldRules, array $attri if (strpos($fieldRules[$field], 'required') !== false) { array_push($attributes, 'style="color:red";'); } - return sprintf("%s", implode(" ", $attributes), lang("Admin/BoardConfig.label.{$field}")); + return sprintf("%s", implode(" ", [...$attributes]), lang("Admin/BoardConfig.label.{$field}")); break; } } @@ -22,56 +22,53 @@ function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions, case 'isreply': case 'isupload': case 'isdownload': - // foreach ($fieldFormOptions[$field] as $key => $label) { - // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? $value : explode("|", $value)), $attributes) . $label; - // } - // return implode(" ", $checkboxs); - // break; case 'status': $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes); + return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); + // foreach ($fieldFormOptions[$field] as $key => $label) { + // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label; + // } + // return implode(" ", $checkboxs); + // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); break; case 'updated_at': case 'created_at': return form_input($field, $value, [...$attributes, 'class' => 'calender']); break; case 'passwd': - case 'confirmpassword': - return form_password($field, DEFAULTS['EMPTY'], $attributes); + return sprintf( + "%s %s %s", + form_password($field, DEFAULTS['EMPTY'], [...$attributes]), + lang("Admin/BoardConfig.label.confirmpassword"), + form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]), + ); break; case 'head': case 'tail': return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']); break; + case 'upload_file': + return form_upload($field); + break; default: - return form_input($field, $value, $attributes); + return form_input($field, $value, [...$attributes]); break; } } // function getFieldView_BoardConfigHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) { + $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { - case 'isaccess': - case 'isread': - case 'iswrite': - case 'isreply': - case 'isupload': - case 'isdownload': - foreach ($fieldFormOptions[$field] as $key => $label) { - $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode("|", $entity->$field)), $attributes) . $label; - } - return implode(" ", $checkboxs); + case 'upload_file': + return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]); break; case 'head': case 'tail': - return html_entity_decode($entity->$field); + return html_entity_decode($value); break; default: - if (in_array($field, $fieldFilters)) { - return getFieldForm_BoardConfigHelper($field, $entity->$field, $fieldFormOptions, $attributes); - } - return $entity->$field ?: DEFAULTS['EMPTY']; + return in_array($field, $fieldFilters) ? $fieldFormOptions[$field][$value] : $value; break; } } // @@ -80,15 +77,6 @@ function getFieldFilter_BoardConfigHelper($field, $value, array $fieldFormOption { $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { - // case 'isaccess': - // case 'isread': - // case 'iswrite': - // case 'isreply': - // case 'isupload': - // case 'isdownload': - // $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - // return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes); - // break; default: return getFieldForm_BoardConfigHelper($field, $value, $fieldFormOptions, $attributes); break; @@ -100,36 +88,29 @@ function getFieldIndex_Column_BoardConfigHelper($field, $order_field, $order_val $label = lang("Admin/BoardConfig.label.{$field}"); $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; - return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, $attributes); + return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]); } // -function getFieldIndex_Row_BoardConfigHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array()): string +function getFieldIndex_Row_BoardConfigHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string { + $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { case 'name': - return anchor(current_url() . '/view/' . $row['uid'], $row[$field], [...$attributes, "target" => "_self"]); + return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]); + break; + case 'upload_file': + return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]); break; - // case 'isaccess': - // case 'isread': - // case 'iswrite': - // case 'isreply': - // case 'isupload': - // case 'isdownload': - // foreach ($fieldFormOptions[$field] as $key => $label) { - // $checkboxs[] = form_checkbox($field, $key, in_array($key, explode("|", $row[$field])), $attributes) . $label; - // } - // return '
' . implode("
", $checkboxs) . '
'; - // break; case 'updated_at': case 'created_at': - return isset($row[$field]) ? str_split($row[$field], 10)[0] : ""; + return isset($value) ? str_split($value, 10)[0] : ""; break; default: if (in_array($field, $fieldFilters)) { - $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field); - return getFieldFilter_BoardConfigHelper($field, $row[$field], $fieldFormOptions, $attributes); + $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); + return getFieldFilter_BoardConfigHelper($field, $value, $fieldFormOptions, [...$attributes]); } - return $row[$field] ?: DEFAULTS['EMPTY']; + return $value; break; } } // \ No newline at end of file diff --git a/app/Helpers/Admin/Board_helper.php b/app/Helpers/Admin/Board_helper.php index 9aafb86..326e436 100644 --- a/app/Helpers/Admin/Board_helper.php +++ b/app/Helpers/Admin/Board_helper.php @@ -6,7 +6,7 @@ function getFieldLabel_BoardHelper($field, array $fieldRules, array $attributes if (strpos($fieldRules[$field], 'required') !== false) { array_push($attributes, 'style="color:red";'); } - return sprintf("%s", implode(" ", $attributes), lang("Admin/Board.label.{$field}")); + return sprintf("%s", implode(" ", [...$attributes]), lang("Admin/Board.label.{$field}")); break; } } @@ -14,13 +14,17 @@ function getFieldLabel_BoardHelper($field, array $fieldRules, array $attributes //header.php에서 getFieldForm_Helper사용 function getFieldForm_BoardHelper($field, $value, array $fieldFormOptions, array $attributes = array()) { - $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { - case 'board_config_uid': - case 'user_uid': + case "board_config_uid": + case "user_uid": case 'status': $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes); + return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); + // foreach ($fieldFormOptions[$field] as $key => $label) { + // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label; + // } + // return implode(" ", $checkboxs); + // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); break; case 'updated_at': case 'created_at': @@ -29,41 +33,37 @@ function getFieldForm_BoardHelper($field, $value, array $fieldFormOptions, array case 'passwd': return sprintf( "%s %s %s", - form_password($field, DEFAULTS['EMPTY'], $attributes), + form_password($field, DEFAULTS['EMPTY'], [...$attributes]), lang("Admin/Board.label.confirmpassword"), - form_password('confirmpassword', DEFAULTS['EMPTY'], $attributes), + form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]), ); break; case 'content': return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']); break; + case 'upload_file': case 'board_file': return form_upload($field); break; default: - return form_input($field, $value, [...$attributes, 'size' => '80']); + return form_input($field, $value, [...$attributes]); break; } } // function getFieldView_BoardHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) { + $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { case 'board_file': - list($origin_filename, $filename) = explode("||", $entity->getFile()); - if (is_file(WRITEPATH . PATHS['UPLOAD'] . "/" . $origin_filename)) { - return "파일이 확인되지 않습니다."; - } - return $entity->$field ? anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $entity->$field)[0], [...$attributes, "target" => "_self"]) : ""; + case 'upload_file': + return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]); break; case 'content': - return html_entity_decode($entity->$field); + return html_entity_decode($value); break; default: - if (in_array($field, $fieldFilters)) { - return getFieldForm_BoardHelper($field, $entity->$field, $fieldFormOptions, $attributes); - } - return $entity->$field ?: DEFAULTS['EMPTY']; + return in_array($field, $fieldFilters) ? $fieldFormOptions[$field][$value] : $value; break; } } // @@ -83,33 +83,30 @@ function getFieldIndex_Column_BoardHelper($field, $order_field, $order_value, ar $label = lang("Admin/Board.label.{$field}"); $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; - return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, $attributes); + return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]); } // -function getFieldIndex_Row_BoardHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array()): string +function getFieldIndex_Row_BoardHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string { + $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { case 'title': - return sprintf( - '
%s  %s
', - $row['grpdepth'] * DEFAULTS['HIERARCHY_GRPDEPTH'], - anchor(current_url() . '/view/' . $row['uid'], $row[$field], [...$attributes, "target" => "_self"]), - anchor(current_url() . '/reply/' . $row['uid'], ICONS['REPLY'], [...$attributes, "target" => "_self"]) - ); + return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]); break; case 'board_file': - return $row[$field] ? anchor(current_url() . '/download/' . $row['uid'], ICONS['IMAGE_FILE'] . explode("||", $row[$field])[0], [...$attributes, "target" => "_self"]) : ""; + case 'upload_file': + return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]); break; case 'updated_at': case 'created_at': - return isset($row[$field]) ? str_split($row[$field], 10)[0] : ""; + return isset($value) ? str_split($value, 10)[0] : ""; break; default: if (in_array($field, $fieldFilters)) { - $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field); - return getFieldFilter_BoardHelper($field, $row[$field], $fieldFormOptions, $attributes); + $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); + return getFieldFilter_BoardHelper($field, $value, $fieldFormOptions, [...$attributes]); } - return $row[$field] ?: DEFAULTS['EMPTY']; + return $value; break; } } // \ No newline at end of file diff --git a/app/Helpers/Admin/UserSNS_helper.php b/app/Helpers/Admin/UserSNS_helper.php index ed0ef40..029bb0e 100644 --- a/app/Helpers/Admin/UserSNS_helper.php +++ b/app/Helpers/Admin/UserSNS_helper.php @@ -6,7 +6,7 @@ function getFieldLabel_UserSNSHelper($field, array $fieldRules, array $attribute if (strpos($fieldRules[$field], 'required') !== false) { array_push($attributes, 'style="color:red";'); } - return sprintf("%s", implode(" ", $attributes), lang("Admin/UserSNS.label.{$field}")); + return sprintf("%s", implode(" ", [...$attributes]), lang("Admin/UserSNS.label.{$field}")); break; } } @@ -16,29 +16,52 @@ function getFieldForm_UserSNSHelper($field, $value, array $fieldFormOptions, arr { $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { - case 'user_uid': + case "user_uid": case 'status': $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes); + return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); + // foreach ($fieldFormOptions[$field] as $key => $label) { + // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label; + // } + // return implode(" ", $checkboxs); + // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); break; case 'updated_at': case 'created_at': return form_input($field, $value, [...$attributes, 'class' => 'calender']); break; + case 'passwd': + return sprintf( + "%s %s %s", + form_password($field, DEFAULTS['EMPTY'], [...$attributes]), + lang("Admin/UserSNS.label.confirmpassword"), + form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]), + ); + break; + case 'content': + return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']); + break; + case 'upload_file': + return form_upload($field); + break; default: - return form_input($field, $value, $attributes); + return form_input($field, $value, [...$attributes]); break; } } // function getFieldView_UserSNSHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) { + $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { + case 'upload_file': + return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]); + break; + case 'content': + return html_entity_decode($value); + break; default: - if (in_array($field, $fieldFilters)) { - return getFieldForm_UserSNSHelper($field, $entity->$field, $fieldFormOptions, $attributes); - } - return $entity->$field ?: DEFAULTS['EMPTY']; + return in_array($field, $fieldFilters) ? $fieldFormOptions[$field][$value] : $value; break; } } // @@ -58,25 +81,29 @@ function getFieldIndex_Column_UserSNSHelper($field, $order_field, $order_value, $label = lang("Admin/UserSNS.label.{$field}"); $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; - return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, $attributes); + return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]); } // -function getFieldIndex_Row_UserSNSHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array()): string +function getFieldIndex_Row_UserSNSHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string { + $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { - case 'name': - return anchor(current_url() . '/view/' . $row['uid'], $row[$field], [...$attributes, "target" => "_self"]); + case 'id': + return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]); + break; + case 'upload_file': + return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]); break; case 'updated_at': case 'created_at': - return isset($row[$field]) ? str_split($row[$field], 10)[0] : ""; + return isset($value) ? str_split($value, 10)[0] : ""; break; default: if (in_array($field, $fieldFilters)) { - $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field); - return getFieldFilter_UserSNSHelper($field, $row[$field], $fieldFormOptions, $attributes); + $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); + return getFieldFilter_UserSNSHelper($field, $value, $fieldFormOptions, [...$attributes]); } - return $row[$field] ?: DEFAULTS['EMPTY']; + return $value; break; } } // \ No newline at end of file diff --git a/app/Helpers/Admin/User_helper.php b/app/Helpers/Admin/User_helper.php index d7b7271..62c10d3 100644 --- a/app/Helpers/Admin/User_helper.php +++ b/app/Helpers/Admin/User_helper.php @@ -6,7 +6,7 @@ function getFieldLabel_UserHelper($field, array $fieldRules, array $attributes = if (strpos($fieldRules[$field], 'required') !== false) { array_push($attributes, 'style="color:red";'); } - return sprintf("%s", implode(" ", $attributes), lang("Admin/User.label.{$field}")); + return sprintf("%s", implode(" ", [...$attributes]), lang("Admin/User.label.{$field}")); break; } } @@ -17,14 +17,14 @@ function getFieldForm_UserHelper($field, $value, array $fieldFormOptions, array $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { case 'role': - // foreach ($fieldFormOptions[$field] as $key => $label) { - // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? $value : explode("|", $value)), $attributes) . $label; - // } - // return implode(" ", $checkboxs); - // break; case 'status': $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes); + return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); + // foreach ($fieldFormOptions[$field] as $key => $label) { + // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label; + // } + // return implode(" ", $checkboxs); + // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); break; case 'updated_at': case 'created_at': @@ -33,31 +33,35 @@ function getFieldForm_UserHelper($field, $value, array $fieldFormOptions, array case 'passwd': return sprintf( "%s %s %s", - form_password($field, DEFAULTS['EMPTY'], $attributes), + form_password($field, DEFAULTS['EMPTY'], [...$attributes]), lang("Admin/User.label.confirmpassword"), - form_password('confirmpassword', DEFAULTS['EMPTY'], $attributes), + form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]), ); break; + case 'content': + return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']); + break; + case 'upload_file': + return form_upload($field); + break; default: - return form_input($field, $value, $attributes); + return form_input($field, $value, [...$attributes]); break; } } // function getFieldView_UserHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) { + $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { - // case 'role': - // foreach ($fieldFormOptions[$field] as $key => $label) { - // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode("|", $entity->$field)), $attributes) . $label; - // } - // return implode(" ", $checkboxs); - // break; + case 'upload_file': + return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]); + break; + case 'content': + return html_entity_decode($value); + break; default: - if (in_array($field, $fieldFilters)) { - return getFieldForm_UserHelper($field, $entity->$field, $fieldFormOptions, $attributes); - } - return $entity->$field ?: DEFAULTS['EMPTY']; + return in_array($field, $fieldFilters) ? $fieldFormOptions[$field][$value] : $value; break; } } // @@ -66,10 +70,6 @@ function getFieldFilter_UserHelper($field, $value, array $fieldFormOptions, arra { $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { - // case 'role': - // $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - // return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes); - // break; default: return getFieldForm_UserHelper($field, $value, $fieldFormOptions, $attributes); break; @@ -81,31 +81,29 @@ function getFieldIndex_Column_UserHelper($field, $order_field, $order_value, arr $label = lang("Admin/User.label.{$field}"); $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; - return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, $attributes); + return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]); } // -function getFieldIndex_Row_UserHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array()): string +function getFieldIndex_Row_UserHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string { + $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { case 'id': - return anchor(current_url() . '/view/' . $row['uid'], $row[$field], [...$attributes, "target" => "_self"]); + return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]); + break; + case 'upload_file': + return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]); break; - // case 'role': - // foreach ($fieldFormOptions[$field] as $key => $label) { - // $checkboxs[] = form_checkbox($field, $key, in_array($key, explode("|", $row[$field])), $attributes) . $label; - // } - // return '
' . implode("
", $checkboxs) . '
'; - // break; case 'updated_at': case 'created_at': - return isset($row[$field]) ? str_split($row[$field], 10)[0] : ""; + return isset($value) ? str_split($value, 10)[0] : ""; break; default: if (in_array($field, $fieldFilters)) { - $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field); - return getFieldFilter_UserHelper($field, $row[$field], $fieldFormOptions, $attributes); + $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); + return getFieldFilter_UserHelper($field, $value, $fieldFormOptions, $attributes); } - return $row[$field] ?: DEFAULTS['EMPTY']; + return $value; break; } } // \ No newline at end of file diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index 52d032f..77e1d40 100644 --- a/app/Models/BaseModel.php +++ b/app/Models/BaseModel.php @@ -3,6 +3,7 @@ namespace App\Models; use CodeIgniter\Model; +use App\Libraries\Log\Log; use App\Entities\BaseEntity; abstract class BaseModel extends Model diff --git a/app/Models/BoardConfigModel.php b/app/Models/BoardConfigModel.php index 6c45563..3d475e5 100644 --- a/app/Models/BoardConfigModel.php +++ b/app/Models/BoardConfigModel.php @@ -8,6 +8,7 @@ class BoardConfigModel extends BaseModel { protected $table = "tw_board_config"; protected $useAutoIncrement = false; + protected $returnType = BoardConfigEntity::class; public function __construct() { parent::__construct(); @@ -72,12 +73,12 @@ class BoardConfigModel extends BaseModel } public function getEntity($conditions): BoardConfigEntity { - $entity = $this->asObject(BoardConfigEntity::class)->where($conditions)->first(); - return $entity ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); + $entity = $this->where($conditions)->first(); + return $entity ?: throw new \Exception("{$conditions}의 해당 데이터가 없습니다.\n "); } public function getEntitys($conditions): array { - return $this->asObject(BoardConfigEntity::class)->where($conditions)->findAll(); + return $this->where($conditions)->findAll(); } protected function changeFormData(string $field, array $formDatas, $entity) diff --git a/app/Models/BoardModel.php b/app/Models/BoardModel.php index 19656d8..9bfaf54 100644 --- a/app/Models/BoardModel.php +++ b/app/Models/BoardModel.php @@ -7,6 +7,7 @@ use App\Entities\BoardEntity; class BoardModel extends BaseHierarchyModel { protected $table = "tw_board"; + protected $returnType = BoardEntity::class; public function __construct() { parent::__construct(); @@ -58,12 +59,12 @@ class BoardModel extends BaseHierarchyModel public function getEntity($conditions): BoardEntity { - $entity = $this->asObject(BoardEntity::class)->where($conditions)->first(); - return $entity ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); + $entity = $this->where($conditions)->first(); + return $entity ?: throw new \Exception("{$conditions}의 해당 데이터가 없습니다.\n "); } public function getEntitys($conditions): array { - return $this->asObject(BoardEntity::class)->where($conditions)->findAll(); + return $this->where($conditions)->findAll(); } public function create(array $formDatas): BoardEntity { diff --git a/app/Models/UserModel.php b/app/Models/UserModel.php index 8d5bde4..1056725 100644 --- a/app/Models/UserModel.php +++ b/app/Models/UserModel.php @@ -8,6 +8,7 @@ class UserModel extends BaseModel { protected $table = "tw_user"; protected $useAutoIncrement = false; + protected $returnType = UserEntity::class; public function __construct() { parent::__construct(); @@ -66,12 +67,12 @@ class UserModel extends BaseModel } public function getEntity($conditions): UserEntity { - $entity = $this->asObject(UserEntity::class)->where($conditions)->first(); - return $entity ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); + $entity = $this->where($conditions)->first(); + return $entity ?: throw new \Exception("{$conditions}의 해당 사용자가 없습니다.\n "); } public function getEntitys($conditions): array { - return $this->asObject(UserEntity::class)->where($conditions)->findAll(); + return $this->where($conditions)->findAll(); } protected function changeFormData(string $field, array $formDatas, $entity) diff --git a/app/Models/UserSNSModel.php b/app/Models/UserSNSModel.php index 48e91a4..e678b09 100644 --- a/app/Models/UserSNSModel.php +++ b/app/Models/UserSNSModel.php @@ -7,6 +7,7 @@ use App\Entities\UserSNSEntity; class UserSNSModel extends BaseModel { protected $table = "tw_user_sns"; + protected $returnType = UserSNSEntity::class; public function __construct() { parent::__construct(); @@ -31,7 +32,7 @@ class UserSNSModel extends BaseModel } public function getFieldFilters(array $fields = array()): array { - return ["status", ...$fields]; + return ["user_uid", "status", ...$fields]; } protected function getFieldRule(string $field, array $rules, string $action = ""): array { @@ -60,12 +61,12 @@ class UserSNSModel extends BaseModel } public function getEntity($conditions): UserSNSEntity { - $entity = $this->asObject(UserSNSEntity::class)->where($conditions)->first(); - return $entity ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true)); + $entity = $this->where($conditions)->first(); + return $entity ?: throw new \Exception("{$conditions}의 해당 데이터가 없습니다.\n "); } public function getEntitys($conditions): array { - return $this->asObject(UserSNSEntity::class)->where($conditions)->findAll(); + return $this->where($conditions)->findAll(); } public function create(array $formDatas): UserSNSEntity diff --git a/app/Views/admin/board/index.php b/app/Views/admin/board/index.php index c319873..3c46671 100644 --- a/app/Views/admin/board/index.php +++ b/app/Views/admin/board/index.php @@ -19,16 +19,16 @@ 작업 - - onClick="indexRowCheckBoxToggle(this);"> + + getStatus() != 'use' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);"> - "checkbox_uid_{$row['uid']}", "name" => "batchjob_uids[]", "value" => $row['uid'], "class" => "batchjobuids_checkboxs"]); ?> - "_self"]) ?> + "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?> + getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?> - + - "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> + getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> diff --git a/app/Views/admin/board/insert.php b/app/Views/admin/board/insert.php index 13660d6..67c5325 100644 --- a/app/Views/admin/board/insert.php +++ b/app/Views/admin/board/insert.php @@ -9,7 +9,7 @@ - + @@ -20,12 +20,5 @@ getFlashdata('error')) : ?>getFlashdata('error') ?> - - +include('templates/admin/footer'); ?> endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/board/reply.php b/app/Views/admin/board/reply.php index 1b1937a..ac5b5f4 100644 --- a/app/Views/admin/board/reply.php +++ b/app/Views/admin/board/reply.php @@ -9,7 +9,7 @@ - $field : old($field), $fieldFormOptions) ?> + $field, $fieldFormOptions) ?> @@ -20,13 +20,5 @@ getFlashdata('error')) : ?>getFlashdata('error') ?> - - include('templates/admin/footer'); ?> endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/board/update.php b/app/Views/admin/board/update.php index 1b1937a..ac5b5f4 100644 --- a/app/Views/admin/board/update.php +++ b/app/Views/admin/board/update.php @@ -9,7 +9,7 @@ - $field : old($field), $fieldFormOptions) ?> + $field, $fieldFormOptions) ?> @@ -20,13 +20,5 @@ getFlashdata('error')) : ?>getFlashdata('error') ?> - - include('templates/admin/footer'); ?> endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/boardconfig/index.php b/app/Views/admin/boardconfig/index.php index 6b21d51..9ac4815 100644 --- a/app/Views/admin/boardconfig/index.php +++ b/app/Views/admin/boardconfig/index.php @@ -19,16 +19,16 @@ 작업 - - onClick="indexRowCheckBoxToggle(this);"> + + getStatus() != 'use' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);"> - "checkbox_uid_{$row['uid']}", "name" => "batchjob_uids[]", "value" => $row['uid'], "class" => "batchjobuids_checkboxs"]); ?> - "_self"]) ?> + "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?> + getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?> - + - "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> + getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> diff --git a/app/Views/admin/boardconfig/insert.php b/app/Views/admin/boardconfig/insert.php index 0ecac2d..183bcd6 100644 --- a/app/Views/admin/boardconfig/insert.php +++ b/app/Views/admin/boardconfig/insert.php @@ -9,7 +9,7 @@ - + @@ -20,13 +20,6 @@ getFlashdata('error')) : ?>getFlashdata('error') ?> - - include('templates/admin/footer'); ?> endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/boardconfig/update.php b/app/Views/admin/boardconfig/update.php index 3fee288..dd3aac2 100644 --- a/app/Views/admin/boardconfig/update.php +++ b/app/Views/admin/boardconfig/update.php @@ -9,7 +9,7 @@ - $field : old($field), $fieldFormOptions) ?> + $field : old($field), $fieldFormOptions) ?> @@ -20,13 +20,5 @@ getFlashdata('error')) : ?>getFlashdata('error') ?> - - include('templates/admin/footer'); ?> endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/user/index.php b/app/Views/admin/user/index.php index 3dcc6eb..8c287f0 100644 --- a/app/Views/admin/user/index.php +++ b/app/Views/admin/user/index.php @@ -19,16 +19,16 @@ 작업 - - onClick="indexRowCheckBoxToggle(this);"> + + getStatus() != 'use' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);"> - "checkbox_uid_{$row['uid']}", "name" => "batchjob_uids[]", "value" => $row['uid'], "class" => "batchjobuids_checkboxs"]); ?> - "_self"]) ?> + "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?> + getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?> - + - "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> + getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> diff --git a/app/Views/admin/user/insert.php b/app/Views/admin/user/insert.php index 92c5033..5328eff 100644 --- a/app/Views/admin/user/insert.php +++ b/app/Views/admin/user/insert.php @@ -9,7 +9,7 @@ - + diff --git a/app/Views/admin/user/update.php b/app/Views/admin/user/update.php index 164f1c1..ed4f7a7 100644 --- a/app/Views/admin/user/update.php +++ b/app/Views/admin/user/update.php @@ -6,17 +6,19 @@ - + - $field:old($field),$fieldFormOptions) ?> + $field, $fieldFormOptions) ?> - "btn btn-outline btn-primary")); ?> + + "btn btn-outline btn-primary")); ?> + -getFlashdata('error')):?>getFlashdata('error') ?> +getFlashdata('error')) : ?>getFlashdata('error') ?> include('templates/admin/footer'); ?> endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/usersns/index.php b/app/Views/admin/usersns/index.php index 7f0c8e8..23f9fb1 100644 --- a/app/Views/admin/usersns/index.php +++ b/app/Views/admin/usersns/index.php @@ -19,16 +19,16 @@ 작업 - - + + - "checkbox_uid_{$row['uid']}", "name" => "batchjob_uids[]", "value" => $row['uid'], "class" => "batchjobuids_checkboxs"]); ?> + "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?> - + - "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> + getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> diff --git a/app/Views/layouts/admin/left_menu.php b/app/Views/layouts/admin/left_menu.php index 1ce48b4..a6fb54c 100644 --- a/app/Views/layouts/admin/left_menu.php +++ b/app/Views/layouts/admin/left_menu.php @@ -5,7 +5,6 @@
include($layout['path'] . '/left_menu/base'); ?> - include($layout['path'] . '/left_menu/hpilo'); ?> include($layout['path'] . '/left_menu/board'); ?>
\ No newline at end of file diff --git a/app/Views/templates/admin/footer.php b/app/Views/templates/admin/footer.php index 5be7005..d73c017 100644 --- a/app/Views/templates/admin/footer.php +++ b/app/Views/templates/admin/footer.php @@ -1,28 +1,35 @@ - - - + \ No newline at end of file + \ No newline at end of file From 986d08c8864b62a72857fb5084d5511386133b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0git=20config=20git=20config=20-?= =?UTF-8?q?-helpgit=20config=20--global=20user=2Ename=20=EC=B5=9C=EC=A4=80?= =?UTF-8?q?=ED=9D=A0?= Date: Wed, 26 Jul 2023 05:54:59 +0900 Subject: [PATCH 2/3] servermgrv2 init... --- app/Helpers/Admin/BoardConfig_helper.php | 2 +- app/Helpers/Admin/Board_helper.php | 2 +- app/Helpers/Admin/UserSNS_helper.php | 2 +- app/Helpers/Admin/User_helper.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Helpers/Admin/BoardConfig_helper.php b/app/Helpers/Admin/BoardConfig_helper.php index 1b85dce..34ded31 100644 --- a/app/Helpers/Admin/BoardConfig_helper.php +++ b/app/Helpers/Admin/BoardConfig_helper.php @@ -24,7 +24,7 @@ function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions, case 'isdownload': case 'status': $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); + return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]); // foreach ($fieldFormOptions[$field] as $key => $label) { // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label; // } diff --git a/app/Helpers/Admin/Board_helper.php b/app/Helpers/Admin/Board_helper.php index 326e436..31bd028 100644 --- a/app/Helpers/Admin/Board_helper.php +++ b/app/Helpers/Admin/Board_helper.php @@ -19,7 +19,7 @@ function getFieldForm_BoardHelper($field, $value, array $fieldFormOptions, array case "user_uid": case 'status': $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); + return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]); // foreach ($fieldFormOptions[$field] as $key => $label) { // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label; // } diff --git a/app/Helpers/Admin/UserSNS_helper.php b/app/Helpers/Admin/UserSNS_helper.php index 029bb0e..fc1ec2d 100644 --- a/app/Helpers/Admin/UserSNS_helper.php +++ b/app/Helpers/Admin/UserSNS_helper.php @@ -19,7 +19,7 @@ function getFieldForm_UserSNSHelper($field, $value, array $fieldFormOptions, arr case "user_uid": case 'status': $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); + return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]); // foreach ($fieldFormOptions[$field] as $key => $label) { // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label; // } diff --git a/app/Helpers/Admin/User_helper.php b/app/Helpers/Admin/User_helper.php index 62c10d3..7168a83 100644 --- a/app/Helpers/Admin/User_helper.php +++ b/app/Helpers/Admin/User_helper.php @@ -19,7 +19,7 @@ function getFieldForm_UserHelper($field, $value, array $fieldFormOptions, array case 'role': case 'status': $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); + return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]); // foreach ($fieldFormOptions[$field] as $key => $label) { // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label; // } From 02b5a48f3eb5afb64fb993ee61da3d94f7bc1b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0git=20config=20git=20config=20-?= =?UTF-8?q?-helpgit=20config=20--global=20user=2Ename=20=EC=B5=9C=EC=A4=80?= =?UTF-8?q?=ED=9D=A0?= Date: Wed, 26 Jul 2023 06:01:17 +0900 Subject: [PATCH 3/3] baseproject init... --- app/Helpers/Admin/BoardConfig_helper.php | 5 ++++- app/Helpers/Admin/Board_helper.php | 5 ++++- app/Helpers/Admin/UserSNS_helper.php | 5 ++++- app/Helpers/Admin/User_helper.php | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/Helpers/Admin/BoardConfig_helper.php b/app/Helpers/Admin/BoardConfig_helper.php index 34ded31..46fd941 100644 --- a/app/Helpers/Admin/BoardConfig_helper.php +++ b/app/Helpers/Admin/BoardConfig_helper.php @@ -22,7 +22,6 @@ function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions, case 'isreply': case 'isupload': case 'isdownload': - case 'status': $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]); // foreach ($fieldFormOptions[$field] as $key => $label) { @@ -31,6 +30,10 @@ function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions, // return implode(" ", $checkboxs); // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); break; + case 'status': + $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; + return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes); + break; case 'updated_at': case 'created_at': return form_input($field, $value, [...$attributes, 'class' => 'calender']); diff --git a/app/Helpers/Admin/Board_helper.php b/app/Helpers/Admin/Board_helper.php index 31bd028..b3f8c01 100644 --- a/app/Helpers/Admin/Board_helper.php +++ b/app/Helpers/Admin/Board_helper.php @@ -17,7 +17,6 @@ function getFieldForm_BoardHelper($field, $value, array $fieldFormOptions, array switch ($field) { case "board_config_uid": case "user_uid": - case 'status': $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]); // foreach ($fieldFormOptions[$field] as $key => $label) { @@ -26,6 +25,10 @@ function getFieldForm_BoardHelper($field, $value, array $fieldFormOptions, array // return implode(" ", $checkboxs); // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); break; + case 'status': + $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; + return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes); + break; case 'updated_at': case 'created_at': return form_input($field, $value, [...$attributes, 'class' => 'calender']); diff --git a/app/Helpers/Admin/UserSNS_helper.php b/app/Helpers/Admin/UserSNS_helper.php index fc1ec2d..ef0b36c 100644 --- a/app/Helpers/Admin/UserSNS_helper.php +++ b/app/Helpers/Admin/UserSNS_helper.php @@ -17,7 +17,6 @@ function getFieldForm_UserSNSHelper($field, $value, array $fieldFormOptions, arr $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { case "user_uid": - case 'status': $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]); // foreach ($fieldFormOptions[$field] as $key => $label) { @@ -26,6 +25,10 @@ function getFieldForm_UserSNSHelper($field, $value, array $fieldFormOptions, arr // return implode(" ", $checkboxs); // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); break; + case 'status': + $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; + return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes); + break; case 'updated_at': case 'created_at': return form_input($field, $value, [...$attributes, 'class' => 'calender']); diff --git a/app/Helpers/Admin/User_helper.php b/app/Helpers/Admin/User_helper.php index 7168a83..3844bce 100644 --- a/app/Helpers/Admin/User_helper.php +++ b/app/Helpers/Admin/User_helper.php @@ -17,7 +17,6 @@ function getFieldForm_UserHelper($field, $value, array $fieldFormOptions, array $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { case 'role': - case 'status': $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]); // foreach ($fieldFormOptions[$field] as $key => $label) { @@ -26,6 +25,10 @@ function getFieldForm_UserHelper($field, $value, array $fieldFormOptions, array // return implode(" ", $checkboxs); // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); break; + case 'status': + $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; + return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes); + break; case 'updated_at': case 'created_at': return form_input($field, $value, [...$attributes, 'class' => 'calender']);