vhost init...1
This commit is contained in:
parent
0784951c55
commit
cdcb113eda
14
app/Cells/BaseCell.php
Normal file
14
app/Cells/BaseCell.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells;
|
||||
|
||||
use App\Models\CategoryModel;
|
||||
|
||||
class BaseCell
|
||||
{
|
||||
private $_categoryModel = null;
|
||||
final protected function getCategoryModel(): CategoryModel
|
||||
{
|
||||
return $this->_categoryModel = $this->_categoryModel ?: new CategoryModel();
|
||||
}
|
||||
}
|
||||
@ -2,9 +2,10 @@
|
||||
|
||||
namespace App\Cells;
|
||||
|
||||
use App\Cells\BaseCell;
|
||||
use App\Models\BoardModel;
|
||||
|
||||
class BoardCell
|
||||
class BoardCell extends BaseCell
|
||||
{
|
||||
private $_boardModel = null;
|
||||
private function getBoardModel(): BoardModel
|
||||
@ -14,6 +15,7 @@ class BoardCell
|
||||
public function information(array $viewDatas): string
|
||||
{
|
||||
helper('Board');
|
||||
$viewDatas['currentCategory'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => __FUNCTION__]);
|
||||
$viewDatas['cellDatas'] = array();
|
||||
$viewDatas['cellDatas']['entitys'] = $this->getBoardModel()->getEntitys([
|
||||
'category_uid' => __FUNCTION__
|
||||
|
||||
@ -2,14 +2,16 @@
|
||||
|
||||
namespace App\Cells;
|
||||
|
||||
class ProductCell
|
||||
use App\Cells\BaseCell;
|
||||
|
||||
class ProductCell extends BaseCell
|
||||
{
|
||||
public function virtual_calculator(array $viewDatas): string
|
||||
{
|
||||
$viewDatas['cellDatas']=array();
|
||||
$viewDatas['cellDatas'] = array();
|
||||
return view(
|
||||
'Views/front/product/cell/' . __FUNCTION__,
|
||||
['viewDatas'=>$viewDatas]
|
||||
'Views/front/product/cell/' . __FUNCTION__,
|
||||
['viewDatas' => $viewDatas]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ use CodeIgniter\HTTP\Files\UploadedFile;
|
||||
trait UpDownloadTrait
|
||||
{
|
||||
//Upload FIle관련
|
||||
private function upDownload_file_process(UploadedFile $upfile): ?string
|
||||
private function upload_file_process(UploadedFile $upfile): ?string
|
||||
{
|
||||
$filename = null;
|
||||
$uploaded_filename = null;
|
||||
|
||||
@ -126,7 +126,7 @@ function getFieldIndex_Row_BillingHelper($field, $entity, array $viewDatas): str
|
||||
case 'title':
|
||||
case 'name':
|
||||
return anchor(
|
||||
current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(),
|
||||
current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey(),
|
||||
$value,
|
||||
["target" => "_self"]
|
||||
);
|
||||
|
||||
@ -130,12 +130,12 @@ function getFieldIndex_Row_BoardHelper($field, $entity, array $viewDatas): strin
|
||||
$depth .= " ";
|
||||
}
|
||||
$reply = anchor(
|
||||
current_url() . '/reply/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(),
|
||||
current_url() . '/reply/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey(),
|
||||
ICONS['REPLY'],
|
||||
["target" => "_self"]
|
||||
);
|
||||
$view = anchor(
|
||||
current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(),
|
||||
current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey(),
|
||||
$value,
|
||||
["target" => "_self"]
|
||||
);
|
||||
@ -147,7 +147,7 @@ function getFieldIndex_Row_BoardHelper($field, $entity, array $viewDatas): strin
|
||||
base_url() .
|
||||
$viewDatas['control'] .
|
||||
"/board/download/{$field}/{$entity->getPrimaryKey()}" .
|
||||
'?category=' . $viewDatas['category']->getPrimaryKey(),
|
||||
'?category=' . $viewDatas['currentCategory']->getPrimaryKey(),
|
||||
$field
|
||||
);
|
||||
break;
|
||||
@ -157,6 +157,25 @@ function getFieldIndex_Row_BoardHelper($field, $entity, array $viewDatas): strin
|
||||
}
|
||||
} //
|
||||
|
||||
//Front용
|
||||
function getFieldCell_Row_BoardHelper($field, $entity, array $viewDatas): string
|
||||
{
|
||||
$value = $entity->$field ?: DEFAULTS['EMPTY'];
|
||||
switch ($field) {
|
||||
case 'title':
|
||||
case 'name':
|
||||
return anchor(
|
||||
$viewDatas['currentCategory']->linkurl . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey(),
|
||||
$value,
|
||||
["target" => "_self"]
|
||||
);
|
||||
break;
|
||||
default:
|
||||
return getFieldView_BoardHelper($field, $entity, $viewDatas);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
//Admin용
|
||||
function getFieldIndex_Row_BoardHelper_Admin($field, $entity, array $viewDatas): string
|
||||
{
|
||||
|
||||
@ -137,7 +137,7 @@ function getFieldIndex_Row_OrderHelper($field, $entity, array $viewDatas): strin
|
||||
case 'name':
|
||||
$uid = lang("{$viewDatas['className']}.label.uid") . ' : ' . str_split($entity->getPrimaryKey(), 4)[0] . '-xx-' . str_split($entity->getPrimaryKey(), 4)[1];
|
||||
$title = anchor(
|
||||
current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(),
|
||||
current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey(),
|
||||
$value,
|
||||
["target" => "_self"]
|
||||
);
|
||||
|
||||
@ -141,7 +141,7 @@ function getFieldIndex_Row_ProductHelper($field, $entity, array $viewDatas): str
|
||||
case 'title':
|
||||
case 'name':
|
||||
return anchor(
|
||||
current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['category']->getPrimaryKey(),
|
||||
current_url() . '/view/' . $entity->getPrimaryKey() . '?category=' . $viewDatas['currentCategory']->getPrimaryKey(),
|
||||
$value,
|
||||
["target" => "_self"]
|
||||
);
|
||||
|
||||
@ -73,18 +73,34 @@ abstract class BaseModel extends Model
|
||||
{
|
||||
return $this->where($conditions)->findAll();
|
||||
}
|
||||
final public function getUUID()
|
||||
{
|
||||
$randomBytes = bin2hex(random_bytes(32));
|
||||
return sprintf(
|
||||
'%08s-%04s-%04x-%04x-%12s',
|
||||
substr($randomBytes, 0, 8),
|
||||
substr($randomBytes, 8, 4),
|
||||
substr($randomBytes, 12, 4),
|
||||
substr($randomBytes, 16, 4),
|
||||
substr($randomBytes, 20, 12)
|
||||
);
|
||||
}
|
||||
final protected function getUUIDFieldRule($condition = 'required'): string
|
||||
{
|
||||
return "{$condition}|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]";
|
||||
}
|
||||
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] = $this->getUUIDFieldRule();
|
||||
$rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
}
|
||||
break;
|
||||
case "user_uid":
|
||||
$rules[$field] = "if_exist|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]";
|
||||
$rules[$field] = $this->getUUIDFieldRule('if_exist');
|
||||
break;
|
||||
case "passwd":
|
||||
$rules[$field] = "if_exist|trim|string";
|
||||
@ -167,19 +183,6 @@ abstract class BaseModel extends Model
|
||||
// return $fieldFormOptions;
|
||||
// }
|
||||
|
||||
final public function getUUID()
|
||||
{
|
||||
$randomBytes = bin2hex(random_bytes(16));
|
||||
return sprintf(
|
||||
"%s-%s-%s-%s-%s",
|
||||
substr($randomBytes, 0, 8),
|
||||
substr($randomBytes, 8, 4),
|
||||
substr($randomBytes, 12, 4),
|
||||
substr($randomBytes, 16, 4),
|
||||
substr($randomBytes, 20)
|
||||
);
|
||||
}
|
||||
|
||||
//create , modify 직전 작업용 작업
|
||||
protected function changeFormData(string $action, string $field, array $formDatas, $entity)
|
||||
{
|
||||
|
||||
@ -32,7 +32,10 @@ class BoardModel extends BaseHierarchyModel
|
||||
{
|
||||
switch ($field) {
|
||||
case "category_uid":
|
||||
$rules[$field] = "required|numeric";
|
||||
$rules[$field] = "required|string";
|
||||
break;
|
||||
case "user_uid":
|
||||
$rules[$field] = $this->getUUIDFieldRule('required');
|
||||
break;
|
||||
case $this->getTitleField():
|
||||
case "content":
|
||||
|
||||
@ -29,6 +29,9 @@ class CategoryModel extends BaseHierarchyModel
|
||||
public function getFieldRule(string $field, array $rules, string $action = ""): array
|
||||
{
|
||||
switch ($field) {
|
||||
case $this->primaryKey:
|
||||
$rules[$field] = "required|string";
|
||||
break;
|
||||
case $this->getTitleField():
|
||||
$rules[$field] = "required|trim|string";
|
||||
$rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : "";
|
||||
|
||||
@ -23,8 +23,8 @@ class OrderBillingModel extends BaseModel
|
||||
public function getFieldRule(string $field, array $rules, string $action = ""): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'order_uid':
|
||||
$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}/]";
|
||||
case "order_uid":
|
||||
$rules[$field] = $this->getUUIDFieldRule('required');
|
||||
break;
|
||||
case 'billing_uid':
|
||||
$rules[$field] = "required|numeric";
|
||||
|
||||
@ -28,8 +28,8 @@ class OrderModel extends BaseModel
|
||||
public function getFieldRule(string $field, array $rules, string $action = ""): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'product_uid':
|
||||
$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}/]";
|
||||
case "product_uid":
|
||||
$rules[$field] = $this->getUUIDFieldRule('required');
|
||||
break;
|
||||
case $this->getTitleField():
|
||||
$rules[$field] = "required|trim|string";
|
||||
|
||||
@ -32,10 +32,10 @@ class ProductModel extends BaseModel
|
||||
{
|
||||
switch ($field) {
|
||||
case "category_uid":
|
||||
$rules[$field] = "required|numeric";
|
||||
$rules[$field] = "required|string";
|
||||
break;
|
||||
case "user_uid":
|
||||
$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] = $this->getUUIDFieldRule('required');
|
||||
break;
|
||||
case $this->getTitleField():
|
||||
$rules[$field] = "required|trim|string";
|
||||
|
||||
@ -32,7 +32,10 @@ class SitepageModel extends BaseModel
|
||||
{
|
||||
switch ($field) {
|
||||
case "category_uid":
|
||||
$rules[$field] = "required|numeric";
|
||||
$rules[$field] = "required|string";
|
||||
break;
|
||||
case "user_uid":
|
||||
$rules[$field] = $this->getUUIDFieldRule('required');
|
||||
break;
|
||||
case $this->getTitleField():
|
||||
case "content":
|
||||
|
||||
@ -1,11 +1,5 @@
|
||||
<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>
|
||||
<?php foreach ($viewDatas['cellDatas']['entitys'] as $entity) : ?>
|
||||
<?php foreach (['title', 'created_at'] as $field) : ?>
|
||||
<?= getFieldCell_Row_BoardHelper($field, $entity, $viewDatas) ?>
|
||||
<?php endforeach ?>
|
||||
<?php endforeach ?>
|
||||
@ -7,7 +7,7 @@
|
||||
<div class="title"><?= $viewDatas['menus'][$viewDatas['currentCategory']->parent]['entity']->getTitle() ?></div>
|
||||
</div>
|
||||
<?php foreach ($viewDatas['menus'][$viewDatas['currentCategory']->parent]['childs'] as $child) : ?>
|
||||
<div class="sibling ">
|
||||
<div class="sibling <?= $child->getPrimaryKey() == $viewDatas['category'] ? "active" : "" ?>">
|
||||
<a href="<?= $child->linkurl ?>?category=<?= $child->getPrimaryKey() ?>" target="_self"><?= $child->getTitle() ?></a><span class="play"><i class="bi bi-play-fill"></i></span>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="navbarDarkDropdownMenuLink">
|
||||
<?php foreach ($viewDatas['menus'][$menu_key]['childs'] as $child) : ?>
|
||||
<li><a class="dropdown-item <?= $child->getPrimaryKey() == $viewDatas['category'] ? "active" : "" ?>" href="<?= $child->linkurl ?>?category=<?= $child->getPrimaryKey() ?>"><?= $child->getTitle() ?></a></li>
|
||||
<li class="<?= $child->getPrimaryKey() == $viewDatas['category'] ? "active" : "" ?>"><a class=" dropdown-item" href="<?= $child->linkurl ?>?category=<?= $child->getPrimaryKey() ?>"><?= $child->getTitle() ?></a></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@ -29,6 +29,9 @@ div#left_menu div.sibling {
|
||||
height:60px;
|
||||
border-bottom:1px solid silver;
|
||||
}
|
||||
div#left_menu div.active {
|
||||
background-color:#26417D;
|
||||
}
|
||||
div#left_menu div.sibling a{
|
||||
text-decoration: none;
|
||||
color:black;
|
||||
|
||||
@ -54,8 +54,12 @@
|
||||
text-align:center;
|
||||
text-decoration:none;
|
||||
}
|
||||
#top_menu div.dropdown-center ul.navbar-nav li.dropdown ul.dropdown-menu li a.active{
|
||||
color:#efefef;
|
||||
#top_menu div.dropdown-center ul.navbar-nav li.dropdown ul.dropdown-menu li.active{
|
||||
background-color:#26417D;
|
||||
/* border:1px solid red; */
|
||||
}
|
||||
#top_menu div.dropdown-center ul.navbar-nav li.dropdown ul.dropdown-menu li.active a{
|
||||
color:white;
|
||||
background-color:#26417D;
|
||||
/* border:1px solid red; */
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user