more ausbudget work
more ausbudget work


Former-commit-id: 1ec1907af829318fa6e8e3ac107f21b4a5c10fad

--- a/admin/ausbudget/importAusbudget.php
+++ /dev/null
@@ -1,7 +1,1 @@
-<?php
 
-$html = phpQuery::newDocumentHTML($request->body);
-            phpQuery::selectDocument($html);
-            foreach (pq('meta')->elements as $meta) {
-
-

--- /dev/null
+++ b/admin/importAusbudget.php
@@ -1,1 +1,51 @@
+<?php
 
+include_once("../include/common.inc.php");
+require($basePath . 'lib/phpquery/phpQuery/phpQuery.php');
+
+setlocale(LC_CTYPE, 'C');
+
+function getTextFromNode($Node, $Text = "") {
+    if (!isset($Node->tagName) || $Node->tagName == null) {
+        return $Text . $Node->textContent;
+    }
+    $Node = $Node->firstChild;
+    if (isset($Node) && $Node != null) {
+        $Text = getTextFromNode($Node, $Text);
+    }
+    while (isset($Node->nextSibling) && $Node->nextSibling != null) {
+        $Text = getTextFromNode($Node->nextSibling, $Text);
+        $Node = $Node->nextSibling;
+    }
+    return $Text;
+}
+
+$dir = "./ausbudget/";
+$dhandle = opendir("./ausbudget/");
+// define an array to hold the files
+$files = array();
+if ($dhandle) {
+    // loop through all of the files
+    while (false !== ($fname = readdir($dhandle))) {
+        if (($fname != '.') && ($fname != '..')) {
+            echo "$fname <br>";
+            $html = phpQuery::newDocumentHTML(file_get_contents($dir . $fname));
+            phpQuery::selectDocument($html);
+            foreach (pq('table')->elements as $table) {
+                echo "loltable";
+                //echo $table->ownerDocument->saveXML($table);
+                foreach (pq('tr')->elements as $row) {
+                    echo "lolrow";
+                    $rowText = getTextFromNode($row);
+                    if (strpos($rowText,"Twitter") === false) {
+                        echo "<b>".pq("td:first",$row)->text()."</b><br>";
+                        echo pq("td",$row)->text() . "<br>";
+                    }
+                }
+            }
+        }
+        break;
+    }
+}
+?>
+