classes/DcaBanner.php
public function addHeader($add, $dca)
    {
        $catId = $add['id'];
        unset($add['id']); //delete the helper
        
        $sql = 'SELECT CAST(`banner_published` AS UNSIGNED INTEGER) AS published
                	,count(id) AS numbers 
                FROM `tl_banner` 
                WHERE `pid`=?
                GROUP BY 1';
        $objNumbers = \Database::getInstance()->prepare($sql)->execute($catId);
        if ($objNumbers->numRows == 0)
        {
            return $add;
        }
        $published     = 0;
        $not_published = 0;
        while ($objNumbers->next())
        {
            if ($objNumbers->published == 0) 
            {
            	$not_published = $objNumbers->numbers;
            }
            if ($objNumbers->published == 1)
            {
                $published = $objNumbers->numbers;
            }
        }
    
        $add[$GLOBALS['TL_LANG']['tl_banner']['banner_number_of']] = $published." " 
                        . $GLOBALS['TL_LANG']['tl_banner']['banner_active']
                        . " / "
                        . $not_published." "
                        . $GLOBALS['TL_LANG']['tl_banner']['banner_inactive'];
        return $add;
    }
public function addHeader($add, $dca)
    {
        $catId = $add['id'];
        unset($add['id']); //delete the helper
        
        $sql = 'SELECT CAST(`banner_published` AS UNSIGNED INTEGER) AS published
                	,count(id) AS numbers 
                FROM `tl_banner` 
                WHERE `pid`=?
                GROUP BY 1';
        $objNumbers = \Database::getInstance()->prepare($sql)->execute($catId);
        if ($objNumbers->numRows == 0)
        {
            return $add;
        }
        $published     = 0;
        $not_published = 0;
        while ($objNumbers->next())
        {
            if ($objNumbers->published == 0) 
            {
            	$not_published = $objNumbers->numbers;
            }
            if ($objNumbers->published == 1)
            {
                $published = $objNumbers->numbers;
            }
        }
    
        $add[$GLOBALS['TL_LANG']['tl_banner']['banner_number_of']] = $published." " 
                        . $GLOBALS['TL_LANG']['tl_banner']['banner_active']
                        . " / "
                        . $not_published." "
                        . $GLOBALS['TL_LANG']['tl_banner']['banner_inactive'];
        return $add;
    }
public function addHeader ( $ add , $ dca ) { $ catId = $ add [ 'id' ] ; unset ( $ add [ 'id' ] ) ; //delete the helper $ sql = 'SELECT CAST(`banner_published` AS UNSIGNED INTEGER) AS published
                	,count(id) AS numbers 
                FROM `tl_banner` 
                WHERE `pid`=?
                GROUP BY 1' ; $ objNumbers = \ Database :: getInstance ( ) -> prepare ( $ sql ) -> execute ( $ catId ) ; if ( $ objNumbers -> numRows == 0 ) { return $ add ; } $ published = 0 ; $ not_published = 0 ; while ( $ objNumbers -> next ( ) ) { if ( $ objNumbers -> published == 0 ) { $ not_published = $ objNumbers -> numbers ; } if ( $ objNumbers -> published == 1 ) { $ published = $ objNumbers -> numbers ; } } $ add [ $ GLOBALS [ 'TL_LANG' ] [ 'tl_banner' ] [ 'banner_number_of' ] ] = $ published . " " . $ GLOBALS [ 'TL_LANG' ] [ 'tl_banner' ] [ 'banner_active' ] . " / " . $ not_published . " " . $ GLOBALS [ 'TL_LANG' ] [ 'tl_banner' ] [ 'banner_inactive' ] ; return $ add ; }
Add Header Rows, call from header_callback
Add Header Rows call from header_callback