/** * @return array */ protected function getValues() { if ($this->values === null) { $this->values = array(); if ($this->contentClassAttribute->attribute('data_type_string') == 'ezobjectrelationlist') { $field = ezfSolrDocumentFieldBase::$DocumentFieldName->lookupSchemaName(ezfSolrDocumentFieldBase::SUBATTR_FIELD_PREFIX . $this->contentClassAttribute->attribute('identifier') . ezfSolrDocumentFieldBase::SUBATTR_FIELD_SEPARATOR . 'name' . ezfSolrDocumentFieldBase::SUBATTR_FIELD_SEPARATOR, 'string'); } else { $field = ezfSolrDocumentFieldBase::$DocumentFieldName->lookupSchemaName(ezfSolrDocumentFieldBase::ATTR_FIELD_PREFIX . $this->contentClassAttribute->attribute('identifier'), 'string'); } $facets = array('field' => $field, 'name' => $this->attributes['name'], 'limit' => 300, 'sort' => 'alpha'); $fetchParameters = array('SearchContentClassID' => array($this->contentClassAttribute->attribute('contentclass_id')), 'Facet' => array($facets)); $data = $this->client->fetchRemoteNavigationList($fetchParameters); if (isset($data[$this->attributes['name']])) { $this->values = $data[$this->attributes['name']]; // setto i valori attivi e inietto il conto nel nome foreach ($this->values as $index => $value) { $current = (array) $this->attributes['value']; if (in_array($value['query'], $current)) { $this->values[$index]['active'] = true; } $this->values[$index]['query'] = OCFacetNavgationHelper::encodeValue($this->values[$index]['query']); if (isset($value['count']) && $value['count'] > 0) { $this->values[$index]['name'] = $value['name'] . ' (' . $value['count'] . ')'; } } } } return $this->values; }
protected function initClassMap() { $definition = $this->attribute('definition'); if (!isset($definition['LocalClassIdentifier'])) { throw new Exception("Configurazione LocalClassIdentifier non trovata"); } if (!isset($definition['MapRemoteLocalAttributes'])) { throw new Exception("Configurazione MapRemoteLocalAttributes non trovata"); } $this->mapClassIdentifier = $definition['LocalClassIdentifier']; $this->mapAttributes = $definition['MapRemoteLocalAttributes']; $this->remoteClassAttributes = array_keys($this->mapAttributes); $this->localeClassAttributes = array_values($this->mapAttributes); $contentClassDataMap = array(); foreach ($this->remoteClassAttributes as $identifier) { $contentClassAttribute = new OCClassSearchTemplate(); $contentClassAttribute->setAttributes(array('id' => $this->mapClassIdentifier . '-' . $identifier, 'identifier' => $identifier, 'name' => $identifier, 'is_searchable' => true, 'contentclass_id' => $this->classIdentifier)); $contentClassDataMap[$identifier] = $contentClassAttribute; } $this->contentClass = new OCClassSearchTemplate(); $this->contentClass->setAttributes(array('identifier' => $this->mapClassIdentifier, 'data_map' => $contentClassDataMap)); }