mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
Merge branch 'aside-activity-merging' into 'master'
Various improvements for aside activity See merge request Chill-Projet/chill-bundles!148
This commit is contained in:
commit
dcbac34b96
@ -10,7 +10,7 @@
|
|||||||
<php>
|
<php>
|
||||||
<ini name="error_reporting" value="-1" />
|
<ini name="error_reporting" value="-1" />
|
||||||
<server name="APP_ENV" value="test" force="true" />
|
<server name="APP_ENV" value="test" force="true" />
|
||||||
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
|
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
|
||||||
<server name="SHELL_VERBOSITY" value="-1" />
|
<server name="SHELL_VERBOSITY" value="-1" />
|
||||||
</php>
|
</php>
|
||||||
|
|
||||||
@ -31,6 +31,9 @@
|
|||||||
<!-- temporarily removed, the time to find a fix -->
|
<!-- temporarily removed, the time to find a fix -->
|
||||||
<exclude>src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php</exclude>
|
<exclude>src/Bundle/ChillPersonBundle/Tests/Controller/PersonDuplicateControllerViewTest.php</exclude>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
|
<testsuite name="AsideActivityBundle">
|
||||||
|
<directory suffix="Test.php">src/Bundle/ChillAsideActivityBundle/src/Tests/</directory>
|
||||||
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
|
||||||
<listeners>
|
<listeners>
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\Controller;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller for activity configuration
|
||||||
|
*
|
||||||
|
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||||
|
* @author Champs Libres <info@champs-libres.coop>
|
||||||
|
*/
|
||||||
|
class AdminController extends AbstractController
|
||||||
|
{
|
||||||
|
|
||||||
|
public function redirectToAdminIndexAction()
|
||||||
|
{
|
||||||
|
return $this->redirectToRoute('chill_main_admin_central');
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,41 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Chill\AsideActivityBundle\Controller;
|
namespace Chill\AsideActivityBundle\Controller;
|
||||||
|
|
||||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||||
|
use Doctrine\ORM\QueryBuilder;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||||
|
use Doctrine\Common\Collections\Criteria;
|
||||||
|
|
||||||
|
final class AsideActivityController extends CRUDController
|
||||||
/**
|
|
||||||
* Class AsideActivityBundle
|
|
||||||
*/
|
|
||||||
class AsideActivityController extends CRUDController
|
|
||||||
{
|
{
|
||||||
|
protected function buildQueryEntities(string $action, Request $request)
|
||||||
|
{
|
||||||
|
$qb = parent::buildQueryEntities($action, $request);
|
||||||
|
|
||||||
|
if ('index' === $action) {
|
||||||
|
$qb->andWhere($qb->expr()->eq('e.agent', ':user'));
|
||||||
|
$qb->setParameter('user', $this->getUser());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $qb;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function orderQuery(
|
||||||
|
string $action,
|
||||||
|
$query,
|
||||||
|
Request $request,
|
||||||
|
PaginatorInterface $paginator
|
||||||
|
) {
|
||||||
|
if ('index' === $action) {
|
||||||
|
return $query->orderBy('e.date', 'DESC');
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::orderQuery($action, $query, $request, $paginator);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Chill\AsideActivityBundle\Entity\AsideActivity;
|
||||||
|
use Chill\MainBundle\DataFixtures\ORM\LoadUsers;
|
||||||
|
use Chill\MainBundle\Repository\UserRepository;
|
||||||
|
use Doctrine\Bundle\FixturesBundle\Fixture;
|
||||||
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
|
||||||
|
class LoadAsideActivity extends Fixture implements DependentFixtureInterface
|
||||||
|
{
|
||||||
|
private UserRepository $userRepository;
|
||||||
|
|
||||||
|
public function __construct(UserRepository $userRepository)
|
||||||
|
{
|
||||||
|
$this->userRepository = $userRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDependencies(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
LoadUsers::class,
|
||||||
|
LoadAsideActivityCategory::class
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
$user = $this->userRepository->findOneBy(['username' => 'center a_social']);
|
||||||
|
|
||||||
|
for ($i = 0; $i < 50; $i++) {
|
||||||
|
$activity = new AsideActivity();
|
||||||
|
$activity
|
||||||
|
->setAgent($user)
|
||||||
|
->setCreatedAt(new \DateTimeImmutable('now'))
|
||||||
|
->setCreatedBy($user)
|
||||||
|
->setUpdatedAt(new \DateTimeImmutable('now'))
|
||||||
|
->setUpdatedBy($user)
|
||||||
|
->setType(
|
||||||
|
$this->getReference('aside_activity_category_0')
|
||||||
|
)
|
||||||
|
->setDate((new \DateTimeImmutable('today'))
|
||||||
|
->sub(new \DateInterval('P'.\random_int(1, 100).'D')))
|
||||||
|
;
|
||||||
|
|
||||||
|
$manager->persist($activity);
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\DataFixtures\ORM;
|
||||||
|
|
||||||
|
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
|
||||||
|
use Doctrine\Persistence\ObjectManager;
|
||||||
|
|
||||||
|
class LoadAsideActivityCategory extends \Doctrine\Bundle\FixturesBundle\Fixture
|
||||||
|
{
|
||||||
|
public function load(ObjectManager $manager)
|
||||||
|
{
|
||||||
|
foreach ([
|
||||||
|
'Appel téléphonique',
|
||||||
|
'Formation'
|
||||||
|
] as $key => $label) {
|
||||||
|
$category = new AsideActivityCategory();
|
||||||
|
$category->setTitle(['fr' => $label]);
|
||||||
|
$manager->persist($category);
|
||||||
|
$this->setReference('aside_activity_category_'.$key, $category);
|
||||||
|
}
|
||||||
|
|
||||||
|
$manager->flush();
|
||||||
|
}
|
||||||
|
}
|
@ -25,8 +25,9 @@ final class ChillAsideActivityExtension extends Extension implements PrependExte
|
|||||||
public function load(array $configs, ContainerBuilder $container): void
|
public function load(array $configs, ContainerBuilder $container): void
|
||||||
{
|
{
|
||||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
||||||
// $loader->load('services.yaml');
|
$loader->load('services.yaml');
|
||||||
$loader->load('services/form.yaml');
|
$loader->load('services/form.yaml');
|
||||||
|
$loader->load('services/menu.yaml');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function prepend(ContainerBuilder $container)
|
public function prepend(ContainerBuilder $container)
|
||||||
|
@ -200,10 +200,4 @@ class AsideActivity implements TrackUpdateInterface, TrackCreationInterface
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public function __toString()
|
|
||||||
// {
|
|
||||||
// // dump($this->type->getTitle());
|
|
||||||
// return $this->type->getTitle();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,9 @@ use Chill\MainBundle\Entity\User;
|
|||||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
|
use Doctrine\ORM\EntityRepository;
|
||||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
|
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
|
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
@ -26,8 +28,12 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
private TranslatableStringHelper $translatableStringHelper;
|
private TranslatableStringHelper $translatableStringHelper;
|
||||||
private TokenStorageInterface $storage;
|
private TokenStorageInterface $storage;
|
||||||
|
|
||||||
public function __construct (TranslatableStringHelper $translatableStringHelper, array $timeChoices, TokenStorageInterface $storage){
|
public function __construct (
|
||||||
$this->timeChoices = $timeChoices;
|
TranslatableStringHelper $translatableStringHelper,
|
||||||
|
ParameterBagInterface $parameterBag,
|
||||||
|
TokenStorageInterface $storage
|
||||||
|
){
|
||||||
|
$this->timeChoices = $parameterBag->get('chill_activity.form.time_duration');
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
$this->storage = $storage;
|
$this->storage = $storage;
|
||||||
}
|
}
|
||||||
@ -47,12 +53,15 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
];
|
];
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('agent', EntityType::class,
|
->add('agent', EntityType::class,
|
||||||
[
|
[
|
||||||
'label' => 'Agent',
|
'label' => 'Agent',
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'class' => User::class,
|
'class' => User::class,
|
||||||
'data' => $this->storage->getToken()->getUser(),
|
'data' => $this->storage->getToken()->getUser(),
|
||||||
|
'query_builder' => function(EntityRepository $er){
|
||||||
|
return $er->createQueryBuilder('u')->where('u.enabled = true');
|
||||||
|
},
|
||||||
'attr' => array('class' => 'select2 '),
|
'attr' => array('class' => 'select2 '),
|
||||||
'placeholder' => 'Choose the agent for whom this activity is created',
|
'placeholder' => 'Choose the agent for whom this activity is created',
|
||||||
'choice_label' => 'username'
|
'choice_label' => 'username'
|
||||||
@ -85,7 +94,7 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
'required' => false,
|
'required' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach (['duration'] as $fieldName)
|
foreach (['duration'] as $fieldName)
|
||||||
{
|
{
|
||||||
$builder->get($fieldName)
|
$builder->get($fieldName)
|
||||||
->addModelTransformer($durationTimeTransformer);
|
->addModelTransformer($durationTimeTransformer);
|
||||||
@ -108,7 +117,6 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
$seconds = $data->getTimezone()->getOffset($data);
|
$seconds = $data->getTimezone()->getOffset($data);
|
||||||
$data->setTimeZone($timezoneUTC);
|
$data->setTimeZone($timezoneUTC);
|
||||||
$data->add(new \DateInterval('PT'.$seconds.'S'));
|
$data->add(new \DateInterval('PT'.$seconds.'S'));
|
||||||
dump($data);
|
|
||||||
|
|
||||||
// test if the timestamp is in the choices.
|
// test if the timestamp is in the choices.
|
||||||
// If not, recreate the field with the new timestamp
|
// If not, recreate the field with the new timestamp
|
||||||
@ -131,7 +139,7 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
public function configureOptions(OptionsResolver $resolver): void
|
public function configureOptions(OptionsResolver $resolver): void
|
||||||
{
|
{
|
||||||
$resolver->setDefaults([
|
$resolver->setDefaults([
|
||||||
'data_class' => AsideActivity::class,
|
'data_class' => AsideActivity::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,4 +147,4 @@ final class AsideActivityFormType extends AbstractType
|
|||||||
{
|
{
|
||||||
return 'chill_asideactivitybundle_asideactivity';
|
return 'chill_asideactivitybundle_asideactivity';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\Menu;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
|
use Knp\Menu\MenuItem;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SectionMenuBuilder
|
||||||
|
*
|
||||||
|
* @package Chill\AsideActivityBundle\Menu
|
||||||
|
*/
|
||||||
|
class SectionMenuBuilder implements LocalMenuBuilderInterface
|
||||||
|
{
|
||||||
|
protected TranslatorInterface $translator;
|
||||||
|
|
||||||
|
public function __construct(TranslatorInterface $translator)
|
||||||
|
{
|
||||||
|
$this->translator = $translator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $menuId
|
||||||
|
* @param MenuItem $menu
|
||||||
|
* @param array $parameters
|
||||||
|
*/
|
||||||
|
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||||
|
{
|
||||||
|
$menu->addChild($this->translator->trans('Create an aside activity'), [
|
||||||
|
'route' => 'chill_crud_aside_activity_new'
|
||||||
|
])
|
||||||
|
->setExtras([
|
||||||
|
'order' => 11,
|
||||||
|
'icons' => [ 'plus' ]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getMenuIds(): array
|
||||||
|
{
|
||||||
|
return [ 'section' ];
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
|
||||||
|
|
||||||
|
{% block vertical_menu_content %}
|
||||||
|
{{ chill_menu('admin_aside_activity', {
|
||||||
|
'layout': '@ChillAsideActivity/Admin/menu_asideactivity.html.twig',
|
||||||
|
}) }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block layout_wvm_content %}
|
||||||
|
{% block admin_content %}
|
||||||
|
<!-- block personcontent empty -->
|
||||||
|
<h1>{{ 'Aside activity configuration' |trans }}</h1>
|
||||||
|
{% endblock %}
|
||||||
|
{% endblock %}
|
@ -0,0 +1,4 @@
|
|||||||
|
{% extends "@ChillMain/Menu/verticalMenu.html.twig" %}
|
||||||
|
{% block v_menu_title %}
|
||||||
|
{{ 'Aside activity configuration menu'|trans }}
|
||||||
|
{% endblock %}
|
@ -1,37 +1,30 @@
|
|||||||
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
|
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
|
||||||
{% block crud_content_header %}
|
{% block crud_content_header %}
|
||||||
<h1>{{ ('crud.'~crud_name~'.title_delete')|trans({ '%as_string%': 'Aside Activity' }) }}</h1>
|
<h1>{{ ('crud.'~crud_name~'.title_delete')|trans({ '%as_string%': 'Aside Activity' }) }}</h1>
|
||||||
{% endblock crud_content_header %}
|
{% endblock crud_content_header %}
|
||||||
|
|
||||||
<p class="message-confirm">{{ ('crud.'~crud_name~'.confirm_message_delete')|trans({ '%as_string%': 'Aside Activity' }) }}</p>
|
<p class="message-confirm">{{ ('crud.'~crud_name~'.confirm_message_delete')|trans({ '%as_string%': 'Aside Activity' }) }}</p>
|
||||||
|
|
||||||
{{ form_start(form) }}
|
{{ form_start(form) }}
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
{% block content_form_actions_back %}
|
{% block content_form_actions_back %}
|
||||||
<li class="cancel">
|
<li class="cancel">
|
||||||
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index') }}">
|
<a class="btn btn-cancel" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_index') }}">
|
||||||
{{ 'Cancel'|trans }}
|
{{ 'Cancel'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block content_form_actions_before %}{% endblock %}
|
{% block content_form_actions_before %}
|
||||||
{% block content_form_actions_view %}
|
|
||||||
{% if is_granted(chill_crud_config('role', crud_name, 'view'), entity) %}
|
|
||||||
<li class="">
|
|
||||||
<a class="btn btn-show" href="{{ chill_return_path_or('chill_crud_'~crud_name~'_view', { 'id': entity.id }) }}">
|
|
||||||
{{ 'crud.edit.back_to_view'|trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endblock %}
|
|
||||||
{% block content_form_actions_confirm_delete %}
|
|
||||||
<li>
|
|
||||||
<button type="submit" class="btn btn-delete" value="delete-and-close">{{ ('crud.'~crud_name~'.button_delete')|trans }}</button>
|
|
||||||
</li>
|
|
||||||
{% endblock content_form_actions_confirm_delete %}
|
|
||||||
{% block content_form_actions_after %}{% endblock %}
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
{{ form_end(form) }}
|
{% endblock %}
|
||||||
</div>
|
{% block content_form_actions_confirm_delete %}
|
||||||
|
<li>
|
||||||
|
<button type="submit" class="btn btn-delete" value="delete-and-close">{{ ('crud.'~crud_name~'.button_delete')|trans }}</button>
|
||||||
|
</li>
|
||||||
|
{% endblock content_form_actions_confirm_delete %}
|
||||||
|
{% block content_form_actions_after %}{% endblock %}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{{ form_end(form) }}
|
||||||
|
</div>
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
{# {% block title %}{{ ('crud.' ~ crud_name ~ '.delete.title')|trans({'%crud_name%': crud_name}) }}{% endblock %} #}
|
{# {% block title %}{{ ('crud.' ~ crud_name ~ '.delete.title')|trans({'%crud_name%': crud_name}) }}{% endblock %} #}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% embed '@ChillAsideActivity/AsideActivity/_delete.html.twig' %}
|
{% embed '@ChillAsideActivity/asideActivity/_delete.html.twig' %}
|
||||||
{% endembed %}
|
{% endembed %}
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
@ -9,5 +9,6 @@
|
|||||||
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
|
||||||
{# we do not have "view" page. We empty the corresponding block #}
|
{# we do not have "view" page. We empty the corresponding block #}
|
||||||
{% block content_form_actions_view %}{% endblock %}
|
{% block content_form_actions_view %}{% endblock %}
|
||||||
|
{% block content_form_actions_save_and_show %}{% endblock %}
|
||||||
{% endembed %}
|
{% endembed %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,107 +1,97 @@
|
|||||||
{% extends "@ChillMain/layout.html.twig" %}
|
{% extends "@ChillMain/layout.html.twig" %}
|
||||||
|
|
||||||
{% block title %}{{ 'Aside activity list' |trans }}{% endblock title %}
|
{% block title %}
|
||||||
|
{{ 'Aside activity list' |trans }}
|
||||||
|
{% endblock title %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="col-md-10 col-xxl asideactivity-list">
|
<div class="col-md-10 col-xxl asideactivity-list">
|
||||||
<h2>{{ 'My aside activities' |trans }}</h2>
|
<h2>{{ 'My aside activities' |trans }}</h2>
|
||||||
|
|
||||||
{% if entities|length == 0 %}
|
{% if entities|length == 0 %}
|
||||||
<p class="chill-no-data-statement">
|
<p class="chill-no-data-statement">
|
||||||
{{ "There aren't any aside activities."|trans }}
|
{{ "There aren't any aside activities."|trans }}
|
||||||
<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create button-small"></a>
|
<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create button-small"></a>
|
||||||
</p>
|
</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
<div class="flex-table my-4 list-records">
|
<div
|
||||||
{# Sort activities according to date in descending order #}
|
class="flex-table my-4 list-records">
|
||||||
{% for entity in entities|sort ((a, b) => b.date <=> a.date) %}
|
{# Sort activities according to date in descending order #}
|
||||||
{% set t = entity.type %}
|
{% for entity in entities %}
|
||||||
|
{% set t = entity.type %}
|
||||||
|
|
||||||
{# only load aside activities of current user. #}
|
<div class="item-bloc">
|
||||||
{% if entity.agent == app.user %}
|
<div class="item-row main">
|
||||||
|
<div class="item-col">
|
||||||
|
|
||||||
<div class="item-bloc">
|
<h3>
|
||||||
<div class="item-row main">
|
<b>{{ entity.type.title | localize_translatable_string }}</b>
|
||||||
<div class="item-col">
|
</h3>
|
||||||
|
|
||||||
<h3>
|
{% if entity.date %}
|
||||||
<b>{{ entity.type.title | localize_translatable_string }}</b>
|
<p>{{ entity.date|format_date('long') }}</p>
|
||||||
</h3>
|
{% endif %}
|
||||||
|
|
||||||
{% if entity.date %}
|
<div class="duration">
|
||||||
<p>{{ entity.date|format_date('long') }}</p>
|
<p>
|
||||||
{% endif %}
|
<i class="fa fa-fw fa-hourglass-end"></i>
|
||||||
|
{{ entity.duration|date('H:i') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="duration">
|
</div>
|
||||||
<p>
|
<div class="item-col">
|
||||||
<i class="fa fa-fw fa-hourglass-end"></i>
|
<ul class="list-content">
|
||||||
{{ entity.duration|date('H:i') }}
|
{% if entity.createdBy %}
|
||||||
</p>
|
<li>
|
||||||
</div>
|
<b>{{ 'Created by: '|trans }}{{ entity.createdBy.usernameCanonical }}</b>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
{# {%
|
||||||
<div class="item-col">
|
if entity.note is not empty
|
||||||
<ul class="list-content">
|
or entity.createdBy|length > 0
|
||||||
{% if entity.createdBy %}
|
%}
|
||||||
<li>
|
<div class="item-row details">
|
||||||
<b>{{ 'Created by: '|trans }}{{ entity.createdBy.usernameCanonical }}</b>
|
{% if entity.note is not empty %}
|
||||||
</li>
|
<div class="item-col comment">
|
||||||
{% endif %}
|
{{ entity.note|chill_markdown_to_html }}
|
||||||
</ul>
|
</div>
|
||||||
</div>
|
{% endif %}
|
||||||
</div>
|
|
||||||
|
|
||||||
{# {%
|
</div>
|
||||||
if entity.note is not empty
|
{% endif %} #}
|
||||||
or entity.createdBy|length > 0
|
<div class="item-col">
|
||||||
%}
|
<ul class="list-content">
|
||||||
<div class="item-row details">
|
<ul class="record_actions">
|
||||||
{% if entity.note is not empty %}
|
<li>
|
||||||
<div class="item-col comment">
|
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_edit', { 'id': entity.id }) }}" class="btn btn-update btn-mini "></a>
|
||||||
{{ entity.note|chill_markdown_to_html }}
|
</li>
|
||||||
</div>
|
<li>
|
||||||
{% endif %}
|
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_delete', { 'id': entity.id } ) }}" class="btn btn-delete btn-mini"></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
{% endfor %}
|
||||||
{% endif %} #}
|
</div>
|
||||||
<div class="item-col">
|
|
||||||
<ul class="list-content">
|
{{ chill_pagination(paginator) }}
|
||||||
<ul class="record_actions">
|
|
||||||
{# <li>
|
<ul class="record_actions">
|
||||||
<a href="{{ path('chill_crud_aside_activity_view', { 'id': entity.id} ) }}" class="btn btn-show "></a>
|
<li>
|
||||||
</li> #}
|
<a href="{{ chill_path_add_return_path('chill_crud_aside_activity_new') }}" class="btn btn-create">
|
||||||
{# TOOD
|
{{ 'Create' | trans }}
|
||||||
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
|
</a>
|
||||||
#}
|
</li>
|
||||||
<li>
|
</ul>
|
||||||
<a href="{{ path('chill_crud_aside_activity_edit', { 'id': entity.id }) }}" class="btn btn-update "></a>
|
</div>
|
||||||
</li>
|
{% endif %}
|
||||||
{# TOOD
|
|
||||||
{% endif %}
|
|
||||||
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
|
|
||||||
#}
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('chill_crud_aside_activity_delete', { 'id': entity.id } ) }}" class="btn btn-delete "></a>
|
|
||||||
</li>
|
|
||||||
{#
|
|
||||||
{% endif %}
|
|
||||||
#}
|
|
||||||
</ul>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
<ul class="record_actions">
|
|
||||||
<li>
|
|
||||||
<a href="{{ path('chill_crud_aside_activity_new') }}" class="btn btn-create">
|
|
||||||
{{ 'Add a new aside activity' | trans }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,44 +1,44 @@
|
|||||||
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
|
{% extends "@ChillAsideActivity/Admin/layout_asideactivity.html.twig" %}
|
||||||
|
|
||||||
{% block admin_content %}
|
{% block admin_content %}
|
||||||
<h1>{{ 'ActivityType list'|trans }}</h1>
|
<h1>{{ 'ActivityType list'|trans }}</h1>
|
||||||
|
|
||||||
<table class="records_list table table-bordered border-dark">
|
<table class="records_list table table-bordered border-dark">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ 'Name'|trans }}</th>
|
<th>{{ 'Name'|trans }}</th>
|
||||||
<th>{{ 'Active'|trans }}</th>
|
<th>{{ 'Active'|trans }}</th>
|
||||||
<th>{{ 'Actions'|trans }}</th>
|
<th>{{ 'Actions'|trans }}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for entity in entities %}
|
{% for entity in entities %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ entity.title|localize_translatable_string }}</td>
|
<td>{{ entity.title|localize_translatable_string }}</td>
|
||||||
<td style="text-align:center;">
|
<td style="text-align:center;">
|
||||||
{%- if entity.isActive -%}
|
{%- if entity.isActive -%}
|
||||||
<i class="fa fa-check-square-o"></i>
|
<i class="fa fa-check-square-o"></i>
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
<i class="fa fa-square-o"></i>
|
<i class="fa fa-square-o"></i>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_crud_aside_activity_category_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
|
<a href="{{ path('chill_crud_aside_activity_category_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_crud_aside_activity_category_new') }}" class="btn btn-create">
|
<a href="{{ path('chill_crud_aside_activity_category_new') }}" class="btn btn-create">
|
||||||
{{ 'Create a new aside activity type'|trans }}
|
{{ 'Create a new aside activity type'|trans }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Chill\AsideActivityBundle\Tests\Controller;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
use Chill\AsideActivityBundle\Entity\AsideActivity;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
|
||||||
|
class AccompanyingCourseControllerTest extends WebTestCase
|
||||||
|
{
|
||||||
|
use PrepareClientTrait;
|
||||||
|
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
self::bootKernel();
|
||||||
|
$this->client = $this->getClientAuthenticated();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testIndexWithoutUsers()
|
||||||
|
{
|
||||||
|
$this->client->request('GET', '/fr/asideactivity');
|
||||||
|
|
||||||
|
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testNewWithoutUsers()
|
||||||
|
{
|
||||||
|
$this->client->request('GET', '/fr/asideactivity/new');
|
||||||
|
|
||||||
|
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider generateAsideActivityId
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function testEditWithoutUsers(int $asideActivityId)
|
||||||
|
{
|
||||||
|
$this->client->request('GET', "/fr/asideactivity/{$asideActivityId}/edit");
|
||||||
|
|
||||||
|
$this->assertEquals(200, $this->client->getResponse()->getStatusCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function generateAsideActivityId()
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
|
||||||
|
$qb = self::$container->get(EntityManagerInterface::class)
|
||||||
|
->createQueryBuilder();
|
||||||
|
|
||||||
|
$asideActivityIds = $qb
|
||||||
|
->select('DISTINCT asideactivity.id')
|
||||||
|
->from(AsideActivity::class, 'asideactivity')
|
||||||
|
->innerJoin('asideactivity.agent', 'agent')
|
||||||
|
->where($qb->expr()->eq('agent.username', ':center_name'))
|
||||||
|
->setParameter('center_name', 'center a_social')
|
||||||
|
->setMaxResults(100)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
|
||||||
|
\shuffle($asideActivityIds);
|
||||||
|
|
||||||
|
yield [ \array_pop($asideActivityIds)['id'] ];
|
||||||
|
yield [ \array_pop($asideActivityIds)['id'] ];
|
||||||
|
yield [ \array_pop($asideActivityIds)['id'] ];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,3 +1,12 @@
|
|||||||
chill_asideactivities_controllers:
|
chill_asideactivities_controllers:
|
||||||
resource: "@ChillAsideActivityBundle/Controller"
|
resource: "@ChillAsideActivityBundle/Controller"
|
||||||
type: annotation
|
type: annotation
|
||||||
|
|
||||||
|
chill_admin_aside_activity_redirect_to_admin_index:
|
||||||
|
path: /{_locale}/admin/activity_redirect_to_main
|
||||||
|
controller: Chill\ActivityBundle\Controller\AdminController::redirectToAdminIndexAction
|
||||||
|
options:
|
||||||
|
menus:
|
||||||
|
admin_aside_activity:
|
||||||
|
order: 0
|
||||||
|
label: Main admin menu
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
# services:
|
services:
|
||||||
# chill.asideactivity.form.type.asideactivity:
|
Chill\AsideActivityBundle\DataFixtures\:
|
||||||
# class: Chill\AsideActivityBundle\Form\AsideActivityFormType
|
resource: './../DataFixtures'
|
||||||
# arguments:
|
autowire: true
|
||||||
# - "@chill.main.helper.translatable_string"
|
autoconfigure: true
|
||||||
# # - "%chill_activity.form.time_duration%"
|
|
||||||
# tags:
|
|
||||||
# - { name: form.type, alias: chill_asideactivitybundle_asideactivity }
|
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
---
|
---
|
||||||
services:
|
services:
|
||||||
chill.asideactivity.form.type.asideactivity:
|
Chill\AsideActivityBundle\Form\:
|
||||||
class: Chill\AsideActivityBundle\Form\AsideActivityFormType
|
resource: './../../Form'
|
||||||
arguments:
|
autowire: true
|
||||||
- "@chill.main.helper.translatable_string"
|
autoconfigure: true
|
||||||
- "%chill_activity.form.time_duration%"
|
|
||||||
- "@security.token_storage"
|
|
||||||
tags:
|
|
||||||
- { name: form.type, alias: chill_asideactivitybundle_asideactivity }
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
services:
|
||||||
|
Chill\AsideActivityBundle\Menu\:
|
||||||
|
resource: './../../Menu'
|
||||||
|
autowire: true
|
||||||
|
autoconfigure: true
|
@ -1,9 +1,10 @@
|
|||||||
#general
|
#general
|
||||||
Show the aside activity: Voir l'activité annexe
|
Show the aside activity: Voir l'activité annexe
|
||||||
Edit the aside activity: Modifier l'activité annexe
|
Edit the aside activity: Modifier l'activité annexe
|
||||||
|
Remove aside activity: Supprimer l'activité annexe
|
||||||
Aside activity: Activité annexe
|
Aside activity: Activité annexe
|
||||||
Duration time: Durée
|
Duration time: Durée
|
||||||
durationTime: durée
|
durationTime: durée
|
||||||
user_username: nom de l'utilisateur
|
user_username: nom de l'utilisateur
|
||||||
Remark: Commentaire
|
Remark: Commentaire
|
||||||
No comments: Aucun commentaire
|
No comments: Aucun commentaire
|
||||||
@ -25,7 +26,7 @@ Required: Obligatoire
|
|||||||
Persons: Personnes
|
Persons: Personnes
|
||||||
Users: Utilisateurs
|
Users: Utilisateurs
|
||||||
Emergency: Urgent
|
Emergency: Urgent
|
||||||
by: 'Par '
|
by: "Par "
|
||||||
location: Lieu
|
location: Lieu
|
||||||
|
|
||||||
# Crud
|
# Crud
|
||||||
@ -33,10 +34,10 @@ crud:
|
|||||||
aside_activity:
|
aside_activity:
|
||||||
title_view: Détail de l'activité annexe
|
title_view: Détail de l'activité annexe
|
||||||
title_new: Nouvelle activité annexe
|
title_new: Nouvelle activité annexe
|
||||||
title_edit: Edition d'une activité annexe
|
title_edit: Édition d'une activité annexe
|
||||||
title_delete: Supprimation d'une activité annexe
|
title_delete: Supprimer une activité annexe
|
||||||
button_delete: Supprimer
|
button_delete: Supprimer
|
||||||
confirm_message_delete: Êtes-vous sûr de vouloir supprimer cet activité annexe?
|
confirm_message_delete: Êtes-vous sûr de vouloir supprimer cette activité annexe?
|
||||||
aside_activity_category:
|
aside_activity_category:
|
||||||
title_new: Nouvelle catégorie d'activité annexe
|
title_new: Nouvelle catégorie d'activité annexe
|
||||||
title_edit: Edition d'une catégorie de type d'activité
|
title_edit: Edition d'une catégorie de type d'activité
|
||||||
@ -57,26 +58,18 @@ Agent: Utilisateur
|
|||||||
date: Date
|
date: Date
|
||||||
Duration: Durée
|
Duration: Durée
|
||||||
Note: Note
|
Note: Note
|
||||||
5 minutes: 5 minutes
|
|
||||||
10 minutes: 10 minutes
|
|
||||||
15 minutes: 15 minutes
|
|
||||||
20 minutes: 20 minutes
|
|
||||||
25 minutes: 25 minutes
|
|
||||||
30 minutes: 30 minutes
|
|
||||||
45 minutes: 45 minutes
|
|
||||||
1 hour: 1 heure
|
|
||||||
1 hour 15: 1 heure 15
|
|
||||||
1 hour 30: 1 heure 30
|
|
||||||
1 hour 45: 1 heure 45
|
|
||||||
2 hours: 2 heures
|
|
||||||
|
|
||||||
#list
|
#list
|
||||||
My aside activities: Mes activités annexes
|
My aside activities: Mes activités annexes
|
||||||
Date: Date
|
Date: Date
|
||||||
Created by: Creér par
|
Created by: Creér par
|
||||||
|
|
||||||
|
|
||||||
#Aside activity delete
|
#Aside activity delete
|
||||||
Delete aside activity: Supprimer une activité annexe
|
Delete aside activity: Supprimer une activité annexe
|
||||||
Are you sure you want to remove the aside activity concerning "%name%" ?: Êtes-vous sûr de vouloir supprimer une activité annexe qui concerne "%name%" ?
|
Are you sure you want to remove the aside activity concerning "%name%" ?: Êtes-vous sûr de vouloir supprimer une activité annexe qui concerne "%name%" ?
|
||||||
The activity has been successfully removed.: L'activité a été supprimée.
|
The activity has been successfully removed.: L'activité a été supprimée.
|
||||||
|
|
||||||
|
#Menu
|
||||||
|
Create an aside activity: "Creér une activité annexe"
|
||||||
|
Aside activity configuration menu: "Menu de configuration des activités annexes"
|
||||||
|
Aside activity configuration: "Configuration des activités annexes"
|
||||||
|
@ -1141,7 +1141,7 @@ class CRUDController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
protected function getPaginatorFactory(): PaginatorFactory
|
protected function getPaginatorFactory(): PaginatorFactory
|
||||||
{
|
{
|
||||||
return $this->container->get(PaginatorFactory::class);
|
return $this->container->get('chill_main.paginator_factory');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1196,7 +1196,7 @@ class CRUDController extends AbstractController
|
|||||||
return \array_merge(
|
return \array_merge(
|
||||||
parent::getSubscribedServices(),
|
parent::getSubscribedServices(),
|
||||||
[
|
[
|
||||||
PaginatorFactory::class => PaginatorFactory::class,
|
'chill_main.paginator_factory' => PaginatorFactory::class,
|
||||||
'translator' => TranslatorInterface::class,
|
'translator' => TranslatorInterface::class,
|
||||||
AuthorizationHelper::class => AuthorizationHelper::class,
|
AuthorizationHelper::class => AuthorizationHelper::class,
|
||||||
EventDispatcherInterface::class => EventDispatcherInterface::class,
|
EventDispatcherInterface::class => EventDispatcherInterface::class,
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Chill\MainBundle;
|
namespace Chill\MainBundle;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||||
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
use Symfony\Component\HttpKernel\Bundle\Bundle;
|
||||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Chill\MainBundle\DependencyInjection\CompilerPass\SearchableServicesCompilerPass;
|
use Chill\MainBundle\DependencyInjection\CompilerPass\SearchableServicesCompilerPass;
|
||||||
@ -23,6 +24,10 @@ class ChillMainBundle extends Bundle
|
|||||||
public function build(ContainerBuilder $container)
|
public function build(ContainerBuilder $container)
|
||||||
{
|
{
|
||||||
parent::build($container);
|
parent::build($container);
|
||||||
|
|
||||||
|
$container->registerForAutoconfiguration(LocalMenuBuilderInterface::class)
|
||||||
|
->addTag('chill.menu_builder');
|
||||||
|
|
||||||
$container->addCompilerPass(new SearchableServicesCompilerPass());
|
$container->addCompilerPass(new SearchableServicesCompilerPass());
|
||||||
$container->addCompilerPass(new ConfigConsistencyCompilerPass());
|
$container->addCompilerPass(new ConfigConsistencyCompilerPass());
|
||||||
$container->addCompilerPass(new TimelineCompilerClass());
|
$container->addCompilerPass(new TimelineCompilerClass());
|
||||||
|
@ -15,7 +15,7 @@ use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Load fixtures users into database
|
* Load fixtures users into database
|
||||||
*
|
*
|
||||||
* create a user for each permission_group and center.
|
* create a user for each permission_group and center.
|
||||||
* username and password are identicals.
|
* username and password are identicals.
|
||||||
*
|
*
|
||||||
@ -28,12 +28,12 @@ class LoadUsers extends AbstractFixture implements OrderedFixtureInterface, Cont
|
|||||||
* @var ContainerInterface
|
* @var ContainerInterface
|
||||||
*/
|
*/
|
||||||
private $container;
|
private $container;
|
||||||
|
|
||||||
public function getOrder()
|
public function getOrder()
|
||||||
{
|
{
|
||||||
return 1000;
|
return 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static $refs = array(
|
public static $refs = array(
|
||||||
'center a_social' => array(
|
'center a_social' => array(
|
||||||
'groupCenterRefs' => ['centerA_permission_group_social']
|
'groupCenterRefs' => ['centerA_permission_group_social']
|
||||||
@ -54,10 +54,10 @@ class LoadUsers extends AbstractFixture implements OrderedFixtureInterface, Cont
|
|||||||
'groupCenterRefs' => ['centerB_permission_group_direction']
|
'groupCenterRefs' => ['centerB_permission_group_direction']
|
||||||
),
|
),
|
||||||
'multi_center' => array(
|
'multi_center' => array(
|
||||||
'groupCenterRefs' => ['centerA_permission_group_social',
|
'groupCenterRefs' => ['centerA_permission_group_social',
|
||||||
'centerB_permission_group_social']
|
'centerB_permission_group_social']
|
||||||
)
|
)
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
public function load(ObjectManager $manager)
|
public function load(ObjectManager $manager)
|
||||||
@ -67,11 +67,11 @@ class LoadUsers extends AbstractFixture implements OrderedFixtureInterface, Cont
|
|||||||
$user = new User();
|
$user = new User();
|
||||||
|
|
||||||
$defaultEncoder = new MessageDigestPasswordEncoder('sha512', true, 5000);
|
$defaultEncoder = new MessageDigestPasswordEncoder('sha512', true, 5000);
|
||||||
|
|
||||||
$encoderFactory = new EncoderFactory([
|
$encoderFactory = new EncoderFactory([
|
||||||
User::class => $defaultEncoder
|
User::class => $defaultEncoder
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$user
|
$user
|
||||||
->setUsername($username)
|
->setUsername($username)
|
||||||
->setPassword($encoderFactory
|
->setPassword($encoderFactory
|
||||||
@ -84,7 +84,7 @@ class LoadUsers extends AbstractFixture implements OrderedFixtureInterface, Cont
|
|||||||
foreach ($params['groupCenterRefs'] as $groupCenterRef) {
|
foreach ($params['groupCenterRefs'] as $groupCenterRef) {
|
||||||
$user->addGroupCenter($this->getReference($groupCenterRef));
|
$user->addGroupCenter($this->getReference($groupCenterRef));
|
||||||
}
|
}
|
||||||
|
|
||||||
echo 'Creating user ' . $username ."... \n";
|
echo 'Creating user ' . $username ."... \n";
|
||||||
$manager->persist($user);
|
$manager->persist($user);
|
||||||
$this->addReference($username, $user);
|
$this->addReference($username, $user);
|
||||||
@ -98,7 +98,7 @@ class LoadUsers extends AbstractFixture implements OrderedFixtureInterface, Cont
|
|||||||
if (NULL === $container) {
|
if (NULL === $container) {
|
||||||
throw new \LogicException('$container should not be null');
|
throw new \LogicException('$container should not be null');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->container = $container;
|
$this->container = $container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 8839b431f296733b792c788f2ef58e5ecd6419d3
|
Subproject commit bd95d3c96a437757b7e8f35cdfd30da9aeac1a01
|
Loading…
x
Reference in New Issue
Block a user