function walktree($relations, $definitions, $keys, $thesaurusuri, $thesaurusname, $items, $searchkey = "") { $ret = array(); foreach ($items as $element) { $obj = array(); $obj['id'] = $element; $obj["name"] = $definitions[$element][0]; $obj["qtip"] = $definitions[$element][1]; // $obj["qtip"]=preg_replace("/[\n\r]/","<br>",$obj["qtip"]); if ($element == '1eb0ea0a-312c-4d74-8d42-6f1ad758f999') { //expand science keywords $obj['expanded'] = true; } if (array_key_exists($element, $keys) !== FALSE) { $obj["keyword"] = $keys[$element][0]; } $obj["thesaurusuri"] = $thesaurusuri; $obj["thesaurusname"] = $thesaurusname; if (count($relations[$element]) == 0) { $obj['leaf'] = 'true'; } else { $obj['leaf'] = 'false'; $obj['children'] = walktree($relations, $definitions, $keys, $thesaurusuri, $thesaurusname, $relations[$element]); } array_push($ret, $obj); } return $ret; }
function walktree($tar, $path, $tree) { $git = $tree->repo; $nodes = $tree->nodes; foreach ($nodes as $name => $node) { if ($node->is_dir) { $tar->addDirectory($path . $name); walktree($tar, $path . $name . "/", $git->getObject($node->object)); } else { $tar->addData($path . $name, $git->getObject($node->object)->data); } } }