Return to Snippet

Revision: 16004
at July 22, 2009 15:37 by sveggiani


Initial Code
// si estoy editando un registro elimino toda su rama del arbol
// para no poder moverlo adentro de si mismo

if ( !empty( $id ) ) :
        // traigo todos los IDs hijos de este nodo
	$childrens = $this->Tender->children($id);
	$childrensClean = Set::extract('/Tender/id', $childrens);
	// agrego el ID del propio nodo a la lista de exclusión
        $childrensClean[] = $id;
	$options = array( 'NOT' => array( 'Tender.id' => $childrensClean ) );
else:
	$options = array();
endif;

$parents = $this->Tender->generatetreelist($options, '{n}.Tender.id', '{n}.Tender.title_cat', '     ' );
$this->set('parents', $parents );

Initial URL


Initial Description


Initial Title
remove a branch from a Cakephp Tree (Tree behavior)

Initial Tags
cakephp

Initial Language
PHP