{"action":"created","comment":{"url":"https://api.github.com/repos/abrain/einsatzverwaltung/pulls/comments/172299282","pull_request_review_id":101293047,"id":172299282,"diff_hunk":"@@ -0,0 +1,168 @@\n+<?php\n+namespace abrain\\Einsatzverwaltung\\Export\\Formats;\n+\n+use abrain\\Einsatzverwaltung\\Model\\IncidentReport;\n+use abrain\\Einsatzverwaltung\\Data;\n+\n+/**\n+ * Exportiert Einsatzberichte in eine CSV-Datei.\n+ */\n+class Csv extends AbstractFormat\n+{\n+    /**\n+     * @var string\n+     */\n+    protected $delimiter;\n+\n+    /**\n+     * @var string\n+     */\n+    protected $enclosure;\n+\n+    /**\n+     * @var string\n+     */\n+    protected $escapeChar;\n+\n+    /**\n+     * @var boolean\n+     */\n+    protected $headers;\n+\n+    /**\n+     * @inheritDoc\n+     */\n+    public function getTitle()\n+    {\n+        return 'CSV';\n+    }\n+\n+    /**\n+     * @inheritDoc\n+     */\n+    public function renderOptions()\n+    {\n+        ?>\n+        <li>\n+            <label>\n+                <span class=\"label-responsive\">Spalten getrennt mit:</span>\n+                <input name=\"export_options[csv][delimiter]\" type=\"text\" value=\",\" required=\"required\">\n+            </label>\n+        </li>\n+        <li>\n+            <label>\n+                <span class=\"label-responsive\">Spalten eingeschlossen von:</span>\n+                <input name=\"export_options[csv][enclosure]\" type=\"text\" value=\"&quot;\" required=\"required\">\n+            </label>\n+        </li>\n+        <li>\n+            <label>\n+                <span class=\"label-responsive\">Spalten escaped mit:</span>\n+                <input name=\"export_options[csv][escapeChar]\" type=\"text\" value=\";\" required=\"required\">\n+            </label>\n+        </li>\n+        <li>\n+            <input type=\"checkbox\" name=\"export_options[csv][headers]\" id=\"csv_headers\" value=\"1\" checked=\"checked\">\n+            <label for=\"csv_headers\">Spaltennamen in die erste Zeile setzen</label>\n+        </li>\n+<?php\n+    }\n+\n+    /**\n+     * @inheritDoc\n+     */\n+    public function setOptions(array $options)\n+    {\n+        $this->delimiter = @$options['delimiter'];\n+        if (empty($this->delimiter)) {\n+            $this->delimiter = ',';\n+        }\n+        $this->enclosure = @$options['enclosure'];\n+        if (empty($this->enclosure)) {\n+            $this->enclosure = '\"';\n+        }\n+        $this->escapeChar = @$options['escapeChar'];\n+        if (empty($this->escapeChar)) {\n+            $this->escapeChar = '\\\\';\n+        }\n+        $this->headers = (boolean)@$options['headers'];\n+    }\n+\n+    /**\n+     * @inheritDoc\n+     */\n+    public function getFilename()\n+    {\n+        return 'Einsatzberichte.csv';\n+    }\n+\n+    /**\n+     * @inheritDoc\n+     */\n+    public function export()\n+    {\n+        $handle = fopen('php://output', 'w');\n+        // füge BOM hinzu, damit UTF-8-formatierte Inhalte in Excel funktionieren.\n+        // siehe: http://php.net/manual/de/function.fputcsv.php#118252\n+        fputs($handle, chr(0xEF) . chr(0xBB) . chr(0xBF));\n+\n+        // füge ggf. Spaltennamen als die erste Zeile ein\n+        if ($this->headers) {\n+            $data = array(\n+                'Einsatznummer',\n+                'Alarmierungsart',\n+                'Alarmzeit',\n+                'Einsatzende',\n+                'Dauer (Minuten)',\n+                'Einsatzort',\n+                'Einsatzart',\n+                'Fahrzeuge',\n+                'Externe Einsatzmittel',\n+                'Mannschaftsstärke',\n+                'Einsatzleiter',\n+                'Berichtstitel',\n+                'Berichtstext',\n+                'Besonderer Einsatz',\n+                'Fehlalarm'\n+            );\n+            fputcsv($handle, $data, $this->delimiter, $this->enclosure, $this->escapeChar);\n+        }\n+\n+        $query = $this->getQuery();\n+        while ($query->have_posts()) {\n+            $post = $query->next_post();\n+            $report = new IncidentReport($post);\n+            \n+            $duration = Data::getDauer($report);\n+            if (!$duration) {\n+                $duration = 0;\n+            }\n+\n+            $typeOfIncident = $report->getTypeOfIncident();\n+            if (!$typeOfIncident) {","path":"src/Export/Formats/Csv.php","position":null,"original_position":142,"commit_id":"9e55c8a6396da94433cc39a1875ba906cf7a2ed5","original_commit_id":"9fa8f6332810a8d6656917525991269a06f3fe13","user":{"login":"heikobornholdt","id":789788,"avatar_url":"https://avatars3.githubusercontent.com/u/789788?v=4","gravatar_id":"","url":"https://api.github.com/users/heikobornholdt","html_url":"https://github.com/heikobornholdt","followers_url":"https://api.github.com/users/heikobornholdt/followers","following_url":"https://api.github.com/users/heikobornholdt/following{/other_user}","gists_url":"https://api.github.com/users/heikobornholdt/gists{/gist_id}","starred_url":"https://api.github.com/users/heikobornholdt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heikobornholdt/subscriptions","organizations_url":"https://api.github.com/users/heikobornholdt/orgs","repos_url":"https://api.github.com/users/heikobornholdt/repos","events_url":"https://api.github.com/users/heikobornholdt/events{/privacy}","received_events_url":"https://api.github.com/users/heikobornholdt/received_events","type":"User","site_admin":false},"body":"https://github.com/abrain/einsatzverwaltung/pull/132/commits/9e55c8a6396da94433cc39a1875ba906cf7a2ed5","created_at":"2018-03-05T19:23:27Z","updated_at":"2018-03-05T19:23:27Z","html_url":"https://github.com/abrain/einsatzverwaltung/pull/132#discussion_r172299282","pull_request_url":"https://api.github.com/repos/abrain/einsatzverwaltung/pulls/132","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/abrain/einsatzverwaltung/pulls/comments/172299282"},"html":{"href":"https://github.com/abrain/einsatzverwaltung/pull/132#discussion_r172299282"},"pull_request":{"href":"https://api.github.com/repos/abrain/einsatzverwaltung/pulls/132"}},"in_reply_to_id":162791279},"pull_request":{"url":"https://api.github.com/repos/abrain/einsatzverwaltung/pulls/132","id":126111638,"html_url":"https://github.com/abrain/einsatzverwaltung/pull/132","diff_url":"https://github.com/abrain/einsatzverwaltung/pull/132.diff","patch_url":"https://github.com/abrain/einsatzverwaltung/pull/132.patch","issue_url":"https://api.github.com/repos/abrain/einsatzverwaltung/issues/132","number":132,"state":"open","locked":false,"title":"Export von Einsatzberichten","user":{"login":"heikobornholdt","id":789788,"avatar_url":"https://avatars3.githubusercontent.com/u/789788?v=4","gravatar_id":"","url":"https://api.github.com/users/heikobornholdt","html_url":"https://github.com/heikobornholdt","followers_url":"https://api.github.com/users/heikobornholdt/followers","following_url":"https://api.github.com/users/heikobornholdt/following{/other_user}","gists_url":"https://api.github.com/users/heikobornholdt/gists{/gist_id}","starred_url":"https://api.github.com/users/heikobornholdt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heikobornholdt/subscriptions","organizations_url":"https://api.github.com/users/heikobornholdt/orgs","repos_url":"https://api.github.com/users/heikobornholdt/repos","events_url":"https://api.github.com/users/heikobornholdt/events{/privacy}","received_events_url":"https://api.github.com/users/heikobornholdt/received_events","type":"User","site_admin":false},"body":"Closes #63\r\nCloses #64 ","created_at":"2017-06-16T20:43:18Z","updated_at":"2018-03-05T19:23:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8251a53be480c7813b247214c8e94d3fbc0a4b46","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/abrain/einsatzverwaltung/pulls/132/commits","review_comments_url":"https://api.github.com/repos/abrain/einsatzverwaltung/pulls/132/comments","review_comment_url":"https://api.github.com/repos/abrain/einsatzverwaltung/pulls/comments{/number}","comments_url":"https://api.github.com/repos/abrain/einsatzverwaltung/issues/132/comments","statuses_url":"https://api.github.com/repos/abrain/einsatzverwaltung/statuses/9e55c8a6396da94433cc39a1875ba906cf7a2ed5","head":{"label":"heikobornholdt:63-export","ref":"63-export","sha":"9e55c8a6396da94433cc39a1875ba906cf7a2ed5","user":{"login":"heikobornholdt","id":789788,"avatar_url":"https://avatars3.githubusercontent.com/u/789788?v=4","gravatar_id":"","url":"https://api.github.com/users/heikobornholdt","html_url":"https://github.com/heikobornholdt","followers_url":"https://api.github.com/users/heikobornholdt/followers","following_url":"https://api.github.com/users/heikobornholdt/following{/other_user}","gists_url":"https://api.github.com/users/heikobornholdt/gists{/gist_id}","starred_url":"https://api.github.com/users/heikobornholdt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heikobornholdt/subscriptions","organizations_url":"https://api.github.com/users/heikobornholdt/orgs","repos_url":"https://api.github.com/users/heikobornholdt/repos","events_url":"https://api.github.com/users/heikobornholdt/events{/privacy}","received_events_url":"https://api.github.com/users/heikobornholdt/received_events","type":"User","site_admin":false},"repo":{"id":92877343,"name":"einsatzverwaltung","full_name":"heikobornholdt/einsatzverwaltung","owner":{"login":"heikobornholdt","id":789788,"avatar_url":"https://avatars3.githubusercontent.com/u/789788?v=4","gravatar_id":"","url":"https://api.github.com/users/heikobornholdt","html_url":"https://github.com/heikobornholdt","followers_url":"https://api.github.com/users/heikobornholdt/followers","following_url":"https://api.github.com/users/heikobornholdt/following{/other_user}","gists_url":"https://api.github.com/users/heikobornholdt/gists{/gist_id}","starred_url":"https://api.github.com/users/heikobornholdt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/heikobornholdt/subscriptions","organizations_url":"https://api.github.com/users/heikobornholdt/orgs","repos_url":"https://api.github.com/users/heikobornholdt/repos","events_url":"https://api.github.com/users/heikobornholdt/events{/privacy}","received_events_url":"https://api.github.com/users/heikobornholdt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/heikobornholdt/einsatzverwaltung","description":"Wordpress-Plugin zur Verwaltung und Darstellung von Einsatzberichten der Feuerwehr und anderer Hilfsorganisationen","fork":true,"url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung","forks_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/forks","keys_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/keys{/key_id}","collaborators_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/teams","hooks_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/hooks","issue_events_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/issues/events{/number}","events_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/events","assignees_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/assignees{/user}","branches_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/branches{/branch}","tags_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/tags","blobs_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/git/refs{/sha}","trees_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/git/trees{/sha}","statuses_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/statuses/{sha}","languages_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/languages","stargazers_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/stargazers","contributors_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/contributors","subscribers_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/subscribers","subscription_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/subscription","commits_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/commits{/sha}","git_commits_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/git/commits{/sha}","comments_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/comments{/number}","issue_comment_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/issues/comments{/number}","contents_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/contents/{+path}","compare_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/compare/{base}...{head}","merges_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/merges","archive_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/downloads","issues_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/issues{/number}","pulls_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/pulls{/number}","milestones_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/milestones{/number}","notifications_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/labels{/name}","releases_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/releases{/id}","deployments_url":"https://api.github.com/repos/heikobornholdt/einsatzverwaltung/deployments","created_at":"2017-05-30T21:22:37Z","updated_at":"2017-05-30T21:22:39Z","pushed_at":"2018-03-05T19:22:54Z","git_url":"git://github.com/heikobornholdt/einsatzverwaltung.git","ssh_url":"git@github.com:heikobornholdt/einsatzverwaltung.git","clone_url":"https://github.com/heikobornholdt/einsatzverwaltung.git","svn_url":"https://github.com/heikobornholdt/einsatzverwaltung","homepage":"https://einsatzverwaltung.abrain.de","size":1245,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"abrain:develop","ref":"develop","sha":"c6079c9c3423418c7e1ce2213e6657c680cdc5e5","user":{"login":"abrain","id":1263052,"avatar_url":"https://avatars0.githubusercontent.com/u/1263052?v=4","gravatar_id":"","url":"https://api.github.com/users/abrain","html_url":"https://github.com/abrain","followers_url":"https://api.github.com/users/abrain/followers","following_url":"https://api.github.com/users/abrain/following{/other_user}","gists_url":"https://api.github.com/users/abrain/gists{/gist_id}","starred_url":"https://api.github.com/users/abrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abrain/subscriptions","organizations_url":"https://api.github.com/users/abrain/orgs","repos_url":"https://api.github.com/users/abrain/repos","events_url":"https://api.github.com/users/abrain/events{/privacy}","received_events_url":"https://api.github.com/users/abrain/received_events","type":"User","site_admin":false},"repo":{"id":16840112,"name":"einsatzverwaltung","full_name":"abrain/einsatzverwaltung","owner":{"login":"abrain","id":1263052,"avatar_url":"https://avatars0.githubusercontent.com/u/1263052?v=4","gravatar_id":"","url":"https://api.github.com/users/abrain","html_url":"https://github.com/abrain","followers_url":"https://api.github.com/users/abrain/followers","following_url":"https://api.github.com/users/abrain/following{/other_user}","gists_url":"https://api.github.com/users/abrain/gists{/gist_id}","starred_url":"https://api.github.com/users/abrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abrain/subscriptions","organizations_url":"https://api.github.com/users/abrain/orgs","repos_url":"https://api.github.com/users/abrain/repos","events_url":"https://api.github.com/users/abrain/events{/privacy}","received_events_url":"https://api.github.com/users/abrain/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abrain/einsatzverwaltung","description":"Wordpress-Plugin zur Verwaltung und Darstellung von Einsatzberichten der Feuerwehr und anderer Hilfsorganisationen","fork":false,"url":"https://api.github.com/repos/abrain/einsatzverwaltung","forks_url":"https://api.github.com/repos/abrain/einsatzverwaltung/forks","keys_url":"https://api.github.com/repos/abrain/einsatzverwaltung/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abrain/einsatzverwaltung/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abrain/einsatzverwaltung/teams","hooks_url":"https://api.github.com/repos/abrain/einsatzverwaltung/hooks","issue_events_url":"https://api.github.com/repos/abrain/einsatzverwaltung/issues/events{/number}","events_url":"https://api.github.com/repos/abrain/einsatzverwaltung/events","assignees_url":"https://api.github.com/repos/abrain/einsatzverwaltung/assignees{/user}","branches_url":"https://api.github.com/repos/abrain/einsatzverwaltung/branches{/branch}","tags_url":"https://api.github.com/repos/abrain/einsatzverwaltung/tags","blobs_url":"https://api.github.com/repos/abrain/einsatzverwaltung/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abrain/einsatzverwaltung/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abrain/einsatzverwaltung/git/refs{/sha}","trees_url":"https://api.github.com/repos/abrain/einsatzverwaltung/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abrain/einsatzverwaltung/statuses/{sha}","languages_url":"https://api.github.com/repos/abrain/einsatzverwaltung/languages","stargazers_url":"https://api.github.com/repos/abrain/einsatzverwaltung/stargazers","contributors_url":"https://api.github.com/repos/abrain/einsatzverwaltung/contributors","subscribers_url":"https://api.github.com/repos/abrain/einsatzverwaltung/subscribers","subscription_url":"https://api.github.com/repos/abrain/einsatzverwaltung/subscription","commits_url":"https://api.github.com/repos/abrain/einsatzverwaltung/commits{/sha}","git_commits_url":"https://api.github.com/repos/abrain/einsatzverwaltung/git/commits{/sha}","comments_url":"https://api.github.com/repos/abrain/einsatzverwaltung/comments{/number}","issue_comment_url":"https://api.github.com/repos/abrain/einsatzverwaltung/issues/comments{/number}","contents_url":"https://api.github.com/repos/abrain/einsatzverwaltung/contents/{+path}","compare_url":"https://api.github.com/repos/abrain/einsatzverwaltung/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abrain/einsatzverwaltung/merges","archive_url":"https://api.github.com/repos/abrain/einsatzverwaltung/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abrain/einsatzverwaltung/downloads","issues_url":"https://api.github.com/repos/abrain/einsatzverwaltung/issues{/number}","pulls_url":"https://api.github.com/repos/abrain/einsatzverwaltung/pulls{/number}","milestones_url":"https://api.github.com/repos/abrain/einsatzverwaltung/milestones{/number}","notifications_url":"https://api.github.com/repos/abrain/einsatzverwaltung/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abrain/einsatzverwaltung/labels{/name}","releases_url":"https://api.github.com/repos/abrain/einsatzverwaltung/releases{/id}","deployments_url":"https://api.github.com/repos/abrain/einsatzverwaltung/deployments","created_at":"2014-02-14T14:55:50Z","updated_at":"2018-01-14T08:53:55Z","pushed_at":"2018-03-05T19:22:55Z","git_url":"git://github.com/abrain/einsatzverwaltung.git","ssh_url":"git@github.com:abrain/einsatzverwaltung.git","clone_url":"https://github.com/abrain/einsatzverwaltung.git","svn_url":"https://github.com/abrain/einsatzverwaltung","homepage":"https://einsatzverwaltung.abrain.de","size":1226,"stargazers_count":20,"watchers_count":20,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":40,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":7,"open_issues":40,"watchers":20,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/abrain/einsatzverwaltung/pulls/132"},"html":{"href":"https://github.com/abrain/einsatzverwaltung/pull/132"},"issue":{"href":"https://api.github.com/repos/abrain/einsatzverwaltung/issues/132"},"comments":{"href":"https://api.github.com/repos/abrain/einsatzverwaltung/issues/132/comments"},"review_comments":{"href":"https://api.github.com/repos/abrain/einsatzverwaltung/pulls/132/comments"},"review_comment":{"href":"https://api.github.com/repos/abrain/einsatzverwaltung/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/abrain/einsatzverwaltung/pulls/132/commits"},"statuses":{"href":"https://api.github.com/repos/abrain/einsatzverwaltung/statuses/9e55c8a6396da94433cc39a1875ba906cf7a2ed5"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"heikobornholdt"}}