<?
include("common.php");
$attrs = array(
"owner" => "owner",
"desc" => "description",
"member" => "uniqueMember",
"name" => "cn",
"address" => "corpMailLocalAddress",
);
$sortkey = "name";
define("LDAP_FILTER_GROUPS", "(&(objectclass=groupOfUniqueNames)" .
"(objectClass=corpMailRecipient))");
if (!($search = ldap_search($_SESSION["bind_linkid"], LDAP_BASE_DN_GROUPS,
LDAP_FILTER_GROUPS, array_values($attrs))))
die("ldap search returned failure");
if (!($allgroups = _ldap_get_entries($_SESSION["bind_linkid"], $search)))
die("search succeeded but returned no entries!");
if (!isset($allgroups["count"]))
die("_ldap_get_entries had nothing to find!");
unset($allgroups["count"]);
uasort($allgroups, "sortcallback");
reset($allgroups);
pagehead("Company Directory - Groups", "Group Directory",
MENU_NAVBAR_HEADER);
?>
<table valign=top align=left border=0 width="100%" cellspacing=0 cellpadding=2>
<tr> <td> </td> </tr>
<tr>
<td nowrap class=tablehead> group name </td>
<td nowrap class=tablehead> email enabled? </td>
<td nowrap class=tablehead> owner </td>
<td nowrap class=tablehead> description </td>
<?
$rowclasses = array("tablecell", "tablealtcell");
foreach ($allgroups as $group) {
$rowclass = next($rowclasses);
$rowclass = $rowclass? $rowclass: reset($rowclasses);
?> <tr valign=top class=<?echo($rowclass)?>>
<? printf("<td nowrap> <a href=\"/groupedit.php?cn=%s\"> %s </a> </td>\n",
$group[$attrs["name"]][0], $group[$attrs["name"]][0]);
if (isset($group[$attrs["address"]][0]))
$mail = "yes";
else
$mail = "no";
printf("<td nowrap align=center> %s </td>\n", $mail);
printf("<td nowrap> %s </td>\n",
trim_dn_to_firstval($group[$attrs["owner"]][0]));
printf("<td> %s </td>\n", $group[$attrs["desc"]][0]);
}
?>
</table>
<?
pagefoot();
function
trim_dn_to_firstval ($s)
{
return array_pop(split("=", array_shift(split(",", $s))));
}
?>