Created
November 23, 2012 13:13
-
-
Save rufinus/4135569 to your computer and use it in GitHub Desktop.
Renders blank page if application module is disabled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return array( | |
'modules' => array( | |
'ZendDeveloperTools', | |
'DoctrineModule', | |
'DoctrineORMModule', | |
'cwdAdmin', | |
'ZfcBase', | |
'ZfcRbac', | |
//'Application', | |
'Admin' | |
), | |
'module_listener_options' => array( | |
'config_glob_paths' => array( | |
'config/autoload/{,*.}{global,local}.php', | |
), | |
'module_paths' => array( | |
'./module', | |
'./vendor', | |
), | |
), | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Admin; | |
//use Admin\Model\AlbumTable; | |
use Zend\ModuleManager\ModuleManager; | |
class Module | |
{ | |
public function onBootstrap(\Zend\EventManager\EventInterface $e) | |
{ | |
} | |
public function init(ModuleManager $moduleManager) | |
{ | |
$sharedEvents = $moduleManager->getEventManager()->getSharedManager(); | |
$sharedEvents->attach(__NAMESPACE__, 'dispatch', function($e) { | |
// This event will only be fired when an ActionController under the MyModule namespace is dispatched. | |
$controller = $e->getTarget(); | |
$controller->layout('theme'); | |
}, 100); | |
} | |
public function getAutoloaderConfig() | |
{ | |
return array( | |
'Zend\Loader\ClassMapAutoloader' => array( | |
__DIR__ . '/autoload_classmap.php', | |
), | |
'Zend\Loader\StandardAutoloader' => array( | |
'namespaces' => array( | |
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, | |
), | |
), | |
); | |
} | |
public function getServiceConfig() | |
{ | |
return include __DIR__ . '/config/services.config.php'; | |
} | |
public function getConfig() | |
{ | |
return include __DIR__ . '/config/module.config.php'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Admin; | |
return array( | |
'controllers' => array( | |
'invokables' => array( | |
'Admin\Controller\Index' => 'Admin\Controller\IndexController', | |
'Admin\Controller\Auth' => 'Admin\Controller\AuthController', | |
'Admin\Controller\I18n' => 'Admin\Controller\I18nController', | |
'Admin\Controller\Agency' => 'Admin\Controller\AgencyController', | |
'Admin\Controller\Publisher' => 'Admin\Controller\PublisherController', | |
'Admin\Controller\Publication' => 'Admin\Controller\PublicationController', | |
'Admin\Controller\User' => 'Admin\Controller\UserController', | |
'Admin\Controller\Config' => 'Admin\Controller\ConfigController', | |
'Admin\Controller\Baseprice' => 'Admin\Controller\BasepriceController', | |
), | |
), | |
'view_helpers' => array( | |
'invokables' => array( | |
'getImage' => 'Admin\View\Helper\getImage', | |
) | |
), | |
'translator' => array( | |
'locale' => array('de_AT', 'de_DE'), | |
'translation_file_patterns' => array( | |
array( | |
'type' => 'phparray', | |
'base_dir' => realpath(__DIR__ . '/../../../').'/vendor/zendframework/zendframework/resources/languages/de/', | |
'pattern' => 'Zend_Validate.php', | |
'cache' => 'default_cache' | |
), | |
array( | |
'type' => 'gettext', | |
'base_dir' => 'data/language/', | |
'pattern' => '%s.mo', | |
'text_domain' => 'admin', | |
'cache' => 'default_cache' | |
), | |
), | |
/** | |
'cache' => array( | |
'adapter' => array( | |
'name' => 'apc', | |
'options' => array( | |
), | |
), | |
'plugins' => array( | |
'exception_handler' => array('throw_exceptions' => false), | |
'serializer' | |
) | |
) | |
**/ | |
), | |
'router' => array( | |
'routes' => array( | |
'admin' => array( | |
'type' => 'segment', | |
'may_terminate' => true, | |
'options' => array( | |
'route' => '/[:controller[/:action]][/[:id]]', | |
'constraints' => array( | |
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', | |
'action' => '[a-zA-Z][a-zA-Z0-9_-]*', | |
), | |
'defaults' => array( | |
'__NAMESPACE__' => 'Admin\Controller', | |
'controller' => 'Index', | |
'action' => 'index', | |
), | |
), | |
), | |
), | |
), | |
'view_manager' => array( | |
'display_not_found_reason' => true, | |
'display_exceptions' => true, | |
'not_found_template' => 'error/404', | |
'exception_template' => 'error/index', | |
'template_map' => array( | |
'layout/sidebar' => __DIR__ . '/../view/admin/layout/sidebar.phtml', | |
'error/404' => __DIR__ . '/../view/admin/error/404.phtml', | |
'error/index' => __DIR__ . '/../view/admin/error/index.phtml', | |
'theme' => __DIR__ . '/../view/admin/layout/developr.phtml', | |
), | |
'template_path_stack' => array( | |
'admin' => __DIR__ . '/../view', | |
), | |
'strategies' => array( | |
'ViewJsonStrategy', | |
), | |
), | |
// Doctrine config | |
'doctrine' => array( | |
'driver' => array( | |
'Application_driver' => array( | |
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver', | |
'cache' => 'array', | |
'paths' => array(__DIR__ . '/../../Admin/src/Admin/Entity') | |
), | |
'orm_default' => array( | |
'drivers' => array( | |
'Admin\Entity' => 'Application_driver' | |
) | |
), | |
), | |
'configuration' => array( | |
'orm_default' => array( | |
'metadataCache' => 'apc' | |
) | |
) | |
), | |
'zfcrbac' => array( | |
'firewalls' => array( | |
'ZfcRbac\Firewall\Controller' => array( | |
array('controller' => 'Admin\Controller\User', 'roles' => array('admin')), | |
array('controller' => 'Admin\Controller\I18n', 'roles' => 'admin'), | |
array('controller' => 'Admin\Controller\Publisher', 'roles' => 'admin'), | |
array('controller' => 'Admin\Controller\Publication', 'roles' => 'admin'), | |
array('controller' => 'Admin\Controller\Agency', 'roles' => 'admin'), | |
array('controller' => 'Admin\Controller\Baseprice', 'roles' => 'admin'), | |
array('controller' => 'Admin\Controller\Index', 'action' => 'index', 'roles' => array('guest', 'admin', 'publication', 'agency')), | |
array('controller' => 'Admin\Controller\Index', 'action' => 'agencydash', 'roles' => 'admin') | |
), | |
/* | |
'ZfcRbac\Firewall\Route' => array( | |
array('route' => 'profiles/add', 'roles' => 'member'), | |
array('route' => 'admin/*', 'roles' => 'administrator') | |
), | |
*/ | |
), | |
'providers' => array( | |
'ZfcRbac\Provider\AdjacencyList\Role\DoctrineDbal' => array( | |
'connection' => 'doctrine.connection.orm_default', | |
'options' => array( | |
'table' => 'role', | |
'id_column' => 'role_id', | |
'name_column' => 'role_name', | |
'join_column' => 'parent_role_id' | |
) | |
), | |
'ZfcRbac\Provider\Generic\Permission\DoctrineDbal' => array( | |
'connection' => 'doctrine.connection.orm_default', | |
'options' => array( | |
'permission_table' => 'permission', | |
'role_table' => 'role', | |
'role_join_table' => 'role_has_permission', | |
'permission_id_column' => 'permission_id', | |
'permission_join_column'=> 'permission_id', | |
'role_id_column' => 'role_id', | |
'role_join_column' => 'role_id', | |
'permission_name_column'=> 'description', | |
'role_name_column' => 'role_name' | |
) | |
), | |
), | |
'identity_provider' => 'standard_identity' | |
) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Admin; | |
use cwdCommon\ServiceManager\EntityAwareInterface; | |
return array( | |
'invokables' => array( | |
'serviceFactory' => 'cwdAdmin\Service\ServiceFactory' | |
), | |
'factories' => array( | |
'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory', | |
'standard_identity' => function ($sm) { | |
$auth = $sm->get('cwdAdmin.auth_service'); | |
if(!$auth->hasIdentity()) { | |
$roles = array('guest'); | |
$identity = new \ZfcRbac\Identity\StandardIdentity($roles); | |
}else{ | |
$em = $sm->get('Doctrine\ORM\EntityManager'); | |
$session = $auth->getIdentity(); | |
$identity = $em->find('Admin\Entity\User', $session['userId']); | |
// Define the mandator this user belongs to | |
define('MANDATOR', $identity->getMandator()->getMandatorId()); | |
define('ROLE', $identity->getRole()->getRoleName()); | |
} | |
return $identity; | |
}, | |
'navigation' => 'cwdAdmin\Service\AdminNavigation', | |
'ZfcRbac\View\UnauthorizedStrategy' => 'cwdAdmin\Service\UnauthorizedStrategyFactory', | |
'doctrine.cache.apc' => function($sm) { | |
return new \Doctrine\Common\Cache\ApcCache(); | |
}, | |
'default_cache' => function($sm) { | |
$cache = \Zend\Cache\StorageFactory::factory(array( | |
'adapter' => array( | |
'name' => 'apc', | |
'options' => array( | |
), | |
), | |
'plugins' => array( | |
'exception_handler' => array('throw_exceptions' => false), | |
'serializer' | |
) | |
)); | |
return $cache; | |
}, | |
'Service_I18n' => function ($sm) { | |
$factory = $sm->get('serviceFactory'); | |
$object = $factory->setUp(new \Admin\Service\I18n()); | |
return $object; | |
}, | |
'Service_Agency' => function ($sm) { | |
$factory = $sm->get('serviceFactory'); | |
$object = $factory->setUp(new \Admin\Service\Agency()); | |
return $object; | |
}, | |
'Service_Publisher' => function ($sm) { | |
$factory = $sm->get('serviceFactory'); | |
$object = $factory->setUp(new \Admin\Service\Publisher()); | |
return $object; | |
}, | |
'Service_Publication' => function ($sm) { | |
$factory = $sm->get('serviceFactory'); | |
$object = $factory->setUp(new \Admin\Service\Publication()); | |
return $object; | |
}, | |
'Service_User' => function ($sm) { | |
$factory = $sm->get('serviceFactory'); | |
$object = $factory->setUp(new \Admin\Service\User()); | |
return $object; | |
}, | |
'Service_Config' => function ($sm) { | |
$factory = $sm->get('serviceFactory'); | |
$object = $factory->setUp(new \Admin\Service\Config()); | |
return $object; | |
}, | |
'Service_Baseprice' => function ($sm) { | |
$factory = $sm->get('serviceFactory'); | |
$object = $factory->setUp(new \Admin\Service\Baseprice()); | |
return $object; | |
} | |
), | |
'initializers' => array( | |
), | |
'shared' => array( | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment