TangoMan List Manager provides an easy way to manage searchable, ordered, paginated lists in your app. TangoMan List Manager makes building back-office for your app a brease.
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require tangoman/list-manager-bundleThis command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php file of your project:
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
// ...
public function registerBundles()
{
$bundles = array(
// ...
new TangoMan\ListManagerBundle\TangoManListManagerBundle(),
);
// ...
}
}use TangoMan\ListManagerBundle\Model\SearchForm;
use TangoMan\ListManagerBundle\Model\SearchInput;
use TangoMan\ListManagerBundle\Model\SearchOption;
use TangoMan\ListManagerBundle\Model\Thead;
use TangoMan\ListManagerBundle\Model\Item;<?php
// AppBundle/Controller/DefaultController.php
namespace AppBundle\Controller;
// ...
class DefaultController extends Controller
{
/**
* @Route("/user/index")
*/
public function indexAction()
{
// ...
$form = new SearchForm();
// Number
$input = new SearchInput();
$input->setLabel('Id')
->setName('e-id')
->setType('number');
$form->addInput($input);
// Text
$input = new SearchInput();
$input->setLabel('User')
->setName('user-username');
$form->addInput($input);
// Text
$input = new SearchInput();
$input->setLabel('Email')
->setName('user-email');
$form->addInput($input);
// Select
$input = new SearchInput();
$input->setLabel('Role')
->setName('roles-type');
$option = new SearchOption();
$option->setName('All');
$input->addOption($option);
$option = new SearchOption();
$option->setName('Super Admin')
->setValue('ROLE_SUPER_ADMIN');
$input->addOption($option);
$option = new SearchOption();
$option->setName('Admin')
->setValue('ROLE_ADMIN');
$input->addOption($option);
$option = new SearchOption();
$option->setName('Super Utilisateur')
->setValue('ROLE_SUPER_USER');
$input->addOption($option);
$option = new SearchOption();
$option->setName('Utilisateur')
->setValue('ROLE_USER');
$input->addOption($option);
$form->addInput($input);
// Submit
$input = new SearchInput();
$input->setLabel('Filtrer')
->setType('submit')
->setIcon('glyphicon glyphicon-search');
$form->addInput($input);
// Optionally use json format
$thead = '{
"tds": [
{
"name": "username",
"label": "User",
"route": "app_user_index"
},
{
"name": "email",
"label": "Email",
"route": "app_user_index"
},
{
"label": "Actions",
"roles": ["ROLE_ADMIN","ROLE_MANAGER"],
"colspan": 2
}
]
}';
return $this->render(
'user/index.html.twig',
[
'form' => $form,
'thead' => $thead,
'users' => $users,
]
);
}
}<div id="search-form" class="jumbotron">
{{ searchForm(form) }}
</div><table class="table table-striped">
{{ thead(thead) }}
<tbody>
{% for user in users %}
<tr>
<td>
...If you get to see this :
your json probably is invalid.
If you find any bug please report here : Issues
Copyrights (c) 2017 Matthias Morin
Distributed under the GPLv3.0 license.
If you like TangoMan List Manager please star! And follow me on GitHub: TangoMan75 ... And check my other cool projects.