Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
app
Commits
b9e9ac6e
Commit
b9e9ac6e
authored
Aug 31, 2017
by
Laurent Lécluse
Browse files
Ajout des modifications du messenger pour pouvoir faire fonctionner le mouchard
parent
3dd876e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/UnicaenApp/View/Helper/Messenger.php
View file @
b9e9ac6e
...
...
@@ -5,6 +5,8 @@ use Exception;
use
UnicaenApp\Traits\MessageAwareInterface
;
use
UnicaenApp\Traits\MessageAwareTrait
;
use
UnicaenApp\Exception\LogicException
;
use
Zend\EventManager\EventManagerAwareInterface
;
use
Zend\EventManager\EventManagerAwareTrait
;
use
Zend\View\Helper\AbstractHelper
;
use
Zend\View\Helper\FlashMessenger
;
use
Zend\View\Helper\HtmlTag
;
...
...
@@ -19,8 +21,11 @@ use Zend\View\Renderer\PhpRenderer;
*
* @author Bertrand GAUTHIER <bertrand.gauthier@unicaen.fr>
*/
class
Messenger
extends
AbstractHelper
implements
MessageAwareInterface
class
Messenger
extends
AbstractHelper
implements
MessageAwareInterface
,
EventManagerAwareInterface
{
const
EVENT_RENDER
=
'unicaen-app-messenger-render'
;
use
EventManagerAwareTrait
;
use
MessageAwareTrait
;
const
NAMESPACED_SEVERITY_SEPARATOR
=
'/'
;
...
...
@@ -103,10 +108,14 @@ class Messenger extends AbstractHelper implements MessageAwareInterface
foreach
(
$this
->
getSortedMessages
()
as
$severity
=>
$array
)
{
foreach
(
$array
as
$priority
=>
$message
)
{
if
(
$em
=
$this
->
getEventManager
()){
$em
->
trigger
(
self
::
EVENT_RENDER
,
null
,
compact
(
'severity'
,
'message'
));
}
$out
.
=
sprintf
(
$this
->
getTemplate
(
is_string
(
$severity
)
?
$severity
:
(
is_string
(
$priority
)
?
$priority
:
'info'
)),
implode
(
'<br />'
,
(
array
)
$message
)
);
);
;
}
}
...
...
src/UnicaenApp/View/Helper/MessengerFactory.php
0 → 100644
View file @
b9e9ac6e
<?php
namespace
UnicaenApp\View\Helper
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
/**
* Description of MessengerFactory
*
* @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
*/
class
MessengerFactory
implements
FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $helperPluginManager
* @return Messenger
*/
public
function
createService
(
ServiceLocatorInterface
$helperPluginManager
)
{
$messenger
=
new
Messenger
();
/* @var $application Application */
$application
=
$helperPluginManager
->
getServiceLocator
()
->
get
(
'application'
);
if
(
$application
){
$messenger
->
setEventManager
(
$application
->
getEventManager
());
}
return
$messenger
;
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment