dbms_init_base

This commit is contained in:
최준흠 2025-05-06 10:26:18 +09:00
parent 7575272c2c
commit 1239d97976
43 changed files with 1613 additions and 646 deletions

View File

@ -0,0 +1,115 @@
<?php
namespace App\Controllers\Admin\Customer;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Validation;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\AccountHelper;
use App\Services\Customer\AccountService;
class AccountController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
$this->class_path = $this->getService()->getClassPath();
$this->title = lang("{$this->getService()->getClassPath()}.title");
$this->helper = $this->getHelper();
}
public function getService(): AccountService
{
if (!$this->_service) {
$this->_service = new AccountService($this->request);
}
return $this->_service;
}
public function getHelper(): mixed
{
if (!$this->_helper) {
$this->_helper = new AccountHelper($this->request);
}
return $this->_helper;
}
//Index,FieldForm관련
public function getFields(): array
{
return ['id', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'];
}
public function getFilterFields(): array
{
return ['role', 'status'];
}
public function getBatchJobFields(): array
{
return ['status'];
}
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
{
switch ($field) {
case 'role':
//아래 Rule Array는 필드명.* checkbox를 사용
$validation->setRule("{$field}.*", $field, $rule);
break;
default:
$validation = parent::setValidation($validation, $action, $field, $rule);
break;
}
return $validation;
}
//Index,FieldForm관련.
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
{
switch ($action) {
case 'create':
case 'modify':
$url = base_url() . $this->uri_path . "view/" . $this->entity->getPK();
$result = redirect()->to($url)->with('error', $message);
break;
default:
$result = parent::getResultPageByActon($action, $message);
break;
}
return $result;
}
//생성
protected function create_form_process(): void
{
$fields = [
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
];
$this->init('create_form', $fields);
parent::create_form_process();
}
protected function create_process(): mixed
{
$fields = [
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
];
$this->init('create', $fields);
return parent::create_process();
}
//수정
protected function modify_form_process(mixed $uid): mixed
{
$fields = [
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
];
$this->init('modify_form', $fields);
return parent::modify_form_process($uid);
}
protected function modify_process($uid): mixed
{
$fields = [
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'],
];
$this->init('modify', $fields);
return parent::modify_process($uid);
}
}

View File

@ -0,0 +1,116 @@
<?php
namespace App\Controllers\Admin\Customer;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Validation;
use Psr\Log\LoggerInterface;
use App\Helpers\Customer\ClientHelper;
use App\Services\Customer\ClientService;
class ClientController extends CustomerController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->uri_path .= strtolower($this->getService()->getClassName()) . '/';
$this->class_path = $this->getService()->getClassPath();
$this->title = lang("{$this->getService()->getClassPath()}.title");
$this->helper = $this->getHelper();
}
public function getService(): ClientService
{
if (!$this->_service) {
$this->_service = new ClientService($this->request);
}
return $this->_service;
}
public function getHelper(): mixed
{
if (!$this->_helper) {
$this->_helper = new ClientHelper($this->request);
}
return $this->_helper;
}
//Index,FieldForm관련
public function getFields(): array
{
return ['id', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'];
}
public function getFilterFields(): array
{
return ['role', 'status'];
}
public function getBatchJobFields(): array
{
return ['status'];
}
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
{
switch ($field) {
case 'role':
//아래 Rule Array는 필드명.* checkbox를 사용
$validation->setRule("{$field}.*", $field, $rule);
break;
default:
$validation = parent::setValidation($validation, $action, $field, $rule);
break;
}
return $validation;
}
//Index,FieldForm관련.
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
{
switch ($action) {
case 'create':
case 'modify':
$url = base_url() . $this->uri_path . "view/" . $this->entity->getPK();
$result = redirect()->to($url)->with('error', $message);
break;
default:
$result = parent::getResultPageByActon($action, $message);
break;
}
return $result;
}
//생성
protected function create_form_process(): void
{
$fields = [
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
];
$this->init('create_form', $fields);
parent::create_form_process();
}
protected function create_process(): mixed
{
$fields = [
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
];
$this->init('create', $fields);
return parent::create_process();
}
//수정
protected function modify_form_process(mixed $uid): mixed
{
$fields = [
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role'],
];
$this->init('modify_form', $fields);
return parent::modify_form_process($uid);
}
protected function modify_process($uid): mixed
{
$fields = [
'fields' => ['id', 'passwd', 'confirmpassword', $this->getService()->getModel()::TITLE, 'email', 'mobile', 'role', 'status'],
];
$this->init('modify', $fields);
return parent::modify_process($uid);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Controllers\Admin\Customer;
use App\Controllers\Admin\AdminController;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
abstract class CustomerController extends AdminController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->uri_path .= 'customer/';
$this->uri_path .= "customer/";
$this->view_path .= "customer" . DIRECTORY_SEPARATOR;
}
}

View File

@ -13,6 +13,7 @@ use App\Services\UserService;
class MyLogController extends AdminController
{
private $_helper = null;
private $_userService = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
@ -60,7 +61,6 @@ class MyLogController extends AdminController
{
switch ($field) {
case 'user_uid':
// $this->getUserModel()->where('status', DEFAULTS['STATUS']);
$options[$field] = $this->getUserService()->getFormFieldOption($field);
// echo $this->getUserModel()->getLastQuery();
// dd($options);

View File

@ -9,11 +9,13 @@ use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Validation\Validation;
use Psr\Log\LoggerInterface;
use App\Helpers\UserHelper as Helper;
use App\Services\UserService as Service;
use App\Helpers\UserHelper;
use App\Services\UserService;
class UserController extends AdminController
{
private $_service = null;
private $_helper = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@ -22,17 +24,17 @@ class UserController extends AdminController
$this->title = lang("{$this->getService()->getClassPath()}.title");
$this->helper = $this->getHelper();
}
final public function getService(): Service
final public function getService(): UserService
{
if (!$this->_service) {
$this->_service = new Service($this->request);
$this->_service = new UserService($this->request);
}
return $this->_service;
}
public function getHelper(): mixed
{
if (!$this->_helper) {
$this->_helper = new Helper($this->request);
$this->_helper = new UserHelper($this->request);
}
return $this->_helper;
}
@ -69,8 +71,8 @@ class UserController extends AdminController
switch ($action) {
case 'create':
case 'modify':
$url = base_url() . $this->uri_path . "view/" . $this->entity->getPK();
$result = redirect()->to($url)->with('error', $message);
$this->getHelper()->setViewDatas($this->getViewDatas());
$result = view($this->view_path . 'view', ['viewDatas' => $this->getViewDatas()]);;
break;
default:
$result = parent::getResultPageByActon($action, $message);

View File

@ -9,45 +9,30 @@ use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Helpers\AuthHelper as Helper;
use App\Libraries\MySocket\GoogleSocket\API as GoogleSocket;
use App\Services\UserService;
use App\Entities\UserEntity as Entity;
use App\Entities\UserEntity;
use App\Helpers\AuthHelper;
abstract class AuthController extends CommonController
{
private ?GoogleSocket $_socket = null;
private ?UserService $_userService = null;
private $_helper = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->layout = "auth";
$this->uri_path = "auth/";
$this->view_path = "auth" . DIRECTORY_SEPARATOR;
$this->helper = $this->getHelper();
}
abstract protected function login_process(): Entity;
abstract protected function getSNSButton(): string;
abstract protected function login_process(): UserEntity;
final public function getSocket()
{
if (!$this->_socket) {
$this->_socket = new GoogleSocket();
}
return $this->_socket;
}
public function getHelper(): mixed
final public function getHelper(): mixed
{
if (!$this->_helper) {
$this->_helper = new Helper($this->request);
$this->_helper = new AuthHelper($this->request);
}
return $this->_helper;
}
final public function getUserService(): UserService
{
if (!$this->_userService) {
$this->_userService = new UserService($this->request);
}
return $this->_userService;
}
//Index,FieldForm관련
public function getFields(): array
@ -84,9 +69,7 @@ abstract class AuthController extends CommonController
try {
$this->init(__FUNCTION__);
helper(['form']);
//구글 로그인 BUTTON용
// $this->google_url = $this->getSocket()->createAuthUrl();
$this->google_url = "";
$this->sns_buttoh = $this->getSNSButton();
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
return $this->getResultPageByActon($this->action);
} catch (\Exception $e) {

View File

@ -6,12 +6,15 @@ use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Services\Auth\GoogleService as Service;
use App\Entities\UserEntity as Entity;
use App\Libraries\MySocket\GoogleSocket\API as GoogleSocket;
use App\Services\Auth\GoogleService;
use App\Entities\UserEntity;
class GoogleController extends AuthController
{
private ?Service $_service = null;
private ?GoogleSocket $_socket = null;
private $_service = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@ -19,17 +22,29 @@ class GoogleController extends AuthController
$this->class_path = $this->getService()->getClassPath();
$this->title = lang("{$this->getService()->getClassPath()}.title");;
}
final public function getService(): Service
final public function getSocket()
{
if (!$this->_socket) {
$this->_socket = new GoogleSocket();
}
return $this->_socket;
}
final public function getService(): GoogleService
{
if (!$this->_service) {
$this->_service = new Service($this->getSocket(), $this->request);
$this->_service = new GoogleService($this->getSocket(), $this->request);
}
return $this->_service;
}
public function getSNSButton(): string
{
//구글 로그인 BUTTON용
return anchor($this->getSocket()->createAuthUrl(), ICONS['GOOGLE'] . 'Google 로그인', ["class" => "btn-google"]);
}
//로그인처리
protected function login_process(): Entity
protected function login_process(): UserEntity
{
$access_code = $this->request->getVar('code');
if (!$access_code) {

View File

@ -6,12 +6,12 @@ use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Services\Auth\LocalService as Service;
use App\Entities\UserEntity as Entity;
use App\Entities\UserEntity;
use App\Services\Auth\LocalService;
class LocalController extends AuthController
{
private ?Service $_service = null;
private $_service = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@ -19,16 +19,20 @@ class LocalController extends AuthController
$this->class_path = $this->getService()->getClassPath();
$this->title = lang("{$this->getService()->getClassPath()}.title");;
}
final public function getService(): Service
final public function getService(): LocalService
{
if (!$this->_service) {
$this->_service = new Service($this->request);
$this->_service = new LocalService($this->request);
}
return $this->_service;
}
public function getSNSButton(): string
{
return "";
}
//로그인처리
protected function login_process(): Entity
protected function login_process(): UserEntity
{
$this->init(__FUNCTION__);
$this->formDatas = $this->doValidate($this->action, $this->fields);

View File

@ -17,7 +17,6 @@ use Psr\Log\LoggerInterface;
use App\Libraries\LogCollector;
use App\Services\MyLogService;
use App\Helpers\CommonHelper as Helper;
abstract class CommonController extends BaseController
{
@ -25,13 +24,14 @@ abstract class CommonController extends BaseController
private $_myLogService = null;
private $_viewDatas = [];
abstract public function getService(): mixed;
abstract function getHelper(): mixed;
abstract public function getFields(): array;
abstract public function getFilterFields(): array;
abstract public function getBatchJobFields(): array;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_myAuth = service('myauth');
$this->isLoggedIn = false;
if ($this->getMyAuth()->isLoggedIn()) {
$this->isLoggedIn = true;
$this->myAuthName = $this->getMyAuth()->getNameByAuthInfo();
@ -51,8 +51,15 @@ abstract class CommonController extends BaseController
}
final protected function getMyAuth(): mixed
{
if (!$this->_myAuth) {
$this->_myAuth = service('myauth');
}
return $this->_myAuth;
}
final public function getViewDatas(): array
{
return $this->_viewDatas;
}
final public function getMyLogService(): mixed
{
if (!$this->_myLogService) {
@ -60,35 +67,16 @@ abstract class CommonController extends BaseController
}
return $this->_myLogService;
}
public function getHelper(): mixed
{
if (!$this->_helper) {
$this->_helper = new Helper($this->request);
}
return $this->_helper;
}
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
{
switch ($action) {
case 'create_form':
case 'modify_form':
case 'index':
case 'view':
$this->getHelper()->setViewDatas($this->getViewDatas());
$result = view($this->view_path . $action, ['viewDatas' => $this->getViewDatas()]);
break;
default:
$result = redirect()->to($this->_myAuth->popPreviousUrl())->with('error', $message);
break;
}
return $result;
}
final public function getViewDatas(): array
{
return $this->_viewDatas;
}
//Index,FieldForm관련
protected function init(string $action, array $fields = []): void
{
$this->action = $action;
$this->fields = array_key_exists('fields', $fields) && is_array($fields['fields']) && count($fields['fields']) ? $fields['fields'] : $this->getFields();
$this->field_rules = array_key_exists('field_rules', $fields) && is_array($fields['field_rules']) && count($fields['field_rules']) ? $fields['field_rules'] : $this->getFieldRules($this->action, $this->fields);
$this->filter_fields = array_key_exists('filter_fields', $fields) && is_array($fields['filter_fields']) && count($fields['filter_fields']) ? $fields['filter_fields'] : $this->getFilterFields();
$this->field_options = array_key_exists('field_options', $fields) && is_array($fields['field_optionss']) && count($fields['field_options']) ? $fields['field_options'] : $this->getFormFieldOptions($this->filter_fields);
$this->batchjob_fields = array_key_exists('batchjob_fields', $fields) && is_array($fields['batchjob_fields']) && count($fields['batchjob_fields']) ? $fields['filter_fields'] : $this->getBatchJobFields();
}
protected function getFieldRule(string $action, string $field): string
{
if (is_array($field)) {
@ -113,10 +101,8 @@ abstract class CommonController extends BaseController
switch ($field) {
default:
$options[$field] = lang($this->getService()->getClassPath() . '.' . strtoupper($field));
// dd($options);
break;
}
// dd($options);
return $options;
}
final protected function getFormFieldOptions(array $fields, array $options = []): array
@ -127,7 +113,6 @@ abstract class CommonController extends BaseController
}
$options = $this->getFormFieldOption($field, $options);
}
// dd($options);
return $options;
}
protected function setValidation(Validation $validation, string $action, string $field, ?string $rule = null): Validation
@ -139,18 +124,7 @@ abstract class CommonController extends BaseController
}
return $validation;
}
//Index,FieldForm관련
//Field관련
final protected function init(string $action, array $fields = []): void
{
$this->action = $action;
$this->fields = array_key_exists('fields', $fields) && is_array($fields['fields']) && count($fields['fields']) ? $fields['fields'] : $this->getFields();
$this->field_rules = array_key_exists('field_rules', $fields) && is_array($fields['field_rules']) && count($fields['field_rules']) ? $fields['field_rules'] : $this->getFieldRules($this->action, $this->fields);
$this->filter_fields = array_key_exists('filter_fields', $fields) && is_array($fields['filter_fields']) && count($fields['filter_fields']) ? $fields['filter_fields'] : $this->getFilterFields();
$this->field_options = array_key_exists('field_options', $fields) && is_array($fields['field_optionss']) && count($fields['field_options']) ? $fields['field_options'] : $this->getFormFieldOptions($this->filter_fields);
$this->batchjob_fields = array_key_exists('batchjob_fields', $fields) && is_array($fields['batchjob_fields']) && count($fields['batchjob_fields']) ? $fields['filter_fields'] : $this->getBatchJobFields();
}
//데이터 검증
final protected function doValidate(string $action, array $fields, ?Validation $validation = null): array
{
@ -171,6 +145,23 @@ abstract class CommonController extends BaseController
}
return $validation->getValidated();
}
protected function getResultPageByActon(string $action, string $message = MESSAGES["SUCCESS"]): RedirectResponse|string
{
switch ($action) {
case 'create_form':
case 'modify_form':
case 'index':
case 'view':
$this->getHelper()->setViewDatas($this->getViewDatas());
$result = view($this->view_path . $action, ['viewDatas' => $this->getViewDatas()]);
break;
default:
$result = redirect()->to($this->getMyAuth()->popPreviousUrl())->with('error', $message);
break;
}
return $result;
}
//Index,FieldForm관련
// 생성
protected function create_form_process(): void {}
@ -208,7 +199,6 @@ abstract class CommonController extends BaseController
return redirect()->back()->withInput()->with('error', $e->getMessage());
}
}
//수정관련
protected function modify_form_process(mixed $uid): mixed
{
@ -284,10 +274,6 @@ abstract class CommonController extends BaseController
$this->formDatas = $this->doValidate($this->action, $this->fields);
$temps = [];
foreach ($entities as $entity) {
// echo var_dump($entity->toArray());
// echo "<HR>";
// echo $this->formDatas['status'];
// exit;
$temps[] = $this->getService()->modify($entity, $this->formDatas);
}
return $temps;
@ -357,7 +343,7 @@ abstract class CommonController extends BaseController
}
}
//일괄삭제
protected function batchjob_delete_process(array $entities): void
protected function batchjob_delete_process(array $entities): int
{
$cnt = 0;
foreach ($entities as $entity) {
@ -367,11 +353,7 @@ abstract class CommonController extends BaseController
$cnt++;
}
}
if ($cnt) {
$message = "총:" . count($entities) . "중에 " . $cnt . "개를 실패";
LogCollector::error($message);
throw new \Exception($message);
}
return $cnt;
}
final public function batchjob_delete(): RedirectResponse|string
{
@ -389,7 +371,12 @@ abstract class CommonController extends BaseController
$entity = $this->getService()->getEntity($uid);
$entities[] = $entity;
}
$this->batchjob_delete_process($entities);
$cnt = $this->batchjob_delete_process($entities);
if ($cnt) {
$message = "총:" . count($entities) . "중에 " . $cnt . "개를 실패";
LogCollector::error($message);
throw new \Exception($message);
}
$this->getService()->getModel()->transCommit();
$this->getMyLogService()->save($this->getService(), __FUNCTION__, $this->_myAuth, MESSAGES["SUCCESS"]);
return $this->getResultPageByActon($this->action);
@ -441,7 +428,7 @@ abstract class CommonController extends BaseController
}
//검색일 처리
$this->start = $this->request->getVar('start') ?? DEFAULTS['EMPTY'];
$this->end = $this->request->getVar('end') ?: DEFAULTS['EMPTY'];
$this->end = $this->request->getVar('end') ?? DEFAULTS['EMPTY'];
$this->getService()->getModel()->setList_DateFilter($this->start, $this->end);
}
//PageNation 처리
@ -480,8 +467,8 @@ abstract class CommonController extends BaseController
//Pagination 처리
$this->pagination = $this->getPaginationForList();
//OrderBy 처리
$this->order_field = $this->request->getVar('order_field') ?: DEFAULTS['EMPTY'];
$this->order_value = $this->request->getVar('order_value') ?: DEFAULTS['EMPTY'];
$this->order_field = $this->request->getVar('order_field') ?? DEFAULTS['EMPTY'];
$this->order_value = $this->request->getVar('order_value') ?? DEFAULTS['EMPTY'];
if ($this->order_field !== DEFAULTS['EMPTY'] && $this->order_value !== DEFAULTS['EMPTY']) {
$this->getService()->getModel()->orderBy(sprintf("%s.%s %s", $this->getService()->getModel()::TABLE, $this->order_field, $this->order_value));
} else {

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
<?php
namespace App\Entities\Customer;
use App\Entities\CommonEntity;
use App\Models\Customer\AccountModel;
class AccountEntity extends CommonEntity
{
const PK = AccountModel::PK;
const TITLE = AccountModel::TITLE;
public function getClient()
{
return $this->attributes['clientinfo_uid'];
}
public function getCoupon()
{
return $this->attributes['coupon_balance'];
}
public function getPoint()
{
return $this->attributes['point_balance'];
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Entities\Customer;
use App\Entities\CommonEntity;
use App\Models\Customer\ClientModel;
class ClientEntity extends CommonEntity
{
const PK = ClientModel::PK;
const TITLE = ClientModel::TITLE;
public function getRole(): string
{
return $this->attributes['role'];
}
public function getAccount()
{
return $this->attributes['account_balance'];
}
public function getCoupon()
{
return $this->attributes['coupon_balance'];
}
public function getPoint()
{
return $this->attributes['point_balance'];
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Entities\Customer;
use App\Entities\CommonEntity;
abstract class CustomerEntity extends CommonEntity
{
public function __construct(array|null $data = null)
{
parent::__construct($data);
}
}

View File

@ -8,9 +8,9 @@ class CommonHelper
{
protected ?IncomingRequest $request = null;
private $_viewDatas = [];
public function __construct(?IncomingRequest $_request = null)
public function __construct(?IncomingRequest $request = null)
{
$this->request = $_request;
$this->request = $request;
}
final public function setViewDatas(array $viewDatas): void
{

View File

@ -0,0 +1,96 @@
<?php
namespace App\Helpers\Customer;
use App\Helpers\CommonHelper;
use App\Models\UserModel as Model;
use CodeIgniter\HTTP\IncomingRequest;
class AccountHelper extends CommonHelper
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
}
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
if (in_array($viewDatas['action'], ['create', 'modify'])) {
$extras = (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
}
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'id':
case Model::TITLE:
$form = form_input($field, $value, $extras);
break;
case 'passwd':
case 'confirmpassword':
$form = form_password($field, "", ["autocomplete" => $field, ...$extras]);
break;
case 'email':
$form = form_input($field, $value, ["placeholder" => "예)test@example.com", ...$extras]);
break;
case 'mobile':
$form = form_input($field, $value, ["placeholder" => "예)010-0010-0010", ...$extras]);
break;
case 'role':
if (in_array($viewDatas['action'], ['create_form', 'modify_form'])) {
$forms = [];
foreach ($viewDatas['field_options'][$field] as $key => $label) {
$values = is_array($value) ? $value : explode(DEFAULTS["DELIMITER_ROLE"], $value);
$forms[] = form_checkbox(
"{$field}[]",
$key,
in_array($key, $values)
) . $label;
}
$form = implode(" ", $forms);
} else {
$form = form_dropdown(
$field,
[
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
] + $viewDatas['field_options'][$field],
$value,
$extras
);
}
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
}
return $form;
} //
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
{
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case Model::TITLE:
$value = form_label(
$value,
'view',
[
"data-src" => current_url() . '/view/' . $viewDatas['entity']->getPK(),
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
"style" => "color: blue; cursor: pointer; font-weight:bold;",
...$extras,
]
);
break;
case 'role':
$roles = [];
foreach (explode(DEFAULTS["DELIMITER_ROLE"], $value) as $key) {
$roles[] = $viewDatas['field_options'][$field][$key];
}
$value = implode(" , ", $roles);
break;
default:
$value = parent::getFieldView($field, $viewDatas, $extras);
break;
}
return $value;
} //
}

View File

@ -0,0 +1,92 @@
<?php
namespace App\Helpers\Customer;
use App\Helpers\CommonHelper;
use App\Models\Customer\ClientModel;
use CodeIgniter\HTTP\IncomingRequest;
class ClientHelper extends CommonHelper
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
}
public function getFieldForm(string $field, mixed $value, array $viewDatas, array $extras = []): string
{
if (in_array($viewDatas['action'], ['create', 'modify'])) {
$extras = (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => "", ...$extras] : ["class" => "form-control", ...$extras];
}
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'id':
case ClientModel::TITLE:
$form = form_input($field, $value, $extras);
break;
case 'email':
$form = form_input($field, $value, ["placeholder" => "예)test@example.com", ...$extras]);
break;
case 'phone':
$form = form_input($field, $value, ["placeholder" => "예)010-0010-0010", ...$extras]);
break;
case 'role':
if (in_array($viewDatas['action'], ['create_form', 'modify_form'])) {
$forms = [];
foreach ($viewDatas['field_options'][$field] as $key => $label) {
$values = is_array($value) ? $value : explode(DEFAULTS["DELIMITER_ROLE"], $value);
$forms[] = form_checkbox(
"{$field}[]",
$key,
in_array($key, $values)
) . $label;
}
$form = implode(" ", $forms);
} else {
$form = form_dropdown(
$field,
[
"" => lang($viewDatas['class_path'] . '.label.' . $field) . ' 선택',
] + $viewDatas['field_options'][$field],
$value,
$extras
);
}
break;
default:
$form = parent::getFieldForm($field, $value, $viewDatas, $extras);
break;
}
return $form;
} //
public function getFieldView(string $field, array $viewDatas, array $extras = []): string
{
$value = $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case ClientModel::TITLE:
$value = form_label(
$value,
'view',
[
"data-src" => current_url() . '/view/' . $viewDatas['entity']->getPK(),
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
"style" => "color: blue; cursor: pointer; font-weight:bold;",
...$extras,
]
);
break;
case 'role':
$roles = [];
foreach (explode(DEFAULTS["DELIMITER_ROLE"], $value) as $key) {
$roles[] = $viewDatas['field_options'][$field][$key];
}
$value = implode(" , ", $roles);
break;
default:
$value = parent::getFieldView($field, $viewDatas, $extras);
break;
}
return $value;
} //
}

View File

@ -0,0 +1,14 @@
<?php
namespace App\Helpers\Customer;
use App\Helpers\CommonHelper;
use CodeIgniter\HTTP\IncomingRequest;
class CustomerHelper extends CommonHelper
{
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
}
}

View File

@ -0,0 +1,8 @@
<?php
return [
'title' => "고객정보",
'label' => [
'id' => "계정",
'passwd' => "암호",
],
];

View File

@ -0,0 +1,22 @@
<?php
return [
'title' => "고객정보",
'label' => [
'email' => "메일",
'phone' => "연락처",
'role' => "권한",
'name' => "이름",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일",
],
"ROLE" => [
"user" => "일반회원",
"vip" => "VIP회원",
"reseller" => "리셀러",
],
"STATUS" => [
"use" => "사용",
"pause" => "사용정지",
],
];

View File

@ -14,6 +14,6 @@ return [
],
"STATUS" => [
"use" => "완료",
"unuse" => "실패",
"fail" => "실패",
],
];

View File

@ -25,6 +25,6 @@ return [
],
"STATUS" => [
"use" => "사용",
"unuse" => "사용않함",
"pause" => "사용정지",
],
];

View File

@ -64,6 +64,19 @@ abstract class CommonModel extends Model
{
return constant("static::TITLE");
}
//Primary Key로 uuid를 사용시 해당 모델에 아래 변수 반드시 추가 필요
// protected $useAutoIncrement = false;
// protected $beforeInsert = ['generateUUID'];
// allowedFields에는 PK넣으면 않됨, Column Type: CHAR(36)
//
final protected function generateUUID(): string
{
$data = random_bytes(16);
// UUID version 4 (random)
$data[6] = chr(ord($data[6]) & 0x0f | 0x40); // version 0100
$data[8] = chr(ord($data[8]) & 0x3f | 0x80); // variant 10
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
}
final protected function getFieldRules(string $action, array $fields, $rules = []): array
{
foreach ($fields as $field) {
@ -87,7 +100,7 @@ abstract class CommonModel extends Model
}
break;
case $this->getTitleField():
$rule = "required|string";
$rule = "required|trim|string";
break;
case 'image':
$rule = "is_image[{$field}]|mime_in[{$field},image/jpg,image/jpeg,image/gif,image/png,image/webp]|max_size[{$field},300]|max_dims[{$field},2048,768]";
@ -136,7 +149,7 @@ abstract class CommonModel extends Model
return $value;
}
private function save_process($entity): mixed
private function save_process(mixed $entity): mixed
{
// 최종 변경사항이 없으면
if (!$entity->hasChanged()) {
@ -155,6 +168,7 @@ abstract class CommonModel extends Model
}
return $entity;
}
public function create(array $formDatas, mixed $entity): mixed
{
// Field에 맞는 Validation Rule 재정의
@ -164,7 +178,11 @@ abstract class CommonModel extends Model
LogCollector::debug("{$field}:{$formDatas[$field]}");
$entity->$field = $this->convertEntityData($field, $formDatas);
}
// dd($entity);
// primaryKey가 자동입력이 아니면
if (!$this->useAutoIncrement) {
$pkField = $this->getPKField();
$entity->$pkField = $this->generateUUID();
}
$entity = $this->save_process($entity);
// primaryKey가 자동입력이면
if ($this->useAutoIncrement) {

View File

@ -0,0 +1,57 @@
<?php
namespace App\Models\Customer;
use App\Entities\Customer\AccountEntity;
use App\Models\CommonModel;
class AccountModel extends CustomerModel
{
const TABLE = "acountinfo";
const PK = "uid";
const TITLE = "title";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = AccountEntity::class;
protected $allowedFields = [
"clientinfo_uid",
"title",
"alias",
"amount",
"status",
];
public function __construct()
{
parent::__construct();
}
public function getFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "clientinfo_uid":
case "amount":
$rule = "required|number";
break;
case "title":
case "alias":
$rule = "required|trim|string";
break;
case "status":
$rule = "if_exist|in_list[in,out]";
break;
default:
$rule = parent::getFieldRule($action, $field);
break;
}
return $rule;
}
//List 검색용
public function setList_WordFilter(string $word): void
{
$this->orLike(self::TABLE . "." . self::TITLE, $word, 'both');
$this->orLike(self::TABLE . '.alias', $word, 'both');
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace App\Models\Customer;
use App\Entities\Customer\ClientEntity;
class ClientModel extends CustomerModel
{
const TABLE = "clientinfo";
const PK = "uid";
const TITLE = "name";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = ClientEntity::class;
protected $allowedFields = [
"role",
"name",
"email",
"phone",
"account_balance",
"coupon_balance",
"point_balance",
"status"
];
public function __construct()
{
parent::__construct();
}
public function getFieldRule(string $action, string $field): string
{
if (is_array($field)) {
throw new \Exception(__FUNCTION__ . "=> field가 array 입니다.\n" . var_export($field, true));
}
switch ($field) {
case "name":
$rule = "required|trim|string";
break;
case "email":
$rule = "if_exist|trim|valid_email";
$rule .= in_array($action, ["create", "create_form"]) ? "|is_unique[{$this->table}.{$field}]" : "";
break;
case "role":
$rule = "required|trim|string";
break;
case "account_balance":
case "coupon_balance":
case "point_balance":
$rule = "if_exist|trim|number";
break;
default:
$rule = parent::getFieldRule($action, $field);
break;
}
return $rule;
}
//List 검색용
public function setList_WordFilter(string $word): void
{
$this->orLike(self::TABLE . "." . self::TITLE, $word, 'both');
$this->orLike(self::TABLE . '.email', $word, 'both');
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace App\Models\Customer;
use App\Models\CommonModel;
abstract class CustomerModel extends CommonModel
{
protected function __construct()
{
parent::__construct();
}
}

View File

@ -2,7 +2,7 @@
namespace App\Models;
use App\Entities\MyLogEntity as Entity;
use App\Entities\MyLogEntity;
use App\Models\CommonModel;
class MyLogModel extends CommonModel
@ -12,7 +12,7 @@ class MyLogModel extends CommonModel
const TITLE = "title";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = Entity::class;
protected $returnType = MyLogEntity::class;
protected $allowedFields = [
"user_uid",
"class_name",

View File

@ -2,7 +2,7 @@
namespace App\Models;
use App\Entities\UserEntity as Entity;
use App\Entities\UserEntity;
use App\Models\CommonModel;
class UserModel extends CommonModel
@ -12,7 +12,7 @@ class UserModel extends CommonModel
const TITLE = "name";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = Entity::class;
protected $returnType = UserEntity::class;
protected $allowedFields = [
"id",
"passwd",
@ -49,6 +49,9 @@ class UserModel extends CommonModel
case "role":
$rule = "required|trim|string";
break;
case "status":
$rule = "if_exist|in_list[use,pause]";
break;
default:
$rule = parent::getFieldRule($action, $field);
break;

View File

@ -2,7 +2,7 @@
namespace App\Models;
use App\Entities\UserSNSEntity as Entity;
use App\Entities\UserSNSEntity;
use App\Models\CommonModel;
class UserSNSModel extends CommonModel
@ -14,7 +14,7 @@ class UserSNSModel extends CommonModel
const SITE = "site";
protected $table = self::TABLE;
protected $primaryKey = self::PK;
protected $returnType = Entity::class;
protected $returnType = UserSNSEntity::class;
protected $allowedFields = [
"site",
"user_uid",

View File

@ -2,7 +2,8 @@
namespace App\Services\Auth;
use App\Entities\UserEntity as Entity;
use App\Entities\UserEntity;
use App\Models\UserModel;
use App\Services\CommonService;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\Session\Session;
@ -15,6 +16,20 @@ abstract class AuthService extends CommonService
{
parent::__construct($request);
}
public function getClassName(): string
{
return "Auth" . DIRECTORY_SEPARATOR;
}
final public function getModelClass(): UserModel
{
return new UserModel();
}
final public function getEntityClass(): UserEntity
{
return new UserEntity();
}
final public function getSession(): Session
{
if (!$this->_session) {
@ -83,7 +98,7 @@ abstract class AuthService extends CommonService
return '/'; // 기본 URL
}
public function login(Entity $entity): Entity
public function login(UserEntity $entity): UserEntity
{
$this->getSession()->set(SESSION_NAMES['ISLOGIN'], true);
$this->getSession()->set(SESSION_NAMES['AUTH'], ['uid' => $entity->getPK(), 'id' => $entity->getID(), 'name' => $entity->getTitle(), 'role' => $entity->role]);

View File

@ -2,8 +2,7 @@
namespace App\Services\Auth;
use App\Entities\UserEntity as Entity;
use App\Models\UserModel as Model;
use App\Entities\UserEntity;
// use App\Libraries\MySocket\GoogleSocket\CURL;
use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\IncomingRequest;
@ -16,24 +15,11 @@ class GoogleService extends AuthService
$this->_mySocket = $mySocket;
parent::__construct($request);
}
final public function getClassName(): string
public function getClassName(): string
{
return "GoogleAuth";
return parent::getClassName() . DIRECTORY_SEPARATOR . "Google";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModelClass(): string
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
}
public function checkUser(string $access_code): Entity
public function checkUser(string $access_code): UserEntity
{
try {
// Google 서비스 설정

View File

@ -2,8 +2,7 @@
namespace App\Services\Auth;
use App\Entities\UserEntity as Entity;
use App\Models\UserModel as Model;
use App\Entities\UserEntity;
use CodeIgniter\HTTP\IncomingRequest;
class LocalService extends AuthService
@ -14,28 +13,14 @@ class LocalService extends AuthService
}
final public function getClassName(): string
{
return "LocalAuth";
return parent::getClassName() . DIRECTORY_SEPARATOR . "Local";
}
final public function getClassPath(): string
{
return $this->getClassName();
}
public function getModelClass(): string
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
}
public function checkUser(array $formDatas): Entity
public function checkUser(array $formDatas): UserEntity
{
$entity = $this->getEntity(['id' => $formDatas['id']]);
if (is_null($entity) || !isset($entity->passwd)) {
throw new \Exception("사용자ID: {$formDatas['id']}가 존재하지 않습니다.");
}
if (!password_verify($formDatas['passwd'], $entity->passwd)) {
// log_message("error", "암호: {$formDatas['passwd']}, {$entity->passwd}");
throw new \Exception("암호가 맞지 않습니다.");

View File

@ -14,8 +14,10 @@ abstract class CommonService
{
$this->request = $_request;
}
abstract public function getModelClass(): string;
abstract public function getEntityClass(): string;
abstract public function getModelClass(): mixed;
abstract public function getEntityClass(): mixed;
abstract public function getClassName(): string;
final public function __get($name)
{
if (!array_key_exists($name, $this->_serviceDatas)) {
@ -27,7 +29,10 @@ abstract class CommonService
{
$this->_serviceDatas[$name] = $value;
}
final public function getClassPath(): string
{
return $this->getClassName();
}
final public function getRequest(): IncomingRequest|null
{
return $this->request;
@ -35,9 +40,7 @@ abstract class CommonService
final public function getModel(): mixed
{
if (!$this->_model) {
$modelClass = $this->getModelClass();
$this->_model = new $modelClass();
// $this->_model->setDebug(true);
$this->_model = $this->getModelClass();
}
return $this->_model;
}

View File

@ -0,0 +1,53 @@
<?php
namespace App\Services\Customer;
use App\Entities\Customer\AccountEntity;
use App\Models\Customer\AccountModel;
use CodeIgniter\HTTP\IncomingRequest;
class AccountService extends CustomerService
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
}
final public function getClassName(): string
{
return "Account";
}
public function getModelClass(): AccountModel
{
return new AccountModel();
}
public function getEntityClass(): AccountEntity
{
return new AccountEntity();
}
public function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
default:
$this->getModel()->orderBy($this->getModel()::TITLE, 'ASC');
$options = parent::getFormFieldOption($field, $options);
break;
}
return $options;
}
public function create(array $formDatas, mixed $entity = null): AccountEntity
{
$formDatas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $formDatas['role']);
return parent::create($formDatas, $entity ?? new AccountEntity());
}
public function modify(mixed $entity, array $formDatas): AccountEntity
{
// die(var_export($formDatas, true));
//Role을 지정이 있을경우에만 , toggle이나 batcjhjob에서는 없을수도 있으므로
if (isset($formDatas['role'])) {
$formDatas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $formDatas['role']);
}
// die(var_export($formDatas, true));
return parent::modify($entity, $formDatas);
}
}

View File

@ -0,0 +1,53 @@
<?php
namespace App\Services\Customer;
use App\Entities\Customer\ClientEntity;
use App\Models\Customer\ClientModel;
use CodeIgniter\HTTP\IncomingRequest;
class ClientService extends CustomerService
{
protected ?IncomingRequest $request = null;
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
}
final public function getClassName(): string
{
return "Client";
}
public function getModelClass(): ClientModel
{
return new ClientModel();
}
public function getEntityClass(): ClientEntity
{
return new ClientEntity();
}
public function getFormFieldOption(string $field, array $options = []): array
{
switch ($field) {
default:
$this->getModel()->orderBy($this->getModel()::TITLE, 'ASC');
$options = parent::getFormFieldOption($field, $options);
break;
}
return $options;
}
public function create(array $formDatas, mixed $entity = null): ClientEntity
{
$formDatas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $formDatas['role']);
return parent::create($formDatas, $entity ?? new ClientEntity());
}
public function modify(mixed $entity, array $formDatas): ClientEntity
{
// die(var_export($formDatas, true));
//Role을 지정이 있을경우에만 , toggle이나 batcjhjob에서는 없을수도 있으므로
if (isset($formDatas['role'])) {
$formDatas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $formDatas['role']);
}
// die(var_export($formDatas, true));
return parent::modify($entity, $formDatas);
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Services\Customer;
use App\Services\CommonService;
use CodeIgniter\HTTP\IncomingRequest;
abstract class CustomerService extends CommonService
{
public function __construct(?IncomingRequest $request = null)
{
parent::__construct($request);
}
public function getClassName(): string
{
return "Customer" . DIRECTORY_SEPARATOR;
}
}

View File

@ -2,8 +2,8 @@
namespace App\Services;
use App\Entities\MyLogEntity as Entity;
use App\Models\MyLogModel as Model;
use App\Entities\MyLogEntity;
use App\Models\MyLogModel;
use App\Services\Auth\AuthService;
use CodeIgniter\HTTP\IncomingRequest;
use App\Libraries\LogCollector;
@ -18,20 +18,16 @@ class MyLogService extends CommonService
{
return "MyLog";
}
final public function getClassPath(): string
public function getModelClass(): MyLogModel
{
return $this->getClassName();
return new MyLogModel();
}
public function getModelClass(): string
public function getEntityClass(): MyLogEntity
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
return new MyLogEntity();
}
public function save($service, string $method, AuthService $myauth, string $title): Entity
public function save($service, string $method, AuthService $myauth, string $title): MyLogEntity
{
$formDatas = [
'user_uid' => $myauth->getUIDByAuthInfo(),
@ -41,6 +37,6 @@ class MyLogService extends CommonService
'content' => LogCollector::dump(),
];
LogCollector::clear();
return $this->getModel()->create($formDatas, new Entity());
return $this->getModel()->create($formDatas, new MyLogEntity());
}
}

View File

@ -2,8 +2,8 @@
namespace App\Services;
use App\Entities\UserEntity as Entity;
use App\Models\UserModel as Model;
use App\Entities\UserEntity;
use App\Models\UserModel;
use CodeIgniter\HTTP\IncomingRequest;
class UserService extends CommonService
@ -17,17 +17,13 @@ class UserService extends CommonService
{
return "User";
}
final public function getClassPath(): string
public function getModelClass(): UserModel
{
return $this->getClassName();
return new UserModel();
}
public function getModelClass(): string
public function getEntityClass(): UserEntity
{
return Model::class;
}
public function getEntityClass(): string
{
return Entity::class;
return new UserEntity();
}
public function getFormFieldOption(string $field, array $options = []): array
{
@ -39,12 +35,12 @@ class UserService extends CommonService
}
return $options;
}
public function create(array $formDatas, mixed $entity = null): Entity
public function create(array $formDatas, mixed $entity = null): UserEntity
{
$formDatas['role'] = implode(DEFAULTS["DELIMITER_ROLE"], $formDatas['role']);
return parent::create($formDatas, $entity ?? new Entity());
return parent::create($formDatas, $entity ?? new UserEntity());
}
public function modify(mixed $entity, array $formDatas): Entity
public function modify(mixed $entity, array $formDatas): UserEntity
{
// die(var_export($formDatas, true));
//암호를 입력하지 않았을시는 변경하기 않게 하기위함

View File

@ -5,7 +5,6 @@
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<div class="action_form">
<table class="table table-bordered">
<?php $cnt = 1 ?>
<?php foreach ($viewDatas['fields'] as $field): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
@ -13,17 +12,13 @@
<?= $viewDatas['helper']->getFieldForm($field, old($field), $viewDatas) ?>
<div><?= validation_show_error($field); ?></div>
</td>
<?php $cnt++ ?>
</tr>
<?php endforeach; ?>
<tr>
<td colspan="<?= $cnt * 2 ?>" class="text-center">
<?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?>
</td>
</tr>
</table>
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
<?= form_close(); ?>
</div>
<?php if (session()->has('error')): ?><div class="alert alert-info"><?= session('error') ?></div><?php endif; ?>
</div>
<script src="/assets/tinymce/tinymce.js" referrerpolicy="origin"></script>
<?= $this->endSection() ?>

View File

@ -14,7 +14,6 @@
<?= $this->include("templates/{$viewDatas['layout']}/index_header"); ?>
<div id="container" class="layout_content">
<link href="/css/<?= $viewDatas['layout'] ?>/index.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/css/<?= $viewDatas['layout'] ?>/resizeTable.css" media="screen" rel="stylesheet" type="text/css" />
<div class="index_body">
<?= $this->include("templates/{$viewDatas['layout']}/index_content_top"); ?>
<?= form_open(current_url(), ['id' => 'batchjob_form', 'method' => "post"]) ?>
@ -49,7 +48,6 @@
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
</div>
<div class="index_bottom"><?= $this->include("templates/common/modal_fetch"); ?></div>
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/resizeTable.js"></script>
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/index.js"></script>
</div>
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>

View File

@ -5,7 +5,6 @@
<?= form_open(current_url(), ['id' => 'action_form', ...$viewDatas['forms']['attributes']], $viewDatas['forms']['hiddens']) ?>
<div class="action_form">
<table class="table table-bordered">
<?php $cnt = 1 ?>
<?php foreach ($viewDatas['fields'] as $field): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
@ -13,17 +12,13 @@
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? $viewDatas['entity']->$field, $viewDatas) ?>
<div><?= validation_show_error($field); ?></div>
</td>
<?php $cnt++ ?>
</tr>
<?php endforeach; ?>
<tr>
<td colspan="<?= $cnt * 2 ?>" class="text-center">
<?= form_submit("", '수정', ["class" => "btn btn-outline btn-primary"]) ?>
</td>
</tr>
</table>
<div class="text-center"><?= form_submit("", '수정', ["class" => "btn btn-outline btn-primary"]) ?></div>
<?= form_close(); ?>
</div>
<?php if (session()->has('error')): ?><div class="alert alert-info"><?= session('error') ?></div><?php endif; ?>
</div>
<script src="/assets/tinymce/tinymce.js" referrerpolicy="origin"></script>
<?= $this->endSection() ?>

View File

@ -1,5 +1,4 @@
<?= $this->section('content') ?>
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
<link href="/css/front/login.css" media="screen" rel="stylesheet" type="text/css" />
<div class="login-page">
<div class="login-content">
@ -8,18 +7,18 @@
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<div class="input-group">
<label for="userId">아이디</label>
<input type="text" id="userId" name="id" value="<?= old('id') ?>" required>
<input type="text" name="id" value="<?= old('id') ?>" required>
<div><?= validation_show_error('id'); ?></div>
</div>
<div class="input-group">
<label for="userPassword">비밀번호</label>
<input type="password" id="userPassword" name="passwd" required>
<input type="password" name="passwd" required>
<div><?= validation_show_error('passwd'); ?></div>
</div>
<button type="submit" class="btn-login">로그인</button>
<div class="login-options">
<?= anchor($viewDatas['google_url'], ICONS['GOOGLE'] . 'Google 로그인', ["class" => "btn-google"]) ?>
<button type="button" class="btn-facebook">Facebook</button>
</div>
<div class="login-options"><?= $viewDatas['sns_buttoh'] ?></div>
<?= form_close(); ?>
<?php if (session()->has('error')): ?><div class="alert alert-info"><?= session('error') ?></div><?php endif; ?>
</div>
</div>
</div>

View File

@ -23,7 +23,6 @@
</head>
<body>
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>
<?= $this->renderSection('content') ?>
</body>

View File

@ -1,5 +1 @@
<?php if (session()->has('message')): ?>
<div class="alert alert-info">
<?= session('message') ?>
</div>
<?php endif; ?>
<?php if ($error = session('error')): ?><?= $viewDatas['helper']->alert($error) ?><?php endif ?>