diff --git a/src/UnicaenRenderer/Controller/RenduController.php b/src/UnicaenRenderer/Controller/RenduController.php index dae34c721fdace649c93d1ddea10b5d4c6b22e38..5da2ad2b6774a84e37c204fbf51a4cd37801874f 100644 --- a/src/UnicaenRenderer/Controller/RenduController.php +++ b/src/UnicaenRenderer/Controller/RenduController.php @@ -25,7 +25,7 @@ class RenduController extends AbstractActionController { return new ViewModel([ 'title' => "Affichage du contenu #" . $rendu->getId(), - 'contenu' => $rendu, + 'rendu' => $rendu, ]); } diff --git a/src/UnicaenRenderer/Controller/TemplateController.php b/src/UnicaenRenderer/Controller/TemplateController.php index e7435de9510f1fb7b76051d758ed4ee5daf82a01..3f6d38e287a11eb1236384cd373dda6f28261a52 100755 --- a/src/UnicaenRenderer/Controller/TemplateController.php +++ b/src/UnicaenRenderer/Controller/TemplateController.php @@ -67,6 +67,7 @@ class TemplateController extends AbstractActionController { $form = $this->getTemplateForm(); $form->setAttribute('action', $this->url()->fromRoute('contenu/template/modifier', ['template' => $template->getId()], [], true)); $form->bind($template); + $form->setOldCode($template->getCode()); $request = $this->getRequest(); if ($request->isPost()) { diff --git a/src/UnicaenRenderer/Entity/Db/Template.php b/src/UnicaenRenderer/Entity/Db/Template.php index 9e7c01cb00c174f7e8ab82a4c4a6e484b97fa87a..b2bbc46d8e0ba232bc242fb62d208c9362a18313 100755 --- a/src/UnicaenRenderer/Entity/Db/Template.php +++ b/src/UnicaenRenderer/Entity/Db/Template.php @@ -8,6 +8,11 @@ class Template implements ResourceInterface { const RESOURCE_ID = 'Template'; + public function generateTag() : string + { + return (implode('_', [$this->getResourceId(), $this->getCode()])); + } + /** * @return string */ diff --git a/src/UnicaenRenderer/Service/Rendu/RenduService.php b/src/UnicaenRenderer/Service/Rendu/RenduService.php index 55bd22534c622df06c8fe21c40615c11f3525537..05b5dc47b5ff05dad35d1956430a155ff20bd7ed 100644 --- a/src/UnicaenRenderer/Service/Rendu/RenduService.php +++ b/src/UnicaenRenderer/Service/Rendu/RenduService.php @@ -92,7 +92,7 @@ class RenduService { * @param int $id * @return Rendu|null */ - public function getRendu(int $id) : ?Rendu + public function getRendu(?int $id) : ?Rendu { $qb = $this->createQueryBuilder() ->andWhere('contenu.id = :id') @@ -111,7 +111,7 @@ class RenduService { * @param string $param * @return Rendu|null */ - public function getRequestedRendu(AbstractActionController $controller, string $param='contenu') : ?Rendu + public function getRequestedRendu(AbstractActionController $controller, string $param='rendu') : ?Rendu { $id = $controller->params()->fromRoute($param); $result = $this->getRendu($id); diff --git a/src/UnicaenRenderer/View/Helper/partial/rendu.phtml b/src/UnicaenRenderer/View/Helper/partial/rendu.phtml index e8684673205223d00778c728f96fd9abeab3d693..036bcce1711593350684e77b89817cc841566cc6 100644 --- a/src/UnicaenRenderer/View/Helper/partial/rendu.phtml +++ b/src/UnicaenRenderer/View/Helper/partial/rendu.phtml @@ -2,7 +2,7 @@ /** * @see \UnicaenRenderer\View\Helper\RenduViewHelper - * @var Rendu $contenu + * @var Rendu $rendu * @var array $options */ @@ -15,29 +15,29 @@ use UnicaenRenderer\Entity\Db\Rendu; <dl> <dt> Identifiant </dt> <dd> - <?php echo $contenu->getId(); ?> + <?php echo $rendu->getId(); ?> </dd> <dt> Template </dt> <dd> - <?php if ($contenu->getTemplate()) : ?> - <?php echo $contenu->getTemplate()->getCode(); ?> + <?php if ($rendu->getTemplate()) : ?> + <?php echo $rendu->getTemplate()->getCode(); ?> <?php else: ?> <i>Aucun template associé</i> <?php endif; ?> </dd> <dt> Date de génération </dt> <dd> - <?php echo $contenu->getDate()->format('d/m/Y'); ?> + <?php echo $rendu->getDate()->format('d/m/Y'); ?> </dd> </dl> </div> <div class="col-md-8"> <div class="panel panel-default"> <div class="panel-heading"> - <?php echo $contenu->getSujet(); ?> + <?php echo $rendu->getSujet(); ?> </div> <div class="panel-body"> - <?php echo $contenu->getCorps(); ?> + <?php echo $rendu->getCorps(); ?> </div> </div> </div> diff --git a/view/unicaen-renderer/contenu/afficher.phtml b/view/unicaen-renderer/rendu/afficher.phtml similarity index 100% rename from view/unicaen-renderer/contenu/afficher.phtml rename to view/unicaen-renderer/rendu/afficher.phtml diff --git a/view/unicaen-renderer/contenu/index.phtml b/view/unicaen-renderer/rendu/index.phtml similarity index 100% rename from view/unicaen-renderer/contenu/index.phtml rename to view/unicaen-renderer/rendu/index.phtml