Application/Transfer/Import/Herrnhut/Frontend.php
<?php
namespace SPHERE\Application\Transfer\Import\Herrnhut;
use SPHERE\Common\Frontend\Form\Repository\Button\Primary;
use SPHERE\Common\Frontend\Form\Repository\Field\FileUpload;
use SPHERE\Common\Frontend\Form\Structure\Form;
use SPHERE\Common\Frontend\Form\Structure\FormColumn;
use SPHERE\Common\Frontend\Form\Structure\FormGroup;
use SPHERE\Common\Frontend\Form\Structure\FormRow;
use SPHERE\Common\Frontend\Icon\Repository\Exclamation;
use SPHERE\Common\Frontend\IFrontendInterface;
use SPHERE\Common\Frontend\Layout\Repository\Well;
use SPHERE\Common\Frontend\Layout\Structure\Layout;
use SPHERE\Common\Frontend\Layout\Structure\LayoutColumn;
use SPHERE\Common\Frontend\Layout\Structure\LayoutGroup;
use SPHERE\Common\Frontend\Layout\Structure\LayoutRow;
use SPHERE\Common\Frontend\Text\Repository\Warning;
use SPHERE\Common\Window\Stage;
use SPHERE\System\Extension\Extension;
/**
* Class Frontend
*
* @package SPHERE\Application\Transfer\Import\Herrnhut
*/
class Frontend extends Extension implements IFrontendInterface
{
/**
* @param null $File
*
* @return Stage
*
* @throws \MOC\V\Component\Document\Exception\DocumentTypeException
*/
public function frontendStudentImport($File = null)
{
$View = new Stage('Import Herrnhut', 'Schüler-Daten');
$View->setContent(
new Layout(
new LayoutGroup(
new LayoutRow(
new LayoutColumn(array(
new Well(
Herrnhut::useService()->createStudentsFromFile(new Form(
new FormGroup(
new FormRow(
new FormColumn(
new FileUpload('File', 'Datei auswählen', 'Datei auswählen', null,
array('showPreview' => false))
)
)
)
, new Primary('Hochladen')
), $File
)
,
new Warning('Erlaubte Dateitypen: Excel (XLS,XLSX)', new Exclamation())
)
))
)
)
)
);
return $View;
}
/**
* @param null $File
*
* @return Stage
*
* @throws \MOC\V\Component\Document\Exception\DocumentTypeException
*/
public function frontendFormerStudentImport($File = null)
{
$View = new Stage('Import Herrnhut', 'Ehemalige Schüler-Daten');
$View->setContent(
new Layout(
new LayoutGroup(
new LayoutRow(
new LayoutColumn(array(
new Well(
Herrnhut::useService()->createStudentsFromFile(new Form(
new FormGroup(
new FormRow(
new FormColumn(
new FileUpload('File', 'Datei auswählen', 'Datei auswählen', null,
array('showPreview' => false))
)
)
)
, new Primary('Hochladen')
), $File, true
)
,
new Warning('Erlaubte Dateitypen: Excel (XLS,XLSX)', new Exclamation())
)
))
)
)
)
);
return $View;
}
/**
* @param null $File
*
* @return Stage
*
* @throws \MOC\V\Component\Document\Exception\DocumentTypeException
*/
public function frontendPersonImport($File = null)
{
$View = new Stage('Import Herrnhut', 'Privatkontakte');
$View->setContent(
new Layout(
new LayoutGroup(
new LayoutRow(
new LayoutColumn(array(
new Well(
Herrnhut::useService()->createPersonsFromFile(new Form(
new FormGroup(
new FormRow(
new FormColumn(
new FileUpload('File', 'Datei auswählen', 'Datei auswählen', null,
array('showPreview' => false))
)
)
)
, new Primary('Hochladen')
), $File)
. new Warning(new Exclamation() . ' Erlaubte Dateitypen: Excel (XLS,XLSX)')
)
))
)
)
)
);
return $View;
}
/**
* @param null $File
*
* @return Stage
*
* @throws \MOC\V\Component\Document\Exception\DocumentTypeException
*/
public function frontendCompanyImport($File = null)
{
$View = new Stage('Import Herrnhut', 'Institutionen mit Ansprechpartnern');
$View->setContent(
new Layout(
new LayoutGroup(
new LayoutRow(
new LayoutColumn(array(
new Well(
Herrnhut::useService()->createCompaniesFromFile(new Form(
new FormGroup(
new FormRow(
new FormColumn(
new FileUpload('File', 'Datei auswählen', 'Datei auswählen', null,
array('showPreview' => false))
)
)
)
, new Primary('Hochladen')
), $File)
. new Warning(new Exclamation() . ' Erlaubte Dateitypen: Excel (XLS,XLSX)')
)
))
)
)
)
);
return $View;
}
}