NAVIGATION
This shows you the differences between two versions of the page.
|
english:other-enhancements:hacks:form-result-download-csv [2012/05/18 10:22] Knut Heermann (flip-flop) |
english:other-enhancements:hacks:form-result-download-csv [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 16: | Line 16: | ||
| ##%%http://example.com/include/inc_act/act_export.php?action=exportformresultcsv&fid=8%%## | ##%%http://example.com/include/inc_act/act_export.php?action=exportformresultcsv&fid=8%%## | ||
| - | (exportformresult changes to exportformresult**csv**). | + | (Change exportformresult to exportformresult**csv**). |
| Line 56: | Line 56: | ||
| - | ==== Codeschnipsel V1.1 (Hack) ==== | + | ==== Code snipped V1.1 (Hack) ==== |
| - | **Update V1.1 18.05.2012:** Standardkonforme CSV-Ausgabe auch bei " und ; im Zellentext, \\ | + | **Update V1.1 18.05.2012:** A standard CSV output even if " and/or a field separator in the cell text, \\ |
| - | siehe OG: [[http://forum.phpwcms.org/viewtopic.php?p=135720#p135720]]. | + | see [[http://forum.phpwcms.org/viewtopic.php?p=135720#p135720]]. |
| - | + | ||
| - | Als Feldtrenner wird hier ein ##**;**## verwendet, einstellbar in der Variablen **$separator**, etwa in Zeile 140. | + | |
| - | As a field separator is the sign ##**;**## in use. Which is adjustable in the variable **$separator** around line 140. | + | As a field separator the sign ##**;**## is in use, which is adjustable in the variable **$separator** around line 140. |
| - | Erweiterung der Datei **include/inc_act/act_export.php** etwa ab Zeile 120. \\ | + | Enlagement of the file **include/inc_act/act_export.php** around line 120. \\ |
| - | Das erste ##exit();## wird ersetzt durch: | + | The first ##exit();## is replaced by: |
| Line 94: | Line 92: | ||
| $export = array(); | $export = array(); | ||
| $row = 1; | $row = 1; | ||
| - | $export[0] = array('#ID'=>'','#Date'=>'','#IP'=>''); | + | $export[0] = array('#'=>'','#ID'=>'','#Date'=>'','#IP'=>''); |
| // run all data first and combine array elements | // run all data first and combine array elements | ||
| Line 100: | Line 98: | ||
| // numbering starting at 1 | // numbering starting at 1 | ||
| + | $export[$row]['#'] = $row; | ||
| $export[$row]['#ID'] = $value['formresult_id']; | $export[$row]['#ID'] = $value['formresult_id']; | ||
| $export[$row]['#Date'] = $value['formresult_createdate']; | $export[$row]['#Date'] = $value['formresult_createdate']; | ||
| Line 145: | Line 144: | ||
| $elements[$x] .= ''; | $elements[$x] .= ''; | ||
| - | if ( isset($export[$x][$key]) ) { | + | // if ( isset($export[$x][$key]) ) { |
| // // Nicht zwingen notwenig, nur um fuer HTML-Darstellung | // // Nicht zwingen notwenig, nur um fuer HTML-Darstellung | ||
| Line 154: | Line 153: | ||
| $export[$x][$key] = '"'.str_replace('"', '""', $export[$x][$key]).'"'; // Jede Spalte in "..." setzen | $export[$x][$key] = '"'.str_replace('"', '""', $export[$x][$key]).'"'; // Jede Spalte in "..." setzen | ||
| - | } | + | // } |
| $elements[$x] .= $separator; // CSV-Trenner setzen | $elements[$x] .= $separator; // CSV-Trenner setzen | ||
| Line 175: | Line 174: | ||
| \\ | \\ | ||
| - | Es ist ratsam die Originaldatei vor dem Hack umzubenennen nach z.B. **act_export_org.php** und die gepatchte Datei nochmals abzulegen unter z.B. **act_export_patch.php**. | + | It is advisable to rename the original file to **example act_export_org.php** before doing the hack. Store the modified file e.g. under the name **act_export_patch.php**. |
| - | Das ist hilfreich bei einem Update des Systems, bei dem die jetzt gepatchte Datei **act_export.php** u.U. überschrieben wird. | + | |
| + | This is useful when updating the system and the patched file **act_export.php** is overwritten. | ||
| - | So kann nach einem Update leicht dieser Hack wieder eingesetzt werden. | + | After an update this hack can be used again quite simple. |
| \\ | \\ | ||