Setting admin profile creation (route, view, form)

This commit is contained in:
mespeche
2013-09-24 09:36:48 +02:00
parent 44dc4dbcc8
commit 1f54a288fc
5 changed files with 334 additions and 0 deletions

View File

@@ -106,6 +106,8 @@
<form name="thelia.admin.language.creation" class="Thelia\Form\LanguageCreationForm"/>
<form name="thelia.admin.admin-profile.creation" class="Thelia\Form\AdminProfileCreationForm"/>
</forms>

View File

@@ -545,6 +545,15 @@
<!-- end mailing system management -->
<!-- admin profiles management -->
<route id="admin.configuration.admin-profiles.default" path="/admin/configuration/admin_profiles">
<default key="_controller">Thelia\Controller\Admin\AdminProfileController::defaultAction</default>
</route>
<!-- end admin profiles management -->
<!-- The default route, to display a template -->
<route id="admin.processTemplate" path="/admin/{template}">

View File

@@ -0,0 +1,39 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Controller\Admin;
/**
* Class AdminProfileController
* @package Thelia\Controller\Admin
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class AdminProfileController extends BaseAdminController
{
public function defaultAction()
{
if (null !== $response = $this->checkAuth("admin.admin-profile.view")) return $response;
return $this->render("admin-profiles", array("display_admin_profile" => 20));
}
}

View File

@@ -0,0 +1,65 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Form;
use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraints\NotBlank;
use Thelia\Core\Translation\Translator;
class AdminProfileCreationForm extends BaseForm
{
protected function buildForm()
{
$this->formBuilder
->add("wording" , "text" , array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Wording *"),
"label_attr" => array(
"for" => "wording"
))
)
->add("name" , "text" , array(
"constraints" => array(
new NotBlank()
),
"label" => Translator::getInstance()->trans("Name *"),
"label_attr" => array(
"for" => "name"
))
)
->add("description" , "text" , array(
"label" => Translator::getInstance()->trans("Description"),
"label_attr" => array(
"for" => "description"
))
)
;
}
public function getName()
{
return "thelia_admin_profile_creation";
}
}