Commit ce4be830 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Initial commit

parents
<?php
namespace UnicaenDocument;
use Zend\Mvc\ModuleRouteListener;
use Zend\Mvc\MvcEvent;
use Zend\Stdlib\ArrayUtils;
use Zend\Stdlib\Glob;
use Zend\Config\Factory as ConfigFactory;
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('Zend\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(
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
),
),
);
}
}
{
"name": "unicaen/document",
"description": "Module de gestion de contenu de document",
"repositories": [
{
"type": "composer",
"url": "https://gest.unicaen.fr/packagist"
}
],
"require": {
"unicaen/app": "^3.x",
"unicaen/utilisateur": "dev-zf-3.x",
"unicaen/privilege": "dev-zf-3.x"
},
"autoload": {
"psr-0": {
"UnicaenUtilisateurLdapAdapter": "src/"
},
"classmap": [
"./Module.php"
]
}
}
<?php
use UnicaenDocument\Controller\ContenuController;
use UnicaenDocument\Controller\ContenuControllerFactory;
use UnicaenDocument\Form\Contenu\ContenuForm;
use UnicaenDocument\Form\Contenu\ContenuFormFactory;
use UnicaenDocument\Form\Contenu\ContenuHydrator;
use UnicaenDocument\Form\Contenu\ContenuHydratorFactory;
use UnicaenDocument\Provider\Privilege\DocumentcontentPrivileges;
use UnicaenDocument\Service\Contenu\ContenuService;
use UnicaenDocument\Service\Contenu\ContenuServiceFactory;
use UnicaenDocument\Service\Exporter\ExporterService;
use UnicaenDocument\Service\Exporter\ExporterServiceFactory;
use UnicaenPrivilege\Guard\PrivilegeController;
use Zend\Router\Http\Literal;
use Zend\Router\Http\Segment;
return [
'bjyauthorize' => [
'guards' => [
PrivilegeController::class => [
[
'controller' => ContenuController::class,
'action' => [
'index',
'afficher',
],
'privileges' => [
DocumentcontentPrivileges::DOCUMENTCONTENU_INDEX,
],
],
[
'controller' => ContenuController::class,
'action' => [
'ajouter',
],
'privileges' => [
DocumentcontentPrivileges::DOCUMENTCONTENU_AJOUTER,
],
],
[
'controller' => ContenuController::class,
'action' => [
'modifier',
],
'privileges' => [
DocumentcontentPrivileges::DOCUMENTCONTENU_MODIFIER,
],
],
[
'controller' => ContenuController::class,
'action' => [
'historiser',
'restaurer',
],
'privileges' => [
DocumentcontentPrivileges::DOCUMENTCONTENU_HISTORISER,
],
],
[
'controller' => ContenuController::class,
'action' => [
'detruire',
],
'privileges' => [
DocumentcontentPrivileges::DOCUMENTCONTENU_SUPPRIMER,
],
],
],
],
],
'navigation' => [
'default' => [
'home' => [
'pages' => [
'administration' => [
'pages' => [
'contenu' => [
'pages' => [
'contenu' => [
'label' => 'Contenu',
'route' => 'contenu/contenu',
'resource' => PrivilegeController::getResourceId(ContenuController::class, 'index'),
'order' => 10001,
],
],
],
],
],
],
],
],
],
'router' => [
'routes' => [
'contenu' => [
'child_routes' => [
'contenu' => [
'type' => Literal::class,
'options' => [
'route' => '/contenu',
'defaults' => [
'controller' => ContenuController::class,
'action' => 'index',
],
],
'may_terminate' => true,
'child_routes' => [
'afficher' => [
'type' => Segment::class,
'options' => [
'route' => '/afficher/:contenu',
'defaults' => [
'controller' => ContenuController::class,
'action' => 'afficher',
],
],
],
'ajouter' => [
'type' => Literal::class,
'options' => [
'route' => '/ajouter',
'defaults' => [
'controller' => ContenuController::class,
'action' => 'ajouter',
],
],
],
'modifier' => [
'type' => Segment::class,
'options' => [
'route' => '/modifier/:contenu',
'defaults' => [
'controller' => ContenuController::class,
'action' => 'modifier',
],
],
],
'restaurer' => [
'type' => Segment::class,
'options' => [
'route' => '/restaurer/:contenu',
'defaults' => [
'controller' => ContenuController::class,
'action' => 'restaurer',
],
],
],
'historiser' => [
'type' => Segment::class,
'options' => [
'route' => '/historiser/:contenu',
'defaults' => [
'controller' => ContenuController::class,
'action' => 'historiser',
],
],
],
'detruire' => [
'type' => Segment::class,
'options' => [
'route' => '/detruire/:contenu',
'defaults' => [
'controller' => ContenuController::class,
'action' => 'detruire',
],
],
],
],
],
],
],
],
],
'service_manager' => [
'factories' => [
ContenuService::class => ContenuServiceFactory::class,
ExporterService::class => ExporterServiceFactory::class,
],
],
'form_elements' => [
'factories' => [
ContenuForm::class => ContenuFormFactory::class,
],
],
'hydrators' => [
'factories' => [
ContenuHydrator::class => ContenuHydratorFactory::class,
],
],
'controllers' => [
'factories' => [
ContenuController::class => ContenuControllerFactory::class,
]
],
];
<?php
use UnicaenDocument\Controller\IndexController;
use UnicaenDocument\Controller\IndexControllerFactory;
use UnicaenDocument\Provider\Privilege\DocumentcontentPrivileges;
use UnicaenDocument\Provider\Privilege\DocumentmacroPrivileges;
use UnicaenPrivilege\Guard\PrivilegeController;
use Zend\Router\Http\Literal;
return [
'bjyauthorize' => [
'guards' => [
PrivilegeController::class => [
[
'controller' => IndexController::class,
'action' => [
'index',
],
'privileges' => [
DocumentcontentPrivileges::DOCUMENTCONTENU_INDEX,
DocumentmacroPrivileges::DOCUMENTMACRO_INDEX,
],
],
],
],
],
'navigation' => [
'default' => [
'home' => [
'pages' => [
'administration' => [
'pages' => [
'contenu' => [
'label' => 'Contenu',
'route' => 'contenu',
'resource' => PrivilegeController::getResourceId(IndexController::class, 'index'),
'order' => 10001,
'pages' => [
],
],
],
],
],
],
],
],
'router' => [
'routes' => [
'contenu' => [
'type' => Literal::class,
'options' => [
'route' => '/contenu',
'defaults' => [
'controller' => IndexController::class,
'action' => 'index',
],
],
'may_terminate' => true,
'child_routes' => [ ],
],
],
],
'service_manager' => [
'factories' => [
],
],
'form_elements' => [
'factories' => [
],
],
'hydrators' => [
'factories' => [
],
],
'controllers' => [
'factories' => [
IndexController::class => IndexControllerFactory::class,
]
],
];
<?php
use UnicaenDocument\Controller\MacroController;
use UnicaenDocument\Controller\MacroControllerFactory;
use UnicaenDocument\Form\Macro\MacroForm;
use UnicaenDocument\Form\Macro\MacroFormFactory;
use UnicaenDocument\Form\Macro\MacroHydrator;
use UnicaenDocument\Form\Macro\MacroHydratorFactory;
use UnicaenDocument\Provider\Privilege\DocumentmacroPrivileges;
use UnicaenDocument\Service\Macro\MacroService;
use UnicaenDocument\Service\Macro\MacroServiceFactory;
use UnicaenPrivilege\Guard\PrivilegeController;
use Zend\Router\Http\Literal;
use Zend\Router\Http\Segment;
return [
'bjyauthorize' => [
'guards' => [
PrivilegeController::class => [
[
'controller' => MacroController::class,
'action' => [
'index',
'generer-json'
],
'privileges' => [
DocumentmacroPrivileges::DOCUMENTMACRO_INDEX,
],
],
[
'controller' => MacroController::class,
'action' => [
'ajouter',
],
'privileges' => [
DocumentmacroPrivileges::DOCUMENTMACRO_AJOUTER,
],
],
[
'controller' => MacroController::class,
'action' => [
'modifier',
],
'privileges' => [
DocumentmacroPrivileges::DOCUMENTMACRO_MODIFIER,
],
],
[
'controller' => MacroController::class,
'action' => [
'historiser',
'restaurer',
],
'privileges' => [
DocumentmacroPrivileges::DOCUMENTMACRO_HISTORISER,
],
],
[
'controller' => MacroController::class,
'action' => [
'supprimer',
],
'privileges' => [
DocumentmacroPrivileges::DOCUMENTMACRO_SUPPRIMER,
],
],
],
],
],
'navigation' => [
'default' => [
'home' => [
'pages' => [
'administration' => [
'pages' => [
'contenu' => [
'pages' => [
'macro' => [
'label' => 'Macro',
'route' => 'contenu/macro',
'resource' => PrivilegeController::getResourceId(MacroController::class, 'index'),
'order' => 10001,
],
],
],
],
],
],
],
],
],
'router' => [
'routes' => [
'contenu' => [
'child_routes' => [
'macro' => [
'type' => Literal::class,
'options' => [
'route' => '/macro',
'defaults' => [
'controller' => MacroController::class,
'action' => 'index',
],
],
'may_terminate' => true,
'child_routes' => [
'generer-json' => [
'type' => Literal::class,
'options' => [
'route' => '/generer-json',
'defaults' => [
'controller' => MacroController::class,
'action' => 'generer-json',
],
],
],
'ajouter' => [
'type' => Literal::class,
'options' => [
'route' => '/ajouter',
'defaults' => [
'controller' => MacroController::class,
'action' => 'ajouter',
],
],
],
'modifier' => [
'type' => Segment::class,
'options' => [
'route' => '/modifier/:macro',
'defaults' => [
'controller' => MacroController::class,
'action' => 'modifier',
],
],
],
'historiser' => [
'type' => Segment::class,
'options' => [
'route' => '/historiser/:macro',
'defaults' => [
'controller' => MacroController::class,
'action' => 'historiser',
],
],
],
'restaurer' => [
'type' => Segment::class,
'options' => [
'route' => '/restaurer/:macro',
'defaults' => [
'controller' => MacroController::class,
'action' => 'restaurer',
],
],
],
'supprimer' => [
'type' => Segment::class,
'options' => [
'route' => '/supprimer/:macro',
'defaults' => [
'controller' => MacroController::class,
'action' => 'supprimer',
],
],
],
],
],
],
],
],
],
'service_manager' => [
'factories' => [
MacroService::class => MacroServiceFactory::class,
],
],
'form_elements' => [
'factories' => [
MacroForm::class => MacroFormFactory::class,
],
],
'hydrators' => [
'factories' => [
MacroHydrator::class => MacroHydratorFactory::class,
],
],
'controllers' => [
'factories' => [
MacroController::class => MacroControllerFactory::class,
]
],
];
<?php
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain;
use Doctrine\ORM\Mapping\Driver\XmlDriver;
return [
'doctrine' => [
'driver' => [
'orm_default' => [
'class' => MappingDriverChain::class,
'drivers' => [
'UnicaenDocument\Entity\Db' => 'orm_default_xml_driver',
],
],
'orm_default_xml_driver' => [
'class' => XmlDriver::class,
'cache' => 'apc',
'paths' => [
__DIR__ . '/../src/UnicaenDocument/Entity/Db/Mapping',
],
],
],
'cache' => [
'apc' => [
'namespace' => 'UNICAEN-DOCUMENT__' . __NAMESPACE__,
],
],
],
'view_manager' => [
'template_path_stack' => [
__DIR__ . '/../view',
],
],
'view_helpers' => [
'aliases' => [
],
'factories' => [
],
],
];
\ No newline at end of file
<?php
namespace UnicaenDocument\Controller;
use UnicaenDocument\Entity\Db\Content;
use UnicaenDocument\Form\Contenu\ContenuFormAwareTrait;
use UnicaenDocument\Service\Contenu\ContenuServiceAwareTrait;