public function getParentComponent($numParent = 1)
    {
        if (isset($this->_lazyParent)) {
            $id = $this->_lazyParent;
            for ($i=0;$i<$numParent;$i++) {
                $pos = max(strrpos($id, '_'), strrpos($id, '-'));
                if ($pos) {
                    $id = substr($id, 0, $pos);
                } else {
                    $c = Kwf_Component_Data_Root::getInstance()->getComponentById($id, array('ignoreVisible'=>true));
                    for ($j=0;$j<$numParent-$i-1;$j++) {
                        $c = $c->parent;
                    }
                    return $c;
                }
            }
            return Kwf_Component_Data_Root::getInstance()->getComponentById($id, array('ignoreVisible'=>true));
        }
        $c = $this;
        for ($i=0;$i<$numParent;$i++) {
            $c = $c->parent;
        }
        return $c;
    }
public function getParentComponent($numParent = 1)
    {
        if (isset($this->_lazyParent)) {
            $id = $this->_lazyParent;
            for ($i=0;$i<$numParent;$i++) {
                $pos = max(strrpos($id, '_'), strrpos($id, '-'));
                if ($pos) {
                    $id = substr($id, 0, $pos);
                } else {
                    $c = Kwf_Component_Data_Root::getInstance()->getComponentById($id, array('ignoreVisible'=>true));
                    for ($j=0;$j<$numParent-$i-1;$j++) {
                        $c = $c->parent;
                    }
                    return $c;
                }
            }
            return Kwf_Component_Data_Root::getInstance()->getComponentById($id, array('ignoreVisible'=>true));
        }
        $c = $this;
        for ($i=0;$i<$numParent;$i++) {
            $c = $c->parent;
        }
        return $c;
    }
public function getParentComponent ( $ numParent = 1 ) { if ( isset ( $ this -> _lazyParent ) ) { $ id = $ this -> _lazyParent ; for ( $ i = 0 ; $ i < $ numParent ; $ i ++ ) { $ pos = max ( strrpos ( $ id , '_' ) , strrpos ( $ id , '-' ) ) ; if ( $ pos ) { $ id = substr ( $ id , 0 , $ pos ) ; } else { $ c = Kwf_Component_Data_Root :: getInstance ( ) -> getComponentById ( $ id , array ( 'ignoreVisible' => true ) ) ; for ( $ j = 0 ; $ j < $ numParent - $ i - 1 ; $ j ++ ) { $ c = $ c -> parent ; } return $ c ; } } return Kwf_Component_Data_Root :: getInstance ( ) -> getComponentById ( $ id , array ( 'ignoreVisible' => true ) ) ; } $ c = $ this ; for ( $ i = 0 ; $ i < $ numParent ; $ i ++ ) { $ c = $ c -> parent ; } return $ c ; }
Returns a parent component from a given depth

more efficient than getting ->parent multiple times (only if data was unserialized)

@param int levels to go up
@return Kwf_Component_Data
Returns a parent component from a given depth