diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-05-26 21:38:43 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-05-26 21:38:43 -0400 |
commit | 9ebbe3da56914c408327997cea4eb00db2f88e0c (patch) | |
tree | 92a40db64f958abff457add4aa643fc6154a05d3 /app/Controller/TaskImport.php | |
parent | 33dea152fc6b0c061b1f61060cc75710dd0ec236 (diff) |
Rename task controllers
Diffstat (limited to 'app/Controller/TaskImport.php')
-rw-r--r-- | app/Controller/TaskImport.php | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/app/Controller/TaskImport.php b/app/Controller/TaskImport.php deleted file mode 100644 index 5e37fb2f..00000000 --- a/app/Controller/TaskImport.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php - -namespace Kanboard\Controller; - -use Kanboard\Core\Csv; - -/** - * Task Import controller - * - * @package controller - * @author Frederic Guillot - */ -class TaskImport extends BaseController -{ - /** - * Upload the file and ask settings - * - * @param array $values - * @param array $errors - * @throws \Kanboard\Core\Controller\PageNotFoundException - */ - public function step1(array $values = array(), array $errors = array()) - { - $project = $this->getProject(); - - $this->response->html($this->helper->layout->project('task_import/step1', array( - 'project' => $project, - 'values' => $values, - 'errors' => $errors, - 'max_size' => ini_get('upload_max_filesize'), - 'delimiters' => Csv::getDelimiters(), - 'enclosures' => Csv::getEnclosures(), - 'title' => t('Import tasks from CSV file'), - ))); - } - - /** - * Process CSV file - * - */ - public function step2() - { - $project = $this->getProject(); - $values = $this->request->getValues(); - $filename = $this->request->getFilePath('file'); - - if (! file_exists($filename)) { - $this->step1($values, array('file' => array(t('Unable to read your file')))); - } - - $this->taskImport->projectId = $project['id']; - - $csv = new Csv($values['delimiter'], $values['enclosure']); - $csv->setColumnMapping($this->taskImport->getColumnMapping()); - $csv->read($filename, array($this->taskImport, 'import')); - - if ($this->taskImport->counter > 0) { - $this->flash->success(t('%d task(s) have been imported successfully.', $this->taskImport->counter)); - } else { - $this->flash->failure(t('Nothing have been imported!')); - } - - $this->response->redirect($this->helper->url->to('taskImport', 'step1', array('project_id' => $project['id']))); - } - - /** - * Generate template - * - */ - public function template() - { - $this->response->withFileDownload('tasks.csv'); - $this->response->csv(array($this->taskImport->getColumnMapping())); - } -} |