<?php

/**
 *	loader.php is our helper script that loads new data into representation layer via client side callbacks
 */
namespace Reporo;

//Factory related includes
include_once "StatisticsFactory.php";
/**could sanitize $_GET vars if we were to pass it into db, ie with mysqli_real-escape-string
 * or with htmlspecialchars to escape special characters, if we were to embed this string within html markup
 * or escapeshellarg for embedding string into external commands, also could have checked for origin to avoid xss attackes
 * but will ignore security for now
 */
$id = $_GET["id"];
$type = $_GET["type"];
$statsFactory = new StatisticsFactory();
$publisher = $statsFactory->create($type, "2015-1-1", null, $id);
echo "['" . ucfirst($publisher->getName()) . " {$id} stats',  {v: " . $publisher->getImpressions() . "}, {v: " . $publisher->getClicks() . "}, {v: " . $publisher->getRevenues() . ", f: '£" . $publisher->getRevenues() . "'}]";
<?php

/**
 *	index.php is our view
 */
namespace Reporo;

//Factory related includes
include_once "StatisticsFactory.php";
$statsFactory = new StatisticsFactory();
//whole publisher stats in 2015
$publisher = $statsFactory->create(1, "2015-1-1", null, null);
?>
<!DOCTYPE html>
<html>
<head>
	<meta charset=utf-8 />
	<title>Reporo Statistical Analysis</title>
	<link rel="stylesheet" type="text/css" media="screen" href="css/master.css" />
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
	<!--[if IE]>
		<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
	<![endif]-->
	<!-- Latest compiled and minified CSS -->
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

	<!-- Optional theme -->
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">

	<!-- Latest compiled and minified JavaScript -->
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>