예제 #1
0
파일: lib.php 프로젝트: Zoocha/pt-reporting
function reportStats()
{
    $connection = connectToDb();
    $output = "";
    $headers = array("Accepted", "Finished", "Unscheduled", "Started", "Unstarted", "Rejected", "Delivered");
    $output .= '<thead><tr>';
    foreach ($headers as $header) {
        $output .= '<th>' . $header . '</th>';
    }
    $output .= '</tr></thead>';
    $output .= '<tbody>';
    $items_array = array();
    $items_array[] = countAllStatusSql("accepted", $connection);
    $items_array[] = countAllStatusSql("finished", $connection);
    $items_array[] = countAllStatusSql("unscheduled", $connection);
    $items_array[] = countAllStatusSql("started", $connection);
    $items_array[] = countAllStatusSql("unstarted", $connection);
    $items_array[] = countAllStatusSql("rejected", $connection);
    $items_array[] = countAllStatusSql("delivered", $connection);
    $items_string = "<td>" . implode("</td><td>", $items_array) . "</td>";
    $output .= "<tr>" . $items_string . "</tr>" . "\n";
    $output .= '</tbody>';
    $connection = null;
    return $output;
}
예제 #2
0
?>
],
                ['Started', <?php 
echo countAllStatusSql("started", $connection);
?>
],
                ['Unstarted', <?php 
echo countAllStatusSql("unstarted", $connection);
?>
],
                ['Rejected', <?php 
echo countAllStatusSql("rejected", $connection);
?>
],
                ['Delivered', <?php 
echo countAllStatusSql("delivered", $connection);
?>
]
            ]);

            var options = {
                title: 'All project statistics'
            };

            var chart = new google.visualization.BarChart(document.getElementById('piechart'));

            chart.draw(data, options);
        }
    </script>
<div id="piechart"></div>
<?php