Skip to content
Snippets Groups Projects
Commit 8d3f8b58 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Ammélioration pour affichage des listes de niveaux dans la page offre de...

Ammélioration pour affichage des listes de niveaux dans la page offre de formation si niveau pertinence égal à 0
parent 8cd42b26
No related branches found
No related tags found
No related merge requests found
......@@ -59,7 +59,7 @@ class OffreFormationController extends AbstractController
$params = [];
if ($structure) $params['structure'] = $structure->getId();
if ($niveau) $params['niveau'] = $niveau->getId();
if ($niveau) $params['niveau'] = ($niveau->getPertinence()) ? $niveau->getId() : $niveau->getLib();
if ($etape) $params['etape'] = $etape->getId();
......@@ -82,7 +82,6 @@ class OffreFormationController extends AbstractController
}
public function exportAction()
{
$this->initFilters();
......@@ -174,14 +173,12 @@ class OffreFormationController extends AbstractController
}
public function administrationOffreAction()
{
return [];
}
public function reconductionAction()
{
$this->initFilterHistorique();
......@@ -238,7 +235,6 @@ class OffreFormationController extends AbstractController
}
public function reconductionCentreCoutAction()
{
$this->initFilterHistorique();
......@@ -290,7 +286,6 @@ class OffreFormationController extends AbstractController
}
public function reconductionModulateurAction()
{
$this->initFilterHistorique();
......@@ -343,7 +338,6 @@ class OffreFormationController extends AbstractController
}
protected function initFilters()
{
$this->initFilterAnnee();
......@@ -351,7 +345,6 @@ class OffreFormationController extends AbstractController
}
protected function initFilterAnnee()
{
$this->em()->getFilters()->enable('annee')->init([
......@@ -362,7 +355,6 @@ class OffreFormationController extends AbstractController
}
protected function initFilterHistorique()
{
/* Mise en place des filtres */
......@@ -377,14 +369,12 @@ class OffreFormationController extends AbstractController
}
protected function disableFilters($name)
{
$this->em()->getFilters()->disable($name);
}
protected function getParams()
{
$structure = $this->context()->structureFromQuery() ?: $this->getServiceContext()->getStructure();
......
......@@ -25,6 +25,8 @@ class NiveauEtape
*/
protected $lib;
protected $pertinence;
/**
*
* @param \Application\Entity\Db\Etape $etape
......@@ -93,6 +95,11 @@ class NiveauEtape
return $this->lib;
}
public function getPertinence()
{
return $this->pertinence;
}
public function setNiv($niv)
{
$this->niv = $niv;
......@@ -105,11 +112,18 @@ class NiveauEtape
return $this;
}
public function setPertinence($pertinence)
{
$this->pertinence = $pertinence;
return $this;
}
public function setEtape(Etape $etape)
{
$this->etape = $etape;
$this->niv = $this->etape->getNiveau();
$this->lib = $this->etape->getTypeFormation()->getGroupe()->getLibelleCourt();
$this->pertinence = $this->etape->getTypeFormation()->getGroupe()->getPertinenceNiveau();
return $this;
}
}
\ No newline at end of file
......@@ -22,8 +22,9 @@ class NiveauEtapeService extends AbstractService
return null;
}
$tiretPos = strrpos($id, '-');
$groupeTypeFormationLibelleCourt = substr( $id, 0, $tiretPos );
$niv = substr( $id, $tiretPos+1 );
$groupeTypeFormationLibelleCourt = (!$tiretPos) ? $id : substr($id, 0, $tiretPos);
$niv = (!$tiretPos) ? false : substr($id, $tiretPos + 1);
if ($niv === false) $niv = null;
$niveau = new NiveauEtape();
......
......@@ -30,13 +30,11 @@ class OffreFormationService extends AbstractEntityService
}
public function getAlias()
{
}
public function getNeep($structure, $niveau, $etape, $annee = null, $source = null)
{
if ($etape) {
......@@ -57,7 +55,7 @@ class OffreFormationService extends AbstractEntityService
$dql = 'SELECT
partial e.{id,code,annee,libelle,sourceCode,niveau,histoDestruction},
partial tf.{id},
partial gtf.{id, libelleCourt, ordre},
partial gtf.{id, libelleCourt, ordre, pertinenceNiveau},
partial ep.{id,code,libelle,sourceCode,etape,periode,tauxFoad,fi,fc,fa,tauxFi,tauxFc,tauxFa},
partial vme.{id,heures, groupes}
FROM
......@@ -92,9 +90,14 @@ class OffreFormationService extends AbstractEntityService
if ($object instanceof Etape) {
$n = NiveauEtape::getInstanceFromEtape($object);
if ($object->estNonHistorise()) {
$gtf = $object->getTypeFormation()->getGroupe()->getPertinenceNiveau();
if ($gtf) {
$niveaux[$n->getId()] = $n;
} else {
$niveaux[$n->getLib()] = $n;
}
if (!$niveau || $niveau->getId() == $n->getId()) {
}
if (!$niveau || ($niveau->getId() == $n->getId() && $n->getPertinence()) || ($niveau->getLib() == $n->getLib() && !$n->getPertinence())) {
if ($object->estNonHistorise() || $object->getElementPedagogique()->count() > 0) {
$etapes[] = $object;
}
......@@ -122,11 +125,11 @@ class OffreFormationService extends AbstractEntityService
return $e1Lib > $e2Lib ? 1 : 0;
});
return [$niveaux, $etapes, $elements];
}
public function getNeepEtape($etape)
{
$niveaux = [];
......@@ -176,7 +179,6 @@ class OffreFormationService extends AbstractEntityService
}
/**
* @return array
*/
......@@ -250,7 +252,6 @@ class OffreFormationService extends AbstractEntityService
}
public function createMappingEtapeNEtapeN1($etapesN, $etapesN1)
{
$codesEtapeN = [];
......
......@@ -24,7 +24,7 @@ function makeQuery($structure = null, $niveau = null, $etape = null)
$params = [];
//@formatter:off
if ($structure) $params['structure'] = $structure->getId();
if ($niveau) $params['niveau'] = $niveau->getId();
if ($niveau) $params['niveau'] = ($niveau->getPertinence()) ? $niveau->getId() : $niveau->getLib();
if ($etape) $params['etape'] = $etape->getId();
//@formatter:on
......@@ -41,9 +41,9 @@ $niveauxItems = [
],
];
foreach ($niveaux as $niv) {
$niveauxItems[$niv->getId()] = [
'label' => (string)$niv,
foreach ($niveaux as $code => $niv) {
$niveauxItems[$code] = [
'label' => ($niv->getPertinence()) ? (string)$niv : $code,
'niveau' => $niv,
'url' => $this->url('of', [], makeQuery($structure, $niv)),
];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment