$info) { $ind = '   '; $indent = ''; if($level > 0 ) { for($i=0; $i<$level; $i++) { $indent .= $ind; } } if(isset($info['text'])) { echo '\n"; } if(isset($info['sub'])) { directory_print_orgs2($info['sub'], $level+1); } } } /** * Print "select" options for Restrict to Organizational Units feature. * This algorithm needs a properly formatted "$orgs3" array. * @param array $orgs3 * @param int $level * @global array $restrict * @global int $trim_at * @return void */ function directory_print_orgs3($orgs3, $level) { global $restrict, $trim_at; foreach($orgs3 as $dn=>$info) { print $dn; $ind = '    '; $indent = ''; if($level > 0 ) { for($i=0; $i<$level; $i++) { $indent .= $ind; } } if(isset($info['text'])) { if(isset($trim_at) && strlen($info['text']) > $trim_at && $dn != '*') { $text = substr($info['text'], 0, $trim_at); $text .= '...'; } else { $text = $info['text']; } echo '\n"; } if(isset($info['sub'])) { directory_print_orgs3($info['sub'], $level+1); } } } function directory_print_browse_tree($orgs3, $level, $stop_at = 1, $current = '', $expand = array()) { global $restrict, $trim_at, $ldq_standalone; if($stop_at == 0) { return; } if($ldq_standalone) { $target_browse = 'dirbrowse'; $target_results = 'dirresults'; } else { $target_browse = '_self'; $target_results = '_self'; } foreach($orgs3 as $dn=>$info) { if(isset($niaou)) unset($niaou); if(isset($gab)) unset($gab); $ind = '    '; $indent = ''; if($level > 0 ) { for($i=0; $i<$level; $i++) { $indent .= $ind; } } if(isset($info['text'])) { if(isset($trim_at) && strlen($info['text']) > $trim_at && $dn != '*') { $text = substr($info['text'], 0, $trim_at); $text .= '...'; } else { $text = $info['text']; } echo $indent; /* Set up "Rest of URL", for all links below! */ $restofurl = ''; if(isset($level)) { $restofurl .= '&level='.$level; } if(isset($expand)) { foreach($expand as $exp) { $restofurl .= '&expand[]='.urlencode($exp); } } global $formname, $inputname, $popup; if(!empty($formname)) { $restofurl .= '&formname='.urlencode($formname); } if(!empty($inputname)) { $restofurl .= '&inputname='.urlencode($inputname); } if(isset($popup) && $popup == 1) { $restofurl .= '&popup=1'; } /* Plus/Minus gif, expand/collapse functionality */ if(array_key_exists('sub', $info)) { if(in_array($dn, $expand) ) { echo ''. '[-]'; } else { echo ''. '[+]'; } } else { echo '[ ]'; } /* Text & Link Print */ if($dn == $current) { echo ''; $niaou = true; } elseif($dn == '*') { echo ''; $gab = true; } else { // echo ''; $selfuri = 'browse.php?dn='.urlencode($dn).$restofurl. '&expand[]='.urlencode($dn); $selftarget = urlencode($dn); echo ''; } echo $info['struct']. ' ' .$text; if(isset($niaou)) { echo ' '. ''. ''. _('. ' '. ''._('; } elseif(isset($gab)) { echo ' '; } else { echo ''; } echo "
\n"; } if(isset($info['sub']) && in_array($dn, $expand) ) { //print "directory_print_browse_tree(".$info['sub'].", $level+1, $stop_at, $current)\n
"; directory_print_browse_tree($info['sub'], $level+1, $stop_at, $current, $expand); } elseif(isset($info['sub'])) { directory_print_browse_tree($info['sub'], $level+1, $stop_at-1, $current, $expand); } } } function directory_find_inferior($restrict, &$inferior_final) { global $orgs; $inferior = array(); foreach($restrict as $no=>$restrictdn) { foreach ($orgs as $orgdn => $data) { if(isset($data['superior']['dn']) && $data['superior']['dn'] == $restrictdn) { // print "Hit. $orgdn
"; $inferior_final[] = $orgdn; $inferior[] = $orgdn; } else { continue; } } if(!empty($inferior)) { // print "

calling directory_find_inferior("; print_r($inferior); print_r($inferior_final); directory_find_inferior($inferior, $inferior_final); } } } ?>