public function renderSummary($postId, $data)
    {
        $totalCount = 0;
        echo '<table id="customer-feedback-summary" cellspacing="0" cellpadding="0"><tbody>';

        foreach ($data['args']['results'] as $count) {
            $totalCount += $count;
        }

        foreach ($data['args']['results'] as $answer => $count) {
            $answerLabel = false;

            switch ($answer) {
                case 'yes':
                    $answerLabel = '<span style="color:#30BA41;">' . __('Positive', 'customer-feedback') . '</span>';
                    break;

                case 'no':
                    $answerLabel = '<span style="color:#BA3030;">' . __('Negative', 'customer-feedback') . '</span>';
                    break;
            }

            if (!$answerLabel) {
                continue;
            }

            $percent = 0;
            if ($totalCount > 0) {
                $percent = round($count / $totalCount, 2) * 100;
            }

            echo '
                <tr>
                    <td>' . $answerLabel . '</td>
                    <td>' . $percent . '% (' . $count . ')</td>
                </tr>
            ';
        }

        echo '</tbody></table>';

        echo '<div style="padding:12px 14px;">' . __('The feedback stats will be reset to zero (without removing the actual feedback messages) when a new version of the post is saved.', 'customer-feedback') . '</div>';
    }
public function renderSummary($postId, $data)
    {
        $totalCount = 0;
        echo '<table id="customer-feedback-summary" cellspacing="0" cellpadding="0"><tbody>';

        foreach ($data['args']['results'] as $count) {
            $totalCount += $count;
        }

        foreach ($data['args']['results'] as $answer => $count) {
            $answerLabel = false;

            switch ($answer) {
                case 'yes':
                    $answerLabel = '<span style="color:#30BA41;">' . __('Positive', 'customer-feedback') . '</span>';
                    break;

                case 'no':
                    $answerLabel = '<span style="color:#BA3030;">' . __('Negative', 'customer-feedback') . '</span>';
                    break;
            }

            if (!$answerLabel) {
                continue;
            }

            $percent = 0;
            if ($totalCount > 0) {
                $percent = round($count / $totalCount, 2) * 100;
            }

            echo '
                <tr>
                    <td>' . $answerLabel . '</td>
                    <td>' . $percent . '% (' . $count . ')</td>
                </tr>
            ';
        }

        echo '</tbody></table>';

        echo '<div style="padding:12px 14px;">' . __('The feedback stats will be reset to zero (without removing the actual feedback messages) when a new version of the post is saved.', 'customer-feedback') . '</div>';
    }
public function renderSummary ( $ postId , $ data ) { $ totalCount = 0 ; echo '<table id="customer-feedback-summary" cellspacing="0" cellpadding="0"><tbody>' ; foreach ( $ data [ 'args' ] [ 'results' ] as $ count ) { $ totalCount += $ count ; } foreach ( $ data [ 'args' ] [ 'results' ] as $ answer => $ count ) { $ answerLabel = false ; switch ( $ answer ) { case 'yes' : $ answerLabel = '<span style="color:#30BA41;">' . __ ( 'Positive' , 'customer-feedback' ) . '</span>' ; break ; case 'no' : $ answerLabel = '<span style="color:#BA3030;">' . __ ( 'Negative' , 'customer-feedback' ) . '</span>' ; break ; } if ( ! $ answerLabel ) { continue ; } $ percent = 0 ; if ( $ totalCount > 0 ) { $ percent = round ( $ count / $ totalCount , 2 ) * 100 ; } echo '
                <tr>
                    <td>' . $ answerLabel . '</td>
                    <td>' . $ percent . '% (' . $ count . ')</td>
                </tr>
            ' ; } echo '</tbody></table>' ; echo '<div style="padding:12px 14px;">' . __ ( 'The feedback stats will be reset to zero (without removing the actual feedback messages) when a new version of the post is saved.' , 'customer-feedback' ) . '</div>' ; }
Content of summary metabox
@param  integer $postId Current post id
@param  array   $data   Metabox args
@return void
Content of summary metabox