File: D:/HostingSpaces/SBogers95/rentman.io/app/Komma/Kms/Transfer/TransferSection.php
<?php
namespace App\Komma\Kms\Transfer;
//The new object oriented attributes
use App\Helpers\KommaHelpers;
use App\Komma\Kms\Core\Attributes\Attribute;
use App\Komma\Kms\Core\Sections\NoLanguageTabsDirector;
use App\Komma\Kms\Core\Sections\Section;
use App\Komma\Kms\Core\Sections\SectionTabGroups;
use App\Komma\Kms\Core\Sections\SectionTabItem;
use App\Komma\Kms\Core\Sections\SectionTabsBuilder;
use App\Komma\Routes\RouteService;
use App\Komma\Sites\SiteServiceInterface;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\MessageBag;
class TransferSection extends Section
{
protected $title = 'Importeren';
protected $subtitle = 'All pages';
protected $slug = 'transfer';
protected $hasRoutes = true;
public $showSave = 'all';
public $showDelete = [];
public $showCreate = [];
/**
* PageSection constructor.
* @param TransferService $sectionService
* @param RouteService $routeService
* @param SiteServiceInterface $siteService
*/
// function __construct(Kms $kms, PageRepository $repository)
public function __construct(TransferService $sectionService, RouteService $routeService, SiteServiceInterface $siteService)
{
$this->title = ucfirst(__('kms/transfer.transfer'));
$this->subtitle = __('kms/transfer.transfersubtitle');
$sectionTabDirector = new NoLanguageTabsDirector(new SectionTabsBuilder());
parent::__construct($sectionService, $routeService, $siteService, $sectionTabDirector);
$this->submitButtonLabel = __('kms/transfer.transfer');
}
/**
* Generates the attributes for this section. They all must extend the App\Komma\Kms\Core\Attributes\Attribute class
* This is the place where you need to setup your sections appearance. Just make sure you build an array of attributes
* and put each attribute in a AbstractSectionTabItem with a SectionTabGroups constant to link them to a tab.
*
* @see PageRepository::saveModel()
* @return Collection A collection of SectionTabItems
*/
protected function generateAttributes(): Collection
{
// Note: The "attributes are hardcoded in transfer.blade.php because this method isn't giving is the right amount of flexibility right now"
//
// //*****************************************************************************************\\
// //*** Define attribute validation sets ***\\
// //*****************************************************************************************\\
// //*****************************************************************************************\\
// //*** Generate the attributes ***\\
// //*****************************************************************************************\\
//
// //****************************************************************************************************************************************\\
// //*** Put the all attributes in a SectionTabItem so we can track for which tab they are. And then put SectionTabItems in a Collection ***\\
// //****************************************************************************************************************************************\\
$tabItems = new Collection();
// foreach($attributes as $attribute) $tabItems->push(new SectionTabItem($attribute, SectionTabGroups::General));
// foreach($languageIndexedAttributes as $attribute) $tabItems->push(new SectionTabItem($attribute, SectionTabGroups::Languages));
//
return $tabItems;
}
/**
* Makes the view and returns it
*
* @return View
*/
protected function makeView(): View
{
$successes = (\Session::has('successes')) ? \Session::get('successes') : new MessageBag();
return \View::make('kms/section.transfer', [
'section' => $this,
'importRoute' => [
'route' => route('transfer.import'),
'method' => 'POST',
],
'exportRoute' => [
'route' => route('transfer.export'),
'method' => 'POST',
],
'importDocumentsRoute' => [
'route' => route('transfer.import_documents'),
'method' => 'POST',
],
'successes' => $successes,
'maxUploadSize' => KommaHelpers::fileUploadMaxSize(),
]);
}
public function getModelTitle()
{
return __('kms/transfer.transfer');
}
}