Skip to content
Snippets Groups Projects
Commit 92097abe authored by Laurent's avatar Laurent
Browse files

dev #22209 search result feed

first implementation of search criterias rendering
parent 9f51db80
Branches
Tags
3 merge requests!1132Hotline#29412 images des articles dans le resultat de recherche,!1027Dev#22209 search result feed,!1026Dev#22209 search result feed
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class ZendAfi_Feed_SearchResultHeader {
use Trait_Translator;
protected
$_header,
$_criterias = [],
$_description = '';
public function __construct($header) {
$this->_header = $header;
}
public function visitSearchResult($search_result) {
$this->_description = $this->_plural($search_result->getRecordsCount(),
"Aucun résultat trouvé",
"Il y a %d résultat",
"Il y a %d résultats",
$search_result->getRecordsCount());
$search_result->acceptCriteresVisitor($this);
$this->_header->description = $this->_description
. '. '
. implode('. ', $this->_criterias);
}
public function visitNoExtension($no_extension) {}
public function hasErreur() {return false;}
public function setErreur($error) {
$this->addCriteria($this->_('Erreur'), $error);
}
public function visitSearchUrl($url) {
$this->_header->link = Class_Url::absolute($url);
}
public function visitExpression($expression) {
$this->_description .= ' ' . $this->_('pour: ') . $expression;
$this->_header->title = $this->_('Recherche') . ': ' . $expression;
}
public function visitFilterOnDomain($criterias) { }
public function visitDomain($criterias) {}
public function visitDigitalLib($digital_lib) {
if ($digital_lib)
$this->addCriteria($this->_('Bibliothèque numérique seulement'));
}
public function visitTri($tri, $libelle) {
$this->addCriteria($this->_('Trié par: ') . $libelle);
}
public function visitFacette($facette) {
$facette = new Class_Notice_Facette($facette);
$this->addCriteria($facette->getCodeRubriqueLibelle(), $facette->getLibelleFacette());
}
protected function addCriteria($name, $value = null) {
$this->_criterias []= $name . ($value ? (': ' . $value) : '');
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment