From 278b084214aace31824bf6b42cfaa25423b20824 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 4 Sep 2019 11:49:06 +0200 Subject: [PATCH] Add ['NB_LSOBJECT_LIST_CHOICES'] parameter --- doc/conf/globale.docbook | 10 ++++++++++ public_html/conf/config.inc.php | 1 + public_html/includes/class/class.LSsearch.php | 5 ++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/conf/globale.docbook b/doc/conf/globale.docbook index 0b7d875d..dbcc7808 100644 --- a/doc/conf/globale.docbook +++ b/doc/conf/globale.docbook @@ -223,6 +223,16 @@ define('CONST2','val2') + + $GLOBALS['NB_LSOBJECT_LIST_CHOICES'] + + Variable permettant de configurer la liste des choix proposés à + l'utilisateur pour le nombre maximum d'objets affichés par page de résultat + de recherche. + + + + MAX_SEND_FILE_SIZE diff --git a/public_html/conf/config.inc.php b/public_html/conf/config.inc.php index 0297cbd5..1d77e654 100644 --- a/public_html/conf/config.inc.php +++ b/public_html/conf/config.inc.php @@ -213,6 +213,7 @@ $GLOBALS['LSlog']['enable'] = true; define('NB_LSOBJECT_LIST',30); define('NB_LSOBJECT_LIST_SELECT',11); +$GLOBALS['NB_LSOBJECT_LIST_CHOICES'] = array(30, 60, 100); define('MAX_SEND_FILE_SIZE',2000000); diff --git a/public_html/includes/class/class.LSsearch.php b/public_html/includes/class/class.LSsearch.php index 6c5c9c30..86146741 100644 --- a/public_html/includes/class/class.LSsearch.php +++ b/public_html/includes/class/class.LSsearch.php @@ -58,7 +58,7 @@ class LSsearch { 'displaySubDn' => NULL, 'displayFormat' => NULL, 'nbObjectsByPage' => NB_LSOBJECT_LIST, - 'nbObjectsByPageChoices' => array(25, 50, 75, 100), + 'nbObjectsByPageChoices' => NULL, 'nbPageLinkByPage' => 10, 'customInfos' => array(), 'withoutCache' => false, @@ -714,6 +714,9 @@ class LSsearch { **/ public function getParam($key) { if(in_array($key,array_keys($this -> params))) { + if ($key == 'nbObjectsByPageChoices' && !is_array($this -> params['nbObjectsByPageChoices'])) { + return (isset($GLOBALS['NB_LSOBJECT_LIST_CHOICES']) && is_array($GLOBALS['NB_LSOBJECT_LIST_CHOICES'])?$GLOBALS['NB_LSOBJECT_LIST_CHOICES']:range(NB_LSOBJECT_LIST, NB_LSOBJECT_LIST*4, NB_LSOBJECT_LIST)); +} return $this -> params[$key]; } return NULL;