From e1b63ce4c56f871bb6a65e4d2475e11205e44fc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Tue, 1 Oct 2024 18:25:10 +0900 Subject: [PATCH] cfmgrv4 init...1 --- app/Config/Constants.php | 3 +- app/Config/Routes.php | 11 ++ .../Admin/Cloudflare/AccountController.php | 9 +- .../Admin/Cloudflare/AuthController.php | 11 +- .../Admin/Cloudflare/RecordController.php | 4 +- .../Admin/Cloudflare/ZoneController.php | 9 +- app/Controllers/Admin/MapurlController.php | 145 ++++++++++++++++++ app/Controllers/Admin/UserController.php | 98 +++++++++++- app/Controllers/MVController.php | 80 +++++++++- app/Entities/MapurlEntity.php | 27 ++++ app/Entities/UserEntity.php | 19 +-- .../Admin/Cloudflare/Account_helper.php | 20 +-- app/Helpers/Admin/Cloudflare/Auth_helper.php | 1 - app/Helpers/Admin/Mapurl_helper.php | 97 ++++++++++++ app/Helpers/Admin/User_helper.php | 101 ++++++++++++ app/Language/en/{ => Admin}/Mapurl.php | 0 app/Language/en/{ => Admin}/User.php | 5 +- app/Models/Cloudflare/RecordModel.php | 12 +- app/Models/Cloudflare/ZoneModel.php | 22 ++- app/Models/CommonModel.php | 7 +- app/Models/MapurlModel.php | 64 ++++++++ app/Models/SNSUserModel.php | 4 +- app/Models/UserModel.php | 24 ++- app/Views/admin/cloudflare/account/index.php | 24 +-- app/Views/admin/cloudflare/auth/create.php | 27 ++-- app/Views/admin/cloudflare/auth/index.php | 30 +--- app/Views/admin/cloudflare/auth/modify.php | 29 ++-- app/Views/admin/cloudflare/record/create.php | 32 ++-- app/Views/admin/cloudflare/record/index.php | 33 +--- app/Views/admin/cloudflare/zone/create.php | 32 ++-- app/Views/admin/cloudflare/zone/index.php | 31 +--- app/Views/admin/mapurl/create.php | 24 +++ app/Views/admin/mapurl/index.php | 51 ++++++ app/Views/admin/mapurl/modify.php | 24 +++ app/Views/admin/user/create.php | 24 +++ app/Views/admin/user/index.php | 93 +++++------ app/Views/admin/user/insert.php | 24 --- app/Views/admin/user/modify.php | 24 +++ app/Views/admin/user/update.php | 24 --- app/Views/admin/user/view.php | 19 --- app/Views/layouts/admin/left_menu/base.php | 2 +- app/Views/layouts/empty.php | 43 +++--- app/Views/templates/admin/actionform.php | 30 +++- app/Views/templates/admin/index_top.php | 25 +++ app/Views/templates/admin/modalform.php | 40 ++++- public/css/admin/content.css | 85 +++++----- public/css/empty.css | 4 +- public/images/common/pdf.png | Bin 0 -> 1392 bytes public/js/admin.js | 8 + public/js/admin/content.js | 6 - 50 files changed, 1113 insertions(+), 448 deletions(-) create mode 100644 app/Controllers/Admin/MapurlController.php create mode 100644 app/Entities/MapurlEntity.php create mode 100644 app/Helpers/Admin/Mapurl_helper.php create mode 100644 app/Helpers/Admin/User_helper.php rename app/Language/en/{ => Admin}/Mapurl.php (100%) rename app/Language/en/{ => Admin}/User.php (83%) create mode 100644 app/Models/MapurlModel.php create mode 100644 app/Views/admin/mapurl/create.php create mode 100644 app/Views/admin/mapurl/index.php create mode 100644 app/Views/admin/mapurl/modify.php create mode 100644 app/Views/admin/user/create.php delete mode 100644 app/Views/admin/user/insert.php create mode 100644 app/Views/admin/user/modify.php delete mode 100644 app/Views/admin/user/update.php delete mode 100644 app/Views/admin/user/view.php create mode 100644 app/Views/templates/admin/index_top.php create mode 100644 public/images/common/pdf.png diff --git a/app/Config/Constants.php b/app/Config/Constants.php index 9c6cacb..a09cf8e 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -156,6 +156,8 @@ define("MESSENGERS", [ //아이콘 및 Sound관련 define('ICONS', [ 'LOGO' => '', + 'EXCEL' => '', + 'PDF' => '', 'MEMBER' => '', 'LOGIN' => '', 'LOGOUT' => '', @@ -170,7 +172,6 @@ define('ICONS', [ 'SETUP' => '', 'FLAG' => '', 'SEARCH' => '', - 'EXCEL' => '', 'PLAY' => '', 'CART' => '', 'CARD' => '', diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 81b67e0..6f8138a 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -17,6 +17,17 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function ($rou $routes->get('/', 'Home::index'); $routes->group('user', function ($routes) { $routes->get('/', 'UserController::index'); + $routes->get('create', 'UserController::create_form'); + $routes->post('create', 'UserController::create'); + $routes->get('modify/(:num)', 'UserController::modify_form/$1'); + $routes->post('modify/(:num)', 'UserController::modify/$1'); + }); + $routes->group('mapurl', function ($routes) { + $routes->get('/', 'MapurlController::index'); + $routes->get('create', 'MapurlController::create_form'); + $routes->post('create', 'MapurlController::create'); + $routes->get('modify/(:num)', 'MapurlController::modify_form/$1'); + $routes->post('modify/(:num)', 'MapurlController::modify/$1'); }); $routes->group('cloudflare', ['namespace' => 'App\Controllers\Admin\Cloudflare'], function ($routes) { $routes->cli('/reload', 'CloudflareController::reload'); diff --git a/app/Controllers/Admin/Cloudflare/AccountController.php b/app/Controllers/Admin/Cloudflare/AccountController.php index 4df64cc..ebafb5d 100644 --- a/app/Controllers/Admin/Cloudflare/AccountController.php +++ b/app/Controllers/Admin/Cloudflare/AccountController.php @@ -62,19 +62,22 @@ class AccountController extends CloudflareController $this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'type', 'status', 'updated_at', 'created_at']; $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); $this->filter_fields = [$this->getModel()::PARENT, 'type', 'status']; - $this->batchjob_fields = ['typep', 'status']; $this->field_options = $this->getFormFieldOptions($this->filter_fields); + $this->batchjob_fields = ['typep', 'status']; return $this->list_procedure(); } public function reload(): RedirectResponse { + //Transaction Start + $this->getModel()->transStart(); try { - //Transaction Start - $this->getModel()->transStart(); foreach ($this->getModel()->getEntitys as $entity) { $zone_socket = new ZoneSocket($entity); $zone_socket->reload(); } + log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다."); + $this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n"); + $this->getModel()->transCommit(); return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); } catch (\Exception $e) { //Transaction Rollback diff --git a/app/Controllers/Admin/Cloudflare/AuthController.php b/app/Controllers/Admin/Cloudflare/AuthController.php index efb82d8..8001617 100644 --- a/app/Controllers/Admin/Cloudflare/AuthController.php +++ b/app/Controllers/Admin/Cloudflare/AuthController.php @@ -46,7 +46,7 @@ class AuthController extends CloudflareController $this->create_validate($this->action, $this->fields); $this->formDatas = $this->getFormDatas(); parent::create_process(); - $this->entity = $this->getModel()->create($this->formDatas); + $this->entity = $this->getModel()->create(formDatas: $this->formDatas); } public function create(): RedirectResponse { @@ -90,20 +90,23 @@ class AuthController extends CloudflareController $this->fields = [$this->getModel()::TITLE, 'oldkey', 'status', 'updated_at', 'created_at']; $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); $this->filter_fields = ['status']; - $this->batchjob_fields = ['status']; $this->field_options = $this->getFormFieldOptions($this->filter_fields); + $this->batchjob_fields = ['status']; return $this->list_procedure(); } public function reload(): RedirectResponse { + //Transaction Start + $this->getModel()->transStart(); try { - //Transaction Start - $this->getModel()->transStart(); foreach ($this->getModel()->getEntitys as $entity) { $account_socket = new AccountSocket($entity); $account_socket->reload(); } + log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다."); + $this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n"); + $this->getModel()->transCommit(); return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); } catch (\Exception $e) { //Transaction Rollback diff --git a/app/Controllers/Admin/Cloudflare/RecordController.php b/app/Controllers/Admin/Cloudflare/RecordController.php index 0e80e43..a4c6788 100644 --- a/app/Controllers/Admin/Cloudflare/RecordController.php +++ b/app/Controllers/Admin/Cloudflare/RecordController.php @@ -121,10 +121,10 @@ class RecordController extends CloudflareController { $this->action = __FUNCTION__; $this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'type', 'content', 'ttl', 'proxied', 'locked', 'updated_at', 'created_at']; - $this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied']; $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); - $this->batchjob_fields = ['proxied']; + $this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied']; $this->field_options = $this->getFormFieldOptions($this->filter_fields); + $this->batchjob_fields = ['proxied']; return $this->list_procedure(); } } diff --git a/app/Controllers/Admin/Cloudflare/ZoneController.php b/app/Controllers/Admin/Cloudflare/ZoneController.php index c64dd8e..bf1dbc5 100644 --- a/app/Controllers/Admin/Cloudflare/ZoneController.php +++ b/app/Controllers/Admin/Cloudflare/ZoneController.php @@ -166,20 +166,23 @@ class ZoneController extends CloudflareController $this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at']; $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); $this->filter_fields = [$this->getModel()::PARENT, 'development_mode', 'ipv6', 'security_level']; - $this->batchjob_fields = ['development_mode', 'ipv6', 'security_level']; $this->field_options = $this->getFormFieldOptions($this->filter_fields); + $this->batchjob_fields = ['development_mode', 'ipv6', 'security_level']; return $this->list_procedure(); } //reload public function reload(): RedirectResponse { + //Transaction Start + $this->getModel()->transStart(); try { - //Transaction Start - $this->getModel()->transStart(); foreach ($this->getModel()->getEntitys as $entity) { $record_socket = new RecordSocket($entity); $record_socket->reload(); } + log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다."); + $this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n"); + $this->getModel()->transCommit(); return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); } catch (\Exception $e) { //Transaction Rollback diff --git a/app/Controllers/Admin/MapurlController.php b/app/Controllers/Admin/MapurlController.php new file mode 100644 index 0000000..1a6768a --- /dev/null +++ b/app/Controllers/Admin/MapurlController.php @@ -0,0 +1,145 @@ +class_name = "Mapurl"; + $this->class_path = $this->root . $this->class_name; + $this->title = lang("{$this->class_path}.title"); + helper($this->class_path); + } + protected function getModel(): MapurlModel + { + if ($this->_model === null) { + $this->_model = new MapurlModel(); + } + return $this->_model; + } + protected function getFormFieldOption(string $field, array $options = []): array + { + switch ($field) { + default: + $options = parent::getFormFieldOption($field, $options); + break; + } + return $options; + } + protected function getFormData(string $field, array $formDatas): array + { + switch ($field) { + default: + $formDatas = parent::getFormData($field, $formDatas); + break; + } + return $formDatas; + } + private function init(string $action): void + { + $this->action = $action; + $this->fields = [$this->getModel()::TITLE, 'newurl', 'status']; + $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); + $this->filter_fields = ['status']; + $this->field_options = $this->getFormFieldOptions($this->filter_fields); + } + private function remaping_process(): void + { + //모든 필요한 FormOption등 조기화작업 필요 + $this->getModel()->where('status', DEFAULTS['STATUS']); + $this->getModel()->orderBy('oldurl', 'ASC'); + //html의 case문 설정 + $urls = array(""); + foreach ($this->getModel()->getEntitys() as $entity) { + $temp_oldurl = sprintf("case '%s':", trim($entity->oldurl)); + //한글을 포함하고 있는지 체크 + if (preg_match("/[\xE0-\xFF][\x80-\xFF][\x80-\xFF]/", $entity->oldurl)) { + //도메인 URL 분리 + preg_match("/^(https?:\/\/)(.*)/", $entity->oldurl, $matches); + $temp_oldurl = sprintf("case '%s%s':\ncase '%s':", $matches[1], idn_to_ascii($matches[2]), trim($entity->oldurl)); + } + array_push($urls, sprintf("\t\t\t%s\n \t\t\twindow.location.href='%s';\n \t\tbreak;", $temp_oldurl, trim($entity->newurl))); + } + $remap_page = view($this->class_path . DIRECTORY_SEPARATOR . __FUNCTION__, ["urls" => $urls]); + $remap_path = FCPATH . DIRECTORY_SEPARATOR . "mapurl"; + //디렉토리 생성 여부 확인 + if (!is_dir($remap_path)) { + mkdir($remap_path, 0755, true); + } + //htmlBuild용 + if (!file_put_contents($remap_path . '/index.html', $remap_page)) { + throw new \Exception(__FUNCTION__ . "에서 " . $remap_path . "/index.html Write 실패"); + } + } + //생성 + public function create_form(): RedirectResponse|string + { + $this->init('create'); + return $this->create_form_procedure(); + } + protected function create_process(): void + { + $this->create_validate($this->action, $this->fields); + $this->formDatas = $this->getFormDatas(); + parent::create_process(); + $this->entity = $this->getModel()->create(formDatas: $this->formDatas); + $this->remaping_process(); + } + public function create(): RedirectResponse + { + $this->init(__FUNCTION__); + return $this->create_procedure(); + } + //수정 + protected function modify_form_process(string $uid): void + { + $this->entity = $this->getModel()->getEntityByPK(intval($uid)); + if ($this->entity === null) { + throw new \Exception("해당 정보를 찾을수 없습니다."); + } + parent::modify_form_process($uid); + } + public function modify_form(string $uid): RedirectResponse|string + { + $this->init('modify'); + return $this->modify_form_procedure($uid); + } + protected function modify_process(string $uid): void + { + $this->entity = $this->getModel()->getEntityByPK(intval($uid)); + if ($this->entity === null) { + throw new \Exception("{$uid} 정보를 찾을수 없습니다."); + } + $this->modify_validate($this->action, $this->fields); + $this->formDatas = $this->getFormDatas(); + parent::modify_process($uid); + $this->entity = $this->getModel()->modify($this->entity, $this->formDatas); + $this->remaping_process(); + } + public function modify(string $uid): RedirectResponse + { + $this->init(__FUNCTION__); + return $this->modify_procedure($uid); + } + // 리스트 + public function index(): string + { + $this->action = __FUNCTION__; + $this->fields = [$this->getModel()::TITLE, 'newurl', 'status']; + $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); + $this->filter_fields = ['status']; + $this->field_options = $this->getFormFieldOptions($this->filter_fields); + $this->batchjob_fields = ['status']; + return $this->list_procedure(); + } +} diff --git a/app/Controllers/Admin/UserController.php b/app/Controllers/Admin/UserController.php index 874fc7c..adf9831 100644 --- a/app/Controllers/Admin/UserController.php +++ b/app/Controllers/Admin/UserController.php @@ -2,22 +2,23 @@ namespace App\Controllers\Admin; +use App\Models\UserModel; +use CodeIgniter\HTTP\RedirectResponse; + use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; -use App\Models\UserModel; -use App\Traits\AuthTrait; - class UserController extends AdminController { private $_model = null; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { parent::initController($request, $response, $logger); - $this->root = "Admin/"; - $this->layout = "admin"; - $this->session = $this->session_AuthTrait(); + $this->class_name = "User"; + $this->class_path = $this->root . $this->class_name; + $this->title = lang("{$this->class_path}.title"); + helper($this->class_path); } protected function getModel(): UserModel { @@ -26,4 +27,89 @@ class UserController extends AdminController } return $this->_model; } + protected function getFormFieldOption(string $field, array $options = []): array + { + switch ($field) { + default: + $options = parent::getFormFieldOption($field, $options); + break; + } + return $options; + } + protected function getFormData(string $field, array $formDatas): array + { + switch ($field) { + default: + $formDatas = parent::getFormData($field, $formDatas); + break; + } + return $formDatas; + } + private function init(string $action): void + { + $this->action = $action; + $this->fields = ['id', 'passwd', $this->getModel()::TITLE, 'email', 'mobile', 'role']; + $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); + $this->filter_fields = ['role', 'status']; + $this->field_options = $this->getFormFieldOptions($this->filter_fields); + } + //생성 + public function create_form(): RedirectResponse|string + { + $this->init('create'); + return $this->create_form_procedure(); + } + protected function create_process(): void + { + $this->create_validate($this->action, $this->fields); + $this->formDatas = $this->getFormDatas(); + parent::create_process(); + $this->entity = $this->getModel()->create(formDatas: $this->formDatas); + } + public function create(): RedirectResponse + { + $this->init(__FUNCTION__); + return $this->create_procedure(); + } + //수정 + protected function modify_form_process(string $uid): void + { + $this->entity = $this->getModel()->getEntityByPK(intval($uid)); + if ($this->entity === null) { + throw new \Exception("해당 정보를 찾을수 없습니다."); + } + parent::modify_form_process($uid); + } + public function modify_form(string $uid): RedirectResponse|string + { + $this->init('modify'); + return $this->modify_form_procedure($uid); + } + protected function modify_process(string $uid): void + { + $this->entity = $this->getModel()->getEntityByPK(intval($uid)); + if ($this->entity === null) { + throw new \Exception("{$uid} 정보를 찾을수 없습니다."); + } + $this->modify_validate($this->action, $this->fields); + $this->formDatas = $this->getFormDatas(); + parent::modify_process($uid); + $this->entity = $this->getModel()->modify($this->entity, $this->formDatas); + } + public function modify(string $uid): RedirectResponse + { + $this->init(__FUNCTION__); + return $this->modify_procedure($uid); + } + // 리스트 + public function index(): string + { + $this->action = __FUNCTION__; + $this->fields = ['id', $this->getModel()::TITLE, 'email', 'mobile', 'role', 'status']; + $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); + $this->filter_fields = ['role', 'status']; + $this->field_options = $this->getFormFieldOptions($this->filter_fields); + $this->batchjob_fields = ['role', 'status']; + return $this->list_procedure(); + } } diff --git a/app/Controllers/MVController.php b/app/Controllers/MVController.php index d777575..4d12a3b 100644 --- a/app/Controllers/MVController.php +++ b/app/Controllers/MVController.php @@ -2,10 +2,11 @@ namespace App\Controllers; -use Psr\Log\LoggerInterface; -use CodeIgniter\HTTP\ResponseInterface; -use CodeIgniter\HTTP\RequestInterface; +use CodeIgniter\HTTP\DownloadResponse; use CodeIgniter\HTTP\RedirectResponse; +use CodeIgniter\HTTP\RequestInterface; +use CodeIgniter\HTTP\ResponseInterface; +use Psr\Log\LoggerInterface; abstract class MVController extends CommonController { @@ -20,7 +21,7 @@ abstract class MVController extends CommonController { switch ($field) { default: - // log_message("debug", __FUNCTION__ . "에서 호출:" . $field); + // dd(lang($this->class_path . '.' . strtoupper($field))); $options[$field] = [ "" => lang($this->class_path . '.label.' . $field) . ' 선택', ...lang($this->class_path . '.' . strtoupper($field)), @@ -90,11 +91,13 @@ abstract class MVController extends CommonController protected function create_process(): void {} final protected function create_procedure(): RedirectResponse { + //Transaction Start + $this->getModel()->transStart(); try { - //Transaction Start - $this->getModel()->transStart(); $this->create_process(); log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다."); + $this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n"); + $this->getModel()->transCommit(); return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); } catch (\Exception $e) { //Transaction Rollback @@ -138,11 +141,13 @@ abstract class MVController extends CommonController protected function modify_process(string $uid): void {} final protected function modify_procedure(string $uid): RedirectResponse { + //Transaction Start + $this->getModel()->transStart(); try { - //Transaction Start - $this->getModel()->transStart(); $this->modify_process($uid); log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다."); + $this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n"); + $this->getModel()->transCommit(); return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); } catch (\Exception $e) { //Transaction Rollback @@ -252,4 +257,63 @@ abstract class MVController extends CommonController // return redirect()->back()->with('return_message', $e->getMessage()); } } + + //OUPUT Document 관련 + private function output_save_process(string $document_type, mixed $loaded_data): array + { + $full_path = WRITEPATH . DIRECTORY_SEPARATOR . "excel"; + switch ($document_type) { + case 'excel': + $file_name = sprintf("%s_%s.xlsx", $this->class_name, date('Y-m-d_Hm')); + $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($loaded_data, 'Xlsx'); + $writer->save($full_path . DIRECTORY_SEPARATOR . $file_name); + break; + case 'pdf': + $file_name = sprintf("%s_%s.pdf", $this->class_name, date('Y-m-d_Hm')); + $writer = new \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($loaded_data); + $writer->save($full_path . DIRECTORY_SEPARATOR . $file_name); + break; + default: + if (!is_file($full_path)) { + throw new \Exception("첨부파일이 확인되지 않습니다.\n"); + } + // //oupuput directly + // header("Content-Type: application/vnd.ms-excel"); + // header(sprintf("Content-Disposition: attachment; filename=%s", urlencode($output_name))); + // header("Expires: 0"); + // header("Cache-Control: must-revalidate"); + // header("Pragma: public"); + // header("Content-Length:" . filesize($full_path)); + // return $writer->save('php://output'); + break; + } + return array($full_path, $file_name); + } + //File Download관련 + final public function download_procedure(string $output_type, mixed $entity = null): DownloadResponse|RedirectResponse + { + try { + switch ($output_type) { + case 'excel': + case 'pdf': + //data loading + $reader = new \PhpOffice\PhpSpreadsheet\Reader\Html(); + // string buffer에서 읽어오는 경우 + $this->entitys = $this->list_entitys_process(); + $loaded_data = $reader->loadFromString(view( + strtolower($this->class_path) . DIRECTORY_SEPARATOR . $output_type, + ['viewDatas' => $this->getViewDatas()] + )); + list($full_path, $file_name) = $this->output_save_process($output_type, $loaded_data); + break; + default: + list($file_name, $uploaded_filename) = $entity->getDownlaodFile(); + $full_path = WRITEPATH . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . $uploaded_filename; + break; + } + return $this->response->download($full_path, null)->setFileName($file_name); + } catch (\Exception $e) { + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with('return_message', $e->getMessage()); + } + } } diff --git a/app/Entities/MapurlEntity.php b/app/Entities/MapurlEntity.php new file mode 100644 index 0000000..7628e67 --- /dev/null +++ b/app/Entities/MapurlEntity.php @@ -0,0 +1,27 @@ +getPK()}:{$this->getTitle()}}"; + } + public function getPK(): int + { + return $this->attributes[MapurlModel::PK]; + } + public function getTitle(): string + { + return $this->attributes[MapurlModel::TITLE]; + } + public function setTitle(string $title): void + { + $this->attributes[MapurlModel::TITLE] = $title; + } + //Common Function +} diff --git a/app/Entities/UserEntity.php b/app/Entities/UserEntity.php index fd6a5a7..4cda592 100644 --- a/app/Entities/UserEntity.php +++ b/app/Entities/UserEntity.php @@ -9,7 +9,7 @@ class UserEntity extends CommonEntity { public function __toString(): string { - return "{$this->getPK()}:{$this->getID()}:{$this->getTitle()},{$this->getLevel()}/{$this->getPoint()}"; + return "{$this->getPK()}:{$this->getID()}:{$this->getTitle()},{$this->getRole()}}"; } public function getPK(): int { @@ -29,21 +29,8 @@ class UserEntity extends CommonEntity { return $this->attributes['id']; } - public function getPoint(): int + public function getRole(): string { - return $this->attributes['point']; - } - public function setPoint(int $point): void - { - - $this->attributes['point'] = $point; - } - public function getLevel(): int - { - return $this->attributes['level']; - } - public function setLevel(int $value): void - { - $this->attributes['level'] = $value; + return $this->attributes['role']; } } diff --git a/app/Helpers/Admin/Cloudflare/Account_helper.php b/app/Helpers/Admin/Cloudflare/Account_helper.php index af8a955..6015dd5 100644 --- a/app/Helpers/Admin/Cloudflare/Account_helper.php +++ b/app/Helpers/Admin/Cloudflare/Account_helper.php @@ -100,16 +100,16 @@ function getFieldView_AccountHelper(string $field, AccountEntity $entity, array $value = $value ? date("Y-m-d", strtotime($value)) : ""; break; default: - if (in_array($field, $viewDatas['filter_fields']) && $value) { - $extras["onChange"] = sprintf( - 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', - current_url(), - $entity->getPK(), - $field, - $field - ); - $value = getFieldForm_AccountHelper($field, $entity->$field, $viewDatas, $extras); - } + // if (in_array($field, $viewDatas['filter_fields']) && $value) { + // $extras["onChange"] = sprintf( + // 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', + // current_url(), + // $entity->getPK(), + // $field, + // $field + // ); + // $value = getFieldForm_AccountHelper($field, $entity->$field, $viewDatas, $extras); + // } break; } return $value; diff --git a/app/Helpers/Admin/Cloudflare/Auth_helper.php b/app/Helpers/Admin/Cloudflare/Auth_helper.php index 60a0b25..adea0cf 100644 --- a/app/Helpers/Admin/Cloudflare/Auth_helper.php +++ b/app/Helpers/Admin/Cloudflare/Auth_helper.php @@ -97,7 +97,6 @@ function getListColumns_AuthHelper(string $field, array $viewDatas, array $extra $label = anchor((string)$viewDatas['uri'], $label); switch ($field) { case AuthModel::TITLE: - $label .= " + + +
+include('templates/' . $viewDatas['layout'] . '/modalform'); ?> +endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/mapurl/modify.php b/app/Views/admin/mapurl/modify.php new file mode 100644 index 0000000..239196e --- /dev/null +++ b/app/Views/admin/mapurl/modify.php @@ -0,0 +1,24 @@ +extend("layouts/empty") ?> +section('content') ?> + + + + + + + + + + + + + + +
+ $field, $viewDatas) ?> +
+
+ "btn btn-outline btn-primary")); ?> +
+ +endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/user/create.php b/app/Views/admin/user/create.php new file mode 100644 index 0000000..9f6cec5 --- /dev/null +++ b/app/Views/admin/user/create.php @@ -0,0 +1,24 @@ +extend("layouts/empty") ?> +section('content') ?> + + + + + + + + + + + + + + +
+ +
+
+ "btn btn-outline btn-primary")); ?> +
+ +endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/user/index.php b/app/Views/admin/user/index.php index 4ba60b3..0b138f0 100644 --- a/app/Views/admin/user/index.php +++ b/app/Views/admin/user/index.php @@ -1,50 +1,51 @@ -extend('layouts/admin') ?> +extend("layouts/{$viewDatas['layout']}") ?> section('content') ?> - -
-
- "get")) ?> - - include('templates/admin/index_head') ?> - -
- - - - - - - - - - - - - status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> - - - - - - - + + + +include('templates/' . $viewDatas['layout'] . '/index_top'); ?> +
#@
- "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"]) ?>
+ + + + + - -
번호
-
- - -
- + 작업 + + + + + + status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>> + + "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?> + + + + + + + + + getPK(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> + + + + + + + +
+
+
+include('templates/' . $viewDatas['layout'] . '/modalform'); ?> endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/user/insert.php b/app/Views/admin/user/insert.php deleted file mode 100644 index e834872..0000000 --- a/app/Views/admin/user/insert.php +++ /dev/null @@ -1,24 +0,0 @@ -extend('layouts/admin') ?> -section('content') ?> - -
- - - - - - - - - - - - - - -
- - -
"btn btn-outline btn-primary")); ?>
-
-endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/user/modify.php b/app/Views/admin/user/modify.php new file mode 100644 index 0000000..9f260a8 --- /dev/null +++ b/app/Views/admin/user/modify.php @@ -0,0 +1,24 @@ +extend("layouts/empty") ?> +section('content') ?> + + + + + + + + + + + + + + +
+ $field, $viewDatas) ?> +
+
+ "btn btn-outline btn-primary")); ?> +
+ +endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/user/update.php b/app/Views/admin/user/update.php deleted file mode 100644 index c673532..0000000 --- a/app/Views/admin/user/update.php +++ /dev/null @@ -1,24 +0,0 @@ -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/user/view.php b/app/Views/admin/user/view.php deleted file mode 100644 index 69e8d92..0000000 --- a/app/Views/admin/user/view.php +++ /dev/null @@ -1,19 +0,0 @@ -extend('layouts/admin') ?> -section('content') ?> - -
- - - - - - - - - -
- - -
-
-endSection() ?> \ No newline at end of file diff --git a/app/Views/layouts/admin/left_menu/base.php b/app/Views/layouts/admin/left_menu/base.php index b24a973..d13a1e9 100644 --- a/app/Views/layouts/admin/left_menu/base.php +++ b/app/Views/layouts/admin/left_menu/base.php @@ -5,5 +5,5 @@ SNS 계정 관리
- MapURL 관리 + MapURL 관리
\ No newline at end of file diff --git a/app/Views/layouts/empty.php b/app/Views/layouts/empty.php index 2f23d0f..2631393 100644 --- a/app/Views/layouts/empty.php +++ b/app/Views/layouts/empty.php @@ -1,34 +1,29 @@ - - + + - - - - - - - - - - - - - - + + <?= $viewDatas['title'] ?> + + + + + + + + + + + -
- include('templates/empty/header'); ?> - renderSection('content') ?> - include('templates/empty/footer'); ?> -
+
renderSection('content') ?>
\ No newline at end of file diff --git a/app/Views/templates/admin/actionform.php b/app/Views/templates/admin/actionform.php index 13d9126..dd9bf7e 100644 --- a/app/Views/templates/admin/actionform.php +++ b/app/Views/templates/admin/actionform.php @@ -1,7 +1,29 @@ -
+ + +
+ +
- \ No newline at end of file + \ No newline at end of file diff --git a/app/Views/templates/admin/index_top.php b/app/Views/templates/admin/index_top.php new file mode 100644 index 0000000..1aed90c --- /dev/null +++ b/app/Views/templates/admin/index_top.php @@ -0,0 +1,25 @@ + "get")) ?> + + \ No newline at end of file diff --git a/app/Views/templates/admin/modalform.php b/app/Views/templates/admin/modalform.php index 7b67441..49e9786 100644 --- a/app/Views/templates/admin/modalform.php +++ b/app/Views/templates/admin/modalform.php @@ -1,19 +1,47 @@ -