67 lines
2.2 KiB
PHP
67 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Admin\Cloudflare;
|
|
|
|
use App\Libraries\MyCloudflare\Account;
|
|
use App\Models\Cloudflare\AccountModel;
|
|
use CodeIgniter\HTTP\RedirectResponse;
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
class AccountController extends CloudflareController
|
|
{
|
|
private $_myLibrary = null;
|
|
private $_model = null;
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
$this->class_name = "Account";
|
|
$this->class_path .= $this->class_name;
|
|
$this->title = lang("{$this->class_path}.title");
|
|
helper($this->class_path);
|
|
}
|
|
final protected function getModel(): AccountModel
|
|
{
|
|
if ($this->_model === null) {
|
|
$this->_model = new AccountModel();
|
|
}
|
|
return $this->_model;
|
|
}
|
|
final protected function getMyLibrary(): Account
|
|
{
|
|
if ($this->_myLibrary === null) {
|
|
$this->_myLibrary = new Account();
|
|
}
|
|
return $this->_myLibrary;
|
|
}
|
|
//생성
|
|
protected function create_init(): void
|
|
{
|
|
$this->action = 'create';
|
|
$this->fields = ['id', 'authkey'];
|
|
$this->filter_fields = [];
|
|
$this->field_rules = $this->getModel()->getFieldRules($this->fields);
|
|
$this->field_options = $this->getFormFieldOptions();
|
|
$this->getModel()->setAction($this->action);
|
|
}
|
|
protected function create_process(): void
|
|
{
|
|
parent::create_process();
|
|
$this->getMyLibrary()->create($this->formDatas);
|
|
}
|
|
//수정
|
|
protected function modify_init(): void {}
|
|
// 리스트
|
|
public function list_init(): void
|
|
{
|
|
$this->action = 'index';
|
|
$this->fields = [$this->getModel()::TITLE, 'oldkey', 'type', 'status', 'updated_at', 'created_at'];
|
|
$this->filter_fields = ['type', 'status'];
|
|
$this->batchjob_fields = ['status'];
|
|
$this->field_rules = $this->getModel()->getFieldRules($this->fields);
|
|
$this->field_options = $this->getFormFieldOptions();
|
|
$this->getModel()->setAction($this->action);
|
|
}
|
|
}
|