static public function countControls($control) { $currentCount=0; $controls=$control->getControls(); if (($count=$controls->getCount()) > 0) { for ($i=0; $i < $count; $i++) { if (($currControl=$controls->itemAt($i)) instanceof TControl) { $currentCount++; $currentCount+=self::countControls($currControl); } } } return $currentCount; }