Commit 184b62ca authored by Alexandre Zvenigorosky's avatar Alexandre Zvenigorosky
Browse files

modified: module/Application/config/modulateur.config.php

	modified:   module/Application/src/Application/Controller/ModulateurController.php
	modified:   module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.TypeModulateurStructure.dcm.xml
	modified:   module/Application/src/Application/Entity/Db/TypeModulateurStructure.php
	new file:   module/Application/src/Application/Form/Modulateur/Traits/TypeModulateurStructureSaisieFormAwareTrait.php
	new file:   module/Application/src/Application/Form/Modulateur/TypeModulateurStructureSaisieForm.php
	modified:   module/Application/src/Application/Service/TypeModulateurService.php
	modified:   module/Application/view/application/modulateur/index.phtml
	new file:   module/Application/view/application/modulateur/type-modulateur-structure-saisie.phtml
parent df676386
$this->add([
'name' => 'champtiret',
'options' => [
'label' => "champphrase",
],
'type' => 'Text',
]);
$this->add([
'name' => 'champtiret',
'options' => [
'label' => 'champphrase',
],
'attributes' => [
'class' => 'selectpicker',
'data-live-search' => 'true',
],
'type' => 'Select',
]);
$this->get('champtiret')
->setEmptyOption("(Aucun)")
->setValueOptions(\UnicaenApp\Util::collectionAsOptions($this->getServicechampmaj()->getList()));
<?php
namespace Application;
use Application\Provider\Privilege\Privileges;
use UnicaenAuth\Guard\PrivilegeController;
return [
'router' => [
'routes' => [
'nomtiret' => [
'type' => 'Literal',
'options' => [
'route' => '/nomtiret',
'defaults' => [
'controller' => 'Application\Controller\nommaj',
'action' => 'index',
],
],
'may_terminate' => true,
'child_routes' => [
'delete' => [
'type' => 'Segment',
'options' => [
'route' => '/delete/:nomtiret',
'constraints' => [
'nomtiret' => '[0-9]*',
],
'defaults' => [
'action' => 'delete',
],
],
],
'saisie' => [
'type' => 'Segment',
'options' => [
'route' => '/saisie/[:nomtiret]',
'constraints' => [
'nomtiret' => '[0-9]*',
],
'defaults' => [
'action' => 'saisie',
],
],
],
],
],
],
],
'navigation' => [
'default' => [
'home' => [
'pages' => [
'administration' => [
'pages' => [
'nomtiret' => [
'label' => 'nommaj',
'icon' => 'fa fa-graduation-cap',
'route' => 'nomtiret',
'resource' => PrivilegeController::getResourceId('Application\Controller\nommaj', 'index'),
'order' => 80,
'border-color' => '#BBCF55',
],
],
],
],
],
],
],
'bjyauthorize' => [
'guards' => [
PrivilegeController::class => [
[
'controller' => 'Application\Controller\nommaj',
'action' => ['index'],
'privileges' => Privileges::droitvisualisation,
],
[
'controller' => 'Application\Controller\nommaj',
'action' => ['saisie','delete'],
'privileges' => Privileges::droitedition,
],
],
],
],
'controllers' => [
'invokables' => [
'Application\Controller\nommaj' => Controller\nommajController::class,
],
],
'service_manager' => [
'invokables' => [
Service\nommajService::class => Service\nommajService::class,
],
],
'view_helpers' => [
],
'form_elements' => [
'invokables' => [
Form\nommaj\Saisie::class => Form\nommaj\Saisie::class,
],
],
];
<?php
namespace Application\Controller;
use Application\Entity\Db\nommaj;
use Application\Service\Traits\nommajServiceAwareTrait;
use Application\Exception\DbException;
use Application\Form\nommaj\Traits\nommajSaisieFormAwareTrait;
use UnicaenApp\View\Model\MessengerViewModel;
class nommajController extends AbstractController
{
use nommajServiceAwareTrait;
use nommajSaisieFormAwareTrait;
public function indexAction()
{
$this->em()->getFilters()->enable('historique')->init([
nommaj::class,
]);
$nomms = $this->getServicenommaj()->getList();
return compact('nomms');
}
public function saisieAction()
{
/* @var $nomm nommaj */
$nomm = $this->getEvent()->getParam('nomtiret');
$form = $this->getFormnommajSaisie();
if (empty($nomm)) {
$title = 'Création d\'une nouvelle nommaj';
$nomm = $this->getServicenommaj()->newEntity();
} else {
$title = 'Édition d\'une nommaj';
}
$form->bindRequestSave($nomm, $this->getRequest(), function (nommaj $fr) {
try {
$this->getServicenommaj()->save($fr);
$this->flashMessenger()->addSuccessMessage('Enregistrement effectué');
} catch (\Exception $e) {
$e = DbException::translate($e);
$this->flashMessenger()->addErrorMessage($e->getMessage() . ':' . $fr->getId());
}
});
return compact('form', 'title');
}
public function deleteAction()
{
$nomm = $this->getEvent()->getParam('nomtiret');
try {
$this->getServicenommaj()->delete($nomm);
$this->flashMessenger()->addSuccessMessage("nommaj supprimée avec succès.");
} catch (\Exception $e) {
$this->flashMessenger()->addErrorMessage(DbException::translate($e)->getMessage());
}
return new MessengerViewModel(compact('nomm'));
}
}
<?php
/**
* @var $this \Application\View\Renderer\PhpRenderer
* @var $nomms \Application\Entity\Db\nommaj[]
*/
use Application\Provider\Privilege\Privileges;
$this->headTitle()->append("nomsouss");
$canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::droitedition));
?>
<h1 class="page-header">nomsouss</h1>
<table class="table table-bordered table-sort">
<thead>
<?php if ($canEdit) echo '<th>Actions</th>' ?>
</thead>
<tbody>
<?php foreach ($nomms as $fr): ?>
<tr>
<?php if ($canEdit) { ?>
<td style="text-align:center;width:1px;white-space: nowrap">
<a class="ajax-modal" data-event="nomtiret-saisie"
href="<?= $this->url('nomtiret/saisie', ['nomtiret' => $fr->getId()]) ?>"
title="Modifier la nommaj">
<span class="glyphicon glyphicon-edit"></span></a>
<a class="pop-ajax"
href="<?= $this->url('nomtiret/delete', ['nomtiret' => $fr->getId()]) ?>"
title="Supprimer la nommaj"
data-content="<p class='lead text-danger'><strong>Attention!</strong> Confirmez-vous cette suppression ?</p>"
data-confirm="true"
data-confirm-button="Oui"
data-cancel-button="Non"
data-submit-reload="true"
>
<span class="glyphicon glyphicon-remove"></span>
</a>
</td>
<?php } ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php if ($canEdit): ?>
<a class="btn btn-primary ajax-modal" data-event="nomtiret-saisie"
href="<?= $this->url('nomtiret/saisie') ?>"
title="Ajouter une nomsous">
<span class="glyphicon glyphicon-edit"></span>
Ajouter une nomsous</a>
<script type="text/javascript">
$(function () {
$("body").on("nomtiret-saisie", function (event, data) {
window.location.reload();
});
});
</script>
<?php endif ?>
<?php
namespace Application\Form\nommaj\Traits;
use Application\Form\nommaj\nommajSaisieForm;
/**
* Description of nommajSaisieFormAwareTrait
*
* @author UnicaenCode
*/
trait nommajSaisieFormAwareTrait
{
/**
* @var nommajSaisieForm
*/
private $formnommajSaisie;
/**
* @param nommajSaisieForm $formnommajSaisie
*
* @return self
*/
public function setFormnommajSaisie(nommajSaisieForm $formnommajSaisie)
{
$this->formnommajSaisie = $formnommajSaisie;
return $this;
}
/**
* Retourne un nouveau formulaire ou fieldset systématiquement, sauf si ce dernier a été fourni manuellement.
*
* @return nommajSaisieForm
*/
public function getFormnommajSaisie()
{
if (!empty($this->formnommajSaisie)) {
return $this->formnommajSaisie;
}
return \Application::$container->get('FormElementManager')->get(nommajSaisieForm::class);
}
}
<?php
/**
* @var $this \Application\View\Renderer\PhpRenderer
* @var $form \Application\Form\nommaj\nommajSaisieForm
*/
echo $this->messenger()->addCurrentMessagesFromFlashMessenger();
echo $this->form($form);
<?php
namespace Application\Service\Traits;
use Application\Service\nommajService;
/**
* Description of nommajAwareTrait
*
* @author UnicaenCode
*/
trait nommajServiceAwareTrait
{
/**
* @var nommajService
*/
private $servicenommaj;
/**
* @param nommajService $servicenommaj
*
* @return self
*/
public function setServicenommaj(nommajService $servicenommaj)
{
$this->servicenommaj = $servicenommaj;
return $this;
}
/**
* @return nommajService
*/
public function getServicenommaj()
{
if (empty($this->servicenommaj)) {
$this->servicenommaj = \Application::$container->get(nommajService::class);
}
return $this->servicenommaj;
}
}
<?php
namespace Application\Service;
use Doctrine\ORM\QueryBuilder;
/**
* Description of nommaj
*
*/
class nommajService extends AbstractEntityService
{
/**
* retourne la classe des entit?s
*
* @return string
* @throws RuntimeException
*/
public function getEntityClass()
{
return \Application\Entity\Db\nommaj::class;
}
/**
* Retourne l'alias d'entit? courante
*
* @return string
*/
public function getAlias()
{
return 'fr';
}
public function getList(QueryBuilder $qb = null, $alias = null)
{
list($qb, $alias) = $this->initQuery();
return parent::getList($qb, $alias);
}
}
......@@ -147,37 +147,33 @@
},
{
"name": "doctrine/cache",
"version": "v1.7.1",
"version": "v1.6.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "b3217d58609e9c8e661cd41357a54d926c4a2a1a"
"reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/b3217d58609e9c8e661cd41357a54d926c4a2a1a",
"reference": "b3217d58609e9c8e661cd41357a54d926c4a2a1a",
"url": "https://api.github.com/repos/doctrine/cache/zipball/eb152c5100571c7a45470ff2a35095ab3f3b900b",
"reference": "eb152c5100571c7a45470ff2a35095ab3f3b900b",
"shasum": ""
},
"require": {
"php": "~7.1"
"php": "~5.5|~7.0"
},
"conflict": {
"doctrine/common": ">2.2,<2.4"
},
"require-dev": {
"alcaeus/mongo-php-adapter": "^1.1",
"mongodb/mongodb": "^1.1",
"phpunit/phpunit": "^5.7",
"predis/predis": "~1.0"
},
"suggest": {
"alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver"
"phpunit/phpunit": "~4.8|~5.0",
"predis/predis": "~1.0",
"satooshi/php-coveralls": "~0.6"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.7.x-dev"
"dev-master": "1.6.x-dev"
}
},
"autoload": {
......@@ -217,24 +213,24 @@
"cache",
"caching"
],
"time": "2017-08-25T07:02:50+00:00"
"time": "2017-07-22T12:49:21+00:00"
},
{
"name": "doctrine/collections",
"version": "v1.5.0",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/collections.git",
"reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf"
"reference": "1a4fb7e902202c33cce8c55989b945612943c2ba"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/collections/zipball/a01ee38fcd999f34d9bfbcee59dbda5105449cbf",
"reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf",
"url": "https://api.github.com/repos/doctrine/collections/zipball/1a4fb7e902202c33cce8c55989b945612943c2ba",
"reference": "1a4fb7e902202c33cce8c55989b945612943c2ba",
"shasum": ""
},
"require": {
"php": "^7.1"
"php": "^5.6 || ^7.0"
},
"require-dev": {
"doctrine/coding-standard": "~0.1@dev",
......@@ -284,7 +280,7 @@
"collections",
"iterator"
],
"time": "2017-07-22T10:37:32+00:00"
"time": "2017-01-03T10:49:41+00:00"
},
{
"name": "doctrine/common",
......@@ -361,26 +357,24 @@
},
{
"name": "doctrine/dbal",
"version": "v2.6.3",
"version": "v2.5.13",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "e3eed9b1facbb0ced3a0995244843a189e7d1b13"
"reference": "729340d8d1eec8f01bff708e12e449a3415af873"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/e3eed9b1facbb0ced3a0995244843a189e7d1b13",
"reference": "e3eed9b1facbb0ced3a0995244843a189e7d1b13",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/729340d8d1eec8f01bff708e12e449a3415af873",
"reference": "729340d8d1eec8f01bff708e12e449a3415af873",
"shasum": ""
},
"require": {
"doctrine/common": "^2.7.1",
"ext-pdo": "*",
"php": "^7.1"
"doctrine/common": ">=2.4,<2.8-dev",
"php": ">=5.3.2"
},
"require-dev": {
"phpunit/phpunit": "^5.4.6",
"phpunit/phpunit-mock-objects": "!=3.2.4,!=3.2.5",
"phpunit/phpunit": "4.*",
"symfony/console": "2.*||^3.0"
},
"suggest": {
......@@ -392,7 +386,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.6.x-dev"
"dev-master": "2.5.x-dev"
}
},
"autoload": {
......@@ -430,7 +424,7 @@
"persistence",
"queryobject"
],
"time": "2017-11-19T13:38:54+00:00"
"time": "2017-07-22T20:44:48+00:00"
},
{
"name": "doctrine/doctrine-module",
......@@ -590,20 +584,20 @@
},
{
"name": "doctrine/inflector",
"version": "v1.3.0",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/inflector.git",
"reference": "5527a48b7313d15261292c149e55e26eae771b0a"
"reference": "e11d84c6e018beedd929cff5220969a3c6d1d462"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a",
"reference": "5527a48b7313d15261292c149e55e26eae771b0a",
"url": "https://api.github.com/repos/doctrine/inflector/zipball/e11d84c6e018beedd929cff5220969a3c6d1d462",
"reference": "e11d84c6e018beedd929cff5220969a3c6d1d462",
"shasum": ""
},
"require": {
"php": "^7.1"
"php": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.2"
......@@ -611,7 +605,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
"dev-master": "1.2.x-dev"
}
},
"autoload": {
......@@ -653,36 +647,36 @@
"singularize",
"string"
],
"time": "2018-01-09T20:05:19+00:00"
"time": "2017-07-22T12:18:28+00:00"
},
{
"name": "doctrine/instantiator",
"version": "1.1.0",
"version": "1.0.5",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda"
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda",
"reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d",
"reference": "8e884e78f9f0eb1329e445619e04456e64d8051d",
"shasum": ""
},
"require": {
"php": "^7.1"
"php": ">=5.3,<8.0-DEV"
},
"require-dev": {
"athletic/athletic": "~0.1.8",
"ext-pdo": "*",
"ext-phar": "*",
"phpunit/phpunit": "^6.2.3",
"squizlabs/php_codesniffer": "^3.0.2"
"phpunit/phpunit": "~4.0",
"squizlabs/php_codesniffer": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
"dev-master": "1.0.x-dev"
}