servermgrv2 init...

This commit is contained in:
최준흠 2023-08-16 09:16:16 +09:00
parent 7add84d1f1
commit 2e1fdd2ce5
197 changed files with 4899 additions and 1406 deletions

18
.gitignore vendored
View File

@ -70,6 +70,17 @@ writable/HPILO/*
writable/Excel/*
!writable/Excel/index.html
#mapurl 결과물
public/mapurl/index.html
#upload 파일
public/uploads/*
public/upload_images/*
#leftmenu 파일
layouts/front/left_menu/*
layouts/main/board.php
#-------------------------
# User Guide Temp Files
#-------------------------
@ -130,10 +141,3 @@ nb-configuration.xml
/results/
/phpunit*.xml
/.phpunit.*.cache
#mapurl 결과물
public/mapurl/index.html
#upload 파일
public/uploads/*
public/upload_images/*

View File

@ -144,7 +144,39 @@ define('LAYOUTS', [
'<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>',
'<script src="/vendors/tinymce/tinymce/tinymce.min.js" referrerpolicy="origin"></script>',
]
],
'main' => [
'path' => 'layouts' . DIRECTORY_SEPARATOR . 'main',
'stylesheets' => [
'<link rel="icon" href="/favicon.ico">',
'<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">',
'<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">',
'<link href="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">',
'<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css">',
'<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2-bootstrap-5-theme@1.3.0/dist/select2-bootstrap-5-theme.min.css" />',
'<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/boxicons@latest/css/boxicons.min.css" />',
'<link rel="stylesheet" href="/css/style.css" />',
],
'javascripts' => [
'<script src="//cdn.jsdelivr.net/npm/jquery@3.7.0/dist/jquery.min.js"></script>',
'<script src="//code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>',
'<script src="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>',
'<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>',
'<script src="/vendors/tinymce/tinymce/tinymce.min.js" referrerpolicy="origin"></script>',
]
],
]);
//URL
define('URLS', [
'LOGIN' => '/front/user/login',
'SIGNUP' => '/front/user/signup',
'LOGOUT' => '/front/user/logout',
'Order' => '/front/order',
'addCart' => '/front/order/addCart',
'cancelCart' => '/front/order/cancelCart',
'cardPayment' => '/front/order/payment/card',
'depositPayment' => '/front/order/payment/deposit',
]);
//SESSION 관련
define('SESSION_NAMES', [
@ -154,16 +186,8 @@ define('SESSION_NAMES', [
'CART' => 'cart'
]);
define('AUTH_FIELDS', ['ID' => 'id', 'TITLE' => 'title', 'ROLE' => 'role']);
//Category관련 Role Fields
define('CATEGORY_ROLE_FIELDS', [
'ACCESS' => 'isaccess',
'READ' => 'isread',
'WRITE' => 'iswrite',
'REPLY' => 'isreply',
'UPLOAD' => 'isupload',
'DONWLOAD' => 'isdownload',
]);
//월이용권 상품의 Category번호
define('RENTAL_PRODUCT_CATEGORYS', [5, 8]);
//인증 관련
define('AUTH_ADAPTERS', [
'Local' => [
@ -189,7 +213,7 @@ define('PATHS', [
]);
foreach (PATHS as $key => $path) {
if (!is_dir($path)) {
mkdir($path, 0640);
mkdir($path, 0755);
}
}
@ -205,19 +229,39 @@ define('ICONS', [
'SETUP' => '<i class="bi bi-gear"></i>',
'FLAG' => '<i class="bi bi-send"></i>',
'SEARCH' => '<i class="bi bi-search"></i>',
'EXCEL' => '<i class="bi bi-file-excel"></i>',
'EXCEL' => '<img src="/images/common/excel.png"/>',
'HOME' => '<i class="bi bi-house-door-fill"></i>',
'PLAY' => '<i class="bi bi-play-fill"></i>',
'CART' => '<i class="bi bi-cart4"></i>',
'CARD' => '<i class="bi bi-credit-card"></i>',
'DEPOSIT' => '<i class="bi bi-cash-coin"></i>',
'UP' => '<i class="bi bi-arrow-up"></i>',
'DOWN' => '<i class="bi bi-arrow-down"></i>',
'LEFT' => '<i class="bi bi-arrow-left"></i>',
'RIGHT' => '<i class="bi bi-arrow-right"></i>',
'IMAGE_FILE' => '<i class="bi bi-file-earmark-image"></i>',
]);
define('CLASS_ICONS', [
'USER' => '<i class="bi bi-person-vcard"></i>',
'USERSNS' => '<i class="bi bi-globe"></i>',
'BOARDCONFIG' => '<i class="bi bi-gear"></i>',
'BOARD' => '<i class="bi bi-pencil-square"></i>',
'SITEPAGE' => '<i class="bi bi-body-text"></i>',
'CATEGORY' => '<i class="bi bi-boxes"></i>',
'PRODUCT' => '<i class="bi bi-box2"></i>',
'CART' => '<i class="bi bi-cart4"></i>',
'ORDER' => '<i class="bi bi-clipboard-check"></i>',
'BILLING' => '<i class="bi bi-cash-coin"></i>',
'CART' => '<i class="bi bi-cart4"></i>',
'CARD' => '<i class="bi bi-credit-card"></i>',
'DEPOSIT' => '<i class="bi bi-cash-coin"></i>',
]);
define('CLASS_TOP_BANNER', [
'USER' => '<img src="/images/banner/sub_visual1.jpg"/>',
'USERSNS' => '<img src="/images/banner/sub_visual1.jpg"/>',
'ORDER' => '<img src="/images/banner/sub_visual1.jpg"/>',
'CARD' => '<img src="/images/banner/sub_visual1.jpg"/>',
'DEPOSIT' => '<img src="/images/banner/sub_visual1.jpg"/>',
'PRODUCT' => '<img src="/images/banner/sub_visual2.jpg"/>',
'SITEPAGE' => '<img src="/images/banner/sub_visual3.jpg"/>',
'BOARD' => '<img src="/images/banner/sub_visual4.jpg"/>',
]);
define('AUDIOS', [
'Alram_GetEmail' => '<object width=0 height=0 data="/sound/jarvis_email.mp3" type="audio/mpeg"></object>',
@ -225,11 +269,12 @@ define('AUDIOS', [
//Default값 정의
define('DEFAULTS', [
'ORDER_CATEGORY' => getenv('default.order_category') ?: 11,
'USER_CATEGORY' => getenv('default.user_category') ?: 22,
'ROLE' => getenv('default.role') ?: "guest",
'STATUS' => getenv('default.status') ?: "use",
'EMPTY' => getenv('default.empty') ?: "",
'PERPAGE' => getenv('default.perpage') ?: 20,
'HIERARCHY_GRPDEPTH' => getenv('default.hierarchy_grpdepth') ?: 20,
'DELIMITER_FILE' => getenv('default.delimiter.file') ?: "||",
'DELIMITER_ROLE' => getenv('default.delimiter.role') ?: ",",
]);

View File

@ -35,10 +35,6 @@ $routes->setAutoRoute(false);
$routes->addPlaceholder('uuid', '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}');
$routes->get('/', 'Home::index');
$routes->get('/login', 'AuthController::login');
$routes->post('/signup', 'AuthController::signup/local');
$routes->get('/signup/(:alpha)', 'AuthController::signup/$1');
$routes->get('/logout', 'AuthController::logout');
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
});
// authGuard는 App\Config\Filters.php의 $aliases에 선언한 이름이어야 함
@ -95,10 +91,16 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
});
});
$routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($routes) {
$routes->group('user', ['namespace' => 'App\Controllers\Front', 'filter' => 'authFilter:user'], static function ($routes) {
$routes->get('update/(:uuid)', 'UserController::update_form/$1');
$routes->post('update/(:uuid)', 'UserController::update/R1');
$routes->get('view/(:uuid)', 'UserController::view/$1');
$routes->group('user', static function ($routes) {
$routes->get('', 'UserController::index', ['filter' => 'authFilter:user']);
$routes->get('insert', 'UserController::insert_form');
$routes->post('insert', 'UserController::insert');
$routes->get('update/(:uuid)', 'UserController::update_form/$1', ['filter' => 'authFilter:user']);
$routes->post('update/(:uuid)', 'UserController::update/$1', ['filter' => 'authFilter:user']);
$routes->get('login', 'UserController::login_form');
$routes->post('login', 'UserController::login/local');
$routes->get('signup/(:alpha)', 'UserController::login/$1');
$routes->get('logout', 'UserController::logout', ['filter' => 'authFilter:user']);
});
$routes->group('board', static function ($routes) {
$routes->get('', 'BoardController::index');
@ -113,6 +115,9 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou
$routes->get('delete/(:num)', 'BoardController::delete/$1');
$routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2');
});
$routes->group('sitepage', static function ($routes) {
$routes->get('', 'SitepageController::index');
});
});
/*
* --------------------------------------------------------------------

View File

@ -13,6 +13,7 @@ abstract class AdminController extends BaseController
{
parent::initController($request, $response, $logger);
$this->_viewPath = 'admin/';
$this->_viewDatas['control'] = 'admin';
$this->_viewDatas['layout'] = LAYOUTS['admin'];
}
}

View File

@ -2,20 +2,25 @@
namespace App\Controllers\Admin;
use App\Controllers\Trait\UpDownloadTrait;
use App\Models\BoardModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Controllers\Trait\UpDownloadTrait;
class BoardController extends AdminController
{
use UpDownloadTrait;
private $_category_notice = 3;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
$this->_model = new BoardModel();
parent::initController($request, $response, $logger);
$this->_viewPath .= strtolower($this->_model->getClassName());
$this->_model = new BoardModel();
$this->_viewDatas['className'] = 'Board';
$this->_viewPath .= strtolower($this->_viewDatas['className']);;
$this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title');
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])];
helper($this->_viewDatas['className']);
}
public function getFields(string $action = ""): array
@ -46,12 +51,11 @@ class BoardController extends AdminController
protected function getFieldFormData(string $field, $entity = null): array
{
switch ($field) {
case 'passwd':
$this->_viewDatas['fieldDatas'][$field] = $this->request->getVar($field);
$this->_viewDatas['fieldDatas']['confirmpassword'] = $this->request->getVar('confirmpassword');
break;
case 'board_file':
$this->_viewDatas['fieldDatas'][$field] = $this->upload_file_procedure($field);
$file = $this->upload_file_procedure($field);
if (!is_null($file)) {
$this->_viewDatas['fieldDatas'][$field] = $file;
}
break;
default:
return parent::getFieldFormData($field, $entity);
@ -59,4 +63,59 @@ class BoardController extends AdminController
}
return $this->_viewDatas['fieldDatas'];
}
private function build_notice()
{
$entitys = $this->_model->getEntitys(['category_uid' => $this->_category_notice, 'status' => DEFAULTS['STATUS']]);
$temps = array("<ul>");
foreach ($entitys as $entity) {
array_push($temps, sprintf(
"<li><a href=\"/front/board/view/%s?category=3\">%s</a><span>%s</span></li>",
$entity->getPrimaryKey(),
$entity->getTitle(),
$entity->created_at ? str_split($entity->created_at, 10)[0] : "",
));
}
array_push($temps, "</ul>");
// echo var_export($temps, true);
// exit;
file_put_contents(APPPATH . 'Views' . "/layouts/main/board.php", implode("\n", $temps));
}
//Insert관련
protected function insert_process()
{
$entity = parent::insert_process();
if ($entity->category_uid == $this->_category_notice) {
$this->build_notice();
}
return $entity;
}
//Update관련
protected function update_process($entity)
{
$entity = parent::update_process($entity);
if ($entity->category_uid == $this->_category_notice) {
$this->build_notice();
}
return $entity;
}
//Toggle관련
protected function toggle_process($entity)
{
$entity = parent::toggle_process($entity);
if ($entity->category_uid == $this->_category_notice) {
$this->build_notice();
}
return $entity;
}
//Delete 관련
protected function delete_process($entity)
{
$entity = parent::delete_process($entity);
if ($entity->category_uid->$this->_category_notice) {
$this->build_notice();
}
return $entity;
}
}

View File

@ -2,6 +2,8 @@
namespace App\Controllers\Admin;
use App\Controllers\Trait\UpDownloadTrait;
use App\Entities\CategoryEntity;
use App\Models\CategoryModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
@ -9,24 +11,29 @@ use Psr\Log\LoggerInterface;
class CategoryController extends AdminController
{
use UpDownloadTrait;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
$this->_model = new CategoryModel();
parent::initController($request, $response, $logger);
$this->_viewPath .= strtolower($this->_model->getClassName());
$this->_model = new CategoryModel();
$this->_viewDatas['className'] = 'Category';
$this->_viewPath .= strtolower($this->_viewDatas['className']);
$this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title');
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])];
helper($this->_viewDatas['className']);
}
public function getFields(string $action = ""): array
{
$fields = [
'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
'name', "linkurl", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
"status", "head", "tail",
];
switch ($action) {
case "index":
case "excel":
return [
'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
'name', "linkurl", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
"status", "created_at"
];
break;
@ -47,39 +54,67 @@ class CategoryController extends AdminController
return parent::getFieldBatchFilters();
}
// private function build_leftmenu()
// {
// $categorys = $this->_model->getEntitys(['status' => DEFAULTS['STATUS']]);
// $leftmenu = view($this->_viewPath . '/leftmenu', ['categorys' => $categorys]);
// file_put_contents(APPPATH . 'Views' . '/layouts/front/left_menu/leftmenu.php', $leftmenu);
// }
private function write_leftmenu($old_category, array $categorys)
{
//신규 대분류인경우 기존 카테고리 메뉴 만들기
// $categorys = array_reverse($categorys); //중분류의 경우 나중에 넣은것이 먼저되므로 reverse해서 처리
foreach ($categorys as $category) {
$viewDatas = [
'className' => $this->_viewDatas['className'],
'category' => $category,
'parent_category' => $old_category,
'sibling_categorys' => $categorys
];
$leftmenu = view($this->_viewPath . '/leftmenu_template', ['viewDatas' => $viewDatas]);
file_put_contents(APPPATH . 'Views' . "/layouts/front/left_menu/leftmenu_{$category->getPrimaryKey()}.php", $leftmenu);
}
}
private function build_leftmenu()
{
$old_category = null;
$categorys = array();
foreach ($this->_model->getEntitys(['status' => DEFAULTS['STATUS']]) as $entity) {
if ($entity->getHierarchy_Depth() == 1) {
if (is_null($old_category)) {
$old_category = $entity;
} else if ($old_category->getPrimaryKey() != $entity->getPrimaryKey()) {
$this->write_leftmenu($old_category, $categorys);
$old_category = $entity;
$categorys = array();
}
} else {
array_push($categorys, $entity);
}
}
$this->write_leftmenu($old_category, $categorys);
}
// //Insert관련
// protected function insert_process()
// {
// $entity = parent::insert_process();
// $this->build_leftmenu();
// return $entity;
// }
// //Update관련
// protected function update_process($entity)
// {
// $entity = parent::update_process($entity);
// $this->build_leftmenu();
// return $entity;
// }
// //Reply관련
// protected function reply_process($entity)
// {
// $entity = parent::reply_process($entity);
// $this->build_leftmenu();
// return $entity;
// }
// //Delete 관련
// protected function delete_process($entity)
// {
// $entity = parent::delete_process($entity);
// $this->build_leftmenu();
// return $entity;
// }
//Insert관련
protected function insert_process()
{
$entity = parent::insert_process();
$this->build_leftmenu();
return $entity;
}
//Update관련
protected function update_process($entity)
{
$entity = parent::update_process($entity);
$this->build_leftmenu();
return $entity;
}
//Reply관련
protected function reply_process($entity)
{
$entity = parent::reply_process($entity);
$this->build_leftmenu();
return $entity;
}
//Delete 관련
protected function delete_process($entity)
{
$entity = parent::delete_process($entity);
$this->build_leftmenu();
return $entity;
}
}

View File

@ -9,12 +9,36 @@ use Psr\Log\LoggerInterface;
class Home extends Controller
{
private $_session = null;
private $_viewDatas = array();
private $_viewPath = "admin/";
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_viewDatas['control'] = 'admin';
$this->_viewDatas['title'] = '쇼핑몰관리툴페이지';
$this->_viewDatas['layout'] = LAYOUTS['admin'];
$this->_session = \Config\Services::session();
$this->_viewDatas['session'] = $this->_session;
$this->_viewDatas['className'] = 'MAIN';
$this->_viewDatas['class_icon'] = CLASS_ICONS['USER'];
helper("Common");
// echo var_export($this->_viewDatas['layout'], true);
// exit;
//사용자 기본 Role 지정
$this->_viewDatas[SESSION_NAMES['ISLOGIN']] = false;
$this->_viewDatas['currentRoles'] = [DEFAULTS["ROLE"]];
if ($this->_session->get(SESSION_NAMES['ISLOGIN'])) {
$this->_viewDatas[SESSION_NAMES['ISLOGIN']] = true;
$this->_viewDatas['auth'] = $this->_session->get(SESSION_NAMES['AUTH']);
$currentRoles = explode(DEFAULTS['DELIMITER_ROLE'], $this->_viewDatas['auth'][AUTH_FIELDS['ROLE']]);
$this->_viewDatas['currentRoles'] = is_array($currentRoles) ? $currentRoles : [DEFAULTS["ROLE"]];
}
}
public function index()
{
return view('admin/welcome_message');
return view($this->_viewPath . 'welcome_message', ['viewDatas' => $this->_viewDatas]);
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace App\Controllers\Admin;
use App\Models\SitepageModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class SitepageController extends AdminController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_model = new SitepageModel();
$this->_viewDatas['className'] = 'Sitepage';
$this->_viewPath .= strtolower($this->_viewDatas['className']);
$this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title');
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])];
helper($this->_viewDatas['className']);
}
public function getFields(string $action = ""): array
{
$fields = ["category_uid", 'title', "status", "content"];
switch ($action) {
case "index":
case "excel":
return ["category_uid", "user_uid", 'title', "status", "created_at"];
break;
case "view":
return ["category_uid", "user_uid", 'title', "status", "created_at", "content"];
break;
default:
return $fields;
break;
}
}
public function getFieldFilters(): array
{
return ["category_uid", "user_uid", "status"];
}
public function getFieldBatchFilters(): array
{
return parent::getFieldBatchFilters();
}
}

View File

@ -11,43 +11,32 @@ class UserController extends AdminController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
$this->_model = new UserModel();
parent::initController($request, $response, $logger);
$this->_viewPath .= strtolower($this->_model->getClassName());
$this->_model = new UserModel();
$this->_viewDatas['className'] = 'User';
$this->_viewPath .= strtolower($this->_viewDatas['className']);
$this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title');
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])];
helper($this->_viewDatas['className']);
}
//Field별 Form Datas 처리용
protected function getFieldFormData(string $field, $entity = null): array
{
switch ($field) {
case 'passwd':
$passwd = $this->request->getVar($field) ?: false;
$confirmpassword = $this->request->getVar('confirmpassword') ?: false;
if ($passwd && $confirmpassword) {
$this->_viewDatas['fieldDatas'][$field] = $passwd;
$this->_viewDatas['fieldDatas']['confirmpassword'] = $confirmpassword;
}
break;
default:
return parent::getFieldFormData($field, $entity);
break;
}
return $this->_viewDatas['fieldDatas'];
}
public function getFields(string $action = ""): array
{
$fields = ["id", "passwd", 'name', "email", "role", "status"];
switch ($action) {
case 'insert':
return ["id", "passwd", 'name', "email", "phone", "mobile", "role", "status"];
break;
case 'update':
return ["passwd", 'name', "email", "phone", "mobile", "role", "status"];
break;
case "index":
case "excel":
return ["id", 'name', "email", "role", "status", 'created_at'];
return ["id", 'name', "email", "phone", "mobile", "role", "status", 'created_at'];
break;
case "view":
return ["id", 'name', "email", "role", "status", 'updated_at', 'created_at'];
return ["id", 'name', "email", "phone", "mobile", "role", "status", 'updated_at', 'created_at'];
break;
default:
return $fields;
return [];
break;
}
}

View File

@ -11,9 +11,13 @@ class UserSNSController extends AdminController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
$this->_model = new UserSNSModel();
parent::initController($request, $response, $logger);
$this->_viewPath .= strtolower($this->_model->getClassName());
$this->_model = new UserSNSModel();
$this->_viewDatas['className'] = 'UserSNS';
$this->_viewPath .= strtolower($this->_viewDatas['className']);
$this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title');
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])];
helper($this->_viewDatas['className']);
}
public function getFields(string $action = ""): array
{

View File

@ -58,13 +58,7 @@ abstract class BaseController extends Controller
// Preload any models, libraries, etc, here.
// E.g.: $this->session = \Config\Services::session();
$this->_session = \Config\Services::session();
$this->_viewDatas['layout'] = LAYOUTS['empty'];
$this->_viewDatas['session'] = $this->_session;
$this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title');
$this->_viewDatas['className'] = $this->_model->getClassName();
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_model->getClassName())];
helper($this->_model->getClassName());
//사용자 기본 Role 지정
$this->_viewDatas[SESSION_NAMES['ISLOGIN']] = false;
$this->_viewDatas['currentRoles'] = [DEFAULTS["ROLE"]];
@ -78,16 +72,61 @@ abstract class BaseController extends Controller
abstract public function getFields(string $action): array;
abstract public function getFieldFilters(): array;
//Field별 Rule용
protected function getFieldRule(string $field, array $rules, string $action = ""): array
{
switch ($field) {
default:
$rules = $this->_model->getFieldRule($field, $rules, $action);
break;
}
return $rules;
}
final public function getFieldRules(array $fields, string $action = ""): array
{
$rules = array();
foreach ($fields as $field) {
$rules = $this->getFieldRule($field, $rules, $action);
}
return $rules;
}
public function getFieldBatchFilters(): array
{
return $this->getFieldFilters();
}
//Field별 Form Option용
public function getFieldFormOption(string $field): array
{
switch ($field) {
default:
$options = $this->_model->getFieldFOrmOption($field);
break;
}
if (!is_array($options)) {
throw new \Exception(__FUNCTION__ . "에서 {$this->_viewDatas['className']}의 Field:{$field}의 FormOptionData가 array가 아닙니다.\n" . var_export($options, true));
}
return $options;
}
final public function getFieldFormOptions(array $fields): array
{
$fieldFormOptions = array();
foreach ($fields as $field) {
if (!is_string($field)) {
throw new \Exception(__FUNCTION__ . "에서 {$this->_viewDatas['className']}의 Field:{$field}가 string 아닙니다.\n" . var_export($fields, true));
}
$fieldFormOptions[$field] = $this->getFieldFormOption($field);
}
return $fieldFormOptions;
}
//Field별 Form Datas 처리용
protected function getFieldFormData(string $field, $entity = null): array
{
switch ($field) {
default:
$this->_viewDatas['fieldDatas'][$field] = $this->request->getVar($field);
$value = $this->request->getVar($field);
if (!is_null($value)) {
$this->_viewDatas['fieldDatas'][$field] = $value;
}
break;
}
return $this->_viewDatas['fieldDatas'];
@ -105,10 +144,10 @@ abstract class BaseController extends Controller
break;
}
$this->_viewDatas['fields'] = $fields ?: $this->getFields($action);
$this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], $action);
$this->_viewDatas['fieldRules'] = $this->getFieldRules($this->_viewDatas['fields'], $action);
$this->_viewDatas['fieldFilters'] = $this->getFieldFilters();
$this->_viewDatas['batchjobFilters'] = $this->getFieldBatchFilters();
$this->_viewDatas['fieldFormOptions'] = $this->_model->getFieldFormOptions($this->_viewDatas['fieldFilters']);
$this->_viewDatas['fieldFormOptions'] = $this->getFieldFormOptions($this->_viewDatas['fieldFilters']);
return $this->_viewDatas;
}
@ -206,11 +245,17 @@ abstract class BaseController extends Controller
$this->_viewDatas['fieldDatas'] = array();
foreach ($this->_viewDatas['fields'] as $field) {
$this->_viewDatas['fieldDatas'] = $this->getFieldFormData($field, $entity);
//보안문제,사용자정보의 update시 암호를 변경하지 않느경우를 위해
if ($field != 'passwd') {
}
//변견된 데이터 Log로 남기기
foreach ($this->_viewDatas['fieldDatas'] as $field => $value) {
if ($field != "passwd") { //보안위험성이 있으므로 passwd는 Log에 남기지 않는다.
log_message(
"info",
"{$field} : {$entity->$field} => " . var_export($this->_viewDatas['fieldDatas'][$field])
sprintf(
"{$field} 변경: ---원본--\n%s\n---변경---\n%s",
$entity->$field,
var_export($value, true)
)
);
}
}
@ -263,7 +308,14 @@ abstract class BaseController extends Controller
}
protected function reply_validate($entity)
{
$this->update_validate($entity);
if (!$this->validate($this->_viewDatas['fieldRules'])) {
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
}
//fieldData 적용
$this->_viewDatas['fieldDatas'] = array();
foreach ($this->_viewDatas['fields'] as $field) {
$this->_viewDatas['fieldDatas'] = $this->getFieldFormData($field, $entity);
}
}
protected function reply_process($entity)
{
@ -292,11 +344,18 @@ abstract class BaseController extends Controller
//Toggle 관련
protected function toggle_validate($entity)
{
$this->update_validate($entity);
if (!$this->validate($this->_viewDatas['fieldRules'])) {
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
}
//fieldData 적용
$this->_viewDatas['fieldDatas'] = array();
foreach ($this->_viewDatas['fields'] as $field) {
$this->_viewDatas['fieldDatas'] = $this->getFieldFormData($field, $entity);
}
}
protected function toggle_process($entity)
{
return $this->update_process($entity);
return $this->_model->modify($entity, $this->_viewDatas['fieldDatas']);
}
public function toggle($uid, string $field)
{
@ -319,21 +378,29 @@ abstract class BaseController extends Controller
//Batchjob 관련
protected function batchjob_validate($entity)
{
$this->update_validate($entity);
if (!$this->validate($this->_viewDatas['fieldRules'])) {
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
}
//fieldData 적용
$this->_viewDatas['fieldDatas'] = array();
foreach ($this->_viewDatas['fields'] as $field) {
$this->_viewDatas['fieldDatas'] = $this->getFieldFormData($field, $entity);
}
}
protected function batchjob_process($entity)
{
return $this->update_process($entity);
return $this->_model->modify($entity, $this->_viewDatas['fieldDatas']);
}
public function batchjob()
{
$msg = "";
$uids = array();
$entitys = array();
$batchjobs = array();
try {
//fields 해당하는 field중 선택된 값이 있는경우만 fields로 정의
$fields = array();
foreach ($this->_model->getFieldBatchFilters() as $field) {
foreach ($this->getFieldBatchFilters() as $field) {
if ($this->request->getVar($field)) {
array_push($fields, $field);
}
@ -377,6 +444,7 @@ abstract class BaseController extends Controller
count($entitys),
count($uids) - count($entitys),
__FUNCTION__,
$e->getMessage()
);
log_message("error", $e->getMessage());
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
@ -449,7 +517,7 @@ abstract class BaseController extends Controller
$this->_viewDatas['word'] = $this->request->getVar('word') ?: '';
$this->_viewDatas['start'] = $this->request->getVar('start') ?: '';
$this->_viewDatas['end'] = $this->request->getVar('end') ?: '';
$this->_viewDatas['order_field'] = $this->request->getVar('order_field') ?: 'uid';
$this->_viewDatas['order_field'] = $this->request->getVar('order_field') ?: 'created_at';
$this->_viewDatas['order_value'] = $this->request->getVar('order_value') ?: 'DESC';
$this->_model->setCondition(
$filterFields,
@ -515,6 +583,7 @@ abstract class BaseController extends Controller
//모델 처리
$this->_viewDatas['entitys'] = $this->index_getEntitys();
// echo $this->_model->getLastQuery();
// exit;
// log_message("debug", __METHOD__ . "에서 findAll 호출:" . $this->_model->getLastQuery());
//setting return_url to session flashdata
helper(['form']);
@ -535,7 +604,7 @@ abstract class BaseController extends Controller
//Header용
$column = 'A';
foreach ($viewDatas['fields'] as $field) {
$sheet->setCellValue($column++ . '1', lang($this->_model->getClassName() . '.label.' . $field));
$sheet->setCellValue($column++ . '1', lang($this->_viewDatas['className'] . '.label.' . $field));
}
//본문용
$line = 2;
@ -585,6 +654,8 @@ abstract class BaseController extends Controller
throw new \Exception("첨부파일이 확인되지 않습니다.");
}
$entity = $this->download_process($entity);
echo "TEST";
exit;
list($filename, $uploaded_filename) = explode(DEFAULTS['DELIMITER_FILE'], $entity->$field);
if (!is_file(PATHS['UPLOAD'] . "/" . $uploaded_filename)) {
throw new \Exception("파일이 확인되지 않습니다.\n" . PATHS['UPLOAD'] . "/" . $uploaded_filename);

View File

@ -11,9 +11,15 @@ class BoardController extends FrontController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
$this->_model = new BoardModel($this->getFields());
parent::initController($request, $response, $logger);
$this->_viewPath .= strtolower($this->_model->getClassName());
$this->_model = new BoardModel();
$this->_viewDatas['className'] = 'Board';
$this->_viewPath .= strtolower($this->_viewDatas['className']);
$this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title');
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])];
helper($this->_viewDatas['className']);
// echo var_export($this->_viewDatas['layout'], true);
// exit;
}
public function getFields(string $action = ""): array
{
@ -21,7 +27,7 @@ class BoardController extends FrontController
switch ($action) {
case "index":
case "excel":
return ['title', "board_file", "view_cnt", "created_at"];
return ['title', "board_file", "created_at", "view_cnt"];
break;
case "view":
return ['title', "board_file", "view_cnt", "created_at", "content"];
@ -39,19 +45,12 @@ class BoardController extends FrontController
{
return parent::getFieldBatchFilters();
}
//Field별 Form Datas 처리용
protected function getFieldFormData(string $field, $entity = null): array
//권한체크
protected function isRole($action)
{
switch ($field) {
case 'passwd':
$this->_viewDatas['fieldDatas'][$field] = $this->request->getVar($field);
$this->_viewDatas['fieldDatas']['confirmpassword'] = $this->request->getVar('confirmpassword');
break;
default:
return parent::getFieldFormData($field, $entity);
break;
}
return $this->_viewDatas['fieldDatas'];
$this->_category = $this->request->getVar('category') ?: throw new \Exception("분류를 지정하지 않으셨습니다.");
parent::isRole($action);
}
//Insert관련
@ -75,31 +74,42 @@ class BoardController extends FrontController
protected function update_form_process($entity)
{
//본인이 작성한글인지 최종확인용 정상접속이 아닌 위회해서 수정을 시도방지용
if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->getUser_Uid() == $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) {
if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->user_uid != $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) {
throw new \Exception("작성자 본인글인지 여부가 확인되지 않습니다.");
}
return parent::update_form_process($entity);
//권한체크
$this->isRole('update');
$entity = parent::update_form_process($entity);
$this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => [
'category' => $this->_category
]];
return $entity;
}
protected function update_process($entity)
{
//본인이 작성한글인지 최종확인용 정상접속이 아닌 위회해서 수정을 시도방지용
if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->getUser_Uid() == $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) {
if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->user_uid != $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) {
throw new \Exception("작성자 본인글인지 여부가 확인되지 않습니다.");
}
return parent::update_process($entity);
}
//Reply관련
//Reply관련($entity는 부모의것임을 주의)
protected function reply_form_process($entity)
{
//권한체크
$this->isRole('reply', $entity);
return parent::reply_form_process($entity);
$this->isRole('reply');
$entity = parent::reply_form_process($entity);
$this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => [
'category_uid' => $entity->category_uid,
'category' => $this->_category
]];
return $entity;
}
//Delete 관련
protected function delete_process($entity)
{
//본인이 작성한글인지 최종확인용 정상접속이 아닌 위회해서 삭제 시도 방지용
if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->getUser_Uid() == $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) {
if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->user_uid == $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) {
throw new \Exception("작성자 본인글인지 여부가 확인되지 않습니다.");
}
return parent::delete_process($entity);
@ -108,17 +118,24 @@ class BoardController extends FrontController
protected function view_process($entity)
{
//권한체크
$this->isRole('view', $entity);
$this->isRole('view');
//조회수 올리기
$this->_model->addViewCount($entity);
return parent::view_process($entity);
$entity = $this->_model->addViewCount($entity);
$entity = parent::view_process($entity);
$this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => [
'category' => $this->_category
]];
return $entity;
}
//Index관련
protected function index_process()
{
//권한체크
$this->isRole('index');
return parent::index_process();
parent::index_process();
$this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => [
'category' => $this->_category
]];
}
//Category 및 Status 조건추가
protected function index_setCondition()

View File

@ -3,10 +3,10 @@
namespace App\Controllers\Front;
use App\Controllers\BaseController;
use App\Models\CategoryModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
use App\Models\CategoryModel;
abstract class FrontController extends BaseController
{
@ -15,7 +15,8 @@ abstract class FrontController extends BaseController
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_viewPath .= 'front/';
$this->_viewPath = 'front/';
$this->_viewDatas['control'] = 'front';
$this->_viewDatas['layout'] = LAYOUTS['front'];
}
@ -25,28 +26,29 @@ abstract class FrontController extends BaseController
}
//권한체크
final protected function isRole($action, $entity = null)
protected function isRole($action)
{
$this->_category = !is_null($entity) ? $entity->getCategory_Uid() : ($this->request->getVar('category') ?: throw new \Exception("범주를 지정하지 않으셨습니다."));
$this->_category ?: throw new \Exception("분류를 지정하지 않으셨습니다.");
$this->_viewDatas['category'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => $this->_category]);
$this->_viewDatas['parent_category'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => $this->_viewDatas['category']->getHierarchy_ParentUID()]);
switch ($action) {
case 'insert':
$category_field = CATEGORY_ROLE_FIELDS['WRITE'];
$category_field = getenv("category.role.{$action}") ?: 'iswrite';
break;
case 'reply':
$category_field = CATEGORY_ROLE_FIELDS['REPLY'];
$category_field = getenv("category.role.{$action}") ?: 'isreply';
break;
case 'view':
$category_field = CATEGORY_ROLE_FIELDS['READ'];
$category_field = getenv("category.role.{$action}") ?: 'isread';
break;
case 'upload':
$category_field = CATEGORY_ROLE_FIELDS['UPLOAD'];
$category_field = getenv("category.role.{$action}") ?: 'isupload';
break;
case 'download':
$category_field = CATEGORY_ROLE_FIELDS['DONWLOAD'];
$category_field = getenv("category.role.{$action}") ?: 'isdownload';
break;
default:
$category_field = CATEGORY_ROLE_FIELDS['ACCESS'];
$category_field = getenv("category.role.{$action}") ?: 'isdaccess';
break;
}
//사용자가 Category에서 해당 게시판의 해당권한이 있는지 확인
@ -55,13 +57,13 @@ abstract class FrontController extends BaseController
$this->_viewDatas['category'],
$category_field,
)) {
echo var_export($this->_viewDatas['currentRoles'], true);
echo "<HR>";
echo var_export($this->_viewDatas['category'], true);
echo "<HR>";
echo "field->", $action . ":" . $category_field;
exit;
throw new \Exception("고객님은 " . lang($this->getCategoryModel()->getClassName() . ".label." . $category_field) . "이 없습니다.");
// echo var_export($this->_viewDatas['currentRoles'], true);
// echo "<HR>";
// echo var_export($this->_viewDatas['category'], true);
// echo "<HR>";
// echo "field->", $action . ":" . $category_field;
// exit;
throw new \Exception("고객님은 " . lang("Category.label." . $category_field) . "이 없습니다.");
}
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace App\Controllers\Front;
use App\Models\SitepageModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class SitepageController extends FrontController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_model = new SitepageModel();
$this->_viewDatas['className'] = 'Sitepage';
$this->_viewPath .= strtolower($this->_viewDatas['className']);
$this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title');
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])];
helper($this->_viewDatas['className']);
}
public function getFields(string $action = ""): array
{
$fields = ["content"];
switch ($action) {
case "index":
case "excel":
return ['title', "created_at"];
break;
case "view":
return ['title', "created_at", "content"];
break;
default:
return $fields;
break;
}
}
public function getFieldFilters(): array
{
return [];
}
public function getFieldBatchFilters(): array
{
return parent::getFieldBatchFilters();
}
//권한체크
protected function isRole($action)
{
$this->_category = $this->request->getVar('category') ?: throw new \Exception("분류를 지정하지 않으셨습니다.");
parent::isRole($action);
}
//Index관련
protected function index_process()
{
//권한체크
$this->isRole('index');
return parent::index_process();
}
//Category 및 Status 조건추가
protected function index_setCondition()
{
$this->_model->where("category_uid", $this->_viewDatas['category']->getPrimaryKey());
$this->_model->where("status", DEFAULTS['STATUS']);
parent::index_setCondition();
}
}

View File

@ -2,6 +2,7 @@
namespace App\Controllers\Front;
use App\Libraries\Adapter\Auth\Auth as AuthAdapter;
use App\Models\UserModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
@ -9,11 +10,37 @@ use Psr\Log\LoggerInterface;
class UserController extends FrontController
{
private $_adapters = array();
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
$this->_model = new UserModel();
parent::initController($request, $response, $logger);
$this->_viewPath .= strtolower($this->_model->getClassName());
$this->_model = new UserModel();
$this->_viewDatas['className'] = 'User';
$this->_viewPath .= strtolower($this->_viewDatas['className']);
$this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title');
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])];
helper($this->_viewDatas['className']);
$this->initAdapters();
//Default 회원정보 Category
$this->_category = DEFAULTS['USER_CATEGORY'];
$this->isRole('index');
}
private function initAdapters()
{
foreach (array_keys(AUTH_ADAPTERS) as $adapter) {
$this->getAdapter($adapter);
}
}
private function getAdapter(string $site): AuthAdapter
{
$site = ucfirst($site);
if (!array_key_exists($site, $this->_adapters)) {
$adapterClass = sprintf("\App\Libraries\Adapter\Auth\%sAuth", $site);
$this->_adapters[$site] = new $adapterClass($site, AUTH_ADAPTERS[$site]['DEBUG']);
}
return $this->_adapters[$site];
}
//Field별 Form Datas 처리용
@ -33,50 +60,82 @@ class UserController extends FrontController
public function getFields(string $action = ""): array
{
$fields = ["id", "passwd", 'name', "email", "role", "status"];
switch ($action) {
case 'insert':
return ["id", "passwd", 'name', "email", "phone", "mobile"];
break;
case 'update':
return ["passwd", 'name', "email", "phone", "mobile"];
break;
case "index":
case "excel":
return ["id", 'name', "email", "role", "status", 'created_at'];
return ["id", 'name', "email", "phone", "mobile", 'created_at'];
break;
case "view":
return ["id", 'name', "email", "role", "status", 'updated_at', 'created_at'];
return ["id", 'name', "email", "phone", "mobile", 'updated_at', 'created_at'];
break;
default:
return $fields;
return [];
break;
}
}
public function getFieldFilters(): array
{
return ["role", "status"];
return [];
}
public function getFieldBatchFilters(): array
{
return parent::getFieldBatchFilters();
}
protected function insert_validate()
//Insert관련
protected function insert_process()
{
$rules = [];
foreach ($this->_viewDatas['fieldRules'] as $field => $rule) {
switch ($field) {
case 'role':
$rules[$field . '.*'] = $rule;
break;
default:
$rules[$field] = $rule;
break;
//Role이 반드시 있어야 하기때문에
$this->_viewDatas['fieldDatas']['role'] = DEFAULTS['ROLE'] . ',user';
return parent::insert_process();
}
//Index관련
//사용자 UID 조건추가
protected function index_setCondition()
{
$this->_model->where("uid", $this->_viewDatas['auth'][AUTH_FIELDS['ID']]);
parent::index_setCondition();
}
//추가기능
public function login_form()
{
foreach ($this->_adapters as $key => $adapter) {
$this->_viewDatas['login_buttons'][$key] = $adapter->getAuthButton();
}
$this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []];
helper(['form']);
$this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
return view($this->_viewPath . '/login' . $this->request->getVar('v') ?: '', ['viewDatas' => $this->_viewDatas]);
}
public function login(string $site)
{
try {
//각 Adapter별 인층체크 후 Session에 인증정보 설정
$this->getAdapter($site)->setFormDatas($this->request->getVar());
$this->getAdapter($site)->execute();
return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) {
$this->_session->setFlashdata('return_message', $e->getMessage());
$this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
return redirect()->back()->withInput();
}
}
//fieldData Rule 검사
if (!$this->validate($rules)) {
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
}
//fieldData 적용
$this->_viewDatas['fieldDatas'] = array();
foreach ($this->_viewDatas['fields'] as $field) {
$this->_viewDatas['fieldDatas'] = $this->getFieldFormData($field);
public function logout()
{
//로그인 여부 확인후 Session에 Login 정보 삭제
if ($this->_session->get(SESSION_NAMES['ISLOGIN'])) {
session_destroy();
}
return redirect()->route('/');
}
}

View File

@ -2,6 +2,7 @@
namespace App\Controllers;
use App\Entities\CategoryEntity;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
@ -9,12 +10,36 @@ use Psr\Log\LoggerInterface;
class Home extends Controller
{
private $_session = null;
private $_viewDatas = array();
private $_viewPath = "";
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_viewDatas['control'] = 'main';
$this->_viewDatas['title'] = '쇼핑몰페이지';
$this->_viewDatas['layout'] = LAYOUTS['main'];
$this->_session = \Config\Services::session();
$this->_viewDatas['session'] = $this->_session;
$this->_viewDatas['className'] = 'MAIN';
// echo var_export($this->_viewDatas['layout'], true);
// exit;
//사용자 기본 Role 지정
$this->_viewDatas[SESSION_NAMES['ISLOGIN']] = false;
$this->_viewDatas['currentRoles'] = [DEFAULTS["ROLE"]];
if ($this->_session->get(SESSION_NAMES['ISLOGIN'])) {
$this->_viewDatas[SESSION_NAMES['ISLOGIN']] = true;
$this->_viewDatas['auth'] = $this->_session->get(SESSION_NAMES['AUTH']);
$currentRoles = explode(DEFAULTS['DELIMITER_ROLE'], $this->_viewDatas['auth'][AUTH_FIELDS['ROLE']]);
$this->_viewDatas['currentRoles'] = is_array($currentRoles) ? $currentRoles : [DEFAULTS["ROLE"]];
}
//Default 회원정보 Category
$this->_viewDatas['category'] = new CategoryEntity(['uid' => 1]);
}
public function index()
{
return view('welcome_message');
return view($this->_viewPath . 'welcome_message', ['viewDatas' => $this->_viewDatas]);
}
}

View File

@ -7,7 +7,7 @@ use CodeIgniter\HTTP\Files\UploadedFile;
trait UpDownloadTrait
{
//Upload FIle관련
private function upDownload_file_process(UploadedFile $upfile): string
private function upDownload_file_process(UploadedFile $upfile): ?string
{
$filename = null;
$uploaded_filename = null;
@ -17,10 +17,12 @@ trait UpDownloadTrait
$upfile->move(PATHS['UPLOAD'], $uploaded_filename);
//move시 중복된파일명이 있다면 파일명이 바뀌므로 여기서 한번더 파일명 확인 필요
$uploaded_filename = $upfile->getName();
} else {
return null;
}
return $filename . DEFAULTS['DELIMITER_FILE'] . $uploaded_filename;
}
public function upload_file_procedure(string $field): string
public function upload_file_procedure(string $field): ?string
{
return $this->upload_file_process($this->request->getFile($field));
}
@ -32,7 +34,10 @@ trait UpDownloadTrait
if ($upfiles = $this->request->getFiles()) {
foreach ($upfiles[$field] as $upfile) {
if ($upfile->isValid() && !$upfile->hasMoved()) {
array_push($files, $this->upload_file_process($upfile));
$file = $this->upload_file_process($upfile);
if (!is_null($file)) {
array_push($files, $file);
}
}
}
}
@ -46,7 +51,7 @@ trait UpDownloadTrait
->resize($x, $y, true, 'height')
->save(PATHS['UPLOAD_IMAGE'] . $uploaded_filename);
}
private function upload_image_process(UploadedFile $upfile): string
private function upload_image_process(UploadedFile $upfile): ?string
{
//참고:https://www.positronx.io/codeigniter-resize-image-with-image-manipulation-tutorial/
$filename = null;
@ -60,11 +65,13 @@ trait UpDownloadTrait
$upfile->move(PATHS['UPLOAD_IMAGE'], $uploaded_filename);
//move시 중복된파일명이 있다면 파일명이 바뀌므로 여기서 한번더 파일명 확인 필요
$uploaded_filename = $upfile->getName();
} else {
return null;
}
return $filename . DEFAULTS['DELIMITER_FILE'] . $uploaded_filename;
}
public function upload_image_procedure(string $field): string
public function upload_image_procedure(string $field): ?string
{
return $this->upload_image_process($this->request->getFile($field));
}
@ -76,7 +83,10 @@ trait UpDownloadTrait
if ($upfiles = $this->request->getFiles()) {
foreach ($upfiles[$field] as $upfile) {
if ($upfile->isValid() && !$upfile->hasMoved()) {
array_push($files, $this->upload_image_process($upfile));
$file = $this->upload_image_process($upfile);
if (!is_null($file)) {
array_push($files, $file);
}
}
}
}

View File

@ -7,6 +7,8 @@ CREATE TABLE baseproject.tw_user (
passwd varchar(100) NOT NULL,
name varchar(20) NOT NULL COMMENT "사용자명",
email varchar(50) NOT NULL,
phone varchar(20) NULL COMMENT '연락처',
mobile varchar(20) NULL COMMENT '핸드폰',
role varchar(255) NOT NULL DEFAULT 'user' COMMENT '사용자등급',
status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 사용,unuse: 사용않함',
updated_at timestamp NULL DEFAULT NULL,
@ -50,7 +52,9 @@ CREATE TABLE baseproject.tw_category (
grpno int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group번호: 상위가없을시 기본 uid와 같음,항상 숫자여야함',
grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작',
grpdepth int(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group깊이: 상위가없을시 1부터시작 , 상위 grpdepth+1씩 추가필요',
name varchar(255) NOT NULL COMMENT '범주명',
parent_uid int(10) UNSIGNED NULL COMMENT '부모UID',
name varchar(255) NOT NULL COMMENT '분류명',
linkurl varchar(100) NOT NULL DEFAULT '/front/board' COMMENT 'Front Link URL',
isaccess varchar(30) NOT NULL DEFAULT 'guest' COMMENT '접근권한',
isread varchar(30) NOT NULL DEFAULT 'guest' COMMENT '읽기권한',
iswrite varchar(30) NOT NULL DEFAULT 'guest' COMMENT '쓰기권한',
@ -64,7 +68,7 @@ CREATE TABLE baseproject.tw_category (
created_at timestamp NOT NULL DEFAULT current_timestamp(),
deleted_at timestamp NULL DEFAULT NULL,
PRIMARY KEY (uid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='범주';
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='분류';
DROP TABLE IF EXISTS baseproject.tw_board;
-- 1. 게시물 추가전 grpno에 해당하는 max(grporder)+1씩증가 작업
@ -78,7 +82,8 @@ CREATE TABLE baseproject.tw_board (
grpno int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group번호: 상위가없을시 기본 uid와 같음,항상 숫자여야함',
grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작',
grpdepth int(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group깊이: 상위가없을시 1부터시작 , 상위 grpdepth+1씩 추가필요',
category_uid int(10) UNSIGNED NOT NULL COMMENT '범주 UID',
parent_uid int(10) UNSIGNED NULL COMMENT '부모UID',
category_uid int(10) UNSIGNED NOT NULL COMMENT '분류 UID',
user_uid varchar(36) NULL COMMENT '작성자 정보',
title varchar(255) NOT NULL COMMENT '제목',
content text NOT NULL COMMENT '내용',
@ -93,3 +98,19 @@ CREATE TABLE baseproject.tw_board (
CONSTRAINT FOREIGN KEY (category_uid) REFERENCES tw_category (uid),
CONSTRAINT FOREIGN KEY (user_uid) REFERENCES tw_user (uid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='게시물 정보';
DROP TABLE IF EXISTS baseproject.tw_sitepage;
CREATE TABLE baseproject.tw_sitepage (
uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
category_uid int(10) UNSIGNED NOT NULL COMMENT '분류 UID',
user_uid varchar(36) NULL COMMENT '작성자 정보',
title varchar(255) NOT NULL COMMENT '제목',
content text NOT NULL COMMENT '내용',
status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 사용, unuse: 사용않함 등등',
updated_at timestamp NULL DEFAULT NULL,
created_at timestamp NOT NULL DEFAULT current_timestamp(),
deleted_at timestamp NULL DEFAULT NULL,
PRIMARY KEY (uid),
CONSTRAINT FOREIGN KEY (category_uid) REFERENCES tw_category (uid),
CONSTRAINT FOREIGN KEY (user_uid) REFERENCES tw_user (uid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='사이트페이지 정보';

View File

@ -7,6 +7,8 @@ CREATE TABLE servermgr.tw_user (
passwd varchar(100) NOT NULL,
name varchar(20) NOT NULL COMMENT "사용자명",
email varchar(50) NOT NULL,
phone varchar(20) NULL COMMENT '연락처',
mobile varchar(20) NULL COMMENT '핸드폰',
role varchar(255) NOT NULL DEFAULT 'user' COMMENT '사용자등급',
status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 사용,unuse: 사용않함',
updated_at timestamp NULL DEFAULT NULL,
@ -50,7 +52,9 @@ CREATE TABLE servermgr.tw_category (
grpno int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group번호: 상위가없을시 기본 uid와 같음,항상 숫자여야함',
grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작',
grpdepth int(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group깊이: 상위가없을시 1부터시작 , 상위 grpdepth+1씩 추가필요',
name varchar(255) NOT NULL COMMENT '범주명',
parent_uid int(10) UNSIGNED NULL COMMENT '부모UID',
name varchar(255) NOT NULL COMMENT '분류명',
linkurl varchar(100) NOT NULL DEFAULT '/front/board' COMMENT 'Front Link URL',
isaccess varchar(30) NOT NULL DEFAULT 'guest' COMMENT '접근권한',
isread varchar(30) NOT NULL DEFAULT 'guest' COMMENT '읽기권한',
iswrite varchar(30) NOT NULL DEFAULT 'guest' COMMENT '쓰기권한',
@ -64,7 +68,7 @@ CREATE TABLE servermgr.tw_category (
created_at timestamp NOT NULL DEFAULT current_timestamp(),
deleted_at timestamp NULL DEFAULT NULL,
PRIMARY KEY (uid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='범주';
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='분류';
DROP TABLE IF EXISTS servermgr.tw_board;
-- 1. 게시물 추가전 grpno에 해당하는 max(grporder)+1씩증가 작업
@ -78,7 +82,8 @@ CREATE TABLE servermgr.tw_board (
grpno int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group번호: 상위가없을시 기본 uid와 같음,항상 숫자여야함',
grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작',
grpdepth int(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group깊이: 상위가없을시 1부터시작 , 상위 grpdepth+1씩 추가필요',
category_uid int(10) UNSIGNED NOT NULL COMMENT '범주 UID',
parent_uid int(10) UNSIGNED NULL COMMENT '부모UID',
category_uid int(10) UNSIGNED NOT NULL COMMENT '분류 UID',
user_uid varchar(36) NULL COMMENT '작성자 정보',
title varchar(255) NOT NULL COMMENT '제목',
content text NOT NULL COMMENT '내용',
@ -94,6 +99,22 @@ CREATE TABLE servermgr.tw_board (
CONSTRAINT FOREIGN KEY (user_uid) REFERENCES tw_user (uid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='게시물 정보';
DROP TABLE IF EXISTS servermgr.tw_sitepage;
CREATE TABLE servermgr.tw_sitepage (
uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
category_uid int(10) UNSIGNED NOT NULL COMMENT '분류 UID',
user_uid varchar(36) NULL COMMENT '작성자 정보',
title varchar(255) NOT NULL COMMENT '제목',
content text NOT NULL COMMENT '내용',
status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 사용, unuse: 사용않함 등등',
updated_at timestamp NULL DEFAULT NULL,
created_at timestamp NOT NULL DEFAULT current_timestamp(),
deleted_at timestamp NULL DEFAULT NULL,
PRIMARY KEY (uid),
CONSTRAINT FOREIGN KEY (category_uid) REFERENCES tw_category (uid),
CONSTRAINT FOREIGN KEY (user_uid) REFERENCES tw_user (uid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='사이트페이지 정보';
DROP TABLE IF EXISTS servermgr.tw_hpilo;
CREATE TABLE

View File

@ -6,6 +6,14 @@ use CodeIgniter\Entity\Entity;
abstract class BaseEntity extends Entity
{
abstract public function getPrimaryKey();
abstract public function getTitle(): string;
final public function getPrimaryKey()
{
return $this->attributes['uid'];
}
//조화수관련 Field전용
final public function getViews($field = 'view_cnt')
{
return $this->attributes[$field];
}
}

View File

@ -16,4 +16,8 @@ abstract class BaseHierarchyEntity extends BaseEntity
{
return $this->attributes['grpdepth'];
}
final public function getHierarchy_ParentUID()
{
return $this->attributes['parent_uid'];
}
}

View File

@ -9,42 +9,26 @@ class BoardEntity extends BaseHierarchyEntity
protected $casts = [];
//기본기능
public function getPrimaryKey()
{
return $this->attributes['uid'];
}
public function getTitle(): string
{
return $this->attributes['title'];
}
public function getStatus(): string
{
return $this->attributes['status'];
}
//추가기능
public function getCategory_Uid()
{
return $this->attributes['category_uid'];
}
public function getUser_Uid()
{
return $this->attributes['user_uid'];
}
public function getPassword()
{
return $this->attributes['passwd'];
}
public function getViews()
//파일관련 Field전용
final public function getFileDownload($url, $field = "upload_file")
{
return $this->attributes['view_cnt'];
if (is_null($this->attributes[$field])) {
return "";
}
public function getBoardFile()
{
return $this->attributes['board_file'];
}
public function getBoardFileName()
{
return explode(DEFAULTS['DELIMITER_FILE'], $this->getBoardFile())[1];
$files = explode(DEFAULTS['DELIMITER_FILE'], $this->attributes[$field]);
return anchor(
$url,
ICONS['IMAGE_FILE'] . $files[0],
["target" => "_self"]
);
}
}

View File

@ -2,8 +2,6 @@
namespace App\Entities;
use App\Entities\Trait\HierarchyTrait;
class CategoryEntity extends BaseHierarchyEntity
{
protected $datamap = [];
@ -11,28 +9,12 @@ class CategoryEntity extends BaseHierarchyEntity
protected $casts = [];
//기본기능
public function getPrimaryKey()
{
return $this->attributes['uid'];
}
public function getTitle(): string
{
return $this->attributes['name'];
}
public function getStatus(): string
{
return $this->attributes['status'];
}
//추가기능
public function getHead()
{
return $this->attributes['head'];
}
public function getTail()
{
return $this->attributes['tail'];
}
//CommonHelper에서 사용
public function getRole($field = 'isaccess')
{
return array_key_exists(

View File

@ -0,0 +1,17 @@
<?php
namespace App\Entities;
class SitepageEntity extends BaseEntity
{
protected $datamap = [];
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $casts = [];
//기본기능
public function getTitle(): string
{
return $this->attributes['title'];
}
//추가기능
}

View File

@ -9,25 +9,11 @@ class UserEntity extends BaseEntity
protected $casts = [];
//기본기능
public function getPrimaryKey()
{
return $this->attributes['uid'];
}
public function getTitle(): string
{
return $this->attributes['name'];
}
public function getStatus(): string
{
return $this->attributes['status'];
}
//추가기능
public function getRole()
{
return $this->attributes['role'];
}
public function getPassword()
{
return $this->attributes['passwd'];

View File

@ -9,18 +9,9 @@ class UserSNSEntity extends BaseEntity
protected $casts = [];
//기본기능
public function getPrimaryKey()
{
return $this->attributes['uid'];
}
public function getTitle(): string
{
return $this->attributes['name'];
}
public function getStatus(): string
{
return $this->attributes['status'];
}
//추가기능
}

View File

@ -30,7 +30,7 @@ class AuthFilter implements FilterInterface
$auth = session()->get(SESSION_NAMES['AUTH']);
// 회원 ROLES이 필요ROLE($arguments[0]) 목록에 존재하지 않으면(ACL)
if (!in_array($arguments[0], explode(DEFAULTS['DELIMITER_ROLE'], $auth[AUTH_FIELDS['ROLE']]))) {
return redirect()->to('/login')->with(
return redirect()->to(URLS['LOGIN'])->with(
'return_message',
sprintf(
"%s,%s회원님은 접속에 필요한 권한[%s]이 없습니다. ",
@ -42,7 +42,7 @@ class AuthFilter implements FilterInterface
}
} else {
session()->setFlashdata(SESSION_NAMES['RETURN_URL'], $request->getUri()->getPath() . '?' . $request->getUri()->getQuery());
return redirect()->to('/login')->with('return_message', '로그인을하셔야합니다.');
return redirect()->to(URLS['LOGIN'])->with('return_message', '로그인을하셔야합니다.');
}
}

View File

@ -73,28 +73,18 @@ function getFieldView_BoardHelper($field, $entity, array $viewDatas)
}
return $value;
break;
case 'title':
case 'name':
$reply = anchor(
current_url() . '/reply/' . $entity->getPrimaryKey(),
ICONS['REPLY'],
["target" => "_self"]
);
$view = anchor(
current_url() . '/view/' . $entity->getPrimaryKey(),
$value,
["target" => "_self"]
);
return sprintf(
"<div style=\"text-align:left; padding-left:%spx\">%s %s</div>",
$entity->getHierarchy_Depth() * DEFAULTS['HIERARCHY_GRPDEPTH'],
$reply,
$view
);
break;
case 'board_file':
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]);
return $entity->getFileDownload(
base_url() .
$viewDatas['control'] .
"/board/download/{$field}/{$entity->getPrimaryKey()}" .
'?category=' . $viewDatas['category']->getPrimaryKey(),
$field
);
break;
case 'photo':
return $entity->getFileImage('middle', $field);
break;
case 'view_cnt':
return number_format(!$value ? 0 : $value);
@ -121,22 +111,79 @@ function getFieldFilter_BoardHelper($field, $value, array $viewDatas)
function getFieldIndex_Column_BoardHelper($field, array $viewDatas)
{
$label = lang("{$viewDatas['className']}.label.{$field}");
$label = $field == $viewDatas['order_field'] ? sprintf('%s <i class="fa fa-arrow-%s"></i>', $label, $viewDatas['order_value'] == 'ASC' ? "up" : "down") : $label;
if ($field == $viewDatas['order_field']) {
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS['UP'] : ICONS['DOWN'];
}
$value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
return anchor(current_url() . "?order_field={$field}&order_value={$value}", $label);
$viewDatas['uri']->addQuery('order_field', $field);
$viewDatas['uri']->addQuery('order_value', $value);
$columnData = anchor($viewDatas['uri'], $label);
switch ($field) {
case 'title':
case 'name':
return sprintf("<th class='col-4'>%s</th>", $columnData);
break;
default:
return sprintf("<th>%s</th>", $columnData);
break;
}
} //
//Front용
function getFieldIndex_Row_BoardHelper($field, $entity, array $viewDatas): string
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'title':
case 'name':
$depth = "&nbsp;";
for ($i = 1; $i < $entity->getHierarchy_Depth(); $i++) {
$depth .= "&nbsp;&nbsp;&nbsp;&nbsp;";
}
$reply = anchor(
current_url() . '/reply/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(),
ICONS['REPLY'],
["target" => "_self"]
);
$view = anchor(
current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(),
$value,
["target" => "_self"]
);
return sprintf("%s%s %s", $depth, $reply, $view);
break;
default:
return getFieldView_BoardHelper($field, $entity, $viewDatas);
break;
}
} //
//Admin용
function getFieldIndex_Row_BoardHelper_Admin($field, $entity, array $viewDatas): string
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'title':
case 'name':
$depth = "&nbsp;";
for ($i = 1; $i < $entity->getHierarchy_Depth(); $i++) {
$depth .= "&nbsp;&nbsp;&nbsp;&nbsp;";
}
$reply = anchor(
current_url() . '/reply/' . $entity->getPrimaryKey(),
ICONS['REPLY'],
["target" => "_self"]
);
$view = anchor(
current_url() . '/view/' . $entity->getPrimaryKey(),
$value,
["target" => "_self"]
);
return sprintf("%s%s %s", $depth, $reply, $view);
break;
case 'board_file':
case 'upload_file':
return $entity->getFileDownload(base_url() . $viewDatas['control'] . '/board', $field);
break;
default:
if (in_array($field, $viewDatas['fieldFilters'])) {
$attributes["onChange"] = sprintf(
@ -148,7 +195,7 @@ function getFieldIndex_Row_BoardHelper_Admin($field, $entity, array $viewDatas):
);
return getFieldForm_BoardHelper($field, $entity->$field, $viewDatas, $attributes);
}
return getFieldView_BoardHelper($field, $entity, $viewDatas);
return getFieldIndex_Row_BoardHelper($field, $entity, $viewDatas);
break;
}
} //

View File

@ -40,10 +40,15 @@ function getFieldForm_CategoryHelper($field, $value, array $viewDatas, array $at
case 'content':
case 'head':
case 'tail':
return form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']);
return form_textarea(
$field,
html_entity_decode($value),
['class' => 'editor', 'rows' => '20', 'cols' => '100']
);
break;
case 'upload_file':
case 'board_file':
case 'photo':
return form_upload($field);
break;
case 'view_cnt':
@ -67,29 +72,6 @@ function getFieldView_CategoryHelper($field, $entity, array $viewDatas)
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'title':
case 'name':
$reply = anchor(
current_url() . '/reply/' . $entity->getPrimaryKey(),
ICONS['REPLY'],
["target" => "_self"]
);
$view = anchor(
current_url() . '/view/' . $entity->getPrimaryKey(),
$value,
["target" => "_self"]
);
return sprintf(
"<div style=\"text-align:left; padding-left:%spx\">%s %s</div>",
$entity->getHierarchy_Depth() * DEFAULTS['HIERARCHY_GRPDEPTH'],
$reply,
$view
);
break;
case 'board_file':
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]);
break;
case 'view_cnt':
return number_format(!$value ? 0 : $value);
break;
@ -115,11 +97,25 @@ function getFieldFilter_CategoryHelper($field, $value, array $viewDatas)
function getFieldIndex_Column_CategoryHelper($field, array $viewDatas)
{
$label = lang("{$viewDatas['className']}.label.{$field}");
$label = $field == $viewDatas['order_field'] ? sprintf('%s <i class="fa fa-arrow-%s"></i>', $label, $viewDatas['order_value'] == 'ASC' ? "up" : "down") : $label;
if ($field == $viewDatas['order_field']) {
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS['UP'] : ICONS['DOWN'];
}
$value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
return anchor(current_url() . "?order_field={$field}&order_value={$value}", $label);
$viewDatas['uri']->addQuery('order_field', $field);
$viewDatas['uri']->addQuery('order_value', $value);
$columnData = anchor($viewDatas['uri'], $label);
switch ($field) {
case 'title':
case 'name':
return sprintf("<th class='col-2'>%s</th>", $columnData);
break;
default:
return sprintf("<th>%s</th>", $columnData);
break;
}
} //
//Front용
function getFieldIndex_Row_CategoryHelper($field, $entity, array $viewDatas): string
{
switch ($field) {
@ -128,9 +124,29 @@ function getFieldIndex_Row_CategoryHelper($field, $entity, array $viewDatas): st
break;
}
} //
//Admin용
function getFieldIndex_Row_CategoryHelper_Admin($field, $entity, array $viewDatas): string
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'title':
case 'name':
$depth = "&nbsp;";
for ($i = 1; $i < $entity->getHierarchy_Depth(); $i++) {
$depth .= "&nbsp;&nbsp;&nbsp;&nbsp;";
}
$reply = anchor(
current_url() . '/reply/' . $entity->getPrimaryKey(),
ICONS['REPLY'],
["target" => "_self"]
);
$view = anchor(
current_url() . '/view/' . $entity->getPrimaryKey(),
$value,
["target" => "_self"]
);
return sprintf("%s%s %s", $depth, $reply, $view);
break;
default:
if (in_array($field, $viewDatas['fieldFilters'])) {
$attributes["onChange"] = sprintf(
@ -142,7 +158,7 @@ function getFieldIndex_Row_CategoryHelper_Admin($field, $entity, array $viewData
);
return getFieldForm_CategoryHelper($field, $entity->$field, $viewDatas, $attributes);
}
return getFieldView_CategoryHelper($field, $entity, $viewDatas);
return getFieldIndex_Row_CategoryHelper($field, $entity, $viewDatas);
break;
}
} //

View File

@ -148,17 +148,6 @@ function alert_CommonHelper(string $msg, $url = null)
return "<script type=\"text/javascript\">{$msg}</script>";
} //
function imageSubmit_CommonHelper(string $src, array $attributes = [])
{
return form_input([
'type' => 'image',
'src' => base_url() . $src,
'name' => array_key_exists('name', $attributes) ? $attributes['name'] : "",
'value' => array_key_exists('value', $attributes) ? $attributes['value'] : "",
...$attributes,
]);
}
// STATUS가 use가 아닐때 option을 disabled되게 하기위함 (override form_dropdown)
function form_dropdown_test($data = '', $options = [], $selected = [], $extra = ''): string
{

View File

@ -0,0 +1,161 @@
<?php
function getFieldLabel_SitepageHelper($field, array $viewDatas): string
{
$attributes = [];
switch ($field) {
default:
if (strpos($viewDatas['fieldRules'][$field], 'required') !== false) {
$attributes = ['style="color:red";'];
}
return sprintf("<span %s>%s</span>", implode(" ", $attributes), lang("{$viewDatas['className']}.label.{$field}"));
break;
}
}
//header.php에서 getFieldForm_Helper사용
function getFieldForm_SitepageHelper($field, $value, array $viewDatas, array $attributes = array())
{
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
case "category_uid":
case "user_uid":
$viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]];
return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, [...$attributes, 'class' => "select-field"]);
break;
case 'title':
case 'name':
return form_input($field, $value, ["placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]);
break;
case 'passwd':
return sprintf(
"%s %s %s",
form_password($field, DEFAULTS['EMPTY']),
lang("{$viewDatas['className']}.label.confirmpassword"),
form_password('confirmpassword', DEFAULTS['EMPTY']),
);
break;
case 'content':
case 'head':
case 'tail':
return form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']);
break;
case 'upload_file':
case 'board_file':
return form_upload($field);
break;
case 'view_cnt':
return form_input($field, $value, ['type' => 'number']);
break;
case "status":
$viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]];
return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, $attributes);
break;
case 'updated_at':
case 'created_at':
return form_input($field, $value, ['class' => 'calender']);
break;
default:
return form_input($field, $value);
break;
}
} //
function getFieldView_SitepageHelper($field, $entity, array $viewDatas)
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'category_uid':
foreach (array_values($viewDatas['fieldFormOptions'][$field]) as $category_2depths) {
foreach ($category_2depths as $key => $label) {
if ($key == $value) {
return $label;
}
}
}
return $value;
break;
case 'view_cnt':
return number_format(!$value ? 0 : $value);
break;
case 'content':
return html_entity_decode($value);
break;
case 'updated_at':
case 'created_at':
return $value ? str_split($value, 10)[0] : "";
break;
default:
return in_array($field, $viewDatas['fieldFilters']) && $value ? $viewDatas['fieldFormOptions'][$field][$value] : $value;
break;
}
} //
function getFieldFilter_SitepageHelper($field, $value, array $viewDatas)
{
$viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]];
return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, ['class' => "select-field"]);
} //
function getFieldIndex_Column_SitepageHelper($field, array $viewDatas)
{
$label = lang("{$viewDatas['className']}.label.{$field}");
if ($field == $viewDatas['order_field']) {
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS['UP'] : ICONS['DOWN'];
}
$value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
$viewDatas['uri']->addQuery('order_field', $field);
$viewDatas['uri']->addQuery('order_value', $value);
$columnData = anchor($viewDatas['uri'], $label);
switch ($field) {
case 'title':
case 'name':
return sprintf("<th class='col-4'>%s</th>", $columnData);
break;
default:
return sprintf("<th>%s</th>", $columnData);
break;
}
} //
//Front용
function getFieldIndex_Row_SitepageHelper($field, $entity, array $viewDatas): string
{
//front쪽은 table을 사용하지 않음 주의
switch ($field) {
case 'content':
return getFieldView_SitepageHelper($field, $entity, $viewDatas);
break;
default:
return getFieldView_SitepageHelper($field, $entity, $viewDatas);
break;
}
} //
//Admin용
function getFieldIndex_Row_SitepageHelper_Admin($field, $entity, array $viewDatas): string
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'title':
case 'name':
return anchor(
current_url() . '/view/' . $entity->getPrimaryKey(),
$value,
["target" => "_self"]
);
break;
default:
if (in_array($field, $viewDatas['fieldFilters'])) {
$attributes["onChange"] = sprintf(
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
current_url(),
$entity->getPrimaryKey(),
$field,
$field
);
return getFieldForm_SitepageHelper($field, $entity->$field, $viewDatas, $attributes);
}
//front쪽은 table을 사용하지 않음 주의
return getFieldIndex_Row_SitepageHelper($field, $entity, $viewDatas);
break;
}
} //

View File

@ -71,21 +71,6 @@ function getFieldView_UserSNSHelper($field, $entity, array $viewDatas)
}
return $categorys[$value];
break;
case 'title':
case 'name':
return anchor(
current_url() . '/view/' . $entity->getPrimaryKey(),
$value,
["target" => "_self"]
);
break;
case 'board_file':
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]);
break;
case 'view_cnt':
return number_format(!$value ? 0 : $value);
break;
case 'content':
return html_entity_decode($value);
break;
@ -108,19 +93,43 @@ function getFieldFilter_UserSNSHelper($field, $value, array $viewDatas)
function getFieldIndex_Column_UserSNSHelper($field, array $viewDatas)
{
$label = lang("{$viewDatas['className']}.label.{$field}");
$label = $field == $viewDatas['order_field'] ? sprintf('%s <i class="fa fa-arrow-%s"></i>', $label, $viewDatas['order_value'] == 'ASC' ? "up" : "down") : $label;
if ($field == $viewDatas['order_field']) {
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS['UP'] : ICONS['DOWN'];
}
$value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
return anchor(current_url() . "?order_field={$field}&order_value={$value}", $label);
$viewDatas['uri']->addQuery('order_field', $field);
$viewDatas['uri']->addQuery('order_value', $value);
$columnData = anchor($viewDatas['uri'], $label);
switch ($field) {
case 'title':
case 'name':
return sprintf("<th class='col-1'>%s</th>", $columnData);
break;
default:
return sprintf("<th>%s</th>", $columnData);
break;
}
} //
//Front용
function getFieldIndex_Row_UserSNSHelper($field, $entity, array $viewDatas): string
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'title':
case 'name':
return anchor(
current_url() . '/view/' . $entity->getPrimaryKey(),
$value,
["target" => "_self"]
);
break;
default:
return getFieldView_UserSNSHelper($field, $entity, $viewDatas);
break;
}
} //
//Admin용
function getFieldIndex_Row_UserSNSHelper_Admin($field, $entity, array $viewDatas): string
{
switch ($field) {
@ -135,7 +144,7 @@ function getFieldIndex_Row_UserSNSHelper_Admin($field, $entity, array $viewDatas
);
return getFieldForm_UserSNSHelper($field, $entity->$field, $viewDatas, $attributes);
}
return getFieldView_UserSNSHelper($field, $entity, $viewDatas);
return getFieldIndex_Row_UserSNSHelper($field, $entity, $viewDatas);
break;
}
} //

View File

@ -77,18 +77,6 @@ function getFieldView_UserHelper($field, $entity, array $viewDatas)
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'title':
case 'name':
return anchor(
current_url() . '/view/' . $entity->getPrimaryKey(),
$value,
["target" => "_self"]
);
break;
case 'board_file':
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]);
break;
case 'view_cnt':
return number_format(!$value ? 0 : $value);
break;
@ -114,24 +102,41 @@ function getFieldFilter_UserHelper($field, $value, array $viewDatas)
function getFieldIndex_Column_UserHelper($field, array $viewDatas)
{
$label = lang("{$viewDatas['className']}.label.{$field}");
$label = $field == $viewDatas['order_field'] ? sprintf('%s <i class="fa fa-arrow-%s"></i>', $label, $viewDatas['order_value'] == 'ASC' ? "up" : "down") : $label;
if ($field == $viewDatas['order_field']) {
$label .= $viewDatas['order_value'] == 'ASC' ? ICONS['UP'] : ICONS['DOWN'];
}
$value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
return anchor(current_url() . "?order_field={$field}&order_value={$value}", $label);
$viewDatas['uri']->addQuery('order_field', $field);
$viewDatas['uri']->addQuery('order_value', $value);
$columnData = anchor($viewDatas['uri'], $label);
switch ($field) {
case 'title':
case 'name':
return sprintf("<th class='col-2'>%s</th>", $columnData);
break;
default:
return sprintf("<th>%s</th>", $columnData);
break;
}
} //
//Front용
function getFieldIndex_Row_UserHelper($field, $entity, array $viewDatas): string
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
default:
return getFieldView_UserHelper($field, $entity, $viewDatas);
break;
}
} //
//Admin용
function getFieldIndex_Row_UserHelper_Admin($field, $entity, array $viewDatas): string
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'role':
$value = $entity->$field ?: DEFAULTS['EMPTY'];
// $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]];
// return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, [...$attributes, 'class' => "select-field"]);
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
@ -151,7 +156,7 @@ function getFieldIndex_Row_UserHelper_Admin($field, $entity, array $viewDatas):
);
return getFieldForm_UserHelper($field, $entity->$field, $viewDatas, $attributes);
}
return getFieldView_UserHelper($field, $entity, $viewDatas);
return getFieldIndex_Row_UserHelper($field, $entity, $viewDatas);
break;
}
} //

View File

@ -6,7 +6,7 @@ return [
'grpno' => "그룹번호",
'grpord' => "부모번호",
'grpdpt' => "그룸Depth",
'category_uid' => "범주",
'category_uid' => "분류",
'user_uid' => "작성자",
'title' => "제목",
'content' => "내용",

View File

@ -1,14 +1,16 @@
<?php
$roles = [
'guest' => '비회원', 'user' => '일반회원', 'vip' => 'VIP회원',
'bronze' => '일반판매자', 'silver' => '고급판매자', 'gold' => '파워리셀러',
'manager' => '관리자', 'cloudflare' => "Cloudflare관리자", 'director' => '감독자', 'master' => "마스터",
'manager' => '관리자', 'cloudflare' => "Cloudflare관리자",
'director' => '감독자', 'master' => "마스터",
];
return [
'title' => "범주 정보",
'title' => "분류 정보",
'label' => [
'uid' => "번호",
'name' => "범주제목",
'name' => "분류제목",
'linkurl' => "LinkURL",
'photo' => "이미지",
'isaccess' => "접속권한",
'isread' => "읽기권한",
'iswrite' => "쓰기권한",

View File

@ -0,0 +1,15 @@
<?php
return [
'title' => "사이트페이지 정보",
'label' => [
'uid' => "번호",
'category_uid' => "분류",
'user_uid' => "작성자",
'title' => "제목",
'content' => "내용",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일"
],
'STATUS' => ['use' => '사용', 'unuse' => '사용않함'],
];

View File

@ -1,8 +1,8 @@
<?php
$roles = [
'guest' => '비회원', 'user' => '일반회원', 'vip' => 'VIP회원',
'bronze' => '일반판매자', 'silver' => '고급판매자', 'gold' => '파워리셀러',
'manager' => '관리자', 'cloudflare' => "Cloudflare관리자", 'director' => '감독자', 'master' => "마스터",
'manager' => '관리자', 'cloudflare' => "Cloudflare관리자",
'director' => '감독자', 'master' => "마스터",
];
return [
'title' => '회원 정보',
@ -12,6 +12,8 @@ return [
'passwd' => '암호',
'confirmpassword' => '암호확인',
'email' => '메일',
'phone' => '연락처',
'mobile' => '휴대폰',
'role' => '권한',
'name' => '이름',
'status' => '상태',

View File

@ -0,0 +1,82 @@
<?php
namespace App\Libraries\Adapter\API;
use App\Libraries\Adapter\Adapter;
// 참고:https://github.com/SyntaxPhoenix/iloclient
abstract class API extends Adapter
{
private $_url = null;
private $_method = "GET";
private $_datas = array();
private $_headers = array('Content-Type: application/json; charset=utf-8');
protected $_channel = null;
protected $_serverInfo = array();
protected $_accountInfo = array();
protected $_debug = false;
protected function __construct($debug = false)
{
parent::__construct($debug);
}
abstract protected function getChannel();
abstract protected function execute_process(): object;
final public function setURL(string $url)
{
$this->_url = $url;
}
final public function getURL(): string
{
return $this->_url;
}
final public function setMethod(string $method)
{
$this->_method = $method;
}
final public function getMethod(): string
{
return $this->_method;
}
final public function setDatas(array $datas)
{
$this->_datas = $datas;
}
final public function getDatas(): array
{
return $this->_datas;
}
final public function setHeader($key, $value, $delimiter = ":")
{
array_push($this->_headers, "{$key}{$delimiter} {$value}");
}
final public function getHeaders(): array
{
return $this->_headers;
}
final public function setServerInfo($ip, $port)
{
$this->_serverInfo['ip'] = $ip;
$this->_serverInfo['port'] = $port;
}
final protected function getServerInfo($scheme = "https://", $delimeter = ":"): string
{
return $scheme . $this->_serverInfo['ip'] . $delimeter . $this->_serverInfo['port'];
}
final public function setAccountInfo($id, $password)
{
$this->_serverInfo['id'] = $id;
$this->_serverInfo['password'] = $password;
}
final protected function getAccountInfo($authType = 'basic'): array
{
//type: basic , digest
return array($this->_serverInfo['id'], $this->_serverInfo['password'], $authType);
}
final public function execute(): object
{
return $this->execute_process();
}
}

View File

@ -0,0 +1,209 @@
<?php
namespace App\Libraries\Adapter\API;
// 참고:
// https://techhub.hpe.com/eginfolib/servers/docs/HPRestfultool/iLo4/data_model_reference.html
// https://github.com/SyntaxPhoenix/iloclient
class CurlAPI extends API
{
public function __construct($debug = false)
{
parent::__construct($debug);
}
private function debugging($response)
{
if (!$this->_debug) {
return false;
}
if ($response === false) {
log_message('error', curl_error($this->getChannel()));
}
$info = curl_getinfo($this->getChannel());
log_message('debug', var_export($info, true));
log_message('debug', var_export($this->getDatas(), true));
log_message('debug', "{$info['total_time']}초, url:{$info['url']}, return:{$info['http_code']}");
switch ($info['http_code']) {
case 100:
log_message('debug', "{$info['http_code']} Continue");
break;
case 101:
log_message('debug', "{$info['http_code']} Switching Protocols");
break;
case 200:
log_message('debug', "{$info['http_code']} OK");
break;
case 201:
log_message('debug', "{$info['http_code']} Created");
break;
case 202:
log_message('debug', "{$info['http_code']} Accepted");
break;
case 203:
log_message('debug', "{$info['http_code']} Non-Authoritative Information");
break;
case 204:
log_message('debug', "{$info['http_code']} No Content");
break;
case 205:
log_message('debug', "{$info['http_code']} Reset Content");
break;
case 206:
log_message('debug', "{$info['http_code']} Partial Content");
break;
case 300:
log_message('debug', "{$info['http_code']} Multiple Choices");
break;
case 301:
log_message('debug', "{$info['http_code']} Moved Permanently");
break;
case 302:
log_message('debug', "{$info['http_code']} Found");
break;
case 303:
log_message('debug', "{$info['http_code']} See Other");
break;
case 304:
log_message('debug', "{$info['http_code']} Not Modified");
break;
case 305:
log_message('debug', "{$info['http_code']} Use Proxy");
break;
case 306:
log_message('debug', "{$info['http_code']} (Unused)");
break;
case 307:
log_message('debug', "{$info['http_code']} Temporary Redirect");
break;
case 400:
log_message('debug', "{$info['http_code']} Bad Request");
break;
case 401:
log_message('debug', "{$info['http_code']} Unauthorized");
break;
case 402:
log_message('debug', "{$info['http_code']} Payment Required");
break;
case 403:
log_message('debug', "{$info['http_code']} Forbidden");
break;
case 404:
log_message('debug', "{$info['http_code']} Not Found");
break;
case 405:
log_message('debug', "{$info['http_code']} Method Not Allowed");
break;
case 406:
log_message('debug', "{$info['http_code']} Not Acceptable");
break;
case 407:
log_message('debug', "{$info['http_code']} Proxy Authentication Required");
break;
case 408:
log_message('debug', "{$info['http_code']} Request Timeout");
break;
case 409:
log_message('debug', "{$info['http_code']} Conflict");
break;
case 410:
log_message('debug', "{$info['http_code']} Gone");
break;
case 411:
log_message('debug', "{$info['http_code']} Length Required");
break;
case 412:
log_message('debug', "{$info['http_code']} Precondition Failed");
break;
case 413:
log_message('debug', "{$info['http_code']} Request Entity Too Large");
break;
case 414:
log_message('debug', "{$info['http_code']} Request-URI Too Long");
break;
case 415:
log_message('debug', "{$info['http_code']} Unsupported Media Type");
break;
case 416:
log_message('debug', "{$info['http_code']} Requested Range Not Satisfiable");
break;
case 417:
log_message('debug', "{$info['http_code']} Expectation Failed");
break;
case 500:
log_message('debug', "{$info['http_code']} Internal Server Error");
break;
case 501:
log_message('debug', "{$info['http_code']} Not Implemented");
break;
case 502:
log_message('debug', "{$info['http_code']} Bad Gateway");
break;
case 503:
log_message('debug', "{$info['http_code']} Service Unavailable");
break;
case 504:
log_message('debug', "{$info['http_code']} Gateway Timeout");
break;
case 505:
log_message('debug', "{$info['http_code']} HTTP Version Not Supported");
break;
default:
log_message('debug', "Return Code : {$info['http_code']}");
break;
}
}
protected function getChannel()
{
if (is_null($this->_channel)) {
$this->_channel = curl_init();
}
return $this->_channel;
}
public function setSSLVerifay()
{
//SSL 확인여부용
curl_setopt($this->getChannel(), CURLOPT_SSL_VERIFYPEER, API['SSL_VERIFY']);
curl_setopt($this->getChannel(), CURLOPT_SSL_VERIFYHOST, API['SSL_VERIFY']);
}
public function setCookie()
{
//cookie값 전달용
foreach (curl_getinfo($this->getChannel(), CURLINFO_COOKIELIST) as $cookie_line) {
curl_setopt($this->getChannel(), CURLOPT_COOKIELIST, $cookie_line);
}
}
public function setAUthentication()
{
//접속인증 정보값 전달용
curl_setopt($this->getChannel(), CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($this->getChannel(), CURLOPT_USERPWD, implode(":", $this->getAccountInfo()));
}
protected function execute_process(): object
{
curl_setopt($this->getChannel(), CURLOPT_URL, $this->getServerInfo() . $this->getURL());
switch ($this->getMethod()) {
case 'POST':
curl_setopt($this->getChannel(), CURLOPT_POST, TRUE);
curl_setopt($this->getChannel(), CURLOPT_CUSTOMREQUEST, 'PATCH');
//cookie값 파일저장용
curl_setopt($this->getChannel(), CURLOPT_COOKIEJAR, API['COOKIE_FILE']);
curl_setopt($this->getChannel(), CURLOPT_COOKIEFILE, API['COOKIE_FILE']);
break;
default:
curl_setopt($this->getChannel(), CURLOPT_POST, false);
break;
}
curl_setopt($this->getChannel(), CURLOPT_POSTFIELDS, json_encode($this->getDatas(), true));
curl_setopt($this->getChannel(), CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->getChannel(), CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($this->getChannel(), CURLOPT_TIMEOUT, 20);
curl_setopt($this->getChannel(), CURLOPT_HTTPHEADER, $this->getHeaders());
$response = curl_exec($this->getChannel());
$this->debugging($response);
curl_close($this->getChannel());
if (is_null($response)) {
throw new \Exception("해당서버[{$this->getServerInfo()}]의 ILO접속 오류가 발생하였습니다.");
}
return json_decode($response);
}
}

View File

@ -0,0 +1,85 @@
<?php
namespace App\Libraries\Adapter\API;
use GuzzleHttp\Psr7;
use GuzzleHttp\Exception\ClientException;
// 참고:https://github.com/SyntaxPhoenix/iloclient
class GuzzleAPI extends API
{
private $_jar = null;
public function __construct($debug = false)
{
parent::__construct($debug);
}
private function getCookieJar(): \GuzzleHttp\Cookie\CookieJar
{
if (is_null($this->_jar)) {
$this->_jar = new \GuzzleHttp\Cookie\CookieJar();
}
return $this->_jar;
}
protected function setLocalCookie(): void
{
// dd($this->getCookieJar(), true);
foreach (['Key', 'Lang', 'Url'] as $key) {
log_message('debug', var_export($this->getCookieJar()->getCookieByName('session' . $key), true));
}
}
protected function getChannel() //Guzzle이용시
{
if (is_null($this->_channel)) {
// 참조:https://docs.guzzlephp.org/en/stable/request-options.html
// ex:)$options = [ 'base_uri' => 'http://www.foo.com/1.0/', 'timeout' => 0, 'allow_redirects' => false, 'proxy' => '192.168.16.1:10' ]
$options = [
'base_uri' => $this->getServerInfo(),
'auth' => $this->getAccountInfo(),
'verify' => API['SSL_VERIFY'],
'cookie' => API['COOKIE_FILE'],
// \GuzzleHttp\RequestOptions::ALLOW_REDIRECTS => [
// 'max' => 10, // allow at most 10 redirects.
// 'strict' => true, // use "strict" RFC compliant redirects.
// 'referer' => true, // add a Referer header
// 'track_redirects' => true,
// ],
];
$this->_channel = new \GuzzleHttp\Client($options);
}
return $this->_channel;
}
protected function execute_process(): object
{
try {
$options = array();
if ($this->_debug) {
$options['debug'] = fopen('php://stderr', 'w'); //or true
}
switch ($this->getMethod()) {
case 'POST':
$options['json'] = $this->getDatas();
break;
case 'HEAD':
break;
}
$response = $this->getChannel()->request($this->getMethod(), $this->getURL(), $options);
if ($response->getStatusCode() != 200) {
throw new \Exception(sprintf(
"오류가 발생하였습니다.\n%s\n%s",
$response->getHeaderLine('content-type'),
$response->getBody()
));
}
$this->setLocalCookie($this->getURL());
// echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
// echo $response->getBody()=>'{"id": 1420053, "name": "guzzle", ...}
return json_decode($response->getBody()->getContents());
} catch (ClientException $e) {
throw new \Exception(
Psr7\Message::toString($e->getRequest()) . "\n" .
Psr7\Message::toString($e->getResponse())
);
}
}
}

View File

@ -2,16 +2,16 @@
namespace App\Libraries\Adapter\API;
class LocalAdapter extends Adapter
class LocalAPI extends API
{
public function __construct($debug = false)
{
parent::__construct($debug);
}
protected function getClient() //Codeigniter4 Service의 curlrequest이용시
protected function getChannel() //Codeigniter4 Service의 curlrequest이용시
{
if (is_null($this->_client)) {
if (is_null($this->_channel)) {
// 참조:https://www.codeigniter.com/user_guide/libraries/curlrequest.html?highlight=curl#
// ex:)$options = [ 'baseURI' => 'http://www.foo.com/1.0/', 'timeout' => 0, 'allow_redirects' => false, 'proxy' => '192.168.16.1:10' ]
$options = [
@ -23,21 +23,21 @@ class LocalAdapter extends Adapter
if ($this->_debug) {
$options['debug'] = API['DEBUG_FILE'];
}
$this->_client = \Config\Services::curlrequest($options);
$this->_channel = \Config\Services::curlrequest($options);
}
return $this->_client;
return $this->_channel;
}
protected function requestURL(string $url, string $method, array $datas = []): object
protected function execute_process(): object
{
$options = array();
switch ($method) {
switch ($this->getMethod()) {
case 'POST':
$response = $this->getClient()->setBody($datas)->request($method, $url, $options);
$response = $this->getChannel()->setBody($this->getDatas())->request($this->getMethod(), $this->getURL(), $options);
break;
case 'HEAD':
break;
default:
$response = $this->getClient()->request($method, $url, $options);
$response = $this->getChannel()->request($this->getMethod(), $this->getURL(), $options);
break;
}
dd($response);

View File

@ -0,0 +1,15 @@
<?php
namespace App\Libraries\Adapter;
abstract class Adapter
{
protected $_debug = false;
protected $_session = null;
protected function __construct($debug = false)
{
$this->_debug = $debug;
$this->_session = \Config\Services::session();
}
abstract public function execute();
}

View File

@ -0,0 +1,82 @@
<?php
namespace App\Libraries\Adapter\Auth;
use App\Entities\UserEntity;
use App\Models\UserModel;
use App\Models\UserSNSModel;
use App\Libraries\Adapter\Adapter;
// 참고:https://github.com/SyntaxPhoenix/iloclient
abstract class Auth extends Adapter
{
private $_site = null;
private $_userModel = null;
private $_userSNSModel = null;
private $_formDatas = array();
protected function __construct(string $site, $debug = false)
{
parent::__construct($debug);
$this->_site = $site;
}
final public function getSiteName(): string
{
if (is_null($this->_site)) {
throw new \Exception("Auth Adpater Site명이 정의 되지 않았습니다.");
}
return ucfirst($this->_site);
}
abstract public function getAuthButton();
abstract protected function execute_process(): UserEntity;
final protected function getUserModel(): UserModel
{
if (is_null($this->_userModel)) {
$this->_userModel = new UserModel();
}
return $this->_userModel;
}
final protected function getUserSNSModel(): UserSNSModel
{
if (is_null($this->_userSNSModel)) {
$this->_userSNSModel = new UserSNSModel();
}
return $this->_userSNSModel;
}
final public function setFormDatas(array $formDatas)
{
$this->_formDatas = $formDatas;
}
final public function getFormDatas(): array
{
return $this->_formDatas;
}
protected function setSession_process(UserEntity $entity): UserEntity
{
$this->_session->set(SESSION_NAMES['ISLOGIN'], true);
$auths = [];
foreach (array_values(AUTH_FIELDS) as $field) {
switch ($field) {
case 'id':
$auths[$field] = $entity->getPrimaryKey();
break;
case 'title':
$auths[$field] = $entity->getTitle();
break;
case 'role':
$auths[$field] = $entity->$field;
break;
}
}
$this->_session->set(SESSION_NAMES['AUTH'], $auths);
return $entity;
}
final public function execute(): UserEntity
{
return $this->execute_process();
}
}

View File

@ -0,0 +1,131 @@
<?php
namespace App\Libraries\Adapter\Auth;
use App\Entities\UserEntity;
use App\Entities\UserSNSEntity;
class GoogleAuth extends Auth
{
private $_client = null;
public function __construct(string $site, $debug = false)
{
parent::__construct($site, $debug);
}
private function getClient(): \Google_Client
{
if (is_null($this->_client)) {
$this->_client = new \Google_Client();
$this->_client->setClientId(AUTH_ADAPTERS[$this->getSiteName()]['CLIENT_ID']);
$this->_client->setClientSecret(AUTH_ADAPTERS[$this->getSiteName()]['CLIENT_KEY']);
$this->_client->setRedirectUri(base_url() . AUTH_ADAPTERS[$this->getSiteName()]['CALLBACK_URL']);
$this->_client->addScope('email');
$this->_client->addScope('profile');
}
return $this->_client;
}
private function setAccessToken()
{
$formDatas = $this->getFormDatas();
//1. Google 로그인후 인증코드 확인
if (!isset($formDatas['code']) || !$formDatas['code']) {
throw new \Exception($this->getSiteName() . " 인증 CallBack Code가 필요합니다.");
}
//2.토큰정보 가져오기
$tokenInfo = $this->getClient()->fetchAccessTokenWithAuthCode($formDatas['code']);
if (isset($tokenInfo['error'])) {
throw new \Exception($tokenInfo['error']);
}
$token = $tokenInfo[AUTH_ADAPTERS[$this->getSiteName()]['TOKEN_NAME']];
//3. Google Service에 접근하기위해 Access Token을 설정
$this->getClient()->setAccessToken($token);
//4. Google에 로그인이 했으므로 세션에 Token값 설정
$this->_session->set(AUTH_ADAPTERS[$this->getSiteName()]['TOKEN_NAME'], $token);
}
private function getAccessToken(): ?string
{
return $this->_session->get(AUTH_ADAPTERS[$this->getSiteName()]['TOKEN_NAME']);
}
public function getAuthButton()
{
$button = "";
if (!$this->getAccessToken()) {
$button = anchor($this->getClient()->createAuthUrl(), AUTH_ADAPTERS[$this->getSiteName()]['ICON'], ["target" => "_self"]);
}
return $button;
}
protected function execute_process(): UserEntity
{
try {
//Google 접근 권한 설정.
$this->setAccessToken();
//Google 서비스 설정
$service = new \Google\Service\Oauth2($this->getClient());
$result = $service->userinfo->get();
if ($this->_debug) {
log_message("debug", var_export($result, true));
}
// throw new \Exception(__METHOD__ . "에서 데이터 처리 필요");
// DEBUG - 2023-07-13 12:54:51 --> \Google\Service\Oauth2\Userinfo::__set_state(array(
// 'internal_gapi_mappings' =>
// array (
// 'familyName' => 'family_name',
// 'givenName' => 'given_name',
// 'verifiedEmail' => 'verified_email',
// ),
// 'modelData' =>
// array (
// 'verified_email' => true,
// 'given_name' => '이름',
// 'family_name' => '성',
// ),
// 'processed' =>
// array (
// ),
// 'email' => 'twsdfsew342s@gmail.com',
// 'familyName' => '성',
// 'gender' => NULL,
// 'givenName' => '이름',
// 'hd' => NULL,
// 'id' => '103667492432234234236838324',
// 'link' => NULL,
// 'locale' => 'ko',
// 'name' => '성이름',
// 'picture' => 'https://lh3.googleusercontent.com/a/AAcHTteFSgefsdfsdRJBkJA2tBEmg4PQrvI1Ta_5IXu5=s96-c',
// 'verifiedEmail' => true,
// ))
//조건에 해당하는 이미 등록된 사용자가 있는지 검사
$snsEntity = $this->getUserSNSModel()->asObject(UserSNSEntity::class)->where(
array("site" => $this->getSiteName(), "id" => $result['id'])
)->first();
//snsEntity 없으면 신규등록
if (is_null($snsEntity)) {
$snsEntity = $this->getUserSNSModel()->create([
'site' => $this->getSiteName(),
'id' => $result['id'],
'name' => $result['name'],
'email' => $result['email'],
'detail' => json_encode($result),
'status' => 'standby'
]);
}
//상태가 use(승인완료)가 아니라면
if ($snsEntity->status !== DEFAULTS['STATUS']) {
throw new \Exception($this->getSiteName() . "{$result['email']}:{$result['name']}님은 " . lang("Admin/UserSNS.label." . $snsEntity->status) . "입니다");
}
//user_id가 연결되어있지 않았다면
if (!$snsEntity->user_id) {
throw new \Exception($this->getSiteName() . "{$result['email']}:{$result['name']}님은 아직 사용자 지정이 되지 않았습니다. ");
}
//인증된 사용자 정보를 가져온후 로그인처리
$entity = $this->getUserModel()->getEntity($snsEntity->user_id);
return $this->setSession_process($entity);;
} catch (\Exception $e) {
throw new \Exception("관리자에게 문의하시기 바랍니다.<BR>{$e->getMessage()}");
}
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Libraries\Adapter\Auth;
use App\Entities\UserEntity;
class LocalAuth extends Auth
{
public function __construct(string $site, $debug = false)
{
parent::__construct($site, $debug);
}
public function getAuthButton()
{
return "";
}
protected function execute_process(): UserEntity
{
$formDatas = $this->getFormDatas();
if (!isset($formDatas['id']) || !$formDatas['id'] || !isset($formDatas['passwd']) || !$formDatas['passwd']) {
throw new \Exception("ID 나 암호의 값이 없습니다.");
}
$entity = $this->getUserModel()->getEntity(['id' => $formDatas['id'], 'status' => DEFAULTS['STATUS']]);
if (!password_verify($formDatas['passwd'], $entity->passwd)) {
throw new \Exception("암호가 맞지않습니다.");
}
//Session에 인증정보 설정
return $this->setSession_process($entity);;
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Libraries\Adapter\Payment;
use App\Libraries\Adapter\API\CurlAPI as APIAdapter;
// 참고:
// https://techhub.hpe.com/eginfolib/servers/docs/HPRestfultool/iLo4/data_model_reference.html
// https://github.com/SyntaxPhoenix/iloclient
class CookiePayment extends Payment
{
public function __construct($debug = false)
{
parent::__construct($debug);
}
private function getToken()
{
$adapter = new APIAdapter();
$adapter->setHeader("content-type", "application/json; charset=utf-8");
/* 토큰 발행 API */
$adapter->setURL(getenv("payment.card.pay2.token_url") ?: "{TOKEN 발행 URL}");
$adapter->setDatas(array(
'pay2_id' => getenv("payment.card.pay2.id") ?: 'cookiepayments에서 발급받은 ID',
'pay2_key' => getenv("payment.card.pay2.key") ?: 'cookiepayments에서 발급받은 연동키',
));
$token = $adapter->execute();
/* 여기 까지 */
if ($token['RTN_CD'] != '0000') {
throw new \Exception("Cookipay에서 Token을 받는데 실패했습니다.");
}
return $token;
}
protected function execute_process(): object
{
$adapter = new APIAdapter();
$adapter->setHeader("content-type", "application/json; charset=utf-8");
$adapter->setHeader("ApiKey", getenv("payment.card.pay2.apikey") ?: "COOKIEPAY에서 발급받은 연동키");
$adapter->setHeader("TOKEN", $this->getToken());
$adapter->setURL(getenv("payment.card.pay2.url") ?: "{요청도메인}/keyin/payment");
$datas = $this->getDatas();
// array(
// 'API_ID' => 'COOKIEPAY에서 발급받은 가맹점연동 ID',
// 'ORDERNO' => '주문번호',
// 'PRODUCTNAME' => '상품명',
// 'AMOUNT' => '결제금액',
// 'BUYERNAME' => '고객명',
// 'BUYEREMAIL' => '고객 E-MAIL',
// 'CARDNO' => '카드번호',
// 'EXPIREDT' => '카드유효기간',
// 'PRODUCTCODE' => '상품코드',
// 'BUYERID' => '고객 ID',
// 'BUYERADDRESS' => '고객 주소',
// 'BUYERPHONE' => '고객 휴대폰번호',
// 'QUOTA' => '할부개월',
// 'ETC1' => '추가필드 1',
// 'ETC2' => '추가필드 2',
// 'ETC3' => '추가필드 3',
// 'ETC4' => '추가필드 4',
// 'ETC5' => '추가필드 5',
// )
$adapter->setDatas($datas);
return $adapter->execute();
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Libraries\Adapter\Payment;
use App\Libraries\Adapter\Adapter;
abstract class Payment extends Adapter
{
private $_datas = array();
protected function __construct($debug = false)
{
parent::__construct($debug);
}
abstract protected function execute_process(): object;
//결제용 데이터
final public function setDatas(array $datas)
{
$this->_datas = $datas;
}
final public function getDatas(): array
{
return $this->_datas;
}
final public function execute(): object
{
return $this->execute_process();
}
}

View File

@ -10,12 +10,16 @@ abstract class BaseHierarchyModel extends BaseModel
protected function __construct(string $className)
{
parent::__construct($className);
$this->allowedFields = [...$this->allowedFields, "grpno", "grporder", "grpdepth"];
$this->allowedFields = [...$this->allowedFields, "grpno", "grporder", "grpdepth", "parent_uid"];
$this->validationRules = [...$this->validationRules,];
}
abstract public function getContentField();
abstract public function reply($parent_entity, array $formDatas): BaseEntity;
protected function getFieldRule(string $field, array $rules, string $action = ""): array
public function getSiblingEntitys($entity)
{
return $this->getEntitys(['grpno' => $entity->getHierarchy_No()]);
}
public function getFieldRule(string $field, array $rules, string $action = ""): array
{
switch ($field) {
case "grpno":
@ -23,6 +27,9 @@ abstract class BaseHierarchyModel extends BaseModel
case "grpdepth":
$rules[$field] = "if_exist|numeric"; //반드시숫자여야함
break;
case "parent_uid":
$rules[$field] = "if_exist";
break;
default:
$rules = parent::getFieldRule($field, $rules, $action);
break;
@ -51,6 +58,7 @@ abstract class BaseHierarchyModel extends BaseModel
]);
$this->update();
//reply용 설정
$entity->parent_uid = $parent_entity->getPrimaryKey();
$entity->grpno = $parent_entity->grpno;
$entity->grporder = $parent_entity->grporder + 1;
$entity->grpdepth = $parent_entity->grpdepth + 1;

View File

@ -56,7 +56,7 @@ abstract class BaseModel extends Model
$this->_session = \Config\Services::session();
$this->_validation = \Config\Services::validation();
}
final public function getClassName()
final protected function getClassName()
{
return $this->_className;
}
@ -73,10 +73,11 @@ abstract class BaseModel extends Model
{
return $this->where($conditions)->findAll();
}
protected function getFieldRule(string $field, array $rules, string $action = ""): array
public function getFieldRule(string $field, array $rules, string $action = ""): array
{
switch ($field) {
case $this->primaryKey:
//수동입력인경우
if (!$this->useAutoIncrement) {
$rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]";
$rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : "";
@ -154,17 +155,17 @@ abstract class BaseModel extends Model
return $options;
}
//Field별 Form Option용
final public function getFieldFormOptions(array $fields): array
{
$fieldFormOptions = array();
foreach ($fields as $field) {
if (!is_string($field)) {
throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 Field:{$field}가 string 아닙니다.\n" . var_export($fields, true));
}
$fieldFormOptions[$field] = $this->getFieldFormOption($field);
}
return $fieldFormOptions;
}
// final public function getFieldFormOptions(array $fields): array
// {
// $fieldFormOptions = array();
// foreach ($fields as $field) {
// if (!is_string($field)) {
// throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 Field:{$field}가 string 아닙니다.\n" . var_export($fields, true));
// }
// $fieldFormOptions[$field] = $this->getFieldFormOption($field);
// }
// return $fieldFormOptions;
// }
final public function getUUID()
{
@ -184,8 +185,8 @@ abstract class BaseModel extends Model
{
switch ($field) {
case $this->primaryKey:
//primaryKey가 자동입력이 아니면
if (!$this->useAutoIncrement) {
//primaryKey가 수동입력이고 추가(Reply도 결국엔 create_process를 상용)시에만
if ($action == 'create' && !$this->useAutoIncrement) {
$pk = $this->primaryKey;
$entity->$pk = $this->getUUID();
}
@ -229,11 +230,6 @@ abstract class BaseModel extends Model
log_message("error", implode("\n", $this->errors()));
throw new \Exception(__FUNCTION__ . " 오류 발생.\n" . $this->getLastQuery() . "\n" . var_export($this->errors(), true));
}
//primaryKey가 자동입력이면
if ($this->useAutoIncrement) {
$pk = $this->primaryKey;
$entity->$pk = $this->insertID();
}
} else {
throw new \Exception(__FUNCTION__ . " 오류 발생.\n 기존정보와 동일하여 수정되지 않았습니다.");
}
@ -241,22 +237,22 @@ abstract class BaseModel extends Model
}
protected function create_process($entity, array $formDatas)
{
// echo var_export($entity);
// exit;
foreach ($this->allowedFields as $field) {
$entity = $this->changeFormData('create', $field, $formDatas, $entity);
}
// echo var_export($this->allowedFields);
// exit
return $this->save_process($entity);
$entity = $this->save_process($entity);
//primaryKey가 자동입력이면
if ($this->useAutoIncrement) {
$pk = $this->primaryKey;
$entity->$pk = $this->insertID();
}
return $entity;
}
final protected function modify_process($entity, array $formDatas)
{
foreach ($this->allowedFields as $field) {
if ($field != $this->primaryKey) {
$entity = $this->changeFormData('modify', $field, $formDatas, $entity);
}
}
$entity->updated_at = time();
return $this->save_process($entity);
}
@ -272,13 +268,9 @@ abstract class BaseModel extends Model
$this->where("created_at <=", $end);
}
}
public function setIndexOrderBy(?string $field, ?string $order)
public function setIndexOrderBy(string $field, string $order)
{
if ($this->useAutoIncrement) {
$this->orderBy($field ?: $this->primaryKey, $order ?: "DESC");
} else {
$this->orderBy($field ?: "created_at", $order ?: "DESC");
}
$this->orderBy($field, $order);
}
final public function setCondition(array $filterFields, $word, $start, $end, $order_field, $order_value)
{

View File

@ -28,7 +28,7 @@ class BoardModel extends BaseHierarchyModel
{
return 'content';
}
protected function getFieldRule(string $field, array $rules, string $action = ""): array
public function getFieldRule(string $field, array $rules, string $action = ""): array
{
switch ($field) {
case "category_uid":

View File

@ -13,7 +13,7 @@ class CategoryModel extends BaseHierarchyModel
parent::__construct('Category');
$this->allowedFields = [
...$this->allowedFields,
'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
'name', "linkurl", "photo", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
"head", "tail", "status"
];
$this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
@ -26,13 +26,16 @@ class CategoryModel extends BaseHierarchyModel
{
return 'head';
}
protected function getFieldRule(string $field, array $rules, string $action = ""): array
public function getFieldRule(string $field, array $rules, string $action = ""): array
{
switch ($field) {
case $this->getTitleField():
$rules[$field] = "required|trim|string";
$rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : "";
break;
case 'photo':
$rules[$field] = !$action ? "if_exist|string" : "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]";
break;
case "isaccess":
case "isread":
case "iswrite":
@ -55,6 +58,7 @@ class CategoryModel extends BaseHierarchyModel
{
//대분류 부분은 선택이 되지 않게 하기위해 따로 만듬 (form_dropdown의 optgroup 기능)
$old_title = "";
$options = array();
foreach ($this->getEntitys($conditions) as $entity) {
if ($entity->getHierarchy_Depth() == 1) {
$options[$entity->getTitle()] = [];

View File

@ -0,0 +1,90 @@
<?php
namespace App\Models;
use App\Entities\SitepageEntity;
class SitepageModel extends BaseModel
{
private $_category_options = null;
protected $table = "tw_sitepage";
protected $returnType = SitepageEntity::class;
public function __construct()
{
parent::__construct('Sitepage');
$this->allowedFields = [
...$this->allowedFields,
"category_uid",
"user_uid", 'title', "content",
"status"
];
$this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
}
public function getTitleField(): string
{
return 'title';
}
public function getContentField(): string
{
return 'content';
}
public function getFieldRule(string $field, array $rules, string $action = ""): array
{
switch ($field) {
case "category_uid":
$rules[$field] = "required|numeric";
break;
case $this->getTitleField():
case "content":
$rules[$field] = "required|string";
break;
default:
$rules = parent::getFieldRule($field, $rules, $action);
break;
}
return $rules;
}
//Field별 Form Option용
public function getFieldFormOption(string $field): array
{
switch ($field) {
case 'category_uid':
if (is_null($this->_category_options)) {
$categoryModel = new CategoryModel();
$this->_category_options = $categoryModel->getOptions();
}
$options = $this->_category_options;
break;
default:
return parent::getFieldFormOption($field);
break;
}
if (!is_array($options)) {
throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 Field:{$field}의 FormOptionData가 array가 아닙니다.\n" . var_export($options, true));
}
return $options;
}
public function getEntity($conditions): SitepageEntity
{
return $this->where($conditions)->first() ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true));
}
public function create(array $formDatas): SitepageEntity
{
return $this->create_process(new SitepageEntity(), $formDatas);
}
public function modify(SitepageEntity $entity, array $formDatas): SitepageEntity
{
return $this->modify_process($entity, $formDatas);
}
//Index관련
public function setIndexWordFilter(string $word)
{
if ($word !== DEFAULTS['EMPTY']) {
parent::setIndexWordFilter($word);
$this->orLike($this->getTitleField(), $word, "both");
$this->orLike("content", $word, "both"); //befor , after , both
}
}
}

View File

@ -15,7 +15,7 @@ class UserModel extends BaseModel
parent::__construct('User');
$this->allowedFields = [
...$this->allowedFields,
"id", "passwd", 'name', "email", "role", "status"
"id", "passwd", 'name', "email", "phone", "mobile", "role", "status"
];
$this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
}
@ -23,7 +23,7 @@ class UserModel extends BaseModel
{
return 'name';
}
protected function getFieldRule(string $field, array $rules, string $action = ""): array
public function getFieldRule(string $field, array $rules, string $action = ""): array
{
switch ($field) {
case "id":
@ -92,8 +92,10 @@ class UserModel extends BaseModel
//Index관련
public function setIndexWordFilter(string $word)
{
if ($word !== DEFAULTS['EMPTY']) {
parent::setIndexWordFilter($word);
$this->orLike($this->getTitleField(), $word, "both"); //befor , after , both
$this->orLike("id", $word, "both");
}
}
}

View File

@ -22,7 +22,7 @@ class UserSNSModel extends BaseModel
return 'name';
}
protected function getFieldRule(string $field, array $rules, string $action = ""): array
public function getFieldRule(string $field, array $rules, string $action = ""): array
{
switch ($field) {
case "id":

View File

@ -1,33 +1,32 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<div class="top">
<?= form_open(current_url(), array("method" => "get")) ?>
<ul class="nav">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div class="top container-fluid">
<nav class="nav">
조건검색:<?php foreach ($viewDatas['fieldFilters'] as $field) : ?><?= getFieldFilter_BoardHelper($field, $viewDatas[$field], $viewDatas) ?><?php endforeach ?>
</nav>
<?= $this->include('templates/admin/index_head') ?>
</ul>
<?= form_close() ?>
</div>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="table table-bordered table-hover table-striped">
<table class="table table-hover">
<thead>
<tr>
<th>번호</th>
<?php foreach ($viewDatas['fields'] as $field) : ?><th><?= getFieldIndex_Column_BoardHelper($field, $viewDatas) ?></th><?php endforeach ?>
<th>작업</th>
<th>#</th>
<?php foreach ($viewDatas['fields'] as $field) : ?><?= getFieldIndex_Column_BoardHelper($field, $viewDatas) ?><?php endforeach ?>
<th>@</th>
</tr>
</thead>
<tbody>
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td nowrap>
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<td nowrap><?= getFieldIndex_Row_BoardHelper_Admin($field, $entity, $viewDatas) ?></td>
<td><?= getFieldIndex_Row_BoardHelper_Admin($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td><?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
</tr>

View File

@ -1,13 +1,15 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-hover table-striped">
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_BoardHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldForm_BoardHelper($field, old($field, DEFAULTS['EMPTY']), $viewDatas) ?>
<?= getFieldForm_BoardHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
@ -15,7 +17,8 @@
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</table>
</tbody>
<?= form_close(); ?>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -1,21 +1,24 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-hover table-striped">
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_BoardHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldForm_BoardHelper($field, old($field, $viewDatas['entity']->$field ?: DEFAULTS['EMPTY']), $viewDatas) ?>
<?= getFieldForm_BoardHelper($field, $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
<td valign="bottom" colspan="2"><?= form_submit('', '답변글추가', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</table>
</tbody>
<?= form_close(); ?>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -1,21 +1,24 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-hover table-striped">
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_BoardHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldForm_BoardHelper($field, old($field, $viewDatas['entity']->$field ?: DEFAULTS['EMPTY']), $viewDatas) ?>
<?= getFieldForm_BoardHelper($field, $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
<td valign="bottom" colspan="2"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</table>
</tbody>
<?= form_close(); ?>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -1,7 +1,9 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<table class="form table table-bordered table-hover table-striped">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_BoardHelper($field, $viewDatas) ?></td>
@ -11,6 +13,7 @@
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -1,33 +1,32 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<div class="top">
<?= form_open(current_url(), array("method" => "get")) ?>
<ul class="nav">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div class="top container-fluid">
<nav class="nav">
조건검색:<?php foreach ($viewDatas['fieldFilters'] as $field) : ?><?= getFieldFilter_CategoryHelper($field, $viewDatas[$field], $viewDatas) ?><?php endforeach ?>
</nav>
<?= $this->include('templates/admin/index_head') ?>
</ul>
<?= form_close() ?>
</div>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="table table-bordered table-hover table-striped">
<table class="table table-hover">
<thead>
<tr>
<th>번호</th>
<?php foreach ($viewDatas['fields'] as $field) : ?><th><?= getFieldIndex_Column_CategoryHelper($field, $viewDatas) ?></th><?php endforeach ?>
<th>작업</th>
<th>#</th>
<?php foreach ($viewDatas['fields'] as $field) : ?><?= getFieldIndex_Column_CategoryHelper($field, $viewDatas) ?><?php endforeach ?>
<th>@</th>
</tr>
</thead>
<tbody>
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td nowrap>
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<td nowrap><?= getFieldIndex_Row_CategoryHelper_Admin($field, $entity, $viewDatas) ?></td>
<td><?= getFieldIndex_Row_CategoryHelper_Admin($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td><?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
</tr>

View File

@ -1,13 +1,15 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-hover table-striped">
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_CategoryHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldForm_CategoryHelper($field, old($field, DEFAULTS['EMPTY']), $viewDatas) ?>
<?= getFieldForm_CategoryHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
@ -15,7 +17,8 @@
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</table>
</tbody>
<?= form_close(); ?>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,14 @@
<div class="parent">
<div>-</div>
<div class="title"><?= $viewDatas['parent_category']->getTitle() ?></div>
</div>
<?php foreach ($viewDatas['sibling_categorys'] as $category) : ?>
<div class="sibling <?php if ($viewDatas['category']->getPrimaryKey() == $category->getPrimaryKey()) : ?>active<?php endif ?>">
<?= anchor(
$category->linkurl . '?category=' . $category->getPrimaryKey(),
$category->getTitle(),
["target" => "_self"]
) ?>
<span class="play"><?= ICONS['PLAY'] ?></span>
</div>
<?php endforeach ?>

View File

@ -1,21 +1,24 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-hover table-striped">
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_CategoryHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldForm_CategoryHelper($field, old($field, $viewDatas['entity']->$field ?: DEFAULTS['EMPTY']), $viewDatas) ?>
<?= getFieldForm_CategoryHelper($field, $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
<td valign="bottom" colspan="2"><?= form_submit('', '중분류추가', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</table>
</tbody>
<?= form_close(); ?>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -1,21 +1,24 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-hover table-striped">
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_CategoryHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldForm_CategoryHelper($field, old($field, $viewDatas['entity']->$field ?: DEFAULTS['EMPTY']), $viewDatas) ?>
<?= getFieldForm_CategoryHelper($field, $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
<td valign="bottom" colspan="2"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</table>
</tbody>
<?= form_close(); ?>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -1,7 +1,9 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<table class="form table table-bordered table-hover table-striped">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_CategoryHelper($field, $viewDatas) ?></td>
@ -11,6 +13,7 @@
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,48 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div class="top container-fluid">
<nav class="nav">
조건검색:<?php foreach ($viewDatas['fieldFilters'] as $field) : ?><?= getFieldFilter_SitepageHelper($field, $viewDatas[$field], $viewDatas) ?><?php endforeach ?>
</nav>
<?= $this->include('templates/admin/index_head') ?>
</div>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="table table-hover">
<thead>
<tr>
<th>#</th>
<?php foreach ($viewDatas['fields'] as $field) : ?><?= getFieldIndex_Column_SitepageHelper($field, $viewDatas) ?><?php endforeach ?>
<th>@</th>
</tr>
</thead>
<tbody>
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td nowrap>
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<td><?= getFieldIndex_Row_SitepageHelper_Admin($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td><?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
</tr>
<?php $cnt++ ?>
<?php endforeach ?>
</tbody>
</table>
<div class="bottom">
<ul class="nav justify-content-center">
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
<?php foreach ($viewDatas['batchjobFilters'] as $field) : ?><?= getFieldFilter_SitepageHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?><?php endforeach ?>
<li class="nav-item"><?= form_submit('', '일괄처리', array("class" => "btn btn-outline btn-warning")) ?></li>
<li class="nav-item"><?= anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?></li>
</ul>
<?= $viewDatas['pagination'] ?>
</div>
<?= form_close() ?>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,24 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_SitepageHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldForm_SitepageHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</tbody>
<?= form_close(); ?>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,24 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_SitepageHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldForm_SitepageHelper($field, $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</tbody>
<?= form_close(); ?>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,19 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_SitepageHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldView_SitepageHelper($field, $viewDatas['entity'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -1,39 +1,38 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<div class="top">
<?= form_open(current_url(), array("method" => "get")) ?>
<ul class="nav">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div class="top container-fluid">
<nav class="nav">
조건검색:<?php foreach ($viewDatas['fieldFilters'] as $field) : ?><?= getFieldFilter_UserHelper($field, $viewDatas[$field], $viewDatas) ?><?php endforeach ?>
</nav>
<?= $this->include('templates/admin/index_head') ?>
</ul>
<?= form_close() ?>
</div>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="table table-bordered table-hover table-striped">
<table class="table table-hover">
<thead>
<tr>
<th>번호</th>
<?php foreach ($viewDatas['fields'] as $field) : ?><th><?= getFieldIndex_Column_UserHelper($field, $viewDatas) ?></th><?php endforeach ?>
<th>작업</th>
<th>#</th>
<?php foreach ($viewDatas['fields'] as $field) : ?><?= getFieldIndex_Column_UserHelper($field, $viewDatas) ?><?php endforeach ?>
<th>@</th>
</tr>
</thead>
<tbody>
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td nowarp>
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<td nowrap><?= getFieldIndex_Row_UserHelper_Admin($field, $entity, $viewDatas) ?></td>
<td><?= getFieldIndex_Row_UserHelper_Admin($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td><?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
</tr>
</tbody>
<?php $cnt++ ?>
<?php endforeach ?>
</tbody>
</table>
<div class="bottom">
<ul class="nav justify-content-center">

View File

@ -1,13 +1,15 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-hover table-striped">
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_UserHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldForm_UserHelper($field, old($field, DEFAULTS['EMPTY']), $viewDatas) ?>
<?= getFieldForm_UserHelper($field, DEFAULTS['EMPTY'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
@ -15,7 +17,8 @@
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</table>
</tbody>
<?= form_close(); ?>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -1,21 +1,24 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-hover table-striped">
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_UserHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldForm_UserHelper($field, old($field, $viewDatas['entity']->$field ?: DEFAULTS['EMPTY']), $viewDatas) ?>
<?= getFieldForm_UserHelper($field, $viewDatas['entity']->$field ?: DEFAULTS['EMPTY'], $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
<td valign="bottom" colspan="2"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</table>
</tbody>
<?= form_close(); ?>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -1,7 +1,9 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<table class="form table table-bordered table-hover table-striped">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_UserHelper($field, $viewDatas) ?></td>
@ -11,6 +13,7 @@
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -1,39 +1,38 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<div class="top">
<?= form_open(current_url(), array("method" => "get")) ?>
<ul class="nav">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div class="top container-fluid">
<nav class="nav">
조건검색:<?php foreach ($viewDatas['fieldFilters'] as $field) : ?><?= getFieldFilter_UserSNSHelper($field, $viewDatas[$field], $viewDatas) ?><?php endforeach ?>
</nav>
<?= $this->include('templates/admin/index_head') ?>
</ul>
<?= form_close() ?>
</div>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="table table-bordered table-hover table-striped">
<table class="table table-hover">
<thead>
<tr>
<th>번호</th>
<?php foreach ($viewDatas['fields'] as $field) : ?><th><?= getFieldIndex_Column_UserSNSHelper($field, $viewDatas) ?></th><?php endforeach ?>
<th>작업</th>
<th>#</th>
<?php foreach ($viewDatas['fields'] as $field) : ?><?= getFieldIndex_Column_UserSNSHelper($field, $viewDatas) ?><?php endforeach ?>
<th>@</th>
</tr>
</thead>
<tbody>
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td nowrap>
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<td nowrap><?= getFieldIndex_Row_UserSNSHelper_Admin($field, $entity, $viewDatas) ?></td>
<td><?= getFieldIndex_Row_UserSNSHelper_Admin($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td><?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
</tr>
</tbody>
<?php $cnt++ ?>
<?php endforeach ?>
</tbody>
</table>
<div class="bottom">
<ul class="nav justify-content-center">

View File

@ -1,7 +1,9 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<div class="content">
<table class="form table table-bordered table-hover table-striped">
<link href="/css/admin/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_UserSNSHelper($field, $viewDatas) ?></td>
@ -11,6 +13,7 @@
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?= $this->endSection() ?>

View File

@ -1,91 +1,5 @@
<?= $this->extend('layouts/admin') ?>
<?= $this->section('content') ?>
<?= $this->include('templates/admin/header'); ?>
<!-- Body Content QuickInfo Start -->
<div class="row">
<!-- Body Content QuickInfo 쪽지 Start -->
<div class="col-lg-3 col-md-6">
<div class="panel panel-primary" onClick="location.href='/admin/memorecevie';" style="cursor: pointer;">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3"><i class="fa fa-comments fa-5x"></i></div>
<div class="col-xs-9 text-right">
<div class="huge" style="padding-top:30px;">
<?= ICONS['NEW'] ?>
<?= AUDIOS['Alram_GetEmail'] ?>
</div>
</div>
</div>
</div>
<div class="panel-footer">
<span class="pull-left">자세히보기</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</div>
</div>
<!-- Body Content QuickInfo 쪽지 End -->
<!-- Body Content QuickInfo 신규서버 Start -->
<div class="col-lg-3 col-md-6">
<div class="panel panel-success" onClick="location.href='/serviceList.sev';" style="cursor: pointer;">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3"><i class="fa fa-plus-square-o fa-5x"></i></div>
<div class="col-xs-9 text-right">
<div class="huge">day7_server</div>
<div>최근 7일간 신규서버 대수</div>
</div>
</div>
</div>
<div class="panel-footer">
<span class="pull-left">자세히보기</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</div>
</div>
<!-- Body Content QuickInfo 신규서버 End -->
<!-- Body Content QuickInfo 요청업무 Start -->
<div class="col-lg-3 col-md-6">
<div class="panel panel-warning">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3"><i class="fa fa-tasks fa-5x"></i></div>
<div class="col-xs-9 text-right">
<div class="huge">0</div>
<div>요청업무 알림</div>
</div>
</div>
</div>
<div class="panel-footer">
<span class="pull-left">자세히보기</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</div>
</div>
<!-- Body Content QuickInfo 요청업무 End -->
<!-- Body Content QuickInfo 금일지군 미납서버 Start -->
<div class="col-lg-3 col-md-6">
<div class="panel panel-danger" onClick="location.href='/IdcDepositNonPaymentListMK.dep';" style="cursor: pointer;">
<div class="panel-heading">
<div class="row">
<div class="col-xs-3"><i class="fa fa-support fa-5x"></i></div>
<div class="col-xs-9 text-right">
<div class="huge">deposit_server</div>
<div>금일 기준 미납 서버</div>
</div>
</div>
</div>
<div class="panel-footer">
<span class="pull-left">자세히보기</span>
<span class="pull-right"><i class="fa fa-arrow-circle-right"></i></span>
<div class="clearfix"></div>
</div>
</div>
</div>
<!-- Body Content QuickInfo 금일지군 미납서버 End -->
</div>
<!-- Body Content QuickInfo End -->
<?= $this->include('templates/admin/footer'); ?>
<?= $this->endSection() ?>

View File

@ -1,43 +1,37 @@
<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<div class="content">
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
<div class="top">
<?= form_open(current_url(), array("method" => "get")) ?>
<ul class="nav">
조건검색:<?php foreach ($viewDatas['fieldFilters'] as $field) : ?><?= getFieldFilter_BoardHelper($field, $viewDatas[$field], $viewDatas) ?><?php endforeach ?>
<?= $this->include('templates/front/index_head') ?>
</ul>
<?= form_close() ?>
</div>
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div><?= html_entity_decode($viewDatas['category']->head) ?></div>
<div class="top"><?= $this->include('templates/front/index_head') ?></div>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="table table-bordered table-hover table-striped">
<table class="table table-hover">
<thead>
<tr>
<th>번호</th>
<?php foreach ($viewDatas['fields'] as $field) : ?><th><?= getFieldIndex_Column_BoardHelper($field, $viewDatas) ?></th><?php endforeach ?>
<th>작업</th>
<th>#</th>
<?php foreach ($viewDatas['fields'] as $field) : ?><?= getFieldIndex_Column_BoardHelper($field, $viewDatas) ?><?php endforeach ?>
<th>@</th>
</tr>
</thead>
<tbody>
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td nowrap>
<!-- 사용자가 자신의 작성한것인지 확인되면 update 가능-->
<?php if ($viewDatas[SESSION_NAMES['ISLOGIN']] && $entity->getUser_Uid() == $viewDatas['auth'][AUTH_FIELDS['ID']]) : ?>
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
<?php if ($viewDatas[SESSION_NAMES['ISLOGIN']] && $entity->user_uid == $viewDatas['auth'][AUTH_FIELDS['ID']]) : ?>
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
<?php else : ?>
<?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
<?php endif ?>
</td>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<td nowrap><?= getFieldIndex_Row_BoardHelper($field, $entity, $viewDatas) ?></td>
<td><?= getFieldIndex_Row_BoardHelper($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<!-- 사용자가 자신의 작성한것인지 확인되면 delete 가능-->
<?php if ($viewDatas[SESSION_NAMES['ISLOGIN']] && $entity->getUser_Uid() == $viewDatas['auth'][AUTH_FIELDS['ID']]) : ?>
<?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
<?php if ($viewDatas[SESSION_NAMES['ISLOGIN']] && $entity->user_uid == $viewDatas['auth'][AUTH_FIELDS['ID']]) : ?>
<?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
<?php endif ?>
</td>
</tr>
@ -46,15 +40,13 @@
</tbody>
</table>
<div class="bottom">
<ul class="nav justify-content-center">
<!-- 사용자가 쓰기권한이 있는지 확인-->
<?php if (isRole_CommonHelper($viewDatas['currentRoles'], $viewDatas['category'], CATEGORY_ROLE_FIELDS['WRITE'])) : ?>
<li class="nav-item"><?= anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?></li>
<?php if (isRole_CommonHelper($viewDatas['currentRoles'], $viewDatas['category'], 'iswrite')) : ?>
<?= anchor(current_url() . '/insert?category=' . $viewDatas['category']->getPrimaryKey(), '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
<?php endif ?>
</ul>
<?= $viewDatas['pagination'] ?>
</div>
<?= form_close() ?>
<div><?= html_entity_decode($viewDatas['category']->getTail()) ?></div>
<div><?= html_entity_decode($viewDatas['category']->tail) ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -1,7 +1,8 @@
<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<div class="content">
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div><?= html_entity_decode($viewDatas['category']->head) ?></div>
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-hover table-striped">
<?php foreach ($viewDatas['fields'] as $field) : ?>
@ -18,6 +19,6 @@
</tr>
</table>
<?= form_close(); ?>
<div><?= html_entity_decode($viewDatas['category']->getTail()) ?></div>
<div><?= html_entity_decode($viewDatas['category']->tail) ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -1,7 +1,8 @@
<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<div class="content">
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div><?= html_entity_decode($viewDatas['category']->head) ?></div>
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-hover table-striped">
<?php foreach ($viewDatas['fields'] as $field) : ?>
@ -14,10 +15,10 @@
</tr>
<?php endforeach; ?>
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
<td valign="bottom" colspan="2"><?= form_submit('', '답글', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</table>
<?= form_close(); ?>
<div><?= html_entity_decode($viewDatas['category']->getTail()) ?></div>
<div><?= html_entity_decode($viewDatas['category']->tail) ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -1,7 +1,8 @@
<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<div class="content">
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">>
<div><?= html_entity_decode($viewDatas['category']->head) ?></div>
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-hover table-striped">
<?php foreach ($viewDatas['fields'] as $field) : ?>
@ -14,10 +15,10 @@
</tr>
<?php endforeach; ?>
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
<td valign="bottom" colspan="2"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</table>
<?= form_close(); ?>
<div><?= html_entity_decode($viewDatas['category']->getTail()) ?></div>
<div><?= html_entity_decode($viewDatas['category']->tail) ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -1,8 +1,10 @@
<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<div class="content">
<div><?= html_entity_decode($viewDatas['category']->getHead()) ?></div>
<table class="form table table-bordered table-hover table-striped">
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div><?= html_entity_decode($viewDatas['category']->head) ?></div>
<table class="form table table-bordered table-striped">
<tbody>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_BoardHelper($field, $viewDatas) ?></td>
@ -12,7 +14,8 @@
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div><?= html_entity_decode($viewDatas['category']->getTail()) ?></div>
<div><?= html_entity_decode($viewDatas['category']->tail) ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,14 @@
<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/css/front/sitepage.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div><?= html_entity_decode($viewDatas['category']->head) ?></div>
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
<?= getFieldIndex_Row_SitepageHelper('content', $entity, $viewDatas) ?>
<?php $cnt++ ?>
<?php endforeach ?>
<div><?= html_entity_decode($viewDatas['category']->tail) ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -1,51 +1,41 @@
<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<div class="content">
<div class="top">
<?= form_open(current_url(), array("method" => "get")) ?>
<ul class="nav">
조건검색:<?php foreach ($viewDatas['fieldFilters'] as $field) : ?><?= getFieldFilter_UserHelper($field, $viewDatas[$field], $viewDatas) ?><?php endforeach ?>
<?= $this->include('templates/front/index_head') ?>
</ul>
<?= form_close() ?>
</div>
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div><?= html_entity_decode($viewDatas['category']->head) ?></div>
<div class="top"><?= $this->include('templates/front/index_head') ?></div>
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="table table-bordered table-hover table-striped">
<table class="table table-hover">
<thead>
<tr>
<th>번호</th>
<?php foreach ($viewDatas['fields'] as $field) : ?><th><?= getFieldIndex_Column_UserHelper($field, $viewDatas) ?></th><?php endforeach ?>
<th>#</th>
<?php foreach ($viewDatas['fields'] as $field) : ?><?= getFieldIndex_Column_UserHelper($field, $viewDatas) ?><?php endforeach ?>
</tr>
</thead>
<tbody>
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity) : ?>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)">
<td nowrap>
<!-- 사용자가 자신의 작성한것인지 확인되면 update 가능-->
<?php if ($this->viewDatas[SESSION_NAMES['ISLOGIN']] && $entity->getUser_Uid() == $this->viewDatas['auth'][AUTH_FIELDS['ID']]) : ?>
<?php if ($viewDatas[SESSION_NAMES['ISLOGIN']] && $entity->getPrimaryKey() == $viewDatas['auth'][AUTH_FIELDS['ID']]) : ?>
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
<?php else : ?>
<?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
<?php endif ?>
</td>
<?php foreach ($viewDatas['fields'] as $field) : ?>
<td nowrap><?= getFieldIndex_Row_UserHelper($field, $entity, $viewDatas) ?></td>
<td><?= getFieldIndex_Row_UserHelper($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<!-- 사용자가 자신의 작성한것인지 확인되면 delete 가능-->
<?php if ($this->viewDatas[SESSION_NAMES['ISLOGIN']] && $entity->getUser_Uid() == $this->viewDatas['auth'][AUTH_FIELDS['ID']]) : ?>
<?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
<?php endif ?>
</td>
</tr>
<?php $cnt++ ?>
<?php endforeach ?>
</tbody>
</table>
<div class="bottom">
<ul class="nav justify-content-center">
<!-- 사용자가 쓰기권한이 있는지 확인-->
<?php if (isRole_CommonHelper($this->viewDatas['currentRoles'], $this->viewDatas['category'], CATEGORY_ROLE_FIELDS['WRITE'])) : ?>
<li class="nav-item"><?= anchor(current_url() . '/insert', '입력', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?></li>
<?php endif ?>
</ul>
<?= $viewDatas['pagination'] ?>
</div>
<?= form_close() ?>
<div><?= html_entity_decode($viewDatas['category']->tail) ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,24 @@
<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div><?= html_entity_decode($viewDatas['category']->head) ?></div>
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-hover table-striped">
<?php foreach ($viewDatas['fields'] as $field) : ?>
<tr>
<td class="label"><?= getFieldLabel_UserHelper($field, $viewDatas) ?></td>
<td class="column">
<?= getFieldForm_UserHelper($field, old($field, DEFAULTS['EMPTY']), $viewDatas) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '회원가입', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</table>
<?= form_close(); ?>
<div><?= html_entity_decode($viewDatas['category']->tail) ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,41 @@
<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/css/front/login.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div class="login container">
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table>
<tr>
<td class="label" nowrap>계정</td>
<td class="column">
<?= form_input('id', old('id', DEFAULTS['EMPTY'])) ?>
</td>
<td rowspan="2" class="submit">
<?= form_input([
'type' => 'image', 'src' => "/images/common/btn_login.png",
'width' => '57', 'height' => '60',
]) ?>
</td>
<td rowspan="2">
<?php foreach ($viewDatas['login_buttons'] as $key => $login_button) : ?>
<?= $login_button ?>
<?php endforeach ?>
</td>
</tr>
<tr>
<td class="label" nowrap>암호</td>
<td class="column">
<?= form_password('passwd', old('passwd', DEFAULTS['EMPTY'])) ?>
</td>
</tr>
<tr>
<td colspan="4" class="login_bottom">
<a href="/front/user/insert">회원가입</a>
</td>
</tr>
</table>
<?= form_close(); ?>
</div>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,37 @@
<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/css/front/login_v1.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div class="login container">
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<div class="row mb-3">
<div class="label_column col-3">
<label class="col-form-label">아이디</label>
</div>
<div class="col-9">
<?= form_input('id', old('id', DEFAULTS['EMPTY'])) ?>
</div>
</div>
<div class="row mb-3">
<div class="label_column col-3">
<label class="col-form-label">비밀번호</label>
</div>
<div class="col-9">
<?= form_password('passwd', old('passwd', DEFAULTS['EMPTY'])) ?>
</div>
</div>
<div class="row">
<div class="col-12 text-center d-grid">
<?= form_submit('', '로그인', array("class" => "btn btn-outline btn-primary")) ?>
</div>
</div>
<div class="login_bottom row">
<div class="col"><a href="/front/user/insert">회원가입</a></div>
<!-- <div class="col"><a href="/front/user/findid">아이디찾기</a></div>
<div class="col"><a href="/front/user/findpw">비밀번호찾기</a></div> -->
</div>
</div>
<?= form_close(); ?>
</div>
<?= $this->endSection() ?>

View File

@ -1,6 +1,8 @@
<?= $this->extend('layouts/front') ?>
<?= $this->section('content') ?>
<div class="content">
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<div id="content">
<div><?= html_entity_decode($viewDatas['category']->head) ?></div>
<?= form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="form table table-bordered table-hover table-striped">
<?php foreach ($viewDatas['fields'] as $field) : ?>
@ -13,9 +15,10 @@
</tr>
<?php endforeach; ?>
<tr>
<td valign="bottom" colspan="2"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></td>
<td valign="bottom" colspan="2"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</table>
<?= form_close(); ?>
<div><?= html_entity_decode($viewDatas['category']->head) ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -1,10 +1,10 @@
<!doctype html>
<html>
<!DOCTYPE html>
<html lang="ko">
<head>
<base href="/" target="_self" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" id="viewport" content="width=1280">
<?php foreach ($viewDatas['layout']['stylesheets'] as $stylesheet) : ?>
<?= $stylesheet ?>
<?php endforeach; ?>
@ -24,10 +24,15 @@
</head>
<body>
<div id="head">
<?= $this->include($viewDatas['layout']['path'] . '/top_navigator'); ?>
</div>
<div class="container-fluid">
<nav class="nav"></nav>
<nav class="nav justify-content-center">
<table id="layout">
<tr>
<td id="left" valign="top" width="180">
<td id="left" valign="top" width="160">
<?= $this->include($viewDatas['layout']['path'] . '/left_menu'); ?>
</td>
<td id="body" valign="top" width="*">
@ -37,6 +42,8 @@
</td>
</tr>
</table>
<nav class="nav justify-content-end"></nav>
</div>
</body>
</html>

View File

@ -5,5 +5,6 @@
<div class="accordion accordion-flush">
<?= $this->include($viewDatas['layout']['path'] . '/left_menu/base'); ?>
<?= $this->include($viewDatas['layout']['path'] . '/left_menu/board'); ?>
<?= $this->include($viewDatas['layout']['path'] . '/left_menu/shoppingmall'); ?>
</div>
</div>

View File

@ -4,10 +4,13 @@
</h2>
<div id="flush-heading-Board" class="accordion-collapse collapse show" aria-labelledby="flush-heading-Board">
<div class="accordion-item">
<h2><a href="/admin/category"><?= CLASS_ICONS['CATEGORY'] ?>범주 관리</a></h2>
<h2><a href="/admin/category"><?= CLASS_ICONS['CATEGORY'] ?>분류 관리</a></h2>
</div>
<div class="accordion-item">
<h2><a href="/admin/board"><?= CLASS_ICONS['BOARD'] ?>게시글 관리</a></h2>
</div>
<div class="accordion-item">
<h2><a href="/admin/sitepage"><?= CLASS_ICONS['SITEPAGE'] ?>SitePage 관리</a></h2>
</div>
</div>
</div>

View File

@ -0,0 +1,13 @@
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-heading-Shoppingmall" aria-expanded="false" aria-controls="flush-heading-Shoppingmall"><b>상점관리</b></button>
</h2>
<div id="flush-heading-Shoppingmall" class="accordion-collapse collapse show" aria-labelledby="panelsStayOpen-heading-Shoppingmall">
<div class="accordion-item">
<h2><a href="/admin/product"><?= CLASS_ICONS['PRODUCT'] ?>상품 관리</a></h2>
</div>
<div class="accordion-item">
<h2><a href="/admin/order"><?= CLASS_ICONS['ORDER'] ?></i>주문 관리</a></h2>
</div>
</div>
</div>

View File

@ -1,10 +1,16 @@
<!doctype html>
<html>
<!DOCTYPE html>
<html lang="ko">
<head>
<base href="/" target="_self" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="viewport" id="viewport" content="width=1280">
<meta name="subject" content="IT Solution">
<meta name="description" content="일본IDC 일본서버 일본 서버 일본호스팅 서버호스팅 디도스 공격 해외 호스팅 DDOS 방어 ddos 의뢰 디도스 보안 일본 단독서버">
<meta name="keywords" content="일본IDC 일본서버 일본 서버 일본호스팅 서버호스팅 디도스 공격 해외 호스팅 DDOS 방어 ddos 의뢰 디도스 보안 일본 단독서버">
<meta property="og:type" content="website">
<meta property="og:title" content="IT Solution">
<meta property="og:description" content="일본IDC 일본서버 일본 서버 일본호스팅 서버호스팅 디도스 공격 해외 호스팅 DDOS 방어 ddos 의뢰 디도스 보안 일본 단독서버">
<?php foreach ($viewDatas['layout']['stylesheets'] as $stylesheet) : ?>
<?= $stylesheet ?>
<?php endforeach; ?>
@ -24,10 +30,17 @@
</head>
<body>
<div id="head">
<?= $this->include($viewDatas['layout']['path'] . '/top_navigator'); ?>
<?= $this->include($viewDatas['layout']['path'] . '/top_menu'); ?>
<?= CLASS_TOP_BANNER[strtoupper($viewDatas['className'])] ?>
</div>
<div class="container-fluid">
<nav class="nav"></nav>
<nav class="nav justify-content-center">
<table id="layout">
<tr>
<td id="left" valign="top" width="180">
<td id="left" valign="top" width="200">
<?= $this->include($viewDatas['layout']['path'] . '/left_menu'); ?>
</td>
<td id="body" valign="top" width="*">
@ -37,6 +50,11 @@
</td>
</tr>
</table>
<nav class="nav justify-content-end"></nav>
</div>
<nav id="tail" class="navbar navbar-expand-lg" style="background-color:white">
<?= $this->include($viewDatas['layout']['path'] . '/copyright'); ?>
</nav>
</body>
</html>

View File

@ -1,11 +1,12 @@
<!-- Copyright 시작-->
<div id="tail">
<div class="foot-logo"><img src="../images/common/foot_logo.png" alt="IT Solution"></div>
<div class="foot-info">
<address>
社名 : 株式会社 DUNAMIS <span class="bar"></span> 代表者 : <span class="bar"></span> 住所 : 東京都江東区亀戸5丁-1-2 <span class="bar"></span> 事業者登録番号 : 0400-01-082327 <span class="bar"></span> Tel : 1661-0577 <br>
Copyright by 2018 ()ITSolution. All Right Reserved.
</address>
<link href="/css/front/copyright.css" media="screen" rel="stylesheet" type="text/css" />
<div id="copyright" class="container-fluid">
<nav class="nav"><a class="navbar-brand" href="/">LOGO</a></nav>
<nav class="nav justify-content-center">
<div class="address">
社名 : 株式会社 DUNAMIS | 代表者 : | 住所 : 東京都江東区亀戸5丁-1-2 | 事業者登録番号 : 0400-01-082327 | Tel : 1661-0577 <br>
</div>
</nav>
<nav class="nav justify-content-end">Copyright by 2018 ()ITSolution. All Right Reserved.</nav>
</div>
<!-- Copyright -->

View File

@ -1,9 +1,6 @@
<!-- left menu start -->
<link href="/css/front/left_menu.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/side_menu.js"></script>
<div id="left_menu" class="shadow-lg rounded">
<div class="accordion accordion-flush">
<?= $this->include($viewDatas['layout']['path'] . '/left_menu/base'); ?>
<?= $this->include($viewDatas['layout']['path'] . '/left_menu/board'); ?>
</div>
<div id="left_menu">
<?= $this->include($viewDatas['layout']['path'] . "/left_menu/leftmenu_{$viewDatas['category']->getPrimaryKey()}"); ?>
</div>
<!-- left menu end -->

View File

@ -0,0 +1,13 @@
<!-- DEBUG-VIEW START 7 APPPATH\Views\admin\category\leftmenu_template.php -->
<div class="parent">
<div>-</div>
<div class="title">개인정보</div>
</div>
<div class="sibling active">
<a href="http://localhost:8080/front/order?category=11" target="_self">주문정보</a> <span class="play"><i class="bi bi-play-fill"></i></span>
</div>
<div class="sibling ">
<a href="http://localhost:8080/front/user?category=22" target="_self">사용자정보</a> <span class="play"><i class="bi bi-play-fill"></i></span>
</div>
<!-- DEBUG-VIEW ENDED 7 APPPATH\Views\admin\category\leftmenu_template.php -->

View File

@ -0,0 +1,16 @@
<!-- DEBUG-VIEW START 8 APPPATH\Views\admin\category\leftmenu_template.php -->
<div class="parent">
<div>-</div>
<div class="title">개인정보</div>
</div>
<div class="sibling ">
<a href="http://localhost:8080/front/order?category=11" target="_self">주문정보</a> <span class="play"><i class="bi bi-play-fill"></i></span>
</div>
<div class="sibling active">
<a href="http://localhost:8080/front/payment?category=12" target="_self">결제정보</a> <span class="play"><i class="bi bi-play-fill"></i></span>
</div>
<div class="sibling ">
<a href="http://localhost:8080/front/user?category=22" target="_self">사용자정보</a> <span class="play"><i class="bi bi-play-fill"></i></span>
</div>
<!-- DEBUG-VIEW ENDED 8 APPPATH\Views\admin\category\leftmenu_template.php -->

View File

@ -0,0 +1,13 @@
<!-- DEBUG-VIEW START 5 APPPATH\Views\admin\category\leftmenu_template.php -->
<div class="parent">
<div>-</div>
<div class="title">AboutUS</div>
</div>
<div class="sibling active">
<a href="http://localhost:8080/front/sitepage?category=14" target="_self">인사말</a> <span class="play"><i class="bi bi-play-fill"></i></span>
</div>
<div class="sibling ">
<a href="http://localhost:8080/front/sitepage?category=15" target="_self">회사소개</a> <span class="play"><i class="bi bi-play-fill"></i></span>
</div>
<!-- DEBUG-VIEW ENDED 5 APPPATH\Views\admin\category\leftmenu_template.php -->

View File

@ -0,0 +1,13 @@
<!-- DEBUG-VIEW START 6 APPPATH\Views\admin\category\leftmenu_template.php -->
<div class="parent">
<div>-</div>
<div class="title">AboutUS</div>
</div>
<div class="sibling ">
<a href="http://localhost:8080/front/sitepage?category=14" target="_self">인사말</a> <span class="play"><i class="bi bi-play-fill"></i></span>
</div>
<div class="sibling active">
<a href="http://localhost:8080/front/sitepage?category=15" target="_self">회사소개</a> <span class="play"><i class="bi bi-play-fill"></i></span>
</div>
<!-- DEBUG-VIEW ENDED 6 APPPATH\Views\admin\category\leftmenu_template.php -->

View File

@ -0,0 +1,13 @@
<!-- DEBUG-VIEW START 3 APPPATH\Views\admin\category\leftmenu_template.php -->
<div class="parent">
<div>-</div>
<div class="title">Hosting</div>
</div>
<div class="sibling active">
<a href="http://localhost:8080/front/sitepage?category=17" target="_self">제품안내</a> <span class="play"><i class="bi bi-play-fill"></i></span>
</div>
<div class="sibling ">
<a href="http://localhost:8080/front/sitepage?category=18" target="_self">신청절차</a> <span class="play"><i class="bi bi-play-fill"></i></span>
</div>
<!-- DEBUG-VIEW ENDED 3 APPPATH\Views\admin\category\leftmenu_template.php -->

View File

@ -0,0 +1,13 @@
<!-- DEBUG-VIEW START 4 APPPATH\Views\admin\category\leftmenu_template.php -->
<div class="parent">
<div>-</div>
<div class="title">Hosting</div>
</div>
<div class="sibling ">
<a href="http://localhost:8080/front/sitepage?category=17" target="_self">제품안내</a> <span class="play"><i class="bi bi-play-fill"></i></span>
</div>
<div class="sibling active">
<a href="http://localhost:8080/front/sitepage?category=18" target="_self">신청절차</a> <span class="play"><i class="bi bi-play-fill"></i></span>
</div>
<!-- DEBUG-VIEW ENDED 4 APPPATH\Views\admin\category\leftmenu_template.php -->

Some files were not shown because too many files have changed in this diff Show More