dbms_primeidc_init...1
This commit is contained in:
parent
414f3800fa
commit
6e3182a07a
@ -5,58 +5,136 @@ require_once 'function.php';
|
||||
require_once 'lib.php';
|
||||
?>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: 'FontAwesome';
|
||||
src: url('/font/fontawesome-webfont.eot?v=4.0.3');
|
||||
src: url('/font/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'),
|
||||
url('/font/fontawesome-webfont.woff?v=4.0.3') format('woff'),
|
||||
url('/font/fontawesome-webfont.ttf?v=4.0.3') format('truetype'),
|
||||
url('/font/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'FontAwesome';
|
||||
src: url('/font/fontawesome-webfont.eot?v=4.0.3');
|
||||
src: url('/font/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'),
|
||||
url('/font/fontawesome-webfont.woff?v=4.0.3') format('woff'),
|
||||
url('/font/fontawesome-webfont.ttf?v=4.0.3') format('truetype'),
|
||||
url('/font/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
div#mk_df_title {width:100%;background-color:#24a2e0;color:white;font-size:15px;}
|
||||
div#mk_df_title {
|
||||
width: 100%;
|
||||
background-color: #24a2e0;
|
||||
color: white;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.table-ul {background-color: skyblue;display: table;table-layout: fixed;text-align: center;width: 100%;}
|
||||
.table-ul li {border-right: 1px solid #fff;display: table-cell;vertical-align: middle;height: 40px;}
|
||||
.table-ul li:last-child {border-right: 0;}
|
||||
.table-ul li a {color: #fff;display: block;font-size: 10px;text-decoration: none;}
|
||||
.table-ul {
|
||||
background-color: skyblue;
|
||||
display: table;
|
||||
table-layout: fixed;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#active {background-color: #24a2e0;color: #fff;}
|
||||
.icon-CS방어:before {color: #fff;content:"\f021";font-family: "FontAwesome";}
|
||||
.icon-CS방어:hover {background-color:#24a2e0;color: #fff;}
|
||||
.table-ul li {
|
||||
border-right: 1px solid #fff;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.icon-CS-PRE:before {color: #fff;content:"\f021";font-family: "FontAwesome";}
|
||||
.icon-CS-PRE:hover {background-color:#24a2e0;color: #fff;}
|
||||
.table-ul li:last-child {
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
.icon-CF방어:before {color: #fff;content:"\f021";font-family: "FontAwesome";}
|
||||
.icon-CF방어:hover {background-color:#24a2e0;color: #fff;}
|
||||
.table-ul li a {
|
||||
color: #fff;
|
||||
display: block;
|
||||
font-size: 10px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.icon-BL상시:before {color: #fff;content:"\f021";font-family: "FontAwesome";}
|
||||
.icon-BL상시:hover {background-color:#24a2e0;color: #fff;}
|
||||
#active {
|
||||
background-color: #24a2e0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.icon-인증방어:before {color: #fff;content:"\f021";font-family: "FontAwesome";}
|
||||
.icon-인증방어:hover {background-color:#24a2e0;color: #fff;}
|
||||
.icon-CS방어:before {
|
||||
color: #fff;
|
||||
content: "\f021";
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
|
||||
.icon-MGTK:before {color: #fff;content:"\f021";font-family: "FontAwesome";}
|
||||
.icon-MGTK:hover {background-color:#24a2e0;color: #fff;}
|
||||
.icon-CS방어:hover {
|
||||
background-color: #24a2e0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.icon-CS-PRE:before {
|
||||
color: #fff;
|
||||
content: "\f021";
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
|
||||
.icon-CS-PRE:hover {
|
||||
background-color: #24a2e0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.icon-CF방어:before {
|
||||
color: #fff;
|
||||
content: "\f021";
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
|
||||
.icon-CF방어:hover {
|
||||
background-color: #24a2e0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.icon-BL상시:before {
|
||||
color: #fff;
|
||||
content: "\f021";
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
|
||||
.icon-BL상시:hover {
|
||||
background-color: #24a2e0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.icon-인증방어:before {
|
||||
color: #fff;
|
||||
content: "\f021";
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
|
||||
.icon-인증방어:hover {
|
||||
background-color: #24a2e0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.icon-MGTK:before {
|
||||
color: #fff;
|
||||
content: "\f021";
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
|
||||
.icon-MGTK:hover {
|
||||
background-color: #24a2e0;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?
|
||||
$zonequery = "select * from defensemk where depth = '1' order by idx asc";
|
||||
$zoneresult = @mysql_query($zonequery, $db_connect) or die($db_q_error);
|
||||
$zone_num = mysql_num_rows($zoneresult);
|
||||
?>
|
||||
<ul class="table-ul">
|
||||
<?
|
||||
for ($i = 0; $i < $zone_num; $i++) {
|
||||
$zonedata = mysql_fetch_assoc($zoneresult);
|
||||
<?
|
||||
for ($i = 0; $i < $zone_num; $i++) {
|
||||
$zonedata = mysql_fetch_assoc($zoneresult);
|
||||
?>
|
||||
<li class="icon-<?=$zonedata[zone]?>" id='<?if ($zonedata[zone] == $_GET[zone]) {echo "active";}?>' onclick="location.href='/DefenseInfoMK.sev?zone=<?=$zonedata[zone]?>';"><br><?=$zonedata[zone]?></li>
|
||||
<li class="icon-<?= $zonedata[zone] ?>" id='<? if ($zonedata[zone] == $_GET[zone]) {
|
||||
echo "active";
|
||||
} ?>' onclick="location.href='/DefenseInfoMK.sev?zone=<?= $zonedata[zone] ?>';"><br><?= $zonedata[zone] ?></li>
|
||||
|
||||
<?}?>
|
||||
<? } ?>
|
||||
</ul>
|
||||
|
||||
<?
|
||||
@ -65,50 +143,51 @@ $parentsresult = @mysql_query($parentsquery, $db_connect) or die($db_q_error);
|
||||
$parents_num = mysql_num_rows($parentsresult);
|
||||
for ($j = 0; $j < $parents_num; $j++) {
|
||||
$parentsdata = mysql_fetch_assoc($parentsresult);
|
||||
?>
|
||||
<div id=mk_df_title>
|
||||
<?=$parentsdata[parents]?> / <?=$parentsdata[real_address]?>
|
||||
<button style="color:black;cursor: pointer;" onclick="location.href='/DefenseNewMK.sev?zone=<?=$_GET['zone']?>&parents=<?=$parentsdata[parents]?>';">등록</button>
|
||||
</div>
|
||||
<?
|
||||
?>
|
||||
<div id=mk_df_title>
|
||||
<?= $parentsdata[parents] ?> / <?= $parentsdata[real_address] ?>
|
||||
<button style="color:black;cursor: pointer;" onclick="location.href='/DefenseNewMK.sev?zone=<?= $_GET['zone'] ?>&parents=<?= $parentsdata[parents] ?>';">등록</button>
|
||||
</div>
|
||||
<?
|
||||
$childquery = "select * from defensemk where depth = '3' and zone = '" . $_GET['zone'] . "' and parents = '" . $parentsdata[parents] . "' order by parents asc";
|
||||
$childresult = @mysql_query($childquery, $db_connect) or die($db_q_error);
|
||||
$child_num = mysql_num_rows($childresult);
|
||||
?>
|
||||
<?
|
||||
<?
|
||||
for ($k = 0; $k < $child_num; $k++) {
|
||||
$childdata = mysql_fetch_assoc($childresult);
|
||||
$childidx = $childdata[idx];
|
||||
?>
|
||||
<li>
|
||||
<?=$childdata[child] . " / " . $childdata[cs_code] . " / " . $childdata[cs_ip] . " / " . $childdata[server_code] . " / " . $childdata[server_ip] . " / " . $childdata[setup_domain] . " / " . $childdata[setup_firewall] . " / " . $childdata[register_date] . " / " . $childdata[worker]?> - <a href=/DefenseModifyMK.sev?child=<?=$childidx?>>수정</a>
|
||||
</li>
|
||||
<?}?>
|
||||
<!--
|
||||
<td><?=$parentsdata[parents]?></td>
|
||||
<td><?=$parentsdata[acl_address]?></td>
|
||||
<td><?=$parentsdata[real_address]?></td>
|
||||
?>
|
||||
<li>
|
||||
<?= $childdata[child] . " / " . $childdata[cs_code] . " / " . $childdata[cs_ip] . " / " . $childdata[server_code] . " / " . $childdata[server_ip] . " / " . $childdata[setup_domain] . " / " . $childdata[setup_firewall] . " / " . $childdata[register_date] . " / " . $childdata[worker] ?> - <a href=/DefenseModifyMK.sev?child=<?= $childidx ?>>수정</a>
|
||||
</li>
|
||||
<? } ?>
|
||||
<!--
|
||||
<td><?= $parentsdata[parents] ?></td>
|
||||
<td><?= $parentsdata[acl_address] ?></td>
|
||||
<td><?= $parentsdata[real_address] ?></td>
|
||||
-->
|
||||
|
||||
<?}?>
|
||||
<? } ?>
|
||||
|
||||
<style>
|
||||
.123img {
|
||||
width:800px;
|
||||
height:300px;
|
||||
}
|
||||
.123mk1 {
|
||||
border: 10px solid red;
|
||||
}
|
||||
.123img {
|
||||
width: 800px;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.mk1123 {
|
||||
opacity: 0.4;
|
||||
filter: alpha(opacity=40);
|
||||
}
|
||||
.123mk1 {
|
||||
border: 10px solid red;
|
||||
}
|
||||
|
||||
.mk1123 {
|
||||
opacity: 0.4;
|
||||
filter: alpha(opacity=40);
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--<img id="mk1" class="mk1" src="http://www.iknowjay.xyz/2.jpg" >-->
|
||||
<?
|
||||
//DB닫기
|
||||
mysql_close($db_connect);
|
||||
?>
|
||||
?>
|
||||
32
extdbms/lib/Controllers/DBMS/DefenceController.php
Normal file
32
extdbms/lib/Controllers/DBMS/DefenceController.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace lib\Controllers\DBMS;
|
||||
|
||||
use lib\Services\DefenceService;
|
||||
|
||||
class DefenceController extends BaseController
|
||||
{
|
||||
private ?DefenceService $_clientService = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->getView()->setPath('defence');
|
||||
} //
|
||||
public function getDefenceService(): DefenceService
|
||||
{
|
||||
if ($this->_clientService === null) {
|
||||
$this->_clientService = new DefenceService();
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
|
||||
//방어 defense_index.php
|
||||
//CLI 접속방법 : php index.php site/defence/mk/zone/존/parent/부모키/child/자식키
|
||||
//WEB 접속방법 : http://localhostsite/defence/mk/zone/존/parent/부모키/child/자식키
|
||||
public function mk(): string
|
||||
{
|
||||
$this->request = $this->getRequest();
|
||||
$this->entities = $this->getDefenceService()->getMKList($this->getRequest('zone'));
|
||||
return $this->render(__FUNCTION__);
|
||||
}
|
||||
} //Class
|
||||
@ -30,7 +30,7 @@ class NavigatorController extends BaseController
|
||||
{
|
||||
//전체 고객정보
|
||||
$this->clients = $this->getClientService()->getEntities();
|
||||
$ip = $this->getRequest('ip');
|
||||
$ip = $this->getRequest('ip') ?? '';
|
||||
//IP형식이 ipv4인지 확인 후 값가져오기
|
||||
$services = [];
|
||||
if ($ip && $this->helper->isIPAddress($ip)) {
|
||||
|
||||
@ -38,15 +38,27 @@ abstract class Controller
|
||||
}
|
||||
return array_key_exists($key, $this->_segments) ? $this->_segments[$key] : null;
|
||||
}
|
||||
final public function getRequest(mixed $key = null, string $method = "GET"): mixed
|
||||
final public function getRequest(mixed $key = null, mixed $method = null): mixed
|
||||
{
|
||||
$requestDatas = $method === "POST" ? $_POST : $_GET;
|
||||
$result = null;
|
||||
if (!$key)
|
||||
$result = $requestDatas;
|
||||
else
|
||||
$result = array_key_exists($key, $requestDatas) ? $requestDatas[$key] : null;
|
||||
return $result;
|
||||
if ($this->_request === null) {
|
||||
$this->_request = match (strtoupper($method)) {
|
||||
"POST" => $_POST,
|
||||
"GET" => $_GET,
|
||||
default => $_REQUEST,
|
||||
};
|
||||
}
|
||||
if ($key === null) {
|
||||
return $this->_request;
|
||||
}
|
||||
return array_key_exists($key, $this->_request) ? $this->_request[$key] : null;
|
||||
}
|
||||
final public function getPost(mixed $key = null): mixed
|
||||
{
|
||||
return $this->getRequest($key, "POST");
|
||||
}
|
||||
final public function getGet(mixed $key = null): mixed
|
||||
{
|
||||
return $this->getRequest($key, "GET");
|
||||
}
|
||||
public function render(string $path)
|
||||
{
|
||||
|
||||
@ -11,12 +11,12 @@ abstract class Model
|
||||
private $_db = null;
|
||||
private $_debug = false;
|
||||
private $_reset = true;
|
||||
private $_querys = [];
|
||||
private $_querys = ['SELECT' => 'SELECT *', 'JOIN' => [], 'ORDERBY' => [], 'LIMIT' => ''];
|
||||
private $_wheres = [];
|
||||
private $_lastQuery = "";
|
||||
protected function __construct()
|
||||
{
|
||||
$this->reset();
|
||||
$this->init();
|
||||
} //
|
||||
abstract public function getTable(): string;
|
||||
abstract public function getPKField(): string;
|
||||
@ -39,7 +39,7 @@ abstract class Model
|
||||
throw new \Exception("❌ DB 연결 실패: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
$this->reset();
|
||||
$this->init();
|
||||
return $this->_db;
|
||||
}
|
||||
final public function setDebug($debug)
|
||||
@ -50,48 +50,56 @@ abstract class Model
|
||||
{
|
||||
return $this->_debug;
|
||||
}
|
||||
private function reset(): void
|
||||
private function init(): void
|
||||
{
|
||||
$debug = $_ENV['DATABASE_QUERY_DEBUG'] ?? $_SERVER['DATABASE_QUERY_DEBUG'] ?? 'false';
|
||||
if ($debug === "true") {
|
||||
$this->_debug = true;
|
||||
}
|
||||
$this->_reset = true;
|
||||
$this->_querys = ['SELECT' => 'SELECT *', 'JOIN' => [], 'ORDERBY' => [], 'LIMIT' => ''];
|
||||
$this->_wheres = [];
|
||||
$this->_querys = ["SELECT" => "SELECT *", "JOIN" => "", "ORDERBY" => "", "LIMIT" => ""];
|
||||
$this->_lastQuery = "";
|
||||
}
|
||||
final public function getLastQuery(): string
|
||||
{
|
||||
return $this->_lastQuery;
|
||||
}
|
||||
private function makeValue(mixed $values): string|null
|
||||
|
||||
//Where절관련
|
||||
private function getWhereValue(mixed $datas, $delimeter = ","): string
|
||||
{
|
||||
if ($values === null) {
|
||||
return $values;
|
||||
$value = "";
|
||||
if ($datas === null) {
|
||||
return "NULL";
|
||||
}
|
||||
$temps = [];
|
||||
if (is_array($values)) {
|
||||
foreach ($values as $value) {
|
||||
$temps[] = is_string($value) ? "'{$value}'" : $value;
|
||||
if (is_array($datas)) {
|
||||
$temps = [];
|
||||
foreach ($datas as $data) {
|
||||
$data = trim($data);
|
||||
$temps[] = is_string($data) ? "'{$data}'" : $data;
|
||||
}
|
||||
$value = implode($delimeter, $temps);
|
||||
} else {
|
||||
$temps[] = is_string($values) ? "'{$values}'" : $values;
|
||||
$value = is_string($datas) ? "'{$datas}'" : $datas;
|
||||
}
|
||||
return implode(",", $temps);
|
||||
return $value;
|
||||
}
|
||||
final public function makeWhere(mixed $columns, mixed $values = null, $delimeter = ","): string
|
||||
private function getWhereColumn(mixed $columns, mixed $datas = null): string
|
||||
{
|
||||
$temps = [];
|
||||
if (is_array($columns)) {
|
||||
foreach ($columns as $column => $value) {
|
||||
$value = $this->makeValue($value);
|
||||
$temps[] = sprintf("%s%s", $column, $value === null ? "" : "=" . $value);
|
||||
//복합배열형태로 들어온 경우
|
||||
foreach ($columns as $column => $data) {
|
||||
$value = $this->getWhereValue($data);
|
||||
$temps[] = "{$column}={$value}";
|
||||
}
|
||||
} else {
|
||||
$value = $this->makeValue($values);
|
||||
$temps[] = sprintf("%s%s", $columns, $value === null ? "" : "=" . $value);
|
||||
$value = $this->getWhereValue($datas);
|
||||
$temps[] = "{$columns}={$value}";
|
||||
}
|
||||
// throw new \Exception("DATA:" . $columns . $value === null ? "NULL" : $value);
|
||||
return implode($delimeter . " ", $temps);
|
||||
return implode(" ", $temps);
|
||||
}
|
||||
final public function getWhere(): string
|
||||
{
|
||||
@ -100,23 +108,14 @@ abstract class Model
|
||||
|
||||
final public function where(mixed $columns, mixed $values = null, string $delimeter = "AND"): void
|
||||
{
|
||||
$query = $this->makeWhere($columns, $values, $delimeter);
|
||||
$query = $this->getWhereColumn($columns, $values);
|
||||
$this->_wheres[] = count($this->_wheres) ? $delimeter . " " . $query : $query;
|
||||
}
|
||||
final public function orWhere(mixed $columns, mixed $values = null, string $delimeter = "OR"): void
|
||||
{
|
||||
$this->where($columns, $values, $delimeter);
|
||||
}
|
||||
final public function whereIn(string $column, array $values, string $delimeter = "AND", $range = "IN")
|
||||
{
|
||||
$query = " {$column} {$range} (" . $this->makeValue($values) . ")";
|
||||
$this->_wheres[] = count($this->_wheres) ? $delimeter . " " . $query : $query;
|
||||
}
|
||||
final public function whereNotIn(string $column, array $values, string $delimeter = "AND", $range = "NOT IN")
|
||||
{
|
||||
$this->whereIn($column, $values, $delimeter, $range);
|
||||
}
|
||||
final public function like(string $column, string $value, string $option = "both"): void
|
||||
final public function whereLike(string $column, string $value, string $option = "both", string $delimeter = "AND"): void
|
||||
{
|
||||
switch ($option) {
|
||||
case 'before':
|
||||
@ -129,7 +128,20 @@ abstract class Model
|
||||
$value = "%{$value}%";
|
||||
break;
|
||||
}
|
||||
$this->_wheres[] = "{$column} LIKE '{$value}'";
|
||||
$this->where("{$column} LIKE '{$value}'", null, $delimeter);
|
||||
}
|
||||
final public function orWhereLike(string $column, string $value, string $option = "both", string $delimeter = "OR"): void
|
||||
{
|
||||
$this->whereLike($column, $value, $option, $delimeter);
|
||||
}
|
||||
final public function whereIn(string $column, array $values, string $delimeter = "AND", $range = "IN")
|
||||
{
|
||||
$query = " {$column} {$range} (" . $this->getWhereValue($values) . ")";
|
||||
$this->_wheres[] = count($this->_wheres) ? $delimeter . " " . $query : $query;
|
||||
}
|
||||
final public function whereNotIn(string $column, array $values, string $delimeter = "AND", $range = "NOT IN")
|
||||
{
|
||||
$this->whereIn($column, $values, $delimeter, $range);
|
||||
}
|
||||
|
||||
final public function execute(string $query): bool|PDOStatement
|
||||
@ -141,7 +153,7 @@ abstract class Model
|
||||
$stmt = $this->getConnect()->prepare($query);
|
||||
$stmt->execute();
|
||||
if ($this->_reset) {
|
||||
$this->reset();
|
||||
$this->init();
|
||||
}
|
||||
return $stmt;
|
||||
}
|
||||
@ -149,12 +161,12 @@ abstract class Model
|
||||
//CURD문
|
||||
final protected function create_process(mixed $columns, mixed $values = null): bool|PDOStatement
|
||||
{
|
||||
$query = sprintf("INSERT INTO %s VALUES(%s) %s", $this->getTable(), $this->makeWhere($columns, $values), $this->getWhere());
|
||||
$query = sprintf("INSERT INTO %s VALUES(%s) %s", $this->getTable(), $this->getWhereColumn($columns, $values), $this->getWhere());
|
||||
return $this->execute($query);
|
||||
} //
|
||||
final protected function modify_process(mixed $columns, mixed $values = null): bool|PDOStatement
|
||||
{
|
||||
$query = sprintf("UPDATE %s SET %s %s", $this->getTable(), $this->makeWhere($columns, $values), $this->getWhere());
|
||||
$query = sprintf("UPDATE %s SET %s %s", $this->getTable(), $this->getWhereColumn($columns, $values), $this->getWhere());
|
||||
return $this->execute($query);
|
||||
} //
|
||||
final protected function delete_process(): bool|PDOStatement
|
||||
@ -164,16 +176,25 @@ abstract class Model
|
||||
} //
|
||||
public function select(mixed $columns = "*"): void
|
||||
{
|
||||
$columns = is_array($columns) ? implode(",", $columns) : $columns;
|
||||
$columns = is_array($columns) ? implode(",", $columns) : $columns;
|
||||
$this->_querys["SELECT"] = "SELECT {$columns}";
|
||||
}
|
||||
final public function join(string $table, mixed $match = null, $type = ""): void
|
||||
//join_type : LEFT, RIGHT, INNER, OUTER
|
||||
final public function join(string $table, mixed $match = null, $join_type = ""): void
|
||||
{
|
||||
$this->_querys["JOIN"] = " {$type} JOIN {$table} ON {$match}";
|
||||
$this->_querys['JOIN'][] = " {$join_type} JOIN {$table} ON {$match}";
|
||||
}
|
||||
final public function orderBy(string $column, string $direction = "DESC"): void
|
||||
final public function orderBy(mixed $columns, string $default_direction = ""): void
|
||||
{
|
||||
$this->_querys["ORDERBY"] = " ORDER BY {$column} {$direction}";
|
||||
$orderBy = "";
|
||||
if (is_array($columns)) {
|
||||
foreach ($columns as $column => $direction) {
|
||||
$this->orderBy($column, $direction ?? $default_direction);
|
||||
}
|
||||
} else {
|
||||
$columns = "{$columns} {$default_direction}";
|
||||
}
|
||||
$this->_querys['ORDERBY'][] = $orderBy;
|
||||
}
|
||||
final public function limit(int $start, int $offset = 0): void
|
||||
{
|
||||
@ -182,24 +203,27 @@ abstract class Model
|
||||
}
|
||||
|
||||
//Result
|
||||
private function makeResultQuery(string $head, string $tail = ""): string
|
||||
private function getResultQuery(string $head, string $tail = ""): string
|
||||
{
|
||||
return "{$head} FROM {$this->getTable()} {$this->_querys['JOIN']} {$this->getWhere()} {$tail}";
|
||||
$join = count($this->_querys['JOIN']) ? implode(",", $this->_querys['JOIN']) : "";
|
||||
$where = $this->getWhere();
|
||||
$orderby = count($this->_querys['ORDERBY']) ? implode(",", $this->_querys['ORDERBY']) : "";
|
||||
return "{$head} FROM {$this->getTable()} {$join} {$where} {$tail} {$orderby} {$this->_querys['LIMIT']}";
|
||||
}
|
||||
public function getResult($mode = PDO::FETCH_ASSOC): mixed
|
||||
{
|
||||
$stmt = $this->execute($this->makeResultQuery($this->_querys['SELECT'], "{$this->_querys['ORDERBY']} {$this->_querys['LIMIT']}"));
|
||||
$stmt = $this->execute($this->getResultQuery($this->_querys['SELECT']));
|
||||
return $stmt->fetch($mode);
|
||||
}
|
||||
public function getResults($mode = PDO::FETCH_ASSOC): mixed
|
||||
{
|
||||
$stmt = $this->execute($this->makeResultQuery($this->_querys['SELECT'], "{$this->_querys['ORDERBY']} {$this->_querys['LIMIT']}"));
|
||||
$stmt = $this->execute($this->getResultQuery($this->_querys['SELECT']));
|
||||
return $stmt->fetchAll($mode);
|
||||
}
|
||||
final public function countAllResults(string $column = "*", $reset = true): int
|
||||
{
|
||||
$this->_reset = $reset;
|
||||
$stmt = $this->execute($this->makeResultQuery("SELECT COUNT({$column})"));
|
||||
$stmt = $this->execute($this->getResultQuery("SELECT COUNT({$column})"));
|
||||
$count = $stmt->fetchColumn(0);
|
||||
$this->_reset = true;
|
||||
return $count;
|
||||
|
||||
34
extdbms/lib/Entities/DefenceEntity.php
Normal file
34
extdbms/lib/Entities/DefenceEntity.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace lib\Entities;
|
||||
|
||||
use lib\Entities\CommonEntity as Entity;
|
||||
use lib\Models\DefenceModel as Model;
|
||||
|
||||
class DefenceEntity extends Entity
|
||||
{
|
||||
const PKField = Model::PKField;
|
||||
const TitleField = Model::TitleField;
|
||||
const PairField = Model::PairField;
|
||||
public function __construct($datas)
|
||||
{
|
||||
parent::__construct($datas);
|
||||
} //
|
||||
|
||||
public function getZone(): string
|
||||
{
|
||||
return $this->getTitle();
|
||||
} //
|
||||
public function getParent(): string
|
||||
{
|
||||
return $this->parents;
|
||||
} //
|
||||
public function getChild(): string
|
||||
{
|
||||
return $this->child;
|
||||
} //
|
||||
public function getRealAddress(): string
|
||||
{
|
||||
return $this->real_address;
|
||||
} //
|
||||
} //Class
|
||||
17
extdbms/lib/Models/DefenceModel.php
Normal file
17
extdbms/lib/Models/DefenceModel.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace lib\Models;
|
||||
|
||||
use lib\Models\CommonModel as Model;
|
||||
|
||||
class DefenceModel extends Model
|
||||
{
|
||||
const TABLE = "defensemk";
|
||||
const PKField = "idx";
|
||||
const TitleField = "zone";
|
||||
const PairField = self::PKField;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
} //
|
||||
} //Class
|
||||
38
extdbms/lib/Services/DefenceService.php
Normal file
38
extdbms/lib/Services/DefenceService.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace lib\Services;
|
||||
|
||||
use lib\Entities\DefenceEntity as Entity;
|
||||
use lib\Models\DefenceModel as Model;
|
||||
|
||||
class DefenceService extends CommonService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
final public function getClassName(): string
|
||||
{
|
||||
return "Defence";
|
||||
}
|
||||
final public function getClassPath(): string
|
||||
{
|
||||
return $this->getClassName();
|
||||
}
|
||||
public function getModelClass(): string
|
||||
{
|
||||
return Model::class;
|
||||
}
|
||||
public function getEntityClass(): string
|
||||
{
|
||||
return Entity::class;
|
||||
}
|
||||
|
||||
public function getMKList(mixed $zone = null): array
|
||||
{
|
||||
if ($zone !== null) {
|
||||
$this->getModel()->setWhere(['zone' => $zone]);
|
||||
}
|
||||
return $this->getModel()->orderBy(['zone' => 'asc', 'parent' => 'asc', 'child' => 'asc']);
|
||||
}
|
||||
}
|
||||
138
extdbms/lib/Views/dbms/defence/mk.php
Normal file
138
extdbms/lib/Views/dbms/defence/mk.php
Normal file
@ -0,0 +1,138 @@
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: 'FontAwesome';
|
||||
src: url('/font/fontawesome-webfont.eot?v=4.0.3');
|
||||
src: url('/font/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'),
|
||||
url('/font/fontawesome-webfont.woff?v=4.0.3') format('woff'),
|
||||
url('/font/fontawesome-webfont.ttf?v=4.0.3') format('truetype'),
|
||||
url('/font/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
div#mk_df_title {
|
||||
width: 100%;
|
||||
background-color: #24a2e0;
|
||||
color: white;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.table-ul {
|
||||
background-color: skyblue;
|
||||
display: table;
|
||||
table-layout: fixed;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.table-ul li {
|
||||
border-right: 1px solid #fff;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.table-ul li:last-child {
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
.table-ul li a {
|
||||
color: #fff;
|
||||
display: block;
|
||||
font-size: 10px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#active {
|
||||
background-color: #24a2e0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.icon-CS방어:before {
|
||||
color: #fff;
|
||||
content: "\f021";
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
|
||||
.icon-CS방어:hover {
|
||||
background-color: #24a2e0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.icon-CS-PRE:before {
|
||||
color: #fff;
|
||||
content: "\f021";
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
|
||||
.icon-CS-PRE:hover {
|
||||
background-color: #24a2e0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.icon-CF방어:before {
|
||||
color: #fff;
|
||||
content: "\f021";
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
|
||||
.icon-CF방어:hover {
|
||||
background-color: #24a2e0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.icon-BL상시:before {
|
||||
color: #fff;
|
||||
content: "\f021";
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
|
||||
.icon-BL상시:hover {
|
||||
background-color: #24a2e0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.icon-인증방어:before {
|
||||
color: #fff;
|
||||
content: "\f021";
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
|
||||
.icon-인증방어:hover {
|
||||
background-color: #24a2e0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.icon-MGTK:before {
|
||||
color: #fff;
|
||||
content: "\f021";
|
||||
font-family: "FontAwesome";
|
||||
}
|
||||
|
||||
.icon-MGTK:hover {
|
||||
background-color: #24a2e0;
|
||||
color: #fff;
|
||||
}
|
||||
</style>
|
||||
<ul class="table-ul">
|
||||
<?php foreach ($entities as $entity) { ?>
|
||||
<?php $zone = $entity->getZone() ?>
|
||||
<li class="icon-<?= $zone ?>" id='<?= $zone == $this->request['zone'] ? "active" : "" ?> onclick="location.href=' /DefenseInfoMK.sev?zone=<?= $zone ?>'"><?= $zone ?></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<style>
|
||||
.123img {
|
||||
width: 800px;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.123mk1 {
|
||||
border: 10px solid red;
|
||||
}
|
||||
|
||||
.mk1123 {
|
||||
opacity: 0.4;
|
||||
filter: alpha(opacity=40);
|
||||
}
|
||||
|
||||
</style
|
||||
Loading…
Reference in New Issue
Block a user