source: trunk/workflow/inc/report/includes/classes/ListagemIndicador.class.php @ 5307

Revision 5307, 2.4 KB checked in by pereira.jair, 12 years ago (diff)

Ticket #2416 - Inclusao da nova ferramenta de relatorios do workflow.

Line 
1<?php
2/**
3 * ListagemIndicador
4 *
5 * @author Jair Pereira <pereira.jair@gmail.com>
6 *
7 */
8class ListagemIndicador {
9       
10        private $idindicador;
11        private $tipo;
12        private $condicao;
13        private $codigoimagem;
14        private $legenda;
15        private $tamanho;
16        private $legendaarquivo;
17        private $_url_base_path;
18       
19        public function ListagemIndicador($idindicador,$condicao = "",$tipo = "R",$codigoimagem = "1",$legenda = "",$legendaarquivo = "",$tamanho = "1") {
20                $this->idindicador = $idindicador;
21                $this->condicao = $condicao;
22                $this->tipo = $tipo;
23                $this->codigoimagem = $codigoimagem;
24                $this->legenda = $legenda;
25                $this->legendaarquivo = $legendaarquivo;
26                $this->tamanho = $tamanho;
27                $this->_url_base_path = "";
28        }
29       
30        public function getLegenda() {
31                return $this->legenda;
32        }
33       
34        public function setUrlBasePath($base_path) {
35                $this->_url_base_path = $base_path;
36        }
37       
38        public function getIdIndicador() {
39                return $this->idindicador;
40        }
41       
42        public function getTipo() {
43                return $this->tipo;
44        }
45       
46        public function getCodigoImagem() {
47            return $this->codigoimagem;
48        }
49       
50        protected function getFileName($fundo = false) {
51                if (strtoupper($this->tipo) == "R") { $pasta = $this->_url_base_path . "/images/indicadores/redondos/ap"; }
52                if (strtoupper($this->tipo) == "Q") { $pasta = $this->_url_base_path . "/images/indicadores/quadrados/ap"; }
53                if (strtoupper($this->tipo) == "T") { $pasta = $this->_url_base_path . "/images/indicadores/triangulares/ap"; }
54            if (strtoupper($this->tipo) == "I") { $pasta = $this->_url_base_path . "/images/icones/t"; }
55                if ($fundo) { $pasta = $pasta . "f"; }
56                if (strtoupper($this->tipo) != "I") {
57                if ($this->codigoimagem < 10) {
58                        $nomeimagem = "ap0" . $this->codigoimagem . ".jpg";
59                } else {
60                        $nomeimagem = "ap" . $this->codigoimagem . ".jpg";
61                }
62                $filename = $pasta ."/" .  $nomeimagem;
63                } else {
64                    $filename = $pasta . $this->tamanho . "/" . $this->codigoimagem . ".jpg";   
65                }
66                if (!file_exists($filename)) {
67                    $filename = str_replace("../../../","",$filename);
68                }               
69                return $filename;
70        }
71       
72        public function getLegendaArquivo() {
73                return $this->legendaarquivo;
74        }
75       
76        public function getHtml($fundo = false) {
77            $file = $this->getFileName($fundo);
78                $html = "<img src='" . $file . "' align='absmiddle' alt='" . $this->legenda . "' title='" . $this->legenda .  "'>";
79                return $html;
80        }
81        public function getCondicao() {
82                return $this->condicao;
83        }
84}
85?>
Note: See TracBrowser for help on using the repository browser.