cfmgrv4 init...1

This commit is contained in:
최준흠 2024-10-05 15:33:56 +09:00
parent 5821780796
commit 0de303678f
8 changed files with 28 additions and 16 deletions

View File

@ -56,7 +56,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function ($rou
$routes->group('account', function ($routes) {
$routes->get('/', 'AccountController::index');
$routes->post('create/(:uuid)', 'AccountController::create');
$routes->get('reload/(:alphanum)', 'AccountController::reload/$1');
$routes->get('reload/(:num)', 'AccountController::reload/$1');
$routes->get('download/(:alpha)', 'AccountController::download/$1');
});

View File

@ -14,7 +14,7 @@ class AccountController extends CloudflareController
{
private $_myLibrary = null;
private $_model = null;
private $_auth_key = null;
private $_auth_entity = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@ -33,7 +33,7 @@ class AccountController extends CloudflareController
final protected function getMyLibrary(): Account
{
if ($this->_myLibrary === null) {
$this->_myLibrary = new Account($this->_auth_key);
$this->_myLibrary = new Account($this->_auth_entity);
}
return $this->_myLibrary;
}

View File

@ -126,12 +126,25 @@ class RecordController extends CloudflareController
if ($this->entity === null) {
throw new \Exception("{$uid} 정보를 찾을수 없습니다.");
}
//fixed 필드가 있고 값이 변경되었을때
if (in_array('fixed', $this->fields) && $this->formDatas['fixed'] !== $this->entity->fixed) {
$entity = $this->getModel()->modify($this->entity, $this->formDatas);
} else {
//부모데이터정의
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent());
//Socket처리
$entity = $this->getMyLibrary()->modify($this->entity, $this->formDatas);
}
log_message("debug", "Record:{$entity->getTitle()} 수정 작업을 완료하였습니다.");
}
//단일필드작업
public function toggle(string $uid, string $field): RedirectResponse
{
$this->action = __FUNCTION__;
$this->fields = [$field];
$this->modify_process($uid);
return $this->modify_procedure($uid);
}
//일괄처리작업
public function batcjob(): RedirectResponse
{

View File

@ -220,7 +220,7 @@ abstract class MVController extends CommonController
}
}
//단일필드작업
final public function toggle(string $uid, string $field): RedirectResponse
public function toggle(string $uid, string $field): RedirectResponse
{
$this->action = __FUNCTION__;
$this->fields = [$field];

View File

@ -62,7 +62,7 @@ function getFieldView_AccountHelper(string $field, array $viewDatas, array $extr
} else {
// dd($viewDatas['field_options']);
$value = anchor(
base_url() . strtolower($viewDatas['root']) . "auth/reload/" . $viewDatas['entity']->getParent(),
current_url() . "/reload/" . $viewDatas['entity']->getParent(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@ -75,7 +75,7 @@ function getFieldView_AccountHelper(string $field, array $viewDatas, array $extr
break;
case AccountModel::TITLE:
$value = anchor(
current_url() . '/reload/' . $viewDatas['entity']->getPK(),
base_url() . strtolower($viewDatas['root']) . 'zone/reload/' . $viewDatas['entity']->getPK(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",

View File

@ -43,7 +43,7 @@ function getFieldView_AuthHelper(string $field, array $viewDatas, array $extras
switch ($field) {
case AuthModel::TITLE:
$value = anchor(
current_url() . '/reload/' . $viewDatas['entity']->getPK(),
base_url() . strtolower($viewDatas['root']) . 'account/reload/' . $viewDatas['entity']->getPK(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",

View File

@ -76,7 +76,7 @@ function getFieldView_RecordHelper(string $field, array $viewDatas, array $extra
$value = "";
} else {
$value = anchor(
base_url() . strtolower($viewDatas['root']) . 'zone/reload/' . $viewDatas['entity']->getParent(),
current_url() . "/reload/" . $viewDatas['entity']->getParent(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@ -86,8 +86,8 @@ function getFieldView_RecordHelper(string $field, array $viewDatas, array $extra
}
break;
case RecordModel::TITLE:
$url = sprintf("%s/toggle/%s?fixed=%s", current_url(), $viewDatas['entity']->getPK(), $viewDatas['entity']->fixed == 'on' ? "off" : "on");
$value = sprintf("%s%s", $viewDatas['entity']->fixed == 'on' ? ICONS['LOCK'] : "", $value);
$url = sprintf("%s/toggle/%s/fixed?fixed=%s", current_url(), $viewDatas['entity']->getPK(), $viewDatas['entity']->fixed == 'on' ? "off" : "on");
$value = sprintf("%s%s", $viewDatas['entity']->fixed == 'on' ? "<span class=\"text-danger\">" . ICONS['LOCK'] . "</span>" : "", $value);
$value = anchor($url, $value, ["target" => "_self"]);
break;
case 'content':

View File

@ -79,7 +79,7 @@ function getFieldView_ZoneHelper(string $field, array $viewDatas, array $extras
$value = "";
} else {
$value = anchor(
base_url() . strtolower($viewDatas['root']) . "account/reload/" . $viewDatas['entity']->getParent(),
current_url() . "/reload/" . $viewDatas['entity']->getParent(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",
@ -92,7 +92,7 @@ function getFieldView_ZoneHelper(string $field, array $viewDatas, array $extras
break;
case ZoneModel::TITLE:
$value = anchor(
current_url() . '/reload/' . $viewDatas['entity']->getPK(),
base_url() . strtolower($viewDatas['root']) . 'record/reload/' . $viewDatas['entity']->getPK(),
ICONS["RELOAD"],
[
"class" => "btn btn-sm btn-primary btn-circle",