48 lines
1.8 KiB
PHP
48 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace lib\Controllers\DBMS;
|
|
|
|
use lib\Helpers\ServiceHelper;
|
|
use lib\Services\ClientService;
|
|
use lib\Utils\Pagination;
|
|
|
|
class NavigatorController extends DBMSController
|
|
{
|
|
|
|
private ?ClientService $_clientService = null;
|
|
public function __construct(array $params = [])
|
|
{
|
|
parent::__construct($params);
|
|
$this->getView()->setPath('navigator');
|
|
$this->helper = new ServiceHelper();
|
|
} //
|
|
public function getClientService(): ClientService
|
|
{
|
|
if ($this->_clientService === null) {
|
|
$this->_clientService = new ClientService();
|
|
}
|
|
return $this->_clientService;
|
|
}
|
|
|
|
//부가서비스 : 닷디펜더,딥파인더 등, deepfinder_list.php,dotdefender_list.php
|
|
//CLI 접속방법 : php index.php site/navigator/index
|
|
//WEB 접속방법 : http://localhost/site/navigator/index
|
|
public function index(): string
|
|
{
|
|
$ip = $this->request->get('ip');
|
|
//전체 고객정보
|
|
$this->clients = $this->getClientService()->getEntities();
|
|
//IP형식이 ipv4이면 해당 IP만 , 아니면 like , 없으면 all 값가져오기
|
|
if ($ip && $this->helper->isIPAddress($ip)) {
|
|
$this->getServiceService()->getModel()->where('service_ip', $ip);
|
|
} elseif ($ip) {
|
|
$this->getServiceService()->getModel()->like('service_ip', $ip);
|
|
}
|
|
$this->curPage = intval($this->request->get('curPage', 1));
|
|
$this->perPage = intval($this->request->get('perPage', VIEW_LIST_PERPAGE));
|
|
[$this->total, $this->entities] = $this->getServiceService()->getList($this->curPage, $this->perPage);
|
|
$this->pagination = new Pagination($this->total, (int)$this->curPage, (int)$this->perPage);
|
|
return $this->render(__FUNCTION__);
|
|
}
|
|
} //Class
|