public function buildFetch() { $filters = array(); foreach ($this->requestFields as $key => $value) { if (strpos($key, OCClassSearchFormAttributeField::NAME_PREFIX) !== false) { $contentClassAttributeID = str_replace(OCClassSearchFormAttributeField::NAME_PREFIX, '', $key); $contentClassAttribute = eZContentClassAttribute::fetch($contentClassAttributeID); if ($contentClassAttribute instanceof eZContentClassAttribute) { $field = OCClassSearchFormAttributeField::instance($contentClassAttribute); $field->buildFetch($this, $key, $value, $filters); $this->isFetch = true; } } elseif (in_array($key, OCFacetNavgationHelper::$allowedUserParamters)) { if (!empty($value)) { $this->currentParameters[$key] = $value; $this->isFetch = true; } } elseif ($key == 'class_id') { $this->currentParameters[$key] = $value; $this->addFetchField(array('name' => ezpI18n::tr('extension/ezfind/facets', 'Content type'), 'value' => eZContentClass::fetch($value)->attribute('name'), 'remove_view_parameters' => $this->getViewParametersString(array($key)))); $this->isFetch = true; } elseif ($key == 'publish_date') { $publishedField = new OCClassSearchFormPublishedField($this->requestFields['class_id']); $publishedField->buildFetch($this, $value, $filters); $this->isFetch = true; } elseif ($key == 'query') { $queryField = new OCClassSearchFormQueryField(); $queryField->buildFetch($this, $value); $this->searchText = $queryField->queryText(); $this->isFetch = true; } } $this->currentParameters['filter'] = $filters; return $this->currentParameters; }
/** * @return OCClassSearchFormAttributeField[] */ public function attributeFields() { if ($this->attributeFields === null) { $this->attributeFields = array(); $dataMap = $this->contentClass->attribute('data_map'); $disabled = eZINI::instance('ocsearchtools.ini')->variable('ClassSearchFormSettings', 'DisabledAttributes'); /** @var $dataMap eZContentClassAttribute[] */ foreach ($dataMap as $attribute) { if (!in_array($this->contentClass->attribute('identifier') . '/' . $attribute->attribute('identifier'), $disabled) && $attribute->attribute('is_searchable')) { $inputField = OCClassSearchFormAttributeField::instance($attribute); $this->attributeFields[$inputField->attribute('id')] = $inputField; } } } return $this->attributeFields; }