_className .= '/Firewall'; $this->_model = new FirewallModel(); $this->_defines = [ 'index' => [ 'fields' => ['zone_uid', 'description', 'action', 'paused', 'updated_at', 'created_at'], 'fieldFilters' => ['zone_uid', 'action', 'paused'], 'batchjobFilters' => ['action', 'paused'], ], 'excel' => [ 'fields' => ['zone_uid', 'description', 'action', 'paused', 'updated_at', 'created_at'], 'fieldFilters' => ['zone_uid', 'action', 'paused',], ], ]; helper($this->_className); $this->_viewPath = strtolower($this->_className); $this->_viewDatas['title'] = lang($this->_className . '.title'); } //Field별 Form Option용 protected function getFieldFormOption(string $field): array { switch ($field) { case 'zone_uid': if (is_null($this->_zone_uids)) { //모든 필요한 FormOption등 조기화작업 필요 $this->_zone_uids = [DEFAULT_EMPTY => lang($this->_className . '.label.' . $field) . ' 선택']; foreach ($this->getZoneModel()->orderBy('domain', 'asc')->findAll() as $zone) { $this->_zone_uids[$zone['uid']] = $zone['domain']; } } return $this->_zone_uids; break; default: return parent::getFieldFormOption($field); break; } } //Update관련 protected function update_process($entity) { $api = new Firewall($this->getZoneModel()->gentEntity($entity->getParentFieldData())); $entity = $api->update($entity, $this->_viewDatas['fieldDatas']); return parent::update_process($entity); } //Toggle관련 protected function toggle_process($entity) { $api = new Firewall($this->getZoneModel()->gentEntity($entity->getParentFieldData())); $entity = $api->update($entity, $this->_viewDatas['fieldDatas']); return parent::toggle_process($entity); } //Batchjob관련 protected function batchjob_process($entity) { $api = new Firewall($this->getZoneModel()->gentEntity($entity->getParentFieldData())); $entity = $api->update($entity, $this->_viewDatas['fieldDatas']); return parent::batchjob_process($entity); } //Sync관련 protected function sync_process($entity) { $api = new Firewall($this->getZoneModel()->gentEntity($entity->getParentFieldData())); $entity = $api->sync($entity); return parent::sync_process($entity); } //Index관련 protected function index_process() { $this->_model->orderBy('zone_uid', 'ASC'); $this->_model->orderBy('description', 'ASC'); return parent::index_process(); } }