dbms_primeidc_init...1

This commit is contained in:
최준흠 2025-04-04 19:01:47 +09:00
parent 414f3800fa
commit 6e3182a07a
9 changed files with 492 additions and 118 deletions

View File

@ -5,58 +5,136 @@ require_once 'function.php';
require_once 'lib.php'; require_once 'lib.php';
?> ?>
<style> <style>
@font-face { @font-face {
font-family: 'FontAwesome'; font-family: 'FontAwesome';
src: url('/font/fontawesome-webfont.eot?v=4.0.3'); src: url('/font/fontawesome-webfont.eot?v=4.0.3');
src: url('/font/fontawesome-webfont.eot?#iefix&v=4.0.3') format('embedded-opentype'), 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.woff?v=4.0.3') format('woff'),
url('/font/fontawesome-webfont.ttf?v=4.0.3') format('truetype'), url('/font/fontawesome-webfont.ttf?v=4.0.3') format('truetype'),
url('/font/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg'); url('/font/fontawesome-webfont.svg?v=4.0.3#fontawesomeregular') format('svg');
font-weight: normal; font-weight: normal;
font-style: 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 {
.table-ul li {border-right: 1px solid #fff;display: table-cell;vertical-align: middle;height: 40px;} background-color: skyblue;
.table-ul li:last-child {border-right: 0;} display: table;
.table-ul li a {color: #fff;display: block;font-size: 10px;text-decoration: none;} table-layout: fixed;
text-align: center;
width: 100%;
}
#active {background-color: #24a2e0;color: #fff;} .table-ul li {
.icon-CS방어:before {color: #fff;content:"\f021";font-family: "FontAwesome";} border-right: 1px solid #fff;
.icon-CS방어:hover {background-color:#24a2e0;color: #fff;} display: table-cell;
vertical-align: middle;
height: 40px;
}
.icon-CS-PRE:before {color: #fff;content:"\f021";font-family: "FontAwesome";} .table-ul li:last-child {
.icon-CS-PRE:hover {background-color:#24a2e0;color: #fff;} border-right: 0;
}
.icon-CF방어:before {color: #fff;content:"\f021";font-family: "FontAwesome";} .table-ul li a {
.icon-CF방어:hover {background-color:#24a2e0;color: #fff;} color: #fff;
display: block;
font-size: 10px;
text-decoration: none;
}
.icon-BL상시:before {color: #fff;content:"\f021";font-family: "FontAwesome";} #active {
.icon-BL상시:hover {background-color:#24a2e0;color: #fff;} background-color: #24a2e0;
color: #fff;
}
.icon-인증방어:before {color: #fff;content:"\f021";font-family: "FontAwesome";} .icon-CS방어:before {
.icon-인증방어:hover {background-color:#24a2e0;color: #fff;} color: #fff;
content: "\f021";
font-family: "FontAwesome";
}
.icon-MGTK:before {color: #fff;content:"\f021";font-family: "FontAwesome";} .icon-CS방어:hover {
.icon-MGTK:hover {background-color:#24a2e0;color: #fff;} 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> </style>
<? <?
$zonequery = "select * from defensemk where depth = '1' order by idx asc"; $zonequery = "select * from defensemk where depth = '1' order by idx asc";
$zoneresult = @mysql_query($zonequery, $db_connect) or die($db_q_error); $zoneresult = @mysql_query($zonequery, $db_connect) or die($db_q_error);
$zone_num = mysql_num_rows($zoneresult); $zone_num = mysql_num_rows($zoneresult);
?> ?>
<ul class="table-ul"> <ul class="table-ul">
<? <?
for ($i = 0; $i < $zone_num; $i++) { for ($i = 0; $i < $zone_num; $i++) {
$zonedata = mysql_fetch_assoc($zoneresult); $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> </ul>
<? <?
@ -65,50 +143,51 @@ $parentsresult = @mysql_query($parentsquery, $db_connect) or die($db_q_error);
$parents_num = mysql_num_rows($parentsresult); $parents_num = mysql_num_rows($parentsresult);
for ($j = 0; $j < $parents_num; $j++) { for ($j = 0; $j < $parents_num; $j++) {
$parentsdata = mysql_fetch_assoc($parentsresult); $parentsdata = mysql_fetch_assoc($parentsresult);
?> ?>
<div id=mk_df_title> <div id=mk_df_title>
<?=$parentsdata[parents]?> / <?=$parentsdata[real_address]?> <?= $parentsdata[parents] ?> / <?= $parentsdata[real_address] ?>
<button style="color:black;cursor: pointer;" onclick="location.href='/DefenseNewMK.sev?zone=<?=$_GET['zone']?>&parents=<?=$parentsdata[parents]?>';">등록</button> <button style="color:black;cursor: pointer;" onclick="location.href='/DefenseNewMK.sev?zone=<?= $_GET['zone'] ?>&parents=<?= $parentsdata[parents] ?>';">등록</button>
</div> </div>
<? <?
$childquery = "select * from defensemk where depth = '3' and zone = '" . $_GET['zone'] . "' and parents = '" . $parentsdata[parents] . "' order by parents asc"; $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); $childresult = @mysql_query($childquery, $db_connect) or die($db_q_error);
$child_num = mysql_num_rows($childresult); $child_num = mysql_num_rows($childresult);
?> ?>
<? <?
for ($k = 0; $k < $child_num; $k++) { for ($k = 0; $k < $child_num; $k++) {
$childdata = mysql_fetch_assoc($childresult); $childdata = mysql_fetch_assoc($childresult);
$childidx = $childdata[idx]; $childidx = $childdata[idx];
?> ?>
<li> <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> <?= $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> </li>
<?}?> <? } ?>
<!-- <!--
<td><?=$parentsdata[parents]?></td> <td><?= $parentsdata[parents] ?></td>
<td><?=$parentsdata[acl_address]?></td> <td><?= $parentsdata[acl_address] ?></td>
<td><?=$parentsdata[real_address]?></td> <td><?= $parentsdata[real_address] ?></td>
--> -->
<?}?> <? } ?>
<style> <style>
.123img { .123img {
width:800px; width: 800px;
height:300px; height: 300px;
} }
.123mk1 {
border: 10px solid red;
}
.mk1123 { .123mk1 {
opacity: 0.4; border: 10px solid red;
filter: alpha(opacity=40); }
}
.mk1123 {
opacity: 0.4;
filter: alpha(opacity=40);
}
</style> </style>
<!--<img id="mk1" class="mk1" src="http://www.iknowjay.xyz/2.jpg" >--> <!--<img id="mk1" class="mk1" src="http://www.iknowjay.xyz/2.jpg" >-->
<? <?
//DB닫기 //DB닫기
mysql_close($db_connect); mysql_close($db_connect);
?> ?>

View 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

View File

@ -30,7 +30,7 @@ class NavigatorController extends BaseController
{ {
//전체 고객정보 //전체 고객정보
$this->clients = $this->getClientService()->getEntities(); $this->clients = $this->getClientService()->getEntities();
$ip = $this->getRequest('ip'); $ip = $this->getRequest('ip') ?? '';
//IP형식이 ipv4인지 확인 후 값가져오기 //IP형식이 ipv4인지 확인 후 값가져오기
$services = []; $services = [];
if ($ip && $this->helper->isIPAddress($ip)) { if ($ip && $this->helper->isIPAddress($ip)) {

View File

@ -38,15 +38,27 @@ abstract class Controller
} }
return array_key_exists($key, $this->_segments) ? $this->_segments[$key] : null; 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; if ($this->_request === null) {
$result = null; $this->_request = match (strtoupper($method)) {
if (!$key) "POST" => $_POST,
$result = $requestDatas; "GET" => $_GET,
else default => $_REQUEST,
$result = array_key_exists($key, $requestDatas) ? $requestDatas[$key] : null; };
return $result; }
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) public function render(string $path)
{ {

View File

@ -11,12 +11,12 @@ abstract class Model
private $_db = null; private $_db = null;
private $_debug = false; private $_debug = false;
private $_reset = true; private $_reset = true;
private $_querys = []; private $_querys = ['SELECT' => 'SELECT *', 'JOIN' => [], 'ORDERBY' => [], 'LIMIT' => ''];
private $_wheres = []; private $_wheres = [];
private $_lastQuery = ""; private $_lastQuery = "";
protected function __construct() protected function __construct()
{ {
$this->reset(); $this->init();
} // } //
abstract public function getTable(): string; abstract public function getTable(): string;
abstract public function getPKField(): string; abstract public function getPKField(): string;
@ -39,7 +39,7 @@ abstract class Model
throw new \Exception("❌ DB 연결 실패: " . $e->getMessage()); throw new \Exception("❌ DB 연결 실패: " . $e->getMessage());
} }
} }
$this->reset(); $this->init();
return $this->_db; return $this->_db;
} }
final public function setDebug($debug) final public function setDebug($debug)
@ -50,48 +50,56 @@ abstract class Model
{ {
return $this->_debug; return $this->_debug;
} }
private function reset(): void private function init(): void
{ {
$debug = $_ENV['DATABASE_QUERY_DEBUG'] ?? $_SERVER['DATABASE_QUERY_DEBUG'] ?? 'false'; $debug = $_ENV['DATABASE_QUERY_DEBUG'] ?? $_SERVER['DATABASE_QUERY_DEBUG'] ?? 'false';
if ($debug === "true") { if ($debug === "true") {
$this->_debug = true; $this->_debug = true;
} }
$this->_reset = true;
$this->_querys = ['SELECT' => 'SELECT *', 'JOIN' => [], 'ORDERBY' => [], 'LIMIT' => ''];
$this->_wheres = []; $this->_wheres = [];
$this->_querys = ["SELECT" => "SELECT *", "JOIN" => "", "ORDERBY" => "", "LIMIT" => ""]; $this->_lastQuery = "";
} }
final public function getLastQuery(): string final public function getLastQuery(): string
{ {
return $this->_lastQuery; return $this->_lastQuery;
} }
private function makeValue(mixed $values): string|null
//Where절관련
private function getWhereValue(mixed $datas, $delimeter = ","): string
{ {
if ($values === null) { $value = "";
return $values; if ($datas === null) {
return "NULL";
} }
$temps = []; if (is_array($datas)) {
if (is_array($values)) { $temps = [];
foreach ($values as $value) { foreach ($datas as $data) {
$temps[] = is_string($value) ? "'{$value}'" : $value; $data = trim($data);
$temps[] = is_string($data) ? "'{$data}'" : $data;
} }
$value = implode($delimeter, $temps);
} else { } 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 = []; $temps = [];
if (is_array($columns)) { if (is_array($columns)) {
foreach ($columns as $column => $value) { //복합배열형태로 들어온 경우
$value = $this->makeValue($value); foreach ($columns as $column => $data) {
$temps[] = sprintf("%s%s", $column, $value === null ? "" : "=" . $value); $value = $this->getWhereValue($data);
$temps[] = "{$column}={$value}";
} }
} else { } else {
$value = $this->makeValue($values); $value = $this->getWhereValue($datas);
$temps[] = sprintf("%s%s", $columns, $value === null ? "" : "=" . $value); $temps[] = "{$columns}={$value}";
} }
// throw new \Exception("DATA:" . $columns . $value === null ? "NULL" : $value); // throw new \Exception("DATA:" . $columns . $value === null ? "NULL" : $value);
return implode($delimeter . " ", $temps); return implode(" ", $temps);
} }
final public function getWhere(): string 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 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; $this->_wheres[] = count($this->_wheres) ? $delimeter . " " . $query : $query;
} }
final public function orWhere(mixed $columns, mixed $values = null, string $delimeter = "OR"): void final public function orWhere(mixed $columns, mixed $values = null, string $delimeter = "OR"): void
{ {
$this->where($columns, $values, $delimeter); $this->where($columns, $values, $delimeter);
} }
final public function whereIn(string $column, array $values, string $delimeter = "AND", $range = "IN") final public function whereLike(string $column, string $value, string $option = "both", string $delimeter = "AND"): void
{
$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
{ {
switch ($option) { switch ($option) {
case 'before': case 'before':
@ -129,7 +128,20 @@ abstract class Model
$value = "%{$value}%"; $value = "%{$value}%";
break; 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 final public function execute(string $query): bool|PDOStatement
@ -141,7 +153,7 @@ abstract class Model
$stmt = $this->getConnect()->prepare($query); $stmt = $this->getConnect()->prepare($query);
$stmt->execute(); $stmt->execute();
if ($this->_reset) { if ($this->_reset) {
$this->reset(); $this->init();
} }
return $stmt; return $stmt;
} }
@ -149,12 +161,12 @@ abstract class Model
//CURD문 //CURD문
final protected function create_process(mixed $columns, mixed $values = null): bool|PDOStatement 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); return $this->execute($query);
} // } //
final protected function modify_process(mixed $columns, mixed $values = null): bool|PDOStatement 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); return $this->execute($query);
} // } //
final protected function delete_process(): bool|PDOStatement final protected function delete_process(): bool|PDOStatement
@ -164,16 +176,25 @@ abstract class Model
} // } //
public function select(mixed $columns = "*"): void 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}"; $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 final public function limit(int $start, int $offset = 0): void
{ {
@ -182,24 +203,27 @@ abstract class Model
} }
//Result //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 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); return $stmt->fetch($mode);
} }
public function getResults($mode = PDO::FETCH_ASSOC): mixed 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); return $stmt->fetchAll($mode);
} }
final public function countAllResults(string $column = "*", $reset = true): int final public function countAllResults(string $column = "*", $reset = true): int
{ {
$this->_reset = $reset; $this->_reset = $reset;
$stmt = $this->execute($this->makeResultQuery("SELECT COUNT({$column})")); $stmt = $this->execute($this->getResultQuery("SELECT COUNT({$column})"));
$count = $stmt->fetchColumn(0); $count = $stmt->fetchColumn(0);
$this->_reset = true; $this->_reset = true;
return $count; return $count;

View 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

View 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

View 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']);
}
}

View 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