trafficmonitor init...1

This commit is contained in:
choi.jh 2025-11-13 10:39:52 +09:00
parent 7037cd98f0
commit 56dc996f01

View File

@ -233,6 +233,13 @@ abstract class AdminController extends CommonController
} }
$this->addViewDatas('index_start', $index_start); $this->addViewDatas('index_start', $index_start);
$this->addViewDatas('index_end', $index_end); $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출력용 //Index Option출력용
protected function pagenation_options_process(int $index_totalcount, int $perpage): array 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_totalcount', $index_totalcount);
$this->addViewDatas('index_pagination', $this->pagenation_process($index_totalcount, $page, $perpage)); $this->addViewDatas('index_pagination', $this->pagenation_process($index_totalcount, $page, $perpage));
$this->addViewDatas('index_pagination_options', $this->pagenation_options_process($index_totalcount, $perpage)); $this->addViewDatas('index_pagination_options', $this->pagenation_options_process($index_totalcount, $perpage));
//OrcerBy , Limit 처리 //조건절 LIMIT , OFFSET 처리 List용
$order_field = $this->request->getVar('order_field'); $this->index_condition_process($action);
$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);
$this->service->setLimit($perpage); $this->service->setLimit($perpage);
$this->service->setOffset(($page - 1) * $perpage); $this->service->setOffset(($page - 1) * $perpage);
//List
//조건절 처리 List용
$this->index_condition_process($action);
$this->addViewDatas('entities', $this->index_process()); $this->addViewDatas('entities', $this->index_process());
helper(['form']); helper(['form']);
$this->addViewDatas('formDatas', $this->request->getGet()); $this->addViewDatas('formDatas', $this->request->getGet());
@ -335,11 +335,9 @@ abstract class AdminController extends CommonController
case 'excel': case 'excel':
case 'pdf': case 'pdf':
helper(['form']); helper(['form']);
foreach ($this->getService()->getEntities() as $entity) { $this->index_condition_process($action);
$entities[] = $entity; $this->addViewDatas('entities', $this->index_process());
} $html = $this->action_render_process($this->getActionPaths(), $action, $this->getViewDatas());
$this->entities = $entities;
$html = $this->getResultSuccess();
//data loading //data loading
$reader = new Html(); $reader = new Html();
$loaded_data = $reader->loadFromString($html); $loaded_data = $reader->loadFromString($html);
@ -350,18 +348,18 @@ abstract class AdminController extends CommonController
if (!$uid) { if (!$uid) {
throw new \Exception("{$output_type}은 반드시 uid의 값이 필요합니다."); throw new \Exception("{$output_type}은 반드시 uid의 값이 필요합니다.");
} }
$entity = $this->getService()->getEntity($uid); $entity = $this->service->getEntity($uid);
if (!$entity) { if (!$entity) {
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다."); throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
} }
$this->entity = $entity; $this->addViewDatas('entity', $entity);
list($file_name, $uploaded_filename) = $entity->getDownlaodFile(); list($file_name, $uploaded_filename) = $entity->getDownlaodFile();
$full_path = WRITEPATH . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . $uploaded_filename; $full_path = WRITEPATH . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . $uploaded_filename;
break; break;
} }
return $this->response->download($full_path, null)->setFileName($file_name); return $this->response->download($full_path, null)->setFileName($file_name);
} catch (\Exception $e) { } catch (\Exception $e) {
return $this->getResultFail($e->getMessage()); return $this->action_redirect_process('error', "{$this->getTitle()}에서 오류:" . $e->getMessage());
} }
} }
} }