/** * @param ApplicationFacet[] * @return FacetBase[] */ public function buildFacetList($rawFacetList) { $facets = array(); if ( is_array($rawFacetList) ) { $applicationIdentifier = $this->applicationObject()->attribute('identifier'); FacetFieldTagLanguage::$applicationIdentifier = $applicationIdentifier; FacetFieldTag::$applicationIdentifier = $applicationIdentifier; FacetPublishedSince::$applicationIdentifier = $applicationIdentifier; foreach ($rawFacetList as $rawFacet) { $usableFacet = FacetFactory::factory($rawFacet); if ( $usableFacet instanceof FacetBase ) { $facets[] = $usableFacet; if ( $usableFacet instanceof FacetFieldTagLanguage ) $usableFacet->defaultValues = ApplicationLocalized::getTagFromLanguage( $this->applicationLocalized()->getPublisherLanguages() ); } } } return $facets; }
/** * @param array $solrResult * @return array */ public function facetResult( &$solrResult ) { $translations = FacetFilteringTool::getTaxonomyTranslation ( $this->attribute ); $result = parent::facetResult($solrResult); //sorting $keysById = array(); foreach ( $result as $k => $f ) $keysById[$f['id']] = $k; $sortedResult = array(); foreach($this->defaultValues as $id) { if( isset($keysById[$id])) { $visible = true; if (SolrSafeOperatorHelper::featureIsActive('Univadis18Redesign')) { $hiddenValues = SolrSafeOperatorHelper::feature('Univadis18Redesign', 'SpecialtyFacetHiddenValues'); if (in_array($id, $hiddenValues)) { $visible = false; } } $f = $result[$keysById[$id]]; $f['visible'] = $visible; $sortedResult[$keysById[$id]] = $f; } else { if ( isset($translations[$id]) ) { $visible = true; if (SolrSafeOperatorHelper::featureIsActive('Univadis18Redesign')) { $hiddenValues = SolrSafeOperatorHelper::feature('Univadis18Redesign', 'SpecialtyFacetHiddenValues'); if (in_array($id, $hiddenValues)) { $visible = false; } } $sortedResult[$translations[$id]] = array( 'count' => 0, 'id' => $id, 'checked' => 0, 'visible' => $visible, ); } } } return $sortedResult; }
public function __construct($uxType, $key, $field) { parent::__construct($uxType, $key, $field); $this->hideEmptyValues = true; $this->alwaysHideEmptyValues = true; $this->forcedOpen = true; $this->sortOnRefresh = false; $this->sort = 'alpha'; $this->minCount = 0; $this->initDefaultValues(); }
public function __construct($options) { $header = isset($options['header']) ? $options['header'] : ''; parent::__construct(7, $header, 'trial_country'); $this->fieldName = isset($options['fieldName']) ? $options['fieldName'] : ''; $this->allValuesTranslation = isset($options['allValuesTranslation']) ? $options['allValuesTranslation'] : ''; $this->hideEmptyValues = false; $this->alwaysHideEmptyValues = false; $this->forcedOpen = true; $this->sortOnRefresh = false; $this->sort = 'alpha'; $this->minCount = 0; }
public function __construct($uxType, $key, $field) { parent::__construct($uxType, $key, $field); $this->hideEmptyValues = true; $this->alwaysHideEmptyValues = true; $this->forcedOpen = true; $this->sortOnRefresh = false; $this->sort = 'count'; $this->minCount = 0; $this->defaultValues = $this->applicationIds(); foreach ( $this->defaultValues as $k => $v ) { $this->defaultValues[$k] = strval($v); } }
public function __construct($key, $field, $fieldsToShow, $precheckedValue = null) { parent::__construct(9, $key, $field); $this->hideEmptyValues = false; $this->alwaysHideEmptyValues = true; $this->forcedOpen = true; $this->sortOnRefresh = false; $this->sort = 'alpha'; $this->minCount = 0; $this->fieldsToShow = $fieldsToShow; if (count($fieldsToShow) == 1 && $precheckedValue == null) { $precheckedValue = $fieldsToShow[0]; } $this->precheckedValue = $precheckedValue; $this->allValuesTranslation = ezpI18n::tr('merck/oncology', 'ALL_VALUES'); }
/** * @param int $uxType * @param string $key * @param string $field */ public function __construct($uxType, $key, $field) { parent::__construct($uxType, $key, $field); $this->canBeHidden = true; $this->hideEmptyValues = false; if ( self::isForcedLanguage() ) { $this->forcedValues = array( LocaleTool::languageISO639Code(LocaleTool::mainLanguage()) ); } $defaultValues = array( LocaleTool::languageISO639Code() ); foreach( LocaleTool::languageList() as $locale ) { $language = LocaleTool::languageISO639Code( $locale ); if( !isset($defaultValues[$language]) ) $defaultValues[] = $language; } $this->defaultValues = $defaultValues; $overrideLanguageFacetIsActive = SolrSafeOperatorHelper::featureIsActive('DefaultLanguageFacetValues'); if ($overrideLanguageFacetIsActive) { $forcedLanguageOverrides = SolrSafeOperatorHelper::feature('DefaultLanguageFacetValues', 'ApplicationDefaultLanguage'); if (!empty($forcedLanguageOverrides)) { $identifier = self::$applicationIdentifier; if (!empty($identifier) && isset($forcedLanguageOverrides[$identifier])) { $this->forcedValues = $forcedLanguageOverrides[$identifier]; } } } }
public function __construct() { parent::__construct(1, 'Sections', 'section'); $this->sort = 'count'; $this->sortOnRefresh = false; }
/** * @param int $uxType * @param string $key * @param string $field */ public function __construct($uxType, $key, $field) { parent::__construct($uxType, $key, $field); }
/** * @param int $uxType * @param string $key * @param string $field */ public function __construct($uxType, $key, $field) { parent::__construct($uxType, $key, $field); $this->sortOnRefresh = false; }
/** * @return array */ protected function allSpecialitiesFacet() { $facet = new FacetFieldTag(1, 'Speciality', 'speciality'); $facet->sort = 'alpha'; $params = array( 'indent' => 'on', 'q' => '', 'start' => 0, 'rows' => 1, 'fq' => $this->solrFilter(), 'fl' => 'meta_main_node_id_si', 'qt' => 'ezpublish', 'explainOther' => '', 'hl.fl' => '', 'facet' => 'true', ); $params = $this->mergeFacetParams( $params , $facet->facetParams() ); $solrResult = SolrTool::rawSearch($params); $facetResult = $facet->facetResult( $solrResult ); $results = array(); foreach ( $facetResult as $kw => $v_arr ) { $firstChar = ''; if ( preg_match( '#^(.)#u', $kw, $matches ) ) $firstChar = $matches[1]; if( !preg_match("#\pL#u", $firstChar) ) $firstChar = '#'; if ( !isset( $results[$firstChar]) ) $results[$firstChar] = array(); $results[$firstChar][$kw] = $v_arr; } ksort($results); // We put the # values to the end if( isset($results['#']) ) { $hashResults = $results['#']; unset($results['#']); $results['#'] = $hashResults; } // we rely on solr sort for the time being for the sub arrays return $results; }