2016-05-22 21:11:30 +02:00
|
|
|
<?php
|
2016-08-06 06:21:25 +02:00
|
|
|
/**
|
|
|
|
* ImportController.php
|
|
|
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
|
|
*
|
2016-10-05 06:52:15 +02: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-06 06:21:25 +02:00
|
|
|
*/
|
2017-03-24 15:15:12 +01:00
|
|
|
declare(strict_types=1);
|
2016-05-22 21:11:30 +02:00
|
|
|
|
|
|
|
namespace FireflyIII\Http\Controllers;
|
|
|
|
|
2016-06-10 21:00:00 +02:00
|
|
|
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
2016-05-22 21:11:30 +02:00
|
|
|
use View;
|
|
|
|
|
|
|
|
/**
|
2017-06-24 05:49:33 +02:00
|
|
|
* Class ImportController.
|
2016-05-22 21:11:30 +02:00
|
|
|
*
|
|
|
|
* @package FireflyIII\Http\Controllers
|
|
|
|
*/
|
|
|
|
class ImportController extends Controller
|
|
|
|
{
|
2017-06-24 05:49:33 +02:00
|
|
|
/** @var ImportJobRepositoryInterface */
|
|
|
|
public $repository;
|
|
|
|
|
2016-05-22 21:11:30 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
2016-10-29 07:44:46 +02:00
|
|
|
|
|
|
|
$this->middleware(
|
|
|
|
function ($request, $next) {
|
|
|
|
View::share('mainTitleIcon', 'fa-archive');
|
2017-06-24 06:57:24 +02:00
|
|
|
View::share('title', trans('firefly.import_index_title'));
|
2017-06-24 05:49:33 +02:00
|
|
|
$this->repository = app(ImportJobRepositoryInterface::class);
|
2016-10-29 07:44:46 +02:00
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
);
|
2016-05-22 21:11:30 +02:00
|
|
|
}
|
|
|
|
|
2016-07-02 23:08:47 +02:00
|
|
|
|
|
|
|
/**
|
2017-08-04 15:56:14 +02:00
|
|
|
* General import index
|
2016-06-24 14:24:34 +02:00
|
|
|
*
|
2016-07-23 21:37:06 +02:00
|
|
|
* @return View
|
2016-05-22 21:11:30 +02:00
|
|
|
*/
|
|
|
|
public function index()
|
|
|
|
{
|
2017-06-24 06:57:24 +02:00
|
|
|
$subTitle = trans('firefly.import_index_sub_title');
|
2016-05-22 21:11:30 +02: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 21:00:00 +02:00
|
|
|
|
2016-05-22 21:11:30 +02:00
|
|
|
}
|