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:
parent
66b64b302b
commit
55cb3a92e3
|
@ -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>
|
2013-07-29 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* include/functions_api.php: a lot of tiny fixes.
|
* include/functions_api.php: a lot of tiny fixes.
|
||||||
|
|
|
@ -283,39 +283,36 @@ if (!empty($groups)) {
|
||||||
//Set the content of page of groups
|
//Set the content of page of groups
|
||||||
$offset = (int)get_parameter('offset', 0);
|
$offset = (int)get_parameter('offset', 0);
|
||||||
$count_visible_groups = 0;
|
$count_visible_groups = 0;
|
||||||
$count_visible_groups_block = 0;
|
|
||||||
$stop_count_block = false;
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$start = 0;
|
$start = 0;
|
||||||
$stop = 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) {
|
foreach ($groups as $group) {
|
||||||
if (((int)$group['parent']) == 0) {
|
if (((int)$group['parent']) == 0) {
|
||||||
$count_visible_groups++;
|
$count_visible_groups++;
|
||||||
if (!$stop_count_block)
|
|
||||||
$count_visible_groups_block++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($count_visible_groups - 1) == ($offset) ) {
|
if (($count_visible_groups - 1) == $offset) {
|
||||||
$stop_count_block = true;
|
$start = $count;
|
||||||
$start = $count;
|
if ($offset > 0) {
|
||||||
}
|
$start++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -1 for in the all pages is added all group
|
if (($count_visible_groups - 1) == ($config['block_size'] + $offset)) {
|
||||||
if (($count_visible_groups - 1) == ($offset + ($config['block_size'] - 1))) {
|
$stop = $count;
|
||||||
$stop_count_block = true;
|
}
|
||||||
$stop = $count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
if ($stop == 0) {
|
if ($stop == 0) {
|
||||||
$stop = $start + $config['block_size'];
|
$stop = $start + $config['block_size'] + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1 for to add all group
|
// 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_slice($groups, $start, ($stop - $start));
|
||||||
$groups = array_merge(array($all_group), $groups);
|
$groups = array_merge(array($all_group), $groups);
|
||||||
|
|
Loading…
Reference in New Issue