Skip to content
Snippets Groups Projects
Commit 201e9cb6 authored by Alexandre Zvenigorosky's avatar Alexandre Zvenigorosky
Browse files

Affichage des années

parent 9ae9cc0d
No related branches found
No related tags found
3 merge requests!15Centres cout,!13Centres cout corrigés avec les bons droits,!11Centres cout
......@@ -97,7 +97,7 @@ return [
],
'form_elements' => [
'invokables' => [
Form\nommaj\Saisie::class => Form\nommaj\Saisie::class,
Form\nommaj\nommajSaisieForm::class => Form\nommaj\nommajSaisieForm::class,
],
],
];
......@@ -167,7 +167,7 @@ class modulateurController extends AbstractController
$this->flashMessenger()->addSuccessMessage('Enregistrement effectué');
} catch (\Exception $e) {
$e = DbException::translate($e);
$this->flashMessenger()->addErrorMessage($e->getMessage() . ':' . $tms->getId() . ':' . $tms->getTypeModulateur());
$this->flashMessenger()->addErrorMessage($e->getMessage());
}
});
......@@ -176,8 +176,6 @@ return compact('form', 'title');
public
function typeModulateurStructureDeleteAction()
{
......
......@@ -165,9 +165,9 @@ class TypeFormation implements HistoriqueAwareInterface, ImportAwareInterface
/**
* @param bool $serviceStatutaire
*
* @return FonctionReferentiel
* @return typeFormation
*/
public function setServiceStatutaire(bool $serviceStatutaire): FonctionReferentiel
public function setServiceStatutaire(bool $serviceStatutaire)
{
$this->serviceStatutaire = $serviceStatutaire;
......
<?php
namespace Application\Form\GroupeTypeFormation\Traits;
use Application\Form\GroupeTypeFormation\TypeFormationSaisieForm;
/**
* Description of TypeFormationSaisieFormAwareTrait
*
* @author UnicaenCode
*/
trait TypeFormationSaisieFormAwareTrait
{
/**
* @var TypeFormationSaisieForm
*/
private $formTypeFormationSaisie;
/**
* @param TypeFormationSaisieForm $formTypeFormationSaisie
*
* @return self
*/
public function setFormTypeFormationSaisie(TypeFormationSaisieForm $formTypeFormationSaisie)
{
$this->formTypeFormationSaisie = $formTypeFormationSaisie;
return $this;
}
/**
* Retourne un nouveau formulaire ou fieldset systématiquement, sauf si ce dernier a été fourni manuellement.
*
* @return TypeFormationSaisieForm
*/
public function getFormTypeFormationSaisie()
{
if (!empty($this->formTypeFormationSaisie)) {
return $this->formTypeFormationSaisie;
}
return \Application::$container->get('FormElementManager')->get(TypeFormationSaisieForm::class);
}
}
<?php
namespace Application\Form\GroupeTypeFormation;
use Application\Form\AbstractForm;
use Zend\Form\Element\Csrf;
use Zend\Stdlib\Hydrator\HydratorInterface;
use Application\Service\Traits\SourceServiceAwareTrait;
use Application\Service\Traits\GroupeTypeFormationServiceAwareTrait;
/**
* Description of TypeFormationSaisieForm
*
* @author ZVENIGOROSKY Alexandre <alexandre.zvenigorosky@unicaen.fr>
*/
class TypeFormationSaisieForm extends AbstractForm
{
use SourceServiceAwareTrait;
use GroupeTypeFormationServiceAwareTrait;
public function init()
{
$hydrator = new TypeFormationHydrator();
$this->setHydrator($hydrator);
$this->setAttribute('action', $this->getCurrentUrl());
$this->add([
'name' => 'groupe-type-formation',
'options' => [
'label' => "Groupe de type de formation",
],
'type' => 'Hidden',
]);
$this->add([
'name' => 'libelle-court',
'options' => [
'label' => "Libelle Court",
],
'type' => 'Text',
]);
$this->add([
'name' => 'libelle-long',
'options' => [
'label' => "Libelle Long",
],
'type' => 'Text',
]);
$this->add([
'name' => 'source-code',
'options' => [
'label' => "Source Code",
],
'type' => 'Text',
]);
$this->add([
'name' => 'source',
'options' => [
'label' => 'Source',
],
'attributes' => [
'class' => 'selectpicker',
'data-live-search' => 'true',
],
'type' => 'Select',
]);
$this->get('source')
->setValueOptions(\UnicaenApp\Util::collectionAsOptions($this->getServiceSource()->getList()));
$this->add([
'name' => 'statutaire',
'options' => [
'label' => "Service statutaire",
"checked_value" => 'true',
"unchecked_value" => 'false',
],
'type' => 'Checkbox',
]);
$this->add(new Csrf('security'));
$this->add([
'name' => 'submit',
'type' => 'Submit',
'attributes' => [
'value' => "Enregistrer",
'class' => 'btn btn-primary',
],
]);
return $this;
}
/**
* Should return an array specification compatible with
* {@link Zend\InputFilter\Factory::createInputFilter()}.
*
* @return array
*/
public function getInputFilterSpecification()
{
return [
'libelle-court' => [
'required' => true,
],
'libelle-long' => [
'required' => true,
],
'source' => [
'required' => true,
],
'statutaire' => [
'required' => true,
],
];
}
}
class TypeFormationHydrator implements HydratorInterface
{
use SourceServiceAwareTrait;
use GroupeTypeFormationServiceAwareTrait;
/**
* Hydrate $object with the provided $data.
*
* @param array $data
* @param \Application\Entity\Db\TypeFormation $object
*
* @return object
*/
public function hydrate(array $data, $object)
{
$object->setGroupe($this->getServiceGroupeTypeFormation()->getById($data['groupe-type-formation']));
$object->setLibelleCourt($data['libelle-court']);
$object->setLibelleLong($data['libelle-long']);
$object->setSourceCode($data['source-code']);
if (array_key_exists('source', $data)) {
$object->setSource($this->getServiceSource()->get($data['source']));
}
$object->setServiceStatutaire($data['statutaire']=='true');
return $object;
}
/**
* Extract values from an object
*
* @param \Application\Entity\Db\TypeFormation $object
*
* @return array
*/
public function extract($object)
{
$data = [
'id' => $object->getId()
, 'groupe-type-formation' => $object->getGroupe()->getId()
, 'libelle-court' => $object->getLibelleCourt()
, 'libelle-long' => $object->getLibelleLong()
, 'statutaire' => $object->isServiceStatutaire()?'true':'false'
, 'source-code' => $object->getSourceCode()
, 'source' => ($s = $object->getSource()) ? $s->getId() : null,
];
return $data;
}
}
......@@ -29,4 +29,24 @@ class GroupeTypeFormationService extends AbstractEntityService
public function getAlias(){
return 'gtf';
}
/**
* Retourne une entité à partir de son code
* Retourne null si le code est null
*
* @param string|string[] $code
* @return mixed|null
*/
public function getById($id)
{
if(is_array($id)){
list($qb,$alias) = $this->initQuery();
$qb->andWhere($alias.'.id IN (:'.$alias.'_id)')->setParameter($alias.'_id', $id);
return $this->getList( $qb );
}elseif ($id){
return $this->getRepo()->findOneBy(['id' => $id]);
}else{
return null;
}
}
}
\ No newline at end of file
<?php
/**
* @var $this \Application\View\Renderer\PhpRenderer
* @var $form \Application\Form\GroupeTypeFormation\GroupeTypeFormationSaisieForm
*/
echo $this->messenger()->addCurrentMessagesFromFlashMessenger();
echo $this->form($form);
......@@ -21,6 +21,12 @@ $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::MODULATEUR_EDI
?>
<h1 class="page-header">Modulateurs des taux horaires</h1>
<style>
h3 {
margin: 0px;
margin-bottom: 0.1em;
}
</style>
<?php
foreach ($typeModulateurs as $tm) {
if ($this->isAllowed($tm, Privileges::MODULATEUR_VISUALISATION)) { ?>
......@@ -58,6 +64,7 @@ foreach ($typeModulateurs as $tm) {
<div class="panel-body">
<div class="row">
<div class="col-md-3">
<h3>Règles</h3>
<div class="row">
<div class="col-md-9">Publique :</div>
<div class="col-md-3"><?= affBooleen($tm->getPublique()) ?></div>
......@@ -70,7 +77,10 @@ foreach ($typeModulateurs as $tm) {
<div class="col-md-9">Saisie par ens:</div>
<div class="col-md-3"><?= affBooleen($tm->getSaisieParEnseignant()) ?></div>
</div>
<table class="table table-bordered table-condensed">
<br/>
<h3>Composantes</h3>
<table class="table table-bordered table-condensed table-extra-condensed"
style="margin-top:0em; margin-bottom:.1em;">
<?php foreach ($typeModulateurStructures
as $tms) { ?>
<?php if ($tm->getId() == $tms->getTypeModulateur()->getId()) { ?>
......@@ -88,7 +98,8 @@ foreach ($typeModulateurs as $tm) {
<?php echo ($infoBulle ? '<abbr title="' . $infoBulle . '">' : '') . $tms->getStructure()->getLibelleCourt();
echo($infoBulle ? '</abbr>' : '');
if ($canEdit) { ?>
<a style="position:absolute; right:36px; " class="ajax-modal" data-event="modulateur-saisie"
<a style="position:absolute; right:36px; " class="ajax-modal"
data-event="modulateur-saisie"
href="<?= $this->url('modulateur/type-modulateur-structure-saisie', ['typeModulateur' => $tm->getId(), 'typeModulateurStructure' => $tms->getId()]) ?>"
title="Ajouter un type de modulateur pour une structure">
<span class="glyphicon glyphicon-edit"></span>
......@@ -114,11 +125,12 @@ foreach ($typeModulateurs as $tm) {
<a class="ajax-modal" data-event="modulateur-saisie"
href="<?= $this->url('modulateur/type-modulateur-structure-saisie', ['typeModulateur' => $tm->getId()]) ?>"
title="Ajouter un type de modulateur pour une structure">
<button type="button" class="btn-xs btn-primary">Ajouter une structure</button>
<button type="button" class="btn btn-xs btn-primary">Ajouter une structure</button>
</a>
<?php } ?>
</div>
<div class="col-md-9">
<h3>Taux</h3>
<table class="table table-bordered">
<thead>
<th>Code</th>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment