function MG_showTree($aid, $depth) { global $_CONF, $MG_albums, $level, $counter; $z = 1; $retval = ''; $px = ($level - 1) * 15; if ($aid != 0 && $MG_albums[$aid]->access > 0) { if ($level == 1 && $depth != 1) { // our first one... $retval .= '<p>'; } if ($depth == 0) { $retval .= "<div style=\"margin-left:" . $px . "px;\">" . '<input type="checkbox" name="album[]" id="album[]" value="' . $MG_albums[$aid]->id . '" ' . $block . ' /> ' . strip_tags(COM_stripslashes($MG_albums[$aid]->title)) . '</div>' . LB; } else { if ($level <= $depth) { $retval .= "<div style=\"margin-left:" . $px . "px;\">" . '<a href="' . $_MG_CONF['site_url'] . '/album.php?aid=' . $MG_albums[$aid]->id . '&page=1">' . strip_tags(COM_stripslashes($MG_albums[$aid]->title)) . '</a></div>'; } } } else { if ($MG_albums[$aid]->id == 0) { $retval .= '<br />'; } } $counter++; if (!empty($MG_albums[$aid]->children)) { $children = $MG_albums[$aid]->getChildren(); foreach ($children as $child) { $level++; $retval .= MG_showTree($MG_albums[$child]->id, $depth); $level--; } } return $retval; }
function MG_showTree($aid = 0, $depth = 0, $level = 0) { global $_CONF, $_MG_CONF; require_once $_CONF['path'] . 'plugins/mediagallery/include/classAlbum.php'; $album = new mgAlbum($aid); if ($album->hidden == 1 && $album->access != 3) { return ''; } $retval = ''; if ($album->access > 0) { $px = $level * 15; if ($depth == 0 || $level <= $depth) { $retval .= '<div style="margin-left:' . $px . 'px;">' . '<a href="' . $_MG_CONF['site_url'] . '/album.php?aid=' . $album->id . '&page=1">' . strip_tags($album->title) . '</a></div>'; } } $children = $album->getChildren(); $level++; foreach ($children as $child) { $retval .= MG_showTree($child, $depth, $level); } return $retval; }