58 lines
2.1 KiB
PHP
58 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* Zend Framework (http://framework.zend.com/)
|
|
*
|
|
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
|
|
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
|
|
* @license http://framework.zend.com/license/new-bsd New BSD License
|
|
*/
|
|
|
|
namespace Application;
|
|
|
|
use Zend\ModuleManager\ModuleManager;
|
|
use Zend\Mvc\ModuleRouteListener;
|
|
use Zend\Mvc\MvcEvent;
|
|
use Sookon\Authentication\AuthenticationService;
|
|
use Sookon\Helpers\View as view;
|
|
use Sookon\Helpers\LayoutHelpers;
|
|
|
|
class Module
|
|
{
|
|
|
|
public function onBootstrap(MvcEvent $e)
|
|
{
|
|
$eventManager = $e->getApplication()->getEventManager();
|
|
$moduleRouteListener = new ModuleRouteListener();
|
|
$moduleRouteListener->attach($eventManager);
|
|
|
|
$e->getApplication()->getEventManager()->attach(MvcEvent::EVENT_DISPATCH, array(new LayoutHelpers, 'resetSession'),1000);
|
|
$e->getApplication()->getEventManager()->attach(MvcEvent::EVENT_DISPATCH,array(new AuthenticationService,'run'),400);
|
|
$e->getApplication()->getEventManager()->attach(MvcEvent::EVENT_RENDER, array(new LayoutHelpers, 'setLayoutTitle'),200);
|
|
$e->getApplication()->getEventManager()->attach(MvcEvent::EVENT_DISPATCH, array(new LayoutHelpers, 'setPageNav'),80);
|
|
$e->getApplication()->getEventManager()->attach(MvcEvent::EVENT_DISPATCH, array(new LayoutHelpers, 'mobileDetect'),80);
|
|
|
|
}
|
|
|
|
public function init(ModuleManager $moduleManager)
|
|
{
|
|
$sharedEvents = $moduleManager->getEventManager()->getSharedManager();
|
|
$sharedEvents->attach(__NAMESPACE__, MvcEvent::EVENT_DISPATCH ,array(new LayoutHelpers, 'setMemberScript'), 100);
|
|
}
|
|
|
|
public function getConfig()
|
|
{
|
|
return include __DIR__ . '/config/module.config.php';
|
|
}
|
|
|
|
public function getAutoloaderConfig()
|
|
{
|
|
return array(
|
|
'Zend\Loader\StandardAutoloader' => array(
|
|
'namespaces' => array(
|
|
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|