<?php
        function  getOneCount( $obj ) {
            if( !$obj )
            {
                return '(0)' ;
            }
            $sum = 0 ;
            $sum += intval($obj->satisfied);
            $sum += intval($obj->unsatisfied);
            return '('.  $sum . ')';
        }
        function putOne( $obj ) {
        ?>
<?php if( !$obj || $obj->satisfied || $obj->unsatisfied ) { ?>
<span class="inlinepie" values="<?php echo( intval($obj->satisfied) ); ?>,<?php echo( intval($obj->unsatisfied) ); ?>" ></span>
<?php } else { ?>
<span class="circle" style="height: 150px; line-height: 150px;">No Data</span>
<?php } ?>
<?php } ?>

<div class="col-md-12">
    <div class="box moplet-chart">
        <div class="box-header">
            <h3 class="box-title">Summary</h3>
        </div><!-- /.box-header -->
        <div class="box-body">
            <div class="table table-condensed">

                    <div>
                        <div class="piechart">
                            <p style="text-align: center">

                                <?php putOne( $cToday) ;?>
                                    <span class="subtitle">Today <?php echo getOneCount($cToday); ?></span>
                            </p>
                        </div>
                    </div>
                    <div>
                        <div class="piechart">
                            <p style="text-align: center">

                                <?php putOne( $cWeek) ;?>
                                    <span class="subtitle">This Week <?php echo getOneCount($cWeek); ?></span>
                            </p>
                        </div>
                    </div>
                    <div>
                        <div class="piechart">
                            <p style="text-align: center">

                                <?php putOne( $cMonth) ;?>
                                    <span class="subtitle">This Month <?php echo getOneCount($cMonth); ?></span>
                            </p>
                        </div>
                    </div>
                <div>
                    <div class="piechart">
                        <p style="text-align: center">

                            <?php putOne( $cPrevMonth) ;?>
                                <span class="subtitle">Previous Month <?php echo getOneCount($cPrevMonth); ?></span>
                        </p>
                    </div>
                </div>
                    <div>
                        <div class="piechart">
                            <p style="text-align: center">

                                <?php putOne( $cAll) ;?>
                                    <span class="subtitle">All Time <?php echo getOneCount($cAll); ?></span>
                            </p>
                        </div>
                    </div>

            </div>
        </div><!-- /.box-body -->
    </div>


    <script type="text/javascript">
            $('.inlinepie').sparkline('html', {sliceColors: ['green', 'red'], height: '150px', type: 'pie'});
    </script>
</div>