Loading module/Application/config/others/ecole-doctorale.config.php +24 Changes for module/Application/config/others/ecole-doctorale.config.php: 24 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Application\Provider\Privilege\EcoleDoctoralePrivileges; use Application\Service\EcoleDoctorale\EcoleDoctoraleService; use Application\View\Helper\EcoleDoctoraleHelper; use UnicaenAuth\Guard\PrivilegeController; use Zend\Mvc\Router\Http\Segment; return [ 'bjyauthorize' => [ Loading @@ -16,6 +17,7 @@ return [ 'controller' => 'Application\Controller\EcoleDoctorale', 'action' => [ 'index', 'information' ], 'privileges' => EcoleDoctoralePrivileges::ECOLE_DOCT_CONSULTATION, ], Loading Loading @@ -50,6 +52,16 @@ return [ ], 'may_terminate' => true, 'child_routes' => [ 'information' => [ 'type' => Segment::class, 'options' => [ 'route' => '/information/:ecoleDoctorale', 'defaults' => [ 'action' => 'information', ], ], ], 'ajouter' => [ 'type' => 'Segment', 'options' => [ Loading Loading @@ -148,6 +160,18 @@ return [ 'resource' => PrivilegeController::getResourceId('Application\Controller\EcoleDoctorale', 'index'), 'order' => 10, 'pages' => [ 'modification' => [ 'label' => 'Modification', 'route' => 'ecole-doctorale/modifier', 'resource' => PrivilegeController::getResourceId('Application\Controller\EcoleDoctorale', 'index'), 'withtarget' => true, 'paramsInject' => [ 'ecoleDoctorale', ], ], ], ], ], ], Loading module/Application/src/Application/Controller/EcoleDoctoraleController.php +45 −23 Changes for module/Application/src/Application/Controller/EcoleDoctoraleController.php: 45 added lines, 23 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ namespace Application\Controller; use Application\Entity\Db\EcoleDoctorale; use Application\Entity\Db\Individu; use Application\Entity\Db\IndividuRole; use Application\Entity\Db\Role; use Application\Entity\Db\Structure; use Application\Entity\Db\StructureConcreteInterface; Loading @@ -11,6 +13,7 @@ use Application\Service\EcoleDoctorale\EcoleDoctoraleServiceAwareTrait; use Application\Service\Etablissement\EtablissementServiceAwareTrait; use Application\Service\Individu\IndividuServiceAwareTrait; use Application\Service\Role\RoleServiceAwareTrait; use UnicaenApp\Exception\RuntimeException; use Zend\View\Model\ViewModel; class EcoleDoctoraleController extends AbstractController Loading @@ -30,25 +33,6 @@ class EcoleDoctoraleController extends AbstractController */ public function indexAction() { $selected = $this->params()->fromQuery('selected'); $roles = null; $effectifs = null; if ($selected) { /** * @var StructureConcreteInterface $structure * @var Role[] $roles */ $structure = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($selected); $roles = $structure->getStructure()->getStructureDependantRoles(); $effectifs = []; foreach ($roles as $role) { $individus = $this->individuService->getRepository()->findByRole($role); $effectifs[$role->getLibelle()] = $individus; } } $structuresAll = $this->getEcoleDoctoraleService()->getRepository()->findAll(); /** retrait des structures substituées */ Loading @@ -70,13 +54,51 @@ class EcoleDoctoraleController extends AbstractController } return new ViewModel([ 'structuresPrincipales' => $structures, 'selected' => $selected, 'roles' => $roles, 'effectifs' => $effectifs, 'ecoles' => $structures, ]); } public function informationAction() { $id = $this->params()->fromRoute('ecoleDoctorale'); $ecole = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($id); if ($ecole === null) { throw new RuntimeException("Aucune école doctorale ne possède l'identifiant renseigné."); } $roleListings = []; $individuListings = []; $roles = $this->getRoleService()->getRolesByStructure($ecole->getStructure()); $individus = $this->getRoleService()->getIndividuByStructure($ecole->getStructure()); $individuRoles = $this->getRoleService()->getIndividuRoleByStructure($ecole->getStructure()); /** @var Role $role */ foreach ($roles as $role) { $roleListings [$role->getLibelle()] = 0; } /** @var Individu $individu */ foreach ($individus as $individu) { $denomination = $individu->getNomComplet(false, false, false, true, false); $individuListings[$denomination] = []; } /** @var IndividuRole $individuRole */ foreach ($individuRoles as $individuRole) { $denomination = $individuRole->getIndividu()->getNomComplet(false, false, false, true, false); $role = $individuRole->getRole()->getLibelle(); $individuListings[$denomination][] = $role; $roleListings[$role]++; } return new ViewModel([ 'ecole' => $ecole, 'roleListing' => $roleListings, 'individuListing' => $individuListings, ]); } /** * Modifier permet soit d'afficher le formulaire associé à la modification soit de mettre à jour * les données associées à une école doctorale (Sigle, Libellé et Logo) Loading module/Application/view/application/ecole-doctorale/index.phtml +21 −186 Changes for module/Application/view/application/ecole-doctorale/index.phtml: 21 added lines, 186 removed lines. Original line number Diff line number Diff line <?php use Application\Entity\Db\Etablissement; use Application\Filter\EtablissementPrefixFilter; use Application\Entity\Db\EcoleDoctorale; use Application\Provider\Privilege\EcoleDoctoralePrivileges; use Application\View\Renderer\PhpRenderer; use UnicaenApp\Form\Element\SearchAndSelect; /** * @see \Application\Controller\EcoleDoctoraleController::indexAction() * @var PhpRenderer $this * @var Etablissement[] $structuresPrincipales * @var Etablissement[] $structuresSecondaires * @var string $selected * @var array|null $etablissementIndividus * @var EcoleDoctorale[] $ecoles */ $canModifier = $this->isAllowed(EcoleDoctoralePrivileges::getResourceId(EcoleDoctoralePrivileges::ECOLE_DOCT_MODIFICATION)); Loading @@ -23,7 +19,7 @@ $canModifier = $this->isAllowed(EcoleDoctoralePrivileges::getResourceId(EcoleDoc <h1 class="page-header first"> <?php echo $this->translate("Écoles doctorales") ?> <span class="badge"><?php echo count($structuresPrincipales); ?></span> <span class="badge"><?php echo count($ecoles); ?></span> </h1> <?php echo $this->messenger()->addMessagesFromFlashMessengerWithNoNamespace() ?> Loading @@ -31,7 +27,7 @@ $canModifier = $this->isAllowed(EcoleDoctoralePrivileges::getResourceId(EcoleDoc <?php if ($canModifier): ?> <a href="<?php echo $this->url('ecole-doctorale/ajouter', [], [], true) ?>" class="btn btn-default btn-sm" class="btn btn-primary" title="<?php echo $this->translate("Créer une nouvelle école doctorale");?>"> <span class="glyphicon glyphicon-plus"></span> <?php echo $this->translate("Ajouter une nouvelle école doctorale");?> Loading @@ -50,213 +46,52 @@ $canModifier = $this->isAllowed(EcoleDoctoralePrivileges::getResourceId(EcoleDoc </tr> </thead> <tbody> <?php foreach($structuresPrincipales as $structure): ?> <?php foreach($ecoles as $ecole): ?> <?php $historisee = (!$structure->estNonHistorise()); $hasSousStructure = !($structure->getStructure()->getStructuresSubstituees()->isEmpty()); $historisee = (!$ecole->estNonHistorise()); $hasSousStructure = !($ecole->getStructure()->getStructuresSubstituees()->isEmpty()); ?> <tr <?php if($selected == $structure->getStructure()->getId()) echo 'class="ecole-doctorale selected" style="color:black;"';?> > <tr> <td> <a name="<?php echo $structure->getStructure()->getId();?>"> <a href="<?php echo $this->url('ecole-doctorale', [], ['query' => ['selected' => $structure->getStructure()->getId()], "fragment" => "".$structure->getStructure()->getId()], true); ?>"> <?php echo $structure->getLibelle(); ?> <a href="<?php echo $this->url('ecole-doctorale/information', ['ecoleDoctorale' => $ecole->getStructure()->getId()], [], true); ?>"> <?php echo $ecole->getLibelle(); ?> </a> </td> <td> <?php echo explode("::",$structure->getSource()->getCode())[0]; ?></td> <td> <?php $result = $structure->getCode(); try { $filter = new EtablissementPrefixFilter(); $result = $filter->removePrefixFrom($result); } catch (LogicException $e) {} echo $result; ?> <?php echo explode("::",$ecole->getSource()->getCode())[0]; ?> </td> <td> <?php echo $structure->getSigle(); ?></td> <td> <?php echo $ecole->getCode(); ?> </td> <td> <?php echo $ecole->getSigle(); ?> </td> <td> <?php if ($canModifier && !$historisee) : ?> <a href="<?php echo $this->url('ecole-doctorale/modifier', ["ecoleDoctorale" => $structure->getStructure()->getId()], [], true); ?>" title="Modifier l'établissement"> <span class="glyphicon glyphicon-pencil"></span> </a> <?php endif; ?> <?php if ($canModifier && !$historisee) : ?> <a href="<?php echo $this->url('ecole-doctorale/supprimer', ["ecoleDoctorale" => $structure->getStructure()->getId()], [], true); ?>" <a href="<?php echo $this->url('ecole-doctorale/supprimer', ["ecoleDoctorale" => $ecole->getStructure()->getId()], [], true); ?>" title="Historiser l'établissement"> <span class="glyphicon glyphicon-trash"></span> </a> <?php endif; ?> <?php if ($canModifier && !$historisee && $hasSousStructure) : ?> <a href="<?php echo $this->url('substitution-modifier', ['cible' => $structure->getStructure()->getId(), [], true]); ?>" <a href="<?php echo $this->url('substitution-modifier', ['cible' => $ecole->getStructure()->getId(), [], true]); ?>" title="Historiser l'établissement"> <span class="glyphicon glyphicon-link" title="Éditer la substitution"></span> </a> <?php endif; ?> <?php if ($canModifier && $historisee) : ?> <a href="<?php echo $this->url('ecole-doctorale/restaurer', ["ecoleDoctorale" => $structure->getStructure()->getId()], [], true); ?>" <a href="<?php echo $this->url('ecole-doctorale/restaurer', ["ecoleDoctorale" => $ecole->getStructure()->getId()], [], true); ?>" title="Restaurer l'établissement"> Restaurer </a> <?php endif; ?> </td> </tr> <?php if ($selected == $structure->getStructure()->getId() && !$historisee): ?> <tr class="ecole-doctorale selected" style="color:black;"> <td colspan="3"> <div id="selected"> Zone contenant les individus associé à la structure. </div> <div> <div id="people" class="col-md-8"> <?php if ($canModifier): ?> <div> <!-- $urlAjouter = $view->url($prefix . '/ajouter-individu', [$type => $structure->getId()], [], true);--> <form method="post" action=""> <?php $sas = new SearchAndSelect('individu'); $sas->setLabel($this->translate("Recherche de l'individu à ajouter :")); $sas->setAttribute('class', 'individu-finder'); $sas->setAutocompleteSource($this->url('utilisateur/rechercher-individu', [], [], true)); echo $this->formcontrolgroup($sas, 'formSearchAndSelect'); echo generateSelect("role", $roles); ?> <br/> <!-- <input type="submit" value="Ajouter cet individu" style="margin-top: 0;" title="Ajouter cet individu comme membre" class="btn btn-default btn-sm" />--> </form> <button id="add-role" class="add-role btn btn-default"> <span class="glyphicon glyphicon-plus"></span><span class="glyphicon glyphicon-user"></span> Ajouter un membre </button> <?php if (empty($roles)): ?> <a href="<?php echo $this->url('structure/generer-roles-defauts', ['id' => $structure->getStructure()->getId(), 'type' => \Application\Entity\Db\TypeStructure::CODE_ECOLE_DOCTORALE], [], true);?>" class="btn btn-warning" > <span class="glyphicon glyphicon-refresh"></span> Générer rôles par défaut </a> <?php endif; ?> </div> <?php endif;?> </div> <div id="logo-div" class="col-md-4"> <img style="max-width: 200px; max-height: 200px; border: 1px solid black; background-color: white;" src="data:image/png;base64,<?php echo base64_encode($structure->getLogoContent()); ?>" /> </div> </div> </td> </tr> <?php endif; ?> <?php endforeach; ?> </tbody> </table> <script> $(document).ready(function () { loadIndividu(); $("div#selected").on("click", ".remove-role", function () { var id = $(this).attr("id"); var splits = id.split("_"); var role = splits[1]; var individu = splits[0]; var url = "../../utilisateur/retirer-role/" + individu + "/" + role; $.ajax({ url: url, beforeSend: function () { $("#selected").html('<span class="waiting">Chargement des individus associé à la structure ...</span>'); }, success: function(retour) { loadIndividu(); } }); }); $("div#people").on("click", ".add-role", function () { var individu = $("[name='individu[id]']").val(); var role = $("select[name='role'] option:selected").val(); var url = "../../utilisateur/ajouter-role/" + individu + "/" + role; $.ajax({ url: url, beforeSend: function () { $("#selected").html('<span class="waiting">Chargement des individus associé à la structure ...</span>'); }, success: function(retour) { loadIndividu(); } }); }); }); function loadIndividu() { var url = "../structure/individu-role/" + <?php echo $selected; ?> + "/etablissement"; $.ajax({ url : url, beforeSend: function () { $("#selected").html('<span class="waiting">Chargement des individus associé à la structure ...</span>'); }, success: function(retour){ $("#selected").html(retour); } }); } </script> <style> span.waiting { color: DarkBlue; font-style: italic; font-weight: bold; } </style> <?php function generateSelect($id, $roles) { $texte = ''; $texte .= '<select name="' . $id . '" class="form-control" >'; /** @var \Application\Entity\Db\Role $role */ foreach ($roles as $role) { $texte .= '<option value="' . $role->getId() . '">' . $role->getLibelle() . '</option>'; } $texte .= '</select>'; return $texte; } ?> <!--<script type="text/javascript">--> <!-- $(function () {--> <!-- $(".retirer-individu").click(function() {--> <!-- var individu = $(this).data('individu');--> <!-- return confirm("--><?php //echo $this->translate("Êtes-vous sûr-e de vouloir retirer ");?><!--" + "'" + individu + "'" + " " + "--><?php //echo $this->translate("de la liste des membres ?");?><!--");--> <!-- }); --> <!-- $(".supprimer-etablissement").click(function() {--> <!-- var etablissement = $(this).data('etablissement');--> <!-- return confirm("--><?php ////echo $this->translate("Êtes-vous sûr-e de vouloir supprimer l'établissement ");?><!--//" + "'" + etablissement + "'" + " ? ");--> <!-- });--> <!-- });--> <!--</script>--> </div> No newline at end of file module/Application/view/application/ecole-doctorale/information.phtml +109 Changes for module/Application/view/application/ecole-doctorale/information.phtml: 109 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /** * @see \Application\Controller\EcoleDoctoraleController::informationAction() * @var EcoleDoctorale $ecole * @var array(string => Role[]) $roleListing * @var array(string => string[]) $individuListing */ use Application\Entity\Db\EcoleDoctorale; $this->headTitle('Details de l\'école doctorale ['.$ecole->getLibelle().']'); $canEdit = true; ?> <h1 class="page-header"> Details de l'école doctorale [ <?php echo $ecole->getLibelle(); ?> ] </h1> <a href="<?php echo $this->url('ecole-doctorale', [], [], true); ?>" class="btn btn-primary action" > <span class="glyphicon glyphicon-th-list"></span> Index des écoles doctorales </a> <?php if($canEdit): ?> <a href="<?php echo $this->url('ecole-doctorale/modifier', ['ecoleDoctorale'=> $ecole->getStructure()->getId()], [], true); ?>" class="btn btn-primary action" > <span class="glyphicon glyphicon-pencil"></span> Modifier l'école doctorale </a> <?php endif; ?> <div> <h2> Informations générales </h2> <div class="row"> <div class="col-md-4"> <img id="logo" style="max-width: 200px; max-height: 200px; border: 1px solid black; background-color: white;" src="data:image/png;base64,<?php echo base64_encode($ecole->getLogoContent()); ?>" /> </div> <div class="col-md-6"> <dl> <dt> Libelle : </dt> <dd> <?php echo $ecole->getLibelle(); ?> </dd> <dt> Sigle : </dt> <dd> <?php echo $ecole->getSigle(); ?> </dd> <dt> Code : </dt> <dd> <?php echo $ecole->getCode(); ?> </dd> </dl> </div> </div> <div> <h2> Rôles et membres </h2> <div class="row"> <div class="col-md-6"> <table class="table table-condensed"> <thead> <tr> <th> Libellé du rôles </th> <th> Effectifs </th> </tr> </thead> <tbody> <?php foreach($roleListing as $libelle => $individus): ?> <tr> <td> <?php echo $libelle; ?> </td> <td> <?php echo ($individus)?count($individus):0; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <div class="col-md-6"> <table class="table table-condensed"> <thead> <tr> <th> Dénomination </th> <th> Rôle </th> </tr> </thead> <tbody> <?php foreach($individuListing as $denomination => $roles): ?> <?php foreach($roles as $role): ?> <tr> <td> <?php echo $denomination; ?> </td> <td> <?php echo $role; ?> </td> </tr> <?php endforeach; ?> <?php endforeach; ?> </tbody> </table> </div> </div> </div> <style> .action { width: 20em; } </style> No newline at end of file module/Application/view/application/ecole-doctorale/modifier.phtml +7 Changes for module/Application/view/application/ecole-doctorale/modifier.phtml: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -12,14 +12,21 @@ use Application\View\Renderer\PhpRenderer; */ $fcg = $this->formControlGroup(); $this->headTitle('Modification de l\'école doctorale '.$form->getObject()->getLibelle()); ?> <h1 class="page-header"> Modification de l'école doctorale <?php echo $form->getObject()->getLibelle(); ?> </h1> <?php echo $this->form()->openTag($form->prepare()->setAttribute('class', 'ecole-doctorale')) ?> <?php echo $this->formHidden($form->get('id')) ?> <?php echo $fcg($form->get('libelle')) ?> <?php echo $fcg($form->get('sigle')) ?> <?php echo $fcg($form->get('sourceCode')) ?> <div id="logo-div"> <?php /** @var \Zend\Form\Element\File $logoFile */ Loading Loading
module/Application/config/others/ecole-doctorale.config.php +24 Changes for module/Application/config/others/ecole-doctorale.config.php: 24 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Application\Provider\Privilege\EcoleDoctoralePrivileges; use Application\Service\EcoleDoctorale\EcoleDoctoraleService; use Application\View\Helper\EcoleDoctoraleHelper; use UnicaenAuth\Guard\PrivilegeController; use Zend\Mvc\Router\Http\Segment; return [ 'bjyauthorize' => [ Loading @@ -16,6 +17,7 @@ return [ 'controller' => 'Application\Controller\EcoleDoctorale', 'action' => [ 'index', 'information' ], 'privileges' => EcoleDoctoralePrivileges::ECOLE_DOCT_CONSULTATION, ], Loading Loading @@ -50,6 +52,16 @@ return [ ], 'may_terminate' => true, 'child_routes' => [ 'information' => [ 'type' => Segment::class, 'options' => [ 'route' => '/information/:ecoleDoctorale', 'defaults' => [ 'action' => 'information', ], ], ], 'ajouter' => [ 'type' => 'Segment', 'options' => [ Loading Loading @@ -148,6 +160,18 @@ return [ 'resource' => PrivilegeController::getResourceId('Application\Controller\EcoleDoctorale', 'index'), 'order' => 10, 'pages' => [ 'modification' => [ 'label' => 'Modification', 'route' => 'ecole-doctorale/modifier', 'resource' => PrivilegeController::getResourceId('Application\Controller\EcoleDoctorale', 'index'), 'withtarget' => true, 'paramsInject' => [ 'ecoleDoctorale', ], ], ], ], ], ], Loading
module/Application/src/Application/Controller/EcoleDoctoraleController.php +45 −23 Changes for module/Application/src/Application/Controller/EcoleDoctoraleController.php: 45 added lines, 23 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ namespace Application\Controller; use Application\Entity\Db\EcoleDoctorale; use Application\Entity\Db\Individu; use Application\Entity\Db\IndividuRole; use Application\Entity\Db\Role; use Application\Entity\Db\Structure; use Application\Entity\Db\StructureConcreteInterface; Loading @@ -11,6 +13,7 @@ use Application\Service\EcoleDoctorale\EcoleDoctoraleServiceAwareTrait; use Application\Service\Etablissement\EtablissementServiceAwareTrait; use Application\Service\Individu\IndividuServiceAwareTrait; use Application\Service\Role\RoleServiceAwareTrait; use UnicaenApp\Exception\RuntimeException; use Zend\View\Model\ViewModel; class EcoleDoctoraleController extends AbstractController Loading @@ -30,25 +33,6 @@ class EcoleDoctoraleController extends AbstractController */ public function indexAction() { $selected = $this->params()->fromQuery('selected'); $roles = null; $effectifs = null; if ($selected) { /** * @var StructureConcreteInterface $structure * @var Role[] $roles */ $structure = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($selected); $roles = $structure->getStructure()->getStructureDependantRoles(); $effectifs = []; foreach ($roles as $role) { $individus = $this->individuService->getRepository()->findByRole($role); $effectifs[$role->getLibelle()] = $individus; } } $structuresAll = $this->getEcoleDoctoraleService()->getRepository()->findAll(); /** retrait des structures substituées */ Loading @@ -70,13 +54,51 @@ class EcoleDoctoraleController extends AbstractController } return new ViewModel([ 'structuresPrincipales' => $structures, 'selected' => $selected, 'roles' => $roles, 'effectifs' => $effectifs, 'ecoles' => $structures, ]); } public function informationAction() { $id = $this->params()->fromRoute('ecoleDoctorale'); $ecole = $this->getEcoleDoctoraleService()->getRepository()->findByStructureId($id); if ($ecole === null) { throw new RuntimeException("Aucune école doctorale ne possède l'identifiant renseigné."); } $roleListings = []; $individuListings = []; $roles = $this->getRoleService()->getRolesByStructure($ecole->getStructure()); $individus = $this->getRoleService()->getIndividuByStructure($ecole->getStructure()); $individuRoles = $this->getRoleService()->getIndividuRoleByStructure($ecole->getStructure()); /** @var Role $role */ foreach ($roles as $role) { $roleListings [$role->getLibelle()] = 0; } /** @var Individu $individu */ foreach ($individus as $individu) { $denomination = $individu->getNomComplet(false, false, false, true, false); $individuListings[$denomination] = []; } /** @var IndividuRole $individuRole */ foreach ($individuRoles as $individuRole) { $denomination = $individuRole->getIndividu()->getNomComplet(false, false, false, true, false); $role = $individuRole->getRole()->getLibelle(); $individuListings[$denomination][] = $role; $roleListings[$role]++; } return new ViewModel([ 'ecole' => $ecole, 'roleListing' => $roleListings, 'individuListing' => $individuListings, ]); } /** * Modifier permet soit d'afficher le formulaire associé à la modification soit de mettre à jour * les données associées à une école doctorale (Sigle, Libellé et Logo) Loading
module/Application/view/application/ecole-doctorale/index.phtml +21 −186 Changes for module/Application/view/application/ecole-doctorale/index.phtml: 21 added lines, 186 removed lines. Original line number Diff line number Diff line <?php use Application\Entity\Db\Etablissement; use Application\Filter\EtablissementPrefixFilter; use Application\Entity\Db\EcoleDoctorale; use Application\Provider\Privilege\EcoleDoctoralePrivileges; use Application\View\Renderer\PhpRenderer; use UnicaenApp\Form\Element\SearchAndSelect; /** * @see \Application\Controller\EcoleDoctoraleController::indexAction() * @var PhpRenderer $this * @var Etablissement[] $structuresPrincipales * @var Etablissement[] $structuresSecondaires * @var string $selected * @var array|null $etablissementIndividus * @var EcoleDoctorale[] $ecoles */ $canModifier = $this->isAllowed(EcoleDoctoralePrivileges::getResourceId(EcoleDoctoralePrivileges::ECOLE_DOCT_MODIFICATION)); Loading @@ -23,7 +19,7 @@ $canModifier = $this->isAllowed(EcoleDoctoralePrivileges::getResourceId(EcoleDoc <h1 class="page-header first"> <?php echo $this->translate("Écoles doctorales") ?> <span class="badge"><?php echo count($structuresPrincipales); ?></span> <span class="badge"><?php echo count($ecoles); ?></span> </h1> <?php echo $this->messenger()->addMessagesFromFlashMessengerWithNoNamespace() ?> Loading @@ -31,7 +27,7 @@ $canModifier = $this->isAllowed(EcoleDoctoralePrivileges::getResourceId(EcoleDoc <?php if ($canModifier): ?> <a href="<?php echo $this->url('ecole-doctorale/ajouter', [], [], true) ?>" class="btn btn-default btn-sm" class="btn btn-primary" title="<?php echo $this->translate("Créer une nouvelle école doctorale");?>"> <span class="glyphicon glyphicon-plus"></span> <?php echo $this->translate("Ajouter une nouvelle école doctorale");?> Loading @@ -50,213 +46,52 @@ $canModifier = $this->isAllowed(EcoleDoctoralePrivileges::getResourceId(EcoleDoc </tr> </thead> <tbody> <?php foreach($structuresPrincipales as $structure): ?> <?php foreach($ecoles as $ecole): ?> <?php $historisee = (!$structure->estNonHistorise()); $hasSousStructure = !($structure->getStructure()->getStructuresSubstituees()->isEmpty()); $historisee = (!$ecole->estNonHistorise()); $hasSousStructure = !($ecole->getStructure()->getStructuresSubstituees()->isEmpty()); ?> <tr <?php if($selected == $structure->getStructure()->getId()) echo 'class="ecole-doctorale selected" style="color:black;"';?> > <tr> <td> <a name="<?php echo $structure->getStructure()->getId();?>"> <a href="<?php echo $this->url('ecole-doctorale', [], ['query' => ['selected' => $structure->getStructure()->getId()], "fragment" => "".$structure->getStructure()->getId()], true); ?>"> <?php echo $structure->getLibelle(); ?> <a href="<?php echo $this->url('ecole-doctorale/information', ['ecoleDoctorale' => $ecole->getStructure()->getId()], [], true); ?>"> <?php echo $ecole->getLibelle(); ?> </a> </td> <td> <?php echo explode("::",$structure->getSource()->getCode())[0]; ?></td> <td> <?php $result = $structure->getCode(); try { $filter = new EtablissementPrefixFilter(); $result = $filter->removePrefixFrom($result); } catch (LogicException $e) {} echo $result; ?> <?php echo explode("::",$ecole->getSource()->getCode())[0]; ?> </td> <td> <?php echo $structure->getSigle(); ?></td> <td> <?php echo $ecole->getCode(); ?> </td> <td> <?php echo $ecole->getSigle(); ?> </td> <td> <?php if ($canModifier && !$historisee) : ?> <a href="<?php echo $this->url('ecole-doctorale/modifier', ["ecoleDoctorale" => $structure->getStructure()->getId()], [], true); ?>" title="Modifier l'établissement"> <span class="glyphicon glyphicon-pencil"></span> </a> <?php endif; ?> <?php if ($canModifier && !$historisee) : ?> <a href="<?php echo $this->url('ecole-doctorale/supprimer', ["ecoleDoctorale" => $structure->getStructure()->getId()], [], true); ?>" <a href="<?php echo $this->url('ecole-doctorale/supprimer', ["ecoleDoctorale" => $ecole->getStructure()->getId()], [], true); ?>" title="Historiser l'établissement"> <span class="glyphicon glyphicon-trash"></span> </a> <?php endif; ?> <?php if ($canModifier && !$historisee && $hasSousStructure) : ?> <a href="<?php echo $this->url('substitution-modifier', ['cible' => $structure->getStructure()->getId(), [], true]); ?>" <a href="<?php echo $this->url('substitution-modifier', ['cible' => $ecole->getStructure()->getId(), [], true]); ?>" title="Historiser l'établissement"> <span class="glyphicon glyphicon-link" title="Éditer la substitution"></span> </a> <?php endif; ?> <?php if ($canModifier && $historisee) : ?> <a href="<?php echo $this->url('ecole-doctorale/restaurer', ["ecoleDoctorale" => $structure->getStructure()->getId()], [], true); ?>" <a href="<?php echo $this->url('ecole-doctorale/restaurer', ["ecoleDoctorale" => $ecole->getStructure()->getId()], [], true); ?>" title="Restaurer l'établissement"> Restaurer </a> <?php endif; ?> </td> </tr> <?php if ($selected == $structure->getStructure()->getId() && !$historisee): ?> <tr class="ecole-doctorale selected" style="color:black;"> <td colspan="3"> <div id="selected"> Zone contenant les individus associé à la structure. </div> <div> <div id="people" class="col-md-8"> <?php if ($canModifier): ?> <div> <!-- $urlAjouter = $view->url($prefix . '/ajouter-individu', [$type => $structure->getId()], [], true);--> <form method="post" action=""> <?php $sas = new SearchAndSelect('individu'); $sas->setLabel($this->translate("Recherche de l'individu à ajouter :")); $sas->setAttribute('class', 'individu-finder'); $sas->setAutocompleteSource($this->url('utilisateur/rechercher-individu', [], [], true)); echo $this->formcontrolgroup($sas, 'formSearchAndSelect'); echo generateSelect("role", $roles); ?> <br/> <!-- <input type="submit" value="Ajouter cet individu" style="margin-top: 0;" title="Ajouter cet individu comme membre" class="btn btn-default btn-sm" />--> </form> <button id="add-role" class="add-role btn btn-default"> <span class="glyphicon glyphicon-plus"></span><span class="glyphicon glyphicon-user"></span> Ajouter un membre </button> <?php if (empty($roles)): ?> <a href="<?php echo $this->url('structure/generer-roles-defauts', ['id' => $structure->getStructure()->getId(), 'type' => \Application\Entity\Db\TypeStructure::CODE_ECOLE_DOCTORALE], [], true);?>" class="btn btn-warning" > <span class="glyphicon glyphicon-refresh"></span> Générer rôles par défaut </a> <?php endif; ?> </div> <?php endif;?> </div> <div id="logo-div" class="col-md-4"> <img style="max-width: 200px; max-height: 200px; border: 1px solid black; background-color: white;" src="data:image/png;base64,<?php echo base64_encode($structure->getLogoContent()); ?>" /> </div> </div> </td> </tr> <?php endif; ?> <?php endforeach; ?> </tbody> </table> <script> $(document).ready(function () { loadIndividu(); $("div#selected").on("click", ".remove-role", function () { var id = $(this).attr("id"); var splits = id.split("_"); var role = splits[1]; var individu = splits[0]; var url = "../../utilisateur/retirer-role/" + individu + "/" + role; $.ajax({ url: url, beforeSend: function () { $("#selected").html('<span class="waiting">Chargement des individus associé à la structure ...</span>'); }, success: function(retour) { loadIndividu(); } }); }); $("div#people").on("click", ".add-role", function () { var individu = $("[name='individu[id]']").val(); var role = $("select[name='role'] option:selected").val(); var url = "../../utilisateur/ajouter-role/" + individu + "/" + role; $.ajax({ url: url, beforeSend: function () { $("#selected").html('<span class="waiting">Chargement des individus associé à la structure ...</span>'); }, success: function(retour) { loadIndividu(); } }); }); }); function loadIndividu() { var url = "../structure/individu-role/" + <?php echo $selected; ?> + "/etablissement"; $.ajax({ url : url, beforeSend: function () { $("#selected").html('<span class="waiting">Chargement des individus associé à la structure ...</span>'); }, success: function(retour){ $("#selected").html(retour); } }); } </script> <style> span.waiting { color: DarkBlue; font-style: italic; font-weight: bold; } </style> <?php function generateSelect($id, $roles) { $texte = ''; $texte .= '<select name="' . $id . '" class="form-control" >'; /** @var \Application\Entity\Db\Role $role */ foreach ($roles as $role) { $texte .= '<option value="' . $role->getId() . '">' . $role->getLibelle() . '</option>'; } $texte .= '</select>'; return $texte; } ?> <!--<script type="text/javascript">--> <!-- $(function () {--> <!-- $(".retirer-individu").click(function() {--> <!-- var individu = $(this).data('individu');--> <!-- return confirm("--><?php //echo $this->translate("Êtes-vous sûr-e de vouloir retirer ");?><!--" + "'" + individu + "'" + " " + "--><?php //echo $this->translate("de la liste des membres ?");?><!--");--> <!-- }); --> <!-- $(".supprimer-etablissement").click(function() {--> <!-- var etablissement = $(this).data('etablissement');--> <!-- return confirm("--><?php ////echo $this->translate("Êtes-vous sûr-e de vouloir supprimer l'établissement ");?><!--//" + "'" + etablissement + "'" + " ? ");--> <!-- });--> <!-- });--> <!--</script>--> </div> No newline at end of file
module/Application/view/application/ecole-doctorale/information.phtml +109 Changes for module/Application/view/application/ecole-doctorale/information.phtml: 109 added lines, 0 removed lines. Original line number Diff line number Diff line <?php /** * @see \Application\Controller\EcoleDoctoraleController::informationAction() * @var EcoleDoctorale $ecole * @var array(string => Role[]) $roleListing * @var array(string => string[]) $individuListing */ use Application\Entity\Db\EcoleDoctorale; $this->headTitle('Details de l\'école doctorale ['.$ecole->getLibelle().']'); $canEdit = true; ?> <h1 class="page-header"> Details de l'école doctorale [ <?php echo $ecole->getLibelle(); ?> ] </h1> <a href="<?php echo $this->url('ecole-doctorale', [], [], true); ?>" class="btn btn-primary action" > <span class="glyphicon glyphicon-th-list"></span> Index des écoles doctorales </a> <?php if($canEdit): ?> <a href="<?php echo $this->url('ecole-doctorale/modifier', ['ecoleDoctorale'=> $ecole->getStructure()->getId()], [], true); ?>" class="btn btn-primary action" > <span class="glyphicon glyphicon-pencil"></span> Modifier l'école doctorale </a> <?php endif; ?> <div> <h2> Informations générales </h2> <div class="row"> <div class="col-md-4"> <img id="logo" style="max-width: 200px; max-height: 200px; border: 1px solid black; background-color: white;" src="data:image/png;base64,<?php echo base64_encode($ecole->getLogoContent()); ?>" /> </div> <div class="col-md-6"> <dl> <dt> Libelle : </dt> <dd> <?php echo $ecole->getLibelle(); ?> </dd> <dt> Sigle : </dt> <dd> <?php echo $ecole->getSigle(); ?> </dd> <dt> Code : </dt> <dd> <?php echo $ecole->getCode(); ?> </dd> </dl> </div> </div> <div> <h2> Rôles et membres </h2> <div class="row"> <div class="col-md-6"> <table class="table table-condensed"> <thead> <tr> <th> Libellé du rôles </th> <th> Effectifs </th> </tr> </thead> <tbody> <?php foreach($roleListing as $libelle => $individus): ?> <tr> <td> <?php echo $libelle; ?> </td> <td> <?php echo ($individus)?count($individus):0; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <div class="col-md-6"> <table class="table table-condensed"> <thead> <tr> <th> Dénomination </th> <th> Rôle </th> </tr> </thead> <tbody> <?php foreach($individuListing as $denomination => $roles): ?> <?php foreach($roles as $role): ?> <tr> <td> <?php echo $denomination; ?> </td> <td> <?php echo $role; ?> </td> </tr> <?php endforeach; ?> <?php endforeach; ?> </tbody> </table> </div> </div> </div> <style> .action { width: 20em; } </style> No newline at end of file
module/Application/view/application/ecole-doctorale/modifier.phtml +7 Changes for module/Application/view/application/ecole-doctorale/modifier.phtml: 7 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -12,14 +12,21 @@ use Application\View\Renderer\PhpRenderer; */ $fcg = $this->formControlGroup(); $this->headTitle('Modification de l\'école doctorale '.$form->getObject()->getLibelle()); ?> <h1 class="page-header"> Modification de l'école doctorale <?php echo $form->getObject()->getLibelle(); ?> </h1> <?php echo $this->form()->openTag($form->prepare()->setAttribute('class', 'ecole-doctorale')) ?> <?php echo $this->formHidden($form->get('id')) ?> <?php echo $fcg($form->get('libelle')) ?> <?php echo $fcg($form->get('sigle')) ?> <?php echo $fcg($form->get('sourceCode')) ?> <div id="logo-div"> <?php /** @var \Zend\Form\Element\File $logoFile */ Loading