servermgrv2 init...
This commit is contained in:
parent
79985d0282
commit
c8c525d9b3
@ -114,6 +114,7 @@ define('LAYOUTS', [
|
||||
'<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' => [
|
||||
@ -132,7 +133,6 @@ define('LAYOUTS', [
|
||||
'<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="css/style.css" />',
|
||||
],
|
||||
'javascripts' => [
|
||||
|
||||
@ -98,9 +98,9 @@ $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:master,director,cloudflare,manager,gold,silver,brone,vip,user'], static function ($routes) {
|
||||
$routes->get('update', 'UserController::update_form');
|
||||
$routes->post('update', 'UserController::update');
|
||||
$routes->get('view', 'UserController::view');
|
||||
$routes->get('update/(:uuid)', 'UserController::update_form/$1');
|
||||
$routes->post('update/(:uuid)', 'UserController::update/R1');
|
||||
$routes->get('view/(:uuid)', 'UserController::view/$1');
|
||||
});
|
||||
$routes->group('board', static function ($routes) {
|
||||
$routes->get('', 'BoardController::index');
|
||||
|
||||
84
app/Controllers/Front/UserController.php
Normal file
84
app/Controllers/Front/UserController.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Front;
|
||||
|
||||
use App\Models\UserModel;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class UserController extends FrontController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
$this->_model = new UserModel();
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title');
|
||||
$this->_viewPath .= strtolower($this->_model->getClassName());
|
||||
helper($this->_model->getClassName());
|
||||
}
|
||||
|
||||
//Field별 Form Datas 처리용
|
||||
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;
|
||||
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 "index":
|
||||
case "excel":
|
||||
return ["id", 'name', "email", "role", "status", 'created_at'];
|
||||
break;
|
||||
case "view":
|
||||
return ["id", 'name', "email", "role", "status", 'updated_at', 'created_at'];
|
||||
break;
|
||||
default:
|
||||
return $fields;
|
||||
break;
|
||||
}
|
||||
}
|
||||
public function getFieldFilters(): array
|
||||
{
|
||||
return ["role", "status"];
|
||||
}
|
||||
public function getFieldBatchFilters(): array
|
||||
{
|
||||
return parent::getFieldBatchFilters();
|
||||
}
|
||||
|
||||
protected function insert_validate()
|
||||
{
|
||||
$rules = [];
|
||||
foreach ($this->_viewDatas['fieldRules'] as $field => $rule) {
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
$rules[$field . '.*'] = $rule;
|
||||
break;
|
||||
default:
|
||||
$rules[$field] = $rule;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//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);
|
||||
}
|
||||
}
|
||||
}
|
||||
45
app/Views/front/user/index.php
Normal file
45
app/Views/front/user/index.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?= $this->extend('layouts/admin') ?>
|
||||
<?= $this->section('content') ?>
|
||||
<div class="content">
|
||||
<div class="top">
|
||||
<?= form_open(current_url(), array("method" => "get")) ?>
|
||||
<ul class="nav">
|
||||
조건검색:<?php foreach ($fieldFilters as $field) : ?><li class="nav-item"><?= getFieldFilter_UserHelper($field, $$field, $fieldFormOptions) ?></li><?php endforeach; ?>
|
||||
<?= $this->include('templates/admin/index_head'); ?>
|
||||
</ul>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<?= form_open(current_url() . '/batchjob', $forms['attributes'], $forms['hiddens']) ?>
|
||||
<table class="table table-bordered table-hover table-striped">
|
||||
<tr>
|
||||
<th>번호</th>
|
||||
<?php foreach ($fields as $field) : ?><th><?= getFieldIndex_Column_UserHelper($field, $order_field, $order_value) ?></th><?php endforeach; ?>
|
||||
<th>작업</th>
|
||||
</tr>
|
||||
<?php $i = 0; ?>
|
||||
<?php foreach ($entitys as $entity) : ?>
|
||||
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);">
|
||||
<td>
|
||||
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
|
||||
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
|
||||
</td>
|
||||
<?php foreach ($fields as $field) : ?>
|
||||
<td nowrap><?= getFieldIndex_Row_UserHelper_Admin($field, $entity, $fieldFilters, $fieldFormOptions) ?></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 $i++; ?>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<div class="bottom">
|
||||
<ul class="nav justify-content-center">
|
||||
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
|
||||
<?php foreach ($batchjobFilters as $field) : ?><li class="nav-item"><?= getFieldFilter_UserHelper($field, DEFAULTS['EMPTY'], $fieldFormOptions) ?></li><?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>
|
||||
<?= $pagination ?>
|
||||
</div>
|
||||
<?= form_close(); ?>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
21
app/Views/front/user/update.php
Normal file
21
app/Views/front/user/update.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?= $this->extend('layouts/admin') ?>
|
||||
<?= $this->section('content') ?>
|
||||
<div class="content">
|
||||
<?= form_open_multipart(current_url(), $forms['attributes'], $forms['hiddens']) ?>
|
||||
<table class="form table table-bordered table-hover table-striped">
|
||||
<?php foreach ($fields as $field) : ?>
|
||||
<tr>
|
||||
<td class="label"><?= getFieldLabel_UserHelper($field, $fieldRules) ?></td>
|
||||
<td class="column">
|
||||
<?= getFieldForm_UserHelper($field, old($field, $entity->$field), $fieldFormOptions) ?>
|
||||
<?= 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>
|
||||
</div>
|
||||
<?= form_close(); ?>
|
||||
<?= $this->endSection() ?>
|
||||
16
app/Views/front/user/view.php
Normal file
16
app/Views/front/user/view.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?= $this->extend('layouts/admin') ?>
|
||||
<?= $this->section('content') ?>
|
||||
<div class="content">
|
||||
<table class="form table table-bordered table-hover table-striped">
|
||||
<?php foreach ($fields as $field) : ?>
|
||||
<tr>
|
||||
<td class="label"><?= getFieldLabel_UserHelper($field, $fieldRules) ?></td>
|
||||
<td class="column">
|
||||
<?= getFieldView_UserHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?>
|
||||
<?= validation_show_error($field); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?= $this->endSection() ?>
|
||||
@ -12,8 +12,8 @@
|
||||
<?= $javascript ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<link href="/css/admin.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="/js/admin.js"></script>
|
||||
<link href="/css/front.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="/js/front.js"></script>
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
/* ------------------------------------------------------------
|
||||
* Name : admin.css
|
||||
* Desc : Admin StyleSheet
|
||||
* Created : 2016/9/11 Tri-aBility by Junheum,Choi
|
||||
* Updated :
|
||||
------------------------------------------------------------ */
|
||||
* Name : admin.css
|
||||
* Desc : Admin StyleSheet
|
||||
* Created : 2016/9/11 Tri-aBility by Junheum,Choi
|
||||
* Updated :
|
||||
------------------------------------------------------------ */
|
||||
/* #head{
|
||||
border:1px solid blue;
|
||||
} */
|
||||
@ -30,22 +30,21 @@
|
||||
#layout #body div.header{
|
||||
/*content 상단라인*/
|
||||
padding:15px;
|
||||
border-left:1px solid silver;
|
||||
border-top:1px solid silver;
|
||||
border-left:1px solid silver;
|
||||
border-bottom:0px;
|
||||
border-right:1px solid silver;
|
||||
border-radius: 10px 10px 0px 0px;
|
||||
background-color:#efefef;
|
||||
}
|
||||
#layout #body div.content{
|
||||
/* border:1px solid blue; */
|
||||
/*content center 옆라인*/
|
||||
border-left:1px solid silver;
|
||||
border-right:1px solid silver;
|
||||
background-color:white
|
||||
border:1px solid silver;
|
||||
background-color:white;
|
||||
}
|
||||
#layout #body div.footer
|
||||
/*content 하단라인*/{
|
||||
height:20px;
|
||||
border-top:0px;
|
||||
border-left:1px solid silver;
|
||||
border-bottom:1px solid silver;
|
||||
border-right:1px solid silver;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user