Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Constantine
authored and
Constantine
committed
Mar 22, 2012
1 parent
a2bcd7e
commit c536eff
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace Rooty\UserBundle\Form\Type; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\FormBuilder; | ||
use Rooty\UserBundle\Entity\User; | ||
|
||
class QuickAdminFormType extends AbstractType | ||
{ | ||
|
||
public function buildForm(FormBuilder $builder, array $options) | ||
{ | ||
$builder | ||
->add('roles', 'choice', array ( | ||
'choices' => array( 'ROLE_USER' => 'Пользователь', | ||
'ROLE_SUPERUSER' => 'Суперпользователь', | ||
'ROLE_UPLOADER' => 'Аплоадер', | ||
'ROLE_SUPERUPLOADER' => 'Супераплоадер', | ||
'ROLE_MODERATOR_GAMES' => 'Модератор раздела игр', | ||
'ROLE_MODERATOR_MOVIES' => 'Модератор раздела фильмов', | ||
'ROLE_SUPER_MODERATOR' => 'Супермодератор', | ||
'ROLE_ADMIN' => 'Администратор', | ||
'ROLE_SUPER_ADMIN' => 'СисОп', | ||
), | ||
'label' => 'Роли пользователя:', | ||
'multiple' => true, | ||
'expanded' => true, | ||
'empty_value' => false, | ||
'required' => false, | ||
'help_block' => 'Роли наследуются по возрастанию', | ||
)) | ||
->add('is_gold', 'choice', array ( | ||
'choices' => array('1' => 'Да', '0' => 'Нет'), | ||
'label' => 'Золотой:', | ||
'empty_value' => false, | ||
'required' => false, | ||
'help_block' => 'Даунлоад золотого пользователя не учитывается', | ||
)) | ||
->add('locked', 'choice', array ( | ||
'choices' => array('1' => 'Да', '0' => 'Нет'), | ||
'label' => 'Заблокирован:', | ||
'empty_value' => false, | ||
'required' => false, | ||
)); | ||
} | ||
|
||
public function getName() | ||
{ | ||
return 'rooty_userbundle_quickadminformtype'; | ||
} | ||
|
||
public function getDefaultOptions(array $options) | ||
{ | ||
return array( | ||
'data_class' => 'Rooty\UserBundle\Entity\User', | ||
); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Rooty/UserBundle/Resources/views/User/quick_admin.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<form action="{{ path('user_admin_update', {'id': user.id}) }}" method="post" {{ form_enctype(admin_form) }} class="form-horizontal quick-admin__form"> | ||
{% form_theme admin_form 'MopaBootstrapBundle:Form:fields.html.twig' %} | ||
{{ form_row(admin_form.roles) }} | ||
{{ form_rest(admin_form) }} | ||
|
||
<div class="form-actions"> | ||
<button type="submit" class="btn btn-primary">Сохранить</button> | ||
<button type="reset" class="btn">Сброс</button> | ||
</div> | ||
</form> |