|
1
|
|
|
<?php |
|
2
|
|
|
namespace Padosoft\TesseraSanitaria; |
|
3
|
|
|
|
|
4
|
|
|
use Monolog\Logger; |
|
5
|
|
|
|
|
6
|
|
|
/** |
|
7
|
|
|
* Class PrintHelper |
|
8
|
|
|
* @package Padosoft\TesseraSanitaria |
|
9
|
|
|
*/ |
|
10
|
|
|
class PrintHelper |
|
11
|
|
|
{ |
|
12
|
|
|
use traits\Errorable; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* @param Tracciato $objTracciato |
|
16
|
|
|
* @param Logger $logger |
|
17
|
|
|
*/ |
|
18
|
|
|
public static function printError(Tracciato $objTracciato, Logger $logger) |
|
19
|
|
|
{ |
|
20
|
|
|
|
|
21
|
|
|
if (!$objTracciato->getResult()) { |
|
22
|
|
|
echo '<div class="alert alert-danger" role="alert"><strong>ERRORE!</strong><br /><br />Elenco Errori:<br /><br />'; |
|
23
|
|
|
$arr_errors = $objTracciato->getArrErrors(); |
|
24
|
|
|
foreach ($arr_errors as $error) { |
|
25
|
|
|
echo $error . "<br>"; |
|
26
|
|
|
$logger->addError(strip_tags($error)); |
|
27
|
|
|
} |
|
28
|
|
|
echo "<br /><br /><strong>FILE XML NON CREATO</strong><br><br> |
|
29
|
|
|
</div>"; |
|
30
|
|
|
} |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param $strXML |
|
35
|
|
|
* @param bool|false $textarea |
|
36
|
|
|
* |
|
37
|
|
|
* @throws \Exception |
|
38
|
|
|
*/ |
|
39
|
|
|
public static function printXML($strXML, $textarea = false) |
|
40
|
|
|
{ |
|
41
|
|
|
if ($textarea) { |
|
42
|
|
|
echo 'XML Generato: <br /><textarea name="xml" cols=130 rows=25>' . $strXML . '</textarea><br /><br />'; |
|
43
|
|
|
} else { |
|
44
|
|
|
echo '<div style="height:500px; overflow:auto">' . \luminous::highlight('xml', $strXML) . "</div>"; |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* |
|
50
|
|
|
*/ |
|
51
|
|
|
public static function printHtmlHeader() |
|
52
|
|
|
{ |
|
53
|
|
|
\luminous::set(array('relative_root' => '../vendor/luminous/luminous')); |
|
54
|
|
|
|
|
55
|
|
|
echo '<html> |
|
56
|
|
|
<head> |
|
57
|
|
|
<link href="../vendor/twbs/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> |
|
58
|
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> |
|
59
|
|
|
<script src="../vendor/twbs/bootstrap/dist/js/bootstrap.min.js"></script>'; |
|
60
|
|
|
echo \luminous::head_html(); // outputs CSS includes to highlight xml, intended to go in <head> |
|
61
|
|
|
echo ' </head> |
|
62
|
|
|
<body role="document"> |
|
63
|
|
|
<div class="container theme-showcase" role="main"> |
|
64
|
|
|
<div class="jumbotron"> |
|
65
|
|
|
<h1>Demo Tessera Sanitaria.</h1> |
|
66
|
|
|
<p>Questo è un semplice demo che mostra l\'utilizzo del Package Padosoft TesseraSanitaria.<br /> |
|
67
|
|
|
Il package permette la creazione di file XML delle prestazioni mediche per il servizio nazionale sanità |
|
68
|
|
|
secondo il formato XML della tessera sanitaria definito nel DM 31/07/2015.<br /> |
|
69
|
|
|
Per maggiori info si veda il <a href="http://sistemats1.sanita.finanze.it/wps/portal/" target="_blank">Portale della Tessera Sanitaria</a> |
|
70
|
|
|
</p> |
|
71
|
|
|
</div> |
|
72
|
|
|
'; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* |
|
77
|
|
|
*/ |
|
78
|
|
|
public static function printHtmlFooter() |
|
79
|
|
|
{ |
|
80
|
|
|
echo '<div class="page-header"><h1>Log:</h1></div> |
|
81
|
|
|
<a target="_blank" href="log/tessera_sanitaria.log">tessera_sanitaria.log</a> |
|
82
|
|
|
|
|
83
|
|
|
<div class="page-header"><h1>Credits:</h1></div> |
|
84
|
|
|
github: <a target="_blank" href="https://github.com/Padosoft">Padosoft</a> |
|
85
|
|
|
- |
|
86
|
|
|
website: <a target="_blank" href="https://www.padosoft.com">https://www.padosoft.com</a> |
|
87
|
|
|
'; |
|
88
|
|
|
echo '<br /><br /><br /> |
|
89
|
|
|
</div> |
|
90
|
|
|
</body> |
|
91
|
|
|
</html>'; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* |
|
96
|
|
|
*/ |
|
97
|
|
|
public static function printButton() |
|
98
|
|
|
{ |
|
99
|
|
|
echo '<br /><br /> |
|
100
|
|
|
<div class="page-header"><h1>Opzioni:</h1></div> |
|
101
|
|
|
<a type="button" class="btn btn-lg btn-success" href="?do=0">Test Dati Corretti</a> |
|
102
|
|
|
<a type="button" class="btn btn-lg btn-warning" href="?do=1">Test Dati Errati</a> |
|
103
|
|
|
<a type="button" class="btn btn-lg btn-danger" href="?do=2">Ripulisci Folder output</a> |
|
104
|
|
|
'; |
|
105
|
|
|
} |
|
106
|
|
|
} |
|
107
|
|
|
|