public function buildCategoryRow($type, $parents, $level = 0, $selected = NULL) { $out = NULL; foreach ($parents as $child) { $category = new cnCategory($child); if ($type === 'table') { $out .= $this->buildTableRowHTML($child, $level); } if ($type === 'option') { $out .= $this->buildOptionRowHTML($child, $level, $selected); } if ($type === 'checklist') { $out .= $this->buildCheckListHTML($child, $level, $selected); } if (is_array($category->getChildren())) { ++$level; if ($type === 'table') { $out .= $this->buildCategoryRow('table', $category->getChildren(), $level); } if ($type === 'option') { $out .= $this->buildCategoryRow('option', $category->getChildren(), $level, $selected); } if ($type === 'checklist') { $out .= $this->buildCategoryRow('checklist', $category->getChildren(), $level, $selected); } --$level; } } $level = 0; return $out; }