Commit d3fc0462 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

co-encadrant pour UR

parent 959bf5d8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -187,14 +187,14 @@ class CoEncadrantController extends AbstractActionController {
        $records = [];
        foreach ($listing as $item) {
            $entry = [];
            $entry['Co-endrants'] = $item['co-encadrant']->getIndividu()->getPrenom1() . " " . $item['co-encadrant']->getIndividu()->getNomUsuel();
            $entry['Co-endrant'] = $item['co-encadrant']->getIndividu()->getPrenom1() . " " . $item['co-encadrant']->getIndividu()->getNomUsuel();
            $entry['Nombre d\'encadrements actuels'] = count($item['theses']);
            $entry['Listing'] = implode(';',
                array_map(function(These $t) {return $t->getDoctorant()->getIndividu()->getPrenom1() . " " . $t->getDoctorant()->getIndividu()->getNomUsuel();}, $item['theses'])
            );
            $records[] = $entry;
        }
        $filename = (new DateTime())->format('Ymd-His') . '_coencadrants-' . $structure->getSigle() . 'csv';
        $filename = (new DateTime())->format('Ymd-His') . '_coencadrants-' . str_replace(' ','_',$structure->getSigle()) . '.csv';
        $CSV = new CsvModel();
        $CSV->setDelimiter(';');
        $CSV->setEnclosure('"');
+4 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ namespace Application\Controller\Factory;

use Application\Controller\UniteRechercheController;
use Application\Form\UniteRechercheForm;
use Application\Service\CoEncadrant\CoEncadrantService;
use Application\Service\DomaineScientifiqueService;
use Application\Service\Etablissement\EtablissementServiceLocateTrait;
use Application\Service\Individu\IndividuService;
@@ -29,18 +30,21 @@ class UniteRechercheControllerFactory
        $form = $container->get('FormElementManager')->get('UniteRechercheForm');

        /**
         * @var CoEncadrantService $coEncadrantService
         * @var UniteRechercheService $uniteRechercheService
         * @var IndividuService $individuService
         * @var RoleService $roleService
         * @var StructureService $structureService
         * @var DomaineScientifiqueService $domaineService
         */
        $coEncadrantService = $container->get(CoEncadrantService::class);
        $uniteRechercheService = $container->get('UniteRechercheService');
        $roleService = $container->get('RoleService');
        $structureService = $container->get(StructureService::class);
        $domaineService = $container->get(DomaineScientifiqueService::class);

        $controller = new UniteRechercheController();
        $controller->setCoEncadrantService($coEncadrantService);
        $controller->setUniteRechercheService($uniteRechercheService);
        $controller->setRoleService($roleService);
        $controller->setEtablissementService($this->locateEtablissementService($container));
+7 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ namespace Application\Controller;

use Application\Entity\Db\TypeStructure;
use Application\Entity\Db\UniteRecherche;
use Application\Service\CoEncadrant\CoEncadrantServiceAwareTrait;
use Application\Service\DomaineScientifiqueServiceAwareTrait;
use Application\Service\Etablissement\EtablissementServiceAwareTrait;
use Application\Service\UniteRecherche\UniteRechercheService;
@@ -14,6 +15,7 @@ use Zend\View\Model\ViewModel;

class UniteRechercheController extends StructureConcreteController
{
    use CoEncadrantServiceAwareTrait;
    use UniteRechercheServiceAwareTrait;
    use EtablissementServiceAwareTrait;
    use DomaineScientifiqueServiceAwareTrait;
@@ -51,6 +53,10 @@ class UniteRechercheController extends StructureConcreteController
     */
    public function informationAction()
    {
        $id = $this->params()->fromRoute('structure');
        $structureConcrete = $this->getStructureConcreteService()->getRepository()->findByStructureId($id);
        $coencadrants = $this->getCoEncadrantService()->getCoEncadrantsByStructureConcrete($structureConcrete);

        $viewModel = parent::informationAction();

        $unite = $viewModel->getVariable('structure');
@@ -60,6 +66,7 @@ class UniteRechercheController extends StructureConcreteController
        $viewModel->setVariables([
            'unite'                       => $unite,
            'etablissementsRattachements' => $etablissementsRattachements,
            'coencadrants'                => $coencadrants,
        ]);

        return $viewModel;
+10 −7
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ $canEdit = ($this->isAllowed(StructurePrivileges::getResourceId(StructurePrivile
$canAddRole = $canEdit;

$canCoencadrantAfficher = $this->isAllowed(CoEncadrantPrivileges::getResourceId(CoEncadrantPrivileges::COENCADRANT_AFFICHER));
$canCoencadrantExport = $this->isAllowed(CoEncadrantPrivileges::getResourceId(CoEncadrantPrivileges::COENCADRANT_AFFICHER));

?>

@@ -151,6 +152,7 @@ $canCoencadrantAfficher = $this->isAllowed(CoEncadrantPrivileges::getResourceId(
    <span class="badge"> <?php echo count($coencadrants); ?> </span>
</h2>

<?php if($canCoencadrantExport) : ?>
    <?php /** @see \Application\Controller\CoEncadrantController::genererExportCsvAction() */ ?>
    <a href="<?php echo $this->url('co-encadrant/generer-export-csv', ['structure-type' => 'ecole-doctorale', 'structure-id' => $ecole->getId()], [], true); ?>"
       class="btn btn-primary"
@@ -158,6 +160,7 @@ $canCoencadrantAfficher = $this->isAllowed(CoEncadrantPrivileges::getResourceId(
        <span class="glyphicon glyphicon-export"></span>
        Générer l'export CSV des co-encadrants
    </a>
<?php endif; ?>

<br/>
<br/>
+45 −1
Original line number Diff line number Diff line
@@ -7,11 +7,13 @@
 * @var array                       $individuListing (string => string[])
 * @var EtablissementRattachement[] $etablissementsRattachements
 * @var string                      $logoContent
 * @var array                       $coencadrants
 */

use Application\Entity\Db\EtablissementRattachement;
use Application\Entity\Db\TypeStructure;
use Application\Entity\Db\UniteRecherche;
use Application\Provider\Privilege\CoEncadrantPrivileges;
use Application\Provider\Privilege\StructurePrivileges;

$this->headTitle("Unité de recherche '{$unite->getStructure()->getCode()}'");
@@ -19,6 +21,10 @@ $this->headTitle("Unité de recherche '{$unite->getStructure()->getCode()}'");
$canEdit = ($this->isAllowed(StructurePrivileges::getResourceId(StructurePrivileges::STRUCTURE_MODIFICATION_TOUTES_STRUCTURES))) ||
    ($this->isAllowed($unite->getStructure(), StructurePrivileges::STRUCTURE_MODIFICATION_SES_STRUCTURES));
$canAddRole = $canEdit;

$canCoencadrantAfficher = $this->isAllowed(CoEncadrantPrivileges::getResourceId(CoEncadrantPrivileges::COENCADRANT_AFFICHER));
$canCoencadrantExport = $this->isAllowed(CoEncadrantPrivileges::getResourceId(CoEncadrantPrivileges::COENCADRANT_AFFICHER));

?>

<h1 class="page-header">
@@ -147,3 +153,41 @@ $canAddRole = $canEdit;
    <a href="<?php echo $this->url('unite-recherche/modifier', ['structure' => $unite->getStructure()->getId()], [], true); ?>"
       class="btn btn-primary action"><span class="glyphicon glyphicon-pencil"></span> Modifier l'unité de recherche</a>
<?php endif; ?>


<h2>
    Co-encadrants
    <span class="badge"> <?php echo count($coencadrants); ?> </span>
</h2>

<?php if($canCoencadrantExport) : ?>
    <?php /** @see \Application\Controller\CoEncadrantController::genererExportCsvAction() */ ?>
    <a href="<?php echo $this->url('co-encadrant/generer-export-csv', ['structure-type' => 'unite-recherche', 'structure-id' => $unite->getId()], [], true); ?>"
       class="btn btn-primary"
    >
        <span class="glyphicon glyphicon-export"></span>
        Générer l'export CSV des co-encadrants
    </a>
<?php endif; ?>

<br/>
<br/>

<ul>
    <?php foreach ($coencadrants as $coencadrant) : ?>
        <?php
        $acteur = $coencadrant['co-encadrant'];
        $count = count($coencadrant['theses']);
        ?>
        <li>
            <?php echo $acteur->getIndividu()->getPrenom1(); ?>
            <?php echo $acteur->getIndividu()->getNomUsuel(); ?>
            (<?php echo $count; ?> co-encadrement<?php if ($count > 1) echo "s"; ?> en cours.)
            <?php if ($canCoencadrantAfficher) : ?>
                <a href="<?php echo $this->url('co-encadrant/historique', ['co-encadrant' => $acteur->getId()],[], true); ?>">
                    <span class="glyphicon glyphicon-eye-open" title="Accéder à l'historique de co-encadrement"></span></a>
            <?php endif; ?>
        </li>
    <?php endforeach; ?>
</ul>