public function compileCheckboxOptions($filter, $options)
    {
        $allOptionsOfCurrentFilter = $filter['options'];

        // alphabetical sorting of filter options
        if ($filter['alphabeticalsorting'] == 1) {
            $this->sortArrayByColumn($allOptionsOfCurrentFilter, 'title');
        }

        // loop through options
        $checkboxOptions = array();
        if (is_array($allOptionsOfCurrentFilter)) {
            foreach ($allOptionsOfCurrentFilter as $key => $data) {
                $data['key'] = $key;

                // check if current option (of searchresults) is in array of all possible options
                $isOptionInOptionArray = false;
                if (is_array($options)) {
                    foreach ($options as $optionInResultList) {
                        if ($optionInResultList['value'] == $data['tag']) {
                            $isOptionInOptionArray = true;
                            $data['results'] = $optionInResultList['results'];
                            break;
                        }
                    }
                }

                // if option is in optionArray, we have to mark the checkboxes
                if ($isOptionInOptionArray) {
                    // if user has selected a checkbox it must be selected on the resultpage, too.
                    // options which have been preselected in the backend are
                    // already in $this->piVars['filter'][$filter['uid]]
                    if ($this->piVars['filter'][$filter['uid']][$key]) {
                        $data['selected'] = 1;
                    }

                    // mark all checkboxes if that config options is set and no search string was given and there
                    // are no preselected filters given for that filter
                    if ($this->isEmptySearch
                        && $filter['markAllCheckboxes']
                        && empty($this->preselectedFilter[$filter['uid']])
                    ) {
                        $data['selected'] = 1;
                    }
                } else { // if an option was not found in the search results
                    $data['disabled'] = 1;
                }

                $data['id'] = 'filter_' . $filter['uid'] . '_' . $key;
                $checkboxOptions[] = $data;
            }
        }

        // modify filter options by hook
        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilterOptions'])) {
            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilterOptions'] as $_classRef) {
                $_procObj = &GeneralUtility::makeInstance($_classRef);
                $_procObj->modifyFilterOptions($filter, $checkboxOptions, $this);
            }
        }

        return $checkboxOptions;
    }
public function compileCheckboxOptions($filter, $options)
    {
        $allOptionsOfCurrentFilter = $filter['options'];

        // alphabetical sorting of filter options
        if ($filter['alphabeticalsorting'] == 1) {
            $this->sortArrayByColumn($allOptionsOfCurrentFilter, 'title');
        }

        // loop through options
        $checkboxOptions = array();
        if (is_array($allOptionsOfCurrentFilter)) {
            foreach ($allOptionsOfCurrentFilter as $key => $data) {
                $data['key'] = $key;

                // check if current option (of searchresults) is in array of all possible options
                $isOptionInOptionArray = false;
                if (is_array($options)) {
                    foreach ($options as $optionInResultList) {
                        if ($optionInResultList['value'] == $data['tag']) {
                            $isOptionInOptionArray = true;
                            $data['results'] = $optionInResultList['results'];
                            break;
                        }
                    }
                }

                // if option is in optionArray, we have to mark the checkboxes
                if ($isOptionInOptionArray) {
                    // if user has selected a checkbox it must be selected on the resultpage, too.
                    // options which have been preselected in the backend are
                    // already in $this->piVars['filter'][$filter['uid]]
                    if ($this->piVars['filter'][$filter['uid']][$key]) {
                        $data['selected'] = 1;
                    }

                    // mark all checkboxes if that config options is set and no search string was given and there
                    // are no preselected filters given for that filter
                    if ($this->isEmptySearch
                        && $filter['markAllCheckboxes']
                        && empty($this->preselectedFilter[$filter['uid']])
                    ) {
                        $data['selected'] = 1;
                    }
                } else { // if an option was not found in the search results
                    $data['disabled'] = 1;
                }

                $data['id'] = 'filter_' . $filter['uid'] . '_' . $key;
                $checkboxOptions[] = $data;
            }
        }

        // modify filter options by hook
        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilterOptions'])) {
            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['ke_search']['modifyFilterOptions'] as $_classRef) {
                $_procObj = &GeneralUtility::makeInstance($_classRef);
                $_procObj->modifyFilterOptions($filter, $checkboxOptions, $this);
            }
        }

        return $checkboxOptions;
    }
public function compileCheckboxOptions ( $ filter , $ options ) { $ allOptionsOfCurrentFilter = $ filter [ 'options' ] ; // alphabetical sorting of filter options if ( $ filter [ 'alphabeticalsorting' ] == 1 ) { $ this -> sortArrayByColumn ( $ allOptionsOfCurrentFilter , 'title' ) ; } // loop through options $ checkboxOptions = array ( ) ; if ( is_array ( $ allOptionsOfCurrentFilter ) ) { foreach ( $ allOptionsOfCurrentFilter as $ key => $ data ) { $ data [ 'key' ] = $ key ; // check if current option (of searchresults) is in array of all possible options $ isOptionInOptionArray = false ; if ( is_array ( $ options ) ) { foreach ( $ options as $ optionInResultList ) { if ( $ optionInResultList [ 'value' ] == $ data [ 'tag' ] ) { $ isOptionInOptionArray = true ; $ data [ 'results' ] = $ optionInResultList [ 'results' ] ; break ; } } } // if option is in optionArray, we have to mark the checkboxes if ( $ isOptionInOptionArray ) { // if user has selected a checkbox it must be selected on the resultpage, too. // options which have been preselected in the backend are // already in $this->piVars['filter'][$filter['uid]] if ( $ this -> piVars [ 'filter' ] [ $ filter [ 'uid' ] ] [ $ key ] ) { $ data [ 'selected' ] = 1 ; } // mark all checkboxes if that config options is set and no search string was given and there // are no preselected filters given for that filter if ( $ this -> isEmptySearch && $ filter [ 'markAllCheckboxes' ] && empty ( $ this -> preselectedFilter [ $ filter [ 'uid' ] ] ) ) { $ data [ 'selected' ] = 1 ; } } else { // if an option was not found in the search results $ data [ 'disabled' ] = 1 ; } $ data [ 'id' ] = 'filter_' . $ filter [ 'uid' ] . '_' . $ key ; $ checkboxOptions [ ] = $ data ; } } // modify filter options by hook if ( is_array ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXTCONF' ] [ 'ke_search' ] [ 'modifyFilterOptions' ] ) ) { foreach ( $ GLOBALS [ 'TYPO3_CONF_VARS' ] [ 'EXTCONF' ] [ 'ke_search' ] [ 'modifyFilterOptions' ] as $ _classRef ) { $ _procObj = & GeneralUtility :: makeInstance ( $ _classRef ) ; $ _procObj -> modifyFilterOptions ( $ filter , $ checkboxOptions , $ this ) ; } } return $ checkboxOptions ; }
compiles a list of checkbox records
@param integer $filterUid UID of the filter for which we need the checkboxes
@param array $options contains all options which are found in the search result
@return array list of checkboxes records
compiles a list of checkbox records