search 2.7
This commit is contained in:
parent
5502114fff
commit
ce15d55695
@ -1,2 +1,5 @@
|
||||
# Version 2.7
|
||||
- Traduction
|
||||
- Suppression du cadre de présentation des résultats
|
||||
# Version 2.6
|
||||
- Chargement de la feuille de style si présente
|
@ -19,7 +19,7 @@
|
||||
|
||||
class search extends common {
|
||||
|
||||
const VERSION = '2.6';
|
||||
const VERSION = '2.7';
|
||||
const REALNAME = 'Recherche';
|
||||
const DATADIRECTORY = self::DATA_DIR . 'search/';
|
||||
|
||||
@ -254,11 +254,11 @@ class search extends common {
|
||||
}
|
||||
// Message de synthèse de la recherche
|
||||
if (count($result) === 0) {
|
||||
self::$resultTitle = 'Aucun résultat';
|
||||
self::$resultError = 'Avez-vous pensé aux accents ?';
|
||||
self::$resultTitle = helper::translate('Aucun résultat');
|
||||
self::$resultError = helper::translate('Avez-vous pensé aux accents ?');
|
||||
} else {
|
||||
self::$resultError = '';
|
||||
self::$resultTitle = ' Résultat de votre recherche';
|
||||
//self::$resultTitle = sprintf(' %s',helper::translate('Résultat de votre recherche'));
|
||||
rsort($result);
|
||||
foreach ($result as $key => $value) {
|
||||
$r [] = $value['preview'];
|
||||
@ -315,7 +315,7 @@ class search extends common {
|
||||
$valid = preg_match_all($keywords,$contenu,$matches,PREG_OFFSET_CAPTURE);
|
||||
if ($valid > 0 ) {
|
||||
if (($matches[0][0][1]) > 0) {
|
||||
$resultat = '<h2><a href="./?'.$url.'" target="_blank" rel="noopener">' . $titre . '</a></h2>';
|
||||
$resultat = sprintf('<h2><a href="./?%s" target="_blank" rel="noopener">%s (%s)</a></h2>', $url, $titre, count($matches[0]));
|
||||
// Création de l'aperçu
|
||||
// Eviter de découper avec une valeur négative
|
||||
$d = $matches[0][0][1] - 50 < 0 ? 1 : $matches[0][0][1] - 50;
|
||||
@ -327,7 +327,7 @@ class search extends common {
|
||||
$t = preg_replace($keywords, '<span class= "keywordColor">\1</span>',$t);
|
||||
// Sauver résultat
|
||||
$resultat .= '<p class="searchResult">'.$t.'...</p>';
|
||||
$resultat .= '<p class="searchTitle">' . count($matches[0]) . (count($matches[0]) === 1 ? ' correspondance<p>' : ' correspondances<p>');
|
||||
|
||||
//}
|
||||
return ([
|
||||
'matches' => count($matches[0]),
|
||||
|
@ -1,9 +1,16 @@
|
||||
|
||||
.searchTitle {
|
||||
font: caption;
|
||||
font-style: italic;
|
||||
margin-left: 1em;
|
||||
}
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
.searchResult {
|
||||
margin: .3em 0 .3em 1em;
|
||||
|
@ -1,41 +1,41 @@
|
||||
<?php echo template::formOpen('searchForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col10 offset1">
|
||||
<div class="row">
|
||||
<div class="col9 verticalAlignMiddle">
|
||||
<?php echo template::text('searchMotphraseclef', [
|
||||
'placeholder' => $this->getData(['module', $this->getUrl(0), 'config', 'placeHolder']) ? $this->getData(['module', $this->getUrl(0), 'config', 'placeHolder']):'Un ou plusieurs mots clef séparés par un espace',
|
||||
'value' => $module::$motclef
|
||||
]); ?>
|
||||
</div>
|
||||
<?php $col = empty($this->getData(['module', $this->getUrl(0), 'config', 'submitText'])) ? 'col1' : 'col3';?>
|
||||
<div class="<?php echo $col;?> verticalAlignMiddle">
|
||||
<?php echo template::submit('pageEditSubmit', [
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'submitText']),
|
||||
'ico' => 'search'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col10 offset1">
|
||||
<div class="row">
|
||||
<div class="col9 verticalAlignMiddle">
|
||||
<?php echo template::text('searchMotphraseclef', [
|
||||
'placeholder' => $this->getData(['module', $this->getUrl(0), 'config', 'placeHolder']) ? $this->getData(['module', $this->getUrl(0), 'config', 'placeHolder']) : 'Un ou plusieurs mots clef séparés par un espace',
|
||||
'value' => $module::$motclef
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('searchMotentier', true, 'Mots approchants', [
|
||||
'checked' => $module::$motentier,
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ( $module::$resultTitle ): ?>
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<?php echo '<h4>'.$module::$resultTitle . '</h4>'; ?>
|
||||
<?php if ($module::$resultList )
|
||||
echo '<p>'.$module::$resultList.'</p>';
|
||||
?>
|
||||
<?php if ($module::$resultError )
|
||||
echo '<p>'.$module::$resultError.'</p>';
|
||||
?>
|
||||
<?php $col = empty($this->getData(['module', $this->getUrl(0), 'config', 'submitText'])) ? 'col1' : 'col3'; ?>
|
||||
<div class="<?php echo $col; ?> verticalAlignMiddle">
|
||||
<?php echo template::submit('pageEditSubmit', [
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'submitText']),
|
||||
'ico' => 'search'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('searchMotentier', true, 'Mots approchants', [
|
||||
'checked' => $module::$motentier,
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php if ($module::$resultTitle)
|
||||
echo $module::$resultTitle;
|
||||
?>
|
||||
<?php if ($module::$resultList)
|
||||
echo '<p>' . $module::$resultList . '</p>';
|
||||
?>
|
||||
<?php if ($module::$resultError)
|
||||
echo '<p>' . $module::$resultError . '</p>';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
@ -455,5 +455,7 @@
|
||||
"Nouveau mot de passe enregistré": "Nueva contraseña guardada",
|
||||
"'Rien à importer, erreur de format ou fichier incorrect": "'Nada que importar, error de formato o archivo incorrecto",
|
||||
"Importation effectuée": "Importación realizada",
|
||||
"Erreur de lecture, vérifiez les permissions": "Error de lectura, verifique los permisos"
|
||||
"Erreur de lecture, vérifiez les permissions": "Error de lectura, verifique los permisos",
|
||||
"Avez-vous pensé aux accents ?": "¿Has pensado en los acentos?",
|
||||
"Aucun résultat": "Sin resultados"
|
||||
}
|
@ -453,5 +453,7 @@
|
||||
"Nouveau mot de passe enregistré": "",
|
||||
"'Rien à importer, erreur de format ou fichier incorrect": "",
|
||||
"Importation effectuée": "",
|
||||
"Erreur de lecture, vérifiez les permissions": ""
|
||||
"Erreur de lecture, vérifiez les permissions": "",
|
||||
"Avez-vous pensé aux accents ?": "",
|
||||
"Aucun résultat": ""
|
||||
}
|
Loading…
Reference in New Issue
Block a user