Skip to content
Snippets Groups Projects
Commit ae70dcd5 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Ajout des affectations

parent 81ffa22e
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ namespace Octopus\Entity\Db;
// TODO prendre les overwrites, normalisés, phonétiques
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
class Individu {
/** @var integer */
......@@ -45,6 +46,15 @@ class Individu {
/** @var DateTime */
private $dateModification;
/** @var ArrayCollection */
private $affectations;
public function __construct()
{
$this->affectations = new ArrayCollection();
}
/**
* @return int
*/
......@@ -197,10 +207,24 @@ class Individu {
return $this->dateModification;
}
/**
* @param boolean $active
* @return IndividuAffectation[]
*/
public function getAffectations($active = false) {
$affectations = $this->affectations->toArray();
if ($active) {
$affectations = array_filter($affectations, function(IndividuAffectation $a) { return ($a->getDateFin() === null);});
}
return $affectations;
}
public function __toString()
{
$texte = $this->getPrenom(). " " . $this->getNomUsage();
return $texte;
}
}
\ No newline at end of file
<?php
namespace Octopus\Entity\Db;
use DateTime;
class IndividuAffectation {
/** @var integer */
private $id;
/** @var Individu */
private $individu;
/** @var Structure */
private $structure;
/** @var StructureType */
private $type;
/** @var Source */
private $source;
/** @var DateTime */
private $dateDebut;
/** @var DateTime */
private $dateFin;
/** @var integer */
private $idOrig;
/** @var boolean */
private $principal;
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return Individu
*/
public function getIndividu()
{
return $this->individu;
}
/**
* @return Structure
*/
public function getStructure()
{
return $this->structure;
}
/**
* @return StructureType
*/
public function getType()
{
return $this->type;
}
/**
* @return Source
*/
public function getSource()
{
return $this->source;
}
/**
* @return DateTime
*/
public function getDateDebut()
{
return $this->dateDebut;
}
/**
* @return DateTime
*/
public function getDateFin()
{
return $this->dateFin;
}
/**
* @return int
*/
public function getIdOrig()
{
return $this->idOrig;
}
/**
* @return bool
*/
public function isPrincipal()
{
return $this->principal;
}
}
\ No newline at end of file
......@@ -32,5 +32,7 @@
<field name="emailPersonnelle" type="string" length="255" column="EMAIL_PERSO" nullable="false"/>
<field name="dateModification" type="date" column="D_MODIF" nullable="false"/>
<one-to-many target-entity="Octopus\Entity\Db\IndividuAffectation" mapped-by="individu" field="affectations"/>
</entity>
</doctrine-mapping>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Octopus\Entity\Db\IndividuAffectation" table="INDIVIDU_AFFECTATION">
<id name="id" type="integer" column="ID">
<generator strategy="IDENTITY"/>
</id>
<many-to-one target-entity="Octopus\Entity\Db\Individu" field="individu">
<join-column name="INDIVIDU_ID" referenced-column-name="C_INDIVIDU_CHAINE" />
</many-to-one>
<many-to-one target-entity="Octopus\Entity\Db\Structure" field="structure">
<join-column name="STRUCTURE_ID" referenced-column-name="ID" />
</many-to-one>
<many-to-one target-entity="Octopus\Entity\Db\StructureType" field="type">
<join-column name="TYPE_ID" referenced-column-name="ID" />
</many-to-one>
<many-to-one target-entity="Octopus\Entity\Db\Source" field="source">
<join-column name="SOURCE_ID" referenced-column-name="C_SOURCE" />
</many-to-one>
<field name="dateDebut" column="DATE_DEBUT" type="datetime" nullable="false"/>
<field name="dateFin" column="DATE_FIN" type="datetime" nullable="true"/>
<field name="idOrig" column="ID_ORIG" type="integer" nullable="false"/>
<field name="principal" column="T_PRINCIPALE" type="boolean" nullable="false"/>
</entity>
</doctrine-mapping>
\ No newline at end of file
......@@ -65,11 +65,11 @@ class Source {
public function __toString()
{
switch ($this->cSource) {
case 'OCTO' : return '<span class="badge" style="background-color: darkred;">'. $this->getLibelleLong() .'</span>';
case 'HARP' : return '<span class="badge" style="background-color: hotpink;">'. $this->getLibelleLong() .'</span>';
case 'APO' : return '<span class="badge" style="background-color: royalblue;">'. $this->getLibelleLong() .'</span>';
case 'FCA' : return '<span class="badge" style="background-color: cadetblue;">'. $this->getLibelleLong() .'</span>';
case 'INV' : return '<span class="badge" style="background-color: darkgreen;">'. $this->getLibelleLong() .'</span>';
case self::SOURCE_OCTO : return '<span class="badge" style="background-color: darkred;">'. $this->getLibelleLong() .'</span>';
case self::SOURCE_HARPEGE : return '<span class="badge" style="background-color: hotpink;">'. $this->getLibelleLong() .'</span>';
case self::SOURCE_APOGEE : return '<span class="badge" style="background-color: royalblue;">'. $this->getLibelleLong() .'</span>';
case self::SOURCE_FCA : return '<span class="badge" style="background-color: cadetblue;">'. $this->getLibelleLong() .'</span>';
case self::SOURCE_INV : return '<span class="badge" style="background-color: darkgreen;">'. $this->getLibelleLong() .'</span>';
default : return '<span class="badge" style="background-color: gray;">'. $this->getLibelleLong() .'</span>';
}
}
......
......@@ -3,6 +3,19 @@
namespace Octopus\Entity\Db;
class StructureType {
const TYPE_ANTN = 'Antenne';
const TYPE_BIBL = 'Bibliothèque';
const TYPE_COMP = 'Composante';
const TYPE_DEPT = 'Département';
const TYPE_ED = 'École doctorale';
const TYPE_ETAB = 'Établissement';
const TYPE_FICT = 'Structure fictive';
const TYPE_SCEN = 'Service central';
const TYPE_SCOM = 'Service commun';
const TYPE_SREC = 'Structure de recherche';
const TYPE_SSAD = 'Sous-structure administrative';
/** @var integer */
private $id;
/** @var string */
......@@ -46,7 +59,9 @@ class StructureType {
public function __toString()
{
$texte = $this->getLibelle();
$texte = '<span class="badge" style="background-color: slategray; border-radius: 0;">';
$texte .= $this->getLibelle();
$texte .= '</span>';
return $texte;
}
......
......@@ -55,6 +55,21 @@ use UnicaenApp\Form\Element\SearchAndSelect;
<td> <?php echo $individu->getCPaysNaissance(); ?> </td>
<!-- <td> --><?php //echo $individu->getCPaysNaissance()->getLibelleLong(); ?><!-- </td>-->
</tr>
<?php foreach ($individu->getAffectations(true) as $affectation) : ?>
<tr>
<td colspan="6">
&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;
<?php echo $affectation->getSource(); ?>
<?php echo $affectation->getStructure()->getLibelleLong(); ?>
<?php echo $affectation->getType(); ?>
(<?php echo $affectation->getDateDebut()->format('d/m/Y'); ?>
&rightarrow;
<?php echo ($affectation->getDateFin())?$affectation->getDateFin()->format('d/m/Y'):""; ?>)
<?php echo ($affectation->isPrincipal())?"Oui":"Non"; ?>
</td>
</tr>
<?php endforeach; ?>
<?php $position += 1; ?>
<?php if ($position >= 5) : ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment