Add import form and templates

modifié:         core/lib/Thelia/Config/Resources/form.xml
	nouveau fichier: core/lib/Thelia/Form/ImportForm.php
	nouveau fichier: templates/backOffice/default/ajax/import-modal.html
	modifié:         templates/backOffice/default/import-page.html
	modifié:         templates/backOffice/default/import.html
This commit is contained in:
Benjamin Perche
2014-07-17 09:49:33 +02:00
parent 0c1169a686
commit af5d355e19
5 changed files with 159 additions and 25 deletions

View File

@@ -134,6 +134,7 @@
<form name="thelia.images-and-documents-cache.flush" class="Thelia\Form\Cache\ImagesAndDocumentsCacheFlushForm"/>
<form name="thelia.export" class="Thelia\Form\ExportForm" />
<form name="thelia.import" class="Thelia\Form\ImportForm" />
</forms>

View File

@@ -0,0 +1,60 @@
<?php
/*************************************************************************************/
/* This file is part of the Thelia package. */
/* */
/* Copyright (c) OpenStudio */
/* email : dev@thelia.net */
/* web : http://www.thelia.net */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace Thelia\Form;
use Thelia\Core\Translation\Translator;
/**
* Class ImportForm
* @package Thelia\Form
* @author Benjamin Perche <bperche@openstudio.fr>
*/
class ImportForm extends BaseForm
{
/**
*
* in this function you add all the fields you need for your Form.
* Form this you have to call add method on $this->formBuilder attribute :
*
* $this->formBuilder->add("name", "text")
* ->add("email", "email", array(
* "attr" => array(
* "class" => "field"
* ),
* "label" => "email",
* "constraints" => array(
* new \Symfony\Component\Validator\Constraints\NotBlank()
* )
* )
* )
* ->add('age', 'integer');
*
* @return null
*/
protected function buildForm()
{
$this->formBuilder->add("file_upload", "file", array(
"label" => Translator::getInstance()->trans("File to upload"),
"label_attr" => ["for" => "file_to_upload"],
"required" => true,
));
}
/**
* @return string the name of you form. This name must be unique
*/
public function getName()
{
return "thelia_import";
}
}