diff --git a/src/Controller/OrganisationsController.php b/src/Controller/OrganisationsController.php index 3106593..e5d9ad5 100644 --- a/src/Controller/OrganisationsController.php +++ b/src/Controller/OrganisationsController.php @@ -20,46 +20,48 @@ class OrganisationsController extends AppController public function index() { + $customContextFilters = [ + // [ + // 'label' => __('ENISA Accredited'), + // 'filterCondition' => [ + // 'MetaFields.field' => 'enisa-tistatus', + // 'MetaFields.value' => 'Accredited', + // 'MetaFields.MetaTemplates.name' => 'ENISA CSIRT Network' + // ] + // ], + // [ + // 'label' => __('ENISA not-Accredited'), + // 'filterCondition' => [ + // 'MetaFields.field' => 'enisa-tistatus', + // 'MetaFields.value !=' => 'Accredited', + // 'MetaFields.MetaTemplates.name' => 'ENISA CSIRT Network' + // ] + // ], + // [ + // 'label' => __('ENISA CSIRT Network (GOV)'), + // 'filterConditionFunction' => function ($query) { + // return $this->CRUD->setParentConditionsForMetaFields($query, [ + // 'ENISA CSIRT Network' => [ + // [ + // 'field' => 'constituency', + // 'value LIKE' => '%Government%', + // ], + // [ + // 'field' => 'csirt-network-status', + // 'value' => 'Member', + // ], + // ] + // ]); + // } + // ], + ]; + $this->CRUD->index([ 'filters' => $this->filterFields, 'quickFilters' => $this->quickFilterFields, 'quickFilterForMetaField' => ['enabled' => true, 'wildcard_search' => true], 'contextFilters' => [ - 'custom' => [ - [ - 'label' => __('ENISA Accredited'), - 'filterCondition' => [ - 'MetaFields.field' => 'enisa-tistatus', - 'MetaFields.value' => 'Accredited', - 'MetaFields.MetaTemplates.name' => 'ENISA CSIRT Network' - ] - ], - [ - 'label' => __('ENISA not-Accredited'), - 'filterCondition' => [ - 'MetaFields.field' => 'enisa-tistatus', - 'MetaFields.value !=' => 'Accredited', - 'MetaFields.MetaTemplates.name' => 'ENISA CSIRT Network' - ] - ], - [ - 'label' => __('ENISA CSIRT Network (GOV)'), - 'filterConditionFunction' => function($query) { - return $this->CRUD->setParentConditionsForMetaFields($query, [ - 'ENISA CSIRT Network' => [ - [ - 'field' => 'constituency', - 'value LIKE' => '%Government%', - ], - [ - 'field' => 'csirt-network-status', - 'value' => 'Member', - ], - ] - ]); - } - ] - ], + 'custom' => $customContextFilters, ], 'contain' => $this->containFields, 'statisticsFields' => $this->statisticsFields,