From 6bbba0108bedf098b3fb338b070ad3b46560ce21 Mon Sep 17 00:00:00 2001 From: Paul Spiesberger Date: Wed, 10 Mar 2021 23:21:47 +0100 Subject: [PATCH 1/5] Adds PHP CSV script to save data to local file --- .gitignore | 1 + settings/config.xml | 4 ++-- src/save_as_csv.php | 55 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100755 src/save_as_csv.php diff --git a/.gitignore b/.gitignore index f3adafd..a091a5d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store /data/ +OUTPUT/* \ No newline at end of file diff --git a/settings/config.xml b/settings/config.xml index 86a75a5..9f3b210 100644 --- a/settings/config.xml +++ b/settings/config.xml @@ -70,9 +70,9 @@ - exe.php?do=save + src/save_as_csv.php - post + get yourdomain.com diff --git a/src/save_as_csv.php b/src/save_as_csv.php new file mode 100755 index 0000000..c58d45a --- /dev/null +++ b/src/save_as_csv.php @@ -0,0 +1,55 @@ + \ No newline at end of file From 0846446b1e1f8cab7499b961d5b8b1293c4f5366 Mon Sep 17 00:00:00 2001 From: Paul Spiesberger Date: Thu, 11 Mar 2021 20:50:50 +0100 Subject: [PATCH 2/5] Adds doc, changes to PHP CSV function --- src/save_as_csv.php | 87 +++++++++++++++++++++++++++------------------ 1 file changed, 53 insertions(+), 34 deletions(-) diff --git a/src/save_as_csv.php b/src/save_as_csv.php index c58d45a..5742c88 100755 --- a/src/save_as_csv.php +++ b/src/save_as_csv.php @@ -1,3 +1,19 @@ +/** +This PHP script takes the results of the survey and writes it into a CSV file. + +Change in settings/config.xml the following: + + + src/save_as_csv.php + + get + +You will find the generate CSV file in the folder OUTPUT. Simply move or delete the file if you +would like to start a new survey. + +@author Paul Spiesberger - no warrenty for any dataloss or other harm. + + */ Date: Thu, 11 Mar 2021 21:04:50 +0100 Subject: [PATCH 3/5] Fixes Typo --- src/save_as_csv.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/save_as_csv.php b/src/save_as_csv.php index 5742c88..f69c19c 100755 --- a/src/save_as_csv.php +++ b/src/save_as_csv.php @@ -18,7 +18,7 @@ $filePath = "../OUTPUT/survey_results.csv"; -createDir("../OUTPUT/"); // create director if it doesn't exist yet +createDir("../OUTPUT/"); // create directory if it doesn't exist yet $csvFile = fopen($filePath, "a") or die("Unable to open file!"); From b2ad330d9c072d7d369cde8b3be63c63897755af Mon Sep 17 00:00:00 2001 From: Paul Spiesberger Date: Fri, 12 Mar 2021 22:27:58 +0100 Subject: [PATCH 4/5] Dynamic forms, comments and durations --- src/save_as_csv.php | 106 +++++++++++++++++++++++++------------------- 1 file changed, 61 insertions(+), 45 deletions(-) diff --git a/src/save_as_csv.php b/src/save_as_csv.php index f69c19c..974e5ea 100755 --- a/src/save_as_csv.php +++ b/src/save_as_csv.php @@ -1,68 +1,85 @@ + + * src/save_as_csv.php + * + * get + * + * You will find the generate CSV file in the folder OUTPUT. Simply move or delete the file if you + * would like to start a new survey. + * + * @author Paul Spiesberger - no warrenty for any dataloss or other harm. + */ -Change in settings/config.xml the following: +$filePath = "../OUTPUT/survey_results.csv"; - - src/save_as_csv.php - - get +createDir("../OUTPUT/"); // create directory if it doesn't exist yet -You will find the generate CSV file in the folder OUTPUT. Simply move or delete the file if you -would like to start a new survey. +$csvFile = fopen($filePath, "a") or die("Unable to open file!"); -@author Paul Spiesberger - no warrenty for any dataloss or other harm. +// Extract comments +$comments = array(); +$commentHeaders = array(); - */ - \ No newline at end of file From 4c2003ad647319e8cca58492183b47496cb92589 Mon Sep 17 00:00:00 2001 From: Paul Spiesberger Date: Sat, 13 Mar 2021 18:48:32 +0100 Subject: [PATCH 5/5] Updates Readme and resets config file --- README.md | 13 +++++++++++++ settings/config.xml | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bb62c35..b100245 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,19 @@ HtmlQ introduces a few new settings that were not available in FlashQ: Your answers will be lost. ``` +### CSV Export + +If your webspace supports [PHP](https://www.php.net/) then you can config HtmlQ to write all results into a CSV file. You will find the CSV file in the folder with the name `OUTPUT`. Delete the file to start a new survey. + +`settings/config.xml`: + +```xml + + src/save_as_csv.php + + get +``` + ## Creating unique participation links (UID) If you want to send out unique links to a HtmlQ survey that will automatically fill in the UID/user code, you can create links in the following format: [https://www.yourdomain.com/htmlq/#/?userCode=USERCODE](). In the resulting CSV file, the user code will show up in the UID field. This allows you to identify participants without requiring them to log in. diff --git a/settings/config.xml b/settings/config.xml index 9f3b210..86a75a5 100644 --- a/settings/config.xml +++ b/settings/config.xml @@ -70,9 +70,9 @@ - src/save_as_csv.php + exe.php?do=save - get + post yourdomain.com