- Patch #7350 by Mathias: return part a taxonomy tree to a user-defined

depth/level.

- Updated CHANGELOG.txt.
4.5.x
Dries Buytaert 2004-05-31 19:14:43 +00:00
parent fd4d894340
commit 7a33d9f6fd
7 changed files with 23 additions and 16 deletions

View File

@ -20,6 +20,7 @@ Drupal x.x.x, xxxx-xx-xx
* slightly reorganized navigation menus.
- accessibility:
* improved the accessibility of the archive module's calendar.
* improved form handling.
Drupal 4.4.1, 2004-04-01
------------------------

View File

@ -225,7 +225,7 @@ function comment_reply($pid, $nid) {
function comment_validate_form($edit) {
global $user;
/*
** Validate the comment's body.
*/

View File

@ -225,7 +225,7 @@ function comment_reply($pid, $nid) {
function comment_validate_form($edit) {
global $user;
/*
** Validate the comment's body.
*/

View File

@ -303,7 +303,7 @@ function path_save($edit) {
}
drupal_set_message(t('the alias has been saved.'));
return path_overview();
}
}

View File

@ -303,7 +303,7 @@ function path_save($edit) {
}
drupal_set_message(t('the alias has been saved.'));
return path_overview();
}
}

View File

@ -462,7 +462,7 @@ function taxonomy_get_children($tid, $vid = 0, $key = "tid") {
}
// hierarchy: get whole family, with tid, parent and depth; useful to show
function taxonomy_get_tree($vocabulary_id, $parent = 0, $depth = -1, $key = "tid") {
function taxonomy_get_tree($vocabulary_id, $parent = 0, $depth = -1, $max_depth = NULL) {
static $children, $parents, $terms;
$depth++;
@ -479,14 +479,17 @@ function taxonomy_get_tree($vocabulary_id, $parent = 0, $depth = -1, $key = "tid
}
}
$max_depth = ($max_depth == '') ? count($children[$vocabulary_id]) : $max_depth;
if ($children[$vocabulary_id][$parent]) {
foreach ($children[$vocabulary_id][$parent] as $child) {
$terms[$vocabulary_id][$child]->depth = $depth;
unset($terms[$vocabulary_id][$child]->parent); // this is not useful as it would show one parent only
$terms[$vocabulary_id][$child]->parents = $parents[$vocabulary_id][$child];
$tree[] = $terms[$vocabulary_id][$child];
if ($max_depth > $depth) {
$terms[$vocabulary_id][$child]->depth = $depth;
unset($terms[$vocabulary_id][$child]->parent); // this is not useful as it would show one parent only
$terms[$vocabulary_id][$child]->parents = $parents[$vocabulary_id][$child];
$tree[] = $terms[$vocabulary_id][$child];
$tree = array_merge($tree, taxonomy_get_tree($vocabulary_id, $child, $depth));
$tree = array_merge($tree, taxonomy_get_tree($vocabulary_id, $child, $depth, $max_depth));
}
}
}

View File

@ -462,7 +462,7 @@ function taxonomy_get_children($tid, $vid = 0, $key = "tid") {
}
// hierarchy: get whole family, with tid, parent and depth; useful to show
function taxonomy_get_tree($vocabulary_id, $parent = 0, $depth = -1, $key = "tid") {
function taxonomy_get_tree($vocabulary_id, $parent = 0, $depth = -1, $max_depth = NULL) {
static $children, $parents, $terms;
$depth++;
@ -479,14 +479,17 @@ function taxonomy_get_tree($vocabulary_id, $parent = 0, $depth = -1, $key = "tid
}
}
$max_depth = ($max_depth == '') ? count($children[$vocabulary_id]) : $max_depth;
if ($children[$vocabulary_id][$parent]) {
foreach ($children[$vocabulary_id][$parent] as $child) {
$terms[$vocabulary_id][$child]->depth = $depth;
unset($terms[$vocabulary_id][$child]->parent); // this is not useful as it would show one parent only
$terms[$vocabulary_id][$child]->parents = $parents[$vocabulary_id][$child];
$tree[] = $terms[$vocabulary_id][$child];
if ($max_depth > $depth) {
$terms[$vocabulary_id][$child]->depth = $depth;
unset($terms[$vocabulary_id][$child]->parent); // this is not useful as it would show one parent only
$terms[$vocabulary_id][$child]->parents = $parents[$vocabulary_id][$child];
$tree[] = $terms[$vocabulary_id][$child];
$tree = array_merge($tree, taxonomy_get_tree($vocabulary_id, $child, $depth));
$tree = array_merge($tree, taxonomy_get_tree($vocabulary_id, $child, $depth, $max_depth));
}
}
}