Example #1
0
function reportStoryIndividualStats($id)
{
    $connection = connectToDb();
    $output = "";
    $headers = array("Accepted", "Finished", "Unscheduled", "Started", "Unstarted", "Rejected", "Delivered", "Total");
    $items_array = array();
    $items_array[] = "<tr><th>" . $headers[0] . "</th>\n        <td>" . ($accepted = countStoryStatusSql($id, "accepted", $connection));
    $items_array[] = "<tr><th>" . $headers[1] . "</th>\n        <td>" . ($finished = countStoryStatusSql($id, "finished", $connection));
    $items_array[] = "<tr><th>" . $headers[2] . "</th>\n        <td>" . ($unscheduled = countStoryStatusSql($id, "unscheduled", $connection));
    $items_array[] = "<tr><th>" . $headers[3] . "</th>\n        <td>" . ($started = countStoryStatusSql($id, "started", $connection));
    $items_array[] = "<tr><th>" . $headers[4] . "</th>\n        <td>" . ($unstarted = countStoryStatusSql($id, "unstarted", $connection));
    $items_array[] = "<tr><th>" . $headers[5] . "</th>\n        <td>" . ($rejected = countStoryStatusSql($id, "rejected", $connection));
    $items_array[] = "<tr><th>" . $headers[6] . "</th>\n        <td>" . ($delivered = countStoryStatusSql($id, "delivered", $connection));
    $items_array[] = '<tr class="success"><th>' . $headers[7] . "</th>\n        <td>" . ($accepted + $finished + $unscheduled + $started + $unstarted + $rejected + $delivered);
    $items_string = implode("</tr>", $items_array);
    $output .= $items_string . "</td></tr>";
    $connection = null;
    return $output;
}
?>
],
                ['Started', <?php 
echo countStoryStatusSql($history_id, "started", $connection);
?>
],
                ['Unstarted', <?php 
echo countStoryStatusSql($history_id, "unstarted", $connection);
?>
],
                ['Rejected', <?php 
echo countStoryStatusSql($history_id, "rejected", $connection);
?>
],
                ['Delivered', <?php 
echo countStoryStatusSql($history_id, "delivered", $connection);
?>
]
            ]);

            var options = {
                title: 'Story States Statistics'
            };

            var chart = new google.visualization.PieChart(document.getElementById('story-state-piechart'));

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