From 56dc996f01c8baefee155b530ac43ccc89b2a706 Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Thu, 13 Nov 2025 10:39:52 +0900 Subject: [PATCH] trafficmonitor init...1 --- app/Controllers/Admin/AdminController.php | 32 +++++++++++------------ 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/app/Controllers/Admin/AdminController.php b/app/Controllers/Admin/AdminController.php index e990e10..31f1654 100644 --- a/app/Controllers/Admin/AdminController.php +++ b/app/Controllers/Admin/AdminController.php @@ -233,6 +233,13 @@ abstract class AdminController extends CommonController } $this->addViewDatas('index_start', $index_start); $this->addViewDatas('index_end', $index_end); + + //OrcerBy처리 + $order_field = $this->request->getVar('order_field'); + $order_value = $this->request->getVar('order_value'); + $this->service->setOrderBy($order_field, $order_value); + $this->addViewDatas('order_field', $order_field); + $this->addViewDatas('order_value', $order_value); } //Index Option출력용 protected function pagenation_options_process(int $index_totalcount, int $perpage): array @@ -284,17 +291,10 @@ abstract class AdminController extends CommonController $this->addViewDatas('index_totalcount', $index_totalcount); $this->addViewDatas('index_pagination', $this->pagenation_process($index_totalcount, $page, $perpage)); $this->addViewDatas('index_pagination_options', $this->pagenation_options_process($index_totalcount, $perpage)); - //OrcerBy , Limit 처리 - $order_field = $this->request->getVar('order_field'); - $order_value = $this->request->getVar('order_value'); - $this->service->setOrderBy($order_field, $order_value); - $this->addViewDatas('order_field', $order_field); - $this->addViewDatas('order_value', $order_value); + //조건절 LIMIT , OFFSET 처리 List용 + $this->index_condition_process($action); $this->service->setLimit($perpage); $this->service->setOffset(($page - 1) * $perpage); - //List - //조건절 처리 List용 - $this->index_condition_process($action); $this->addViewDatas('entities', $this->index_process()); helper(['form']); $this->addViewDatas('formDatas', $this->request->getGet()); @@ -335,11 +335,9 @@ abstract class AdminController extends CommonController case 'excel': case 'pdf': helper(['form']); - foreach ($this->getService()->getEntities() as $entity) { - $entities[] = $entity; - } - $this->entities = $entities; - $html = $this->getResultSuccess(); + $this->index_condition_process($action); + $this->addViewDatas('entities', $this->index_process()); + $html = $this->action_render_process($this->getActionPaths(), $action, $this->getViewDatas()); //data loading $reader = new Html(); $loaded_data = $reader->loadFromString($html); @@ -350,18 +348,18 @@ abstract class AdminController extends CommonController if (!$uid) { throw new \Exception("{$output_type}은 반드시 uid의 값이 필요합니다."); } - $entity = $this->getService()->getEntity($uid); + $entity = $this->service->getEntity($uid); if (!$entity) { throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다."); } - $this->entity = $entity; + $this->addViewDatas('entity', $entity); list($file_name, $uploaded_filename) = $entity->getDownlaodFile(); $full_path = WRITEPATH . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . $uploaded_filename; break; } return $this->response->download($full_path, null)->setFileName($file_name); } catch (\Exception $e) { - return $this->getResultFail($e->getMessage()); + return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage()); } } }