vhost init...2

This commit is contained in:
최준흠 2024-05-07 14:52:34 +09:00
parent eebf9d005b
commit 0784951c55
17 changed files with 60 additions and 52 deletions

View File

@ -108,7 +108,7 @@ define('LAYOUTS', [
'front' => [
'title' => '사용자화면',
'path' => 'layouts' . DIRECTORY_SEPARATOR . 'front',
'menus' => ['aboutus', 'hosting', 'service', 'support'],
'menus' => ['aboutus', 'hosting', 'serverdevice', 'service', 'support'],
'stylesheets' => [
'<link rel="icon" href="/favicon.ico">',
'<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">',
@ -267,17 +267,16 @@ define('CLASS_ICONS', [
'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"/>',
'BILLING' => '<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('TOP_BANNER', [
'default' => '<img src="/images/banner/sub_visual1.jpg"/>',
'aboutus' => '<img src="/images/banner/sub_visual1.jpg"/>',
'hosting' => '<img src="/images/banner/sub_visual2.jpg"/>',
'serverdevice' => '<img src="/images/banner/sub_visual3.jpg"/>',
'service' => '<img src="/images/banner/sub_visual3.jpg"/>',
'support' => '<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>',
]);

View File

@ -15,5 +15,7 @@ abstract class AdminController extends BaseController
$this->_viewPath = 'admin/';
$this->_viewDatas['control'] = 'admin';
$this->_viewDatas['layout'] = LAYOUTS['admin'];
$this->_viewDatas['title'] = '관리자페이지';
$this->_viewDatas['class_icon'] = '';
}
}

View File

@ -11,9 +11,6 @@ class Home extends AdminController
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_viewDatas['className'] = 'Home';
$this->_viewDatas['title'] = '관리자페이지';
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])];
}
public function getFields(string $action): array

View File

@ -19,7 +19,8 @@ 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['title'] = '사용자화면';
$this->_viewDatas['class_icon'] = '';
$this->_viewDatas['menus'] = $this->getCategoryModel()->getMenus();
$this->_viewDatas['category'] = false;
}

View File

@ -45,17 +45,11 @@ class ProductController extends FrontController
return parent::getFieldBatchFilters();
}
//권한체크
protected function isRole($action)
{
$this->_category = $this->request->getVar('category') ?: throw new \Exception("분류를 지정하지 않으셨습니다.");
parent::isRole($action);
}
//View관련
protected function view_process($entity)
{
//권한체크
$this->isRole('view', $entity);
$this->isRole('view');
//조회수 올리기
$entity = $this->_model->addViewCount($entity);
return parent::view_process($entity);
@ -70,8 +64,8 @@ class ProductController extends FrontController
//Category 및 Status 조건추가
protected function index_setCondition()
{
$this->_model->where("category_uid", $this->_viewDatas['category']->getPrimaryKey());
// $this->_model->where("status", DEFAULTS['STATUS']);
$this->_model->where("category_uid", $this->getCurrentCategory()->getPrimaryKey());
$this->_model->where("status", DEFAULTS['STATUS']);
parent::index_setCondition();
}
}

View File

@ -110,4 +110,30 @@ CREATE TABLE vhost.tw_sitepage (
KEY user_uid (user_uid),
CONSTRAINT tw_sitepage_ibfk_1 FOREIGN KEY (category_uid) REFERENCES tw_category (uid),
CONSTRAINT tw_sitepage_ibfk_2 FOREIGN KEY (user_uid) REFERENCES tw_user (uid)
) ENGINE = InnoDB COMMENT '사이트페이지';
) ENGINE = InnoDB COMMENT '사이트페이지';
DROP TABLE IF EXISTS tw_product;
CREATE TABLE vhost.tw_product (
uid varchar(36) NOT NULL,
category_uid varchar(50) NOT NULL COMMENT '범주_UID',
user_uid varchar(36) DEFAULT NULL COMMENT '생산자 정보',
type varchar(10) NOT NULL DEFAULT 'rental' COMMENT 'rental: 월임대, onetime:판매,일회성',
name varchar(255) NOT NULL COMMENT '상품명',
photo varchar(255) DEFAULT NULL COMMENT '상품이미지',
cost int(10) unsigned NOT NULL COMMENT '원가',
price int(10) unsigned NOT NULL COMMENT '판매가',
sale int(10) unsigned NOT NULL DEFAULT 0 COMMENT '할인가',
stock int(5) unsigned DEFAULT 1 COMMENT '재고수량',
view_cnt int(4) unsigned NOT NULL DEFAULT 0 COMMENT '조회수',
content text NOT NULL COMMENT '상품정보',
status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 판매, unuse: 판매않함, standby: 판매준비, hold: 판매중지 soldout: 상품부족 등등',
updated_at timestamp NULL DEFAULT NULL,
created_at timestamp NOT NULL DEFAULT current_timestamp(),
deleted_at timestamp NULL DEFAULT NULL,
PRIMARY KEY (uid),
KEY category_uid (category_uid),
KEY user_uid (user_uid),
CONSTRAINT tw_product_ibfk_1 FOREIGN KEY (category_uid) REFERENCES tw_category (uid),
CONSTRAINT tw_product_ibfk_2 FOREIGN KEY (user_uid) REFERENCES tw_user (uid)
) ENGINE = InnoDB COMMENT = '상품 정보';

View File

@ -106,7 +106,7 @@ function getFieldIndex_Column_BillingHelper($field, array $viewDatas)
$value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
$viewDatas['uri']->addQuery('order_field', $field);
$viewDatas['uri']->addQuery('order_value', $value);
$columnData = anchor($viewDatas['uri'], $label);
$columnData = anchor((string)$viewDatas['uri'], $label);
switch ($field) {
case 'title':
case 'name':

View File

@ -103,7 +103,7 @@ function getFieldIndex_Column_CategoryHelper($field, array $viewDatas)
$value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
$viewDatas['uri']->addQuery('order_field', $field);
$viewDatas['uri']->addQuery('order_value', $value);
$columnData = anchor($viewDatas['uri'], $label);
$columnData = anchor((string)$viewDatas['uri'], $label);
switch ($field) {
case 'title':
case 'name':

View File

@ -116,7 +116,7 @@ function getFieldIndex_Column_OrderHelper($field, array $viewDatas)
$value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
$viewDatas['uri']->addQuery('order_field', $field);
$viewDatas['uri']->addQuery('order_value', $value);
$columnData = anchor($viewDatas['uri'], $label);
$columnData = anchor((string)$viewDatas['uri'], $label);
switch ($field) {
case 'title':
case 'name':

View File

@ -120,7 +120,7 @@ function getFieldIndex_Column_ProductHelper($field, array $viewDatas)
$value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
$viewDatas['uri']->addQuery('order_field', $field);
$viewDatas['uri']->addQuery('order_value', $value);
$columnData = anchor($viewDatas['uri'], $label);
$columnData = anchor((string)$viewDatas['uri'], $label);
switch ($field) {
case 'title':
case 'name':

View File

@ -104,7 +104,7 @@ function getFieldIndex_Column_SitepageHelper($field, array $viewDatas)
$value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
$viewDatas['uri']->addQuery('order_field', $field);
$viewDatas['uri']->addQuery('order_value', $value);
$columnData = anchor($viewDatas['uri'], $label);
$columnData = anchor((string)$viewDatas['uri'], $label);
switch ($field) {
case 'title':
case 'name':

View File

@ -108,7 +108,7 @@ function getFieldIndex_Column_UserHelper($field, array $viewDatas)
$value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC";
$viewDatas['uri']->addQuery('order_field', $field);
$viewDatas['uri']->addQuery('order_value', $value);
$columnData = anchor($viewDatas['uri'], $label);
$columnData = anchor((string)$viewDatas['uri'], $label);
switch ($field) {
case 'title':
case 'name':

View File

@ -4,7 +4,13 @@
<div id="content">
<div><?= html_entity_decode($viewDatas['currentCategory']->head) ?></div>
<div class="top">
<?= $this->include('templates/front/index_head_product') ?>
<?= $this->include('templates/front/index_head') ?>
<nav class="nav"></nav>
<nav class="nav justify-content-center"></nav>
<nav class="nav justify-content-end">
<?= anchor(current_url() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey() . '&order_field=price&order_value=ASC', '판매가순', ["class" => "btn btn-sm btn-info btn-circle", "target" => "_self"]) ?>
<?= anchor(current_url() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey() . '&order_field=view_cnt&order_value=DESC', '인기순', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
</nav>
</div>
<?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity) : ?>

View File

@ -1,4 +1,4 @@
<?= $this->extend('layouts/front') ?>
<?= $this->extend('layouts/main') ?>
<?= $this->section('content') ?>
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/css/common/login.css" media="screen" rel="stylesheet" type="text/css" />

View File

@ -1,4 +1,4 @@
<?= $this->extend('layouts/front') ?>
<?= $this->extend('layouts/main') ?>
<?= $this->section('content') ?>
<link href="/css/front/content.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/css/common/login_v1.css" media="screen" rel="stylesheet" type="text/css" />

View File

@ -33,7 +33,7 @@
<div id="head">
<?= $this->include($viewDatas['layout']['path'] . '/top_navigator'); ?>
<?= $this->include($viewDatas['layout']['path'] . '/top_menu'); ?>
<?= CLASS_TOP_BANNER[strtoupper($viewDatas['className'])] ?>
<?= TOP_BANNER[array_key_exists('currentCategory', $viewDatas) ? $viewDatas['currentCategory']->parent : 'default'] ?>
</div>
<div class="container-fluid">
<nav class="nav"></nav>

View File

@ -1,17 +0,0 @@
<nav class="navbar navbar-expand-lg">
<div class="container-fluid">
<nav class="nav">
<span class="pageinfo">페이지정보 : <?= $viewDatas['page'] ?>/<?= $viewDatas['total_page'] ?></span>
</nav>
<nav class="nav justify-content-center">
<?= anchor(current_url() . '?category=' . $viewDatas['category']->getPrimaryKey() . '&order_field=price&order_value=ASC', '판매가순', ["class" => "btn btn-sm btn-info btn-circle", "target" => "_self"]) ?>
<?= anchor(current_url() . '?category=' . $viewDatas['category']->getPrimaryKey() . '&order_field=view_cnt&order_value=DESC', '인기순', ["class" => "btn btn-sm btn-primary btn-circle", "target" => "_self"]) ?>
</nav>
<nav class="nav justify-content-end">
<?= form_open(current_url(), array("method" => "get")) ?>
<?= form_input('word', $viewDatas['word']) ?>
<?= form_submit('', '검색하기') ?>
<?= form_close() ?>
</nav>
</div>
</nav>