dbms_init...1

This commit is contained in:
choi.jh 2025-06-09 18:35:02 +09:00
parent 7bd8830b28
commit 922af9dc02
2 changed files with 8 additions and 6 deletions

View File

@ -244,6 +244,7 @@ abstract class CommonController extends BaseController
case 'login_form': case 'login_form':
case 'index': case 'index':
case 'view': case 'view':
case 'download':
$this->control = $this->getControlDatas(); $this->control = $this->getControlDatas();
$this->getHelper()->setViewDatas($this->getViewDatas()); $this->getHelper()->setViewDatas($this->getViewDatas());
$result = view($this->view_path . $this->getAction(), [ $result = view($this->view_path . $this->getAction(), [
@ -705,7 +706,7 @@ abstract class CommonController extends BaseController
return array($full_path, $file_name); return array($full_path, $file_name);
} }
// Download // Download
final public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse final public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
{ {
try { try {
//각 Field 초기화 //각 Field 초기화
@ -717,12 +718,13 @@ abstract class CommonController extends BaseController
case 'pdf': case 'pdf':
// string buffer에서 읽어오는 경우 // string buffer에서 읽어오는 경우
$this->entities = $this->index_process(); $this->entities = $this->index_process();
$html = view('templates' . DIRECTORY_SEPARATOR . 'common' . DIRECTORY_SEPARATOR . __FUNCTION__, ['viewDatas' => $this->getViewDatas()]); $html = $this->getResultSuccess();
//data loading //data loading
$reader = new Html(); $reader = new Html();
$loaded_data = $reader->loadFromString($html); $loaded_data = $reader->loadFromString($html);
list($full_path, $file_name) = $this->download_document($output_type, $loaded_data); list($full_path, $file_name) = $this->download_document($output_type, $loaded_data);
$full_path .= DIRECTORY_SEPARATOR . $file_name; $full_path .= DIRECTORY_SEPARATOR . $file_name;
return $this->response->download($full_path, null)->setFileName($file_name);
break; break;
default: default:
if (!$uid) { if (!$uid) {
@ -735,9 +737,9 @@ abstract class CommonController extends BaseController
$this->entity = $entity; $this->entity = $entity;
list($file_name, $uploaded_filename) = $this->entity->getDownlaodFile(); list($file_name, $uploaded_filename) = $this->entity->getDownlaodFile();
$full_path = WRITEPATH . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . $uploaded_filename; $full_path = WRITEPATH . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . $uploaded_filename;
return $this->response->download($full_path, null)->setFileName($file_name);
break; break;
} }
return $this->response->download($full_path, null)->setFileName($file_name);
} catch (\Exception $e) { } catch (\Exception $e) {
return $this->getResultFail($e->getMessage()); return $this->getResultFail($e->getMessage());
} }

View File

@ -1,16 +1,16 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<?php foreach ($viewDatas['fields'] as $field): ?> <?php foreach ($viewDatas['control']['index_fields'] as $field): ?>
<th><?= lang("{$viewDatas['class_path']}.label.{$field}") ?></th> <th><?= lang("{$viewDatas['class_path']}.label.{$field}") ?></th>
<?php endforeach ?> <?php endforeach ?>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $cnt = 0 ?> <?php $cnt = 0 ?>
<?php foreach ($viewDatas['entitys'] as $entity): ?> <?php foreach ($viewDatas['entities'] as $entity): ?>
<tr> <tr>
<?php foreach ($viewDatas['fields'] as $field): ?> <?php foreach ($viewDatas['control']['index_fields'] as $field): ?>
<td><?= $entity->$field ?></td> <td><?= $entity->$field ?></td>
<?php endforeach ?> <?php endforeach ?>
</tr> </tr>