Setting admin profile creation (route, view, form)
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
|
||||
@@ -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}">
|
||||
|
||||
39
core/lib/Thelia/Controller/Admin/AdminProfileController.php
Normal file
39
core/lib/Thelia/Controller/Admin/AdminProfileController.php
Normal 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));
|
||||
}
|
||||
|
||||
}
|
||||
65
core/lib/Thelia/Form/AdminProfileCreationForm.php
Normal file
65
core/lib/Thelia/Form/AdminProfileCreationForm.php
Normal 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";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user