</div>
</div>
<div class="container">
+<?php
+ $views = $this->viewModel()->getCurrent()->getChildren();
+ $main_view = $views[0];
+ $variables = $main_view->getVariables();
+?>
+<?php if (isset($variables['infos'])) : ?>
+<?php foreach($main_view->infos as $info): ?>
+ <?php echo $this->format($info, 'info'); ?>
+<?php endforeach; ?>
+<?php endif; ?>
+<?php if (isset($main_view->warnings)) : ?>
+<?php foreach($warnings as $warning): ?>
+ <?php echo $this->format($warning, 'warning'); ?>
+<?php endforeach; ?>
+<?php endif; ?>
+<?php if (isset($main_view->errors)) : ?>
+<?php foreach($errors as $error): ?>
+ <?php echo $this->format($error, 'error'); ?>
+<?php endforeach; ?>
+<?php endif; ?>
+ <hr />
<?php echo $this->content; ?>
- <hr>
+ <hr />
<footer>
<p>© 2005 - 2012 by Zend Technologies Ltd. <?php echo $this->translate('All rights reserved.') ?></p>
</footer>
use Zend\ModuleManager\Feature\ConfigProviderInterface;
use Zend\ModuleManager\Feature\BootstrapListenerInterface;
use Zend\ModuleManager\Feature\ServiceProviderInterface;
-
+use Zend\ModuleManager\Feature\ViewHelperProviderInterface;
use Zend\EventManager\EventInterface;
use Zend\Mvc\ModuleRouteListener;
use Galerie\Model\GalerieInfoTable;
use Galerie\Form\GalerieForm;
+use Custom\View\Helper\Format;
+
class Module implements
AutoloaderProviderInterface,
ConfigProviderInterface,
BootstrapListenerInterface,
- ServiceProviderInterface
+ ServiceProviderInterface,
+ ViewHelperProviderInterface
{
public function getAutoloaderConfig()
),
);
}
+
+ public function getViewHelperConfig()
+ {
+ return array(
+ 'factories' => array(
+ 'format' => function($sm) {
+ return new Format;
+ },
+ ),
+ );
+ }
+
+
+
+
}
'controllers' => array(
'invokables' => array(
'Galerie\Controller\Index' =>
- 'Galerie\Controller\IndexController'
+ 'Galerie\Controller\IndexController',
+ ),
+ ),
+ 'controller_plugins' => array(
+ 'invokables' => array(
+ 'MessageGetter' =>
+ 'Custom\Mvc\Controller\Plugin\MessageGetter',
),
),
'view_manager' => array(
public function indexAction()
- {
- return new ViewModel(array(
- 'messages' => $this->flashMessenger()->getMessages(),
- ));
+ {
+ return new ViewModel($this->MessageGetter());
}
public function listAction()
$this->_getGalerieTable()->save($galerie);
$translator = $this->_getTranslator();
+ $messenger = $this->flashMessenger();
+ $messenger->setNamespace('infos');
if ($is_new) {
- $this->flashMessenger()->addMessage($translator->translate('Galerie_added', 'galerie'));
+ $messenger->addMessage($translator->translate('Galerie_added', 'galerie'));
} else {
- $this->flashMessenger()->addMessage($translator->translate('Galerie_updated', 'galerie'));
+ $messenger->addMessage($translator->translate('Galerie_updated', 'galerie'));
}
// Redirection à l'ancienne mode
//return $this->redirect()->toRoute('galerie');
<h1><?php echo $this->translate('Galerie_index_title', 'galerie'); ?></h1>
-<?php foreach($messages as $message): ?>
- <div class='alert-info'><?php echo $message; ?></div>
-<?php endforeach; ?>
-
<table id="galeries" class="sorted">
<thead>
<tr>