diff --git a/application/modules/opac/controllers/FormationsController.php b/application/modules/opac/controllers/FormationsController.php new file mode 100644 index 0000000000000000000000000000000000000000..7ca06cbfceabaeff407151db71455339a9a8a440 --- /dev/null +++ b/application/modules/opac/controllers/FormationsController.php @@ -0,0 +1,52 @@ +<?php +/** + * Copyright (c) 2012-2014, Agence Française Informatique (AFI). All rights reserved. + * + * AFI-OPAC 2.0 is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * AFI-OPAC 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with AFI-OPAC 2.0; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class FormationsController extends ZendAfi_Controller_Action { + public function init() { + parent::init(); + xdebug_break(); + if ('authenticate' == $this->getRequest()->getActionName()) + return; + + $this->_user = Class_Users::getLoader()->getIdentity(); + + + } + public function indexAction() { + $this->sessions_inscrit = []; + $this->view->formations_by_year = Class_Formation::indexByYear(Class_Formation::getLoader()->findAll()); + $this->view->user = $this->_user; + + } + + public function detailSessionAction() { + if (!$session = Class_SessionFormation::getLoader()->find((int)$this->_getParam('id'))) + $this->_redirect('/formations/index'); + $this->view->retour_controller="formations"; + $this->view->retour_action = $this->_getParam('retour', 'index'); + if ($this->view->retour_action=="fiche") + $this->view->retour_controller="abonne"; + $this->view->session = $session; + } + +} +?> \ No newline at end of file diff --git a/application/modules/opac/views/scripts/formations/_formation.phtml b/application/modules/opac/views/scripts/formations/_formation.phtml new file mode 100644 index 0000000000000000000000000000000000000000..4d6924ab2534735fc147ef97537bdf25cfb3b297 --- /dev/null +++ b/application/modules/opac/views/scripts/formations/_formation.phtml @@ -0,0 +1,3 @@ +<?php +echo $this->renderFormation($this->formation); +?> diff --git a/application/modules/opac/views/scripts/formations/detail-session.phtml b/application/modules/opac/views/scripts/formations/detail-session.phtml new file mode 100644 index 0000000000000000000000000000000000000000..f2979d349548896d2ed8df38c9b206525da3cf04 --- /dev/null +++ b/application/modules/opac/views/scripts/formations/detail-session.phtml @@ -0,0 +1,14 @@ +<?php +echo $this->openBoite(sprintf('Formation %s: session du %s', + $this->session->getLibelleFormation(), + $this->renderDateRange($this->session->getDateDebut(), + $this->session->getDateFin()))); +echo $this->renderSession($this->session); +echo $this->tag('div', + $this->tagAnchor($this->url(['controller' => $this->retour_controller, + 'action' => $this->retour_action] + ,null,true), + $this->_('Retour')), + ['class' => 'actions']); +echo $this->closeBoite(); ; +?> diff --git a/application/modules/opac/views/scripts/formations/index.phtml b/application/modules/opac/views/scripts/formations/index.phtml new file mode 100644 index 0000000000000000000000000000000000000000..0077c1a15177131b519693e3abe84df76a9208a8 --- /dev/null +++ b/application/modules/opac/views/scripts/formations/index.phtml @@ -0,0 +1,20 @@ +<?php +echo $this->openBoite('Formations'); + +if ($this->user && !$this->user->hasRightSuivreFormation()) + echo sprintf('<p class="error">%s</p>', + $this->_("Vous n'avez pas les droits suffisants pour vous inscrire à une formation")); + +foreach($this->formations_by_year as $year => $formations) { + echo '<div class="formations">'; + echo $this->partialCycle('formations/_formation.phtml', + 'formation', + $formations, + ['first', 'second']); + echo '</div>'; +} + +echo $this->closeBoite(); +?> + +<?php echo $this->abonne_RetourFiche(); ?>