89 lines
2.9 KiB
PHP
89 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Cloudflare;
|
|
|
|
use Psr\Log\LoggerInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\RedirectResponse;
|
|
|
|
use App\Libraries\MyCloudflare\Account;
|
|
use App\Entities\Cloudflare\AccountEntity;
|
|
|
|
class AccountController extends CloudflareController
|
|
{
|
|
private $_myLibrary = null;
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
$this->class_name .= "Account";
|
|
$this->layout = LAYOUTS['admin'];
|
|
$this->title = lang("{$this->class_name}.title");
|
|
helper($this->class_name);
|
|
}
|
|
final protected function getMyLibrary(): Account
|
|
{
|
|
if ($this->_myLibrary === null) {
|
|
$this->_myLibrary = new Account();
|
|
}
|
|
return $this->_myLibrary;
|
|
}
|
|
//Field별 Form Input용
|
|
protected function getFormFieldInput(string $field, string $value, array $inputs = []): array
|
|
{
|
|
switch ($field) {
|
|
case 'type':
|
|
$inputs[$field] = form_dropdown(
|
|
$field,
|
|
$this->getFormFieldInputOption($field, $inputs),
|
|
$value
|
|
);
|
|
break;
|
|
default:
|
|
$inputs = parent::getFormFieldInput($field, $value, $inputs);
|
|
break;
|
|
}
|
|
return $inputs;
|
|
}
|
|
protected function create_init(): void
|
|
{
|
|
$this->fields = [$this->getMyLibrary()->getMyStorage()::TITLE, 'authkey', 'type', 'status'];
|
|
$this->filter_fields = ['type', 'status'];
|
|
$this->action = DB_ACTION['CREATE'];
|
|
$this->getMyLibrary()->getMyStorage()->setAction($this->action);
|
|
}
|
|
// public function create_form(): RedirectResponse|string
|
|
// {
|
|
// $this->create_init();
|
|
// return $this->create_form_process();
|
|
// }
|
|
protected function create_process_submit(): void
|
|
{
|
|
$entity = $this->getMyLibrary()->create($this->formDatas);
|
|
}
|
|
public function create(): RedirectResponse
|
|
{
|
|
$this->create_init();
|
|
$this->formDatas = [];
|
|
$this->getFormDatas();
|
|
$this->convertFormDatas();
|
|
$this->validateFormDatas();
|
|
return parent::create_process();
|
|
}
|
|
|
|
protected function index_init(): void
|
|
{
|
|
$this->fields = [$this->getMyLibrary()->getMyStorage()::TITLE, 'oldkey', 'type', 'status', 'updated_at', 'created_at'];
|
|
$this->filter_fields = ['type', 'status'];
|
|
$this->action = DB_ACTION['CREATE'];
|
|
$this->getMyLibrary()->getMyStorage()->setAction($this->action);
|
|
helper(['form']);
|
|
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
|
}
|
|
public function index(): string
|
|
{
|
|
$this->index_init();
|
|
return parent::list_process();
|
|
}
|
|
}
|