* Licensed under the GNU GPL. For full terms see the file COPYING. * * @package directory * @subpackage custom * @version $Id: uoa.php,v 1.2 2005/06/27 14:47:45 avel Exp $ * @copyright (c) 2003-2005 Alexandros Vellis */ /** * UoA (National and Kapodistrian University of Athens, http://www.uoa.gr ) * Custom Functions. Most probably not useful for anyone else. */ /* We do not use these eduorgaffiliation values */ unset($affiliations_map['member']); unset($affiliations_map['alum']); /** * Custom Function for UoAStructuralType attribute. */ function display_UoAStructural_listbox($structural, $selected, $name){ $temp = array(); foreach($structural['eduorgsuperioruri'] as $key => $value){ $parse_array = parse_url($value); $sup = substr($parse_array['path'],1); if(!isset($temp[$sup])) $temp[$sup][0] = $key; else $temp[$sup][count($temp[$sup])] = $key; } $display = array(); $start = array_values($temp['top_level']); $depth = 0; find_children($start,$structural, $temp, $display, $depth); $display = array_reverse($display); echo "
";print_r($display);echo "
"; print ''; } /** * Recursive function for traversing a custom tree... */ function find_children(&$current, $full, $init, &$result, &$depth){ //print "
"; print_r($result); print "
"; //print "
"; print_r($depth); print "
"; if(count($current)){ $dn = $full['dn'][$current[0]]; if( (isset($init[$dn])) && (!isset($result[$full['dn'][$init[$dn][0]]])) ){ $next = array_values($init[$dn]); $depth++; foreach($next as $val){ array_unshift($current,$val); } find_children($current, $full, $init, $result, $depth); } else{ if(isset($init[$dn][0])){ $depth--; } $result[$dn]['cn'] = $full['cn'][$current[0]]; $result[$dn]['UoAStructuralType'] = $full['UoAStructuralType'][$current[0]]; $result[$dn]['depth'] = $depth; $temp = array_shift($current); find_children($current, $full, $init, $result, $depth); } } } ?>