<?php 
	$c = new Criteria();
	$cats = TblcategoryPeer::doselect( $c);
	$tree['']='';
	foreach ($cats as $key => $cat) {
		$tree[$cat->getCgId()] = str_repeat('&nbsp', 4*substr_count($cat->getCgFamily(), "/")) . '+' . $cat->getCgName();
	}
	$htmlTags = "";
	switch ($sf_context->getActionName()) {
	    case "list":
	        $htmlTags = array('class'=>'filterCat');
        	$catSelected = $sf_params->get('filters');
        	if(isset($catSelected['doc_category']))
        	   $catSelected = $catSelected['doc_category'];
        	echo select_tag('filters[doc_category]', options_for_select($tree, $catSelected), $htmlTags);
	        break;
	    case "edit":
	        echo select_tag('tbldocument[doc_category]', options_for_select($tree, $tbldocument->getDocCategory()), $htmlTags);
	        break;
	}
?>