* initial commit

This commit is contained in:
Danyi Dávid 2018-11-11 12:01:18 +01:00
commit 17ec066110
165 changed files with 20529 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
.idea
composer.phar
clover.xml
coveralls-upload.json
phpunit.xml
vendor/

1
README.md Normal file
View File

@ -0,0 +1 @@
# Webnaplo Gül-Baba

View File

@ -0,0 +1,46 @@
<?php
/**
* Script for clearing the configuration cache.
*
* Can also be invoked as `composer clear-config-cache`.
*
* @see https://github.com/zendframework/zend-expressive-skeleton for the canonical source repository
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (http://www.zend.com)
* @license https://github.com/zendframework/zend-expressive-skeleton/blob/master/LICENSE.md New BSD License
*/
chdir(__DIR__ . '/../');
require 'vendor/autoload.php';
$config = include 'config/config.php';
if (! isset($config['config_cache_path'])) {
echo "No configuration cache path found" . PHP_EOL;
exit(0);
}
if (! file_exists($config['config_cache_path'])) {
printf(
"Configured config cache file '%s' not found%s",
$config['config_cache_path'],
PHP_EOL
);
exit(0);
}
if (false === unlink($config['config_cache_path'])) {
printf(
"Error removing config cache file '%s'%s",
$config['config_cache_path'],
PHP_EOL
);
exit(1);
}
printf(
"Removed configured config cache file '%s'%s",
$config['config_cache_path'],
PHP_EOL
);
exit(0);

18
bin/cli Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/php
<?php
chdir(__DIR__ . '/..');
require __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\Console\Application;
/** @var \Interop\Container\ContainerInterface $container */
$container = require __DIR__ . '/../config/container.php';
$application = new Application('Application console');
$commands = $container->get('config')['console']['commands'];
foreach ($commands as $command) {
$application->add($container->get($command));
}
$application->run();

9
cli-config.php Normal file
View File

@ -0,0 +1,9 @@
<?php
$container = require 'config/container.php';
return new \Symfony\Component\Console\Helper\HelperSet([
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper(
$container->get('doctrine.entity_manager.orm_default')
),
]);

76
composer.json Normal file
View File

@ -0,0 +1,76 @@
{
"name": "zendframework/zend-expressive-skeleton",
"description": "Zend expressive skeleton. Begin developing PSR-7 middleware applications in seconds!",
"type": "project",
"homepage": "https://github.com/zendframework/zend-expressive-skeleton",
"license": "BSD-3-Clause",
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^7.1",
"dasprid/container-interop-doctrine": "^1.0",
"doctrine/data-fixtures": "^1.2",
"gedmo/doctrine-extensions": "^2.4",
"imagine/imagine": "^0.7.1",
"lcobucci/jwt": "^3.2",
"monolog/monolog": "^1.23",
"oro/doctrine-extensions": "^1.2",
"phpoffice/phpexcel": "1.8.1",
"psliwa/php-pdf": "^1.2",
"roave/security-advisories": "dev-master",
"symfony/yaml": "^3.3",
"tuupola/cors-middleware": "^0.5.2",
"tuupola/slim-jwt-auth": "^2.3",
"zendframework/zend-component-installer": "^1.0",
"zendframework/zend-config": "^3.1",
"zendframework/zend-config-aggregator": "^1.0",
"zendframework/zend-crypt": "^3.2",
"zendframework/zend-expressive": "^2.0.2",
"zendframework/zend-expressive-fastroute": "^2.0",
"zendframework/zend-expressive-helpers": "^4.0",
"zendframework/zend-hydrator": "^2.2",
"zendframework/zend-json": "^3.0",
"zendframework/zend-mail": "^2.8",
"zendframework/zend-permissions-rbac": "^2.5",
"zendframework/zend-servicemanager": "^3.3",
"zendframework/zend-stdlib": "^3.1"
},
"require-dev": {
"phpunit/phpunit": "^6.0.8 || ^5.7.15",
"squizlabs/php_codesniffer": "^2.8.1",
"zfcampus/zf-development-mode": "^3.1",
"filp/whoops": "^2.1.7"
},
"autoload": {
"psr-4": {
"App\\": "src/App/"
}
},
"autoload-dev": {
"psr-4": {
"AppTest\\": "test/AppTest/"
}
},
"scripts": {
"post-create-project-cmd": [
"@development-enable"
],
"development-disable": "zf-development-mode disable",
"development-enable": "zf-development-mode enable",
"development-status": "zf-development-mode status",
"check": [
"@cs-check",
"@test"
],
"clear-config-cache": "php bin/clear-config-cache.php",
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"serve": "php -S 0.0.0.0:8888 -t public public/index.php",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
"upload-coverage": "coveralls -v"
}
}

5243
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

1
config/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
development.config.php

2
config/autoload/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
local.php
*.local.php

View File

@ -0,0 +1,93 @@
<?php
/**
* Authorization, authentication config
*/
return [
'acl_config' => [
'unguarded_routes' => [
'api.auth.login',
'api.ping',
'api.xlsx',
'show-attachment',
'hibajegy-pdf',
'karbantartasjegy-pdf',
'havi-riport-pdf',
],
'route_guard' => [
'roles' => [
/**
* child role => parents[]
* parentrole has all child roles permissions
* order of roles DO matter, referenced parents MUST exist, so should be defined first
*/
// karbantartó oldal
'uzemeltetesi_vezeto' => [
'ufo',
],
'betekinto' => [
'uzemeltetesi_vezeto',
],
// ügyfél oldal
'karbantarto' => [
'projektvezeto'
],
'user' => [
'betekinto',
'karbantarto',
],
],
'permissions' => [
// 'admin' role has full access
'uzemeltetesi_vezeto' => [
'api.fault.post',
'api.fault.put',
'api.report.post',
'api.fault-attachment.post',
'api.fault-comment.post',
'api.fault-reject.post',
'api.maintenance',
'api.maintenance.upcoming'
],
'ufo' => [
'api.fault.put',
'api.fault-attachment.post',
'api.fault-comment.post',
'api.fault-reject.post',
],
// 'betekinto' => [
// 'api.fault.get',
// ],
'projektvezeto' => [
'api.fault.put',
'api.report.post',
'api.fault-attachment.post',
'api.fault-comment.post',
'api.maintenance',
'api.maintenance.put',
'api.maintenance.upcoming',
],
'karbantarto' => [
],
// anybody logged in has the 'user' meta role, its not assignable otherwise
// api endpoints defined here are accessible to all authenticated users
'user' => [
'api.auth.renew',
'api.user.list',
'api.user.profile',
'api.user.password',
// 'api.settings.post',
'api.error-category.get',
'api.error-origin.get',
'api.facility-location.get',
'api.solution-time-interval.get',
'api.fault.get',
'show-attachment',
],
],
],
],
];

View File

@ -0,0 +1,19 @@
<?php
return [
'dependencies' => [
'invokables' => [],
'factories' => [
App\Command\InitializeFixtureCommand::class => App\Command\InitializeFixtureCommandFactory::class,
// App\Command\ConvertMaintenanceHashCommand::class => App\Command\ConvertMaintenanceHashCommandFactory::class,
// App\Command\MailTestCommand::class => App\Command\MailTestCommandFactory::class,
],
],
'console' => [
'commands' => [
App\Command\InitializeFixtureCommand::class,
// App\Command\ConvertMaintenanceHashCommand::class,
// App\Command\MailTestCommand::class,
],
],
];

View File

@ -0,0 +1,43 @@
<?php
use Zend\Expressive\Application;
use Zend\Expressive\Container;
use Zend\Expressive\Delegate;
use Zend\Expressive\Helper;
use Zend\Expressive\Middleware;
return [
// Provides application-wide services.
// We recommend using fully-qualified class names whenever possible as
// service names.
'dependencies' => [
// Use 'aliases' to alias a service name to another service. The
// key is the alias name, the value is the service to which it points.
'aliases' => [
'Zend\Expressive\Delegate\DefaultDelegate' => Delegate\NotFoundDelegate::class,
],
// Use 'invokables' for constructor-less services, or services that do
// not require arguments to the constructor. Map a service name to the
// class name.
'invokables' => [
// Fully\Qualified\InterfaceName::class => Fully\Qualified\ClassName::class,
Helper\ServerUrlHelper::class => Helper\ServerUrlHelper::class,
],
// Use 'factories' for services provided by callbacks/factory classes.
'factories' => [
Application::class => Container\ApplicationFactory::class,
Delegate\NotFoundDelegate::class => Container\NotFoundDelegateFactory::class,
Helper\ServerUrlMiddleware::class => Helper\ServerUrlMiddlewareFactory::class,
Helper\UrlHelper::class => Helper\UrlHelperFactory::class,
Helper\UrlHelperMiddleware::class => Helper\UrlHelperMiddlewareFactory::class,
Zend\Stratigility\Middleware\ErrorHandler::class => Container\ErrorHandlerFactory::class,
Middleware\ErrorResponseGenerator::class => Container\ErrorResponseGeneratorFactory::class,
Middleware\NotFoundHandler::class => Container\NotFoundHandlerFactory::class,
Slim\Middleware\JwtAuthentication::class => App\Middleware\JwtAuthenticationFactory::class,
Tuupola\Middleware\Cors::class => App\Middleware\CorsMiddlewareFactory::class,
App\Middleware\RouteAuthorization::class => App\Middleware\RouteAuthorizationFactory::class,
],
],
];

View File

@ -0,0 +1,34 @@
<?php
/**
* Development-only configuration.
*
* Put settings you want enabled when under development mode in this file, and
* check it into your repository.
*
* Developers on your team will then automatically enable them by calling on
* `composer development-enable`.
*/
use Zend\Expressive\Container;
use Zend\Expressive\Middleware\ErrorResponseGenerator;
return [
'dependencies' => [
'invokables' => [
],
'factories' => [
ErrorResponseGenerator::class => Container\WhoopsErrorResponseGeneratorFactory::class,
'Zend\Expressive\Whoops' => Container\WhoopsFactory::class,
'Zend\Expressive\WhoopsPageHandler' => Container\WhoopsPageHandlerFactory::class,
],
],
'whoops' => [
'json_exceptions' => [
'display' => true,
'show_trace' => true,
'ajax_only' => true,
],
],
];

View File

@ -0,0 +1,74 @@
<?php
return [
'dependencies' => [
'factories' => [
'doctrine.entity_manager.orm_default' => ContainerInteropDoctrine\EntityManagerFactory::class,
'doctrine.hydrator' => App\Hydrator\DoctrineObjectFactory::class,
],
],
'doctrine' => [
'driver' => [
'orm_default' => [
'class' => Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain::class,
'drivers' => [
'App\Entity' => 'app_entity',
],
],
'app_entity' => [
'class' => Doctrine\ORM\Mapping\Driver\AnnotationDriver::class,
'cache' => 'array',
'paths' => __DIR__ . '/../../src/App/Entity',
],
],
'configuration' => [
'orm_default' => [
// 'datetime_functions' => [
// 'date' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
// 'time' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
// 'timestamp' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
// 'convert_tz' => Oro\ORM\Query\AST\Functions\DateTime\ConvertTz::class,
// ],
'numeric_functions' => [
// 'timestampdiff' => Oro\ORM\Query\AST\Functions\Numeric\TimestampDiff::class,
// 'dayofyear' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
// 'dayofmonth' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
// 'dayofweek' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
// 'week' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
// 'day' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
// 'hour' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
// 'minute' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
'month' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
// 'quarter' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
// 'second' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
'year' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
// 'sign' => Oro\ORM\Query\AST\Functions\Numeric\Sign::class,
// 'pow' => Oro\ORM\Query\AST\Functions\Numeric\Pow::class,
],
// 'string_functions' => [
// 'md5' => Oro\ORM\Query\AST\Functions\SimpleFunction::class,
// 'group_concat' => Oro\ORM\Query\AST\Functions\String\GroupConcat::class,
// 'cast' => Oro\ORM\Query\AST\Functions\Cast::class,
// 'concat_ws' => Oro\ORM\Query\AST\Functions\String\ConcatWs::class
// ]
// 'filters' => [
// 'soft-deleteable' => Gedmo\SoftDeleteable\Filter\SoftDeleteableFilter::class,
// ],
],
],
'event_manager' => [
'orm_default' => [
'subscribers' => [
Gedmo\Timestampable\TimestampableListener::class,
Gedmo\Tree\TreeListener::class,
// Gedmo\SoftDeleteable\SoftDeleteableListener::class,
// Gedmo\Translatable\TranslatableListener::class,
// Gedmo\Blameable\BlameableListener::class,
// Gedmo\Loggable\LoggableListener::class,
// Gedmo\Sortable\SortableListener::class,
// Gedmo\Sluggable\SluggableListener::class,
],
],
],
],
];

View File

@ -0,0 +1,14 @@
<?php
return [
'doctrine' => [
'connection' => [
'orm_default' => [
'params' => [
'url' => 'sqlite:///data/app.db',
'charset' => 'UTF8',
],
],
],
],
];

View File

@ -0,0 +1,27 @@
<?php
/**
* Local configuration.
*
* Copy this file to `local.php` and change its settings as required.
* `local.php` is ignored by git and safe to use for local and sensitive data like usernames and passwords.
*/
return [
'self' => [
'name' => 'Laterex Üzemeltető Kft.',
'address' => '1095 Budapest, Hídépítő utca 1-12.',
'tax_number' => '25398791-2-43',
'sender' => 'nobody@localhost',
'site-uri' => 'localhost',
],
'client' => [
'short' => 'XXII. kerület',
'name' => 'Budafok-Tétény, Budapest, XXII. kerületi Önkormányzat',
'address' => '1221 Budapest, Városház tér 11.',
'tax_number' => '15735856-2-43',
],
'acl_config' => [
'hmac_key' => '',
],
];

View File

@ -0,0 +1,29 @@
<?php
use Zend\Mail\Transport\File;
use Zend\Mail\Transport\FileOptions;
//use Zend\Mail\Transport\Smtp;
//use Zend\Mail\Transport\SmtpOptions;
return [
'mailer' => [
// 'transportClass' => Smtp::class,
// 'optionsClass' => SmtpOptions::class,
// 'options' => [
// 'name' => 'localhost',
// 'host' => '127.0.0.1',
// 'port' => 25,
// 'connection_class' => 'plain',
// 'connection_config' => [
// 'username' => 'user',
// 'password' => 'pass',
// ],
// ],
'transportClass' => File::class,
'optionsClass' => FileOptions::class,
'options' => [
'path' => 'data/mail/',
],
]
];

View File

@ -0,0 +1,12 @@
<?php
use Zend\Expressive\Router\FastRouteRouter;
use Zend\Expressive\Router\RouterInterface;
return [
'dependencies' => [
'invokables' => [
RouterInterface::class => FastRouteRouter::class,
],
],
];

View File

@ -0,0 +1,27 @@
<?php
use Zend\ConfigAggregator\ConfigAggregator;
return [
// Toggle the configuration cache. Set this to boolean false, or remove the
// directive, to disable configuration caching. Toggling development mode
// will also disable it by default; clear the configuration cache using
// `composer clear-config-cache`.
ConfigAggregator::ENABLE_CACHE => true,
// Enable debugging; typically used to provide debugging information within templates.
'debug' => false,
'zend-expressive' => [
// Enable programmatic pipeline: Any `middleware_pipeline` or `routes`
// configuration will be ignored when creating the `Application` instance.
'programmatic_pipeline' => true,
// Provide templates for the error handling middleware to use when
// generating responses.
'error_handler' => [
'template_404' => 'error::404',
'template_error' => 'error::error',
],
],
];

36
config/config.php Normal file
View File

@ -0,0 +1,36 @@
<?php
use Zend\ConfigAggregator\ArrayProvider;
use Zend\ConfigAggregator\ConfigAggregator;
use Zend\ConfigAggregator\PhpFileProvider;
// To enable or disable caching, set the `ConfigAggregator::ENABLE_CACHE` boolean in
// `config/autoload/local.php`.
$cacheConfig = [
'config_cache_path' => 'data/config-cache.php',
];
$aggregator = new ConfigAggregator([
\Zend\Mail\ConfigProvider::class,
\Zend\Validator\ConfigProvider::class,
\Zend\Cache\ConfigProvider::class,
\Zend\Hydrator\ConfigProvider::class,
// Include cache configuration
new ArrayProvider($cacheConfig),
// Default App module config
App\ConfigProvider::class,
// Load application config in a pre-defined order in such a way that local settings
// overwrite global settings. (Loaded as first to last):
// - `global.php`
// - `*.global.php`
// - `local.php`
// - `*.local.php`
new PhpFileProvider('config/autoload/{{,*.}global,{,*.}local}.php'),
// Load development config if it exists
new PhpFileProvider('config/development.config.php'),
], $cacheConfig['config_cache_path']);
return $aggregator->getMergedConfig();

16
config/container.php Normal file
View File

@ -0,0 +1,16 @@
<?php
use Zend\ServiceManager\Config;
use Zend\ServiceManager\ServiceManager;
// Load configuration
$config = require __DIR__ . '/config.php';
// Build container
$container = new ServiceManager();
(new Config($config['dependencies']))->configureServiceManager($container);
// Inject config
$container->setService('config', $config);
return $container;

View File

@ -0,0 +1,29 @@
<?php
/**
* File required to allow enablement of development mode.
*
* For use with the zf-development-mode tool.
*
* Usage:
* $ composer development-disable
* $ composer development-enable
* $ composer development-status
*
* DO NOT MODIFY THIS FILE.
*
* Provide your own development-mode settings by editing the file
* `config/autoload/development.local.php.dist`.
*
* Because this file is aggregated last, it simply ensures:
*
* - The `debug` flag is _enabled_.
* - Configuration caching is _disabled_.
*/
use Zend\ConfigAggregator\ConfigAggregator;
return [
'debug' => true,
ConfigAggregator::ENABLE_CACHE => false,
];

58
config/pipeline.php Normal file
View File

@ -0,0 +1,58 @@
<?php
use Zend\Expressive\Helper\ServerUrlMiddleware;
use Zend\Expressive\Helper\UrlHelperMiddleware;
use Zend\Expressive\Middleware\ImplicitHeadMiddleware;
use Zend\Expressive\Middleware\ImplicitOptionsMiddleware;
use Zend\Expressive\Middleware\NotFoundHandler;
use Zend\Stratigility\Middleware\ErrorHandler;
/**
* Setup middleware pipeline:
*/
// The error handler should be the first (most outer) middleware to catch
// all Exceptions.
$app->pipe(Tuupola\Middleware\Cors::class);
$app->pipe(ErrorHandler::class);
$app->pipe(ServerUrlMiddleware::class);
// Pipe more middleware here that you want to execute on every request:
// - bootstrapping
// - pre-conditions
// - modifications to outgoing responses
//
// Piped Middleware may be either callables or service names. Middleware may
// also be passed as an array; each item in the array must resolve to
// middleware eventually (i.e., callable or service name).
//
// Middleware can be attached to specific paths, allowing you to mix and match
// applications under a common domain. The handlers in each middleware
// attached this way will see a URI with the MATCHED PATH SEGMENT REMOVED!!!
//
// - $app->pipe('/api', $apiMiddleware);
// - $app->pipe('/docs', $apiDocMiddleware);
// - $app->pipe('/files', $filesMiddleware);
// Register the routing middleware in the middleware pipeline
$app->pipeRoutingMiddleware();
$app->pipe(ImplicitHeadMiddleware::class);
$app->pipe(ImplicitOptionsMiddleware::class);
$app->pipe(UrlHelperMiddleware::class);
// Add more middleware here that needs to introspect the routing results; this
// might include:
//
// - route-based authentication
// - route-based validation
// - etc.
$app->pipe(Slim\Middleware\JwtAuthentication::class);
$app->pipe(App\Middleware\RouteAuthorization::class);
// Register the dispatch middleware in the middleware pipeline
$app->pipeDispatchMiddleware();
// At this point, if no Response is return by any middleware, the
// NotFoundHandler kicks in; alternately, you can provide other fallback
// middleware to execute.
$app->pipe(NotFoundHandler::class);

60
config/routes.php Normal file
View File

@ -0,0 +1,60 @@
<?php
/**
* Setup routes with a single request method:
*
* $app->get('/', App\Action\HomePageAction::class, 'home');
* $app->post('/album', App\Action\AlbumCreateAction::class, 'album.create');
* $app->put('/album/:id', App\Action\AlbumUpdateAction::class, 'album.put');
* $app->patch('/album/:id', App\Action\AlbumUpdateAction::class, 'album.patch');
* $app->delete('/album/:id', App\Action\AlbumDeleteAction::class, 'album.delete');
*
* Or with multiple request methods:
*
* $app->route('/contact', App\Action\ContactAction::class, ['GET', 'POST', ...], 'contact');
*
* Or handling all request methods:
*
* $app->route('/contact', App\Action\ContactAction::class)->setName('contact');
*
* or:
*
* $app->route(
* '/contact',
* App\Action\ContactAction::class,
* Zend\Expressive\Router\Route::HTTP_METHOD_ANY,
* 'contact'
* );
*/
$app->get('/', App\Action\PingAction::class, 'home');
$app->get('/api/ping', App\Action\PingAction::class, 'api.ping');
$app->get('/api/maintenance/upcoming', App\Action\MaintenanceUpcomingAction::class, 'api.maintenance.upcoming');
$app->route('/api/maintenance[/{id:\w+}]', App\Action\MaintenanceAction::class, ['GET', 'OPTIONS'], 'api.maintenance');
$app->route('/api/maintenance/{id:\w+}', App\Action\MaintenanceAction::class, ['PUT'], 'api.maintenance.put');
// authentication and user management
$app->route('/api/auth/login', App\Action\Auth\AuthAction::class, ['POST', 'OPTIONS'], 'api.auth.login');
$app->route('/api/auth/renew', App\Action\Auth\AuthAction::class, ['GET', 'OPTIONS'], 'api.auth.renew');
$app->route('/api/user[/{id:\d+}]', App\Action\User\UserAction::class, ['GET', 'PUT', 'OPTIONS'], 'api.user.profile');
$app->route('/api/user/password', App\Action\User\PasswordAction::class, ['POST', 'OPTIONS'], 'api.user.password');
// fault management
$app->route('/api/fault[/{id:\d+}]', App\Action\Fault\FaultAction::class, ['GET', 'OPTIONS'], 'api.fault.get'); // list/show
$app->post('/api/fault', App\Action\Fault\FaultAction::class, 'api.fault.post'); // create
$app->put('/api/fault/{id:\d+}', App\Action\Fault\FaultAction::class, 'api.fault.put'); // update
$app->delete('/api/fault/{id:\d+}', App\Action\Fault\FaultAction::class, 'api.fault.delete');
$app->route('/api/fault-reject/{id:\d+}', App\Action\Fault\FaultRejectAction::class, ['POST', 'OPTIONS'], 'api.fault-reject.post');
$app->route('/api/fault-comment/{id:\d+}', App\Action\Fault\FaultCommentAction::class, ['POST', 'OPTIONS'], 'api.fault-comment.post');
$app->route('/api/fault-attachment/{id:\d+}/{type}', App\Action\Fault\FaultAttachmentAction::class, ['POST', 'OPTIONS'], 'api.fault-attachment.post');
$app->route('/show-attachment/{id:\d+}', App\Action\Fault\FaultAttachmentAction::class, ['GET', 'OPTIONS'], 'show-attachment');
$app->route('/hibajegy-pdf/{id:\d+}[/{filename}]', App\Action\Pdf\GenerateWorksheetAction::class, ['GET', 'OPTIONS'], 'hibajegy-pdf');
$app->route('/karbantartasjegy-pdf/{id:\w+}[/{filename}]', App\Action\Pdf\GenerateMaintenanceSheetAction::class, ['GET', 'OPTIONS'], 'karbantartasjegy-pdf');
// core data
$app->route('/api/error-category', App\Action\ErrorCategoryAction::class, ['GET', 'OPTIONS'], 'api.error-category.get'); // list/show
$app->route('/api/error-origin', App\Action\ErrorOriginAction::class, ['GET', 'OPTIONS'], 'api.error-origin.get'); // list/show
$app->route('/api/facility-location', App\Action\FacilityLocationAction::class, ['GET', 'OPTIONS'], 'api.facility-location.get'); // list/show
$app->route('/api/solution-time-interval', App\Action\SolutionTimeIntervalAction::class, ['GET', 'OPTIONS'], 'api.solution-time-interval.get'); // list/show

6
data/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
attachments
tmp
temp
cache
passwords-generated.txt
user-upload

View File

@ -0,0 +1,86 @@
ErrorCategories:
ErrorCategory_1:
id: 1
name: "víz-, és szennyvízrendszer"
type: "machinery"
active: true
ErrorCategory_2:
id: 2
name: "hideg-, és melegvizes végberendezés, szerelvény, stb."
type: "machinery"
active: true
ErrorCategory_3:
id: 3
name: "fűtési rendszer és melegvíz szolgáltatás"
type: "machinery"
active: true
ErrorCategory_4:
id: 4
name: "fűtési végberendezés, szabályozó, stb."
type: "machinery"
active: true
ErrorCategory_5:
id: 5
name: "légtechnikai gépészeti rendszer"
type: "machinery"
active: true
ErrorCategory_6:
id: 6
name: "légtecnikai gépészeti berendezés, szabályozó, stb."
type: "machinery"
active: true
ErrorCategory_7:
id: 7
name: "elektromos rendszer"
type: "electric"
active: true
ErrorCategory_8:
id: 8
name: "végelem: kapcsoló, dugaszolóaljzat, biztosíték, stb."
type: "electric"
active: true
ErrorCategory_9:
id: 9
name: "kommunikációs hálózat"
type: "electric"
active: true
ErrorCategory_10:
id: 10
name: "kommunikációs végberendezés (telefon, kamera , stb.)"
type: "electric"
active: true
ErrorCategory_11:
id: 11
name: "tartószerkezetek, fal, mennyezet, válaszfal szerkezete"
type: "building"
active: true
ErrorCategory_12:
id: 12
name: "tetők, falak, padozatok szigetelése"
type: "building"
active: true
ErrorCategory_13:
id: 13
name: "álmennyezetek és padlófelületek "
type: "building"
active: true
ErrorCategory_14:
id: 14
name: "falak és mennyezetek felületképzése"
type: "building"
active: true
ErrorCategory_15:
id: 15
name: "ajtók, ablakok szerkezetei és szerelvényei"
type: "building"
active: true
ErrorCategory_16:
id: 16
name: "egyéb felületképzések"
type: "building"
active: true
ErrorCategory_17:
id: 17
name: "egyéb épületszerkezetek"
type: "building"
active: true

View File

@ -0,0 +1,31 @@
ErrorOrigins:
ErrorOrigin_1:
id: 1
code: "ü"
name: "rendeltetésszerű használat"
active: true
ErrorOrigin_2:
id: 2
code: "k"
name: "karbantartás"
active: true
ErrorOrigin_3:
id: 3
code: "e"
name: "külső elhárítatlan ok"
active: true
ErrorOrigin_4:
id: 4
code: "r"
name: "rongálás-károkozás"
active: true
ErrorOrigin_5:
id: 5
code: "hn"
name: "rend. haszn. nem befolyásol"
active: true
ErrorOrigin_6:
id: 6
code: "m"
name: "megrendelés"
active: true

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
SolutionTimeIntervals:
SolutionTimeInterval_1:
id: 1
name: "Sürgős"
code: "S"
active: true
SolutionTimeInterval_2:
id: 2
name: "Normál"
code: "N"
active: true

255
data/fixture/user.yml Normal file
View File

@ -0,0 +1,255 @@
Users:
User_1:
id: 1
name: Dávid
email: yvan@yvan.hu
wantsEmail: true
job: tesztelő
phone: "+36 1 123 4567"
roles: admin
active: true
# uzemeltetesi_vezeto
User_MajorosZoltan:
id: 10
name: Majoros Zoltán
email: techsupport.eycb@coe.int
wantsEmail: false
job: technical support
phone: "+36-1-438-0174"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_RozsaSandor:
id: 11
name: Rózsa Sándor
email: techsupport.eycb@coe.int
wantsEmail: false
job: technical support
phone: "+36-1-438-0174"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_HorvathCsaba:
id: 12
name: Horváth Csaba
email: techsupport.eycb@coe.int
wantsEmail: false
job: technical support
phone: "+36-1-438-0174"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_PohlottLaszlo:
id: 13
name: Pohlott László
email: techsupport.eycb@coe.int
wantsEmail: false
job: technical support
phone: "+36-1-438-0174"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_BalogKaroly:
id: 14
name: Balog Károly
email: keyrm.beik@gmail.com
wantsEmail: false
job: biztonsági szolgálat
phone: "+36-1-438-1041"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_SzenteRoland:
id: 15
name: Szente Roland
email: keyrm.beik@gmail.com
wantsEmail: false
job: biztonsági szolgálat
phone: "+36-1-438-1041"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_NekamIstvan:
id: 16
name: Nékám István
email: keyrm.beik@gmail.com
wantsEmail: false
job: biztonsági szolgálat
phone: "+36-1-438-1041"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_KotroczoIstvan:
id: 17
name: Kotroczó István
email: keyrm.beik@gmail.com
wantsEmail: false
job: biztonsági szolgálat
phone: "+36-1-438-1041"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_LandszmannZsolt:
id: 18
name: LandszmannZsolt
email: keyrm.beik@gmail.com
wantsEmail: false
job: biztonsági szolgálat
phone: "+36-1-438-1041"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_GoliczaZoltan:
id: 19
name: Golicza Zoltán
email: keyrm.beik@gmail.com
wantsEmail: false
job: biztonsági szolgálat
phone: "+36-1-438-1041"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_EckermannTibor:
id: 20
name: Eckermann Tibor
email: keyrm.beik@gmail.com
wantsEmail: false
job: biztonsági szolgálat
phone: "+36-1-438-1041"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_FarkasAndras:
id: 21
name: Farkas András
email: keyrm.beik@gmail.com
wantsEmail: false
job: biztonsági szolgálat
phone: "+36-1-438-1041"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_SimonZoltan:
id: 22
name: Simon Zoltán
email: keyrm.beik@gmail.com
wantsEmail: false
job: biztonsági szolgálat
phone: "+36-1-438-1041"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_ZsoldosGeza:
id: 23
name: Zsoldos Géza
email: keyrm.beik@gmail.com
wantsEmail: false
job: biztonsági szolgálat
phone: "+36-1-438-1041"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_MareschDavid:
id: 24
name: Maresch Dávid
email: keyrm.beik@gmail.com
wantsEmail: false
job: biztonsági szolgálat
phone: "+36-1-438-1041"
roles: uzemeltetesi_vezeto
active: true
canChangePassword: false
User_BuczkoAttila:
id: 25
name: Buczkó Attila
email: attila.buczko@coe.int
wantsEmail: true
job: technikus
phone: "+36-1-438-1078"
roles: uzemeltetesi_vezeto
active: true
User_KedveCsaba:
id: 26
name: Kedve Csaba
email: csaba.kedves@coe.int
wantsEmail: true
job: üzemeltetési vezető
phone: "+36-1-438-1079"
roles: uzemeltetesi_vezeto
active: true
# ufo
User_DrHeimPeter:
id: 40
name: Dr. Heim Péter
email: peter.heim@mfa.gov.hu
wantsEmail: true
job: főosztályvezető h.
phone: ""
roles: ufo
active: true
User_KrivdaLaszlo:
id: 41
name: Krivda László
email: krivda@t-online.hu
wantsEmail: true
job: műszaki ellenőr
phone: "+36 30 942 9072"
roles: ufo
active: true
# betekinto
User_BaloghGabor:
id: 60
name: Balogh Gábor
email: gabor.balogh@mfa.gov.hu
wantsEmail: true
job: főosztályvezető
phone: ""
roles: betekinto
active: true
User_CsicselyTibor:
id: 61
name: Csicsely Tibor
email: csicselyt@laterex.hu
wantsEmail: true
job: ügyvezető
phone: "+36 30 555 3634"
roles: betekinto
active: true
# projektvezeto
User_HantzmannGergely:
id: 82
name: Hantzmann Gergely
email: hantzmanng@laterex.hu
wantsEmail: true
job: karbantartási csv.
phone: "+36 30 181 3591"
roles: projektvezeto,karbantarto
active: true
User_KovacsLudovit:
id: 83
name: Kovác Ludovit
email: kovacl@laterex.hu
wantsEmail: true
job: projektvezető
phone: "+36 30 257 4183"
roles: projektvezeto
active: true
# karbantarto
User_MeszarosBela:
id: 90
name: Mészáros Béla
email: karbantarto1@laterex.hu
wantsEmail: false
job: karbantartó
phone: ""
roles: karbantarto
active: true
User_SzathmaryZsoltMiklos:
id: 91
name: Szathmáry Zsolt Miklos
email: karbantarto2@laterex.hu
wantsEmail: false
job: karbantartó
phone: ""
roles: karbantarto
active: true

View File

@ -0,0 +1,3 @@
Ez az értesítés egy automatikusan generált levél, ne válaszoljon rá.
Amennyiben módosítani kívánja az értesítési beállításait azt megteheti a %%WEBNAPLO_URI%% címen,
felhasználói beállítások menüpont alatt.

View File

@ -0,0 +1,10 @@
Intézményerész: %%FACILITY_LOCATION%%
Intézményrész pontosítva:
%%FACILITY_LOCATION_DESCRIPTION%%
Hiba szakág: %%ERROR_CATEGORY%%
Hiba eredet: %%ERROR_ORIGIN%%
Hiba leírás:
%%ERROR_DESCRIPTION%%
Hiba javítás ideje: %%SOLUTION_TIME%%

4
data/pdf-resources/asdf Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,9 @@
<fonts>
<font name="TimesNewRoman">
<!-- "%resources%" will be replaced by path to PHPPdf/Resources directory -->
<normal src="data/pdf-resources/fonts/Times_New_Roman.ttf"/>
<bold src="data/pdf-resources/fonts/Times_New_Roman_Bold.ttf"/>
<italic src="data/pdf-resources/fonts/Times_New_Roman_Italic.ttf"/>
<bold-italic src="data/pdf-resources/fonts/Times_New_Roman_Bold_Italic.ttf"/>
</font>
</fonts>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@ -0,0 +1,210 @@
<stylesheet>
<dynamic-page>
<attribute name="margin" value="12px" />
</dynamic-page>
<td>
<attribute name="vertical-align" value="middle" />
</td>
<td class="bottom">
<attribute name="vertical-align" value="down" />
</td>
<tr class="user-input">
<td>
<attribute name="height" value="27px" />
</td>
</tr>
<td class="highlighted">
<complex-attribute name="background" color="#E0FFFF" />
</td>
<table class="heading">
<any class="padded">
<attribute name="padding" value="2px" />
</any>
<attribute name="font-size" value="12px" />
<attribute name="margin-bottom" value="12px" />
<!-- nested element, equivalent CSS selector syntax: "table.heading td.large" -->
<td class="logo">
<attribute name="margin-left" value="40px" />
</td>
<td class="large">
<attribute name="font-size" value="16px" />
<attribute name="text-align" value="center" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="medium">
<attribute name="font-size" value="16px" />
<attribute name="text-align" value="center" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="small">
<attribute name="font-size" value="10px" />
<attribute name="text-align" value="center" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="smallest">
<attribute name="font-size" value="8px" />
<attribute name="text-align" value="center" />
</td>
<any class="bold">
<attribute name="font-style" value="bold" />
</any>
</table>
<table class="partners">
<attribute name="margin-bottom" value="10px" />
<tr class="heading">
<attribute name="font-size" value="12px" />
<attribute name="font-style" value="bold" />
</tr>
<td>
<attribute name="padding" value="2px" />
</td>
<td class="definition">
<attribute name="width" value="65px" />
<attribute name="font-size" value="10px" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="data">
<attribute name="font-size" value="12px" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="partner">
<attribute name="font-size" value="16px" />
<attribute name="font-style" value="bold" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="self">
<attribute name="font-size" value="22px" />
<attribute name="font-style" value="bold" />
<attribute name="vertical-align" value="middle" />
</td>
</table>
<table class="location">
<attribute name="margin-bottom" value="14px" />
<td>
<attribute name="padding" value="2px" />
</td>
<td class="heading">
<attribute name="font-size" value="12px" />
<attribute name="font-style" value="bold" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="definition">
<attribute name="width" value="65px" />
<attribute name="font-size" value="10px" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="data">
<attribute name="font-size" value="12px" />
<attribute name="text-align" value="center" />
<attribute name="vertical-align" value="middle" />
</td>
</table>
<table class="fault">
<td>
<attribute name="padding" value="2px" />
<attribute name="text-align" value="center"/>
<attribute name="vertical-align" value="middle" />
</td>
<tr class="heading">
<attribute name="font-size" value="12px" />
<attribute name="font-style" value="bold" />
<attribute name="vertical-align" value="left" />
</tr>
<td class="definition">
<attribute name="font-size" value="10px" />
<attribute name="text-align" value="left" />
</td>
<td class="data">
<attribute name="font-size" value="12px" />
<attribute name="text-align" value="center" />
</td>
</table>
<table class="spacer">
<attribute name="margin-bottom" value="14px" />
</table>
<table class="work">
<attribute name="margin-top" value="14px" />
<attribute name="margin-bottom" value="14px" />
<td>
<attribute name="padding" value="2px" />
<attribute name="text-align" value="center"/>
</td>
<tr class="heading">
<attribute name="font-size" value="12px" />
<attribute name="text-align" value="center" />
<attribute name="vertical-align" value="middle" />
<td>
<attribute name="height" value="30px" />
</td>
</tr>
<tr class="definition">
<td>
<attribute name="font-size" value="10px" />
</td>
</tr>
<tr class="data">
<td>
<attribute name="font-size" value="12px" />
</td>
</tr>
<td class="tiny">
<attribute name="width" value="22px" />
</td>
</table>
<table class="notes">
<attribute name="margin-bottom" value="14px" />
<td>
<attribute name="padding" value="2px" />
</td>
<tr class="heading">
<attribute name="font-size" value="12px" />
<attribute name="font-style" value="bold" />
<attribute name="text-align" value="center" />
<complex-attribute name="background" color="#ffff99" />
</tr>
<tr class="subheading">
<attribute name="font-size" value="10px" />
<attribute name="text-align" value="center" />
</tr>
<td class="empty-notes">
<attribute name="height" value="120px" />
</td>
</table>
<table class="materials">
<attribute name="margin-bottom" value="14px" />
<any class="padded">
<attribute name="padding" value="2px" />
</any>
<tr class="heading">
<attribute name="font-size" value="12px" />
<attribute name="font-style" value="bold" />
<attribute name="text-align" value="center" />
<complex-attribute name="background" color="#ffff99" />
</tr>
<tr class="subheading">
<attribute name="font-size" value="10px" />
<attribute name="text-align" value="center" />
</tr>
</table>
<table class="penalty">
<attribute name="margin-bottom" value="14px" />
<tr class="heading">
<attribute name="font-size" value="12px" />
<attribute name="font-style" value="bold" />
</tr>
</table>
</stylesheet>

View File

@ -0,0 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pdf SYSTEM "data/pdf-template/php-pdf.dtd">
<pdf>
<dynamic-page encoding="UTF-8" font-type="TimesNewRoman">
<table class="heading">
<tr>
<td class="large bold">
<img src="data/pdf-resources/laterex-logo.png" height="60px"/>
</td>
<td>
<table>
<tr>
<td class="large bold" height="24px"><![CDATA[KARBANTARTÁS]]></td>
</tr>
<tr>
<td class="small padded" height="36px"><![CDATA[Budapesti Európai Ifjúsági Központ 1024 Budapest, Zivatar utca 1-3.]]></td>
</tr>
</table>
</td>
<td>
<table>
<tr>
<td class="large padded" height="60px"><![CDATA[Sorszáma:]]></td>
<td class="medium padded" height="60px"><![CDATA[%%MS_ID%%]]></td>
</tr>
</table>
</td>
</tr>
</table><!-- end of heading-->
<table class="partners">
<tr class="heading">
<td colspan="2"><![CDATA[Megrendelö:]]></td>
<td colspan="2"><![CDATA[Vállalkozó:]]></td>
</tr>
<tr>
<td class="definition"><![CDATA[megnevezése:]]></td>
<td class="partner"><![CDATA[%%OWNER_NAME%%]]></td>
<td class="definition"><![CDATA[megnevezése:]]></td>
<td class="self"><![CDATA[%%SELF_NAME%%]]></td>
</tr>
<tr>
<td class="definition"><![CDATA[székhelye:]]></td>
<td class="data"><![CDATA[%%OWNER_ADDRESS%%]]></td>
<td class="definition"><![CDATA[székhelye:]]></td>
<td class="data"><![CDATA[%%SELF_ADDRESS%%]]></td>
</tr>
<tr>
<td class="definition"><![CDATA[adószáma:]]></td>
<td class="data"><![CDATA[%%OWNER_TAXNUMBER%%]]></td>
<td class="definition"><![CDATA[adószáma:]]></td>
<td class="data"><![CDATA[%%SELF_TAXNUMBER%%]]></td>
</tr>
</table>
<table class="location">
<tr>
<td class="heading"><![CDATA[Karbantartás]]></td>
</tr>
<tr>
<td class="data"><![CDATA[%%MAINTENANCE_GROUP%%]]></td>
</tr>
</table> <!-- end of institute -->
<!-- fault 1 -->
<table class="fault">
<tr>
<td colspan="2" class="heading"><![CDATA[Karbantartandó egység]]></td>
</tr>
<tr>
<td width="70px" class="definition"><![CDATA[hibacsoport:]]></td>
<td class="data"><![CDATA[%%MAINTENANCE_DEVICE%%]]></td>
</tr>
</table>
<table class="fault">
<tr>
<td width="180px" class="definition"><![CDATA[%%WORK_DESCRIPTION%%]]></td>
</tr>
</table>
<table class="fault spacer">
<tr>
<td width="60px" class="definition"><![CDATA[eredet:]]></td>
<td width="200px" class="data"><![CDATA[karbantartás]]></td>
<td width="100px" class="definition"><![CDATA[Hiba jellege:]]></td>
<td width="100px" class="data"><![CDATA[normal]]></td>
<td width="100px" class="definition"><![CDATA[Hiba rögzítő:]]></td>
<td width="100px" class="data"><![CDATA[Karbantartási terv]]></td>
<td class="data"><![CDATA[]]></td>
</tr>
<tr>
<td colspan="7" class="definition"><![CDATA[Rögzítő megjegyzése:]]></td>
</tr>
</table>
<!-- fault 2 -->
<table class="fault">
<tr>
<td colspan="6" class="heading"><![CDATA[Hiba kategória és döntés]]></td>
</tr>
<tr>
<td width="100px" class="definition"><![CDATA[Visszaigazoló:]]></td>
<td width="190px" class="data"><![CDATA[%%CONFIRMER_NAME%%]]></td>
<td width="120px" class="data"><![CDATA[%%CONFIRMER_JOB%%]]></td>
<td width="80px" class="definition"><![CDATA[Javítást végző:]]></td>
<td width="140px" class="definition"><![CDATA[%%MAINTENER_NAME%%]]></td>
<td class="data"><![CDATA[%%MAINTENER_JOB%%]]></td>
</tr>
</table>
<table class="fault spacer">
<tr>
<td width="100px" class="definition"><![CDATA[Munka kategória:]]></td>
<td width="40px" class="data"><![CDATA[]]></td>
<td width="150px" class="definition"><![CDATA[Költség nettó értéke (anyag+díj):]]></td>
<td width="120px" class="data"><![CDATA[-]]></td>
<td width="80px" class="definition"><![CDATA[Ft+ÁFA]]></td>
<td class="definition"><![CDATA[Költségvetés száma: alapszerződés szerinti]]></td>
</tr>
</table>
<!-- fault 3 -->
<table class="fault">
<tr>
<td colspan="6" class="heading"><![CDATA[Időpontok]]></td>
</tr>
<tr>
<td width="80px" class="definition"><![CDATA[Tervezett kezdete:]]></td>
<td width="100px" class="data"><![CDATA[%%SHOULD_START_AT%%]]></td>
<td width="100px" class="definition"><![CDATA[hétköznap]]></td>
<td width="120px" class="definition"><![CDATA[Tervezett vége]]></td>
<td width="120px" class="data"><![CDATA[%%SHOULDBE_DONE_BY%%]]></td>
<td class="data"><![CDATA[]]></td>
</tr>
</table> <!-- end of fault -->
<table class="fault">
<tr>
<td width="80px" class="definition"><![CDATA[Időpont módosító:]]></td>
<td width="100px" class="data"><![CDATA[]]></td>
<td width="150px" class="data"><![CDATA[]]></td>
<td width="130px" class="definition"><![CDATA[Kezdés időpontja:]]></td>
<td width="180px" class="data"><![CDATA[%%STARTED_AT%%]]></td>
<td class="data"><![CDATA[]]></td>
</tr>
</table> <!-- end of fault -->
<table class="fault">
<tr>
<td width="80px" class="definition"><![CDATA[Karbantartás befejezése:]]></td>
<td width="100px" class="data"><![CDATA[%%FINISHED_AT%%]]></td>
<td width="100px" class="definition"><![CDATA[Naptár szerint eltelt idő]]></td>
<td width="120px" class="data"><![CDATA[%%TIMESPENT_HOUR%%]]></td>
<td width="30px" class="definition"><![CDATA[óra]]></td>
<td width="30px" class="definition"><![CDATA[=]]></td>
<td width="60px" class="data"><![CDATA[%%TIMESPENT_DAY%%]]></td>
<td class="definition"><![CDATA[nap]]></td>
</tr>
</table> <!-- end of fault -->
<table class="fault">
<tr>
<td width="80px" class="definition"><![CDATA[Karbantartást igazoló:]]></td>
<td width="100px" class="data"><![CDATA[]]></td>
<td width="150px" class="data"><![CDATA[]]></td>
<td width="130px" class="definition"><![CDATA[Igazolás időpontja]]></td>
<td width="180px" class="data"><![CDATA[%%ACKNOWLEDGED_AT%%]]></td>
<td class="data"><![CDATA[]]></td>
</tr>
</table> <!-- end of fault -->
</dynamic-page>
</pdf>

View File

@ -0,0 +1,134 @@
<stylesheet>
<dynamic-page>
<attribute name="margin" value="20px" />
</dynamic-page>
<table class="heading">
<any class="padded">
<attribute name="padding" value="10px" />
</any>
<attribute name="font-size" value="11px" />
<!-- nested element, equivalent CSS selector syntax: "table.heading td.large" -->
<td>
<attribute name="padding" value="2px" />
<complex-attribute name="border" type="none" />
</td>
<td class="title">
<attribute name="font-size" value="14px" />
<attribute name="text-align" value="center" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="label">
<attribute name="font-size" value="10px" />
</td>
<td class="period">
<attribute name="font-size" value="12px" />
<attribute name="text-align" value="center" />
<attribute name="vertical-align" value="middle" />
</td>
<any class="bold">
<attribute name="font-style" value="bold" />
</any>
</table>
<table class="faults">
<attribute name="margin-top" value="20px" />
<attribute name="font-size" value="10px" />
<attribute name="vertical-align" value="middle" />
<tr class="institute">
<attribute name="font-style" value="bold-italic" />
<td>
<attribute name="height" value="24px" />
</td>
<td class="address">
<attribute name="text-align" value="center" />
</td>
</tr>
<tr class="heading">
<td>
<attribute name="text-align" value="center" />
</td>
</tr>
<tr class="fault">
<td>
<attribute name="height" value="24px" />
</td>
<td class="location">
<attribute name="text-align" value="center" />
</td>
</tr>
<td class="first">
<attribute name="text-align" value="left" />
<complex-attribute name="border" type="left+right"/>
</td>
<td>
<attribute name="padding" value="2px" />
</td>
<td class="sheetid">
<attribute name="width" value="80px" />
</td>
<td class="name">
</td>
<td class="invoiceid">
<attribute name="width" value="70px" />
</td>
<td class="unit">
<attribute name="width" value="30px" />
</td>
<td class="amount">
<attribute name="width" value="30px" />
</td>
<td class="nettprice">
<attribute name="width" value="40px" />
</td>
<td class="sumprice">
<attribute name="width" value="50px" />
</td>
<td class="workhours">
<attribute name="width" value="45px" />
</td>
<td class="workcost">
<attribute name="width" value="50px" />
</td>
<td class="fakeBottom">
<complex-attribute name="border" type="top"/>
</td>
<any class="righttxt">
<attribute name="text-align" value="right" />
</any>
<any class="center">
<attribute name="text-align" value="center" />
</any>
</table>
<table class="summary">
<attribute name="margin-top" value="20px" />
<td class="sumprice">
<attribute name="width" value="50px" />
</td>
<td class="workcost">
<attribute name="width" value="95px" />
</td>
<td>
<attribute name="padding" value="2px" />
</td>
<any class="righttxt">
<attribute name="text-align" value="right" />
</any>
</table>
<table class="signo">
<attribute name="margin-top" value="50px" />
<td>
<attribute name="padding" value="2px" />
<attribute name="padding-left" value="40px" />
<complex-attribute name="border" type="none" />
</td>
<tr>
<td>
<attribute name="height" value="40px" />
</td>
</tr>
</table>
</stylesheet>

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pdf SYSTEM "data/pdf-template/php-pdf.dtd">
<pdf>
<dynamic-page encoding="UTF-8" font-type="TimesNewRoman">
<table class="heading">
<tr>
<td colspan="9" class="title bold"><![CDATA[HAVI ELSZÁMOLÁS]]></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="label"><![CDATA[időszak:]]></td>
<td colspan="2" class="bold"><![CDATA[%%REPORT_DATE_PERIOD%%]]></td>
<td colspan="5">&nbsp;</td>
</tr>
<tr>
<td colspan="9" class="padded"><![CDATA[a Budafok-Tétény Budapest, XXII. kerület Önkormányzata és a Laterex Üzemeltető Kft. közötti keretszerződés 3. számú mellékletében felsorolt Intézmények működését biztosító hibaelhárítási, - megelőző műszaki - karbantartási, karba-helyezési és felújítási munkálatairól]]></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="label"><![CDATA[készült:]]></td>
<td><![CDATA[%%REPORT_DATE_PRINTED%%]]></td>
<td colspan="6">&nbsp;</td>
</tr>
</table>
<!-- details table -->
<table class="faults">
<tr class="heading">
<td class="sheetid"><![CDATA[munkalap száma:]]></td>
<td class="name"><![CDATA[hiba megnevezése/felhasznált anyagok megnevezése]]></td>
<td class="invoiceid"><![CDATA[beszerzési számla azonosítója]]></td>
<td class="unit"><![CDATA[me]]></td>
<td class="amount"><![CDATA[mennyiség]]></td>
<td class="nettprice"><![CDATA[nettó Ft/me]]></td>
<td class="sumprice"><![CDATA[össz anyag, Ft]]></td>
<td class="workhours"><![CDATA[munkaóra]]></td>
<td class="workcost"><![CDATA[összes díj, Ft]]></td>
</tr>
%%TABLE_DATA%%
<tr>
<td colspan="9" class="fakeBottom"><![CDATA[]]></td>
</tr>
</table>
<table class="summary">
<tr>
<td class="label"><![CDATA[összes anyag díj]]></td>
<td class="sumprice righttxt"><![CDATA[%%SUM_MATERIAL_COST%%]]></td>
<td class="workcost">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><![CDATA[összes munkadíj:]]></td>
<td class="righttxt"><![CDATA[%%SUM_WORK_COST%%]]></td>
</tr>
<tr>
<td><![CDATA[kötbér]]></td>
<td class="righttxt"><![CDATA[%%LATE_PENALTY_COST%%]]></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><![CDATA[kötbérrel csökkentett anyag+munka:]]></td>
<td class="righttxt"><![CDATA[%%SUM_NETT_COST%%]]></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><![CDATA[ÁFA 27%]]></td>
<td class="righttxt"><![CDATA[%%VAT_COST%%]]></td>
<td>&nbsp;</td>
</tr>
<tr>
<td><![CDATA[számlázható bruttó érték:]]></td>
<td class="righttxt"><![CDATA[%%BRUT_COST%%]]></td>
<td>&nbsp;</td>
</tr>
</table>
<table class="signo">
<tr class="label">
<td><![CDATA[Megrendelő részéről:]]></td>
<td><![CDATA[Vállalkozó részéről:]]></td>
</tr>
<tr>
<td><![CDATA[aláírás:……………………………]]></td>
<td><![CDATA[aláírás:……………………………]]></td>
</tr>
</table>
</dynamic-page>
</pdf>

View File

@ -0,0 +1,8 @@
<tr class="fault">
<td class="first"><![CDATA[%s]]></td>
<td><![CDATA[%s]]></td>
<td>&nbsp;</td>
<td colspan="4" class="location"><![CDATA[%s]]></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

View File

@ -0,0 +1,11 @@
<tr class="material">
<td class="first">&nbsp;</td>
<td><![CDATA[%s]]></td>
<td>&nbsp;</td>
<td class="center"><![CDATA[%s]]></td>
<td class="center"><![CDATA[%s]]></td>
<td class="center"><![CDATA[%s]]></td>
<td class="righttxt"><![CDATA[%s]]></td>
<td>&nbsp;</td>
<td class="righttxt">0</td>
</tr>

View File

@ -0,0 +1,11 @@
<tr class="late">
<td class="first">&nbsp;</td>
<td><![CDATA[kötbér]]></td>
<td>&nbsp;</td>
<td class="center"><![CDATA[%s]]></td>
<td class="center"><![CDATA[%s]]></td>
<td class="center"><![CDATA[%s]]></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="righttxt"><![CDATA[%s]]></td>
</tr>

View File

@ -0,0 +1,11 @@
<tr class="work">
<td class="first">&nbsp;</td>
<td><![CDATA[összes óra]]></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="center"><![CDATA[%s]]></td>
<td class="righttxt"><![CDATA[%s]]></td>
</tr>

View File

@ -0,0 +1,7 @@
<tr class="institute">
<td class="first"><![CDATA[%s]]></td>
<td><![CDATA[%s]]></td>
<td colspan="5" class="address"><![CDATA[%s]]></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>

View File

@ -0,0 +1,245 @@
<!ELEMENT pdf ANY>
<!ELEMENT dynamic-page ANY>
<!ATTLIST dynamic-page encoding CDATA #IMPLIED>
<!ATTLIST dynamic-page font-type CDATA #IMPLIED>
<!ELEMENT table ANY>
<!ATTLIST table class CDATA #IMPLIED>
<!ELEMENT tr ANY>
<!ATTLIST tr class CDATA #IMPLIED>
<!ELEMENT th ANY>
<!ATTLIST th class CDATA #IMPLIED>
<!ELEMENT td ANY>
<!ATTLIST td colspan CDATA #IMPLIED>
<!ATTLIST td class CDATA #IMPLIED>
<!ATTLIST td width CDATA #IMPLIED>
<!ATTLIST td height CDATA #IMPLIED>
<!ELEMENT img ANY>
<!ATTLIST img src CDATA #IMPLIED>
<!ATTLIST img height CDATA #IMPLIED>
<!ELEMENT br EMPTY>
<!ENTITY apos '"'>
<!ENTITY amp "&#38;">
<!ENTITY percent "&#37;">
<!ENTITY nbsp "&#160;">
<!ENTITY lt "<">
<!ENTITY gt ">">
<!ENTITY iexcl "¡">
<!ENTITY cent "¢">
<!ENTITY pound "£">
<!ENTITY curren "¤">
<!ENTITY yen "¥">
<!ENTITY brvbar "¦">
<!ENTITY sect "§">
<!ENTITY uml "¨">
<!ENTITY copy "©">
<!ENTITY ordf "ª">
<!ENTITY laquo "«">
<!ENTITY not "¬">
<!ENTITY shy " ">
<!ENTITY reg "®">
<!ENTITY macr "¯">
<!ENTITY deg "°">
<!ENTITY plusmn "±">
<!ENTITY sup2 "²">
<!ENTITY sup3 "³">
<!ENTITY acute "´">
<!ENTITY micro "µ">
<!ENTITY para "¶">
<!ENTITY middot "·">
<!ENTITY cedil "¸">
<!ENTITY sup1 "¹">
<!ENTITY ordm "º">
<!ENTITY raquo "»">
<!ENTITY frac14 "¼">
<!ENTITY frac12 "½">
<!ENTITY frac34 "¾">
<!ENTITY iquest "¿">
<!ENTITY Agrave "À">
<!ENTITY Aacute "Á">
<!ENTITY Acirc "Â">
<!ENTITY Atilde "Ã">
<!ENTITY Auml "Ä">
<!ENTITY Aring "Å">
<!ENTITY AElig "Æ">
<!ENTITY Ccedil "Ç">
<!ENTITY Egrave "È">
<!ENTITY Eacute "É">
<!ENTITY Ecirc "Ê">
<!ENTITY Euml "Ë">
<!ENTITY Igrave "Ì">
<!ENTITY Iacute "Í">
<!ENTITY Icirc "Î">
<!ENTITY Iuml "Ï">
<!ENTITY ETH "Ð">
<!ENTITY Ntilde "Ñ">
<!ENTITY Ograve "Ò">
<!ENTITY Oacute "Ó">
<!ENTITY Ocirc "Ô">
<!ENTITY Otilde "Õ">
<!ENTITY Ouml "Ö">
<!ENTITY times "×">
<!ENTITY Oslash "Ø">
<!ENTITY Ugrave "Ù">
<!ENTITY Uacute "Ú">
<!ENTITY Ucirc "Û">
<!ENTITY Uuml "Ü">
<!ENTITY Yacute "Ý">
<!ENTITY THORN "Þ">
<!ENTITY szlig "ß">
<!ENTITY agrave "à">
<!ENTITY aacute "á">
<!ENTITY acirc "â">
<!ENTITY atilde "ã">
<!ENTITY auml "ä">
<!ENTITY aring "å">
<!ENTITY aelig "æ">
<!ENTITY ccedil "ç">
<!ENTITY egrave "è">
<!ENTITY eacute "é">
<!ENTITY ecirc "ê">
<!ENTITY euml "ë">
<!ENTITY igrave "ì">
<!ENTITY iacute "í">
<!ENTITY icirc "î">
<!ENTITY iuml "ï">
<!ENTITY eth "ð">
<!ENTITY ntilde "ñ">
<!ENTITY ograve "ò">
<!ENTITY oacute "ó">
<!ENTITY ocirc "ô">
<!ENTITY otilde "õ">
<!ENTITY ouml "ö">
<!ENTITY divide "÷">
<!ENTITY oslash "ø">
<!ENTITY ugrave "ù">
<!ENTITY uacute "ú">
<!ENTITY ucirc "û">
<!ENTITY uuml "ü">
<!ENTITY yacute "ý">
<!ENTITY thorn "þ">
<!ENTITY yuml "ÿ">
<!ENTITY OElig "Œ">
<!ENTITY oelig "œ">
<!ENTITY Scaron "Š">
<!ENTITY scaron "š">
<!ENTITY Yuml "Ÿ">
<!ENTITY fnof "ƒ">
<!ENTITY circ "ˆ">
<!ENTITY tilde "˜">
<!ENTITY Alpha "Α">
<!ENTITY Beta "Β">
<!ENTITY Gamma "Γ">
<!ENTITY Delta "Δ">
<!ENTITY Epsilon "Ε">
<!ENTITY Zeta "Ζ">
<!ENTITY Eta "Η">
<!ENTITY Theta "Θ">
<!ENTITY Iota "Ι">
<!ENTITY Kappa "Κ">
<!ENTITY Lambda "Λ">
<!ENTITY Mu "Μ">
<!ENTITY Nu "Ν">
<!ENTITY Xi "Ξ">
<!ENTITY Omicron "Ο">
<!ENTITY Pi "Π">
<!ENTITY Rho "Ρ">
<!ENTITY Sigma "Σ">
<!ENTITY Tau "Τ">
<!ENTITY Upsilon "Υ">
<!ENTITY Phi "Φ">
<!ENTITY Chi "Χ">
<!ENTITY Psi "Ψ">
<!ENTITY Omega "Ω">
<!ENTITY alpha "α">
<!ENTITY beta "β">
<!ENTITY gamma "γ">
<!ENTITY delta "δ">
<!ENTITY epsilon "ε">
<!ENTITY zeta "ζ">
<!ENTITY eta "η">
<!ENTITY theta "θ">
<!ENTITY iota "ι">
<!ENTITY kappa "κ">
<!ENTITY lambda "λ">
<!ENTITY mu "μ">
<!ENTITY nu "ν">
<!ENTITY xi "ξ">
<!ENTITY omicron "ο">
<!ENTITY pi "π">
<!ENTITY rho "ρ">
<!ENTITY sigmaf "ς">
<!ENTITY sigma "σ">
<!ENTITY tau "τ">
<!ENTITY upsilon "υ">
<!ENTITY phi "φ">
<!ENTITY chi "χ">
<!ENTITY psi "ψ">
<!ENTITY omega "ω">
<!ENTITY zwnj " ">
<!ENTITY zwj " ">
<!ENTITY lrm " ">
<!ENTITY rlm " ">
<!ENTITY ndash "">
<!ENTITY mdash "—">
<!ENTITY lsquo "">
<!ENTITY rsquo "">
<!ENTITY sbquo "">
<!ENTITY ldquo "“">
<!ENTITY rdquo "”">
<!ENTITY bdquo "„">
<!ENTITY dagger "†">
<!ENTITY Dagger "‡">
<!ENTITY bull "•">
<!ENTITY hellip "…">
<!ENTITY permil "‰">
<!ENTITY prime "">
<!ENTITY Prime "″">
<!ENTITY lsaquo "">
<!ENTITY rsaquo "">
<!ENTITY oline "‾">
<!ENTITY frasl "">
<!ENTITY euro "€">
<!ENTITY trade "™">
<!ENTITY larr "←">
<!ENTITY uarr "↑">
<!ENTITY rarr "→">
<!ENTITY darr "↓">
<!ENTITY harr "↔">
<!ENTITY rArr "⇒">
<!ENTITY hArr "⇔">
<!ENTITY forall "∀">
<!ENTITY part "∂">
<!ENTITY exist "∃">
<!ENTITY nabla "∇">
<!ENTITY isin "∈">
<!ENTITY ni "∋">
<!ENTITY prod "∏">
<!ENTITY sum "∑">
<!ENTITY minus "">
<!ENTITY radic "√">
<!ENTITY prop "∝">
<!ENTITY infin "∞">
<!ENTITY ang "∠">
<!ENTITY and "∧">
<!ENTITY or "">
<!ENTITY cap "∩">
<!ENTITY cup "">
<!ENTITY int "∫">
<!ENTITY there4 "∴">
<!ENTITY sim "">
<!ENTITY asymp "≈">
<!ENTITY ne "≠">
<!ENTITY equiv "≡">
<!ENTITY le "≤">
<!ENTITY ge "≥">
<!ENTITY sub "⊂">
<!ENTITY sup "⊃">
<!ENTITY sube "⊆">
<!ENTITY supe "⊇">
<!ENTITY oplus "⊕">
<!ENTITY perp "⊥">
<!ENTITY loz "◊">
<!ENTITY spades "♠">
<!ENTITY clubs "♣">
<!ENTITY hearts "♥">
<!ENTITY diams "♦">

View File

@ -0,0 +1,210 @@
<stylesheet>
<dynamic-page>
<attribute name="margin" value="12px" />
</dynamic-page>
<td>
<attribute name="vertical-align" value="middle" />
</td>
<td class="bottom">
<attribute name="vertical-align" value="down" />
</td>
<tr class="user-input">
<td>
<attribute name="height" value="27px" />
</td>
</tr>
<td class="highlighted">
<complex-attribute name="background" color="#E0FFFF" />
</td>
<table class="heading">
<any class="padded">
<attribute name="padding" value="2px" />
</any>
<attribute name="font-size" value="12px" />
<attribute name="margin-bottom" value="12px" />
<!-- nested element, equivalent CSS selector syntax: "table.heading td.large" -->
<td class="logo">
<attribute name="margin-left" value="40px" />
</td>
<td class="large">
<attribute name="font-size" value="16px" />
<attribute name="text-align" value="center" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="medium">
<attribute name="font-size" value="16px" />
<attribute name="text-align" value="center" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="small">
<attribute name="font-size" value="10px" />
<attribute name="text-align" value="center" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="smallest">
<attribute name="font-size" value="8px" />
<attribute name="text-align" value="center" />
</td>
<any class="bold">
<attribute name="font-style" value="bold" />
</any>
</table>
<table class="partners">
<attribute name="margin-bottom" value="10px" />
<tr class="heading">
<attribute name="font-size" value="12px" />
<attribute name="font-style" value="bold" />
</tr>
<td>
<attribute name="padding" value="2px" />
</td>
<td class="definition">
<attribute name="width" value="65px" />
<attribute name="font-size" value="10px" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="data">
<attribute name="font-size" value="12px" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="partner">
<attribute name="font-size" value="16px" />
<attribute name="font-style" value="bold" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="self">
<attribute name="font-size" value="22px" />
<attribute name="font-style" value="bold" />
<attribute name="vertical-align" value="middle" />
</td>
</table>
<table class="location">
<attribute name="margin-bottom" value="14px" />
<td>
<attribute name="padding" value="2px" />
</td>
<td class="heading">
<attribute name="font-size" value="12px" />
<attribute name="font-style" value="bold" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="definition">
<attribute name="width" value="65px" />
<attribute name="font-size" value="10px" />
<attribute name="vertical-align" value="middle" />
</td>
<td class="data">
<attribute name="font-size" value="12px" />
<attribute name="text-align" value="center" />
<attribute name="vertical-align" value="middle" />
</td>
</table>
<table class="fault">
<td>
<attribute name="padding" value="2px" />
<attribute name="text-align" value="center"/>
<attribute name="vertical-align" value="middle" />
</td>
<tr class="heading">
<attribute name="font-size" value="12px" />
<attribute name="font-style" value="bold" />
<attribute name="vertical-align" value="left" />
</tr>
<td class="definition">
<attribute name="font-size" value="10px" />
<attribute name="text-align" value="left" />
</td>
<td class="data">
<attribute name="font-size" value="12px" />
<attribute name="text-align" value="center" />
</td>
</table>
<table class="spacer">
<attribute name="margin-bottom" value="14px" />
</table>
<table class="work">
<attribute name="margin-top" value="14px" />
<attribute name="margin-bottom" value="14px" />
<td>
<attribute name="padding" value="2px" />
<attribute name="text-align" value="center"/>
</td>
<tr class="heading">
<attribute name="font-size" value="12px" />
<attribute name="text-align" value="center" />
<attribute name="vertical-align" value="middle" />
<td>
<attribute name="height" value="30px" />
</td>
</tr>
<tr class="definition">
<td>
<attribute name="font-size" value="10px" />
</td>
</tr>
<tr class="data">
<td>
<attribute name="font-size" value="12px" />
</td>
</tr>
<td class="tiny">
<attribute name="width" value="22px" />
</td>
</table>
<table class="notes">
<attribute name="margin-bottom" value="14px" />
<td>
<attribute name="padding" value="2px" />
</td>
<tr class="heading">
<attribute name="font-size" value="12px" />
<attribute name="font-style" value="bold" />
<attribute name="text-align" value="center" />
<complex-attribute name="background" color="#ffff99" />
</tr>
<tr class="subheading">
<attribute name="font-size" value="10px" />
<attribute name="text-align" value="center" />
</tr>
<td class="empty-notes">
<attribute name="height" value="120px" />
</td>
</table>
<table class="materials">
<attribute name="margin-bottom" value="14px" />
<any class="padded">
<attribute name="padding" value="2px" />
</any>
<tr class="heading">
<attribute name="font-size" value="12px" />
<attribute name="font-style" value="bold" />
<attribute name="text-align" value="center" />
<complex-attribute name="background" color="#ffff99" />
</tr>
<tr class="subheading">
<attribute name="font-size" value="10px" />
<attribute name="text-align" value="center" />
</tr>
</table>
<table class="penalty">
<attribute name="margin-bottom" value="14px" />
<tr class="heading">
<attribute name="font-size" value="12px" />
<attribute name="font-style" value="bold" />
</tr>
</table>
</stylesheet>

View File

@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pdf SYSTEM "data/pdf-template/php-pdf.dtd">
<pdf>
<dynamic-page encoding="UTF-8" font-type="TimesNewRoman">
<table class="heading">
<tr>
<td class="large bold">
<img src="data/pdf-resources/laterex-logo.png" height="60px"/>
</td>
<td>
<table>
<tr>
<td class="large bold" height="24px"><![CDATA[HIBAJEGY]]></td>
</tr>
<tr>
<td class="small padded" height="36px"><![CDATA[Budapesti Európai Ifjúsági Központ 1024 Budapest, Zivatar utca 1-3.]]></td>
</tr>
</table>
</td>
<td>
<table>
<tr>
<td class="large padded" height="60px"><![CDATA[Sorszáma:]]></td>
<td class="medium padded" height="60px"><![CDATA[%%WS_ID%%]]></td>
</tr>
</table>
</td>
</tr>
</table><!-- end of heading-->
<table class="partners">
<tr class="heading">
<td colspan="2"><![CDATA[Megrendelö:]]></td>
<td colspan="2"><![CDATA[Vállalkozó:]]></td>
</tr>
<tr>
<td class="definition"><![CDATA[megnevezése:]]></td>
<td class="partner"><![CDATA[%%OWNER_NAME%%]]></td>
<td class="definition"><![CDATA[megnevezése:]]></td>
<td class="self"><![CDATA[%%SELF_NAME%%]]></td>
</tr>
<tr>
<td class="definition"><![CDATA[székhelye:]]></td>
<td class="data"><![CDATA[%%OWNER_ADDRESS%%]]></td>
<td class="definition"><![CDATA[székhelye:]]></td>
<td class="data"><![CDATA[%%SELF_ADDRESS%%]]></td>
</tr>
<tr>
<td class="definition"><![CDATA[adószáma:]]></td>
<td class="data"><![CDATA[%%OWNER_TAXNUMBER%%]]></td>
<td class="definition"><![CDATA[adószáma:]]></td>
<td class="data"><![CDATA[%%SELF_TAXNUMBER%%]]></td>
</tr>
</table>
<table class="location">
<tr>
<td colspan="3" class="heading"><![CDATA[Helyiség/terület]]></td>
</tr>
<tr>
<td width="80px" class="data"><![CDATA[%%FAULT_LOCATION_ROOMNUMBER%%]]></td>
<td width="400px" class="data"><![CDATA[%%FAULT_LOCATION_NAME%%]]></td>
<td width="100px" class="data"><![CDATA[terület: %%FAULT_LOCATION_SIZE%% m2]]></td>
</tr>
</table> <!-- end of institute -->
<!-- fault 1 -->
<table class="fault">
<tr>
<td colspan="4" class="heading"><![CDATA[Hiba paraméterei]]></td>
</tr>
<tr>
<td width="140px" class="definition"><![CDATA[hibacsoport:]]></td>
<td width="170px" class="data"><![CDATA[%%FAULT_ERROR_CATEGORY_TYPE%%]]></td>
<td width="140px" class="definition"><![CDATA[Szöveges kiegészítés:]]></td>
<td class="data"><![CDATA[%%FAULT_LOCATION_DESC%%]]></td>
</tr>
</table>
<table class="fault">
<tr>
<td width="30px" class="definition"><![CDATA[%%FAULT_ERROR_CATEGORY_ID%%]]></td>
<td width="180px" class="definition"><![CDATA[%%FAULT_ERROR_CATEGORY_NAME%%]]></td>
<td class="data">&nbsp;</td>
</tr>
</table>
<table class="fault spacer">
<tr>
<td width="60px" class="definition"><![CDATA[eredet:]]></td>
<td width="200px" class="data"><![CDATA[%%FAULT_ERROR_ORIGIN%%]]></td>
<td width="100px" class="definition"><![CDATA[Hiba jellege:]]></td>
<td width="100px" class="data"><![CDATA[%%FAULT_ERROR_URGENCY%%]]></td>
<td width="100px" class="definition"><![CDATA[Hiba rögzítő:]]></td>
<td width="100px" class="data"><![CDATA[%%CREATOR_NAME%%]]></td>
<td class="data"><![CDATA[%%CREATOR_JOB%%]]></td>
</tr>
<tr>
<td colspan="7" class="definition"><![CDATA[Rögzítő megjegyzése: %%FAULT_ERROR_DESC%%]]></td>
</tr>
</table>
<!-- fault 2 -->
<table class="fault">
<tr>
<td colspan="6" class="heading"><![CDATA[Hiba kategória és döntés]]></td>
</tr>
<tr>
<td width="100px" class="definition"><![CDATA[Visszaigazoló:]]></td>
<td width="190px" class="data"><![CDATA[%%CONFIRMER_NAME%%]]></td>
<td width="120px" class="data"><![CDATA[%%CONFIRMER_JOB%%]]></td>
<td width="80px" class="definition"><![CDATA[Javítást végző:]]></td>
<td width="140px" class="definition"><![CDATA[%%WORKER_NAME%%]]></td>
<td class="data"><![CDATA[%%WORKER_JOB%%]]></td>
</tr>
</table>
<table class="fault">
<tr>
<td width="100px" class="definition"><![CDATA[Munka kategória:]]></td>
<td width="40px" class="data"><![CDATA[%%FAULT_COST_TYPE%%]]></td>
<td width="150px" class="definition"><![CDATA[Költség nettó értéke (anyag+díj):]]></td>
<td width="120px" class="data"><![CDATA[%%REPAIR_COST%%]]></td>
<td width="80px" class="definition"><![CDATA[Ft+ÁFA]]></td>
<td class="definition"><![CDATA[Költségvetés száma:]]></td>
</tr>
</table>
<table class="fault">
<tr>
<td width="100px" class="definition"><![CDATA[Költség jóváhagyó:]]></td>
<td width="190px" class="data"><![CDATA[%%APPROVER_NAME%%]]></td>
<td class="data"><![CDATA[%%APPROVER_JOB%%]]></td>
</tr>
</table>
<table class="fault spacer">
<tr>
<td width="100px" class="definition"><![CDATA[Döntés:]]></td>
<td width="190px" class="data"><![CDATA[%%FAULT_DECISION%%]]></td>
<td width="120px" class="definition"><![CDATA[rendelkezésre álló nettó Ft:]]></td>
<td width="120px" class="data"><![CDATA[%%ALLOCATED_EXPENSE%%]]></td>
<td width="100px" class="definition"><![CDATA[egyeztetett határidő:]]></td>
<td class="data"><![CDATA[]]></td>
</tr>
</table>
<!-- fault 3 -->
<table class="fault">
<tr>
<td colspan="6" class="heading"><![CDATA[Időpontok]]></td>
</tr>
<tr>
<td width="80px" class="definition"><![CDATA[Bejelentés időpontja:]]></td>
<td width="100px" class="data"><![CDATA[%%REPORTED_AT%%]]></td>
<td width="100px" class="definition"><![CDATA[hétköznap]]></td>
<td width="120px" class="definition"><![CDATA[visszaigazolás időpontja]]></td>
<td width="120px" class="data"><![CDATA[%%CONFIRMED_AT%%]]></td>
<td class="data"><![CDATA[]]></td>
</tr>
</table> <!-- end of fault -->
<table class="fault">
<tr>
<td width="80px" class="definition"><![CDATA[Hibaelhárítás befejezése:]]></td>
<td width="100px" class="data"><![CDATA[%%FINISHED_AT%%]]></td>
<td width="100px" class="definition"><![CDATA[Naptár szerint eltelt idő]]></td>
<td width="120px" class="data"><![CDATA[%%TIMESPENT_HOUR%%]]></td>
<td width="30px" class="definition"><![CDATA[óra]]></td>
<td width="30px" class="definition"><![CDATA[=]]></td>
<td width="60px" class="data"><![CDATA[%%TIMESPENT_DAY%%]]></td>
<td class="definition"><![CDATA[nap]]></td>
</tr>
</table> <!-- end of fault -->
<table class="fault">
<tr>
<td width="130px" class="definition"><![CDATA[A meghibásodás elismert időtartama:]]></td>
<td width="50px" class="data"><![CDATA[%%FAULT_DURATION%%]]></td>
<td width="50px" class="definition"><![CDATA[nap]]></td>
<td width="100px" class="definition"><![CDATA[A kötbér mértéke:]]></td>
<td width="70px" class="data"><![CDATA[%%LATE_FINE_PERCENT%%]]></td>
<td width="30px" class="definition"><![CDATA[%]]></td>
<td class="data"><![CDATA[]]></td>
</tr>
</table> <!-- end of fault -->
<table class="fault">
<tr>
<td width="80px" class="definition"><![CDATA[Javítást igazoló:]]></td>
<td width="100px" class="data"><![CDATA[%%ACKNOWLEDGEDBY_NAME%%]]></td>
<td width="150px" class="data"><![CDATA[%%ACKNOWLEDGEDBY_JOB%%]]></td>
<td width="130px" class="definition"><![CDATA[Igazolás időpontja]]></td>
<td width="180px" class="data"><![CDATA[%%ACKNOWLEDGED_AT%%]]></td>
<td class="data"><![CDATA[]]></td>
</tr>
</table> <!-- end of fault -->
</dynamic-page>
</pdf>

62
deploy.php Normal file
View File

@ -0,0 +1,62 @@
<?php
namespace Deployer;
require 'recipe/common.php';
set('ssh_type', 'native');
set('ssh_multiplexing', true);
// Configuration
set('repository', 'ssh://gogs@gogs.ragnarok.yvan.hu:2206/Laterex/webnaplo-gul-api.git');
set('shared_files', [
'config/autoload/local.php',
'config/autoload/doctrine.local.php',
'config/autoload/mail.local.php',
]);
set('shared_dirs', [
'data/attachments',
'data/log',
'data/tmp',
'data/user-upload',
]);
set('writable_dirs', []);
set('keep_releases', 3);
set('default_stage', 'production');
// Servers
host('lxuz.hu')
->stage('production')
->user('latuzcs_beik_api_access')
->forwardAgent()
->set('bin/php', '/usr/bin/php7.1')
->set('bin/composer', '{{bin/php}} /var/www/clients/client5/web20/bin/composer')
->set('php_service_name', 'php7.1-fpm')
->set('deploy_path', '/var/www/clients/client5/web20/deploy');
// Tasks
desc('Restart PHP-FPM service');
task('php-fpm:reload', function () {
// The user must have rights for restart service
// /etc/sudoers: $username ALL=NOPASSWD:/bin/systemctl restart php-fpm.service
run('sudo service {{php_service_name}} reload');
});
after('deploy:symlink', 'php-fpm:reload');
desc('Deploy your project');
task('deploy', [
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:writable',
'deploy:vendors',
'deploy:clear_paths',
'deploy:symlink',
'deploy:unlock',
'cleanup',
]);
after('deploy', 'success');

20
phpcs.xml.dist Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<ruleset name="Expressive Skeleton coding standard">
<description>Expressive Skeleton coding standard</description>
<!-- display progress -->
<arg value="p"/>
<arg name="colors"/>
<!-- inherit rules from: -->
<rule ref="PSR2"/>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<properties>
<property name="ignoreBlankLines" value="false"/>
</properties>
</rule>
<!-- Paths to check -->
<file>src</file>
</ruleset>

17
phpunit.xml.dist Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true">
<testsuites>
<testsuite name="App\\Tests">
<directory>./test</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>

17
public/.htaccess Normal file
View File

@ -0,0 +1,17 @@
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

29
public/index.php Normal file
View File

@ -0,0 +1,29 @@
<?php
// Delegate static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server'
&& is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))
) {
return false;
}
chdir(dirname(__DIR__));
require 'vendor/autoload.php';
/**
* Self-called anonymous function that creates its own scope and keep the global namespace clean.
*/
call_user_func(function () {
/** @var \Interop\Container\ContainerInterface $container */
$container = require 'config/container.php';
/** @var \Zend\Expressive\Application $app */
$app = $container->get(\Zend\Expressive\Application::class);
// Import programmatic/declarative middleware pipeline and routing
// configuration statements
require 'config/pipeline.php';
require 'config/routes.php';
$app->run();
});

BIN
public/zf-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

View File

@ -0,0 +1,182 @@
<?php
namespace App\Action;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Interop\Http\ServerMiddleware\MiddlewareInterface as ServerMiddlewareInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response\JsonResponse;
use Zend\Json\Json;
abstract class AbstractCrudAction implements ServerMiddlewareInterface
{
const IDENTIFIER_NAME = 'id';
const CORS_ALLOW_HEADERS = [
'DNT',
'X-CustomHeader',
'Keep-Alive',
'User-Agent',
'X-Requested-With',
'If-Modified-Since',
'Cache-Control',
'Content-Type',
'Authorization',
];
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
{
$requestMethod = strtoupper($request->getMethod());
$id = $request->getAttribute(static::IDENTIFIER_NAME);
switch ($requestMethod) {
case 'GET':
return isset($id)
? $this->get($request, $delegate)
: $this->getList($request, $delegate);
case 'POST':
return $this->create($request, $delegate);
case 'PUT':
return $this->update($request, $delegate);
case 'DELETE':
return isset($id)
? $this->delete($request, $delegate)
: $this->deleteList($request, $delegate);
case 'HEAD':
return $this->head($request, $delegate);
case 'OPTIONS':
return $this->options($request, $delegate);
case 'PATCH':
return $this->patch($request, $delegate);
default:
return $delegate->process($request);
}
}
public function get(ServerRequestInterface $request, DelegateInterface $delegate)
{
return $this->createResponse(['content' => 'Method not allowed'], 405);
}
public function getList(ServerRequestInterface $request, DelegateInterface $delegate)
{
return $this->createResponse(['content' => 'Method not allowed'], 405);
}
public function create(ServerRequestInterface $request, DelegateInterface $delegate)
{
return $this->createResponse(['content' => 'Method not allowed'], 405);
}
public function update(ServerRequestInterface $request, DelegateInterface $delegate)
{
return $this->createResponse(['content' => 'Method not allowed'], 405);
}
public function delete(ServerRequestInterface $request, DelegateInterface $delegate)
{
return $this->createResponse(['content' => 'Method not allowed'], 405);
}
public function deleteList(ServerRequestInterface $request, DelegateInterface $delegate)
{
return $this->createResponse(['content' => 'Method not allowed'], 405);
}
public function head(ServerRequestInterface $request, DelegateInterface $delegate)
{
return $this->createResponse(['content' => 'Method not allowed'], 405);
}
public function options(ServerRequestInterface $request, DelegateInterface $delegate)
{
return $this->createResponse(['content' => 'Method not allowed'], 405);
}
public function patch(ServerRequestInterface $request, DelegateInterface $delegate)
{
return $this->createResponse(['content' => 'Method not allowed'], 405);
}
final protected function createResponse($data, $status = 200)
{
return new JsonResponse($data, $status);
}
/**
*
* @param ServerRequestInterface $request
* @return array|object
*/
public function getRequestData(ServerRequestInterface $request)
{
$body = $request->getParsedBody();
if (!empty($body)) {
return $body;
}
return $this->parseRequestData(
$request->getBody()->getContents(),
$request->getHeaderLine('content-type')
);
}
protected function withCorsHeaders(ResponseInterface $response, iterable $methods = [])
{
if ($methods) {
$methodsHeader = implode(',', $methods);
$response = $response->withHeader('Accept', $methodsHeader)
->withHeader('Access-Control-Allow-Methods', $methodsHeader);
}
return $response
->withHeader('Access-Control-Allow-Origin', '*')
->withHeader('Access-Control-Allow-Headers', implode(",", self::CORS_ALLOW_HEADERS));
}
/**
*
* @param string $input
* @param string $contentType
* @return mixed
*/
private function parseRequestData($input, $contentType)
{
$contentTypeParts = preg_split('/\s*[;,]\s*/', $contentType);
$parser = $this->returnParserContentType($contentTypeParts[0]);
return $parser($input);
}
/**
*
* @param string $contentType
* @return callable
*/
private function returnParserContentType(string $contentType)
{
if ($contentType === 'application/x-www-form-urlencoded') {
return function ($input) {
parse_str($input, $data);
return $data;
};
} elseif ($contentType === 'application/json') {
return function ($input) {
$jsonDecoder = new Json();
try {
return $jsonDecoder->decode($input, Json::TYPE_ARRAY);
} catch (\Exception $e) {
return false;
}
};
} elseif ($contentType === 'multipart/form-data') {
return function ($input) {
return $input;
};
}
return function ($input) {
return $input;
};
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace App\Action\Auth;
use App\Action\AbstractCrudAction;
use App\Response\JsonCorsResponse;
use App\Service\AuthService;
use Doctrine\ORM\NoResultException;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response\EmptyResponse;
class AuthAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'GET',
'POST',
];
/**
* @var AuthService
*/
private $authService;
public function __construct(AuthService $authService)
{
$this->authService = $authService;
}
/**
* Create new auth token (login)
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response\JsonResponse
*/
public function create(ServerRequestInterface $request, DelegateInterface $delegate)
{
$authData = $this->getRequestData($request);
try {
return new JsonCorsResponse($this->authService->authenticate($authData['login'], $authData['password']));
} catch (NoResultException $e) {
return new JsonCorsResponse([
'message' => $e->getMessage()
], 403);
} catch (\Exception $e) {
return new JsonCorsResponse([
'message' => $e->getMessage()
], 500);
}
}
/**
* Renew auth token
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response\JsonResponse
*/
public function getList(ServerRequestInterface $request, DelegateInterface $delegate)
{
try {
$token = $request->getAttribute('token', false);
return new JsonCorsResponse($this->authService->renewToken($token));
} catch (\Exception $e) {
return new JsonCorsResponse([
'message' => $e->getMessage()
], 500);
}
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return static
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate)
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Action\Auth;
use App\Service\AuthService;
use Interop\Container\ContainerInterface;
class AuthFactory
{
public function __invoke(ContainerInterface $container)
{
$faultManagerService = $container->get(AuthService::class);
return new AuthAction($faultManagerService);
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace App\Action;
use App\Response\JsonCorsResponse;
use App\Service\ErrorCategoryService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response;
use Zend\Diactoros\Response\EmptyResponse;
class ErrorCategoryAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'GET',
];
/**
* @var ErrorCategoryService
*/
private $errorCategoryService;
public function __construct(ErrorCategoryService $errorCategoryService)
{
$this->errorCategoryService = $errorCategoryService;
}
/**
* Return all faults accessible to the user
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function getList(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return new JsonCorsResponse($this->errorCategoryService->getList());
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Action;
use App\Service\ErrorCategoryService;
use Interop\Container\ContainerInterface;
class ErrorCategoryFactory
{
public function __invoke(ContainerInterface $container)
{
/** @var ErrorCategoryService $errorCategoryService */
$errorCategoryService = $container->get(ErrorCategoryService::class);
return new ErrorCategoryAction($errorCategoryService);
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace App\Action;
use App\Response\JsonCorsResponse;
use App\Service\ErrorOriginService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response;
use Zend\Diactoros\Response\EmptyResponse;
class ErrorOriginAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'GET',
];
/**
* @var ErrorOriginService
*/
private $errorOriginService;
public function __construct(ErrorOriginService $errorOriginService)
{
$this->errorOriginService = $errorOriginService;
}
/**
* Return all faults accessible to the user
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function getList(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return new JsonCorsResponse($this->errorOriginService->getList());
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Action;
use App\Service\ErrorOriginService;
use Interop\Container\ContainerInterface;
class ErrorOriginFactory
{
public function __invoke(ContainerInterface $container)
{
/** @var ErrorOriginService $errorOriginService */
$errorOriginService = $container->get(ErrorOriginService::class);
return new ErrorOriginAction($errorOriginService);
}
}

View File

@ -0,0 +1,52 @@
<?php
namespace App\Action;
use App\Action\AbstractCrudAction;
use App\Response\JsonCorsResponse;
use App\Service\FacilityLocationService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response;
use Zend\Diactoros\Response\EmptyResponse;
class FacilityLocationAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'GET',
];
/**
* @var FacilityLocationService
*/
private $facilityLocationService;
public function __construct(FacilityLocationService $facilityLocationService)
{
$this->facilityLocationService = $facilityLocationService;
}
/**
* Return all faults accessible to the user
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function getList(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return new JsonCorsResponse($this->facilityLocationService->getFacilityLocationListFlat());
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Action;
use App\Service\FacilityLocationService;
use Interop\Container\ContainerInterface;
class FacilityLocationFactory
{
public function __invoke(ContainerInterface $container)
{
/** @var FacilityLocationService $facilityLocationService */
$facilityLocationService = $container->get(FacilityLocationService::class);
return new FacilityLocationAction($facilityLocationService);
}
}

View File

@ -0,0 +1,122 @@
<?php
namespace App\Action\Fault;
use App\Action\AbstractCrudAction;
use App\Response\JsonCorsResponse;
use App\Service\FaultManagerService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response;
use Zend\Diactoros\Response\EmptyResponse;
class FaultAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'GET',
'POST',
'PUT',
'PATCH',
];
/**
* @var FaultManagerService
*/
private $faultManagerService;
public function __construct(FaultManagerService $faultManagerService)
{
$this->faultManagerService = $faultManagerService;
}
/**
* Return all faults accessible to the user
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function getList(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return new JsonCorsResponse($this->faultManagerService->getFaultList());
}
/**
* Return a single fault
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function get(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
$id = $request->getAttribute('id', false);
return new JsonCorsResponse($this->faultManagerService->getFault($id));
}
/**
* Post a new fault report
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function create(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
try {
$data = $this->getRequestData($request);
$token = $request->getAttribute('token');
return new JsonCorsResponse($this->faultManagerService->createFault($data, $token->uid), 201);
} catch (\Exception $e) {
return new JsonCorsResponse($e->getMessage(), 500);
}
}
/**
* Update a fault report
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function update(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
try {
$id = $request->getAttribute('id');
$token = $request->getAttribute('token');
$data = $this->getRequestData($request);
return new JsonCorsResponse($this->faultManagerService->updateFault($id, $data, $token->uid));
} catch (\Exception $e) {
return new JsonCorsResponse($e->getMessage(), 500);
}
}
/**
* Delete a fault report (NYI)
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function delete(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
try {
$id = $request->getAttribute('id');
return new JsonCorsResponse($this->faultManagerService->deleteFault($id));
} catch (\Exception $e) {
return new JsonCorsResponse($e->getMessage(), $e->getCode());
}
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,104 @@
<?php
namespace App\Action\Fault;
use App\Action\AbstractCrudAction;
use App\Response\JsonCorsResponse;
use App\Service\FaultAttachmentService;
use App\Service\FaultManagerService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\UploadedFileInterface;
use Zend\Diactoros\Response;
use Zend\Diactoros\Response\EmptyResponse;
use Zend\Diactoros\Stream;
class FaultAttachmentAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'GET',
'POST',
];
/**
* @var FaultManagerService
*/
private $faultManagerService;
/**
* @var FaultAttachmentService
*/
private $attachmentService;
public function __construct(
FaultManagerService $faultManagerService,
FaultAttachmentService $attachmentService
) {
$this->faultManagerService = $faultManagerService;
$this->attachmentService = $attachmentService;
}
/**
* Post a new fault report
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function create(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
$faultId = $request->getAttribute('id');
$type = $request->getAttribute('type', 'file');
$token = $request->getAttribute('token');
try {
/** @var UploadedFileInterface[] $files */
$files = $request->getUploadedFiles()['file'];
return new JsonCorsResponse(
$this->attachmentService->createAttachments($faultId, $files, $token->uid, $type),
201
);
} catch (\Exception $e) {
return new JsonCorsResponse($e->getMessage(), 500);
}
}
/**
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return Response
*/
public function get(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
$id = $request->getAttribute('id');
$attachment = $this->attachmentService->get($id);
$stream = new Stream($attachment->getIoStream());
switch ($attachment->getType()) {
case 'image':
$contentType = 'image/jpg';
break;
case 'expense':
$contentType = 'application/pdf';
break;
default:
$contentType = 'application/octet-stream';
}
$response = new Response($stream);
return $response->withStatus(200)
->withHeader('Content-type', $contentType)
// ->withHeader('Content-disposition', 'attachment;filename='.$attachment->getFileName())
;
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\Action\Fault;
use App\Service\FaultAttachmentService;
use App\Service\FaultManagerService;
use Interop\Container\ContainerInterface;
class FaultAttachmentFactory
{
public function __invoke(ContainerInterface $container)
{
$faultManagerService = $container->get(FaultManagerService::class);
$attachmentService = $container->get(FaultAttachmentService::class);
return new FaultAttachmentAction($faultManagerService, $attachmentService);
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace App\Action\Fault;
use App\Action\AbstractCrudAction;
use App\Response\JsonCorsResponse;
use App\Service\FaultManagerService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response;
use Zend\Diactoros\Response\EmptyResponse;
class FaultCommentAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'POST',
];
/**
* @var FaultManagerService
*/
private $faultManagerService;
public function __construct(FaultManagerService $faultManagerService)
{
$this->faultManagerService = $faultManagerService;
}
/**
* Post a new fault report
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function create(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
$faultId = $request->getAttribute('id');
$jwt = $request->getAttribute('token');
try {
$data = $this->getRequestData($request);
return new JsonCorsResponse($this->faultManagerService->addFaultComment($faultId, $data, $jwt->uid), 201);
} catch (\Exception $e) {
return new JsonCorsResponse($e->getMessage(), $e->getCode());
}
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Action\Fault;
use App\Service\FaultManagerService;
use Interop\Container\ContainerInterface;
class FaultCommentFactory
{
public function __invoke(ContainerInterface $container)
{
$faultManagerService = $container->get(FaultManagerService::class);
return new FaultCommentAction($faultManagerService);
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Action\Fault;
use App\Service\FaultManagerService;
use Interop\Container\ContainerInterface;
class FaultFactory
{
public function __invoke(ContainerInterface $container)
{
$faultManagerService = $container->get(FaultManagerService::class);
return new FaultAction($faultManagerService);
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace App\Action\Fault;
use App\Action\AbstractCrudAction;
use App\Response\JsonCorsResponse;
use App\Service\FaultManagerService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response;
use Zend\Diactoros\Response\EmptyResponse;
class FaultRejectAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'POST',
];
/**
* @var FaultManagerService
*/
private $faultManagerService;
public function __construct(FaultManagerService $faultManagerService)
{
$this->faultManagerService = $faultManagerService;
}
/**
* Post a new fault report
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function create(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
$faultId = $request->getAttribute('id');
$jwt = $request->getAttribute('token');
try {
$data = $this->getRequestData($request);
return new JsonCorsResponse($this->faultManagerService->rejectFault($faultId, $data, $jwt->uid), 201);
} catch (\Exception $e) {
return new JsonCorsResponse($e->getMessage(), 500);
}
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace App\Action\Fault;
use App\Service\FaultManagerService;
use Interop\Container\ContainerInterface;
class FaultRejectFactory
{
public function __invoke(ContainerInterface $container)
{
$faultManagerService = $container->get(FaultManagerService::class);
return new FaultRejectAction($faultManagerService);
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\Action\Fault;
use App\Action\AbstractCrudAction;
use App\Response\JsonCorsResponse;
use App\Service\FaultManagerService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response;
use Zend\Diactoros\Response\EmptyResponse;
class FaultS2ConfirmAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'PUT',
];
/**
* @var FaultManagerService
*/
private $faultManagerService;
public function __construct(FaultManagerService $faultManagerService)
{
$this->faultManagerService = $faultManagerService;
}
/**
* Update a fault report
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function update(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
try {
$id = $request->getAttribute('id');
$data = $this->getRequestData($request);
return new JsonCorsResponse($this->faultManagerService->confirmFault($id, $data));
} catch (\Exception $e) {
return new JsonCorsResponse($e->getMessage(), $e->getCode());
}
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\Action\Fault;
use App\Action\AbstractCrudAction;
use App\Response\JsonCorsResponse;
use App\Service\FaultManagerService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response;
use Zend\Diactoros\Response\EmptyResponse;
class FaultS3AcknowledgeAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'PUT',
];
/**
* @var FaultManagerService
*/
private $faultManagerService;
public function __construct(FaultManagerService $faultManagerService)
{
$this->faultManagerService = $faultManagerService;
}
/**
* Update a fault report
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function update(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
try {
$id = $request->getAttribute('id');
$data = $this->getRequestData($request);
return new JsonCorsResponse($this->faultManagerService->ackFault($id, $data));
} catch (\Exception $e) {
return new JsonCorsResponse($e->getMessage(), $e->getCode());
}
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\Action\Fault;
use App\Action\AbstractCrudAction;
use App\Response\JsonCorsResponse;
use App\Service\FaultManagerService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response;
use Zend\Diactoros\Response\EmptyResponse;
class FaultS4RepairedAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'PUT',
];
/**
* @var FaultManagerService
*/
private $faultManagerService;
public function __construct(FaultManagerService $faultManagerService)
{
$this->faultManagerService = $faultManagerService;
}
/**
* Update a fault report
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function update(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
try {
$id = $request->getAttribute('id');
$data = $this->getRequestData($request);
return new JsonCorsResponse($this->faultManagerService->repairFault($id, $data));
} catch (\Exception $e) {
return new JsonCorsResponse($e->getMessage(), $e->getCode());
}
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\Action\Fault;
use App\Action\AbstractCrudAction;
use App\Response\JsonCorsResponse;
use App\Service\FaultManagerService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response;
use Zend\Diactoros\Response\EmptyResponse;
class FaultS5AcceptedAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'PUT',
];
/**
* @var FaultManagerService
*/
private $faultManagerService;
public function __construct(FaultManagerService $faultManagerService)
{
$this->faultManagerService = $faultManagerService;
}
/**
* Update a fault report
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function update(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
try {
$id = $request->getAttribute('id');
$data = $this->getRequestData($request);
return new JsonCorsResponse($this->faultManagerService->acceptFault($id, $data));
} catch (\Exception $e) {
return new JsonCorsResponse($e->getMessage(), $e->getCode());
}
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace App\Action;
use App\Response\JsonCorsResponse;
use App\Service\MaintenanceManagerService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
class MaintenanceAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'GET',
'POST',
];
/**
* @var MaintenanceManagerService
*/
private $maintenanceManagerService;
public function __construct(MaintenanceManagerService $maintenanceManagerService)
{
$this->maintenanceManagerService = $maintenanceManagerService;
}
/**
* Renew auth token
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response\JsonResponse
*/
public function getList(ServerRequestInterface $request, DelegateInterface $delegate)
{
return new JsonCorsResponse($this->maintenanceManagerService->getMaintenanceList()->getValues());
}
/**
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return JsonCorsResponse|\Zend\Diactoros\Response\JsonResponse
* @throws \Doctrine\ORM\ORMException
* @throws \Doctrine\ORM\OptimisticLockException
* @throws \Doctrine\ORM\TransactionRequiredException
*/
public function get(ServerRequestInterface $request, DelegateInterface $delegate)
{
$hash = $request->getAttribute(self::IDENTIFIER_NAME);
return new JsonCorsResponse($this->maintenanceManagerService->get($hash));
}
/**
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return JsonCorsResponse|\Zend\Diactoros\Response\JsonResponse
* @throws \Doctrine\ORM\ORMException
* @throws \Doctrine\ORM\OptimisticLockException
* @throws \Doctrine\ORM\TransactionRequiredException
*/
public function update(ServerRequestInterface $request, DelegateInterface $delegate)
{
$hash = $request->getAttribute(self::IDENTIFIER_NAME);
$data = $this->getRequestData($request);
$jwt = $request->getAttribute('token');
return new JsonCorsResponse($this->maintenanceManagerService->update($hash, $data, $jwt->uid));
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Action;
use App\Service\MaintenanceManagerService;
use Interop\Container\ContainerInterface;
class MaintenanceFactory
{
/**
* @param ContainerInterface $container
* @return MaintenanceAction
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function __invoke(ContainerInterface $container)
{
$maintenanceManagerService = $container->get(MaintenanceManagerService::class);
return new MaintenanceAction($maintenanceManagerService);
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace App\Action;
use App\Response\JsonCorsResponse;
use App\Service\MaintenanceManagerService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
class MaintenanceUpcomingAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'GET',
];
/**
* @var MaintenanceManagerService
*/
private $maintenanceManagerService;
public function __construct(MaintenanceManagerService $maintenanceManagerService)
{
$this->maintenanceManagerService = $maintenanceManagerService;
}
/**
* Renew auth token
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response\JsonResponse
*/
public function getList(ServerRequestInterface $request, DelegateInterface $delegate)
{
return new JsonCorsResponse($this->maintenanceManagerService->getUpcomingMaintenanceList()->getValues());
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Action;
use App\Service\MaintenanceManagerService;
use Interop\Container\ContainerInterface;
class MaintenanceUpcomingFactory
{
/**
* @param ContainerInterface $container
* @return MaintenanceUpcomingAction
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function __invoke(ContainerInterface $container)
{
$maintenanceManagerService = $container->get(MaintenanceManagerService::class);
return new MaintenanceUpcomingAction($maintenanceManagerService);
}
}

View File

@ -0,0 +1,63 @@
<?php
namespace App\Action\Pdf;
use App\Action\AbstractCrudAction;
use App\Service\MaintenanceManagerService;
use App\Service\PdfService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response\EmptyResponse;
use Zend\Diactoros\Response\TextResponse;
class GenerateMaintenanceSheetAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'GET',
];
/**
* @var PdfService
*/
private $pdfService;
/**
* @var MaintenanceManagerService
*/
private $maintenanceManager;
public function __construct(PdfService $pdfService, MaintenanceManagerService $maintenanceManagerService)
{
$this->pdfService = $pdfService;
$this->maintenanceManager = $maintenanceManagerService;
}
/**
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response\JsonResponse|TextResponse|static
* @throws \PHPPdf\Core\PHPPdf\Exception\Exception
*/
public function get(ServerRequestInterface $request, DelegateInterface $delegate)
{
$id = $request->getAttribute('id', false);
try {
return (new TextResponse($this->pdfService->getMaintenanceSheet($id)))
->withHeader('Content-type', 'application/pdf');
} catch (\Exception $e) {
return new TextResponse($e->getMessage(), 500);
}
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return static
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate)
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Action\Pdf;
use App\Service\MaintenanceManagerService;
use App\Service\PdfService;
use Interop\Container\ContainerInterface;
class GenerateMaintenanceSheetFactory
{
/**
* @param ContainerInterface $container
* @return GenerateMaintenanceSheetAction
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function __invoke(ContainerInterface $container)
{
/** @var PdfService $pdfService */
$pdfService = $container->get(PdfService::class);
/** @var MaintenanceManagerService $maintenanceManagerService */
$maintenanceManagerService = $container->get(MaintenanceManagerService::class);
return new GenerateMaintenanceSheetAction($pdfService, $maintenanceManagerService);
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace App\Action\Pdf;
use App\Action\AbstractCrudAction;
use App\Service\FaultManagerService;
use App\Service\PdfService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response\EmptyResponse;
use Zend\Diactoros\Response\TextResponse;
class GenerateWorksheetAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'GET',
];
/**
* @var PdfService
*/
private $pdfService;
/**
* @var FaultManagerService
*/
private $faultManager;
public function __construct(PdfService $pdfService, FaultManagerService $faultManagerService)
{
$this->pdfService = $pdfService;
$this->faultManager = $faultManagerService;
}
/**
* Renew auth token
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function get(ServerRequestInterface $request, DelegateInterface $delegate)
{
$id = $request->getAttribute('id', false);
try {
return (new TextResponse($this->pdfService->getWorksheet($id)))
->withHeader('Content-type', 'application/pdf')
// ->withHeader('Content-disposition', 'attachment; filename='
// . $this->faultManager->getFault($id)->getWorksheetNumber() . '.pdf')
;
} catch (\Exception $e) {
return new TextResponse($e->getMessage(), 500);
}
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return static
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate)
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Action\Pdf;
use App\Service\FaultManagerService;
use App\Service\PdfService;
use Interop\Container\ContainerInterface;
class GenerateWorksheetFactory
{
public function __invoke(ContainerInterface $container)
{
/** @var PdfService $pdfService */
$pdfService = $container->get(PdfService::class);
/** @var FaultManagerService $faultManager */
$faultManager = $container->get(FaultManagerService::class);
return new GenerateWorksheetAction($pdfService, $faultManager);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Action;
use App\Response\JsonCorsResponse;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Interop\Http\ServerMiddleware\MiddlewareInterface as ServerMiddlewareInterface;
use Psr\Http\Message\ServerRequestInterface;
class PingAction implements ServerMiddlewareInterface
{
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
{
return new JsonCorsResponse(['ack' => time()]);
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace App\Action;
use App\Response\JsonCorsResponse;
use App\Service\SolutionTimeIntervalService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response;
use Zend\Diactoros\Response\EmptyResponse;
class SolutionTimeIntervalAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'GET',
];
/**
* @var SolutionTimeIntervalService
*/
private $solutionTimeIntervalService;
public function __construct(SolutionTimeIntervalService $facilityLocationService)
{
$this->solutionTimeIntervalService = $facilityLocationService;
}
/**
* Return all faults accessible to the user
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function getList(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return new JsonCorsResponse($this->solutionTimeIntervalService->getList());
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate): Response
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Action;
use App\Service\SolutionTimeIntervalService;
use Interop\Container\ContainerInterface;
class SolutionTimeIntervalFactory
{
public function __invoke(ContainerInterface $container)
{
/** @var SolutionTimeIntervalService $facilityLocationService */
$facilityLocationService = $container->get(SolutionTimeIntervalService::class);
return new SolutionTimeIntervalAction($facilityLocationService);
}
}

View File

@ -0,0 +1,57 @@
<?php
namespace App\Action\User;
use App\Action\AbstractCrudAction;
use App\Response\JsonCorsResponse;
use App\Service\UserService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response\EmptyResponse;
class PasswordAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'POST',
];
/**
* @var UserService
*/
private $userService;
public function __construct(UserService $userService)
{
$this->userService = $userService;
}
/**
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return JsonCorsResponse
*/
public function create(ServerRequestInterface $request, DelegateInterface $delegate)
{
$token = $request->getAttribute('token');
try {
$data = $this->getRequestData($request);
return new JsonCorsResponse($this->userService->changePassword($token->uid, $data['old'], $data['new']));
} catch (\Exception $e) {
return new JsonCorsResponse([
'message' => $e->getMessage()
], $e->getCode());
}
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return static
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate)
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Action\User;
use App\Service\UserService;
use Interop\Container\ContainerInterface;
class PasswordFactory
{
public function __invoke(ContainerInterface $container)
{
/** @var UserService $userService */
$userService = $container->get(UserService::class);
return new PasswordAction($userService);
}
}

View File

@ -0,0 +1,93 @@
<?php
namespace App\Action\User;
use App\Action\AbstractCrudAction;
use App\Response\JsonCorsResponse;
use App\Service\UserService;
use Interop\Http\ServerMiddleware\DelegateInterface;
use Psr\Http\Message\ServerRequestInterface;
use Zend\Diactoros\Response\EmptyResponse;
class UserAction extends AbstractCrudAction
{
const CORS_ALLOW_METHODS = [
'GET',
'PUT',
];
/**
* @var UserService
*/
private $userService;
public function __construct(UserService $userService)
{
$this->userService = $userService;
}
/**
* Renew auth token
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return \Zend\Diactoros\Response\JsonResponse
*/
public function getList(ServerRequestInterface $request, DelegateInterface $delegate)
{
try {
return new JsonCorsResponse($this->userService->getList());
} catch (\Exception $e) {
return new JsonCorsResponse([
'message' => $e->getMessage()
], 500);
}
}
/**
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return JsonCorsResponse
*/
public function get(ServerRequestInterface $request, DelegateInterface $delegate)
{
$id = $request->getAttribute('id');
try {
return new JsonCorsResponse($this->userService->get($id));
} catch (\Exception $e) {
return new JsonCorsResponse([
'message' => $e->getMessage()
], 500);
}
}
/**
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return JsonCorsResponse
*/
public function update(ServerRequestInterface $request, DelegateInterface $delegate)
{
$id = $request->getAttribute('id');
try {
$data = $this->getRequestData($request);
return new JsonCorsResponse($this->userService->update($id, $data));
} catch (\Exception $e) {
return new JsonCorsResponse([
'message' => $e->getMessage()
], 500);
}
}
/**
* Configure CORS preflight
*
* @param ServerRequestInterface $request
* @param DelegateInterface $delegate
* @return static
*/
public function options(ServerRequestInterface $request, DelegateInterface $delegate)
{
return $this->withCorsHeaders(new EmptyResponse(), self::CORS_ALLOW_METHODS);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Action\User;
use App\Service\UserService;
use Interop\Container\ContainerInterface;
class UserFactory
{
public function __invoke(ContainerInterface $container)
{
/** @var UserService $userService */
$userService = $container->get(UserService::class);
return new UserAction($userService);
}
}

View File

@ -0,0 +1,60 @@
<?php
namespace App\Command;
use App\Entity\DeviceGroup;
use App\Entity\DeviceMaintenanceTask;
use App\Entity\Maintenance;
use App\Service\MaintenanceManagerService;
use Doctrine\ORM\EntityManager;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ConvertMaintenanceHashCommand extends Command
{
/** @var EntityManager */
private $entityManager;
/** @var MaintenanceManagerService */
private $maintenanceManager;
public function __construct(EntityManager $entityManager, MaintenanceManagerService $maintenanceManagerService)
{
$this->entityManager = $entityManager;
$this->maintenanceManager = $maintenanceManagerService;
parent::__construct();
}
protected function configure()
{
$this->setName('convert:hash')
->setDescription('convert v1 hash to v2');
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|null|void
* @throws \Doctrine\ORM\OptimisticLockException
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var DeviceGroup[] $maintGroups */
$maintGroups = $this->maintenanceManager->getMaintenanceList();
foreach ($maintGroups as $maintGroup) {
foreach ($maintGroup->getDevices() as $device) {
foreach ($device->getTasks() as $task) {
if(null !== ($entity = $this->entityManager->getRepository(Maintenance::class)->findOneBy([
'oldHash' => $task->getLegacyHash(),
]))) {
/** @var Maintenance $entity */
$entity->setHash($task->getHash());
}
}
}
}
$this->entityManager->flush();
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Command;
use App\Service\MaintenanceManagerService;
use Doctrine\ORM\EntityManager;
use Interop\Container\ContainerInterface;
class ConvertMaintenanceHashCommandFactory
{
/**
* @param ContainerInterface $container
* @return ConvertMaintenanceHashCommand
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
public function __invoke(ContainerInterface $container)
{
/** @var EntityManager $entityManager */
$entityManager = $container->get('doctrine.entity_manager.orm_default');
/** @var MaintenanceManagerService $maintenanceManager */
$maintenanceManager = $container->get(MaintenanceManagerService::class);
return new ConvertMaintenanceHashCommand($entityManager, $maintenanceManager);
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Command;
use App\Service\FixtureLoaderService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class InitializeFixtureCommand extends Command
{
/**
* @var FixtureLoaderService
*/
private $fixtureLoaderService;
public function __construct(FixtureLoaderService $fixtureLoaderService)
{
$this->fixtureLoaderService = $fixtureLoaderService;
parent::__construct();
}
protected function configure()
{
$this->setName('initialize:fixture')
->setDescription('Loads data fixture into the database, replacing already existing data');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->fixtureLoaderService->load($output);
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Command;
use App\Service\FixtureLoaderService;
use Interop\Container\ContainerInterface;
class InitializeFixtureCommandFactory
{
public function __invoke(ContainerInterface $container)
{
/** @var FixtureLoaderService $fixtureLoaderService */
$fixtureLoaderService = $container->get(FixtureLoaderService::class);
return new InitializeFixtureCommand($fixtureLoaderService);
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Command;
use App\Service\Mailer\MailerService;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class MailTestCommand extends Command
{
/**
* @var MailerService
*/
private $mailerService;
public function __construct(MailerService $mailerService)
{
$this->mailerService = $mailerService;
parent::__construct();
}
protected function configure()
{
$this->setName('mail:test')
->setDescription('Test email');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->mailerService->sendTestMessage();
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Command;
use App\Service\Mailer\MailerService;
use Interop\Container\ContainerInterface;
class MailTestCommandFactory
{
public function __invoke(ContainerInterface $container)
{
/** @var MailerService $mailerService */
$mailerService = $container->get(MailerService::class);
return new MailTestCommand($mailerService);
}
}

Some files were not shown because too many files have changed in this diff Show More