2013-09-03 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_ui.php: into the function "ui_pagination"
	added the parameter "print_total_items" to show the total of
	item in the list. It is showed althought the pagination does not.
	
	* operation/agentes/estado_agente.php: changed to don't show the
	total in the pagination block in the bottom.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8732 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-09-03 08:59:19 +00:00
parent a8f275a175
commit 0aef6ae3a8
3 changed files with 45 additions and 5 deletions

View File

@ -1,3 +1,12 @@
2013-09-03 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: into the function "ui_pagination"
added the parameter "print_total_items" to show the total of
item in the list. It is showed althought the pagination does not.
* operation/agentes/estado_agente.php: changed to don't show the
total in the pagination block in the bottom.
2013-09-03 Ramon Novoa <rnovoa@artica.es>
* extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql,

View File

@ -1472,10 +1472,12 @@ function ui_process_page_body ($string, $bitfield) {
* @param int $pagination Current pagination size. If a user requests a larger
* pagination than config["block_size"]
* @param bool $return Whether to return or print this
* @param string $offset_name The name of parameter for the offset.
* @param bool $print_total_items Show the text with the total items. By default true.
*
* @return string The pagination div or nothing if no pagination needs to be done
*/
function ui_pagination ($count, $url = false, $offset = 0, $pagination = 0, $return = false, $offset_name = 'offset') {
function ui_pagination ($count, $url = false, $offset = 0, $pagination = 0, $return = false, $offset_name = 'offset', $print_total_items = true) {
global $config;
if (empty ($pagination)) {
@ -1503,6 +1505,20 @@ function ui_pagination ($count, $url = false, $offset = 0, $pagination = 0, $ret
*/
$block_limit = 15; // Visualize only $block_limit blocks
if ($count <= $pagination) {
if ($print_total_items) {
$output = '<div class="pagination">';
//Show the count of items
$output .= sprintf(__('Total items: %s'), $count);
// End div and layout
$output .= "</div>";
if ($return === false)
echo $output;
return $output;
}
return false;
}
// If exists more registers than I can put in a page, calculate index markers
@ -1533,6 +1549,13 @@ function ui_pagination ($count, $url = false, $offset = 0, $pagination = 0, $ret
$inicio_pag = 0;
$output = '<div class="pagination">';
//Show the count of items
if ($print_total_items) {
$output .= sprintf(__('Total items: %s'), $count);
$output .= '<br>';
}
// Show GOTO FIRST button
$output .= '<a class="pagination go_first" href="'.$url.'&amp;'.$offset_name.'=0">'.html_print_image ("images/go_first.png", true, array ("class" => "bot")).'</a>&nbsp;';
// Show PREVIOUS button
@ -1587,6 +1610,7 @@ function ui_pagination ($count, $url = false, $offset = 0, $pagination = 0, $ret
$myoffset = floor (($count - 1) / $pagination) * $pagination;
$output .= '<a class="pagination go_last" href="'.$url.'&amp;'.$offset_name.'='.$myoffset.'">'.html_print_image ("images/go_last.png", true, array ("class" => "bot")).'</a>';
}
// End div and layout
$output .= "</div>";

View File

@ -505,7 +505,14 @@ foreach ($agents as $agent) {
if (!empty ($table->data)) {
html_print_table ($table);
ui_pagination ($total_agents, ui_get_url_refresh (array ('group_id' => $group_id, 'search' => $search, 'sort_field' => $sortField, 'sort' => $sort, 'status' => $status)));
ui_pagination ($total_agents,
ui_get_url_refresh(array(
'group_id' => $group_id,
'search' => $search,
'sort_field' => $sortField,
'sort' => $sort,
'status' => $status)),
0, 0, false, 'offset', false);
unset ($table);
}
else {