Files
Phraseanet/lib/Alchemy/Phrasea/Core/Provider/RegistrationServiceProvider.php
Nicolas Le Goff 2899f152fb Merge branch '3.8' into fix-latest-merge
Conflicts:
	README.md
	composer.json
	composer.lock
	config/configuration.sample.yml
	lib/Alchemy/Phrasea/Application/Api.php
	lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php
	lib/Alchemy/Phrasea/Controller/Api/Oauth2.php
	lib/Alchemy/Phrasea/Controller/Prod/Basket.php
	lib/Alchemy/Phrasea/Core/Event/Subscriber/ApiExceptionHandlerSubscriber.php
	lib/Alchemy/Phrasea/Core/Provider/RegistrationServiceProvider.php
	lib/Alchemy/Phrasea/Core/Version.php
	lib/classes/API/V1/adapter.php
	lib/classes/API/V1/result.php
	lib/classes/module/console/schedulerStart.php
	lib/classes/module/console/schedulerState.php
	lib/classes/module/console/schedulerStop.php
	lib/classes/module/console/taskrun.php
	lib/classes/set/export.php
	lib/conf.d/_GV_template.inc
	lib/conf.d/configuration.yml
	templates/web/admin/setup.html.twig
	templates/web/admin/tasks/list.html.twig
	templates/web/api/auth/end_user_authorization.html.twig
	templates/web/prod/actions/Feedback/list.html.twig
	templates/web/prod/actions/publish/publish.html.twig
	templates/web/prod/upload/upload.html.twig
	tests/classes/api/v1/api_v1_adapterTest.php
	tests/classes/api/v1/api_v1_resultTest.php
2014-08-11 20:28:03 +02:00

132 lines
4.6 KiB
PHP

<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Provider;
use Alchemy\Phrasea\Form\Constraint\NewLogin;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Core\Configuration\RegistrationManager;
use Silex\Application;
use Silex\ServiceProviderInterface;
use Symfony\Component\Validator\Constraints as Assert;
class RegistrationServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
$app['registration.fields'] = $app->share(function (Application $app) {
return $app['conf']->get('registration-fields', []);
});
$app['registration.manager'] = $app->share(function (Application $app) {
return new RegistrationManager($app['phraseanet.appbox'], $app['repo.registrations'], $app['locale']);
});
$app['registration.optional-fields'] = $app->share(function (Application $app) {
return [
'login'=> [
'label' => 'admin::compte-utilisateur identifiant',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
NewLogin::create($app),
]
],
'gender' => [
'label' => 'admin::compte-utilisateur sexe',
'type' => 'choice',
'multiple' => false,
'expanded' => false,
'choices' => [
User::GENDER_MISS => 'admin::compte-utilisateur:sexe: mademoiselle',
User::GENDER_MRS => 'admin::compte-utilisateur:sexe: madame',
User::GENDER_MR => 'admin::compte-utilisateur:sexe: monsieur',
]
],
'firstname' => [
'label' => 'admin::compte-utilisateur prenom',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'lastname' => [
'label' => 'admin::compte-utilisateur nom',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'address' => [
'label' => 'admin::compte-utilisateur adresse',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'zipcode' => [
'label' => 'admin::compte-utilisateur code postal',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'geonameid' => [
'label' => 'admin::compte-utilisateur ville',
'type' => new \Alchemy\Phrasea\Form\Type\GeonameType(),
'constraints' => [
new Assert\NotBlank(),
]
],
'job' => [
'label' => 'admin::compte-utilisateur poste',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'company' => [
'label' => 'admin::compte-utilisateur societe',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'position' => [
'label' => 'admin::compte-utilisateur activite',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'tel' => [
'label' => 'admin::compte-utilisateur tel',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
'fax' => [
'label' => 'admin::compte-utilisateur fax',
'type' => 'text',
'constraints' => [
new Assert\NotBlank(),
]
],
];
});
}
public function boot(Application $app)
{
}
}