2016-05-22 14:11:30 -05:00
|
|
|
<?php
|
2016-08-05 23:21:25 -05:00
|
|
|
/**
|
|
|
|
* ImportController.php
|
|
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
|
|
*
|
2016-10-04 23:52:15 -05:00
|
|
|
* This software may be modified and distributed under the terms of the
|
|
|
|
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
|
|
*
|
|
|
|
* See the LICENSE file for details.
|
2016-08-05 23:21:25 -05:00
|
|
|
*/
|
2017-03-24 09:15:12 -05:00
|
|
|
declare(strict_types=1);
|
2016-05-22 14:11:30 -05:00
|
|
|
|
|
|
|
namespace FireflyIII\Http\Controllers;
|
|
|
|
|
2016-06-10 14:00:00 -05:00
|
|
|
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
2016-05-22 14:11:30 -05:00
|
|
|
use View;
|
|
|
|
|
|
|
|
/**
|
2017-06-23 22:49:33 -05:00
|
|
|
* Class ImportController.
|
2016-05-22 14:11:30 -05:00
|
|
|
*
|
|
|
|
* @package FireflyIII\Http\Controllers
|
|
|
|
*/
|
|
|
|
class ImportController extends Controller
|
|
|
|
{
|
2017-06-23 22:49:33 -05:00
|
|
|
/** @var ImportJobRepositoryInterface */
|
|
|
|
public $repository;
|
|
|
|
|
2016-05-22 14:11:30 -05:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
2016-10-29 00:44:46 -05:00
|
|
|
|
|
|
|
$this->middleware(
|
|
|
|
function ($request, $next) {
|
|
|
|
View::share('mainTitleIcon', 'fa-archive');
|
2017-06-23 23:57:24 -05:00
|
|
|
View::share('title', trans('firefly.import_index_title'));
|
2017-06-23 22:49:33 -05:00
|
|
|
$this->repository = app(ImportJobRepositoryInterface::class);
|
2016-10-29 00:44:46 -05:00
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
);
|
2016-05-22 14:11:30 -05:00
|
|
|
}
|
|
|
|
|
2016-07-02 16:08:47 -05:00
|
|
|
|
|
|
|
/**
|
2017-08-04 08:56:14 -05:00
|
|
|
* General import index
|
2016-06-24 07:24:34 -05:00
|
|
|
*
|
2016-07-23 14:37:06 -05:00
|
|
|
* @return View
|
2016-05-22 14:11:30 -05:00
|
|
|
*/
|
|
|
|
public function index()
|
|
|
|
{
|
2017-06-23 23:57:24 -05:00
|
|
|
$subTitle = trans('firefly.import_index_sub_title');
|
2016-05-22 14:11:30 -05:00
|
|
|
$subTitleIcon = 'fa-home';
|
|
|
|
$importFileTypes = [];
|
|
|
|
$defaultImportType = config('firefly.default_import_format');
|
|
|
|
|
|
|
|
foreach (array_keys(config('firefly.import_formats')) as $type) {
|
|
|
|
$importFileTypes[$type] = trans('firefly.import_file_type_' . $type);
|
|
|
|
}
|
|
|
|
|
|
|
|
return view('import.index', compact('subTitle', 'subTitleIcon', 'importFileTypes', 'defaultImportType'));
|
|
|
|
}
|
2016-06-10 14:00:00 -05:00
|
|
|
|
2016-05-22 14:11:30 -05:00
|
|
|
}
|