cfmgr4 init...4
This commit is contained in:
parent
86531c9ecf
commit
54e067a1c4
@ -70,10 +70,10 @@ class UserController extends AdminController
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
||||
$this->validation->setRule($field . "*", $field, $this->getModel()->getRule($action, $field));
|
||||
$this->validation->setRule($field . "*", $field, $this->getModel()->getFieldRule($action, $field));
|
||||
break;
|
||||
default:
|
||||
$this->validation->setRule($field, $field, $this->getModel()->getRule($action, $field));
|
||||
$this->validation->setRule($field, $field, $this->getModel()->getFieldRule($action, $field));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -103,10 +103,10 @@ class UserController extends AdminController
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
||||
$this->validation->setRule($field . "*", $field, $this->getModel()->getRule($action, $field));
|
||||
$this->validation->setRule($field . "*", $field, $this->getModel()->getFieldRule($action, $field));
|
||||
break;
|
||||
default:
|
||||
$this->validation->setRule($field, $field, $this->getModel()->getRule($action, $field));
|
||||
$this->validation->setRule($field, $field, $this->getModel()->getFieldRule($action, $field));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -102,9 +102,9 @@ abstract class MVController extends CommonController
|
||||
$this->getModel()->transStart();
|
||||
try {
|
||||
$this->create_process();
|
||||
$this->getModel()->transCommit();
|
||||
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n");
|
||||
$this->getModel()->transCommit();
|
||||
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
@ -153,6 +153,7 @@ abstract class MVController extends CommonController
|
||||
}
|
||||
protected function modify_process(string $uid): void
|
||||
{
|
||||
// dd($this->fields);
|
||||
$this->modify_validate($this->action, $this->fields);
|
||||
$this->formDatas = $this->getFormDatas();
|
||||
$this->entity = $this->getModel()->getEntityByPK(intval($uid));
|
||||
@ -167,9 +168,9 @@ abstract class MVController extends CommonController
|
||||
$this->getModel()->transStart();
|
||||
try {
|
||||
$this->modify_process($uid);
|
||||
$this->getModel()->transCommit();
|
||||
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n");
|
||||
$this->getModel()->transCommit();
|
||||
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
@ -181,10 +182,10 @@ abstract class MVController extends CommonController
|
||||
}
|
||||
}
|
||||
//단일필드작업
|
||||
final public function toggle(string $field, string $uid): RedirectResponse
|
||||
final public function toggle(string $uid, string $field): RedirectResponse
|
||||
{
|
||||
$this->action = __FUNCTION__;
|
||||
$this->field = [$field];
|
||||
$this->fields = [$field];
|
||||
return $this->modify_procedure($uid);
|
||||
}
|
||||
//일괄처리작업
|
||||
@ -207,9 +208,9 @@ abstract class MVController extends CommonController
|
||||
$this->getModel()->transStart();
|
||||
try {
|
||||
$this->batcjob_process();
|
||||
$this->getModel()->transCommit();
|
||||
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n");
|
||||
$this->getModel()->transCommit();
|
||||
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
@ -235,9 +236,9 @@ abstract class MVController extends CommonController
|
||||
$this->getModel()->transStart();
|
||||
try {
|
||||
$this->delete_process($uid);
|
||||
$this->getModel()->transCommit();
|
||||
log_message("notice", __FUNCTION__ . "=> 작업을 완료하였습니다.");
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " => 작업을 완료하였습니다.\n");
|
||||
$this->getModel()->transCommit();
|
||||
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
|
||||
@ -26,8 +26,9 @@ function getFieldForm_UserHelper(string $field, mixed $value, array $viewDatas,
|
||||
if (in_array($viewDatas['action'], ['create', 'modify'])) {
|
||||
$forms = [];
|
||||
foreach ($viewDatas['field_options'][$field] as $key => $label) {
|
||||
$roles = explode(DEFAULTS["DELIMITER_ROLE"], $value);
|
||||
$forms[] = form_checkbox("{$field}[]", $value, in_array($key, $roles)) . $label;
|
||||
log_message("debug", var_export($value, true));
|
||||
$values = is_array($value) ? $value : explode(DEFAULTS["DELIMITER_ROLE"], $value);
|
||||
$forms[] = form_checkbox($field, $key, in_array($key, $values)) . $label;
|
||||
}
|
||||
$form = implode(" ", $forms);
|
||||
} else {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<div>
|
||||
<?= $viewDatas['session']->getFlashdata('return_message') ? alert_CommonHelper($viewDatas['session']->getFlashdata('return_message')) : "" ?>
|
||||
<?= $viewDatas['session']->getFlashdata(SESSION_NAMES['RETURN_MSG']) ? alert_CommonHelper($viewDatas['session']->getFlashdata(SESSION_NAMES['RETURN_MSG'])) : "" ?>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user