Add bubbletree
Add bubbletree

file:b/.gitmodules (new)
--- /dev/null
+++ b/.gitmodules
@@ -1,1 +1,4 @@
+[submodule "lib/bubbletree"]
+	path = lib/bubbletree
+	url = https://github.com/okfn/bubbletree.git
 

--- a/admin/displayUNSPSC.php
+++ b/admin/displayUNSPSC.php
@@ -1,11 +1,7 @@
 <?php

 error_reporting(E_ALL);

+  include_once("../lib/common.inc.php");

 

-$link = mysql_connect('localhost', 'team7', 'wlUsnD2xu9');

-if (!$link) {

-    die('Could not connect: ' . mysql_error());

-}

-@mysql_select_db("team7") or die("Unable to select database");

 

 $unspscresult = mysql_query ("select * from UNSPSCcategories;");

 while ($row = mysql_fetch_assoc($unspscresult)) {

@@ -17,7 +13,7 @@
 echo "<table>";

 while ($row = mysql_fetch_assoc($catsresult)) {

 	$catName = $unspsc[$row['cat']."000000"].$row['cat'];

-	if ($row['cat'] = "") $catName = "null";

+	if ($row['cat'] == "") $catName = "null";

 	

 	echo "<tr><td>$catName</td><td>".$row['value']."</td></tr>";

 }


--- /dev/null
+++ b/displayBubbletree.php
@@ -1,1 +1,100 @@
 
+<!DOCTYPE html> 
+<html xmlns="http://www.w3.org/1999/xhtml"> 
+<head> 
+	<meta charset="UTF-8"/> 
+	<title>Minimal BubbleTree Demo</title> 
+	<script type="text/javascript" src="lib/bubbletree/lib/jquery-1.5.2.min.js"></script> 
+	<script type="text/javascript" src="lib/bubbletree/lib/jquery.history.js"></script> 
+	<script type="text/javascript" src="lib/bubbletree/lib/raphael.js"></script> 
+	<script type="text/javascript" src="lib/bubbletree/lib/vis4.js"></script> 
+	<script type="text/javascript" src="lib/bubbletree/lib/Tween.js"></script> 
+	<script type="text/javascript" src="lib/bubbletree/build/bubbletree.js"></script> 
+	<link rel="stylesheet" type="text/css" href="lib/bubbletree/build/bubbletree.css" /> 
+	<script type="text/javascript" src="lib/bubbletree/styles/cofog.js"></script> 
+	
+	
+	<script type="text/javascript"> 
+       
+		$(function() {
+		<?php
+include_once ("lib/common.inc.php");
+$unspscresult = mysql_query("select * from UNSPSCcategories;");
+while ($row = mysql_fetch_assoc($unspscresult)) {
+	$unspsc[$row['UNSPSC']] = $row['Title'];
+}
+$total = 0;
+$catsresult = mysql_query("SELECT LEFT( categoryUNSPSC, 1 ) as cat ,
+SUM( value ) as value
+FROM `contractnotice`
+WHERE childCN = 0
+GROUP BY cat ;");
+$nodes = Array();
+while ($row = mysql_fetch_assoc($catsresult)) {
+	$catName = $unspsc[$row['cat'] . "0000000"] . $row['cat'];
+	if ($row['cat'] == "") $catName = "null";
+	$subnodes = Array();
+	$cattwosresult = mysql_query("SELECT LEFT( categoryUNSPSC, 2 ) as cat ,
+SUM( value ) as value
+FROM `contractnotice`
+WHERE childCN = 0 and LEFT( categoryUNSPSC, 1 ) = '{$row['cat']}'
+GROUP BY cat ;");
+	while ($tworow = mysql_fetch_assoc($cattwosresult)) {
+		$subcatName = $unspsc[$tworow['cat'] . "000000"] . $tworow['cat'];
+		if ($tworow['cat'] == "") $subcatName = "null";
+		$subsubnodes = Array();
+		$catthreesresult = mysql_query("SELECT LEFT( categoryUNSPSC, 3 ) as cat ,
+SUM( value ) as value
+FROM `contractnotice`
+WHERE childCN = 0 and LEFT( categoryUNSPSC, 2 ) = '{$tworow['cat']}'
+GROUP BY cat ;");
+		while ($threerow = mysql_fetch_assoc($catthreesresult)) {
+			$subsubcatName = $unspsc[$threerow['cat'] . "00000"] . $threerow['cat'];
+			if ($threerow['cat'] == "") $subsubcatName = "null";
+			$subsubnodes[] = Array(
+				"label" => $subsubcatName,
+				"amount" => $threerow['value'],
+				"color" => "#000000"
+			);
+		}
+		$subnodes[] = Array(
+			"label" => $subcatName,
+			"amount" => $tworow['value'],
+			"color" => "#000000",
+			"children" => $subsubnodes
+		);
+	}
+	$nodes[] = Array(
+		"label" => $catName,
+		"amount" => $row['value'],
+		"color" => "#000000",
+		"children" => $subnodes
+	);
+	$total+= $row['value'];
+}
+$data = Array(
+	"label" => "Australian Federal Government Contract Spending",
+	"amount" => $total,
+	"color" => "#000000",
+	"children" => $nodes
+);
+echo "var data =eval('('+'" . json_encode($data) . "'+')');";
+?>
+
+			new BubbleTree({
+				data: data,
+				container: '.bubbletree'
+			});
+		
+			
+		});
+     
+	</script> 
+</head> 
+<body> 
+	<div class="bubbletree-wrapper"> 
+		<div class="bubbletree"></div> 
+	</div> 
+</body> 
+</html> 
+

directory:b/lib/bubbletree (new)
--- /dev/null
+++ b/lib/bubbletree