diff options
| author | Frederic Guillot <fred@kanboard.net> | 2016-05-15 21:20:46 -0400 |
|---|---|---|
| committer | Frederic Guillot <fred@kanboard.net> | 2016-05-15 21:20:46 -0400 |
| commit | 20052c7dd295464c7782350628701675b1f07db7 (patch) | |
| tree | 5eb416262114feb864694ae05a3c04667f54f727 /app/Controller/UserImport.php | |
| parent | 4eaab1f6da1a56376a840231f7b8a10469308f97 (diff) | |
User import is now a popover
Diffstat (limited to 'app/Controller/UserImport.php')
| -rw-r--r-- | app/Controller/UserImport.php | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/app/Controller/UserImport.php b/app/Controller/UserImport.php deleted file mode 100644 index b99e56a0..00000000 --- a/app/Controller/UserImport.php +++ /dev/null @@ -1,66 +0,0 @@ -<?php - -namespace Kanboard\Controller; - -use Kanboard\Core\Csv; - -/** - * User Import controller - * - * @package controller - * @author Frederic Guillot - */ -class UserImport extends BaseController -{ - /** - * Upload the file and ask settings - * - */ - public function step1(array $values = array(), array $errors = array()) - { - $this->response->html($this->helper->layout->app('user_import/step1', array( - 'values' => $values, - 'errors' => $errors, - 'max_size' => ini_get('upload_max_filesize'), - 'delimiters' => Csv::getDelimiters(), - 'enclosures' => Csv::getEnclosures(), - 'title' => t('Import users from CSV file'), - ))); - } - - /** - * Process CSV file - * - */ - public function step2() - { - $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')))); - } - - $csv = new Csv($values['delimiter'], $values['enclosure']); - $csv->setColumnMapping($this->userImport->getColumnMapping()); - $csv->read($filename, array($this->userImport, 'import')); - - if ($this->userImport->counter > 0) { - $this->flash->success(t('%d user(s) have been imported successfully.', $this->userImport->counter)); - } else { - $this->flash->failure(t('Nothing have been imported!')); - } - - $this->response->redirect($this->helper->url->to('userImport', 'step1')); - } - - /** - * Generate template - * - */ - public function template() - { - $this->response->withDownload('users.csv'); - $this->response->csv(array($this->userImport->getColumnMapping())); - } -} |
