filter/sort table
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,9 +2,6 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" name="Default" comment="">
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/robots.txt" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/sitemap.xml.php" />
- <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/view.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/data/DCaaS+Catalogue+September+2013 Public.xls" afterPath="$PROJECT_DIR$/data/DCaaS+Catalogue+September+2013 Public.xls" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/img/csv.gif" afterPath="$PROJECT_DIR$/img/csv.gif" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/fonts/glyphicons-halflings-regular.eot" afterPath="$PROJECT_DIR$/fonts/glyphicons-halflings-regular.eot" />
@@ -35,9 +32,12 @@
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/img/license.txt" afterPath="$PROJECT_DIR$/img/license.txt" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/misc.xml" afterPath="$PROJECT_DIR$/.idea/misc.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/modules.xml" afterPath="$PROJECT_DIR$/.idea/modules.xml" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/robots.txt" afterPath="$PROJECT_DIR$/robots.txt" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/scopes/scope_settings.xml" afterPath="$PROJECT_DIR$/.idea/scopes/scope_settings.xml" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/sitemap.xml.php" afterPath="$PROJECT_DIR$/sitemap.xml.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/table.php" afterPath="$PROJECT_DIR$/table.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/vcs.xml" afterPath="$PROJECT_DIR$/.idea/vcs.xml" />
+ <change type="MODIFICATION" beforePath="$PROJECT_DIR$/view.php" afterPath="$PROJECT_DIR$/view.php" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/data/xls2csv.py" afterPath="$PROJECT_DIR$/data/xls2csv.py" />
</list>
@@ -46,11 +46,11 @@
<file path="/Dummy.txt" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388344993673" ignored="false" />
<file path="/import.php" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388236506137" ignored="false" />
<file path="/index.php" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388339437257" ignored="false" />
- <file path="/config.php" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388400418216" ignored="false" />
+ <file path="/config.php" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388498839775" ignored="false" />
<file path="/tagcloud.css" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388307524935" ignored="false" />
- <file path="/data.json.php" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388344717435" ignored="false" />
- <file path="/table.php" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388344953688" ignored="false" />
- <file path="/view.php" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388493089071" ignored="false" />
+ <file path="/data.json.php" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388499467699" ignored="false" />
+ <file path="/table.php" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388499014164" ignored="false" />
+ <file path="/view.php" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388496818732" ignored="false" />
<file path="/robots.txt" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388492384234" ignored="false" />
<file path="/sitemap.xml.php" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388492660527" ignored="false" />
<file path="/xls2csv.py" changelist="816b2800-4ae7-4ee2-9d29-ebf91af07d7d" time="1388492814098" ignored="false" />
@@ -117,16 +117,25 @@
<file leaf-file-name="config.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/config.php">
<provider selected="true" editor-type-id="text-editor">
- <state line="15" column="32" selection-start="514" selection-end="514" vertical-scroll-proportion="2.3076923">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="import.php" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/data/import.php">
- <provider selected="true" editor-type-id="text-editor">
- <state line="41" column="27" selection-start="1839" selection-end="1839" vertical-scroll-proportion="-16.384615">
+ <state line="52" column="42" selection-start="1618" selection-end="1618" vertical-scroll-proportion="-13.615385">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="jquery.dynatable.css" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/js/dynatable/jquery.dynatable.css">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="2" column="16" selection-start="0" selection-end="83" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="bootstrap.css" pinned="false" current="false" current-in-tab="false">
+ <entry file="file://$PROJECT_DIR$/css/bootstrap.css">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
@@ -144,21 +153,10 @@
</provider>
</entry>
</file>
- <file leaf-file-name="index.php" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/index.php">
- <provider selected="true" editor-type-id="text-editor">
- <state line="25" column="4" selection-start="829" selection-end="903" vertical-scroll-proportion="2.3076923">
- <folding>
- <element signature="n#style#0;n#div#0;n#div#0;n#div#0;n#!!top" expanded="true" />
- </folding>
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="data.json.php" pinned="false" current="false" current-in-tab="false">
+ <file leaf-file-name="data.json.php" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/data.json.php">
<provider selected="true" editor-type-id="text-editor">
- <state line="7" column="0" selection-start="307" selection-end="563" vertical-scroll-proportion="2.3076923">
+ <state line="21" column="45" selection-start="1149" selection-end="1149" vertical-scroll-proportion="0.45535713">
<folding />
</state>
</provider>
@@ -176,18 +174,16 @@
<file leaf-file-name="table.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/table.php">
<provider selected="true" editor-type-id="text-editor">
- <state line="18" column="45" selection-start="501" selection-end="501" vertical-scroll-proportion="2.3076923">
- <folding>
- <marker date="1388492974000" expanded="true" signature="1574:2226" placeholder="/*...*/" />
- </folding>
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="view.php" pinned="false" current="true" current-in-tab="true">
+ <state line="24" column="58" selection-start="610" selection-end="610" vertical-scroll-proportion="-7.8461537">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ </file>
+ <file leaf-file-name="view.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/view.php">
<provider selected="true" editor-type-id="text-editor">
- <state line="29" column="139" selection-start="1669" selection-end="1669" vertical-scroll-proportion="0.6837294">
+ <state line="36" column="60" selection-start="1888" selection-end="1888" vertical-scroll-proportion="-23.538462">
<folding />
</state>
</provider>
@@ -196,7 +192,7 @@
<file leaf-file-name="sitemap.xml.php" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/sitemap.xml.php">
<provider selected="true" editor-type-id="text-editor">
- <state line="20" column="17" selection-start="876" selection-end="876" vertical-scroll-proportion="2.3076923">
+ <state line="20" column="17" selection-start="876" selection-end="876" vertical-scroll-proportion="-13.076923">
<folding />
</state>
</provider>
@@ -233,13 +229,13 @@
<option value="$PROJECT_DIR$/lib/tag-cloud/css/tagcloud.css" />
<option value="$PROJECT_DIR$/about.php" />
<option value="$PROJECT_DIR$/index.php" />
- <option value="$PROJECT_DIR$/data.json.php" />
- <option value="$PROJECT_DIR$/table.php" />
<option value="$PROJECT_DIR$/robots.txt" />
- <option value="$PROJECT_DIR$/config.php" />
<option value="$PROJECT_DIR$/sitemap.xml.php" />
<option value="$PROJECT_DIR$/data/xls2csv.py" />
<option value="$PROJECT_DIR$/view.php" />
+ <option value="$PROJECT_DIR$/config.php" />
+ <option value="$PROJECT_DIR$/table.php" />
+ <option value="$PROJECT_DIR$/data.json.php" />
</list>
</option>
</component>
@@ -331,6 +327,66 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
+ <option name="myItemId" value="tests" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="lotsofcode" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="TagCloud" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="dcaas" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="dcaas" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="lib" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="tag-cloud" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="src" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="lotsofcode" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="TagCloud" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="dcaas" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="dcaas" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="lib" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="tag-cloud" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
<option name="myItemId" value="css" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
@@ -345,6 +401,38 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
+ <option name="myItemId" value="js" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="dcaas" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="dcaas" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="js" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="dynatable" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="dcaas" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="dcaas" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
<option name="myItemId" value="img" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
@@ -360,6 +448,20 @@
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="data" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ </PATH>
+ <PATH>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="dcaas" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="dcaas" />
+ <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
+ </PATH_ELEMENT>
+ <PATH_ELEMENT>
+ <option name="myItemId" value="css" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
@@ -534,13 +636,6 @@
<breakpoint-manager />
</component>
<component name="editorHistoryManager">
- <entry file="file://$PROJECT_DIR$/config.php">
- <provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
- <folding />
- </state>
- </provider>
- </entry>
<entry file="file://$PROJECT_DIR$/data/import.php">
<provider selected="true" editor-type-id="text-editor">
<state line="29" column="34" selection-start="1266" selection-end="1266" vertical-scroll-proportion="0.0">
@@ -560,9 +655,7 @@
<entry file="file://$PROJECT_DIR$/table.php">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
- <folding>
- <marker date="1388492974000" expanded="true" signature="1574:2226" placeholder="/*...*/" />
- </folding>
+ <folding />
</state>
</provider>
</entry>
@@ -576,13 +669,6 @@
<entry file="file://$PROJECT_DIR$/robots.txt">
<provider selected="true" editor-type-id="text-editor">
<state line="5" column="51" selection-start="175" selection-end="175" vertical-scroll-proportion="0.0">
- <folding />
- </state>
- </provider>
- </entry>
- <entry file="file://$PROJECT_DIR$/config.php">
- <provider selected="true" editor-type-id="text-editor">
- <state line="15" column="32" selection-start="514" selection-end="514" vertical-scroll-proportion="2.3076923">
<folding />
</state>
</provider>
@@ -606,46 +692,65 @@
</entry>
<entry file="file://$PROJECT_DIR$/index.php">
<provider selected="true" editor-type-id="text-editor">
- <state line="25" column="4" selection-start="829" selection-end="903" vertical-scroll-proportion="2.3076923">
+ <state line="25" column="53" selection-start="878" selection-end="878" vertical-scroll-proportion="-11.076923">
<folding>
<element signature="n#style#0;n#div#0;n#div#0;n#div#0;n#!!top" expanded="true" />
</folding>
</state>
</provider>
</entry>
+ <entry file="file://$PROJECT_DIR$/sitemap.xml.php">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="20" column="17" selection-start="876" selection-end="876" vertical-scroll-proportion="-13.076923">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/view.php">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="36" column="60" selection-start="1888" selection-end="1888" vertical-scroll-proportion="-23.538462">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/css/bootstrap.css">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/js/dynatable/jquery.dynatable.css">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="2" column="16" selection-start="0" selection-end="83" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/lib/tag-cloud/css/tagcloud.css">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="44" column="17" selection-start="642" selection-end="642" vertical-scroll-proportion="0.0">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/config.php">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="52" column="42" selection-start="1618" selection-end="1618" vertical-scroll-proportion="-13.615385">
+ <folding />
+ </state>
+ </provider>
+ </entry>
+ <entry file="file://$PROJECT_DIR$/table.php">
+ <provider selected="true" editor-type-id="text-editor">
+ <state line="24" column="58" selection-start="610" selection-end="610" vertical-scroll-proportion="-7.8461537">
+ <folding />
+ </state>
+ </provider>
+ </entry>
<entry file="file://$PROJECT_DIR$/data.json.php">
<provider selected="true" editor-type-id="text-editor">
- <state line="7" column="0" selection-start="307" selection-end="563" vertical-scroll-proportion="2.3076923">
- <folding />
- </state>
- </provider>
- </entry>
- <entry file="file://$PROJECT_DIR$/lib/tag-cloud/css/tagcloud.css">
- <provider selected="true" editor-type-id="text-editor">
- <state line="44" column="17" selection-start="642" selection-end="642" vertical-scroll-proportion="0.0">
- <folding />
- </state>
- </provider>
- </entry>
- <entry file="file://$PROJECT_DIR$/table.php">
- <provider selected="true" editor-type-id="text-editor">
- <state line="18" column="45" selection-start="501" selection-end="501" vertical-scroll-proportion="2.3076923">
- <folding>
- <marker date="1388492974000" expanded="true" signature="1574:2226" placeholder="/*...*/" />
- </folding>
- </state>
- </provider>
- </entry>
- <entry file="file://$PROJECT_DIR$/sitemap.xml.php">
- <provider selected="true" editor-type-id="text-editor">
- <state line="20" column="17" selection-start="876" selection-end="876" vertical-scroll-proportion="2.3076923">
- <folding />
- </state>
- </provider>
- </entry>
- <entry file="file://$PROJECT_DIR$/view.php">
- <provider selected="true" editor-type-id="text-editor">
- <state line="29" column="139" selection-start="1669" selection-end="1669" vertical-scroll-proportion="0.6837294">
+ <state line="21" column="45" selection-start="1149" selection-end="1149" vertical-scroll-proportion="0.45535713">
<folding />
</state>
</provider>
--- a/config.php
+++ b/config.php
@@ -43,7 +43,15 @@
<link href="js/dynatable/jquery.dynatable.css" rel="stylesheet">
<link href="lib/tag-cloud/css/tagcloud.css" rel="stylesheet">
<link href="css/bootstrap.css" rel="stylesheet">
-
+ <style>
+ th a {
+ color: #428bca;
+ }
+ th a:hover {
+ color: #428bca;
+ text-decoration: underline;
+ }
+ </style>
<!-- Custom styles for this template
<link href="starter-template.css" rel="stylesheet">-->
--- a/data.json.php
+++ b/data.json.php
@@ -5,12 +5,33 @@
$page = filter_input(INPUT_GET, 'page', FILTER_SANITIZE_NUMBER_INT);
$perPage = filter_input(INPUT_GET, 'perPage', FILTER_SANITIZE_NUMBER_INT);
$offset = filter_input(INPUT_GET, 'offset', FILTER_SANITIZE_NUMBER_INT);
-$query = "Select acnabn, service_name from dcaas_services order by acnabn";
+$search = preg_replace("/[^a-zA-Z0-9]+/", "", filter_var($_GET['queries']['search'], FILTER_SANITIZE_STRING));
+$sortby = 'acnabn';
+if (isset($_GET['sorts'])) {
+ $keys = array_keys($_GET['sorts']);
+ if (in_array($keys[0], array('trading_or_business_name', 'acnabn', 'service', 'service_category', 'service_sub_category'))) {
+ $sortby = preg_replace("/[^a-zA-Z0-9_]+/", "", $keys[0]);
+ if ($sortby == 'service') $sortby = 'service_name';
+ }
+}
+$select_columns = 'Select trading_or_business_name, acnabn, service_name, service_category, service_sub_category ';
+$query = " from dcaas_services "
+ . ($search != "" ? " where service_name like '%$search%'" : "");
$total = $db->query("select count(*) from dcaas_services")->fetch(PDO::FETCH_NUM);
-foreach ($db->query($query . " limit $offset," . ($page * $perPage), PDO::FETCH_ASSOC) as $row) {
+$query_total = $db->query("select count(*) ".$query)->fetch(PDO::FETCH_NUM);
+
+/* http://www.sqlite.org/lang_select.html
+Instead of a separate OFFSET clause, the LIMIT clause may specify two scalar expressions separated by a comma.
+In this case, the first expression is used as the OFFSET expression and the second as the LIMIT expression.
+This is counter-intuitive, as when using the OFFSET clause the second of the two expressions is the OFFSET
+and the first the LIMIT. This is intentional - it maximizes compatibility with other SQL database systems.*/
+$limit = "limit $offset, $perPage";
+
+foreach ($db->query($select_columns .$query . " order by $sortby $limit", PDO::FETCH_ASSOC) as $row) {
+ $row['service'] = '<a href="view.php?acnabn=' . $row['acnabn'] . "&service_name=" . $row['service_name'] . '">' . $row['service_name'] . "</a>";
$result['records'][] = $row;
}
-$result['queryRecordCount'] = intval($total[0]);
+$result['queryRecordCount'] = intval($query_total[0]);
$result['totalRecordCount'] = intval($total[0]);
echo json_encode($result);
?>
--- a/table.php
+++ b/table.php
@@ -2,17 +2,14 @@
include("config.php");
include("lib/tag-cloud/src/lotsofcode/TagCloud/TagCloud.php");
-includeHeader("title");
+includeHeader("DCaaS Service Catalogue");
?>
<div class="starter-template">
<br/>
<br/>
- <h1>Bootstrap starter template</h1>
-
- <p class="lead">Use this document as a way to quickly start any new project.<br> All you get is this text and a
- mostly barebones HTML document.</p>
+ <h1>DCaaS Service Catalogue</h1>
<!--<div id="search-example-year-filter" style="float: left;">
Year:
@@ -31,10 +28,12 @@
</div>-->
- <table id="my-table">
+ <table id="my-table" class="table table-striped">
<thead>
- <th>acnabn</th>
- <th>service_name</th>
+ <th>trading_or_business_name</th>
+ <th>Service</th>
+ <th>service_category</th>
+ <th>service_sub_category</th>
</thead>
</table>
</div>
--- a/view.php
+++ b/view.php
@@ -1,6 +1,12 @@
<?php
include("config.php");
-$data = $db->query("Select * from dcaas_services where acnabn = '31010545267' and service_name = 'Software as a Service (SaaS) - Microsoft Exchange e-mail';")->fetchAll(PDO::FETCH_ASSOC);
+$acnabn = filter_input(INPUT_GET,'acnabn', FILTER_SANITIZE_STRING);
+$service_name = filter_input(INPUT_GET,'service_name', FILTER_SANITIZE_STRING);
+$sth = $db->prepare("Select * from dcaas_services where acnabn = :acnabn and service_name = :service_name");
+$sth->bindValue(':acnabn',$acnabn);
+$sth->bindValue(':service_name',$service_name);
+$sth->execute();
+$data = $sth->fetchAll(PDO::FETCH_ASSOC);
if (count($data) == 0) {
header('HTTP/1.0 404 Not Found');
includeHeader('Not Found');