Commit e06e42c7 authored by Laurent Lécluse's avatar Laurent Lécluse

Intégration d'UnicaenTbl à la Zend Toolbar

parent 97a83a14
Pipeline #7814 failed with stage
in 6 seconds
......@@ -7,6 +7,7 @@ use UnicaenTbl\Controller\AdminController;
use UnicaenTbl\Form\ActualisationForm;
use UnicaenTbl\Options\ModuleOptions;
use UnicaenTbl\Provider\Privilege\Privileges;
use UnicaenTbl\Service\CollectorService;
use UnicaenTbl\Service\QueryGeneratorService;
use UnicaenTbl\Service\SchemaService;
use UnicaenTbl\Service\TableauBordService;
......@@ -26,12 +27,12 @@ return [
],
'may_terminate' => true,
'child_routes' => [
'update-actuproc' => [
'build' => [
'type' => 'Literal',
'options' => [
'route' => '/update-actuproc',
'route' => '/build',
'defaults' => [
'action' => 'update-actuproc',
'action' => 'build-procedures',
],
],
'may_terminate' => true,
......@@ -67,7 +68,20 @@ return [
],
],
],
'zenddevelopertools' => [
'profiler' => [
'collectors' => [
Service\CollectorService::class => Service\CollectorService::class,
],
],
'toolbar' => [
'entries' => [
Service\CollectorService::class => 'zend-developer-tools/toolbar/unicaen-tbl',
],
],
],
'doctrine' => [
'driver' => [
'unicaen_tbl_driver' => [
......@@ -89,6 +103,10 @@ return [
'template_path_stack' => [
'unicaen-tbl' => __DIR__ . '/../view',
],
'template_map' => [
'zend-developer-tools/toolbar/unicaen-tbl'
=> dirname(__DIR__) . '/view/zend-developer-tools/toolbar/unicaen-tbl.phtml',
],
],
'controllers' => [
......@@ -99,6 +117,7 @@ return [
'service_manager' => [
'factories' => [
CollectorService::class => Service\Factory\CollectorServiceFactory::class,
ModuleOptions::class => Options\Factory\ModuleOptionsFactory::class,
SchemaService::class => Service\Factory\SchemaServiceFactory::class,
QueryGeneratorService::class => Service\Factory\QueryGeneratorServiceFactory::class,
......
......@@ -6,6 +6,7 @@ use UnicaenTbl\Form\Traits\ActualisationFormAwareTrait;
use UnicaenTbl\Service\Traits\QueryGeneratorServiceAwareTrait;
use UnicaenTbl\Service\Traits\SchemaServiceAwareTrait;
use UnicaenTbl\Service\Traits\TableauBordServiceAwareTrait;
use Zend\Http\Request;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\JsonModel;
......@@ -34,12 +35,30 @@ class AdminController extends AbstractActionController
public function buildProceduresAction()
{
echo 'Construction des procédures de mise à jour des tableaux de bord...'."\n";
$inConsole = !$this->getRequest() instanceof Request;
if ($inConsole) {
echo 'Construction des procédures de mise à jour des tableaux de bord...' . "\n";
}
try {
$this->getServiceQueryGenerator()->updateProcedures();
echo 'Procédures finalisées'."\n";
$msg = 'Procédures de mise à jour des tableaux de bord construites'."\n";
if ($inConsole){
echo $msg;
}else{
$this->flashMessenger()->addSuccessMessage($msg);
}
} catch (\Exception $e) {
echo 'Une erreur a été rencontrée : '.$e->getMessage().'.'."\n";
$msg = 'Une erreur a été rencontrée : '.$e->getMessage().'.'."\n";
if ($inConsole){
echo $msg;
}else{
$this->flashMessenger()->addErrorMessage($msg);
}
}
if (!$inConsole) {
$this->redirect()->toRoute('unicaen-tbl');
}
}
......
<?php
namespace UnicaenTbl\Service;
use Serializable;
use Zend\Mvc\MvcEvent;
use ZendDeveloperTools\Collector\CollectorInterface;
/**
* Collecteur de données UnicaenCode
*
* @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
*/
class CollectorService implements CollectorInterface, Serializable
{
const NAME = 'unicaen-tbl_collector';
const PRIORITY = 150;
public function getViews()
{
return ['build' => 'Construction des tableaux de bord'];
}
/**
* {@inheritDoc}
*/
public function getName()
{
return self::class;
}
/**
* {@inheritDoc}
*/
public function getPriority()
{
return static::PRIORITY;
}
/**
* {@inheritDoc}
*/
public function collect(MvcEvent $mvcEvent)
{
}
/**
* {@inheritDoc}
*/
public function serialize()
{
return [];
}
/**
* {@inheritDoc}
*/
public function unserialize($serialized)
{
}
}
<?php
namespace UnicaenTbl\Service\Factory;
use Interop\Container\ContainerInterface;
use UnicaenTbl\Service\CollectorService;
class CollectorServiceFactory
{
public function __invoke(ContainerInterface $container, $requestedName, $options = null)
{
$service = new CollectorService();
return $service;
}
}
\ No newline at end of file
......@@ -14,7 +14,7 @@ use UnicaenTbl\Entity\TableauBord;
</style>
<h1 class="page-header">Tableaux de bord internes de calcul intermédiaire</h1>
<?php echo $this->messenger()->addMessagesFromFlashMessenger(); ?>
<?php foreach ($tbls as $tbl): ?>
<div class="panel panel-default">
<div class="panel-heading">
......
<div class="zdt-toolbar-entry">
<div class="zdt-toolbar-preview">
<span class="zdt-toolbar-info">
<span class="zdt-toolbar-extra-info">
<img style="padding-bottom: 4px;"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACAElEQVR4AX1Sw8KcQRCsD+vYOgaPkH2G2LnHOMa2brFt56XiZBl8GP1Ta9dY1dXd49y6e22tkOqS5zgTHceBMQZsGhy1bYDWdm4bDEcNpRX3vthus2/Xz1csXZnOZrNIp9NokoAV7ZFbILEljWOBYqEw7f2nd699uwYvFX7/RiabQacKopOMc6oRcWzv5qCknOFrJfioq40Cj13XBSGlhB8EoRFSYOLEScjmsiTotD5AgUYYRiiVihCSBGGA9x/eYvac2Zg7bw4mTJiIIAjAACploJUCgyaFguMCP77/wP9//1GtVu2eJaD1tC1KKTx++BTJZJJW+lzhHhFFEfL5xW0XyEz4vo9FCxZix47dPKCf3Gu5EcUClH377g3u06EGge2acDwPR44eAlW1YsD9VgBdpFLJVlykFN0ESsY4feoseMGzZFTBORGEIX7bVD94cLfhHtPZoyCVTuP4yWMQIgafoUcBqCCZQOMIUvUQSKlw4dxF8EdSAaEUs6AR/P+PSqWC6zevdNxvZKEJpuzQkYNwrSXHaUfeoSt2LhhczwWIxvf2mcsmXGv17Olz9JH+t9LXVMAU3rx9HR2gC8KUy2Uw/55lP2yz4HtMk4ZWbQUwdQWzZs8G7xcKJWOFfnHWbVy3LJHwDlnr6YRVYBrfnU+5aMNwqTloJaG0KalY7x0DbYmBlWlA3zgAAAAASUVORK5CYII="/>
UnicaenTbl
</span>
</span>
</div>
<div class="zdt-toolbar-detail">
<span class="zdt-toolbar-info">
<span class="zdt-detail-value">
<a href="<?php echo $this->url('unicaen-tbl/build'); ?>">Construction des tableaux de bord</a>
</span>
</span>
</div>
</div>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment