Loading module/Autoform/src/Autoform/Entity/Db/FormulaireInstance.php +43 −0 Original line number Diff line number Diff line Loading @@ -144,4 +144,47 @@ class FormulaireInstance implements HistoriqueAwareInterface { return null; } /** * @param Champ $champ * @return string|null */ public function getReponseFor(Champ $champ) : ?string { /** @var FormulaireReponse $reponse */ foreach ($this->reponses as $reponse) { if ($reponse->estNonHistorise() AND $reponse->getChamp()->getId() === $champ->getId()) return $reponse->getReponse(); } return null; } public function prettyPrint() : string { $text = ""; $categories = $this->getFormulaire()->getCategories(); $categories = array_filter($categories, function (Categorie $a) { return $a->estNonHistorise(); }); usort($categories, function (Categorie $a, Categorie $b) { return $a->getOrdre() > $b->getOrdre(); }); foreach ($categories as $categorie) { $as = false; $subtext = "<h3>".$categorie->getLibelle()."</h3>"; $champs = $categorie->getChamps(); $champs = array_filter($champs, function (Champ $a) { return $a->estNonHistorise(); }); usort($champs, function (Champ $a, Champ $b) { return $a->getOrdre() > $b->getOrdre(); }); foreach ($champs as $champ) { $reponse = $this->getReponseFor($champ); //todo utiliser les VHs if ($reponse !== null) { $subtext .= $champ->getLibelle() . " : ". $reponse . "<br>"; $as = true; } } if ($as) $text .= $subtext; } return $text; } } No newline at end of file module/EntretienProfessionnel/src/EntretienProfessionnel/Controller/EntretienProfessionnelController.php +1 −0 Original line number Diff line number Diff line Loading @@ -441,6 +441,7 @@ class EntretienProfessionnelController extends AbstractActionController 'entretien' => $entretien, 'agent' => $entretien->getAgent(), 'formations' => $formations, 'campagne' => $entretien->getCampagne(), ]; $titre = $this->getContenuService()->generateTitre($contenu, $vars); $texte = $this->getContenuService()->generateContenu($contenu, $vars); Loading module/EntretienProfessionnel/src/EntretienProfessionnel/Controller/ObservationController.php +0 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ namespace EntretienProfessionnel\Controller; use EntretienProfessionnel\Entity\Db\EntretienProfessionnel; use EntretienProfessionnel\Entity\Db\Observation; use EntretienProfessionnel\Form\Observation\ObservationFormAwareTrait; use EntretienProfessionnel\Service\EntretienProfessionnel\EntretienProfessionnelServiceAwareTrait; Loading module/EntretienProfessionnel/src/EntretienProfessionnel/Entity/Db/EntretienProfessionnel.php +54 −0 Original line number Diff line number Diff line Loading @@ -4,10 +4,14 @@ namespace EntretienProfessionnel\Entity\Db; use Application\Entity\Db\Agent; use Application\Entity\HasAgentInterface; use Autoform\Entity\Db\Categorie; use Autoform\Entity\Db\Champ; use Autoform\Entity\Db\FormulaireInstance; use DateInterval; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use EntretienProfessionnel\Service\EntretienProfessionnel\EntretienProfessionnelService; use EntretienProfessionnel\Service\EntretienProfessionnel\EntretienProfessionnelServiceFactory; use Exception; use UnicaenApp\Exception\RuntimeException; use UnicaenEtat\Entity\Db\HasEtatInterface; Loading @@ -17,6 +21,7 @@ use UnicaenUtilisateur\Entity\HistoriqueAwareInterface; use UnicaenUtilisateur\Entity\HistoriqueAwareTrait; use UnicaenValidation\Entity\Db\ValidationInstance; use Zend\Permissions\Acl\Resource\ResourceInterface; use Zend\View\Helper\Url; class EntretienProfessionnel implements HistoriqueAwareInterface, ResourceInterface, HasAgentInterface, HasEtatInterface { use HistoriqueAwareTrait; Loading Loading @@ -472,4 +477,53 @@ class EntretienProfessionnel implements HistoriqueAwareInterface, ResourceInterf if ($this->getResponsable() !== null) return $this->getResponsable()->getDisplayName(); return "Aucun responsable d'entretien donné"; } public function toStringLienConcovation() : string { //TODO comment invoquer l'aide de vue URL initialiser ? (Solution temporaire de transition) $url = 'http://emc2.unicaen.fr/entretien-professionnel/accepter-entretien/'.$this->getId().'/'.$this->getToken(); return '<a href="'.$url.'">Acceptation de l\'entretien professionnel</a>'; } public function toStringLienEntretien() : string { //TODO comment invoquer l'aide de vue URL initialiser ? (Solution temporaire de transition) $url = 'https://localhost/entretien-professionnel/renseigner/'.$this->getId(); return '<a href="'.$url.'">Acceptation de l\'entretien professionnel</a>'; } public function toStringValidationAgent() : string { if ($this->validationAgent !== null) { return $this->validationAgent->getHistoCreation()->format('d/m/Y à H:i'). " par " .$this->validationAgent->getHistoCreateur()->getDisplayName(); } return "Aucune validation de l'agent"; } public function toStringValidationResponsable() : string { if ($this->validationResponsable !== null) { return $this->validationResponsable->getHistoCreation()->format('d/m/Y à H:i'). " par " .$this->validationResponsable->getHistoCreateur()->getDisplayName(); } return "Aucune validation du responsable d'entretien"; } public function toStringValidationHierarchie() : string { if ($this->validationDRH !== null) { return $this->validationDRH->getHistoCreation()->format('d/m/Y à H:i'). " par " .$this->validationDRH->getHistoCreateur()->getDisplayName(); } return "Aucune validation du responsable hiérarchique"; } public function toStringCR_Entretien() : string { if ($this->formulaireInstance !== null) { return $this->formulaireInstance->prettyPrint(); } return "Aucune formulaire"; } public function toStringCR_Formation() : string { if ($this->formationInstance !== null) { return $this->formationInstance->prettyPrint(); } return "Aucune formulaire"; } } No newline at end of file module/Mailing/src/Mailing/Service/Mailing/MailingService.php +0 −27 Original line number Diff line number Diff line Loading @@ -415,34 +415,7 @@ class MailingService // case 'VAR[EMC2#lien]' : // $lien = '<a href="' . 'https://emc2.unicaen.fr' . '">EMC2</a>'; // return $lien; // /** AGENT *************************************************************************************************/ // case 'VAR[Agent#Denomination]' : // $agent = $variables['agent']; // return $agent->getDenomination(); // /** CAMPAGNE **********************************************************************************************/ // case 'VAR[CAMPAGNE#debut]' : // $campagne = $variables['campagne']; // return $campagne->getDateDebut()->format('d/m/Y'); // case 'VAR[CAMPAGNE#fin]' : // $campagne = $variables['campagne']; // return $campagne->getDateFin()->format('d/m/Y'); // /** ENTRETIEN *********************************************************************************************/ //// {title: 'Entretien : date', description: 'Date de l\'entretien', content: 'VAR[ENTRETIEN#date]'}, // case 'VAR[ENTRETIEN#agent]' : // $entretien = $variables['entretien']; // return $entretien->getAgent()->getDenomination(); // case 'VAR[ENTRETIEN#responsable]' : // $entretien = $variables['entretien']; // return $entretien->getResponsable()->getDisplayName(); // case 'VAR[ENTRETIEN#date]' : // $entretien = $variables['entretien']; // return $entretien->getDateEntretien()->format('d/m/Y'); // case 'VAR[ENTRETIEN#heure]' : // $entretien = $variables['entretien']; // return $entretien->getDateEntretien()->format('H:i'); // case 'VAR[ENTRETIEN#lieu]' : // $entretien = $variables['entretien']; // return $entretien->getLieu(); // case 'VAR[ENTRETIEN#lien_accepter]' : // $entretien = $variables['entretien']; // return '<a href="'.$this->rendererService->url('entretien-professionnel/accepter-entretien', ['entretien-professionnel' => $entretien->getId(), 'token' => $entretien->getToken()], ['force_canonical' => true], true).'">Acceptation de l\'entretien professionnel</a>'; Loading Loading
module/Autoform/src/Autoform/Entity/Db/FormulaireInstance.php +43 −0 Original line number Diff line number Diff line Loading @@ -144,4 +144,47 @@ class FormulaireInstance implements HistoriqueAwareInterface { return null; } /** * @param Champ $champ * @return string|null */ public function getReponseFor(Champ $champ) : ?string { /** @var FormulaireReponse $reponse */ foreach ($this->reponses as $reponse) { if ($reponse->estNonHistorise() AND $reponse->getChamp()->getId() === $champ->getId()) return $reponse->getReponse(); } return null; } public function prettyPrint() : string { $text = ""; $categories = $this->getFormulaire()->getCategories(); $categories = array_filter($categories, function (Categorie $a) { return $a->estNonHistorise(); }); usort($categories, function (Categorie $a, Categorie $b) { return $a->getOrdre() > $b->getOrdre(); }); foreach ($categories as $categorie) { $as = false; $subtext = "<h3>".$categorie->getLibelle()."</h3>"; $champs = $categorie->getChamps(); $champs = array_filter($champs, function (Champ $a) { return $a->estNonHistorise(); }); usort($champs, function (Champ $a, Champ $b) { return $a->getOrdre() > $b->getOrdre(); }); foreach ($champs as $champ) { $reponse = $this->getReponseFor($champ); //todo utiliser les VHs if ($reponse !== null) { $subtext .= $champ->getLibelle() . " : ". $reponse . "<br>"; $as = true; } } if ($as) $text .= $subtext; } return $text; } } No newline at end of file
module/EntretienProfessionnel/src/EntretienProfessionnel/Controller/EntretienProfessionnelController.php +1 −0 Original line number Diff line number Diff line Loading @@ -441,6 +441,7 @@ class EntretienProfessionnelController extends AbstractActionController 'entretien' => $entretien, 'agent' => $entretien->getAgent(), 'formations' => $formations, 'campagne' => $entretien->getCampagne(), ]; $titre = $this->getContenuService()->generateTitre($contenu, $vars); $texte = $this->getContenuService()->generateContenu($contenu, $vars); Loading
module/EntretienProfessionnel/src/EntretienProfessionnel/Controller/ObservationController.php +0 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,6 @@ namespace EntretienProfessionnel\Controller; use EntretienProfessionnel\Entity\Db\EntretienProfessionnel; use EntretienProfessionnel\Entity\Db\Observation; use EntretienProfessionnel\Form\Observation\ObservationFormAwareTrait; use EntretienProfessionnel\Service\EntretienProfessionnel\EntretienProfessionnelServiceAwareTrait; Loading
module/EntretienProfessionnel/src/EntretienProfessionnel/Entity/Db/EntretienProfessionnel.php +54 −0 Original line number Diff line number Diff line Loading @@ -4,10 +4,14 @@ namespace EntretienProfessionnel\Entity\Db; use Application\Entity\Db\Agent; use Application\Entity\HasAgentInterface; use Autoform\Entity\Db\Categorie; use Autoform\Entity\Db\Champ; use Autoform\Entity\Db\FormulaireInstance; use DateInterval; use DateTime; use Doctrine\Common\Collections\ArrayCollection; use EntretienProfessionnel\Service\EntretienProfessionnel\EntretienProfessionnelService; use EntretienProfessionnel\Service\EntretienProfessionnel\EntretienProfessionnelServiceFactory; use Exception; use UnicaenApp\Exception\RuntimeException; use UnicaenEtat\Entity\Db\HasEtatInterface; Loading @@ -17,6 +21,7 @@ use UnicaenUtilisateur\Entity\HistoriqueAwareInterface; use UnicaenUtilisateur\Entity\HistoriqueAwareTrait; use UnicaenValidation\Entity\Db\ValidationInstance; use Zend\Permissions\Acl\Resource\ResourceInterface; use Zend\View\Helper\Url; class EntretienProfessionnel implements HistoriqueAwareInterface, ResourceInterface, HasAgentInterface, HasEtatInterface { use HistoriqueAwareTrait; Loading Loading @@ -472,4 +477,53 @@ class EntretienProfessionnel implements HistoriqueAwareInterface, ResourceInterf if ($this->getResponsable() !== null) return $this->getResponsable()->getDisplayName(); return "Aucun responsable d'entretien donné"; } public function toStringLienConcovation() : string { //TODO comment invoquer l'aide de vue URL initialiser ? (Solution temporaire de transition) $url = 'http://emc2.unicaen.fr/entretien-professionnel/accepter-entretien/'.$this->getId().'/'.$this->getToken(); return '<a href="'.$url.'">Acceptation de l\'entretien professionnel</a>'; } public function toStringLienEntretien() : string { //TODO comment invoquer l'aide de vue URL initialiser ? (Solution temporaire de transition) $url = 'https://localhost/entretien-professionnel/renseigner/'.$this->getId(); return '<a href="'.$url.'">Acceptation de l\'entretien professionnel</a>'; } public function toStringValidationAgent() : string { if ($this->validationAgent !== null) { return $this->validationAgent->getHistoCreation()->format('d/m/Y à H:i'). " par " .$this->validationAgent->getHistoCreateur()->getDisplayName(); } return "Aucune validation de l'agent"; } public function toStringValidationResponsable() : string { if ($this->validationResponsable !== null) { return $this->validationResponsable->getHistoCreation()->format('d/m/Y à H:i'). " par " .$this->validationResponsable->getHistoCreateur()->getDisplayName(); } return "Aucune validation du responsable d'entretien"; } public function toStringValidationHierarchie() : string { if ($this->validationDRH !== null) { return $this->validationDRH->getHistoCreation()->format('d/m/Y à H:i'). " par " .$this->validationDRH->getHistoCreateur()->getDisplayName(); } return "Aucune validation du responsable hiérarchique"; } public function toStringCR_Entretien() : string { if ($this->formulaireInstance !== null) { return $this->formulaireInstance->prettyPrint(); } return "Aucune formulaire"; } public function toStringCR_Formation() : string { if ($this->formationInstance !== null) { return $this->formationInstance->prettyPrint(); } return "Aucune formulaire"; } } No newline at end of file
module/Mailing/src/Mailing/Service/Mailing/MailingService.php +0 −27 Original line number Diff line number Diff line Loading @@ -415,34 +415,7 @@ class MailingService // case 'VAR[EMC2#lien]' : // $lien = '<a href="' . 'https://emc2.unicaen.fr' . '">EMC2</a>'; // return $lien; // /** AGENT *************************************************************************************************/ // case 'VAR[Agent#Denomination]' : // $agent = $variables['agent']; // return $agent->getDenomination(); // /** CAMPAGNE **********************************************************************************************/ // case 'VAR[CAMPAGNE#debut]' : // $campagne = $variables['campagne']; // return $campagne->getDateDebut()->format('d/m/Y'); // case 'VAR[CAMPAGNE#fin]' : // $campagne = $variables['campagne']; // return $campagne->getDateFin()->format('d/m/Y'); // /** ENTRETIEN *********************************************************************************************/ //// {title: 'Entretien : date', description: 'Date de l\'entretien', content: 'VAR[ENTRETIEN#date]'}, // case 'VAR[ENTRETIEN#agent]' : // $entretien = $variables['entretien']; // return $entretien->getAgent()->getDenomination(); // case 'VAR[ENTRETIEN#responsable]' : // $entretien = $variables['entretien']; // return $entretien->getResponsable()->getDisplayName(); // case 'VAR[ENTRETIEN#date]' : // $entretien = $variables['entretien']; // return $entretien->getDateEntretien()->format('d/m/Y'); // case 'VAR[ENTRETIEN#heure]' : // $entretien = $variables['entretien']; // return $entretien->getDateEntretien()->format('H:i'); // case 'VAR[ENTRETIEN#lieu]' : // $entretien = $variables['entretien']; // return $entretien->getLieu(); // case 'VAR[ENTRETIEN#lien_accepter]' : // $entretien = $variables['entretien']; // return '<a href="'.$this->rendererService->url('entretien-professionnel/accepter-entretien', ['entretien-professionnel' => $entretien->getId(), 'token' => $entretien->getToken()], ['force_canonical' => true], true).'">Acceptation de l\'entretien professionnel</a>'; Loading