Back to PhocaDownloadCategory class

Method CategoryTreeOption

public static
CategoryTreeOption
(mixed $data, mixed $tree, mixed $id = 0, mixed $text = '', mixed $currentId = 0)

Method CategoryTreeOption - Source code

public static function CategoryTreeOption($data, $tree, $id = 0, $text = '', $currentId = 0)
{
    foreach ($data as $key) {
        $show_text = $text . $key->text;
        if ($key->parentid == $id && $currentId != $id && $currentId != $key->value) {
            $tree[$key->value] = new CMSObject();
            $tree[$key->value]->text = $show_text;
            $tree[$key->value]->value = $key->value;
            $tree = PhocaDownloadCategory::CategoryTreeOption($data, $tree, $key->value, $show_text . " - ", $currentId);
        }
    }
    return $tree;
}