Loading code/GenerateRubrique.php +125 −128 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ Util::displayForm($form); if (($controller->getRequest()->isPost()) && ($form->isValid())) { $baseOrig = $form->get('Origine')->getValue() . 'module/Application/'; $nom = $form->get('tables')->getValue(); $basefs = '/var/www/Web/module/Application/'; $basefs = 'module/Application/'; $nomsous = strtoupper($nom); $nomvisu = $nomsous . "_VISUALISATION"; $nomedit = $nomsous . "_EDITION"; Loading Loading @@ -129,15 +129,11 @@ if (($controller->getRequest()->isPost()) && ($form->isValid())) { $nbe++; } } if (file_exists('/var/www/Web')) { exec("rm -rf /var/www/Web/*", $stdout, $err); } else { mkdir('/var/www/Web',0770) or die('Vous devez créer un sous répertoire /var/www/Web avec les droits d\'écriture! pour l\'utilisateur www-data<BR>'); } // $res = shell_exec("Web/module/Application"); // if (file_exists('/tmp')) { // exec("rm -rf /tmp", $stdout, $err); // } // mkdir('/tmp', 0770) or die('Vous devez créer un sous répertoire /var/www/Web avec les droits d\'écriture! pour l\'utilisateur www-data<BR>'); //echo "res:$res<BR>"; // mise en place des champs $txt0 = $txt01 = $txt4 = $txt41 = $txt42 = $txt43 = $txt44 = $txt45 = $txt5 = $txt53 = $txt6 = $txt7 = ''; Loading Loading @@ -411,9 +407,11 @@ class nommajHydrator implements HydratorInterface $res = exec("mkdir -p $chemin", $err); // echo "res:$res<BR>"; } $hdl = fopen($ficout, 'wb'); $lgWrite = fwrite($hdl, $txt); fclose($hdl); //$hdl = fopen($ficout, 'wb'); echo '<BR><BR>'.$ficout.'<BR>'; echo str_replace(array(" ","<",">","\"","\n"),array(' ','<','>','"','<br>'),$txt); // $lgWrite = fwrite($hdl, $txt); // fclose($hdl); if (file_exists($ficenr)) { if ($nonRemplace) { unset($result); Loading @@ -436,5 +434,4 @@ class nommajHydrator implements HydratorInterface } } echo "<BR><span style=\"color:#006600; \">Résultat dans l'arborescence $basefs</span>"; } composer.lock +149 −2155 File changed.Preview size limit exceeded, changes collapsed. Show changes module/Application/config/structure.config.php +88 −12 Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ namespace Application; use Application\Provider\Privilege\Privileges; use UnicaenAuth\Guard\PrivilegeController; return [ 'router' => [ 'routes' => [ Loading @@ -28,27 +31,95 @@ return [ ], ], ], 'index2' => [ 'type' => 'Segment', 'options' => [ 'route' => '/index2/:structure', 'constraints' => [ ], 'defaults' => [ 'action' => 'index2', ], ], ], 'delete' => [ 'type' => 'Segment', 'options' => [ 'route' => '/delete/:structure', 'constraints' => [ 'structure' => '[0-9]*', ], 'defaults' => [ 'action' => 'delete', ], ], ], 'saisie' => [ 'type' => 'Segment', 'options' => [ 'route' => '/saisie/[:structure]', 'constraints' => [ 'structure' => '[0-9]*', ], 'defaults' => [ 'action' => 'saisie', ], ], ], ], ], ], ], 'navigation' => [ 'default' => [ 'home' => [ 'pages' => [ 'administration' => [ 'pages' => [ 'structure' => [ 'label' => 'Structure', 'icon' => 'fa fa-graduation-cap', 'route' => 'structure', 'resource' => PrivilegeController::getResourceId('Application\Controller\Structure', 'index2'), 'order' => 80, 'border-color' => '#BBCF55', ], ], ], ], ], ], ], 'bjyauthorize' => [ 'resource_providers' => [ 'BjyAuthorize\Provider\Resource\Config' => [ 'Structure' => [], ], ], 'guards' => [ 'BjyAuthorize\Guard\Controller' => [ PrivilegeController::class => [ [ 'controller' => 'Application\Controller\Structure', 'action' => ['voir'], 'roles' => ['user'], 'action' => ['index2'], 'privileges' => Privileges::STRUCTURES_ADMINISTRATION_VISUALISATION, ], [ 'controller' => 'Application\Controller\Structure', 'action' => ['saisie', 'delete'], 'privileges' => Privileges::STRUCTURES_ADMINISTRATION_EDITION, ], [ 'controller' => 'Application\Controller\Structure', 'action' => ['voir'], 'roles' => ['user'], ], 'resource_providers' => [ 'BjyAuthorize\Provider\Resource\Config' => [ 'Structure' => [], ], ], ], 'controllers' => [ 'invokables' => [ 'Application\Controller\Structure' => Controller\StructureController::class, Loading @@ -64,4 +135,9 @@ return [ 'structure' => View\Helper\StructureViewHelper::class, ], ], 'form_elements' => [ 'invokables' => [ Form\Structure\StructureSaisieForm::class => Form\Structure\StructureSaisieForm::class, ], ], ]; module/Application/src/Application/Controller/StructureController.php +60 −1 Original line number Diff line number Diff line Loading @@ -3,6 +3,10 @@ namespace Application\Controller; use RuntimeException; use Application\Entity\Db\Structure; use Application\Service\Traits\StructureServiceAwareTrait; use Application\Form\Structure\Traits\StructureSaisieFormAwareTrait; use UnicaenApp\View\Model\MessengerViewModel; /** Loading @@ -12,6 +16,61 @@ use RuntimeException; */ class StructureController extends AbstractController { use StructureServiceAwareTrait; use StructureSaisieFormAwareTrait; public function index2Action() { $this->em()->getFilters()->enable('historique')->init([ Structure::class, ]); $structures = $this->getServiceStructure()->getList(); return compact('structures'); } public function saisieAction() { /* @var $structure Structure */ $structure = $this->getEvent()->getParam('structure'); $form = $this->getFormStructureSaisie(); if (empty($structure)) { $title = 'Création d\'une nouvelle Structure'; $structure = $this->getServiceStructure()->newEntity(); } else { $title = 'Édition d\'une Structure'; } $form->bindRequestSave($structure, $this->getRequest(), function (Structure $fr) { try { $this->getServiceStructure()->save($fr); $this->flashMessenger()->addSuccessMessage('Enregistrement effectué'); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } }); return compact('form', 'title'); } public function deleteAction() { $structure = $this->getEvent()->getParam('structure'); try { $this->getServiceStructure()->delete($structure); $this->flashMessenger()->addSuccessMessage("Structure supprimée avec succès."); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } return new MessengerViewModel(compact('structure')); } public function voirAction() { Loading Loading
code/GenerateRubrique.php +125 −128 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ Util::displayForm($form); if (($controller->getRequest()->isPost()) && ($form->isValid())) { $baseOrig = $form->get('Origine')->getValue() . 'module/Application/'; $nom = $form->get('tables')->getValue(); $basefs = '/var/www/Web/module/Application/'; $basefs = 'module/Application/'; $nomsous = strtoupper($nom); $nomvisu = $nomsous . "_VISUALISATION"; $nomedit = $nomsous . "_EDITION"; Loading Loading @@ -129,15 +129,11 @@ if (($controller->getRequest()->isPost()) && ($form->isValid())) { $nbe++; } } if (file_exists('/var/www/Web')) { exec("rm -rf /var/www/Web/*", $stdout, $err); } else { mkdir('/var/www/Web',0770) or die('Vous devez créer un sous répertoire /var/www/Web avec les droits d\'écriture! pour l\'utilisateur www-data<BR>'); } // $res = shell_exec("Web/module/Application"); // if (file_exists('/tmp')) { // exec("rm -rf /tmp", $stdout, $err); // } // mkdir('/tmp', 0770) or die('Vous devez créer un sous répertoire /var/www/Web avec les droits d\'écriture! pour l\'utilisateur www-data<BR>'); //echo "res:$res<BR>"; // mise en place des champs $txt0 = $txt01 = $txt4 = $txt41 = $txt42 = $txt43 = $txt44 = $txt45 = $txt5 = $txt53 = $txt6 = $txt7 = ''; Loading Loading @@ -411,9 +407,11 @@ class nommajHydrator implements HydratorInterface $res = exec("mkdir -p $chemin", $err); // echo "res:$res<BR>"; } $hdl = fopen($ficout, 'wb'); $lgWrite = fwrite($hdl, $txt); fclose($hdl); //$hdl = fopen($ficout, 'wb'); echo '<BR><BR>'.$ficout.'<BR>'; echo str_replace(array(" ","<",">","\"","\n"),array(' ','<','>','"','<br>'),$txt); // $lgWrite = fwrite($hdl, $txt); // fclose($hdl); if (file_exists($ficenr)) { if ($nonRemplace) { unset($result); Loading @@ -436,5 +434,4 @@ class nommajHydrator implements HydratorInterface } } echo "<BR><span style=\"color:#006600; \">Résultat dans l'arborescence $basefs</span>"; }
module/Application/config/structure.config.php +88 −12 Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ namespace Application; use Application\Provider\Privilege\Privileges; use UnicaenAuth\Guard\PrivilegeController; return [ 'router' => [ 'routes' => [ Loading @@ -28,27 +31,95 @@ return [ ], ], ], 'index2' => [ 'type' => 'Segment', 'options' => [ 'route' => '/index2/:structure', 'constraints' => [ ], 'defaults' => [ 'action' => 'index2', ], ], ], 'delete' => [ 'type' => 'Segment', 'options' => [ 'route' => '/delete/:structure', 'constraints' => [ 'structure' => '[0-9]*', ], 'defaults' => [ 'action' => 'delete', ], ], ], 'saisie' => [ 'type' => 'Segment', 'options' => [ 'route' => '/saisie/[:structure]', 'constraints' => [ 'structure' => '[0-9]*', ], 'defaults' => [ 'action' => 'saisie', ], ], ], ], ], ], ], 'navigation' => [ 'default' => [ 'home' => [ 'pages' => [ 'administration' => [ 'pages' => [ 'structure' => [ 'label' => 'Structure', 'icon' => 'fa fa-graduation-cap', 'route' => 'structure', 'resource' => PrivilegeController::getResourceId('Application\Controller\Structure', 'index2'), 'order' => 80, 'border-color' => '#BBCF55', ], ], ], ], ], ], ], 'bjyauthorize' => [ 'resource_providers' => [ 'BjyAuthorize\Provider\Resource\Config' => [ 'Structure' => [], ], ], 'guards' => [ 'BjyAuthorize\Guard\Controller' => [ PrivilegeController::class => [ [ 'controller' => 'Application\Controller\Structure', 'action' => ['voir'], 'roles' => ['user'], 'action' => ['index2'], 'privileges' => Privileges::STRUCTURES_ADMINISTRATION_VISUALISATION, ], [ 'controller' => 'Application\Controller\Structure', 'action' => ['saisie', 'delete'], 'privileges' => Privileges::STRUCTURES_ADMINISTRATION_EDITION, ], [ 'controller' => 'Application\Controller\Structure', 'action' => ['voir'], 'roles' => ['user'], ], 'resource_providers' => [ 'BjyAuthorize\Provider\Resource\Config' => [ 'Structure' => [], ], ], ], 'controllers' => [ 'invokables' => [ 'Application\Controller\Structure' => Controller\StructureController::class, Loading @@ -64,4 +135,9 @@ return [ 'structure' => View\Helper\StructureViewHelper::class, ], ], 'form_elements' => [ 'invokables' => [ Form\Structure\StructureSaisieForm::class => Form\Structure\StructureSaisieForm::class, ], ], ];
module/Application/src/Application/Controller/StructureController.php +60 −1 Original line number Diff line number Diff line Loading @@ -3,6 +3,10 @@ namespace Application\Controller; use RuntimeException; use Application\Entity\Db\Structure; use Application\Service\Traits\StructureServiceAwareTrait; use Application\Form\Structure\Traits\StructureSaisieFormAwareTrait; use UnicaenApp\View\Model\MessengerViewModel; /** Loading @@ -12,6 +16,61 @@ use RuntimeException; */ class StructureController extends AbstractController { use StructureServiceAwareTrait; use StructureSaisieFormAwareTrait; public function index2Action() { $this->em()->getFilters()->enable('historique')->init([ Structure::class, ]); $structures = $this->getServiceStructure()->getList(); return compact('structures'); } public function saisieAction() { /* @var $structure Structure */ $structure = $this->getEvent()->getParam('structure'); $form = $this->getFormStructureSaisie(); if (empty($structure)) { $title = 'Création d\'une nouvelle Structure'; $structure = $this->getServiceStructure()->newEntity(); } else { $title = 'Édition d\'une Structure'; } $form->bindRequestSave($structure, $this->getRequest(), function (Structure $fr) { try { $this->getServiceStructure()->save($fr); $this->flashMessenger()->addSuccessMessage('Enregistrement effectué'); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } }); return compact('form', 'title'); } public function deleteAction() { $structure = $this->getEvent()->getParam('structure'); try { $this->getServiceStructure()->delete($structure); $this->flashMessenger()->addSuccessMessage("Structure supprimée avec succès."); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } return new MessengerViewModel(compact('structure')); } public function voirAction() { Loading