Skip to content

Commit

Permalink
Add options to display print buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
coudot committed Nov 19, 2024
1 parent a7be9a2 commit 4bd251d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
2 changes: 2 additions & 0 deletions conf/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@

$datatables_page_length_choices = array(10, 25, 50, 100, -1);
$datatables_page_length_default = 10;
$datatables_print_all = true;
$datatables_print_page = true;
$datatables_auto_print = true;

$display_items = array('identifier', 'firstname', 'lastname', 'title', 'businesscategory', 'employeenumber', 'employeetype', 'mail', 'mailquota', 'phone', 'mobile', 'fax', 'postaladdress', 'street', 'postalcode', 'l', 'state', 'organizationalunit', 'organization', 'manager', 'secretary' );
Expand Down
20 changes: 18 additions & 2 deletions docs/search-parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ Configure items shown when displaying results:
Datatables
----------

Pagination
~~~~~~~~~~

Define pagination values in dropdown:

.. code-block:: php
Expand All @@ -40,9 +43,22 @@ Set default pagination for results (can also be used to force the length without
$datatables_page_length_default = 10;
Enable or disable autoPrint feature:
Print
~~~~~
Show "print all" button:

.. code-block:: php
$datatables_auto_print = true;
$datatables_print_all = true;
Show "print page" button:

.. code-block:: php
$datatables_print_page = true;
Enable autoPrint feature (will launch print dialog directly when cliking on print buttons):

.. code-block:: php
$datatables_auto_print = true;
2 changes: 2 additions & 0 deletions htdocs/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ function sha256($string)
}
$smarty->assign('datatables_page_length_choices', $datatables_page_length_choices);
$smarty->assign('datatables_page_length_default', $datatables_page_length_default);
$smarty->assign('datatables_print_all', $datatables_print_all);
$smarty->assign('datatables_print_page', $datatables_print_page);
$smarty->assign('datatables_auto_print', $datatables_auto_print);
$smarty->assign('version',$version);
$smarty->assign('display_footer',$display_footer);
Expand Down
6 changes: 5 additions & 1 deletion templates/footer.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@
},
bottom2Start: {
buttons: [
{if $datatables_print_all}
{ extend: 'print', text: '{$msg_print_all}', autoPrint: {if $datatables_auto_print}true{else}false{/if} },
{ extend: 'print', text: '{$msg_print_page}', exportOptions: { modifier: { page: 'current' } }, autoPrint: {if $datatables_auto_print}true{else}false{/if} }
{/if}
{if $datatables_print_page}
{ extend: 'print', text: '{$msg_print_page}', exportOptions: { modifier: { page: 'current' } }, autoPrint: {if $datatables_auto_print}true{else}false{/if} },
{/if}
]
}
},
Expand Down

0 comments on commit 4bd251d

Please sign in to comment.