Refactor result
This commit is contained in:
parent
5c64f76c81
commit
9e2e8dadce
|
@ -95,15 +95,15 @@ function create_header($cfg, $body) {
|
|||
$header = str_replace("%t", $body->event_title, $cfg["export"]["header"]);
|
||||
$header = str_replace("%d", date("Y-m-d"), $header);
|
||||
$header = str_replace("%r", $body->vote_round, $header);
|
||||
$header = "\n\n" . $header .
|
||||
"\n\nAbstimm-ID | Stimme(n)" .
|
||||
"\n###############################################################################\n";
|
||||
return $header;
|
||||
}
|
||||
|
||||
function create_text_file($cfg, $body) {
|
||||
$file_path = $cfg["export"]["path"] . "/" . date('Y-m-d') . "__" . str_replace(" ", "_", $body->event_title) . "__" . $body->vote_round . ".txt";
|
||||
$header = "\n\n" . create_header($cfg, $body) .
|
||||
"\n\nAbstimm-ID | Stimme(n)" .
|
||||
"\n###############################################################################\n";
|
||||
file_put_contents($file_path, $header);
|
||||
file_put_contents($file_path, create_header($cfg, $body));
|
||||
foreach ($body->votes as $vote) {
|
||||
$line = $vote->hash . " | " . implode(", ", $vote->vote) . "\n";
|
||||
file_put_contents($file_path, $line, FILE_APPEND);
|
||||
|
|
Loading…
Reference in a new issue