Skip to content

Commit

Permalink
Add forgotten user quickadmin form
Browse files Browse the repository at this point in the history
  • Loading branch information
Constantine authored and Constantine committed Mar 22, 2012
1 parent a2bcd7e commit c536eff
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
59 changes: 59 additions & 0 deletions src/Rooty/UserBundle/Form/Type/QuickAdminFormType.php
@@ -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 src/Rooty/UserBundle/Resources/views/User/quick_admin.html.twig
@@ -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>

0 comments on commit c536eff

Please sign in to comment.