* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* $Id: display.php,v 1.1.1.1 2004/01/02 16:00:18 avel Exp $
*
* @package plugins
* @subpackage directory
*/
/**
* Display functions, for multiple and single tables output.
*/
/**
* Display HTML results from an LDAP query in multiple tables.
*
* @param array $attributes The list of attributes to display
* @param array $entry The entries array from the ldap_get_entries search result
* @param string $sortby
*/
function directory_dispresultsMulti ($attributes, $entry, $sortby) {
global $languages, $data_dir, $username, $compose_new_win, $base_uri,
$color, $ldq_attributes, $ldq_lang, $charset, $ldq_enablemailalternate;
if ($entry["count"] == 0) {
print _("No records found") . "
\n";
return;
}
/**
* sort the entries. First, build an array with the sortby as the key and
* the entry index as the value
*/
for ($i=0 ; $i < $entry["count"]; $i++) {
$Val = $entry[$i][$sortby][0] . $i;
$sorted[$Val] = $i;
}
if ($sortby == "cn")
uksort ($sorted, "directory_compcns");
else
uksort ($sorted, "directory_compattrs");
foreach ($sorted as $key=>$i) {
print '
'.$ldq_attributes[$attr]['text'].' | ';
switch ($attr) {
case "labeledurl":
/* split up url and label parts */
print directory_print_labeledurl($entry[$i][$attr][$x]);
break;
case "mail":
$val = $entry[$i][$attr][$x];
print directory_href('mail', $val);
if($ldq_enablemailalternate == true) {
if(isset ($entry[$i]['mailalternateaddress']['count']) &&
($entry[$i]['mailalternateaddress']['count'] > 0 )) {
for($k=0; $k<$entry[$i]['mailalternateaddress']['count']; $k++) {
print " "; $val2 = $entry[$i]['mailalternateaddress'][$k]; print directory_href('mail', $val2); print ''; } } } break; default: $attr_lang = $attr.';lang-'.$ldq_lang; if(array_key_exists($attr_lang, $entry[$i]) && !is_null($entry[$i][$attr_lang][$x]) && ($entry[$i][$attr_lang][$x] != " ") ) { $val = directory_string_convert($entry[$i][$attr_lang][$x], "UTF-8", $charset); } else { $val = $entry[$i][$attr][$x]; } print "$val "; print " |
'; } foreach ($attributes as $attr) { // $Var = "directory_showattr_" . $attr; // global $$Var; // if ($$Var == "on") print ' | '.$ldq_attributes[$attr]['text'].' | '; } /* Header for AddACL stuff (useracl plugin) */ if(in_array('useracl', $plugins) && !isset($popup)) { print ''. _("Add Share") .' | '; } print '
'; } } foreach ($attributes as $attr) { // $Var = "directory_showattr_" . $attr; // global $$Var; // if ($$Var == "on") { print ' | ';
if (!array_key_exists($attr, $entry[$i]) ||
( array_key_exists($attr, $entry[$i]) && ($entry[$i][$attr]["count"] == 0)) ) {
print ' '; } if (array_key_exists($attr, $entry[$i])) { for ($x=0 ; $x < $entry[$i][$attr]["count"] ; $x++) { switch ($attr) { case "labeledurl": /* split up url and label parts */ print directory_print_labeledurl($entry[$i][$attr][$x]); break; case "mail": $val = $entry[$i][$attr][$x]; print directory_href('mail', $val); if($ldq_enablemailalternate == true) { if(isset ($entry[$i]['mailalternateaddress']['count']) && ($entry[$i]['mailalternateaddress']['count'] > 0 )) { for($k=0; $k<$entry[$i]['mailalternateaddress']['count']; $k++) { print " "; $val2 = $entry[$i]['mailalternateaddress'][$k]; print directory_href('mail', $val2); print ''; } } } break; default: /* Use language attribute value, if it is available */ $attr_lang = $attr.';lang-'.$ldq_lang; if(array_key_exists($attr_lang, $entry[$i]) && !empty($entry[$i][$attr_lang][$x]) && ($entry[$i][$attr_lang][$x] != " ") ) { $val = directory_string_convert($entry[$i][$attr_lang][$x], "UTF-8", $charset); } else { $val = $entry[$i][$attr][$x]; } if(isset($ldq_attributes[$attr]['map'])) { $val = $ldq_attributes[$attr]['map'][trim($val)]; } if($attr == 'edupersonaffiliation') { if(isset($entry[$i]['edupersonprimaryaffiliation'][0]) && $entry[$i]['edupersonprimaryaffiliation'][0] == $entry[$i][$attr][$x]) { $important = true; } } if($attr == 'edupersonorgunitdn') { if(isset($entry[$i]['edupersonprimaryorgunitdn'][0]) && $entry[$i]['edupersonprimaryorgunitdn'][0] == $entry[$i][$attr][$x]) { $important = true; } } if(isset($ldq_attributes[$attr]['followme'])) { // print "running directory_href($attr, $val, ".$follow[$val] . ")"; if(isset($follow[$val])) { $val = directory_href($attr, $val, $follow[$val]); } elseif(isset($orgs[$val])) { $val = directory_href($attr, $val, '' . $orgs[$val]['struct'] . ' ' . $orgs[$val]['text']); } else { $val = ''; } } else { if(isset($ldq_attributes[$attr]['url'])) { $val = directory_href($attr, $val); } } if(isset($important)) { $val = ''.$val.''; unset($important); } print $val . " "; } } } print ' | ';
// }
}
/* Shares */
if(in_array('useracl', $plugins) && !isset($popup)) {
echo '';
$acl_uri = 'plugins/useracl/addacl.php?user='.$entry[$i]['uid'][0].'&addacl=1';
$disp = '![]() | ';
}
print "