diff --git a/app/Config/Constants.php b/app/Config/Constants.php
index c62d222..2b8e676 100644
--- a/app/Config/Constants.php
+++ b/app/Config/Constants.php
@@ -111,11 +111,15 @@ define('LAYOUTS', [
'',
'',
'',
+ '',
+ '',
],
'javascripts' => [
'',
'',
'',
+ '',
+ '',
]
],
'admin' => [
@@ -125,15 +129,18 @@ define('LAYOUTS', [
'',
'',
'',
+ '',
+ '',
],
'javascripts' => [
'',
'',
'',
+ '',
+ '',
]
]
]);
-
//SESSION 관련
define('SESSION_NAMES', [
'RETURN_URL' => "return_url",
diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 21bb0ac..aedba0a 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -62,6 +62,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->get('view/(:num)', 'UserSNSController::view/$1');
$routes->get('delete/(:num)', 'UserSNSController::delete/$1');
$routes->get('toggle/(:num)/(:hash)', 'UserSNSController::toggle/$1/$2');
+ $routes->post('batchjob', 'UserSNSController::batchjob');
});
$routes->group('boardconfig', static function ($routes) {
$routes->get('', 'BoardConfigController::index');
@@ -88,7 +89,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']);
$routes->get('toggle/(:num)/(:hash)', 'BoardController::toggle/$1/$2');
$routes->post('batchjob', 'BoardController::batchjob');
- $routes->get('download/(:alpha)/(:num)', 'BoardController::download/$1/$2');
+ $routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2');
});
$routes->group('hpilo', static function ($routes) {
$routes->get('', 'HPILOController::index');
diff --git a/app/Config/Session.php b/app/Config/Session.php
index ea83480..de648c2 100644
--- a/app/Config/Session.php
+++ b/app/Config/Session.php
@@ -40,7 +40,7 @@ class Session extends BaseConfig
* The number of SECONDS you want the session to last.
* Setting to 0 (zero) means expire when the browser is closed.
*/
- public int $expiration = 7200;
+ public int $expiration = 0;
/**
* --------------------------------------------------------------------------
diff --git a/app/Controllers/Admin/AdminHierarchyController.php b/app/Controllers/Admin/AdminHierarchyController.php
index 6d5f9ed..78db27c 100644
--- a/app/Controllers/Admin/AdminHierarchyController.php
+++ b/app/Controllers/Admin/AdminHierarchyController.php
@@ -26,9 +26,10 @@ abstract class AdminHierarchyController extends AdminController
$this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], 'reply');
$this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters();
$this->_viewDatas['entity'] = $this->reply_form_process($entity);
- return view($this->_viewPath . '/reply', $this->_viewDatas);
+ $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
+ return view($this->_viewPath . '/update', $this->_viewDatas);
} catch (\Exception $e) {
- return alert_CommonHelper($e->getMessage(), 'back');
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']))->with('return_message', $e->getMessage());
}
}
protected function reply_validate($entity)
@@ -41,7 +42,7 @@ abstract class AdminHierarchyController extends AdminController
}
public function reply($uid)
{
- $message = "";
+ $msg = "";
try {
$entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->_viewDatas['fields'] = $this->_model->getFields('reply');
@@ -49,15 +50,15 @@ abstract class AdminHierarchyController extends AdminController
$this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters();
$entity = $this->reply_validate($entity);
$entity = $this->reply_process($entity);
- $message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
- log_message("info", "{$this->_viewDatas['title']} {$message}");
- return alert_CommonHelper($message, $this->_session->get(SESSION_NAMES['RETURN_URL']));
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 완료하였습니다.";
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']));
} catch (\Exception $e) {
- $message = __FUNCTION__ . " 실패하였습니다.";
- log_message("warning", $e->getMessage());
- log_message("warning", var_export($this->_viewDatas['fieldDatas'], true));
- log_message("info", "{$this->_viewDatas['title']} {$message}",);
- return redirect()->back()->withInput()->with("error", $message . "
\n{$e->getMessage()}");
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
+ log_message("error", $e->getMessage());
+ log_message("error", var_export($this->_viewDatas['fieldDatas'], true));
+ return redirect()->back()->withInput();
+ } finally {
+ $this->_session->setFlashdata("return_message", $msg);
}
}
}
diff --git a/app/Controllers/Admin/HPILOController.php b/app/Controllers/Admin/HPILOController.php
index 0e7836b..733861f 100644
--- a/app/Controllers/Admin/HPILOController.php
+++ b/app/Controllers/Admin/HPILOController.php
@@ -54,15 +54,13 @@ class HPILOController extends \App\Controllers\Admin\AdminController
$this->_viewDatas['entity'] = $entity;
return view($this->_viewPath . '/console_iframe', $this->_viewDatas);
} catch (\Exception $e) {
- $message = "{$entity->getTitle()} " . __FUNCTION__ . " 실패하였습니다.";
- log_message("warning", $message . "
\n{$e->getMessage()}");
- log_message("info", "{$this->_viewDatas['title']} {$message}");
- return alert_CommonHelper($message, 'back');
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']))->with('return_message', $e->getMessage());
}
}
final public function reset($uid, string $type)
{
+ $msg = "";
try {
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
if (!in_array($type, ["On", "Off", "Restart"])) {
@@ -70,20 +68,20 @@ class HPILOController extends \App\Controllers\Admin\AdminController
}
$ilo = new HPILO4($this->getAdapter($entity));
$results = $ilo->reset($type);
- log_message("warning", var_export($results, true));
- $message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
- log_message("info", "{$this->_viewDatas['title']} {$message}");
- return alert_CommonHelper($message, $this->_session->get(SESSION_NAMES['RETURN_URL']));
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 완료하였습니다.";
} catch (\Exception $e) {
- $message = "{$entity->getTitle()} " . __FUNCTION__ . " 실패하였습니다.";
- log_message("warning", $message . "
\n{$e->getMessage()}");
- log_message("info", "{$this->_viewDatas['title']} {$message}");
- return alert_CommonHelper($message, 'back');
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
+ log_message("error", $e->getMessage());
+ log_message("error", var_export($this->_viewDatas['fieldDatas'], true));
+ } finally {
+ $this->_session->setFlashdata("return_message", $msg);
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']));
}
}
final public function reload($uid)
{
+ $msg = "";
try {
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$ilo = new HPILO4($this->getAdapter($entity));
@@ -95,14 +93,14 @@ class HPILOController extends \App\Controllers\Admin\AdminController
throw new \Exception(__FUNCTION__ . " 오류 발생.\n" . var_export($this->_model->errors()));
}
}
- $message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
- log_message("info", "{$this->_viewDatas['title']} {$message}");
- return alert_CommonHelper($message, $this->_session->get(SESSION_NAMES['RETURN_URL']));
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 완료하였습니다.";
} catch (\Exception $e) {
- $message = __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
- log_message("warning", $message . "
\n{$e->getMessage()}");
- log_message("info", "{$this->_viewDatas['title']} {$message}");
- return alert_CommonHelper($message, 'back');
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
+ log_message("error", $e->getMessage());
+ log_message("error", var_export($this->_viewDatas['fieldDatas'], true));
+ } finally {
+ $this->_session->setFlashdata("return_message", $msg);
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']));
}
}
}
diff --git a/app/Controllers/AuthController.php b/app/Controllers/AuthController.php
index 14769f9..2486c5b 100644
--- a/app/Controllers/AuthController.php
+++ b/app/Controllers/AuthController.php
@@ -44,14 +44,11 @@ class AuthController extends BaseController
'attributes' => ['method' => "post",],
'hiddens' => [],
];
- //RETURN_URL 존재하면 추가
- if ($this->_session->get(SESSION_NAMES['RETURN_URL'])) {
- $this->_viewDatas['forms']['hiddens'][SESSION_NAMES['RETURN_URL']] = $this->_session->get(SESSION_NAMES['RETURN_URL']);
- }
$this->_viewDatas['login_buttons'] = array();
foreach ($this->_adapters as $key => $adapter) {
$this->_viewDatas['login_buttons'][$key] = $adapter->getAuthButton();
}
+ $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
return view('auth/login', $this->_viewDatas);
}
@@ -60,10 +57,9 @@ class AuthController extends BaseController
try {
//각 Adapter별 인층체크 후 Session에 인증정보 설정
$this->getAdapter($site)->signup($this->request->getVar());
- $return_url = $this->_session->get(SESSION_NAMES['RETURN_URL']) ?: "/";
- return redirect()->to($this->request->getVar(SESSION_NAMES['RETURN_URL']) ?: $return_url);
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
} catch (\Exception $e) {
- $this->_session->setFlashdata('error', $e->getMessage());
+ $this->_session->setFlashdata('return_message', $e->getMessage());
return redirect()->back()->withInput();
}
}
diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php
index 1487fea..a012b02 100644
--- a/app/Controllers/BaseController.php
+++ b/app/Controllers/BaseController.php
@@ -144,10 +144,7 @@ abstract class BaseController extends Controller
foreach ($upfiles[$field] as $upfile) {
if ($upfile->isValid() && !$upfile->hasMoved()) {
$fileName = $this->upload_file_process($upfile);
- array_push(
- $this->_viewDatas['fieldDatas'][$field],
- $fileName
- );
+ array_push($this->_viewDatas['fieldDatas'][$field], $fileName);
}
}
}
@@ -164,9 +161,10 @@ abstract class BaseController extends Controller
$this->_viewDatas['fieldFormOptions'] = $this->getFieldFormOptions($this->_viewDatas['fieldFilters']);
$this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []];
helper(['form']);
+ $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
return view($this->_viewPath . '/insert', $this->_viewDatas);
} catch (\Exception $e) {
- return alert_CommonHelper($e->getMessage(), 'back');
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']))->with('return_message', $e->getMessage());
}
}
@@ -180,7 +178,6 @@ abstract class BaseController extends Controller
//변경된 값 적용
foreach ($this->_viewDatas['fields'] as $field) {
$this->_viewDatas['fieldDatas'] = $this->getFieldFormData($field);
- log_message("info", "{$field} : " . var_export($this->_viewDatas['fieldDatas'][$field], true));
}
// echo var_export($this->_viewDatas['fields'], true);
// echo "
";
@@ -195,24 +192,22 @@ abstract class BaseController extends Controller
}
public function insert()
{
- $message = "";
+ $msg = "";
try {
$this->_viewDatas['fields'] = $this->_model->getFields('insert');
$this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], 'insert');
$this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters();
$this->insert_validate();
$this->insert_process();
- $message = __FUNCTION__ . " 완료하였습니다.";
- log_message("info", "{$this->_viewDatas['title']} {$message}");
- //session->setTempdata의 기능은 3초간 success에 message를 보관후 사라짐
- //$this->_session->setTempdata('success', 'Page updated successfully', 3);
- return alert_CommonHelper($message, $this->_session->get(SESSION_NAMES['RETURN_URL']));
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 완료하였습니다.";
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']));
} catch (\Exception $e) {
- $message = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.";
- log_message("warning", $e->getMessage());
- log_message("warning", var_export($this->_viewDatas['fieldDatas'], true));
- log_message("info", "{$this->_viewDatas['title']} {$message}");
- return redirect()->back()->withInput()->with("error", $message . "
\n{$e->getMessage()}");
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
+ log_message("error", $e->getMessage());
+ log_message("error", var_export($this->_viewDatas['fieldDatas'], true));
+ return redirect()->back()->withInput();
+ } finally {
+ $this->_session->setFlashdata("return_message", $msg);
}
}
@@ -232,9 +227,10 @@ abstract class BaseController extends Controller
$this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], 'update');
$this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters();
$this->_viewDatas['entity'] = $this->update_form_process($entity);
+ $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
return view($this->_viewPath . '/update', $this->_viewDatas);
} catch (\Exception $e) {
- return alert_CommonHelper($e->getMessage(), 'back');
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']))->with('return_message', $e->getMessage());
}
}
protected function update_validate($entity)
@@ -260,7 +256,7 @@ abstract class BaseController extends Controller
}
public function update($uid)
{
- $message = "";
+ $msg = "";
try {
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->_viewDatas['fields'] = $this->_model->getFields('update');
@@ -268,15 +264,15 @@ abstract class BaseController extends Controller
$this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters();
$entity = $this->update_validate($entity);
$entity = $this->update_process($entity);
- $message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
- log_message("info", "{$this->_viewDatas['title']} {$message}");
- return alert_CommonHelper($message, $this->_session->get(SESSION_NAMES['RETURN_URL']));
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 완료하였습니다.";
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']));
} catch (\Exception $e) {
- $message = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.";
- log_message("warning", $e->getMessage());
- log_message("warning", var_export($this->_viewDatas['fieldDatas'], true));
- log_message("info", "{$this->_viewDatas['title']} {$message}");
- return redirect()->back()->withInput()->with("error", $message . "
\n{$e->getMessage()}");
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
+ log_message("error", $e->getMessage());
+ log_message("error", var_export($this->_viewDatas['fieldDatas'], true));
+ return redirect()->back()->withInput();
+ } finally {
+ $this->_session->setFlashdata("return_message", $msg);
}
}
@@ -292,7 +288,7 @@ abstract class BaseController extends Controller
}
public function toggle($uid, string $field)
{
- $message = "";
+ $msg = "";
try {
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->_viewDatas['fields'] = [$field];
@@ -300,15 +296,14 @@ abstract class BaseController extends Controller
$this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters();
$entity = $this->toggle_validate($entity);
$entity = $this->toggle_process($entity);
- $message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
- log_message("info", "{$this->_viewDatas['title']} {$message}");
- return alert_CommonHelper($message, $this->_session->get(SESSION_NAMES['RETURN_URL']));
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 완료하였습니다.";
} catch (\Exception $e) {
- $message = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.";
- log_message("warning", $e->getMessage());
- log_message("warning", var_export($this->_viewDatas['fieldDatas'], true));
- log_message("info", "{$this->_viewDatas['title']} {$message}");
- return alert_CommonHelper($message . "
\n{$e->getMessage()}", 'back');
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
+ log_message("error", $e->getMessage());
+ log_message("error", var_export($this->_viewDatas['fieldDatas'], true));
+ } finally {
+ $this->_session->setFlashdata("return_message", $msg);
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']));
}
}
//Batchjob 관련
@@ -322,13 +317,10 @@ abstract class BaseController extends Controller
}
public function batchjob()
{
- $messages = array();
- $this->_model->transStart();
+ $msg = "";
+ $batchjobs = array();
try {
- $uids = $this->request->getVar('batchjob_uids');
- if (is_null($uids) || !is_array($uids) || !count($uids)) {
- throw new \Exception($this->_viewDatas['title'] . '에서 변경할 항목(uid)이 선택되지 않았습니다.', 'back');
- }
+ $uids = $this->request->getVar('batchjob_uids') ?: throw new \Exception($this->_viewDatas['title'] . '에서 변경할 항목(uid)이 선택되지 않았습니다.');
//fields 해당하는 field중 선택된 값이 있는경우만 fields로 정의
$fields = array();
foreach ($this->_model->getFieldBatchFilters() as $field) {
@@ -339,31 +331,44 @@ abstract class BaseController extends Controller
if (!is_array($fields) || count($fields) === 0) {
throw new \Exception($this->_viewDatas['title'] . '에서 변경할 항목(field)이 선택되지 않았습니다.');
}
+ //Transaction manully 시작
+ $this->_model->transBegin();
//Fields,FielRules재정의
$this->_viewDatas['fields'] = $fields;
$this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], 'batchjob');
$this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters();
+ $cnt = 1;
$entitys = array();
foreach ($uids as $uid) {
- $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
try {
+ $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$entity = $this->batchjob_validate($entity);
array_push($entitys, $this->batchjob_process($entity));
- array_push($messages, "{$entity->getTitle()}는 수정이 완료되었습니다.");
+ array_push($batchjobs, "{$cnt}. {$entity->getTitle()}는 완료.");
} catch (\Exception $e) {
- array_push($messages, "{$entity->getTitle()}는 다음과 같은 이유로 수정되지 않았습니다.\\n
" . $e->getMessage());
- throw new \Exception($e->getMessage());
+ array_push($batchjobs, "{$cnt}. {$entity->getTitle()}는 실패\n" . $e->getMessage());
}
+ $cnt++;
}
- $this->_model->transComplete();
- log_message("info", "{$this->_viewDatas['title']}에서 " . implode("\n" . $messages));
- return alert_CommonHelper(implode("\\n" . $messages), $this->_session->get(SESSION_NAMES['RETURN_URL']));
+ //Transaction manully Commit
+ $this->_model->transCommit();
+ $msg = sprintf(
+ "%s에서 총:%s중 %s개성공 , %s실패 %s 완료하였습니다.",
+ $this->_viewDatas['title'],
+ count($batchjobs),
+ count($entitys),
+ count($batchjobs) - count($entitys),
+ __FUNCTION__
+ );
} catch (\Exception $e) {
+ //Transaction manully Rollback
$this->_model->transRollback();
- log_message("warning", $e->getMessage());
- log_message("info", implode("\n" . $messages));
- log_message("warning", var_export($this->_viewDatas['fieldDatas'], true));
- return alert_CommonHelper($e->getMessage() . "\\n" . implode("\\n" . $messages), 'back');
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
+ log_message("error", $e->getMessage());
+ log_message("error", var_export($this->_viewDatas['fieldDatas'], true));
+ } finally {
+ $this->_session->setFlashdata("return_message", $msg);
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']));
}
}
@@ -379,18 +384,18 @@ abstract class BaseController extends Controller
}
public function delete($uid)
{
- $message = "";
+ $msg = "";
try {
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->delete_process($entity);
- $message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
- log_message("info", "{$this->_viewDatas['title']} {$message}");
- return alert_CommonHelper($message, $this->_session->get(SESSION_NAMES['RETURN_URL']));
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 완료하였습니다.";
} catch (\Exception $e) {
- $message = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.";
- log_message("warning", $e->getMessage());
- log_message("info", "{$this->_viewDatas['title']} {$message}");
- return alert_CommonHelper($message . "
\n{$e->getMessage()}", 'back');
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
+ log_message("error", $e->getMessage());
+ log_message("error", var_export($this->_viewDatas['fieldDatas'], true));
+ } finally {
+ $this->_session->setFlashdata("return_message", $msg);
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']));
}
}
@@ -412,7 +417,7 @@ abstract class BaseController extends Controller
$this->_viewDatas['entity'] = $this->view_process($entity);
return view($this->_viewPath . '/view', $this->_viewDatas);
} catch (\Exception $e) {
- return alert_CommonHelper($e->getMessage(), 'back');
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']))->with('return_message', $e->getMessage());
}
}
@@ -491,7 +496,6 @@ abstract class BaseController extends Controller
helper(['form']);
$this->_viewDatas['fieldFormOptions'] = $this->getFieldFormOptions($this->_viewDatas['fieldFilters']);
$this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []];
- $this->_session->set(SESSION_NAMES['RETURN_URL'], current_url() . '?' . $this->request->getUri()->getQuery());
foreach ($this->_viewDatas['fieldFilters'] as $field) {
$this->_viewDatas[$field] = $this->request->getVar($field) ?: DEFAULTS['EMPTY'];
}
@@ -504,9 +508,11 @@ abstract class BaseController extends Controller
$this->_viewDatas['per_page'] = $this->request->getVar('per_page') ?: DEFAULTS['PERPAGE'];
$this->_viewDatas['uri'] = $this->request->getUri();
$this->index_process();
+ //setting return_url to session flashdata
+ $this->_session->setFlashdata(SESSION_NAMES['RETURN_URL'], current_url() . '?' . $this->request->getUri()->getQuery() ?: "");
return view($this->_viewPath . '/index', $this->_viewDatas);
} catch (\Exception $e) {
- return alert_CommonHelper($e->getMessage(), 'back');
+ return redirect()->back()->with('return_message', $e->getMessage());
}
}
@@ -561,7 +567,7 @@ abstract class BaseController extends Controller
$this->_viewDatas['fieldFormOptions'] = $this->getFieldFormOptions($this->_viewDatas['fieldFilters']);
return $this->excel_process();
} catch (\Exception $e) {
- return alert_CommonHelper($e->getMessage(), 'back');
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']))->with('return_message', $e->getMessage());
}
}
//File Download관련
@@ -578,7 +584,7 @@ abstract class BaseController extends Controller
}
return $this->response->download(WRITEPATH . PATHS['UPLOAD'] . "/" . $filename, null)->setFileName(date("YmdHms") . '_' . $origin_filename);
} catch (\Exception $e) {
- return alert_CommonHelper($e->getMessage(), 'back');
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']))->with('return_message', $e->getMessage());
}
}
}
diff --git a/app/Filters/AuthFilter.php b/app/Filters/AuthFilter.php
index 48180b9..983b284 100644
--- a/app/Filters/AuthFilter.php
+++ b/app/Filters/AuthFilter.php
@@ -32,7 +32,7 @@ class AuthFilter implements FilterInterface
// 회원 ROLE이 필요ROLE 목록에 존재하지 않으면(ACL)
if (!in_array($auth[AUTH_FIELDS['ROLE']], $arguments)) {
return redirect()->to('/login')->with(
- 'error',
+ 'return_message',
sprintf(
"%s,%s회원님은 접속에 필요한 권한[%s]이 없습니다. ",
$auth[AUTH_FIELDS['ROLE']],
@@ -42,8 +42,8 @@ class AuthFilter implements FilterInterface
);
}
} else {
- session()->set(SESSION_NAMES['RETURN_URL'], $request->getUri()->getPath() . '?' . $request->getUri()->getQuery());
- return redirect()->to('/login')->with('error', session()->getFlashdata('error') ?: '먼저 로그인을하셔야합니다.');
+ session()->setFlashdata(SESSION_NAMES['RETURN_URL'], $request->getUri()->getPath() . '?' . $request->getUri()->getQuery());
+ return redirect()->to('/login')->with('return_message', '로그인을하셔야합니다.');
}
}
diff --git a/app/Helpers/BoardConfig_helper.php b/app/Helpers/BoardConfig_helper.php
index d5c26d7..4d8de49 100644
--- a/app/Helpers/BoardConfig_helper.php
+++ b/app/Helpers/BoardConfig_helper.php
@@ -66,9 +66,16 @@ function getFieldView_BoardConfigHelper($field, $entity, array $fieldFilters, ar
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
+ case 'name':
+ return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
+ break;
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $value)[0], [...$attributes, "target" => "_self"]);
break;
+ case 'updated_at':
+ case 'created_at':
+ return isset($value) ? str_split($value, 10)[0] : "";
+ break;
case 'head':
case 'tail':
return html_entity_decode($value);
@@ -99,24 +106,13 @@ function getFieldIndex_Column_BoardConfigHelper($field, $order_field, $order_val
function getFieldIndex_Row_BoardConfigHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
{
- $value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
- case 'name':
- return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
- break;
- case 'upload_file':
- return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $value)[0], [...$attributes, "target" => "_self"]);
- break;
- case 'updated_at':
- case 'created_at':
- return isset($value) ? str_split($value, 10)[0] : "";
- break;
default:
if (in_array($field, $fieldFilters)) {
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
- return getFieldFilter_BoardConfigHelper($field, $value, $fieldFormOptions, [...$attributes]);
+ return getFieldFilter_BoardConfigHelper($field, $entity->$field, $fieldFormOptions, $attributes);
}
- return $value;
+ return getFieldView_BoardConfigHelper($field, $entity, $fieldFormOptions, $attributes);
break;
}
} //
\ No newline at end of file
diff --git a/app/Helpers/Board_helper.php b/app/Helpers/Board_helper.php
index 7ad917c..793ea13 100644
--- a/app/Helpers/Board_helper.php
+++ b/app/Helpers/Board_helper.php
@@ -51,6 +51,9 @@ function getFieldForm_BoardHelper($field, $value, array $fieldFormOptions, array
case 'title':
return form_input($field, $value, [...$attributes, "placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]);
break;
+ case 'view_cnt':
+ return form_input($field, $value, [...$attributes, 'type' => 'number']);
+ break;
default:
return form_input($field, $value, [...$attributes]);
break;
@@ -61,13 +64,39 @@ function getFieldView_BoardHelper($field, $entity, array $fieldFilters, array $f
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
+ case 'title':
+ return sprintf(
+ "%s %s
",
+ anchor(
+ current_url() . '/reply/' . $entity->getPrimaryKey(),
+ ICONS['REPLY'],
+ [
+ ...$attributes,
+ "style" => sprintf("padding-left:%spx", $entity->getHierarchy_Depth() * DEFAULTS['HIERARCHY_GRPDEPTH']),
+ "target" => "_self"
+ ]
+ ),
+ anchor(
+ current_url() . '/view/' . $entity->getPrimaryKey(),
+ $value,
+ ["target" => "_self"]
+ )
+ );
+ break;
case 'board_file':
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $value)[0], [...$attributes, "target" => "_self"]);
break;
+ case 'view_cnt':
+ return number_format(!$value ? 0 : $value);
+ break;
case 'content':
return html_entity_decode($value);
break;
+ case 'updated_at':
+ case 'created_at':
+ return $value ? str_split($value, 10)[0] : "";
+ break;
default:
return in_array($field, $fieldFilters) ? $fieldFormOptions[$field][$value] : $value;
break;
@@ -94,42 +123,13 @@ function getFieldIndex_Column_BoardHelper($field, $order_field, $order_value, ar
function getFieldIndex_Row_BoardHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
{
- $value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
- case 'title':
- return sprintf(
- "%s%s
",
- anchor(
- current_url() . '/view/' . $entity->getPrimaryKey(),
- $value,
- [
- ...$attributes,
- "style" => sprintf("padding-left:%spx", $entity->getHierarchy_Depth() * DEFAULTS['HIERARCHY_GRPDEPTH']),
- "target" => "_self"
- ]
- ),
- anchor(
- current_url() . '/reply/' . $entity->getPrimaryKey(),
- ICONS['REPLY'],
- ["target" => "_self"]
- )
- );
- break;
- case 'board_file':
- case 'upload_file':
- return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $value)[0], [...$attributes, "target" => "_self"]);
- break;
- case 'updated_at':
- case 'created_at':
- return isset($value) ? str_split($value, 10)[0] : "";
- break;
-
default:
if (in_array($field, $fieldFilters)) {
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
- return getFieldFilter_BoardHelper($field, $value, $fieldFormOptions, [...$attributes]);
+ return getFieldFilter_BoardHelper($field, $entity->$field, $fieldFormOptions, $attributes);
}
- return $value;
+ return getFieldView_BoardHelper($field, $entity, $fieldFormOptions, $attributes);
break;
}
} //
\ No newline at end of file
diff --git a/app/Helpers/Common_helper.php b/app/Helpers/Common_helper.php
index 2f47bd2..3ec2d80 100644
--- a/app/Helpers/Common_helper.php
+++ b/app/Helpers/Common_helper.php
@@ -121,16 +121,13 @@ function isMobile_CommonHelper()
return false;
} //
-function alert_CommonHelper($msg, $url = false)
+function alert_CommonHelper(string $msg, $url = null)
{
- if (!$msg) {
- $msg = '오류가 발생하였습니다';
- }
$msg = preg_replace("/\r/", "\\r", $msg);
$msg = preg_replace("/\n/", "\\n", $msg);
$msg = preg_replace("/\'/", "\'", $msg);
$msg = preg_replace("/\"/", "\'", $msg);
- $msg = sprintf('alert("%s");', $msg);
+ $msg = "alert(\"{$msg}\");";
switch ($url) {
case 'close':
$msg .= "window.close();";
@@ -139,8 +136,8 @@ function alert_CommonHelper($msg, $url = false)
$msg .= "history.back();";
break;
default:
- $msg .= !$url ? '' : 'window.location.href="' . $url . '";';
+ $msg .= $url ? "location.href=\"{$url}\";" : "";
break;
}
- return '';
+ return "";
} //
diff --git a/app/Helpers/HPILO_helper.php b/app/Helpers/HPILO_helper.php
index c11a9ec..03e709f 100644
--- a/app/Helpers/HPILO_helper.php
+++ b/app/Helpers/HPILO_helper.php
@@ -57,6 +57,9 @@ function getFieldView_HPILOHelper($field, $entity, array $fieldFilters, array $f
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
+ case 'customer':
+ return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
+ break;
case 'memory':
return $value . "GB";
break;
@@ -95,27 +98,13 @@ function getFieldIndex_Column_HPILOHelper($field, $order_field, $order_value, ar
function getFieldIndex_Row_HPILOHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
{
- $value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
- case 'memory':
- return $value . "GB";
- break;
- case 'customer':
- return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
- break;
- case 'upload_file':
- return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]);
- break;
- case 'updated_at':
- case 'created_at':
- return isset($value) ? str_split($value, 10)[0] : "";
- break;
default:
if (in_array($field, $fieldFilters)) {
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
- return getFieldFilter_HPILOHelper($field, $value, $fieldFormOptions, [...$attributes]);
+ return getFieldFilter_UserHelper($field, $entity->$field, $fieldFormOptions, $attributes);
}
- return $value;
+ return getFieldView_UserHelper($field, $entity, $fieldFormOptions, $attributes);
break;
}
} //
\ No newline at end of file
diff --git a/app/Helpers/UserSNS_helper.php b/app/Helpers/UserSNS_helper.php
index 04f93f8..a803ab2 100644
--- a/app/Helpers/UserSNS_helper.php
+++ b/app/Helpers/UserSNS_helper.php
@@ -57,12 +57,19 @@ function getFieldView_UserSNSHelper($field, $entity, array $fieldFilters, array
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
+ case 'id':
+ return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
+ break;
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $value)[0], [...$attributes, "target" => "_self"]);
break;
case 'content':
return html_entity_decode($value);
break;
+ case 'updated_at':
+ case 'created_at':
+ return isset($value) ? str_split($value, 10)[0] : "";
+ break;
default:
return in_array($field, $fieldFilters) ? $fieldFormOptions[$field][$value] : $value;
break;
@@ -89,24 +96,13 @@ function getFieldIndex_Column_UserSNSHelper($field, $order_field, $order_value,
function getFieldIndex_Row_UserSNSHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
{
- $value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
- case 'id':
- return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
- break;
- case 'upload_file':
- return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $value)[0], [...$attributes, "target" => "_self"]);
- break;
- case 'updated_at':
- case 'created_at':
- return isset($value) ? str_split($value, 10)[0] : "";
- break;
default:
if (in_array($field, $fieldFilters)) {
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
- return getFieldFilter_UserSNSHelper($field, $value, $fieldFormOptions, [...$attributes]);
+ return getFieldFilter_UserSNSHelper($field, $entity->$field, $fieldFormOptions, $attributes);
}
- return $value;
+ return getFieldView_UserSNSHelper($field, $entity, $fieldFormOptions, $attributes);
break;
}
} //
\ No newline at end of file
diff --git a/app/Helpers/User_helper.php b/app/Helpers/User_helper.php
index e1fd420..6b39811 100644
--- a/app/Helpers/User_helper.php
+++ b/app/Helpers/User_helper.php
@@ -60,6 +60,16 @@ function getFieldView_UserHelper($field, $entity, array $fieldFilters, array $fi
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
+ case 'id':
+ return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
+ break;
+ case 'upload_file':
+ return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $value)[0], [...$attributes, "target" => "_self"]);
+ break;
+ case 'updated_at':
+ case 'created_at':
+ return $value ? str_split($value, 10)[0] : "";
+ break;
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $value)[0], [...$attributes, "target" => "_self"]);
break;
@@ -92,24 +102,13 @@ function getFieldIndex_Column_UserHelper($field, $order_field, $order_value, arr
function getFieldIndex_Row_UserHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
{
- $value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
- case 'id':
- return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
- break;
- case 'upload_file':
- return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $value)[0], [...$attributes, "target" => "_self"]);
- break;
- case 'updated_at':
- case 'created_at':
- return isset($value) ? str_split($value, 10)[0] : "";
- break;
default:
if (in_array($field, $fieldFilters)) {
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
- return getFieldFilter_UserHelper($field, $value, $fieldFormOptions, $attributes);
+ return getFieldFilter_UserHelper($field, $entity->$field, $fieldFormOptions, $attributes);
}
- return $value;
+ return getFieldView_UserHelper($field, $entity, $fieldFormOptions, $attributes);
break;
}
} //
\ No newline at end of file
diff --git a/app/Language/kr/Board.php b/app/Language/ko/Board.php
similarity index 100%
rename from app/Language/kr/Board.php
rename to app/Language/ko/Board.php
diff --git a/app/Language/kr/BoardConfig.php b/app/Language/ko/BoardConfig.php
similarity index 100%
rename from app/Language/kr/BoardConfig.php
rename to app/Language/ko/BoardConfig.php
diff --git a/app/Language/kr/HPILO.php b/app/Language/ko/HPILO.php
similarity index 100%
rename from app/Language/kr/HPILO.php
rename to app/Language/ko/HPILO.php
diff --git a/app/Language/kr/User.php b/app/Language/ko/User.php
similarity index 100%
rename from app/Language/kr/User.php
rename to app/Language/ko/User.php
diff --git a/app/Language/kr/UserSNS.php b/app/Language/ko/UserSNS.php
similarity index 100%
rename from app/Language/kr/UserSNS.php
rename to app/Language/ko/UserSNS.php
diff --git a/app/Language/kr/Validation.php b/app/Language/kr/Validation.php
deleted file mode 100644
index 54d1e7a..0000000
--- a/app/Language/kr/Validation.php
+++ /dev/null
@@ -1,4 +0,0 @@
-allowedFields, $this->primaryKey);
}
$this->validationRules = [];
+ $this->_session = \Config\Services::session();
}
final public function getPrimaryKey(): string
{
@@ -75,7 +77,7 @@ abstract class BaseModel extends Model
break;
case "passwd":
$rules[$field] = "if_exist|trim|string";
- if (!$action) {
+ if ($action != "") {
$rules["confirmpassword"] = "if_exist|trim|string|matches[passwd]";
}
break;
@@ -152,13 +154,15 @@ abstract class BaseModel extends Model
break;
case "user_uid":
if (array_key_exists($field, $formDatas) && $formDatas[$field]) {
- $entity->$field = $formDatas[$field];
- } elseif (session()->get(SESSION_NAMES["ISLOGIN"])) {
- $auth = session()->get(SESSION_NAMES["AUTH"]);
+ $entity->$field = $formDatas[$field];
+ } elseif ($this->_session->get(SESSION_NAMES["ISLOGIN"])) {
+ $auth = $this->_session->get(SESSION_NAMES["AUTH"]);
$entity->$field = $auth[AUTH_FIELDS["ID"]];
}
break;
case "passwd":
+ // echo var_export($this->validationRules, true);
+ // exit;
if (array_key_exists($field, $formDatas) && $formDatas[$field]) {
$entity->$field = password_hash($formDatas[$field], PASSWORD_DEFAULT);
}
@@ -197,13 +201,13 @@ abstract class BaseModel extends Model
}
protected function create_process($entity, array $formDatas)
{
+ // echo var_export($entity);
+ // exit;
foreach ($this->allowedFields as $field) {
$entity = $this->changeFormData($field, $formDatas, $entity);
}
// echo var_export($this->allowedFields);
- // echo "
";
- // echo var_export($entity);
- // exit;
+ // exit
return $this->save_process($entity);
}
final protected function modify_process($entity, array $formDatas)
diff --git a/app/Models/BoardConfigModel.php b/app/Models/BoardConfigModel.php
index 2af7238..71702ad 100644
--- a/app/Models/BoardConfigModel.php
+++ b/app/Models/BoardConfigModel.php
@@ -100,7 +100,7 @@ class BoardConfigModel extends BaseModel
}
break;
default:
- return parent::changeFormData($field, $formDatas, $entity);
+ $entity = parent::changeFormData($field, $formDatas, $entity);
break;
}
return $entity;
diff --git a/app/Models/HPILOModel.php b/app/Models/HPILOModel.php
index 0176bce..5ea1db0 100644
--- a/app/Models/HPILOModel.php
+++ b/app/Models/HPILOModel.php
@@ -14,10 +14,10 @@ class HPILOModel extends BaseModel
$this->allowedFields = [...$this->allowedFields, ...$this->getFields(), 'model', 'processor', 'memory', 'health', 'power', 'detail',];
$this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
}
- public function getTitle(): string
- {
- return 'customer';
- }
+ public function getTitle(): string
+ {
+ return 'customer';
+ }
public function getFields(string $action = ""): array
{
$fields = [$this->getTitle(), 'ip', 'port', 'id', 'passwd', 'status'];
@@ -74,14 +74,8 @@ class HPILOModel extends BaseModel
}
public function getEntity($conditions): HPILOEntity
{
- $entity = $this->asObject(HPILOEntity::class)->where($conditions)->first();
- return $entity ?: throw new \Exception("해당 정보가 없습니다.\n " . var_export($conditions, true));
+ return $this->where($conditions)->first() ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true));
}
- public function getEntitys($conditions): array
- {
- return $this->asObject(HPILOEntity::class)->where($conditions)->findAll();
- }
-
protected function changeFormData(string $field, array $formDatas, $entity)
{
switch ($field) {
@@ -109,16 +103,6 @@ class HPILOModel extends BaseModel
public function setIndexWordFilter(string $word)
{
parent::setIndexWordFilter($word);
- $this->orLike($this->getTitle(), $word, 'both');
+ $this->orLike($this->getTitle(), $word, "both"); //befor , after , both
}
- public function setIndexOrderBy($field, $order = 'ASC')
- {
- $this->orderBy("health", "ASC");
- parent::setIndexOrderBy($field, $order);
- }
- public function setIndexOrderBy($field, $order = "ASC")
- {
- parent::setIndexOrderBy($field, $order);
- $this->orderBy($this->getTitle(), "ASC");
- }
}
diff --git a/app/Models/UserModel.php b/app/Models/UserModel.php
index 59a8c84..8bd9d8d 100644
--- a/app/Models/UserModel.php
+++ b/app/Models/UserModel.php
@@ -53,7 +53,9 @@ class UserModel extends BaseModel
break;
case "passwd":
$rules[$field] = "required|trim|string";
- $rules["confirmpassword"] = "required|trim|string|matches[passwd]";
+ if ($action != "") {
+ $rules["confirmpassword"] = "required|trim|string|matches[passwd]";
+ }
break;
case $this->getTitle():
$rules[$field] = "required|trim|string";
@@ -84,7 +86,7 @@ class UserModel extends BaseModel
}
break;
default:
- return parent::changeFormData($field, $formDatas, $entity);
+ $entity = parent::changeFormData($field, $formDatas, $entity);
break;
}
return $entity;
diff --git a/app/Views/admin/board/insert.php b/app/Views/admin/board/insert.php
index fc53595..b8ac742 100644
--- a/app/Views/admin/board/insert.php
+++ b/app/Views/admin/board/insert.php
@@ -10,7 +10,7 @@
= getFieldLabel_BoardHelper($field, $fieldRules) ?>
- = getFieldForm_BoardHelper($field, old($field) ?: DEFAULTS['EMPTY'], $fieldFormOptions) ?>
+ = getFieldForm_BoardHelper($field, old($field, DEFAULTS['EMPTY']), $fieldFormOptions) ?>
= validation_show_error($field); ?>
|
@@ -20,6 +20,5 @@
= form_close(); ?>
-getFlashdata('error')) : ?>= session()->getFlashdata('error') ?>
= $this->include('templates/admin/footer'); ?>
= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/board/reply.php b/app/Views/admin/board/reply.php
index ac5b5f4..e97f9ba 100644
--- a/app/Views/admin/board/reply.php
+++ b/app/Views/admin/board/reply.php
@@ -9,7 +9,7 @@
= getFieldLabel_BoardHelper($field, $fieldRules) ?>
- = getFieldForm_BoardHelper($field, old($field) ?: $entity->$field, $fieldFormOptions) ?>
+ = getFieldForm_BoardHelper($field, old($field, $entity->$field), $fieldFormOptions) ?>
= validation_show_error($field); ?>
|
@@ -19,6 +19,5 @@
= form_close(); ?>
-getFlashdata('error')) : ?>= session()->getFlashdata('error') ?>
= $this->include('templates/admin/footer'); ?>
= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/board/update.php b/app/Views/admin/board/update.php
index ac5b5f4..e97f9ba 100644
--- a/app/Views/admin/board/update.php
+++ b/app/Views/admin/board/update.php
@@ -9,7 +9,7 @@
= getFieldLabel_BoardHelper($field, $fieldRules) ?>
- = getFieldForm_BoardHelper($field, old($field) ?: $entity->$field, $fieldFormOptions) ?>
+ = getFieldForm_BoardHelper($field, old($field, $entity->$field), $fieldFormOptions) ?>
= validation_show_error($field); ?>
|
@@ -19,6 +19,5 @@
= form_close(); ?>
-getFlashdata('error')) : ?>= session()->getFlashdata('error') ?>
= $this->include('templates/admin/footer'); ?>
= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/boardconfig/insert.php b/app/Views/admin/boardconfig/insert.php
index 183bcd6..b56a644 100644
--- a/app/Views/admin/boardconfig/insert.php
+++ b/app/Views/admin/boardconfig/insert.php
@@ -9,7 +9,7 @@
= getFieldLabel_BoardConfigHelper($field, $fieldRules) ?>
- = getFieldForm_BoardConfigHelper($field, old($field) ?: DEFAULTS['EMPTY'], $fieldFormOptions) ?>
+ = getFieldForm_BoardConfigHelper($field, old($field, DEFAULTS['EMPTY']), $fieldFormOptions) ?>
= validation_show_error($field); ?>
|
@@ -19,7 +19,5 @@
= form_close(); ?>
-getFlashdata('error')) : ?>= session()->getFlashdata('error') ?>
-
= $this->include('templates/admin/footer'); ?>
= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/boardconfig/update.php b/app/Views/admin/boardconfig/update.php
index 5d1a137..1b2227f 100644
--- a/app/Views/admin/boardconfig/update.php
+++ b/app/Views/admin/boardconfig/update.php
@@ -9,7 +9,7 @@
= getFieldLabel_BoardConfigHelper($field, $fieldRules) ?>
- = getFieldForm_BoardConfigHelper($field, old($field) ?: $entity->$field, $fieldFormOptions) ?>
+ = getFieldForm_BoardConfigHelper($field, old($field, $entity->$field), $fieldFormOptions) ?>
= validation_show_error($field); ?>
|
@@ -19,6 +19,5 @@
= form_close(); ?>
-getFlashdata('error')) : ?>= session()->getFlashdata('error') ?>
= $this->include('templates/admin/footer'); ?>
= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/user/insert.php b/app/Views/admin/user/insert.php
index 5328eff..a3032ff 100644
--- a/app/Views/admin/user/insert.php
+++ b/app/Views/admin/user/insert.php
@@ -9,7 +9,7 @@
= getFieldLabel_UserHelper($field, $fieldRules) ?>
- = getFieldForm_UserHelper($field, old($field) ?: DEFAULTS['EMPTY'], $fieldFormOptions) ?>
+ = getFieldForm_UserHelper($field, old($field, DEFAULTS['EMPTY']), $fieldFormOptions) ?>
= validation_show_error($field); ?>
|
@@ -19,6 +19,5 @@
= form_close(); ?>
-getFlashdata('error')) : ?>= session()->getFlashdata('error') ?>
= $this->include('templates/admin/footer'); ?>
= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/admin/user/update.php b/app/Views/admin/user/update.php
index ed4f7a7..cd2160c 100644
--- a/app/Views/admin/user/update.php
+++ b/app/Views/admin/user/update.php
@@ -9,7 +9,7 @@
= getFieldLabel_UserHelper($field, $fieldRules) ?>
- = getFieldForm_UserHelper($field, old($field) ?: $entity->$field, $fieldFormOptions) ?>
+ = getFieldForm_UserHelper($field, old($field, $entity->$field), $fieldFormOptions) ?>
= validation_show_error($field); ?>
|
@@ -19,6 +19,5 @@
= form_close(); ?>
-getFlashdata('error')) : ?>= session()->getFlashdata('error') ?>
= $this->include('templates/admin/footer'); ?>
= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/auth/login.php b/app/Views/auth/login.php
index 774cbd4..de1ab20 100644
--- a/app/Views/auth/login.php
+++ b/app/Views/auth/login.php
@@ -1,38 +1,33 @@
= $this->extend('layouts/empty') ?>
= $this->section('content') ?>
-
- = form_open(url_to('signup'), $forms['attributes'], $forms['hiddens']) ?>
-
+= form_open(url_to('signup'), $forms['attributes'], $forms['hiddens']) ?>
+
+= form_close(); ?>
= $this->endSection() ?>
\ No newline at end of file
diff --git a/app/Views/templates/admin/footer.php b/app/Views/templates/admin/footer.php
index 8b51432..174ff08 100644
--- a/app/Views/templates/admin/footer.php
+++ b/app/Views/templates/admin/footer.php
@@ -1,9 +1,5 @@
-
-
-
-
-
+= $session->getFlashdata('return_message') ? alert_CommonHelper($session->getFlashdata('return_message')) : "" ?>