<?php 
	$c = new Criteria();
	$cats = TblcategoryPeer::doselect( $c);
	$tree['-1']='Root';
	foreach ($cats as $key => $cat) {
	    if($tblcategory->getCgId()!=$cat->getCgId())
		  $tree[$cat->getCgId()] = str_repeat('&nbsp', 4*substr_count($cat->getCgFamily(), "/")) . '+' . $cat->getCgName();
	}
	//var_dump($tblcategory->getCgParentid());
	echo select_tag('tblcategory[cg_parentid]', options_for_select($tree, $tblcategory->getCgParentid()));
?>