Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • alc-refactoring-entity
  • sb-comments-update
  • alc-dev
  • 1.0.6
  • 1.0.5
  • 1.0.4
  • 1.0.3
  • 1.0.2
  • 1.0.1
  • 0.1.5
  • 1.0.0
  • 0.1.4
  • 0.1.3
  • 0.1.2
  • 0.1.1
  • 0.0.15
  • 0.0.14
  • 0.0.13
  • 0.0.12
  • 0.0.11
  • 0.0.10
  • 0.0.9
  • 0.0.8
24 results

Module.php

  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Module.php 1.98 KiB
    <?php
    /**
     * Zend Framework (http://framework.zend.com/)
     *
     * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
     * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
     * @license   http://framework.zend.com/license/new-bsd New BSD License
     */
    
    namespace UnicaenSignature;
    
    use Laminas\Config\Factory as ConfigFactory;
    use Laminas\Http\Request as HttpRequest;
    use Laminas\Mvc\ModuleRouteListener;
    use Laminas\Mvc\MvcEvent;
    use Laminas\Stdlib\ArrayUtils;
    use Laminas\Stdlib\Glob;
    
    class Module
    {
        public function onBootstrap(MvcEvent $e)
        {
            $e->getApplication()->getServiceManager()->get('translator');
            $eventManager        = $e->getApplication()->getEventManager();
            $moduleRouteListener = new ModuleRouteListener();
            $moduleRouteListener->attach($eventManager);
    
            /* Active un layout spécial si la requête est de type AJAX. Valable pour TOUS les modules de l'application. */
            $eventManager->getSharedManager()->attach('Laminas\Mvc\Controller\AbstractActionController', 'dispatch',
                function (MvcEvent $e) {
                    $request = $e->getRequest();
                    if ($request instanceof HttpRequest && $request->isXmlHttpRequest()) {
                        $e->getTarget()->layout('layout/ajax.phtml');
                    }
                }
            );
        }
    
        public function getConfig()
        {
            $configInit = [
                __DIR__ . '/config/module.config.php'
            ];
            $configFiles = ArrayUtils::merge(
                $configInit,
                Glob::glob(__DIR__ . '/config/merged/{,*.}{config}.php', Glob::GLOB_BRACE)
            );
    
            return ConfigFactory::fromFiles($configFiles);
        }
    
        public function getAutoloaderConfig()
        {
            return array(
                'Laminas\Loader\StandardAutoloader' => array(
                    'namespaces' => array(
                        __NAMESPACE__ => __DIR__ . '/src/',
                    ),
                ),
            );
        }
    }