2013-07-30 Sergio Martin <sergio.martin@artica.es>

* godmode/groups/group_list.php: Fix pagination on
	manage groups view



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8593 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2013-07-30 07:54:51 +00:00
parent 66b64b302b
commit 55cb3a92e3
2 changed files with 24 additions and 22 deletions

View File

@ -1,3 +1,8 @@
2013-07-30 Sergio Martin <sergio.martin@artica.es>
* godmode/groups/group_list.php: Fix pagination on
manage groups view
2013-07-29 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_api.php: a lot of tiny fixes.

View File

@ -283,39 +283,36 @@ if (!empty($groups)) {
//Set the content of page of groups
$offset = (int)get_parameter('offset', 0);
$count_visible_groups = 0;
$count_visible_groups_block = 0;
$stop_count_block = false;
$count = 0;
$start = 0;
$stop = 0;
//$offset = $offset - $offset / $config['block_size'];
// Do the pagination manually to show the N first groups of first level (parent=0)
// TODO: Do it better. Maybe with ajax like tree view
foreach ($groups as $group) {
if (((int)$group['parent']) == 0) {
$count_visible_groups++;
if (!$stop_count_block)
$count_visible_groups_block++;
}
if (($count_visible_groups - 1) == ($offset) ) {
$stop_count_block = true;
$start = $count;
}
if (($count_visible_groups - 1) == $offset) {
$start = $count;
if ($offset > 0) {
$start++;
}
}
// -1 for in the all pages is added all group
if (($count_visible_groups - 1) == ($offset + ($config['block_size'] - 1))) {
$stop_count_block = true;
$stop = $count;
if (($count_visible_groups - 1) == ($config['block_size'] + $offset)) {
$stop = $count;
}
}
$count++;
}
if ($stop == 0) {
$stop = $start + $config['block_size'];
$stop = $start + $config['block_size'] + 1;
}
// 1 for to add all group
ui_pagination($count_visible_groups + 1, false, 0, $config['block_size'] - 1);
ui_pagination($count_visible_groups + 1, false, 0, $config['block_size']);
$groups = array_slice($groups, $start, ($stop - $start));
$groups = array_merge(array($all_group), $groups);