summaryrefslogtreecommitdiff
path: root/app/Controller/ExportController.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-01-08 15:31:33 -0500
committerFrederic Guillot <fred@kanboard.net>2017-01-08 15:31:33 -0500
commitca00b8cf532bd93419e3f4bc46f9dde5caa90eec (patch)
treec2c2ca9b795daed99b48d5c44841feb649dd1a56 /app/Controller/ExportController.php
parentb3a450bace8461fb7989d5406b9d9ec644d7df4a (diff)
Display project exports in modal box
Diffstat (limited to 'app/Controller/ExportController.php')
-rw-r--r--app/Controller/ExportController.php34
1 files changed, 18 insertions, 16 deletions
diff --git a/app/Controller/ExportController.php b/app/Controller/ExportController.php
index b7ac92aa..19f73a7c 100644
--- a/app/Controller/ExportController.php
+++ b/app/Controller/ExportController.php
@@ -24,27 +24,29 @@ class ExportController extends BaseController
private function common($model, $method, $filename, $action, $page_title)
{
$project = $this->getProject();
- $from = $this->request->getStringParam('from');
- $to = $this->request->getStringParam('to');
- if ($from && $to) {
- $data = $this->$model->$method($project['id'], $from, $to);
- $this->response->withFileDownload($filename.'.csv');
- $this->response->csv($data);
- } else {
+ if ($this->request->isPost()) {
+ $values = $this->request->getValues();
+ $from = empty($values['from']) ? '' : $values['from'];
+ $to = empty($values['to']) ? '' : $values['to'];
- $this->response->html($this->helper->layout->project('export/'.$action, array(
- 'values' => array(
- 'controller' => 'ExportController',
- 'action' => $action,
+ if ($from && $to) {
+ $data = $this->$model->$method($project['id'], $from, $to);
+ $this->response->withFileDownload($filename.'.csv');
+ $this->response->csv($data);
+ return;
+ }
+ } else {
+ $this->response->html($this->template->render('export/'.$action, array(
+ 'values' => array(
'project_id' => $project['id'],
- 'from' => $from,
- 'to' => $to,
+ 'from' => '',
+ 'to' => '',
),
- 'errors' => array(),
+ 'errors' => array(),
'project' => $project,
- 'title' => $page_title,
- ), 'export/sidebar'));
+ 'title' => $page_title,
+ )));
}
}