mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 09:59:06 +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
|
||||
'displayFormat' => [LSformat],
|
||||
'nbObjectsByPage' => [integer],
|
||||
'nbObjectsByPageChoices' => array([integer], [integer], ...),
|
||||
'nbPageLinkByPage' => [integer],
|
||||
'validPatternRegex' => '[regex]'
|
||||
),
|
||||
|
@ -234,6 +235,14 @@ contexte dans lequel cette recherche est effectuée.</para>
|
|||
</listitem>
|
||||
</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>
|
||||
<term>nbPageLinkByPage</term>
|
||||
<listitem>
|
||||
|
|
|
@ -181,6 +181,8 @@ $GLOBALS['LSobjects']['LSpeople'] = array (
|
|||
),
|
||||
'params' => array (
|
||||
'recursive' => true,
|
||||
'nbObjectsByPage' => 5,
|
||||
'nbObjectsByPageChoices' => array(5, 10, 15),
|
||||
),
|
||||
'predefinedFilters' => array (
|
||||
'(jpegPhoto=*)' => 'With photo',
|
||||
|
|
|
@ -236,27 +236,34 @@ td.LSobject-list-names {
|
|||
*/
|
||||
p.LSobject-list-page {
|
||||
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;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.LSobject-list-page:hover {
|
||||
a.LSobject-list-page:hover, a.LSobject-list-nb-by-page:hover {
|
||||
color: #0072b8;
|
||||
}
|
||||
|
||||
strong.LSobject-list-page {
|
||||
strong.LSobject-list-page, strong.LSobject-list-nb-by-page {
|
||||
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 {
|
||||
float: right;
|
||||
color: #333;
|
||||
font-style: italic;
|
||||
margin-right: 20px;
|
||||
text-transform: lowercase;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ class LSsearch {
|
|||
'displaySubDn' => NULL,
|
||||
'displayFormat' => NULL,
|
||||
'nbObjectsByPage' => NB_LSOBJECT_LIST,
|
||||
'nbObjectsByPageChoices' => array(25, 50, 75, 100),
|
||||
'nbPageLinkByPage' => 10,
|
||||
'customInfos' => array(),
|
||||
'withoutCache' => false,
|
||||
|
@ -333,6 +334,34 @@ class LSsearch {
|
|||
$OK=false;
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
if (isset($params['sortlimit'])) {
|
||||
|
|
|
@ -113,7 +113,21 @@
|
|||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
|
||||
<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}
|
||||
<p class='LSobject-list-page'>
|
||||
|
||||
|
|
Loading…
Reference in a new issue