_className .= '/Board'; $this->_model = new BoardModel(); $this->_defines = [ 'insert' => [ 'fields' => $this->_model->getFields([], ['user_uid', 'view_cnt']), 'fieldRules' => $this->_model->getFieldRules($this->_model->getFields()), 'fieldFilters' => $this->_model->getFieldFilters($this->_model->getFields()), ], 'update' => [ 'fields' => $this->_model->getFields([], ['user_uid', 'view_cnt']), 'fieldRules' => $this->_model->getFieldRules($this->_model->getFields()), 'fieldFilters' => $this->_model->getFieldFilters($this->_model->getFields()), ], 'view' => [ 'fields' => $this->_model->getFields(), 'fieldRules' => $this->_model->getFieldRules($this->_model->getFields()), 'fieldFilters' => $this->_model->getFieldFilters($this->_model->getFields()), ], 'index' => [ 'fields' => $this->_model->getFields([], ['upload_file', 'passwd', 'content']), 'fieldFilters' => $this->_model->getFieldFilters($this->_model->getFields()), 'batchjobFilters' => $this->_model->getFieldFilters($this->_model->getFields()), ], 'excel' => [ 'fields' => $this->_model->getFields([], ['upload_file', 'passwd']), 'fieldFilters' => $this->_model->getFieldFilters($this->_model->getFields()), ], ]; helper($this->_className); $this->_viewPath = strtolower($this->_className); $this->_viewDatas['title'] = lang($this->_className . '.title'); $this->_viewDatas['className'] = $this->_className; } //BoardConfig모델 final protected function getBoardConfigModel(): BoardConfigModel { return is_null($this->_boardConfigModel) ? new BoardConfigModel() : $this->_boardConfigModel; } //Field별 Form Option용 protected function getFieldFormOption(string $field): array { switch ($field) { case 'board_config_uid': $options = $this->_board_config_uids = $this->_board_config_uids ?: $this->getBoardConfigModel()->getFieldFormOptions(['status' => 'use']); break; default: $options = parent::getFieldFormOption($field); break; } return $options; } //Field별 Form Datas 처리용 protected function getFieldFormData(string $field, $entity = null): array { switch ($field) { case 'passwd': $this->_viewDatas['fieldDatas'][$field] = $this->request->getVar($field); $this->_viewDatas['fieldDatas']['confirmpassword'] = $this->request->getVar('confirmpassword'); break; case 'upload_file': $this->_viewDatas['fieldDatas'][$field] = $this->single_upload_procedure($field, $entity); break; default: return parent::getFieldFormData($field, $entity); break; } return $this->_viewDatas['fieldDatas']; } ////Action 모음 //Insert관련 final protected function insert_process() { return parent::insert_process(); } final public function insert() { return $this->insert_procedure(); } //Update관련 final public function update($uid) { return $this->update_procedure($uid); } //Reply 관련 final public function reply($uid) { return $this->reply_procedure($uid); } //Toggle관련 final public function toggle($uid, string $field) { return $this->toggle_procedure($uid, $field); } //Batchjob 관련 final public function batchjob() { return $this->batchjob_procedure(); } //Delete 관련 final public function delete($uid) { return $this->delete_procedure($uid); } //View 관련 protected function view_process($entity) { // view_cnt에 추가하기위함 $this->_model->increaseViewCount($entity->getPrimaryKey()); return parent::view_process($entity); } final public function view($uid) { return $this->view_procedure($uid); } //Index 관련 final public function index() { return $this->index_procedure(); } //Excel 관련 final public function excel() { return $this->excel_procedure(); } }