Personnalisation module de recherche

This commit is contained in:
Fred Tempez 2020-08-16 15:59:37 +02:00
parent fe273b8019
commit e076950f0e
5 changed files with 84 additions and 71 deletions

View File

@ -37,13 +37,24 @@ class search extends common {
// Configuration vide
public function config() {
if($this->isPost()) {
// Soumission du formulaire
$this->setData(['module', $this->getUrl(0), [
'submitText' => $this->getInput('searchSubmitText'),
'placeHolder' => $this->getInput('searchPlaceHolder')
]]);
// Valeurs en sortie, affichage du formulaire
$this->addOutput([
'view' => 'config',
'showBarEditButton' => true,
'showPageContent' => true
'redirect' => helper::baseUrl() . $this->getUrl(),
'notification' => 'Modifications enregistrées',
'state' => true
]);
}
// Valeurs en sortie, affichage du formulaire
$this->addOutput([
'title' => 'Configuration du module',
'view' => 'config'
]);
}
public function index() {
@ -141,15 +152,15 @@ class search extends common {
self::$resultList = $result;
// Valeurs en sortie, affichage du résultat
$this->addOutput([
'title' => '',
'view' => 'result',
'view' => 'index',
'notification' => $notification,
'state' => $success
'state' => $success,
'showBarEditButton' => true,
'showPageContent' => true
]);
} else {
// Valeurs en sortie, affichage du formulaire
$this->addOutput([
'title' => '',
'view' => 'index',
'showBarEditButton' => true,
'showPageContent' => true

View File

@ -1,15 +1,41 @@
<div class="row">
<?php echo template::formOpen('searchConfig'); ?>
<div class="row">
<div class="col2">
<?php echo template::button('newsConfigBack', [
<?php echo template::button('searchConfigBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
'ico' => 'left',
'value' => 'Retour'
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<h2 class="textAlignCenter">Aucun paramètre de configuration</h2>
<div class="col2 offset8">
<?php echo template::submit('searchConfigSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Paramètres</h4>
<div class="row">
<div class="col6">
<?php echo template::text('searchSubmitText', [
'label' => 'Texte du bouton de soumission',
'value' => $this->getData(['module', $this->getUrl(0), 'submitText']),
'placeholder' => 'Rechercher'
]); ?>
</div>
<div class="col6">
<?php echo template::text('searchPlaceHolder', [
'label' => 'Texte dans la zone de recherche',
'value' => $this->getData(['module', $this->getUrl(0), 'placeHolder']),
'placeholder' => 'Saisissez vos mots clés ou une phrase'
]); ?>
</div>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>
<div class="moduleVersion">Version
<?php echo $module::SEARCH_VERSION; ?>
</div>

View File

@ -2,14 +2,14 @@
<div class="row">
<div class="col10 offset1">
<div class="row">
<div class="col10 verticalAlignBottom">
<div class="col9 verticalAlignMiddle">
<?php echo template::text('searchMotphraseclef', [
'placeholder' => 'Saisissez vos mots clés ou une phrase'
'placeholder' => $this->getData(['module',$this->getUrl(0),'placeHolder']) ? $this->getData(['module',$this->getUrl(0),'placeHolder']) : 'Saisissez vos mots clés ou une phrase'
]); ?>
</div>
<div class="col2 verticalAlignBottom">
<div class="col3 verticalAlignMiddle">
<?php echo template::submit('pageEditSubmit', [
'value' => 'Ok'
'value' => $this->getData(['module',$this->getUrl(0),'submitText']) ? $this->getData(['module',$this->getUrl(0),'submitText']) : 'Rechercher'
]); ?>
</div>
</div>
@ -22,4 +22,16 @@
</div>
</div>
</div>
<?php if ($module::$resultTitle && $module::$resultList): ?>
<div class="col12">
<div class="block">
<h4><?php echo $module::$resultTitle; ?></h4>
<?php if (!empty($module::$resultList)) {
echo $module::$resultList;
} else {
echo "Rien à afficher";
} ?>
</div>
</div>
<?php endif;?>
<?php echo template::formClose(); ?>

View File

@ -1,36 +0,0 @@
<?php echo template::formOpen('searchForm'); ?>
<div class="row">
<div class="col10 offset1">
<div class="row">
<div class="col10 verticalAlignBottom">
<?php echo template::text('searchMotphraseclef', [
'placeholder' => 'Saisissez vos mots clés ou une phrase',
'value' => $module::$motclef
]); ?>
</div>
<div class="col2 verticalAlignBottom">
<?php echo template::submit('pageEditSubmit', [
'value' => 'Ok'
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<?php echo template::checkbox('searchMotentier', true, 'Mot entier uniquement', [
'checked' => $module::$motentier
]); ?>
</div>
</div>
</div>
</div>
<div class="col12">
<div class="block">
<h4><?php echo $module::$resultTitle; ?></h4>
<?php if (!empty($module::$resultList)) {
echo $module::$resultList;
} else {
echo "Rien à afficher";
} ?>
</div>
</div>
<?php echo template::formClose(); ?>