Skip to content
Snippets Groups Projects
Commit aa7ec438 authored by lecluse's avatar lecluse
Browse files
parent f8c09b4a
No related branches found
No related tags found
No related merge requests found
Showing
with 488 additions and 205 deletions
......@@ -50,7 +50,7 @@ return [
],
],
],
'fiche' => [
'voir' => [
'type' => 'Segment',
'options' => [
'route' => '/:intervenant',
......@@ -62,12 +62,35 @@ return [
],
],
],
'fiche' => [
'type' => 'Segment',
'options' => [
'route' => '/:intervenant/fiche',
'constraints' => [
'intervenant' => '[0-9]*',
],
'defaults' => [
'action' => 'fiche',
],
],
],
'saisir' => [
'type' => 'Segment',
'options' => [
'route' => '/:intervenant/saisir',
'constraints' => [
'intervenant' => '[0-9]*',
],
'defaults' => [
'action' => 'saisir',
],
],
],
'voir-heures-comp' => [
'type' => 'Segment',
'options' => [
'route' => '/voir-heures-comp/:intervenant',
'constraints' => [
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'intervenant' => '[0-9]*',
],
'defaults' => [
......@@ -80,7 +103,6 @@ return [
'options' => [
'route' => '/formule-totaux-hetd/:intervenant/:typeVolumeHoraire/:etatVolumeHoraire',
'constraints' => [
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'intervenant' => '[0-9]*',
'typeVolumeHoraire' => '[0-9]*',
'etatVolumeHoraire' => '[0-9]*',
......@@ -305,7 +327,7 @@ return [
'label' => 'Intervenant',
'title' => "Intervenant",
'route' => 'intervenant',
'resource' => 'controller/Application\Controller\Intervenant:index',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\Intervenant','index'),
'pages' => [
'rechercher' => [
'label' => " Rechercher",
......@@ -316,17 +338,17 @@ return [
],
'icon' => "glyphicon glyphicon-search",
'withtarget' => true,
'resource' => 'controller/Application\Controller\Intervenant:rechercher',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\Intervenant','rechercher'),
],
'fiche' => [
'voir' => [
'label' => "Fiche individuelle",
'title' => "Consultation de la fiche de l'intervenant {id}",
'route' => 'intervenant/fiche',
'route' => 'intervenant/voir',
'paramsInject' => [
'intervenant',
],
'withtarget' => true,
'resource' => 'controller/Application\Controller\Intervenant:voir',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\Intervenant','voir'),
],
'voir-heures-comp' => [
'label' => "Calcul HETD",
......@@ -337,7 +359,7 @@ return [
],
'action' => 'voir-heures-comp',
'withtarget' => true,
'resource' => 'controller/Application\Controller\Intervenant:voir-heures-comp',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\Intervenant','voir-heures-comp'),
],
'modification-service-du' => [
'label' => "Modification de service dû",
......@@ -347,7 +369,7 @@ return [
'intervenant',
],
'withtarget' => true,
'resource' => 'controller/Application\Controller\ModificationServiceDu:saisir',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\ModificationServiceDu','saisir'),
],
'dossier' => [
'label' => "Données personnelles",
......@@ -357,7 +379,7 @@ return [
'intervenant',
],
'withtarget' => true,
'resource' => 'controller/Application\Controller\Dossier:modifier',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\Dossier','modifier'),
'visible' => 'IntervenantNavigationPageVisibility',
],
'service' => [
......@@ -368,7 +390,7 @@ return [
'intervenant',
],
'withtarget' => true,
'resource' => 'controller/Application\Controller\Service:index',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\Service','index'),
'visible' => 'IntervenantNavigationPageVisibility',
],
'pieces-jointes-saisie' => [
......@@ -385,7 +407,7 @@ return [
'intervenant',
],
'withtarget' => true,
'resource' => 'controller/Application\Controller\Validation:dossier',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\Validation','dossier'),
'visible' => 'IntervenantNavigationPageVisibility',
],
'validation-service-prevu' => [
......@@ -396,7 +418,7 @@ return [
'intervenant',
],
'withtarget' => true,
'resource' => 'controller/Application\Controller\Validation:service',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\Validation','service'),
'visible' => 'IntervenantNavigationPageVisibility',
],
'validation-referentiel-prevu' => [
......@@ -407,7 +429,7 @@ return [
'intervenant',
],
'withtarget' => true,
'resource' => 'controller/Application\Controller\Validation:referentiel',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\Validation','referentiel'),
'visible' => 'IntervenantNavigationPageVisibility',
],
'agrement' => [
......@@ -421,7 +443,7 @@ return [
'intervenant',
],
'withtarget' => true,
'resource' => 'controller/Application\Controller\Contrat:index',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\Contrat','index'),
'visible' => 'IntervenantNavigationPageVisibility',
],
'services-realises' => [
......@@ -432,7 +454,7 @@ return [
'intervenant',
],
'withtarget' => true,
'resource' => 'controller/Application\Controller\Service:index',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\Service','index'),
'visible' => 'IntervenantNavigationPageVisibility',
],
'validation-service-realise' => [
......@@ -443,7 +465,7 @@ return [
'intervenant',
],
'withtarget' => true,
'resource' => 'controller/Application\Controller\Validation:service',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\Validation','service'),
'visible' => 'IntervenantNavigationPageVisibility',
],
'validation-referentiel-realise' => [
......@@ -454,7 +476,7 @@ return [
'intervenant',
],
'withtarget' => true,
'resource' => 'controller/Application\Controller\Validation:referentiel',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\Validation','referentiel'),
'visible' => 'IntervenantNavigationPageVisibility',
],
'demande-mise-en-paiement' => [
......@@ -465,7 +487,7 @@ return [
'intervenant',
],
'withtarget' => true,
'resource' => 'controller/Application\Controller\Paiement:demandemiseenpaiement',
'resource' => Guard\PrivilegeController::getResourceId('Application\Controller\Paiement','demandeMiseEnPaiement'),
'visible' => 'IntervenantNavigationPageVisibility',
],
],
......@@ -486,11 +508,18 @@ return [
],
[
'controller' => 'Application\Controller\Intervenant',
'action' => ['index', 'voir'],
'action' => ['index', 'voir', 'fiche'],
'privileges' => [
Privilege::INTERVENANT_FICHE,
],
],
[
'controller' => 'Application\Controller\Intervenant',
'action' => ['saisir'],
'privileges' => [
Privilege::INTERVENANT_EDITION,
],
],
[
'controller' => 'Application\Controller\ModificationServiceDu',
'action' => ['saisir'],
......@@ -512,7 +541,6 @@ return [
'controller' => 'Application\Controller\Intervenant',
'action' => ['formule-totaux-hetd'],
'roles' => $R_ALL,
'assertion' => 'IntervenantAssertion',
],
[
'controller' => 'Application\Controller\Intervenant',
......@@ -551,17 +579,6 @@ return [
],
],
],
'BjyAuthorize\Provider\Rule\Config' => [
'allow' => [
[
$R_ALL,
'Intervenant',
['total-heures-comp'],
'IntervenantAssertion',
],
],
],
],
],
'controllers' => [
......@@ -606,7 +623,7 @@ return [
],
'form_elements' => [
'invokables' => [
'intervenantForm' => Form\Intervenant\IntervenantForm::class,
'IntervenantEditionForm' => Form\Intervenant\EditionForm::class,
'IntervenantDossier' => Form\Intervenant\Dossier::class,
'IntervenantHeuresCompForm' => Form\Intervenant\HeuresCompForm::class,
'IntervenantModificationServiceDuForm' => Form\Intervenant\ModificationServiceDuForm::class,
......
......@@ -2,7 +2,6 @@
namespace Application\Assertion;
use Application\Entity\Db\Intervenant;
use Zend\Permissions\Acl\Acl;
use Zend\Permissions\Acl\Resource\ResourceInterface;
use Zend\Permissions\Acl\Role\RoleInterface;
......@@ -31,36 +30,7 @@ class IntervenantAssertion extends AbstractAssertion
{
parent::assert($acl, $role, $resource, $privilege);
$privilege = $this->normalizedPrivilege($privilege, $resource);
if ('total-heures-comp' == $privilege){
$resource = $this->getMvcEvent()->getParam('intervenant');
return $this->assertIntervenantTotalHeuresComp($this->getSelectedIdentityRole(), $resource);
}
return true;
}
/**
*
* @param RoleInterface $role
* @param Intervenant $resource
* @return boolean
*/
protected function assertIntervenantTotalHeuresComp(RoleInterface $role = null, Intervenant $resource = null)
{
/*********************************************************
* Rôle intervenant
*********************************************************/
if ($role instanceof \Application\Acl\IntervenantRole){
if ($role->getIntervenant() <> $resource){
return false;
}
}
/*********************************************************
* Tous les autres
*********************************************************/
return true;
}
}
\ No newline at end of file
......@@ -2,6 +2,8 @@
namespace Application\Controller;
use Application\Exception\DbException;
use Application\Form\Intervenant\Traits\EditionFormAwareTrait;
use Application\Form\Intervenant\Traits\HeuresCompFormAwareTrait;
use Application\Traits\SessionContainerTrait;
use Zend\Mvc\Controller\AbstractActionController;
......@@ -28,6 +30,7 @@ class IntervenantController extends AbstractActionController implements Workflow
use TypeHeuresAwareTrait;
use HeuresCompFormAwareTrait;
use SessionContainerTrait;
use EditionFormAwareTrait;
......@@ -91,6 +94,16 @@ class IntervenantController extends AbstractActionController implements Workflow
public function ficheAction()
{
$role = $this->getServiceContext()->getSelectedIdentityRole();
$intervenant = $role->getIntervenant() ?: $this->getEvent()->getParam('intervenant');
return compact('intervenant', 'role');
}
public function apercevoirAction()
{
$role = $this->getServiceContext()->getSelectedIdentityRole();
......@@ -102,6 +115,45 @@ class IntervenantController extends AbstractActionController implements Workflow
public function saisirAction()
{
$this->em()->getFilters()->enable('historique')->init([
]);
$role = $this->getServiceContext()->getSelectedIdentityRole();
$intervenant = $role->getIntervenant() ?: $this->getEvent()->getParam('intervenant');
$title = "Saisie d'un intervenant";
$form = $this->getFormIntervenantEdition();
$errors = [];
if ($intervenant) {
$form->bind($intervenant);
} else {
$intervenant = $this->getServiceIntervenant()->newEntity();
$form->setObject($intervenant);
}
$form->setAttribute('action', $this->url()->fromRoute(null, [], [], true));
$request = $this->getRequest();
if ($request->isPost()) {
$form->setData($request->getPost());
if ($form->isValid()) {
try {
$this->getServiceIntervenant()->save($intervenant);
$form->get('id')->setValue($intervenant->getId()); // transmet le nouvel ID
} catch (\Exception $e) {
$e = DbException::translate($e);
$errors[] = $e->getMessage();
}
}
}
return compact('intervenant', 'form', 'errors', 'title');
}
public function voirHeuresCompAction()
{
$this->em()->getFilters()->enable('historique')->init([
......
......@@ -25,6 +25,7 @@ class Privilege
const INTERVENANT_RECHERCHE = 'intervenant-recherche';
const INTERVENANT_FICHE = 'intervenant-fiche';
const INTERVENANT_CALCUL_HETD = 'intervenant-calcul-hetd';
const INTERVENANT_EDITION = 'intervenant-edition';
const MISE_EN_PAIEMENT_VISUALISATION = 'mise-en-paiement-visualisation';
const MISE_EN_PAIEMENT_DEMANDE = 'mise-en-paiement-demande';
const MISE_EN_PAIEMENT_EXPORT_CSV = 'mise-en-paiement-export-csv';
......@@ -49,6 +50,7 @@ class Privilege
/**
* @var string
*/
......
<?php
namespace Application\Form\Intervenant;
/**
* Description of AjouterModifier
*
* @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
*/
class AjouterModifier extends \Zend\Form\Form
{
}
\ No newline at end of file
<?php
namespace Application\Form\Intervenant;
use Application\Entity\Db\Intervenant;
use Zend\Form\Form;
use Zend\Stdlib\Hydrator\HydratorInterface;
/**
* Description of EditionForm
*
* @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
*/
class EditionForm extends Form
{
public function init()
{
$hydrator = new IntervenantFormHydrator;
$this->setHydrator($hydrator);
$this->add([
'name' => 'montant-indemnite-fc',
'options' => [
'label' => "Montant de l'indemnité de formation continue (€) :",
],
'attributes' => [
'value' => '0',
'title' => "Nombre d'heures",
'step' => 'any',
'min' => 0,
],
'type' => 'Number',
]);
$this->add([
'name' => 'id',
'type' => 'Hidden',
]);
$this->add([
'name' => 'submit',
'type' => 'Submit',
'attributes' => [
'value' => 'Appliquer',
'class' => 'btn btn-primary',
],
]);
}
/**
* Should return an array specification compatible with
* {@link Zend\InputFilter\Factory::createInputFilter()}.
*
* @return array
*/
public function getInputFilterSpecification()
{
return [
'montant-indemnite-fc' => [
'required' => false,
],
];
}
}
class IntervenantFormHydrator implements HydratorInterface
{
/**
* @param array $data
* @param Intervenant $object
*
* @return object
*/
public function hydrate(array $data, $object)
{
$object->setMontantIndemniteFc($data['montant-indemnite-fc']);
return $object;
}
/**
* @param Intervenant $object
*
* @return array
*/
public function extract($object)
{
$data = [
'id' => $object->getId(),
'montant-indemnite-fc' => $object->getMontantIndemniteFc(),
];
return $data;
}
}
\ No newline at end of file
<?php
namespace Application\Form\Intervenant\Interfaces;
use Application\Form\Intervenant\EditionForm;
use RuntimeException;
/**
* Description of EditionFormAwareInterface
*
* @author UnicaenCode
*/
interface EditionFormAwareInterface
{
/**
* @param EditionForm $formIntervenantEdition
* @return self
*/
public function setFormIntervenantEdition( EditionForm $formIntervenantEdition );
/**
* @return EditionFormAwareInterface
* @throws RuntimeException
*/
public function getFormIntervenantEdition();
}
\ No newline at end of file
<?php
namespace Application\Form\Intervenant\Traits;
use Application\Form\Intervenant\EditionForm;
use Application\Module;
use RuntimeException;
/**
* Description of EditionFormAwareTrait
*
* @author UnicaenCode
*/
trait EditionFormAwareTrait
{
/**
* @var EditionForm
*/
private $formIntervenantEdition;
/**
* @param EditionForm $formIntervenantEdition
* @return self
*/
public function setFormIntervenantEdition( EditionForm $formIntervenantEdition )
{
$this->formIntervenantEdition = $formIntervenantEdition;
return $this;
}
/**
* @return EditionForm
* @throws RuntimeException
*/
public function getFormIntervenantEdition()
{
if (empty($this->formIntervenantEdition)){
$serviceLocator = Module::$serviceLocator;
if (! $serviceLocator) {
if (!method_exists($this, 'getServiceLocator')) {
throw new RuntimeException('La classe ' . get_class($this) . ' n\'a pas accès au ServiceLocator.');
}
$serviceLocator = $this->getServiceLocator();
if (method_exists($serviceLocator, 'getServiceLocator')) {
$serviceLocator = $serviceLocator->getServiceLocator();
}
}
$this->formIntervenantEdition = $serviceLocator->get('FormElementManager')->get('IntervenantEditionForm');
}
return $this->formIntervenantEdition;
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@
namespace Application\View\Helper\Intervenant;
use Application\Util;
use Zend\View\Helper\AbstractHtmlElement;
use Application\Entity\Db\Intervenant;
use Application\Entity\Db\Traits\IntervenantAwareTrait;
......@@ -59,24 +60,25 @@ class IntervenantViewHelper extends AbstractHtmlElement
"NOM prénom" => $entity,
"Civilité" => $entity->getCiviliteToString(),
"Date de naissance" => $entity->getDateNaissanceToString(),
"Ville de naissance" => $entity->getVilleNaissanceLibelle() ?: "(Inconnue)",
"Ville de naissance" => $entity->getVilleNaissanceLibelle() ?: '<span class="inconnu">(Inconnue)</span>',
"Pays de naissance" => $entity->getPaysNaissanceLibelle(),
"N° INSEE" => $entity->getNumeroInsee(),
],
'coordonnees' => [
"Email" => $entity->getEmail() ?: "(Inconnu)",
"Téléphone mobile" => $entity->getTelMobile() ?: "(Inconnu)",
"Téléphone pro" => $entity->getTelPro() ?: "(Inconnu)",
"Email" => $entity->getEmail() ?: '<span class="inconnu">(Inconnu)</span>',
"Téléphone mobile" => $entity->getTelMobile() ?: '<span class="inconnu">(Inconnu)</span>',
"Téléphone pro" => $entity->getTelPro() ?: '<span class="inconnu">(Inconnu)</span>',
"Adresse" => nl2br($entity->getAdressePrincipale()),
],
'metier' => [
"Type d'intervenant" => $entity->getStatut()->getTypeIntervenant(),
"Statut de l'intervenant" => $entity->getStatut(),
"N° {$entity->getSource()}" => $entity->getSourceCode(),
"Affectation principale" => $entity->getStructure() ?: "(Inconnue)",
"Affectation recherche" => count($aff = $entity->getAffectation()) ? implode(" ; ", $aff->toArray()) : "(Inconnue)",
"Discipline" => $entity->getDiscipline() ?: "(Inconnue)",
"Grade" => $entity->getGrade() ?: "(Aucun ou inconnu)",
"Affectation principale" => $entity->getStructure() ?: '<span class="inconnu">(Inconnue)</span>',
"Affectation recherche" => count($aff = $entity->getAffectation()) ? implode(" ; ", $aff->toArray()) : '<span class="inconnu">(Inconnue)</span>',
"Discipline" => $entity->getDiscipline() ?: '<span class="inconnu">(Inconnue)</span>',
"Grade" => $entity->getGrade() ?: '<span class="inconnu">(Aucun ou inconnu)</span>',
"Montant de l'indemnité FC" => $entity->getMontantIndemniteFc() !== null ? \UnicaenApp\Util::formattedEuros($entity->getMontantIndemniteFc()) : '<span class="inconnu">(Inconnue)</span>',
],
'divers' => [
"Id" => $entity->getId(),
......
<?php
/* @var $intervenant \Application\Entity\Db\Intervenant */
/* @var $role Application\Acl\Role */
?>
<?php echo $this->intervenant($intervenant); ?>
<hr />
<?php echo $this->partial('application/intervenant/partial/feuille-de-route.phtml', compact('intervenant','role'));
<?php
/* @var $intervenant \Application\Entity\Db\Intervenant */
/* @var $form Application\Form\Intervenant\IntervenantForm */
/* @var $errors array */
echo $this->form()->openTag($form->prepare());
if ($errors) {
echo $this->messenger()->setMessages([UnicaenApp\View\Helper\Messenger::ERROR => $errors]);
}
echo $this->formControlGroup($form->get('montant-indemnite-fc'));
echo $this->formRow($form->get('submit'));
echo $this->formHidden($form->get('id'));
echo $this->form()->closeTag();
\ No newline at end of file
<?php $this->headTitle()->append($intervenant->getNomUsuel())->append("Fiche") ?>
<?php
<h1 class="page-header"><?php echo $intervenant ?> <small><?php echo $intervenant->getStatut()->getTypeIntervenant() ?></small></h1>
/* @var $intervenant \Application\Entity\Db\Intervenant */
/* @var $role \Application\Acl\Role */
<?php echo $this->intervenant($intervenant) ?>
$this->headTitle()->append($intervenant->getNomUsuel())->append("Fiche");
<hr />
?>
<?php echo $this->partial('application/intervenant/partial/feuille-de-route.phtml', compact('intervenant','role'));
\ No newline at end of file
<h1 class="page-header"><?php echo $intervenant ?>
<small><?php echo $intervenant->getStatut()->getTypeIntervenant() ?></small>
</h1>
<?php
$tabs = [
[
'id' => 'fiche',
'label' => '<span class="glyphicon glyphicon-eye-open"></span> Fiche',
'content' => $this->partial('application/intervenant/fiche.phtml', compact('intervenant', 'role')),
'url' => $this->url('intervenant/fiche', ['intervenant' => $intervenant->getSourceCode()]),
'force-refresh' => true,
],
];
if ($this->isAllowed('privilege/' . \Application\Entity\Db\Privilege::INTERVENANT_EDITION)) {
$tabs[] = [
'id' => 'edition',
'label' => '<span class="glyphicon glyphicon-pencil"></span> Édition',
'url' => $this->url('intervenant/saisir', ['intervenant' => $intervenant->getSourceCode()]),
];
}
echo $this->tabajax($tabs);
......@@ -355,6 +355,11 @@ ul.privileges-form li label {
color: white;
}
.inconnu {
font-style: italic;
color: gray;
}
div#navbar pre {
display: none;
}
......
......@@ -130,14 +130,17 @@ $.widget("ose.intervenantRecherche", {
{
var that = this;
this.element.find( "#critere" ).autocomplete({
this.getElementCritere().autocomplete({
source: function( event, ui ) {
that.rechercher(event.term);
return {};
}
});
this.getElementCritere().focus();
},
getElementCritere: function(){ return this.element.find( "#critere" ); },
getElementRecherche : function () { return this.element.find('.recherche'); },
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment