Stampe via API

This commit is contained in:
Thomas Zilio 2019-09-16 17:40:53 +02:00
parent 2f441fe415
commit 3413ed185c
2 changed files with 32 additions and 1 deletions

30
src/API/Common/Stampa.php Normal file
View File

@ -0,0 +1,30 @@
<?php
namespace Api\Common;
use API\Interfaces\CreateInterface;
use API\Interfaces\RetrieveInterface;
use API\Resource;
use Models\PrintTemplate;
use Prints;
class Stampa extends Resource implements RetrieveInterface
{
public function retrieve($request)
{
$content = '';
$print = PrintTemplate::where('name', $request['name'])->first();
if (!empty($print)) {
$directory = DOCROOT.'/files/api';
$data = Prints::render($print->id, $request['id_record'], $directory);
download($data['path']);
delete($data['path']);
}
return [
'custom' => '',
];
}
}

View File

@ -148,7 +148,8 @@ INSERT INTO `zz_api_resources` (`id`, `version`, `type`, `resource`, `class`, `e
(NULL, 'v1', 'create', 'sessione', 'Modules\\Interventi\\API\\v1\\Sessioni', '1'),
(NULL, 'v1', 'delete', 'sessioni_intervento', 'Modules\\Interventi\\API\\v1\\Sessioni', '1'),
(NULL, 'v1', 'retrieve', 'articoli_intervento', 'Modules\\Interventi\\API\\v1\\Articoli', '1'),
(NULL, 'v1', 'create', 'articolo_intervento', 'Modules\\Interventi\\API\\v1\\Articoli', '1');
(NULL, 'v1', 'create', 'articolo_intervento', 'Modules\\Interventi\\API\\v1\\Articoli', '1'),
(NULL, 'v1', 'retrieve', 'stampa', 'Api\\Common\\Stampa', '1');
-- Supporto alla personalizzazione dell'API remota OSMCloud
INSERT INTO `zz_settings` (`id`, `nome`, `valore`, `tipo`, `editable`, `sezione`, `order`) VALUES