Loading config/merged/index.config.php +4 −3 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace UnicaenCalendrier; use Laminas\Router\Http\Literal; use UnicaenCalendrier\Controller\IndexController; use UnicaenCalendrier\Controller\IndexControllerFactory; use UnicaenCalendrier\Provider\Privilege\UnicaencalendrierIndexPrivileges; use UnicaenPrivilege\Guard\PrivilegeController; return [ Loading @@ -16,9 +17,9 @@ return [ 'action' => [ 'index', ], // 'privileges' => [ // Unicaencalendrier_indexPrivileges::INDEX, // ], 'privileges' => [ UnicaencalendrierIndexPrivileges::INDEX, ], 'roles' => [] ], ], Loading documentation/001_table.sql +2 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ create table unicaen_calendrier_date_type code varchar(64) not null constraint unicaen_calendrier_date_type_pk2 unique, libelle varchar(1024) not null, description text, interval boolean default false not null, duree_a_priori integer ); Loading Loading @@ -51,7 +52,7 @@ create table unicaen_calendrier_date constraint unicaen_calendrier_date_pk primary key, date_type_id integer not null constraint unicaen_calendrier_date_unicaen_calendrier_date_type_id_fk references unicaen_calendrier_date_type on delete cascade, debut timestamp default now() not null, debut timestamp, fin timestamp, histo_creation timestamp default now() not null, histo_createur_id integer default 0 not null Loading src/Entity/Db/Date.php +33 −0 Original line number Diff line number Diff line Loading @@ -54,4 +54,37 @@ class Date implements HistoriqueAwareInterface, HasCalendriersInterface { $this->fin = $fin; } public function estTerminee(DateTime $dateObs = null): bool { if(!isset($this->debut) && !isset($this->fin)){return false;} if (empty($dateObs)) { $dateObs = new DateTime(); } $dFin = ($this->fin) ?? ($this->debut); return $dFin < $dateObs; } public function estEnCours(DateTime $dateObs = null): bool { if(!isset($this->debut) && !isset($this->fin)){return false;} if (empty($dateObs)) { $dateObs = new DateTime(); } $dFin = ($this->fin) ?? ($dateObs); $dDebut = ($this->debut) ?? ($dateObs); return $dDebut <= $dateObs && $dateObs <= $dFin; } public function estFutur(DateTime $dateObs = null): bool { if(!isset($this->debut) && !isset($this->fin)){return false;} if (empty($dateObs)) { $dateObs = new DateTime(); } $dDebut = ($this->debut) ?? ($this->fin); return $dateObs < $dDebut; } } No newline at end of file src/Entity/Db/DateType.php +18 −7 Original line number Diff line number Diff line Loading @@ -6,13 +6,14 @@ use Doctrine\Common\Collections\Collection; class DateType { private ?int $id=null; private ?string $code=null; private ?string $libelle=null; private bool $interval = false; private ?int $dureeApriori = null; private Collection $datesPrecedentes; //todo ?precedent comme objet pour proter l'info de durée private Collection $datesSuivantes; protected ?int $id=null; protected ?string $code=null; protected ?string $libelle=null; protected bool $interval = false; protected ?int $dureeApriori = null; protected ?string $description = null; protected Collection $datesPrecedentes; //todo ?precedent comme objet pour proter l'info de durée protected Collection $datesSuivantes; public function getId(): ?int { Loading @@ -39,6 +40,16 @@ class DateType { $this->libelle = $libelle; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): void { $this->description = $description; } public function isInterval(): bool { return $this->interval; Loading src/Entity/Db/Mapping/UnicaenCalendrier.Entity.Db.DateType.dcm.xml +1 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ <field name="code" type="string" length="64" column="code" nullable="false"/> <field name="libelle" type="string" length="1024" column="libelle" nullable="false"/> <field name="description" type="string" column="description" nullable="true"/> <field name="interval" type="boolean" column="interval" nullable="false"/> <field name="dureeApriori" type="integer" column="duree_a_priori" nullable="true"/> Loading Loading
config/merged/index.config.php +4 −3 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace UnicaenCalendrier; use Laminas\Router\Http\Literal; use UnicaenCalendrier\Controller\IndexController; use UnicaenCalendrier\Controller\IndexControllerFactory; use UnicaenCalendrier\Provider\Privilege\UnicaencalendrierIndexPrivileges; use UnicaenPrivilege\Guard\PrivilegeController; return [ Loading @@ -16,9 +17,9 @@ return [ 'action' => [ 'index', ], // 'privileges' => [ // Unicaencalendrier_indexPrivileges::INDEX, // ], 'privileges' => [ UnicaencalendrierIndexPrivileges::INDEX, ], 'roles' => [] ], ], Loading
documentation/001_table.sql +2 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ create table unicaen_calendrier_date_type code varchar(64) not null constraint unicaen_calendrier_date_type_pk2 unique, libelle varchar(1024) not null, description text, interval boolean default false not null, duree_a_priori integer ); Loading Loading @@ -51,7 +52,7 @@ create table unicaen_calendrier_date constraint unicaen_calendrier_date_pk primary key, date_type_id integer not null constraint unicaen_calendrier_date_unicaen_calendrier_date_type_id_fk references unicaen_calendrier_date_type on delete cascade, debut timestamp default now() not null, debut timestamp, fin timestamp, histo_creation timestamp default now() not null, histo_createur_id integer default 0 not null Loading
src/Entity/Db/Date.php +33 −0 Original line number Diff line number Diff line Loading @@ -54,4 +54,37 @@ class Date implements HistoriqueAwareInterface, HasCalendriersInterface { $this->fin = $fin; } public function estTerminee(DateTime $dateObs = null): bool { if(!isset($this->debut) && !isset($this->fin)){return false;} if (empty($dateObs)) { $dateObs = new DateTime(); } $dFin = ($this->fin) ?? ($this->debut); return $dFin < $dateObs; } public function estEnCours(DateTime $dateObs = null): bool { if(!isset($this->debut) && !isset($this->fin)){return false;} if (empty($dateObs)) { $dateObs = new DateTime(); } $dFin = ($this->fin) ?? ($dateObs); $dDebut = ($this->debut) ?? ($dateObs); return $dDebut <= $dateObs && $dateObs <= $dFin; } public function estFutur(DateTime $dateObs = null): bool { if(!isset($this->debut) && !isset($this->fin)){return false;} if (empty($dateObs)) { $dateObs = new DateTime(); } $dDebut = ($this->debut) ?? ($this->fin); return $dateObs < $dDebut; } } No newline at end of file
src/Entity/Db/DateType.php +18 −7 Original line number Diff line number Diff line Loading @@ -6,13 +6,14 @@ use Doctrine\Common\Collections\Collection; class DateType { private ?int $id=null; private ?string $code=null; private ?string $libelle=null; private bool $interval = false; private ?int $dureeApriori = null; private Collection $datesPrecedentes; //todo ?precedent comme objet pour proter l'info de durée private Collection $datesSuivantes; protected ?int $id=null; protected ?string $code=null; protected ?string $libelle=null; protected bool $interval = false; protected ?int $dureeApriori = null; protected ?string $description = null; protected Collection $datesPrecedentes; //todo ?precedent comme objet pour proter l'info de durée protected Collection $datesSuivantes; public function getId(): ?int { Loading @@ -39,6 +40,16 @@ class DateType { $this->libelle = $libelle; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): void { $this->description = $description; } public function isInterval(): bool { return $this->interval; Loading
src/Entity/Db/Mapping/UnicaenCalendrier.Entity.Db.DateType.dcm.xml +1 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ <field name="code" type="string" length="64" column="code" nullable="false"/> <field name="libelle" type="string" length="1024" column="libelle" nullable="false"/> <field name="description" type="string" column="description" nullable="true"/> <field name="interval" type="boolean" column="interval" nullable="false"/> <field name="dureeApriori" type="integer" column="duree_a_priori" nullable="true"/> Loading