app/Module/InteractiveTree/TreeView.php
private function drawChildren(Collection $familyList, int $gen = 1, bool $ajax = false): string
    {
        $html          = '';
        $children2draw = [];
        $f2load        = [];

        foreach ($familyList as $f) {
            $children = $f->children();
            if ($children->isNotEmpty()) {
                $f2load[] = $f->xref();
                foreach ($children as $child) {
                    // Eliminate duplicates - e.g. when adopted by a step-parent
                    $children2draw[$child->xref()] = $child;
                }
            }
        }
        $tc = count($children2draw);
        if ($tc) {
            $f2load = implode(',', $f2load);
            $nbc    = 0;
            foreach ($children2draw as $child) {
                $nbc++;
                if ($tc == 1) {
                    $co = 'c'; // unique
                } elseif ($nbc == 1) {
                    $co = 't'; // first
                } elseif ($nbc == $tc) {
                    $co = 'b'; //last
                } else {
                    $co = 'h';
                }
                $html .= $this->drawPerson($child, $gen - 1, -1, null, $co, false);
            }
            if (!$ajax) {
                $html = '<td align="right"' . ($gen == 0 ? ' abbr="c' . $f2load . '"' : '') . '>' . $html . '</td>' . $this->drawHorizontalLine();
            }
        }

        return $html;
    }
private function drawChildren(Collection $familyList, int $gen = 1, bool $ajax = false): string
    {
        $html          = '';
        $children2draw = [];
        $f2load        = [];

        foreach ($familyList as $f) {
            $children = $f->children();
            if ($children->isNotEmpty()) {
                $f2load[] = $f->xref();
                foreach ($children as $child) {
                    // Eliminate duplicates - e.g. when adopted by a step-parent
                    $children2draw[$child->xref()] = $child;
                }
            }
        }
        $tc = count($children2draw);
        if ($tc) {
            $f2load = implode(',', $f2load);
            $nbc    = 0;
            foreach ($children2draw as $child) {
                $nbc++;
                if ($tc == 1) {
                    $co = 'c'; // unique
                } elseif ($nbc == 1) {
                    $co = 't'; // first
                } elseif ($nbc == $tc) {
                    $co = 'b'; //last
                } else {
                    $co = 'h';
                }
                $html .= $this->drawPerson($child, $gen - 1, -1, null, $co, false);
            }
            if (!$ajax) {
                $html = '<td align="right"' . ($gen == 0 ? ' abbr="c' . $f2load . '"' : '') . '>' . $html . '</td>' . $this->drawHorizontalLine();
            }
        }

        return $html;
    }
private function drawChildren ( Collection $ familyList , int $ gen = 1 , bool $ ajax = false ) : string { $ html = '' ; $ children2draw = [ ] ; $ f2load = [ ] ; foreach ( $ familyList as $ f ) { $ children = $ f -> children ( ) ; if ( $ children -> isNotEmpty ( ) ) { $ f2load [ ] = $ f -> xref ( ) ; foreach ( $ children as $ child ) { // Eliminate duplicates - e.g. when adopted by a step-parent $ children2draw [ $ child -> xref ( ) ] = $ child ; } } } $ tc = count ( $ children2draw ) ; if ( $ tc ) { $ f2load = implode ( ',' , $ f2load ) ; $ nbc = 0 ; foreach ( $ children2draw as $ child ) { $ nbc ++ ; if ( $ tc == 1 ) { $ co = 'c' ; // unique } elseif ( $ nbc == 1 ) { $ co = 't' ; // first } elseif ( $ nbc == $ tc ) { $ co = 'b' ; //last } else { $ co = 'h' ; } $ html .= $ this -> drawPerson ( $ child , $ gen - 1 , - 1 , null , $ co , false ) ; } if ( ! $ ajax ) { $ html = '<td align="right"' . ( $ gen == 0 ? ' abbr="c' . $ f2load . '"' : '' ) . '>' . $ html . '</td>' . $ this -> drawHorizontalLine ( ) ; } } return $ html ; }
Draw the children for some families

@param Collection $familyList array of families to draw the children for
@param int        $gen        number of generations to draw
@param bool       $ajax       true for an ajax call

@return string
Draw the children for some families