moved draw_navigation_bar to lists.inc

This commit is contained in:
Roland Gruber 2004-06-01 11:32:00 +00:00
parent 4bbeabf249
commit c74404ec29
6 changed files with 112 additions and 225 deletions

View File

@ -72,7 +72,58 @@ function listSort($sort, $attr_array, $info) {
// sort and return account list
usort($info, "cmp_array");
return $info;
}
/**
* @brief draws a navigation bar to switch between pages
*
* @param integer $count number of account entries
* @param integer $max_page_entries maximum number of account per page
* @param integer $page current page number
* @param string $sort sort attribute
* @param string $searchFilter LDAP search filter
* @param string $scope account type (user/group/host/domain)
* @param string $text string including the number of accounts
*/
function listDrawNavigationBar($count, $max_page_entries, $page, $sort, $searchFilter, $scope, $text) {
echo("<table class=\"" . $scope . "nav\" width=\"100%\" border=\"0\">\n");
echo("<tr>\n");
echo("<td><input type=\"submit\" name=\"refresh\" value=\"" . _("Refresh") . "\">&nbsp;&nbsp;");
if ($page != 1) {
echo("<a href=\"list" . $scope . "s.php?page=" . ($page - 1) . "&amp;sort=" . $sort . $searchFilter . "\">&lt;=</a>\n");
}
else {
echo("&lt;=");
}
echo("&nbsp;");
if ($page < ($count / $max_page_entries)) {
echo("<a href=\"list" . $scope . "s.php?page=" . ($page + 1) . "&amp;sort=" . $sort . $searchFilter . "\">=&gt;</a>\n");
}
else {
echo("=&gt;</td>");
}
echo("<td class=\"" . $scope . "nav-text\">");
//echo"&nbsp;" . $count . " " . _("Group(s) found");
echo"&nbsp;";
printf($text, $count);
echo("</td>");
echo("<td class=\"" . $scope . "nav-activepage\" align=\"right\">");
for ($i = 0; $i < ($count / $max_page_entries); $i++) {
if ($i == $page - 1) {
echo("&nbsp;" . ($i + 1));
}
else {
echo("&nbsp;<a href=\"list" . $scope . "s.php?page=" . ($i + 1) . "&amp;sort=" . $sort . "\">" . ($i + 1) . "</a>\n");
}
}
echo("</td></tr></table>\n");
}
?>

View File

@ -106,23 +106,23 @@ tr.userlist-checked {
}
/* color for active page digit */
td.userlist-activepage {
td.usernav-activepage {
color:red;
}
/* style of navigation bar */
td.userlist-navbar {
td.usernav {
color:#AAAAAA;
}
table.userlist-navbar {
table.usernav {
background-color:#fff2a3;
border-width:1px;
border-style:solid;
border-color:#9b8523;
}
td.userlist-navbartext {
td.usernav-text {
color:green;
font-family:Verdana,sans-serif;
font-size:12px;

View File

@ -72,9 +72,9 @@ $page = $_GET["page"];
if (!$page) $page = 1;
// take maximum count of domain entries shown on one page out of session
if ($_SESSION["config"]->get_MaxListEntries() <= 0)
$max_pageentrys = 10; // default setting, if not yet set
$max_page_entries = 10; // default setting, if not yet set
else
$max_pageentrys = $_SESSION["config"]->get_MaxListEntries();
$max_page_entries = $_SESSION["config"]->get_MaxListEntries();
// generate attribute and description tables
@ -106,7 +106,7 @@ if (! $_GET['norefresh']) {
ldap_free_result($sr);
if ($dom_info["count"] == 0) StatusMessage("WARN", "", _("No Samba Domains found!"));
// delete first array entry which is "count"
array_shift($dom_info);
unset($dom_info['count']);
// sort rows by sort column ($sort)
$dom_info = listSort($sort, $attr_array, $dom_info);
}
@ -123,7 +123,7 @@ echo ("<form action=\"listdomains.php\" method=\"post\">\n");
// draw navigation bar if domain accounts were found
if (sizeof($dom_info) > 0) {
draw_navigation_bar(sizeof($dom_info));
listDrawNavigationBar(sizeof($dom_info), $max_page_entries, $page, $sort, $searchFilter, "domain", _("%s Samba domain(s) found"));
echo ("<br>\n");
}
@ -142,9 +142,9 @@ for ($k = 0; $k < sizeof($desc_array); $k++) {
echo "</tr>\n";
// calculate which rows to show
$table_begin = ($page - 1) * $max_pageentrys;
if (($page * $max_pageentrys) > sizeof($dom_info)) $table_end = sizeof($dom_info);
else $table_end = ($page * $max_pageentrys);
$table_begin = ($page - 1) * $max_page_entries;
if (($page * $max_page_entries) > sizeof($dom_info)) $table_end = sizeof($dom_info);
else $table_end = ($page * $max_page_entries);
// print domain list
for ($i = $table_begin; $i < $table_end; $i++) {
@ -159,7 +159,7 @@ for ($i = $table_begin; $i < $table_end; $i++) {
// print all attribute entries seperated by "; "
if (sizeof($dom_info[$i][strtolower($attr_array[$k])]) > 0) {
// delete first array entry which is "count"
if ((! $_GET['norefresh']) && (is_array($dom_info[$i][strtolower($attr_array[$k])]))) array_shift($dom_info[$i][strtolower($attr_array[$k])]);
if (is_array($dom_info[$i][strtolower($attr_array[$k])])) unset($dom_info[$i][strtolower($attr_array[$k])]['count']);
if (is_array($dom_info[$i][strtolower($attr_array[$k])])) echo implode("; ", $dom_info[$i][strtolower($attr_array[$k])]);
else echo $dom_info[$i][strtolower($attr_array[$k])];
}
@ -173,7 +173,7 @@ echo ("<br>");
// draw navigation bar if domain accounts were found
if (sizeof($dom_info) > 0) {
draw_navigation_bar(sizeof($dom_info));
listDrawNavigationBar(sizeof($dom_info), $max_page_entries, $page, $sort, $searchFilter, "domain", _("%s Samba domain(s) found"));
echo ("<br>\n");
}
@ -205,46 +205,6 @@ echo ("</p>\n");
echo ("</form>\n");
echo "</body></html>\n";
/**
* @brief draws a navigation bar to switch between pages
*
*
* @return void
*/
function draw_navigation_bar ($count) {
global $max_pageentrys;
global $page;
global $sort;
echo ("<table class=\"domainnav\" width=\"100%\" border=\"0\">\n");
echo ("<tr>\n");
echo ("<td><input type=\"submit\" name=\"refresh\" value=\"" . _("Refresh") . "\">&nbsp;&nbsp;");
if ($page != 1)
echo ("<a href=\"listdomains.php?page=" . ($page - 1) . "&amp;sort=" . $sort . "\">&lt;=</a>\n");
else
echo ("&lt;=");
echo ("&nbsp;");
if ($page < ($count / $max_pageentrys))
echo ("<a href=\"listdomains.php?page=" . ($page + 1) . "&amp;sort=" . $sort . "\">=&gt;</a>\n");
else
echo ("=&gt;</td>");
echo ("<td class=\"domainnav-text\">");
echo "&nbsp;" . $count . " " . _("Samba Domain(s) found");
echo ("</td>");
echo ("<td class=\"domainlist_activepage\" align=\"right\">");
for ($i = 0; $i < ($count / $max_pageentrys); $i++) {
if ($i == $page - 1)
echo ("&nbsp;" . ($i + 1));
else
echo ("&nbsp;<a href=\"listdomains.php?page=" . ($i + 1) .
"&amp;sort=" . $sort . "\">" . ($i + 1) . "</a>\n");
}
echo ("</td></tr></table>\n");
}
// save variables to session

View File

@ -111,9 +111,9 @@ $page = $_GET["page"];
if (!$page) $page = 1;
// take maximum count of group entries shown on one page out of session
if ($_SESSION["config"]->get_MaxListEntries() <= 0)
$max_pageentrys = 10; // default setting, if not yet set
$max_page_entries = 10; // default setting, if not yet set
else
$max_pageentrys = $_SESSION["config"]->get_MaxListEntries();
$max_page_entries = $_SESSION["config"]->get_MaxListEntries();
// generate column attributes and descriptions
for ($i = 0; $i < sizeof($temp_array); $i++) {
@ -139,10 +139,10 @@ elseif ($_SESSION['grp_suffix']) $grp_suffix = $_SESSION['grp_suffix']; // old
else $grp_suffix = $_SESSION["config"]->get_GroupSuffix(); // default suffix
// generate search filter for sort links
$searchfilter = "";
$searchFilter = "";
for ($k = 0; $k < sizeof($desc_array); $k++) {
if (eregi("^([0-9a-z_\\*\\+\\-])+$", $_POST["filter" . strtolower($attr_array[$k])])) {
$searchfilter = $searchfilter . "&amp;filter" . strtolower($attr_array[$k]) . "=".
$searchFilter = $searchFilter . "&amp;filter" . strtolower($attr_array[$k]) . "=".
$_POST["filter" . strtolower($attr_array[$k])];
}
}
@ -169,7 +169,7 @@ if (! $_GET['norefresh']) {
ldap_free_result($sr);
if ($grp_info["count"] == 0) StatusMessage("WARN", "", _("No Groups found!"));
// delete first array entry which is "count"
array_shift($grp_info);
unset($grp_info['count']);
// sort rows by sort column ($sort)
$grp_info = listSort($sort, $attr_array, $grp_info);
}
@ -189,7 +189,7 @@ echo ("<form action=\"listgroups.php\" method=\"post\">\n");
// draw navigation bar if group accounts were found
if (sizeof($grp_info) > 0) {
draw_navigation_bar(sizeof($grp_info));
listDrawNavigationBar(sizeof($grp_info), $max_page_entries, $page, $sort, $searchFilter, "group", _("%s group(s) found"));
echo ("<br>");
}
@ -200,10 +200,10 @@ echo "<tr class=\"grouplist-head\"><th width=22 height=34></th><th></th>";
for ($k = 0; $k < sizeof($desc_array); $k++) {
if (strtolower($attr_array[$k]) == $sort) {
echo "<th class=\"grouplist-sort\"><a href=\"listgroups.php?".
"sort=" . strtolower($attr_array[$k]) . $searchfilter . "&amp;norefresh=y" . "\">" . $desc_array[$k] . "</a></th>";
"sort=" . strtolower($attr_array[$k]) . $searchFilter . "&amp;norefresh=y" . "\">" . $desc_array[$k] . "</a></th>";
}
else echo "<th><a href=\"listgroups.php?".
"sort=" . strtolower($attr_array[$k]) . $searchfilter . "&amp;norefresh=y" . "\">" . $desc_array[$k] . "</a></th>";
"sort=" . strtolower($attr_array[$k]) . $searchFilter . "&amp;norefresh=y" . "\">" . $desc_array[$k] . "</a></th>";
}
echo "</tr>\n";
@ -221,9 +221,9 @@ for ($k = 0; $k < sizeof ($desc_array); $k++) {
echo "</tr>\n";
// calculate which rows to show
$table_begin = ($page - 1) * $max_pageentrys;
if (($page * $max_pageentrys) > sizeof($grp_info)) $table_end = sizeof($grp_info);
else $table_end = ($page * $max_pageentrys);
$table_begin = ($page - 1) * $max_page_entries;
if (($page * $max_page_entries) > sizeof($grp_info)) $table_end = sizeof($grp_info);
else $table_end = ($page * $max_page_entries);
if (sizeof($grp_info) > 0) {
// print group list
@ -246,7 +246,7 @@ if (sizeof($grp_info) > 0) {
// print all attribute entries seperated by "; "
if (sizeof($grp_info[$i][strtolower($attr_array[$k])]) > 0) {
// delete first array entry which is "count"
if ((! $_GET['norefresh']) && (is_array($grp_info[$i][strtolower($attr_array[$k])]))) array_shift($grp_info[$i][strtolower($attr_array[$k])]);
if (is_array($grp_info[$i][strtolower($attr_array[$k])])) unset($grp_info[$i][strtolower($attr_array[$k])]['count']);
// generate links for group members
if (strtolower($attr_array[$k]) == "memberuid") {
// sort array
@ -280,7 +280,7 @@ if (sizeof($grp_info) > 0) {
echo "<tr class=\"grouplist\">\n";
echo "<td align=\"center\"><img src=\"../../graphics/select.png\" alt=\"select all\"></td>\n";
echo "<td colspan=$colspan>&nbsp;<a href=\"listgroups.php?norefresh=y&amp;page=" . $page . "&amp;sort=" . $sort .
$searchfilter . "&amp;selectall=yes\">" .
$searchFilter . "&amp;selectall=yes\">" .
"<font color=\"black\"><b>" . _("Select all") . "</b></font></a></td>\n";
echo "</tr>\n";
}
@ -289,7 +289,7 @@ echo ("<br>");
// draw navigation bar if group accounts were found
if (sizeof($grp_info) > 0) {
draw_navigation_bar(sizeof($grp_info));
listDrawNavigationBar(sizeof($grp_info), $max_page_entries, $page, $sort, $searchFilter, "group", _("%s group(s) found"));
echo ("<br>\n");
}
@ -327,47 +327,6 @@ if (sizeof($grp_info) > 0) {
echo ("</form>\n");
echo "</body></html>\n";
/**
* @brief draws a navigation bar to switch between pages
*
*
* @return void
*/
function draw_navigation_bar ($count) {
global $max_pageentrys;
global $page;
global $sort;
global $searchfilter;
echo ("<table class=\"groupnav\" width=\"100%\" border=\"0\">\n");
echo ("<tr>\n");
echo ("<td><input type=\"submit\" name=\"refresh\" value=\"" . _("Refresh") . "\">&nbsp;&nbsp;");
if ($page != 1)
echo ("<a href=\"listgroups.php?page=" . ($page - 1) . "&amp;sort=" . $sort . $searchfilter . "\">&lt;=</a>\n");
else
echo ("&lt;=");
echo ("&nbsp;");
if ($page < ($count / $max_pageentrys))
echo ("<a href=\"listgroups.php?page=" . ($page + 1) . "&amp;sort=" . $sort . $searchfilter . "\">=&gt;</a>\n");
else
echo ("=&gt;</td>");
echo ("<td class=\"groupnav-text\">");
echo "&nbsp;" . $count . " " . _("Group(s) found");
echo ("</td>");
echo ("<td class=\"groupnav-activepage\" align=\"right\">");
for ($i = 0; $i < ($count / $max_pageentrys); $i++) {
if ($i == $page - 1)
echo ("&nbsp;" . ($i + 1));
else
echo ("&nbsp;<a href=\"listgroups.php?page=" . ($i + 1) .
"&amp;sort=" . $sort . "\">" . ($i + 1) . "</a>\n");
}
echo ("</td></tr></table>\n");
}
// save variables to session
$_SESSION['grp_info'] = $grp_info;
$_SESSION['grp_units'] = $grp_units;

View File

@ -107,9 +107,9 @@ $page = $_GET["page"];
if (!$page) $page = 1;
// take maximum count of host entries shown on one page out of session
if ($_SESSION["config"]->get_MaxListEntries() <= 0)
$max_pageentrys = 10; // default setting, if not yet set
$max_page_entries = 10; // default setting, if not yet set
else
$max_pageentrys = $_SESSION["config"]->get_MaxListEntries();
$max_page_entries = $_SESSION["config"]->get_MaxListEntries();
// generate column attributes and descriptions
for ($i = 0; $i < sizeof($temp_array); $i++) {
@ -135,10 +135,10 @@ elseif ($_SESSION['hst_suffix']) $hst_suffix = $_SESSION['hst_suffix']; // old
else $hst_suffix = $_SESSION["config"]->get_HostSuffix(); // default suffix
// generate search filter for sort links
$searchfilter = "";
$searchFilter = "";
for ($k = 0; $k < sizeof($desc_array); $k++) {
if (eregi("^([0-9a-z_\\*\\+\\-])+$", $_POST["filter" . strtolower($attr_array[$k])])) {
$searchfilter = $searchfilter . "&amp;filter" . strtolower($attr_array[$k]) . "=".
$searchFilter = $searchFilter . "&amp;filter" . strtolower($attr_array[$k]) . "=".
$_POST["filter" . strtolower($attr_array[$k])];
}
}
@ -165,7 +165,7 @@ if (! $_GET['norefresh']) {
ldap_free_result($sr);
if ($hst_info["count"] == 0) StatusMessage("WARN", "", _("No Samba Hosts found!"));
// delete first array entry which is "count"
array_shift($hst_info);
unset($hst_info['count']);
// sort rows by sort column ($sort)
$hst_info = listSort($sort, $attr_array, $hst_info);
}
@ -185,7 +185,7 @@ echo ("<form action=\"listhosts.php\" method=\"post\">\n");
// draw navigation bar if host accounts were found
if (sizeof($hst_info) > 0) {
draw_navigation_bar(sizeof($hst_info));
listDrawNavigationBar(sizeof($hst_info), $max_page_entries, $page, $sort, $searchFilter, "host", _("%s host(s) found"));
echo ("<br>\n");
}
@ -196,10 +196,10 @@ echo "<tr class=\"hostlist-head\"><th width=22 height=34></th><th></th>";
for ($k = 0; $k < sizeof($desc_array); $k++) {
if (strtolower($attr_array[$k]) == $sort) {
echo "<th class=\"hostlist-sort\"><a href=\"listhosts.php?".
"sort=" . strtolower($attr_array[$k]) . $searchfilter . "&amp;norefresh=y" . "\">" . $desc_array[$k] . "</a></th>";
"sort=" . strtolower($attr_array[$k]) . $searchFilter . "&amp;norefresh=y" . "\">" . $desc_array[$k] . "</a></th>";
}
else echo "<th><a href=\"listhosts.php?".
"sort=" . strtolower($attr_array[$k]) . $searchfilter . "&amp;norefresh=y" . "\">" . $desc_array[$k] . "</a></th>";
"sort=" . strtolower($attr_array[$k]) . $searchFilter . "&amp;norefresh=y" . "\">" . $desc_array[$k] . "</a></th>";
}
echo "</tr>\n";
@ -217,9 +217,9 @@ for ($k = 0; $k < sizeof ($desc_array); $k++) {
echo "</tr>\n";
// calculate which rows to show
$table_begin = ($page - 1) * $max_pageentrys;
if (($page * $max_pageentrys) > sizeof($hst_info)) $table_end = sizeof($hst_info);
else $table_end = ($page * $max_pageentrys);
$table_begin = ($page - 1) * $max_page_entries;
if (($page * $max_page_entries) > sizeof($hst_info)) $table_end = sizeof($hst_info);
else $table_end = ($page * $max_page_entries);
if (sizeof($hst_info) > 0) {
// print host list
@ -259,7 +259,7 @@ if (sizeof($hst_info) > 0) {
echo "<tr class=\"hostlist\">\n";
echo "<td align=\"center\"><img src=\"../../graphics/select.png\" alt=\"select all\"></td>\n";
echo "<td colspan=$colspan>&nbsp;<a href=\"listhosts.php?norefresh=y&amp;page=" . $page . "&amp;sort=" . $sort .
$searchfilter . "&amp;selectall=yes\">" .
$searchFilter . "&amp;selectall=yes\">" .
"<font color=\"black\"><b>" . _("Select all") . "</b></font></a></td>\n";
echo "</tr>\n";
}
@ -269,7 +269,7 @@ echo ("<br>");
// draw navigation bar if host accounts were found
if (sizeof($hst_info) > 0) {
draw_navigation_bar(sizeof($hst_info));
listDrawNavigationBar(sizeof($hst_info), $max_page_entries, $page, $sort, $searchFilter, "host", _("%s host(s) found"));
echo ("<br>\n");
}
@ -308,47 +308,6 @@ if (sizeof($hst_info) > 0) {
echo ("</form>\n");
echo "</body></html>\n";
/**
* @brief draws a navigation bar to switch between pages
*
*
* @return void
*/
function draw_navigation_bar ($count) {
global $max_pageentrys;
global $page;
global $sort;
global $searchfilter;
echo ("<table class=\"hostnav\" width=\"100%\" border=\"0\">\n");
echo ("<tr>\n");
echo ("<td><input type=\"submit\" name=\"refresh\" value=\"" . _("Refresh") . "\">&nbsp;&nbsp;");
if ($page != 1)
echo ("<a href=\"listhosts.php?page=" . ($page - 1) . "&amp;sort=" . $sort . $searchfilter . "\">&lt;=</a>\n");
else
echo ("&lt;=");
echo ("&nbsp;");
if ($page < ($count / $max_pageentrys))
echo ("<a href=\"listhosts.php?page=" . ($page + 1) . "&amp;sort=" . $sort . $searchfilter . "\">=&gt;</a>\n");
else
echo ("=&gt;</td>");
echo ("<td class=\"hostnav-text\">");
echo "&nbsp;" . $count . " " . _("Samba Host(s) found");
echo ("</td>");
echo ("<td class=\"hostlist_activepage\" align=\"right\">");
for ($i = 0; $i < ($count / $max_pageentrys); $i++) {
if ($i == $page - 1)
echo ("&nbsp;" . ($i + 1));
else
echo ("&nbsp;<a href=\"listhosts.php?page=" . ($i + 1) .
"&amp;sort=" . $sort . "\">" . ($i + 1) . "</a>\n");
}
echo ("</td></tr></table>\n");
}
// save variables to session
$_SESSION['hst_info'] = $hst_info;
$_SESSION['hst_units'] = $hst_units;

View File

@ -54,7 +54,7 @@ if ($trans_primary == "on" && !$_GET["norefresh"]) {
$sr = @ldap_search($_SESSION["ldap"]->server(), $suffix, $filter, $attrs);
if ($sr) {
$info = @ldap_get_entries($_SESSION["ldap"]->server(), $sr);
array_shift($info); // delete count entry
unset($info['count']); // delete count entry
for ($i = 0; $i < sizeof($info); $i++) {
$trans_primary_hash[$info[$i]['gidnumber'][0]] = $info[$i]['cn'][0];
}
@ -129,9 +129,9 @@ if (!$page) $page = 1;
// take maximum count of user entries shown on one page out of session
if ($_SESSION["config"]->get_MaxListEntries() <= 0) {
$max_pageentrys = 10; // default setting, if not yet set
$max_page_entries = 10; // default setting, if not yet set
}
else $max_pageentrys = $_SESSION["config"]->get_MaxListEntries();
else $max_page_entries = $_SESSION["config"]->get_MaxListEntries();
// generate attribute-description table
$attr_array = array(); // list of LDAP attributes to show
@ -158,7 +158,7 @@ for ($i = 0; $i < sizeof($temp_array); $i++) {
}
}
$sort = $_GET["sortattrib"];
$sort = $_GET["sort"];
if (!$sort)
$sort = strtolower($attr_array[0]);
@ -169,10 +169,10 @@ else $usr_suffix = $_SESSION["config"]->get_UserSuffix(); // default suffix
// generate search filter for sort links
$searchfilter = "";
$searchFilter = "";
for ($k = 0; $k < sizeof($desc_array); $k++) {
if (eregi("^([0-9a-z_\\*\\+\\-])+$", $_POST["filter" . strtolower($attr_array[$k])])) {
$searchfilter = $searchfilter . "&filter" .
$searchFilter = $searchFilter . "&filter" .
strtolower($attr_array[$k]) . "=".
$_POST["filter" . strtolower($attr_array[$k])];
}
@ -207,7 +207,7 @@ else {
ldap_free_result ($sr);
if ($userinfo["count"] == 0) StatusMessage("WARN", "", _("No Users found!"));
// delete first array entry which is "count"
array_shift($userinfo);
unset($userinfo['count']);
$userinfo = listSort($sort, $attr_array, $userinfo);
$_SESSION["userlist"] = $userinfo;
}
@ -226,11 +226,10 @@ echo ("<form action=\"listusers.php\" method=\"post\">\n");
// display table only if users exist in LDAP
if ($user_count != 0) {
// create navigation bar on top of user table
draw_navigation_bar ($user_count);
echo ("<br />");
// create navigation bar on top of user table
listDrawNavigationBar($user_count, $max_page_entries, $page, $sort,
$searchFilter . "&amp;trans_primary=" . $trans_primary, "user", _("%s user(s) found"));
echo ("<br />");
}
// print user table header
@ -244,8 +243,8 @@ if ($user_count != 0) {
echo "<th class=\"userlist-activecolumn\">\n";
else
echo "<th>\n";
echo "<a class=\"userlist\" href=\"listusers.php?norefresh=1&amp;sortattrib=" .
strtolower($attr_array[$k]) . $searchfilter . "&amp;trans_primary=" . $trans_primary . "\">" .
echo "<a class=\"userlist\" href=\"listusers.php?norefresh=1&amp;sort=" .
strtolower($attr_array[$k]) . $searchFilter . "&amp;trans_primary=" . $trans_primary . "\">" .
$desc_array[$k] . "</a></th>\n";
}
echo "</tr>\n";
@ -278,7 +277,7 @@ if ($user_count != 0) {
}
}
// print user list
$userinfo = array_slice ($userinfo, ($page - 1) * $max_pageentrys, $max_pageentrys);
$userinfo = array_slice ($userinfo, ($page - 1) * $max_page_entries, $max_page_entries);
for ($i = 0; $i < sizeof ($userinfo); $i++) { // ignore last entry in array which is "count"
echo("<tr class=\"userlist\"\nonMouseOver=\"user_over(this, '" . $userinfo[$i]["dn"] . "')\"\n" .
"onMouseOut=\"user_out(this, '" . $userinfo[$i]["dn"] . "')\"\n" .
@ -301,7 +300,7 @@ if ($user_count != 0) {
if (sizeof($userinfo[$i][strtolower($attr_array[$k])]) > 0) {
if (is_array($userinfo[$i][strtolower($attr_array[$k])])) {
// delete first array entry which is "count"
array_shift($userinfo[$i][strtolower($attr_array[$k])]);
unset($userinfo[$i][strtolower($attr_array[$k])]['count']);
// sort array
sort($userinfo[$i][strtolower($attr_array[$k])]);
// print all attribute entries seperated by "; "
@ -317,8 +316,8 @@ if ($user_count != 0) {
$colspan = sizeof($attr_array) + 1;
echo "<tr class=\"userlist\">\n";
echo "<td align=\"center\"><img src=\"../../graphics/select.png\" alt=\"select all\"></td>\n";
echo "<td colspan=$colspan>&nbsp;<a href=\"listusers.php?norefresh=1&amp;page=" . $page . "&amp;sortattrib=" . $sort .
$searchfilter . "&amp;trans_primary=" . $trans_primary . "&amp;selectall=yes\">" .
echo "<td colspan=$colspan>&nbsp;<a href=\"listusers.php?norefresh=1&amp;page=" . $page . "&amp;sort=" . $sort .
$searchFilter . "&amp;trans_primary=" . $trans_primary . "&amp;selectall=yes\">" .
"<font color=\"black\"><b>" . _("Select all") . "</b></font></a></td>\n";
echo "</tr>\n";
}
@ -326,8 +325,9 @@ echo ("</table>\n");
echo ("<br>");
if ($user_count != 0) {
draw_navigation_bar ($user_count);
echo ("<br>");
listDrawNavigationBar($user_count, $max_page_entries, $page, $sort,
$searchFilter . "&amp;trans_primary=" . $trans_primary, "user", _("%s user(s) found"));
echo ("<br>");
}
if (! $_GET['norefresh']) {
@ -380,48 +380,6 @@ echo ("<p>&nbsp;</p>\n");
echo ("</form>\n");
echo "</body></html>\n";
/**
* @brief draws a navigation bar to switch between pages
*
*
* @return void
*/
function draw_navigation_bar ($user_count) {
global $max_pageentrys;
global $page;
global $sort;
global $searchfilter;
global $trans_primary;
echo ("<table class=\"userlist-navbar\" width=\"100%\" border=\"0\"\n");
echo ("<tr>\n");
echo ("<td class=\"userlist-navbar\">\n<input type=\"submit\" name=\"refresh\" value=\"" . _("Refresh") . "\">\n&nbsp;&nbsp;");
if ($page != 1)
echo ("<a class=\"userlist\" href=\"listusers.php?norefresh=1&amp;page=" .
($page - 1) . "&amp;sortattrib=" . $sort . $searchfilter . "&amp;trans_primary=" . $trans_primary . "\">&lt;=</a>\n");
else echo ("&lt;=");
echo ("&nbsp;");
if ($page < ($user_count / $max_pageentrys))
echo ("<a class=\"userlist\" href=\"listusers.php?norefresh=1&amp;page=" .
($page + 1) . "&amp;sortattrib=" . $sort . $searchfilter . "&amp;trans_primary=" . $trans_primary . "\">=&gt;</a>\n");
else echo ("=&gt;");
echo ("</td>\n");
echo ("<td class=\"userlist-navbartext\">\n");
echo "&nbsp;" . $user_count . " " . _("User(s) found") . "\n";
echo ("</td>\n");
echo ("<td class=\"userlist-activepage\" align=\"right\">");
for ($i = 0; $i < ($user_count / $max_pageentrys); $i++) {
if ($i == $page - 1) echo ("&nbsp;" . ($i + 1));
else echo ("&nbsp;<a class=\"userlist\" href=\"listusers.php?norefresh=1&amp;page=" .
($i + 1) . "&amp;sortattrib=" . $sort . $searchfilter . "&amp;trans_primary=" . $trans_primary .
"\">" . ($i + 1) . "</a>\n");
}
echo ("</td></tr>\n</table>\n");
}
// save variables to session
$_SESSION['usr_units'] = $usr_units;