From: Alex Sadleir Date: Sat, 28 Dec 2013 14:48:37 +0000 Subject: sqlite import X-Git-Url: https://maxious.lambdacomplex.org/git/?p=dcaas.git&a=commitdiff&h=34efd67e9f4c7b11d0cb577a81fcea17cd813dca --- sqlite import --- --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,7 @@ [submodule "js/dynatable"] path = js/dynatable url = https://github.com/JangoSteve/jquery-dynatable.git +[submodule "lib/tag-cloud"] + path = lib/tag-cloud + url = https://github.com/lotsofcode/tag-cloud.git --- /dev/null +++ b/.idea/.name @@ -1,1 +1,1 @@ - +dcaas --- /dev/null +++ b/.idea/compiler.xml @@ -1,1 +1,24 @@ + + + + + + --- /dev/null +++ b/.idea/encodings.xml @@ -1,1 +1,6 @@ + + + + + --- /dev/null +++ b/.idea/misc.xml @@ -1,1 +1,8 @@ + + + + + + + --- /dev/null +++ b/.idea/modules.xml @@ -1,1 +1,10 @@ + + + + + + + + + --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -1,1 +1,5 @@ - + + + + --- /dev/null +++ b/.idea/vcs.xml @@ -1,1 +1,8 @@ + + + + + + + --- /dev/null +++ b/.idea/workspace.xml @@ -1,1 +1,428 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + localhost + 5050 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --- a/README.md +++ b/README.md --- /dev/null +++ b/config.php @@ -1,1 +1,109 @@ +setAttribute(PDO::ATTR_ERRMODE, + PDO::ERRMODE_EXCEPTION); + } + catch(PDOException $e) { + // Print PDOException message + echo $e->getMessage(); + } +function includeHeader($title) { +?> + + + + + + + + + + + Starter Template for Bootstrap + + + + + + + + + + + + + + + + + + + +
+
+
+
+getMessage(); + } +?> + +
+ + +exec("DROP TABLE IF EXISTS dcaas_services"); + +$row = 0; +$headers = Array(); +$csvfile = '../data/DCaaS+Catalogue+September+2013 PublicDCaaS_AFI_Part_3_Sec_5_Service_.csv'; +if (($handle = fopen($csvfile, "r")) !== FALSE) { + while (($data = fgetcsv($handle, 4096, ",")) !== FALSE) { + if ($row == 0) { + /************************************** + * Create tables * + **************************************/ + // Create table messages + $create = "CREATE TABLE IF NOT EXISTS dcaas_services ("; +// id INTEGER PRIMARY KEY,"; + foreach ($data as $column) { + $column = str_replace(" ", "_", strtolower($column)); + $create .= $column . " text " . (($column == 'acnabn' || $column == 'service_name') ? " not null " : "") . ","; + $headers[] = $column; + } + //$create .= " PRIMARY KEY ( acnabn,service_name) )"; + $create .= "id INTEGER PRIMARY KEY )"; + echo $create; + $db->exec($create); + // Prepare INSERT statement to SQLite3 file db + /* Create a string for the parameter placeholders filled to the number of params */ + $placeholders = implode(',', array_fill(0, count($headers), '?')); + $insert = "INSERT INTO dcaas_services (" . implode($headers, ", ") . ") + VALUES (" . $placeholders . ")"; + echo $insert; + $stmt = $db->prepare($insert); + $db->beginTransaction(); + } else { + if (count($data) < count($headers)) { + $values = $data + array_fill(count($data), count($headers) - count($data), NULL); + } else { + $values = $data; + } + print_r($values); + $stmt->execute($data); + } + $row++; + } +// end transaction + $db->commit(); + + fclose($handle); + echo "$row rows imported"; +} + +?> + --- a/data/xls2csv.py +++ b/data/xls2csv.py --- /dev/null +++ b/dcaas.iml @@ -1,1 +1,10 @@ + + + + + + + + + --- a/fonts/glyphicons-halflings-regular.svg +++ b/fonts/glyphicons-halflings-regular.svg --- a/index.php +++ b/index.php @@ -1,96 +1,12 @@ + - - - - - - - - +includeHeader("title"); +$cloud = new lotsofcode\TagCloud\TagCloud(); +$cloud->addTag("tag-cloud"); +$cloud->addTag("programming"); +echo $cloud->render(); +includeFooter(); +?> - Starter Template for Bootstrap - - - - - - - - - - - - - - - - - - - -
- -
-
-
-

Bootstrap starter template

-

Use this document as a way to quickly start any new project.
All you get is this text and a mostly barebones HTML document.

- - \n"; -} else { -echo " \n"; - } - $row++; -} - fclose($handle); -} -?> -
".implode($data,"")."
".implode($data,"")."
-
- -
- - - - - - - - - - - - --- a/js/bootstrap.js +++ b/js/bootstrap.js --- a/js/bootstrap.min.js +++ b/js/bootstrap.min.js --- /dev/null +++ b/lib/tag-cloud --- /dev/null +++ b/table.php @@ -1,1 +1,99 @@ + + +
+
+
+ +

Bootstrap starter template

+ +

Use this document as a way to quickly start any new project.
All you get is this text and a + mostly barebones HTML document.

+ +
+ Year: + +
+ +
+ Max Price: + $ +
+ + + + + \n"; + } else { + echo " \n"; + } + $row++; + } + fclose($handle); + } + ?> +
" . implode($data, "") . "
" . implode($data, "") . "
+
+ + + + + + + + + + + +