RelatorioHTML.php
3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
require_once('Relatorio.php');
class RelatorioHTML extends Relatorio
{
public function rgb2html($r, $g=-1, $b=-1)
{
if (is_array($r) && sizeof($r) == 3)
list($r, $g, $b) = $r;
$r = intval($r); $g = intval($g);
$b = intval($b);
$r = dechex($r<0?0:($r>255?255:$r));
$g = dechex($g<0?0:($g>255?255:$g));
$b = dechex($b<0?0:($b>255?255:$b));
$color = (strlen($r) < 2?'0':'').$r;
$color .= (strlen($g) < 2?'0':'').$g;
$color .= (strlen($b) < 2?'0':'').$b;
return '#'.$color;
}
public function output()
{
$cor = FALSE;
$titulo = $this->getTitulo();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<?php
echo "<title>$titulo</title>";
?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" topmargin="5">
<table border="0" align="left" cellpadding="0" cellspacing="0" bordercolor="#999999">
<tr bgcolor="#E1E1E1">
<td rowspan="5" bgcolor="#FFFFFF"><img src="../../imgs/cacic_logo.png" width="50" height="50"></td>
<td rowspan="5" bgcolor="#FFFFFF"></td>
<td bgcolor="#FFFFFF"> </td>
</tr>
<tr width="100%" bgcolor="#E1E1E1">
<td nowrap bgcolor="#FFFFFF"><font color="#333333" size="4" face="Verdana, Arial, Helvetica, sans-serif"><strong><?php echo $titulo;?></strong></font></td>
</tr>
<tr>
<td height="1" bgcolor="#333333"></td>
<tr>
<td><p align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Gerado
em <?php echo date("d/m/Y à\s H:i"); ?></font></p></td>
</tr>
<tr cellpadding="10" >
<td></td>
</tr>
</table>
<br>
<br>
<br>
<font size="1" face="Verdana, Arial, Helvetica, sans-serif"></tr>Exportar: <a href="?formato=pdf">PDF</a> | <a href="?formato=ods">ODS</a> | <a href="?formato=csv">CSV</a></font>
<br>
<br>
<?php
echo '<table cellpadding="2" cellspacing="0" border="1" bordercolor="#999999" bordercolordark="#E1E1E1">';
echo '<tr bgcolor="#E1E1E1" >';
foreach ($this->getHeader() as $cell)
{
echo '<td nowrap align="left">';
echo $cell;
echo '</td>';
}
echo '</tr>';
//Data
$i = 0;
foreach ($this->getBody() as $row)
{
$attr = $this->getRowColor($i++);
if (!$attr)
{
if ($cor)
{
$attr = 'bgcolor="#E1E1E1"';
}
}
else
{
$attr = 'bgcolor="'.$this->rgb2html($attr[0], $attr[1], $attr[2]).'"';
}
echo "<tr $attr>";
foreach ($row as $cell)
{
echo '<td nowrap align="left">';
echo $cell;
echo ' </td>';
}
echo '</tr>';
$cor = !$cor;
}
?>
</table>
<br><br>
<p align="left"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Relatório
gerado pelo <strong>CACIC</strong> - Configurador Automático e Coletor
de Informações Computacionais</font><br>
<font size="1" face="Verdana, Arial, Helvetica, sans-serif">Software desenvolvido pela Dataprev - Unidade Regional Espírito Santo</font></p>
</body>
</html>
<?php
}
}
?>