Commit dbd4120d by Frédéric

Translation

parent 517a741d
...@@ -89,19 +89,17 @@ class FluxController extends BackendBase ...@@ -89,19 +89,17 @@ class FluxController extends BackendBase
* @param Request $request * @param Request $request
* @return \Bolt\Response\TemplateResponse|\Bolt\Response\TemplateView|\Symfony\Component\HttpFoundation\RedirectResponse * @return \Bolt\Response\TemplateResponse|\Bolt\Response\TemplateView|\Symfony\Component\HttpFoundation\RedirectResponse
*/ */
public function edit(Request $request) { public function edit(Request $request)
{
$flux = $this->getRepository(Flux::class)->find($request->get('id')); $flux = $this->assertFlux($request->get('id'));
if (!$flux){
$this->app['session']->getFlashBag()->add('error', 'Modification impossible: Flux inexistant');
return $this->redirectToRoute('tourinsoft_admin_flux_index');
}
$form = $this->createForm(FluxType::class, $flux, ['edit_mode' => true]); $form = $this->createFormBuilder(FluxType::class, $flux, ['edit_mode' => true])
$form->handleRequest($request); ->getForm()
->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) if ($form->isSubmitted() && $form->isValid())
{ {
$flux->setUpdatedAt(new \DateTime());
$this->getRepository(Flux::class)->update($flux); $this->getRepository(Flux::class)->update($flux);
return $this->redirectToRoute('tourinsoft_admin_flux_index'); return $this->redirectToRoute('tourinsoft_admin_flux_index');
} }
...@@ -116,15 +114,15 @@ class FluxController extends BackendBase ...@@ -116,15 +114,15 @@ class FluxController extends BackendBase
/** /**
* Synchornisation ('/sync/:id') * Synchornisation ('/sync/:id')
*/ */
public function sync(Request $request) { public function sync(Request $request)
{
$flux = $this->assertFLux($request->get('id'));
$flux = $this->getRepository(Flux::class)->find($request->get('id'));
if (!$flux){
$this->app['session']->getFlashBag()->add('error', 'Modification impossible: Flux inexistant');
} else {
$sync = new Synchronisation($this->config, $this->application, $flux); $sync = new Synchronisation($this->config, $this->application, $flux);
$sync->sync(); $sync->sync();
}
$flux->setSynchronizedAt(new \DateTime());
$this->getRepository(Flux::class)->update($flux);
return $this->redirectToRoute('tourinsoft_admin_flux_index'); return $this->redirectToRoute('tourinsoft_admin_flux_index');
} }
...@@ -136,17 +134,30 @@ class FluxController extends BackendBase ...@@ -136,17 +134,30 @@ class FluxController extends BackendBase
*/ */
public function delete(Request $request) public function delete(Request $request)
{ {
$flux = $this->getRepository(Flux::class)->find($request->get('id')); $flux = $this->assertFLux($request->get('id'));
if (!$flux){
$this->app['session']->getFlashBag()->add('error', 'Suppression impossible: Flux inexistant');
} else {
$this->app['storage']->delete($flux); $this->app['storage']->delete($flux);
$this->app['session']->getFlashBag()->add('success', 'Flux supprimé'); $this->app['session']->getFlashBag()->add('success', 'Flux supprimé');
$sync = new Synchronisation($this->config, $this->application, $flux); $sync = new Synchronisation($this->config, $this->application, $flux);
$sync->delete(); $sync->delete();
return $this->redirectToRoute('tourinsoft_admin_flux_index');
} }
/**
* @param $id
* @return Flux|\Symfony\Component\HttpFoundation\RedirectResponse
*/
private function assertFLux($id) {
$fluxRepository = $this->getRepository(Flux::class);
/** @var Flux $flux */
$flux = $fluxRepository->find($id);
if (!$flux){
$this->app['session']->getFlashBag()->add('error', 'Flux inexistant');
return $this->redirectToRoute('tourinsoft_admin_flux_index'); return $this->redirectToRoute('tourinsoft_admin_flux_index');
} }
return $flux;
}
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
namespace Bolt\Extension\Appolo\Tourinsoft\Form; namespace Bolt\Extension\Appolo\Tourinsoft\Form;
use Bolt\Translation\Translator;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
...@@ -20,7 +21,7 @@ class FluxType extends AbstractType ...@@ -20,7 +21,7 @@ class FluxType extends AbstractType
'title', 'title',
TextType::class, TextType::class,
[ [
'label' => 'Titre', 'label' => Translator::__('Title'),
'required' => true, 'required' => true,
'attr' => [ 'attr' => [
'class' => 'form-control' 'class' => 'form-control'
...@@ -30,7 +31,7 @@ class FluxType extends AbstractType ...@@ -30,7 +31,7 @@ class FluxType extends AbstractType
], ],
'constraints' => array( 'constraints' => array(
new NotBlank([ new NotBlank([
'message' => 'Le titre est requis.' 'message' => Translator::__('appolo.tourinsoft.title_is_required')
]) ])
), ),
]) ])
...@@ -38,7 +39,7 @@ class FluxType extends AbstractType ...@@ -38,7 +39,7 @@ class FluxType extends AbstractType
'code', 'code',
TextType::class, TextType::class,
[ [
'label' => 'Code', 'label' => Translator::__('appolo.tourinsoft.code'),
'required' => false, 'required' => false,
'attr' => [ 'attr' => [
'class' => 'form-control' 'class' => 'form-control'
...@@ -51,7 +52,7 @@ class FluxType extends AbstractType ...@@ -51,7 +52,7 @@ class FluxType extends AbstractType
'key', 'key',
TextType::class, TextType::class,
[ [
'label' => 'Key', 'label' => Translator::__('appolo.tourinsoft.key'),
'required' => true, 'required' => true,
'attr' => [ 'attr' => [
'class' => 'form-control' 'class' => 'form-control'
...@@ -61,7 +62,7 @@ class FluxType extends AbstractType ...@@ -61,7 +62,7 @@ class FluxType extends AbstractType
], ],
'constraints' => array( 'constraints' => array(
new NotBlank([ new NotBlank([
'message' => 'La clé est requise.' 'message' => Translator::__('appolo.tourinsoft.key_is_required')
]) ])
), ),
]) ])
...@@ -69,7 +70,7 @@ class FluxType extends AbstractType ...@@ -69,7 +70,7 @@ class FluxType extends AbstractType
'contentType', 'contentType',
TextType::class, TextType::class,
[ [
'label' => 'Content Type', 'label' => Translator::__('appolo.tourinsoft.content_type'),
'required' => true, 'required' => true,
'read_only' => $options['edit_mode'], 'read_only' => $options['edit_mode'],
'attr' => [ 'attr' => [
...@@ -80,7 +81,7 @@ class FluxType extends AbstractType ...@@ -80,7 +81,7 @@ class FluxType extends AbstractType
], ],
'constraints' => array( 'constraints' => array(
new NotBlank([ new NotBlank([
'message' => 'Le type de contenu est requis.' 'message' => Translator::__('appolo.tourinsoft.content_type_is_required')
]) ])
), ),
]) ])
......
...@@ -22,6 +22,8 @@ class Flux extends Entity ...@@ -22,6 +22,8 @@ class Flux extends Entity
protected $createdAt; protected $createdAt;
/** @var \Datetime */ /** @var \Datetime */
protected $updatedAt; protected $updatedAt;
/** @var \Datetime */
protected $synchronizedAt;
/** /**
* @return int * @return int
...@@ -156,4 +158,22 @@ class Flux extends Entity ...@@ -156,4 +158,22 @@ class Flux extends Entity
$this->updatedAt = $updatedAt; $this->updatedAt = $updatedAt;
return $this; return $this;
} }
/**
* @return \Datetime
*/
public function getSynchronizedAt()
{
return $this->synchronizedAt;
}
/**
* @param \Datetime $synchronizedAt
* @return Flux
*/
public function setSynchronizedAt($synchronizedAt)
{
$this->synchronizedAt = $synchronizedAt;
return $this;
}
} }
\ No newline at end of file
...@@ -19,7 +19,8 @@ class Flux extends BaseTable ...@@ -19,7 +19,8 @@ class Flux extends BaseTable
$this->table->addColumn('contentType', 'string', ['notnull' => true]); $this->table->addColumn('contentType', 'string', ['notnull' => true]);
$this->table->addColumn('enabled', 'boolean', ['default' => false]); $this->table->addColumn('enabled', 'boolean', ['default' => false]);
$this->table->addColumn('createdAt', 'datetime', ['notnull' => true]); $this->table->addColumn('createdAt', 'datetime', ['notnull' => true]);
$this->table->addColumn('updateAt', 'datetime', ['notnull' => false]); $this->table->addColumn('updatedAt', 'datetime', ['notnull' => false]);
$this->table->addColumn('synchronizedAt', 'datetime', ['notnull' => false]);
} }
/** /**
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
{% block page_title %} {% block page_title %}
<h1 class="page-header"> <h1 class="page-header">
<strong>{{ __('general.phrase.overview') }} »</strong> <strong>{{ __('general.phrase.overview') }} »</strong>
<i style="font-style: normal;"> {{ __('Création de Flux') }}</i> <i style="font-style: normal;"> {{ __('appolo.tourinsoft.flux_creation') }}</i>
</h1> </h1>
{% endblock page_title %} {% endblock page_title %}
...@@ -58,13 +58,13 @@ ...@@ -58,13 +58,13 @@
<div class="panel panel-default panel-news"> <div class="panel panel-default panel-news">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-fw fa-cog"></i> <i class="fa fa-fw fa-cog"></i>
{{ __('Actions') }} {{ __('appolo.tourinsoft.actions') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
<button type="submit" class="btn btn-primary"> Valider la modification </button> <button type="submit" class="btn btn-primary"> {{ __('appolo.tourinsoft.save') }} </button>
<br/> <br/>
<a class="btn btn-default" style="margin-top: 1em;" href="{{ path('tourinsoft_admin_flux_index') }}"> <a class="btn btn-default" style="margin-top: 1em;" href="{{ path('tourinsoft_admin_flux_index') }}">
<i class="fa fa-undo" aria-hidden="true"></i> {{ __('Retour à la liste des flux') }} <i class="fa fa-undo" aria-hidden="true"></i> {{ __('appolo.tourinsoft.return_to_flux_list') }}
</a> </a>
</div> </div>
</div> </div>
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
{% block page_title %} {% block page_title %}
<h1 class="page-header"> <h1 class="page-header">
<strong>{{ __('general.phrase.overview') }} »</strong> <strong>{{ __('general.phrase.overview') }} »</strong>
<i style="font-style: normal;"> {{ __('Modification de Flux') }}</i> <i style="font-style: normal;"> {{ __('appolo.tourinsoft.flux_update') }} : {{ flux.title }}</i>
</h1> </h1>
{% endblock page_title %} {% endblock page_title %}
...@@ -58,13 +58,13 @@ ...@@ -58,13 +58,13 @@
<div class="panel panel-default panel-news"> <div class="panel panel-default panel-news">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-fw fa-cog"></i> <i class="fa fa-fw fa-cog"></i>
{{ __('Actions') }} {{ __('appolo.tourinsoft.actions') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
<button type="submit" class="btn btn-primary"> Valider la modification </button> <button type="submit" class="btn btn-primary"> {{ __('appolo.tourinsoft.save') }} </button>
<br/> <br/>
<a class="btn btn-default" style="margin-top: 1em;" href="{{ path('tourinsoft_admin_flux_index') }}"> <a class="btn btn-default" style="margin-top: 1em;" href="{{ path('tourinsoft_admin_flux_index') }}">
<i class="fa fa-undo" aria-hidden="true"></i> {{ __('Retour à la liste des flux') }} <i class="fa fa-undo" aria-hidden="true"></i> {{ __('appolo.tourinsoft.return_to_flux_list') }}
</a> </a>
</div> </div>
</div> </div>
......
...@@ -17,14 +17,15 @@ ...@@ -17,14 +17,15 @@
<table class=" dashboardlisting listing"> <table class=" dashboardlisting listing">
<tbody class="sortable striping_odd ui-sortable"> <tbody class="sortable striping_odd ui-sortable">
<tr class="header"> <tr class="header">
<th class="hidden-xs">Id </th> <th class="hidden-xs">{{ __('appolo.tourinsoft.id') }}</th>
<th>{{ __('Title') }}</th> <th>{{ __('Title') }}</th>
<th>Code</th> <th>{{ __('appolo.tourinsoft.code') }}</th>
<th>Key</th> <th>{{ __('appolo.tourinsoft.key') }}</th>
<th>Content Type</th> <th>{{ __('appolo.tourinsoft.content_type') }}</th>
<th><span class="hidden-xs">{{ __('general.phrase.action-plural') }} </span></th> <th style="text-align: right;">
<span class="hidden-xs">{{ __('general.phrase.action-plural') }} </span>
</th>
</tr> </tr>
{# tri des flux par dates décroissantes #}
{% for item in flux | reverse %} {% for item in flux | reverse %}
<tr class="dim" id="item_1"> <tr class="dim" id="item_1">
<td class="id hidden-xs">{{ item.id }}</td> <td class="id hidden-xs">{{ item.id }}</td>
...@@ -41,15 +42,15 @@ ...@@ -41,15 +42,15 @@
<td class="actions"> <td class="actions">
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown"> <button type="button" class="btn btn-default dropdown-toggle btn-xs" data-toggle="dropdown">
Sélectionner une action {{ __('appolo.tourinsoft.select_an_action') }}
<i cla ss="fa fa-info-sign"></i> <span class="caret"></span> <i class="fa fa-info-sign"></i> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu pull-right"> <ul class="dropdown-menu pull-right">
<li> <li>
<a href="{{ path('tourinsoft_admin_flux_sync', {'id': item.id}) }}"> <a href="{{ path('tourinsoft_admin_flux_sync', {'id': item.id}) }}">
<i class="fa fa-refresh"></i> <i class="fa fa-refresh"></i>
Synchroniser {{ __('appolo.tourinsoft.synchronize') }}
</a> </a>
</li> </li>
<li> <li>
...@@ -59,7 +60,7 @@ ...@@ -59,7 +60,7 @@
</a> </a>
</li> </li>
<li> <li>
<a onclick="return confirm('Êtes-vous sûr de vouloir supprimer ce flux?');" href="{{ path('tourinsoft_admin_flux_delete', {'id': item.id}) }}"> <a onclick="return confirm('{{ __('appolo.tourinsoft.are_you_sure_want_delete_flux') }}');" href="{{ path('tourinsoft_admin_flux_delete', {'id': item.id}) }}">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
{{ __('general.phrase.delete') }} {{ __('general.phrase.delete') }}
</a> </a>
...@@ -67,7 +68,11 @@ ...@@ -67,7 +68,11 @@
<li class="divider"></li> <li class="divider"></li>
<li> <li>
<a class="nolink">{{ __('general.phrase.created-on-colon') }} : <a class="nolink">{{ __('general.phrase.created-on-colon') }} :
<i class="fa fa-asterisk"></i> {{ item.createdAt | date('d/m/Y') }} {{ item.createdAt | date('d/m/Y H:i') }}
</a>
<a class="nolink">{{ __('appolo.tourinsoft.updated_on') }} :
{{ item.updatedAt | date('d/m/Y H:i') }}
</a> </a>
</li> </li>
</ul> </ul>
...@@ -81,15 +86,16 @@ ...@@ -81,15 +86,16 @@
{{ pager('overview') }} {{ pager('overview') }}
</div> </div>
</div> </div>
<!-- sidebar --> <!-- sidebar -->
<aside class="col-md-4"> <aside class="col-md-4">
<div class="panel panel-default panel-news"> <div class="panel panel-default panel-news">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-fw fa-cog"></i>{{ __('Action pour les flux') }} <i class="fa fa-fw fa-cog"></i>{{ __('appolo.tourinsoft.actions_for_flux') }}
</div> </div>
<div class="panel-body"> <div class="panel-body">
<a class="btn btn-primary" href="{{ path('tourinsoft_admin_flux_add') }}"> <a class="btn btn-primary" href="{{ path('tourinsoft_admin_flux_add') }}">
<i class="fa fa-plus"></i> {{ __('Nouveau Flux') }} <i class="fa fa-plus"></i> {{ __('appolo.tourinsoft.new_flux') }}
</a> </a>
</div> </div>
</div> </div>
......
appolo.tourinsoft.updated_on: Updated at
appolo.tourinsoft.are_you_sure_want_delete_flux: Are you sure to want to delete this flux?
appolo.tourinsoft.synchronize: Synchronize
appolo.tourinsoft.select_an_action: Select an action
appolo.tourinsoft.id: "#"
appolo.tourinsoft.code: Code
appolo.tourinsoft.key: Key
appolo.tourinsoft.content_type: Content type
appolo.tourinsoft.actions_for_flux: Actions for flux
appolo.tourinsoft.new_flux: New Flux
appolo.tourinsoft.flux_creation: Create a new flux
appolo.tourinsoft.save: Save
appolo.tourinsoft.return_to_flux_list: Return to flux list
appolo.tourinsoft.actions: Actions
appolo.tourinsoft.flux_update: Update flux
# Validator
appolo.tourinsoft.title_is_required: Title is required
appolo.tourinsoft.key_is_required: Key is required
appolo.tourinsoft.content_type_is_required: Content type is required
\ No newline at end of file
appolo.tourinsoft.updated_on: Mis à jour le
appolo.tourinsoft.are_you_sure_want_delete_flux: Êtes-vous sûr de vouloir supprimer ce flux?
appolo.tourinsoft.synchronize: Synchroniser
appolo.tourinsoft.select_an_action: Sélectionner une action
appolo.tourinsoft.id: "#"
appolo.tourinsoft.code: Code
appolo.tourinsoft.key: Clé
appolo.tourinsoft.content_type: Type de contenu
appolo.tourinsoft.actions_for_flux: Actions pour les flux
appolo.tourinsoft.new_flux: Nouveau Flux
appolo.tourinsoft.flux_creation: Création de Flux
appolo.tourinsoft.save: Enregistrer
appolo.tourinsoft.return_to_flux_list: Retourner à la liste des flux
appolo.tourinsoft.actions: Actions
appolo.tourinsoft.flux_update: Modification du flux
# Validator
appolo.tourinsoft.title_is_required: Le titre est requis
appolo.tourinsoft.key_is_required: La clé est requise
appolo.tourinsoft.content_type_is_required: Le type de contenu est requis
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment