vhost init...2

This commit is contained in:
최준흠 2024-05-06 19:37:01 +09:00
parent 513084d37c
commit 0059d69e46
20 changed files with 152 additions and 62 deletions

View File

@ -93,6 +93,31 @@ define('EVENT_PRIORITY_NORMAL', 100);
*/
define('EVENT_PRIORITY_HIGH', 10);
//Categorys
define('MENULAYERS',[
'default' => 'aboutus',
'TOP'=>['aboutus'=>'AboutUS','hosting'=>'Hosting','service'=>'Service','support'=>'Support'],
'SECOND'=>
['aboutus'=>[
'greeting'=>'인사말',
'companyinfo'=>'회사소개',
],
'hosting'=>[
'beremetal'=>'단독서버',
'virtual'=>'가상서버',
],
'service'=>[
'line'=>'단독회선',
'vpn'=>'VPN',
'ddos'=>'DDOS',
],
'support'=>[
'information'=>'공지사항',
'refrence'=>'자료실',
],
],
]);
define('LAYOUTS', [
'empty' => [
'path' => 'layouts' . DIRECTORY_SEPARATOR . 'empty',
@ -106,6 +131,7 @@ define('LAYOUTS', [
]
],
'front' => [
'title' => '사용자화면',
'path' => 'layouts' . DIRECTORY_SEPARATOR . 'front',
'stylesheets' => [
'<link rel="icon" href="/favicon.ico">',
@ -123,9 +149,11 @@ define('LAYOUTS', [
'<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>',
]
],
'menus' => ['aboutus', 'hosting', 'service', 'support'],
],
'admin' => [
'title' => '관리자화면',
'path' => 'layouts' . DIRECTORY_SEPARATOR . 'admin',
'stylesheets' => [
'<link rel="icon" href="/favicon.ico">',
@ -145,26 +173,6 @@ define('LAYOUTS', [
'<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

View File

@ -18,6 +18,9 @@ abstract class FrontController extends BaseController
$this->_viewPath = 'front/';
$this->_viewDatas['control'] = 'front';
$this->_viewDatas['layout'] = LAYOUTS['front'];
$this->_viewDatas['title'] = LAYOUTS['front']['title'];
$this->_viewDatas['MENULAYERS'] = MENULAYERS;
$this->_viewDatas['category'] = MENULAYERS['default'];
}
final protected function getCategoryModel(): CategoryModel

View File

@ -2,7 +2,6 @@
namespace App\Controllers\Front;
use App\Entities\CategoryEntity;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;

View File

@ -17,7 +17,7 @@ CREATE TABLE vhost.tw_user (
PRIMARY KEY (uid),
UNIQUE KEY (id),
UNIQUE KEY (email)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='사용자 정보';
) ENGINE=InnoDB COMMENT ='사용자 정보';
-- insert into tw_user (uid,id,passwd,name,email,role,status) select uuid(),id,passwd,name,email,role,status from cfmgr.user;
DROP TABLE IF EXISTS vhost.tw_user_profile;
@ -37,39 +37,9 @@ CREATE TABLE vhost.tw_user_sns (
PRIMARY KEY (uid),
UNIQUE KEY (site,id),
CONSTRAINT FOREIGN KEY (user_uid) REFERENCES tw_user (uid) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='SNS 로그인 후 정보';
) ENGINE=InnoDB COMMENT ='SNS 로그인 후 정보';
DROP TABLE IF EXISTS vhost.tw_category;
-- 1. 게시물 추가전 grpno에 해당하는 max(grporder)+1씩증가 작업
-- update tw_category set grporder=grporder+1 where grpno=그룹번호 and grporder > 선택한 grpno
-- 2. 게시물 추가시 작업
-- insert tw_category grpno=그룹번호,grporder=grporder+1,grpdepth=grpdepth+1
-- 3. 게시물 조회시 작업
-- select * from tw_category order by grpno desc,grporder asc
CREATE TABLE vhost.tw_category (
uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
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씩 추가필요',
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 '쓰기권한',
isreply varchar(30) NOT NULL DEFAULT 'guest' COMMENT '답글권한',
isupload varchar(30) NOT NULL DEFAULT 'guest' COMMENT 'Upload권한',
isdownload varchar(30) NOT NULL DEFAULT 'guest' COMMENT 'Download권한',
head text NULL COMMENT '위 내용',
tail text 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)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='분류';
DROP TABLE IF EXISTS vhost.tw_board;
-- 1. 게시물 추가전 grpno에 해당하는 max(grporder)+1씩증가 작업
-- update tw_board set grporder=grporder+1 where grpno=그룹번호 and grporder > 선택한 grpno
@ -79,11 +49,11 @@ DROP TABLE IF EXISTS vhost.tw_board;
-- select * from tw_board order by grpno desc,grporder asc
CREATE TABLE vhost.tw_board (
uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
category varchar(50) NOT NULL DEFAULT 'information' COMMENT '공지사항',
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씩 추가필요',
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 '내용',
@ -95,6 +65,5 @@ CREATE TABLE vhost.tw_board (
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 ='게시물 정보';
) ENGINE=InnoDB COMMENT ='게시물 정보';

View File

@ -0,0 +1,11 @@
<table class="table table-hover">
<tbody>
<?php foreach ($viewDatas['cellDatas']['entitys'] as $entity): ?>
<tr>
<?php foreach (['title', 'created_at'] as $field): ?>
<td><?= getFieldIndex_Row_BoardHelper($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
</tr>
<?php endforeach ?>
</tbody>
</table>

View File

@ -0,0 +1,87 @@
<link href="/css/front/virtual_calculator.css" media="screen" rel="stylesheet" type="text/css" />
<script>
function calculator(order_price) {
var parts = Array.from(document.getElementsByClassName("vhost_parts"));
parts.forEach(function(part) { //loop
//console.log(part);
order_price += parseInt((part.getAttribute('cost') - part.getAttribute('sale')) * part.options[part.selectedIndex].value);
document.getElementById('price').value = order_price;
document.getElementById('order_price').textContent = new Intl.NumberFormat().format(order_price);
});
var current = document.getElementById('paymentday');
if (!current.selectedIndex) {
alert("결제일을 선택해주세요");
current.focus();
return false
}
}
</script>
<div id="virtual_calculator">
<?= form_open(URLS['addCart'], [
'method' => 'post',
"onsubmit" => 'return calculator(' . $viewDatas['parts']['virtual']['default']['baserate'] . ')'
]) ?>
<input type="hidden" id="category" name="category" value="virtual">
<input type="hidden" id="price" name="price">
<table>
<thead>
<tr>
<th scope="col" colspan="3">가상서버 견적 계산기</th>
</tr>
</thead>
<tbody>
<tr>
<th>기본요금</th>
<td>
<strong><?= number_format($viewDatas['parts']['virtual']['default']['baserate']) ?>원</strong>
</td>
</tr>
<?php foreach ($viewDatas['parts']['virtual']['category'] as $category => $attrs) : ?>
<tr>
<th><?= $attrs['label'] ?></th>
<td>
<strong class="line-through"><?= number_format($attrs['cost']) ?>원</strong>
<strong class="f-back">할인가 <?= number_format($attrs['cost'] - $attrs['sale']) ?></strong> *
<?= form_dropdown(
$category,
$attrs['options'],
old($category, 0),
[
'id' => $category,
'class' => 'vhost_parts',
'cost' => $attrs['cost'],
'sale' => $attrs['sale'],
'onChange' => "calculator(" . $viewDatas['parts']['virtual']['default']['baserate'] . ")"
]
) ?>
<?= $attrs['unit'] ?>
</td>
</tr>
<?php endforeach ?>
<tr>
<th>결제일</th>
<td class="column">
<?php $paymentDayOptions = ['' => "결제일 선택"];
for ($i = 1; $i <= 28; $i++) {
$paymentDayOptions[$i] = "매월 {$i}";
}
?>
<?= form_dropdown('paymentday', $paymentDayOptions, old('paymentday', 25), ['id' => 'paymentday']);
?>
</td>
</tr>
<tr>
<th class="none">주문금액</th>
<td class="none" colspan="3">
<span id="order_price">0</span>
<?= form_submit('', '신청', array("class" => "btn btn-outline btn-primary")); ?>
</td>
</tr>
</tbody>
</table>
<?= form_close() ?>
<script type="text/javascript">
window.onload = calculator(<?= $viewDatas['parts']['virtual']['default']['baserate'] ?>);
</script>
<?= $viewDatas['session']->getFlashdata('return_message') ? alert_CommonHelper($viewDatas['session']->getFlashdata('return_message')) : "" ?>
</div>

View File

@ -8,17 +8,18 @@
<nav class="nav"><a class="navbar-brand" href="/">HOME</a></nav>
<nav class="nav justify-content-center"></nav>
<ul class="nav justify-content-end">
<?php foreach ($viewDatas['layout']['top_menus'] as $top_menu): ?>
<li class="nav-item" style="padding-top:10px;">|</li>
<?php foreach ($viewDatas['layout']['menus'] as $menu_key): ?>
<li class="nav-item">
<div class="dropdown-center">
<ul class="navbar-nav">
<li class="nav-item dropdown">
<a class="nav-link" id="navbarDarkDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<?= $viewDatas['categorys'][$top_menu]['parent']->getTitle() ?>
<?= $viewDatas['MENULAYERS']['TOP'][$menu_key] ?>
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDarkDropdownMenuLink">
<?php foreach($viewDatas['categorys'][$top_menu]['childs'] as $child): ?>
<li><a class="dropdown-item <?= $child->getPrimaryKey() == $viewDatas['category'] ? "active" : "" ?>" href="/front/sitepage?category=<?= $child->getPrimaryKey() ?>"><?=$child->getTitle()?></a></li>
<?php foreach($viewDatas['MENULAYERS']['SECOND'][$menu_key] as $child_key=>$child_label): ?>
<li><a class="dropdown-item <?= $child_key == $viewDatas['category'] ? "active" : "" ?>" href="/front/sitepage?category=<?= $child_key ?>"><?=$child_label?></a></li>
<?php endforeach ?>
</ul>
</li>

View File

@ -45,7 +45,7 @@
#top_menu div.dropdown-center ul.navbar-nav li.dropdown ul.dropdown-menu li{
height:60px;
padding-top:15px;
/* border:1px solid red; */
border-bottom:1px solid silver;
}
#top_menu div.dropdown-center ul.navbar-nav li.dropdown ul.dropdown-menu li a{
width:150px;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long