Commit 0acf0a20 authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

Merge branch 'master' of https://git.unicaen.fr/open-source/OSE

parents 17db675c f0f10edf
......@@ -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();
......@@ -119,30 +118,30 @@ class OffreFormationController extends AbstractController
foreach ($elements as $element) {
$cm = '0';
$td = '0';
$tp = '0';
$cm = '0';
$td = '0';
$tp = '0';
$cmGroupe = '0';
$tdGroupe = '0';
$tpGroupe = '0';
foreach ($element->getVolumeHoraireEns() as $vhe) {
if ($vhe->getTypeIntervention()->getCode() == 'CM') {
$cm = (!empty($vhe->getHeures())) ? $vhe->getHeures() : '0';
$cm = (!empty($vhe->getHeures())) ? $vhe->getHeures() : '0';
$cmGroupe = (!empty($vhe->getGroupes())) ? $vhe->getGroupes() : '0';
}
if ($vhe->getTypeIntervention()->getCode() == 'TD') {
$td = (!empty($vhe->getHeures())) ? $vhe->getHeures() : '0';
$td = (!empty($vhe->getHeures())) ? $vhe->getHeures() : '0';
$tdGroupe = (!empty($vhe->getGroupes())) ? $vhe->getGroupes() : '0';
}
if ($vhe->getTypeIntervention()->getCode() == 'TP') {
$tp = (!empty($vhe->getHeures())) ? $vhe->getHeures() : '0';
$tp = (!empty($vhe->getHeures())) ? $vhe->getHeures() : '0';
$tpGroupe = (!empty($vhe->getGroupes())) ? $vhe->getGroupes() : '0';
}
}
$etape = $element->getEtape();
$effectifs = $element->getEffectifs();
$etape = $element->getEtape();
$effectifs = $element->getEffectifs();
$discipline = $element->getDiscipline();
$csvModel->addLine([
$etape->getCode(),
......@@ -174,14 +173,12 @@ class OffreFormationController extends AbstractController
}
public function administrationOffreAction()
{
return [];
}
public function reconductionAction()
{
$this->initFilterHistorique();
......@@ -198,13 +195,13 @@ class OffreFormationController extends AbstractController
[$offresComplementaires, $mappingEtape, $reconductionTotale] = $this->getServiceOffreFormation()->getOffreComplementaire($structure, $niveau, $etape);
$reconductionStep = '';
$messageStep = '';
$fromPost = false;
$messageStep = '';
$fromPost = false;
$request = $this->getRequest();
if ($request->isPost()) {
$datas = $request->getPost();
$datas = $request->getPost();
$fromPost = true;
//Ajout du mapping des EtapesN et EtapesN1 pour pouvoir reconduire un element pédagogique sur une etape déjà reconduite.
$datas['mappingEtape'] = $mappingEtape;
......@@ -219,7 +216,7 @@ class OffreFormationController extends AbstractController
}
} catch (\Exception $e) {
$reconductionStep = false;
$messageStep = $e->getMessage();
$messageStep = $e->getMessage();
$this->flashMessenger()->addErrorMessage($e->getMessage());
}
}
......@@ -238,7 +235,6 @@ class OffreFormationController extends AbstractController
}
public function reconductionCentreCoutAction()
{
$this->initFilterHistorique();
......@@ -259,7 +255,7 @@ class OffreFormationController extends AbstractController
$datas = $request->getPost();
//Reconduire les centres de coût des EP de l'étape.
try {
$etapesReconduites = $this->getServiceEtape()->getEtapeCentreCoutReconductible($structure);
$etapesReconduites = $this->getServiceEtape()->getEtapeCentreCoutReconductible($structure);
$etapesReconduitesCc = [];
if (isset($datas['etapes'])) {
foreach ($datas['etapes'] as $code) {
......@@ -268,7 +264,7 @@ class OffreFormationController extends AbstractController
}
}
}
$result = $this->getProcessusReconduction()->reconduireCCFormation($etapesReconduitesCc);
$result = $this->getProcessusReconduction()->reconduireCCFormation($etapesReconduitesCc);
$etapesReconduites = $this->getServiceEtape()->getEtapeCentreCoutReconductible($structure);
$this->flashMessenger()->addSuccessMessage("$result centre(s) de coût(s) ont été reconduit pour l'année prochaine. ");
......@@ -290,14 +286,13 @@ class OffreFormationController extends AbstractController
}
public function reconductionModulateurAction()
{
$this->initFilterHistorique();
[$structure, $niveau, $etape] = $this->getParams();
$etapesReconduites = [];
$role = $this->getServiceContext()->getSelectedIdentityRole();
$role = $this->getServiceContext()->getSelectedIdentityRole();
$qb = $this->getServiceStructure()->finderByHistorique();
$this->getServiceStructure()->finderByEnseignement($qb);
......@@ -307,7 +302,7 @@ class OffreFormationController extends AbstractController
$request = $this->getRequest();
if ($request->isPost()) {
$datas = $request->getPost();
$datas = $request->getPost();
$etapesReconduites = $this->getServiceEtape()->getEtapeModulateurReconductible($structure);
try {
$etapesReconduitesCc = [];
......@@ -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,19 +369,17 @@ class OffreFormationController extends AbstractController
}
protected function disableFilters($name)
{
$this->em()->getFilters()->disable($name);
}
protected function getParams()
{
$structure = $this->context()->structureFromQuery() ?: $this->getServiceContext()->getStructure();
$niveau = $this->context()->niveauFromQuery();
$etape = $this->context()->etapeFromQuery();
$niveau = $this->context()->niveauFromQuery();
$etape = $this->context()->etapeFromQuery();
if ($niveau) $niveau = $this->getServiceNiveauEtape()->get($niveau); // entité Niveau
return [$structure, $niveau, $etape];
......
......@@ -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->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
......@@ -18,14 +18,15 @@ class NiveauEtapeService extends AbstractService
*/
public function get($id)
{
if (null === $id || 0 === $id || '-' === $id){
if (null === $id || 0 === $id || '-' === $id) {
return null;
}
$tiretPos = strrpos($id,'-');
$groupeTypeFormationLibelleCourt = substr( $id, 0, $tiretPos );
$niv = substr( $id, $tiretPos+1 );
$tiretPos = strrpos($id, '-');
$groupeTypeFormationLibelleCourt = (!$tiretPos) ? $id : substr($id, 0, $tiretPos);
$niv = (!$tiretPos) ? false : substr($id, $tiretPos + 1);
if ($niv === false) $niv = null;
$niveau = new NiveauEtape();
$niveau->setLib($groupeTypeFormationLibelleCourt);
$niveau->setNiv($niv);
......
......@@ -30,13 +30,11 @@ class OffreFormationService extends AbstractEntityService
}
public function getAlias()
{
}
public function getNeep($structure, $niveau, $etape, $annee = null, $source = null)
{
if ($etape) {
......@@ -50,14 +48,14 @@ class OffreFormationService extends AbstractEntityService
if (!$structure) return [[], [], []];
$niveaux = [];
$etapes = [];
$niveaux = [];
$etapes = [];
$elements = [];
$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()) {
$niveaux[$n->getId()] = $n;
$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,15 +125,15 @@ class OffreFormationService extends AbstractEntityService
return $e1Lib > $e2Lib ? 1 : 0;
});
return [$niveaux, $etapes, $elements];
}
public function getNeepEtape($etape)
{
$niveaux = [];
$etapes = [];
$niveaux = [];
$etapes = [];
$elements = [];
$dql = 'SELECT
......@@ -155,12 +158,12 @@ class OffreFormationService extends AbstractEntityService
/** @var CheminPedagogique $object */
if ($object->estHistorise()) continue;
$etape = $object->getEtape();
$etape = $object->getEtape();
$element = $object->getElementPedagogique();
$n = NiveauEtape::getInstanceFromEtape($etape);
$niveaux[$n->getId()] = $n;
$etapes[$etape->getId()] = $etape;
$n = NiveauEtape::getInstanceFromEtape($etape);
$niveaux[$n->getId()] = $n;
$etapes[$etape->getId()] = $etape;
$elements[$element->getId()] = $element;
}
......@@ -176,7 +179,6 @@ class OffreFormationService extends AbstractEntityService
}
/**
* @return array
*/
......@@ -184,9 +186,9 @@ class OffreFormationService extends AbstractEntityService
public function getOffreComplementaire($structure, $niveau, $etape)
{
$offresComplementaires = [];
$anneeEnCours = $this->getServiceContext()->getAnnee();
$anneeSuivante = $this->getServiceAnnee()->getSuivante($anneeEnCours);
$source = $this->getServiceSource()->getOse();
$anneeEnCours = $this->getServiceContext()->getAnnee();
$anneeSuivante = $this->getServiceAnnee()->getSuivante($anneeEnCours);
$source = $this->getServiceSource()->getOse();
$this->getServiceLocalContext()
->setStructure($structure)
......@@ -200,9 +202,9 @@ class OffreFormationService extends AbstractEntityService
[$niveauxN1, $etapesN1, $elementsN1] = $this->getNeep($structure, $niveau, $etape, $anneeSuivante, $source);
//Organisation pour traitement dans la vue
$codesEtapeN1 = [];
$codesElementN1 = [];
$etapesNonReconduits = array_diff($etapes, $etapesN1);
$codesEtapeN1 = [];
$codesElementN1 = [];
$etapesNonReconduits = array_diff($etapes, $etapesN1);
$elementsNonReconduits = array_diff($elements, $elementsN1);
$reconductionTotale = 'non';
......@@ -223,8 +225,8 @@ class OffreFormationService extends AbstractEntityService
continue;
}*/
$offresComplementaires[$v->getId()]['reconduction_partiel'] = 'non';
$offresComplementaires[$v->getId()]['reconduction'] = (in_array($v->getCode(), $codesEtapeN1)) ? 'oui' : 'non';
$offresComplementaires[$v->getId()]['etape'] = $v;
$offresComplementaires[$v->getId()]['reconduction'] = (in_array($v->getCode(), $codesEtapeN1)) ? 'oui' : 'non';
$offresComplementaires[$v->getId()]['etape'] = $v;
$offresComplementaires[$v->getId()]['elements_pedagogique'] = [];
}
......@@ -241,7 +243,7 @@ class OffreFormationService extends AbstractEntityService
}
$offresComplementaires[$etapeId]['elements_pedagogique'][$v->getId()]['reconduction'] = (in_array($v->getCode(), $codesElementN1)) ? 'oui' : 'non';
$offresComplementaires[$etapeId]['elements_pedagogique'][$v->getId()]['element'] = $v;
$offresComplementaires[$etapeId]['elements_pedagogique'][$v->getId()]['element'] = $v;
}
$mappingEtape = $this->createMappingEtapeNEtapeN1($etapes, $etapesN1);
......@@ -250,10 +252,9 @@ class OffreFormationService extends AbstractEntityService
}
public function createMappingEtapeNEtapeN1($etapesN, $etapesN1)
{
$codesEtapeN = [];
$codesEtapeN = [];
$codesEtapeN1 = [];
$mappingEtape = [];
......
......@@ -16,16 +16,16 @@ use Application\Provider\Privilege\Privileges;
/**
* @param \Application\Entity\Db\Structure $structure
* @param \Application\Entity\NiveauEtape $niveau
* @param \Application\Entity\Db\Etape $etape
* @param \Application\Entity\NiveauEtape $niveau
* @param \Application\Entity\Db\Etape $etape
*/
function makeQuery($structure = null, $niveau = null, $etape = null)
{
$params = [];
//@formatter:off
if ($structure) $params['structure'] = $structure->getId();
if ($niveau) $params['niveau'] = $niveau->getId();
if ($etape) $params['etape'] = $etape->getId();
if ($structure) $params['structure'] = $structure->getId();
if ($niveau) $params['niveau'] = ($niveau->getPertinence()) ? $niveau->getId() : $niveau->getLib();
if ($etape) $params['etape'] = $etape->getId();
//@formatter:on
return ['query' => $params];
......@@ -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)),
];
......@@ -77,8 +77,8 @@ if ($structure) {
}
$this->headTitle()->append("Offre de formation");
$canExport = $this->isAllowed(Privileges::getResourceId(Privileges::ODF_EXPORT_CSV)) && count($elements);
$canViewEtape = $this->isAllowed(Privileges::getResourceId(Privileges::ODF_ETAPE_VISUALISATION));
$canExport = $this->isAllowed(Privileges::getResourceId(Privileges::ODF_EXPORT_CSV)) && count($elements);
$canViewEtape = $this->isAllowed(Privileges::getResourceId(Privileges::ODF_ETAPE_VISUALISATION));
$canEditElement = $this->isAllowed($structure, Privileges::ODF_ELEMENT_EDITION);
$canSyncElement = $this->isAllowed(Privileges::getResourceId(Privileges::ODF_ELEMENT_SYNCHRONISATION));
?>
......@@ -236,7 +236,7 @@ $canSyncElement = $this->isAllowed(Privileges::getResourceId(Privileges::ODF_ELE
echo $this->tag('a', $attrs)->html('<i class="fas fa-plus"></i> Nouvel enseignement');
}
if ($canExport) {
$params = [
$params = [
'structure' => $structure ? $structure->getId() : null,
'niveau' => $niveau ? $niveau->getId() : null,
'etape' => $etape ? $etape->getId() : null,
......
Supports Markdown
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