function getAlbumCount($access) { $count = 0; if ($this->access >= $access) { $count++; } $children = $this->getChildren(); foreach ($children as $child) { $child_album = new mgAlbum($child); $count += $child_album->getAlbumCount($access); } return $count; }