_model = new BoardModel(); $this->_viewDatas['className'] = 'Board'; $this->_viewPath .= strtolower($this->_viewDatas['className']);; $this->_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title'); $this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])]; helper($this->_viewDatas['className']); } public function getFields(string $action = ""): array { $fields = ["category_uid", 'title', "board_file", "passwd", "status", "content"]; switch ($action) { case "index": case "excel": return ["category_uid", "user_uid", 'title', "board_file", "view_cnt", "status", "created_at"]; break; case "view": return ["category_uid", "user_uid", 'title', "board_file", "view_cnt", "status", "created_at", "content"]; break; default: return $fields; break; } } public function getFieldFilters(): array { return ["category_uid", "user_uid", "status"]; } public function getFieldBatchFilters(): array { return parent::getFieldBatchFilters(); } //Field별 Form Datas 처리용 protected function getFieldFormData(string $field, $entity = null): array { switch ($field) { case 'board_file': $file = $this->upload_file_procedure($field); if (!is_null($file)) { $this->_viewDatas['fieldDatas'][$field] = $file; } break; default: return parent::getFieldFormData($field, $entity); break; } return $this->_viewDatas['fieldDatas']; } private function build_notice() { $entitys = $this->_model->getEntitys(['category_uid' => $this->_category_notice, 'status' => DEFAULTS['STATUS']]); $temps = array(""); // echo var_export($temps, true); // exit; file_put_contents(APPPATH . 'Views' . "/layouts/main/board.php", implode("\n", $temps)); } //Insert관련 protected function insert_process() { $entity = parent::insert_process(); if ($entity->category_uid == $this->_category_notice) { $this->build_notice(); } return $entity; } //Update관련 protected function update_process($entity) { $entity = parent::update_process($entity); if ($entity->category_uid == $this->_category_notice) { $this->build_notice(); } return $entity; } //Toggle관련 protected function toggle_process($entity) { $entity = parent::toggle_process($entity); if ($entity->category_uid == $this->_category_notice) { $this->build_notice(); } return $entity; } //Delete 관련 protected function delete_process($entity) { $entity = parent::delete_process($entity); if ($entity->category_uid->$this->_category_notice) { $this->build_notice(); } return $entity; } }