mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-26 11:52:59 +01:00
LSsearch : Add nbObjectsByPageChoices parameter
This commit is contained in:
parent
1a2d881322
commit
2708dd01ee
5 changed files with 69 additions and 8 deletions
|
@ -34,6 +34,7 @@ configuration des &LSobjects;, dans la variable <varname>LSsearch</varname>
|
||||||
// Paramètre d'affichage
|
// Paramètre d'affichage
|
||||||
'displayFormat' => [LSformat],
|
'displayFormat' => [LSformat],
|
||||||
'nbObjectsByPage' => [integer],
|
'nbObjectsByPage' => [integer],
|
||||||
|
'nbObjectsByPageChoices' => array([integer], [integer], ...),
|
||||||
'nbPageLinkByPage' => [integer],
|
'nbPageLinkByPage' => [integer],
|
||||||
'validPatternRegex' => '[regex]'
|
'validPatternRegex' => '[regex]'
|
||||||
),
|
),
|
||||||
|
@ -234,6 +235,14 @@ contexte dans lequel cette recherche est effectuée.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>nbObjectsByPageChoices</term>
|
||||||
|
<listitem>
|
||||||
|
<simpara>Tableau des choix proposés à l'utilisateur pour le nombre d'objets maximum affichés dans une page
|
||||||
|
de résultat de la recherche.</simpara>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>nbPageLinkByPage</term>
|
<term>nbPageLinkByPage</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
|
|
@ -181,6 +181,8 @@ $GLOBALS['LSobjects']['LSpeople'] = array (
|
||||||
),
|
),
|
||||||
'params' => array (
|
'params' => array (
|
||||||
'recursive' => true,
|
'recursive' => true,
|
||||||
|
'nbObjectsByPage' => 5,
|
||||||
|
'nbObjectsByPageChoices' => array(5, 10, 15),
|
||||||
),
|
),
|
||||||
'predefinedFilters' => array (
|
'predefinedFilters' => array (
|
||||||
'(jpegPhoto=*)' => 'With photo',
|
'(jpegPhoto=*)' => 'With photo',
|
||||||
|
|
|
@ -236,27 +236,34 @@ td.LSobject-list-names {
|
||||||
*/
|
*/
|
||||||
p.LSobject-list-page {
|
p.LSobject-list-page {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 0.5em;
|
margin: auto;
|
||||||
|
margin-top: 0.5em;
|
||||||
|
max-width: 20em;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.LSobject-list-page {
|
a.LSobject-list-page, a.LSobject-list-nb-by-page {
|
||||||
color: #0072b8;
|
color: #0072b8;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.LSobject-list-page:hover {
|
a.LSobject-list-page:hover, a.LSobject-list-nb-by-page:hover {
|
||||||
color: #0072b8;
|
color: #0072b8;
|
||||||
}
|
}
|
||||||
|
|
||||||
strong.LSobject-list-page {
|
strong.LSobject-list-page, strong.LSobject-list-nb-by-page {
|
||||||
color: #0072b8;
|
color: #0072b8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#LSobject_list_nbresult, p.LSobject-list-nb-by-page {
|
||||||
|
float: right;
|
||||||
|
clear: both;
|
||||||
|
color: #333;
|
||||||
|
font-style: italic;
|
||||||
|
margin: 0;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
#LSobject_list_nbresult {
|
#LSobject_list_nbresult {
|
||||||
float: right;
|
|
||||||
color: #333;
|
|
||||||
font-style: italic;
|
|
||||||
margin-right: 20px;
|
|
||||||
text-transform: lowercase;
|
text-transform: lowercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ class LSsearch {
|
||||||
'displaySubDn' => NULL,
|
'displaySubDn' => NULL,
|
||||||
'displayFormat' => NULL,
|
'displayFormat' => NULL,
|
||||||
'nbObjectsByPage' => NB_LSOBJECT_LIST,
|
'nbObjectsByPage' => NB_LSOBJECT_LIST,
|
||||||
|
'nbObjectsByPageChoices' => array(25, 50, 75, 100),
|
||||||
'nbPageLinkByPage' => 10,
|
'nbPageLinkByPage' => 10,
|
||||||
'customInfos' => array(),
|
'customInfos' => array(),
|
||||||
'withoutCache' => false,
|
'withoutCache' => false,
|
||||||
|
@ -334,6 +335,34 @@ class LSsearch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nbObjectsByPageChoices
|
||||||
|
if (isset($params['nbObjectsByPageChoices'])) {
|
||||||
|
if (is_array($params['nbObjectsByPageChoices'])) {
|
||||||
|
$choices = array();
|
||||||
|
$choiceError = false;
|
||||||
|
foreach($params['nbObjectsByPageChoices'] as $choice) {
|
||||||
|
if (is_int($choice) && !in_array($choice, $choices)) {
|
||||||
|
$choices[] = $choice;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$choiceError = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!empty($choices) && !$choiceError) {
|
||||||
|
$this -> params['nbObjectsByPageChoices'] = $choices;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LSerror :: addErrorCode('LSsearch_03','nbObjectsByPageChoices');
|
||||||
|
$OK = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LSerror :: addErrorCode('LSsearch_03','nbObjectsByPageChoices');
|
||||||
|
$OK = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Sort Limit
|
// Sort Limit
|
||||||
if (isset($params['sortlimit'])) {
|
if (isset($params['sortlimit'])) {
|
||||||
if (is_int($params['sortlimit']) && $params['sortlimit']>=0 ) {
|
if (is_int($params['sortlimit']) && $params['sortlimit']>=0 ) {
|
||||||
|
|
|
@ -113,7 +113,21 @@
|
||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<span id='LSobject_list_nbresult'>{$LSsearch->label_total|escape:"htmlall"}</span>
|
<span id='LSobject_list_nbresult'>{$LSsearch->label_total|escape:"htmlall"}</span>
|
||||||
|
{if !empty($page.list)}
|
||||||
|
<p class='LSobject-list-nb-by-page'>
|
||||||
|
{tr msg='Nb / page :'}
|
||||||
|
{foreach from=$LSsearch->getParam('nbObjectsByPageChoices') item=choice}
|
||||||
|
{if $LSsearch->getParam('nbObjectsByPage') == $choice}
|
||||||
|
<strong><a href='view.php?LSobject={$LSsearch->LSobject|escape:"url"}&nbObjectsByPage={$choice}' class='LSobject-list-nb-by-page'>{$choice}</a></strong>
|
||||||
|
{else}
|
||||||
|
<a href='view.php?LSobject={$LSsearch->LSobject|escape:"url"}&nbObjectsByPage={$choice}' class='LSobject-list-nb-by-page'>{$choice}</a>
|
||||||
|
{/if}
|
||||||
|
{/foreach}
|
||||||
|
</p>
|
||||||
|
{/if}
|
||||||
|
|
||||||
{if $page.nbPages > 1}
|
{if $page.nbPages > 1}
|
||||||
<p class='LSobject-list-page'>
|
<p class='LSobject-list-page'>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue