~ubuntu-branches/ubuntu/wily/ldap-account-manager/wily

« back to all changes in this revision

Viewing changes to lib/lists.inc

  • Committer: Package Import Robot
  • Author(s): Roland Gruber
  • Date: 2015-03-31 18:56:30 UTC
  • mfrom: (1.2.27)
  • Revision ID: package-import@ubuntu.com-20150331185630-z7wvaw3la13snxxa
Tags: 4.9-1
new upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
2
/*
3
 
$Id: lists.inc 5244 2014-02-09 14:47:35Z gruberroland $
 
3
$Id: lists.inc 5519 2015-02-16 19:54:21Z gruberroland $
4
4
 
5
5
  This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
6
 
  Copyright (C) 2003 - 2013  Roland Gruber
 
6
  Copyright (C) 2003 - 2015  Roland Gruber
7
7
 
8
8
  This program is free software; you can redistribute it and/or modify
9
9
  it under the terms of the GNU General Public License as published by
293
293
                                        "&amp;sort=" . $this->sortColumn . "&amp;sortdirection=" . $this->sortDirection . $filter . "\">" .
294
294
                                        "<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-first.png\"></a>\n");
295
295
                        }
296
 
                        if ($this->page > 10) {
 
296
                        if ($this->page > 11) {
297
297
                                echo("<a title=\"" . _('Jump 10 pages backward') . "\" href=\"list.php?type=" . $this->type . "&amp;norefresh=true&amp;page=" . ($this->page - 10) .
298
298
                                        "&amp;sort=" . $this->sortColumn . "&amp;sortdirection=" . $this->sortDirection . $filter . "\">" .
299
299
                                        "<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-previous.png\"></a>\n");
300
300
                        }
 
301
                        $pageCount =  ceil($count / $this->maxPageEntries);
301
302
                        for ($i = $this->page - 6; $i < ($this->page + 5); $i++) {
302
 
                                if ($i >= ($count / $this->maxPageEntries)) {
 
303
                                if ($i >= $pageCount) {
303
304
                                        break;
304
305
                                }
305
306
                                elseif ($i < 0) {
306
307
                                        continue;
307
308
                                }
308
309
                                if ($i == $this->page - 1) {
309
 
                                        echo '&nbsp;' . ($i + 1) . '&nbsp;';
 
310
                                        $url = "list.php?type=" . $this->type . "&amp;norefresh=true" .
 
311
                                        "&amp;sort=" . $this->sortColumn . "&amp;sortdirection=" . $this->sortDirection . $filter;
 
312
                                        echo '<input type="number" class="listPageInput" id="listNavPage" name="listNavPage"'
 
313
                                                . ' value="' . ($i + 1) . '" min="1" max="' . $pageCount . '"'
 
314
                                                . ' onkeypress="listPageNumberKeyPress(\'' . $url . '\', event);">';
310
315
                                }
311
316
                                else {
312
317
                                        echo "&nbsp;<a href=\"list.php?type=" . $this->type . "&amp;norefresh=true&amp;page=" . ($i + 1) .
313
318
                                        "&amp;sort=" . $this->sortColumn . "&amp;sortdirection=" . $this->sortDirection . $filter . "\">" . ($i + 1) . "</a>\n";
314
319
                                }
315
320
                        }
316
 
                        if ($this->page < (($count / $this->maxPageEntries) - 10)) {
 
321
                        if ($this->page < ($pageCount - 10)) {
317
322
                                echo("<a title=\"" . _('Jump 10 pages forward') . "\" href=\"list.php?type=" . $this->type . "&amp;norefresh=true&amp;page=" . ($this->page + 10) .
318
323
                                        "&amp;sort=" . $this->sortColumn . "&amp;sortdirection=" . $this->sortDirection . $filter . "\">" .
319
324
                                        "<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-next.png\"></a>\n");
320
325
                        }
321
 
                        if ($this->page < ($count / $this->maxPageEntries)) {
322
 
                                echo("<a title=\"" . _('Jump to last page') . "\" href=\"list.php?type=" . $this->type . "&amp;norefresh=true&amp;page=" . ceil(($count / $this->maxPageEntries)) .
 
326
                        if ($this->page < $pageCount) {
 
327
                                echo("<a title=\"" . _('Jump to last page') . "\" href=\"list.php?type=" . $this->type . "&amp;norefresh=true&amp;page=" . $pageCount .
323
328
                                        "&amp;sort=" . $this->sortColumn . "&amp;sortdirection=" . $this->sortDirection . $filter . "\">" .
324
329
                                        "<img height=16 width=16 class=\"align-middle\" alt=\"\" src=\"../../graphics/go-last.png\"></a>\n");
325
330
                        }
887
892
                        exit();
888
893
                }
889
894
                // get current page
890
 
                if (isset($_GET["page"])) $this->page = $_GET["page"];
 
895
                if (!empty($_GET["page"])) $this->page = $_GET["page"];
891
896
                else $this->page = 1;
892
897
                // generate attribute-description table
893
898
                $temp_array = $this->listGetAttributeDescriptionList();
1073
1078
                                StatusMessage('INFO', sprintf(_('You can download your PDF files {link=%s}{color=#d2131a}here{endcolor}{endlink}.'), '../' . $_SESSION['mass_pdf']['file']));
1074
1079
                        }
1075
1080
                }
 
1081
                elseif (isset($_GET['accountEditInvalidID'])) {
 
1082
                        StatusMessage('WARN', _('Please do not edit multiple accounts in parallel in multiple browser tabs.'));
 
1083
                }
1076
1084
                if (isset($_SESSION['listRedirectMessages'])) {
1077
1085
                        for ($i = 0; $i < sizeof($_SESSION['listRedirectMessages']); $i++) {
1078
1086
                                call_user_func_array('StatusMessage', $_SESSION['listRedirectMessages'][$i]);