Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 7063 | Rev 15154 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
6898 eleazar 1
<?php
2
 
3
namespace LeadersLinked\Library;
4
 
5
use Fpdf\Fpdf;
6
 
7
class UniqueSurveyReport extends FPDF {
15152 efrain 8
 
9
    public $header;
10
    public $footer;
6898 eleazar 11
    /**
12
     * Header PDF
13
     */
14
    function Header() {
15152 efrain 15
        if ($this->header != '') {
16
            $this->Image($this->header, 10, 8, 190);
17
            $this->SetY(55);
18
        }
6898 eleazar 19
    }
20
 
7054 eleazar 21
    function customHeader($headerFormName) {
7040 eleazar 22
        $s = utf8_decode(' Página: ' . $this->PageNo());
23
        $this->SetFont('Arial', '', 10);
24
        $this->SetY(40);
25
        $this->Cell(190, 10, $s, 0, 0, 'R');
26
 
27
        $this->SetFont('Arial', 'B', 15);
28
        $this->SetY(50);
29
        $this->Cell(180, 10, $headerFormName, 0, 0, 'C');
30
        $this->setY($this->getY() + 8);
31
 
32
 
33
        $this->SetFont('Arial', '', 10);
34
        $this->setY($this->getY() + 10);
35
    }
36
 
6898 eleazar 37
    /**
38
     * Footer PDF
39
     */
40
    function Footer() {
15152 efrain 41
        if ($this->footer != '') {
42
            $this->SetY(-40);
43
            $this->Image($this->footer, 10, $this->getY(), 190);
44
        }
6898 eleazar 45
    }
46
 
47
    /**
48
     * Section Scale
49
     */
50
    function sectionScale() {
51
        $this->SetFillColor(225, 255, 255);
52
        $this->SetTextColor(0);
53
        $this->SetFont('Arial', 'B', 9);
54
 
55
 
56
        $this->Cell(35, 8, utf8_decode(' Escala/Niveles:'), 1, 0, 'L', false);
57
 
58
        $this->SetFillColor(225, 255, 255);
59
        $this->SetTextColor(0);
60
        $this->SetFont('Arial', '', 9);
61
 
62
        $this->Cell(155, 8, utf8_decode(' 1: Mínimo  2: Medio  3: Medio-Alto  4: Alto  N/A: No aplica
63
'), 1, 'L', false);
64
        $this->Ln(15);
65
    }
66
 
67
    /**
68
     * Create Table
69
     * @param string $title
70
     * @param array $content
71
     */
72
    function borderTable($title, $content) {
73
 
74
        // Header Table
75
        $this->SetFillColor(204, 204, 204);
76
        $this->SetDrawColor(0, 0, 0);
77
        $this->SetLineWidth(0);
78
        $this->SetFont('Arial', 'B', 9);
79
 
80
        $this->Cell(190, 6, utf8_decode($title), 1, 0, 'L', true);
81
        $this->Ln();
82
 
83
        // Body Table
84
        $this->SetFillColor(225, 255, 255);
85
        $this->SetTextColor(0);
86
 
87
        foreach ($content as $rs) {
88
            if (isset($rs['title'])) {
89
 
90
                $this->SetFont('Arial', 'B', 9);
91
                $this->Cell(50, 10, utf8_decode($rs['title']), 1, 0, 'L', false);
92
                $this->MultiCell(140, 10, utf8_decode($rs['content']), 1, 'L', false);
93
                $this->Ln();
94
            } else {
95
 
96
                $this->SetFont('Arial', '', 9);
97
                $this->MultiCell(190, 6, utf8_decode($rs['content']), 1, 'L', false);
98
            }
99
        }
100
        $this->Ln(5);
101
    }
102
 
103
    /**
104
     * title option table
105
     * @param string $title
106
     */
107
    function titleOptionTable($title) {
108
 
109
        if ($title != '') {
110
            // Body Table
111
            $this->SetFillColor(204, 204, 204);
112
            $this->SetDrawColor(0, 0, 0);
113
            $this->SetLineWidth(0);
114
            $this->SetFont('Arial', 'B', 9);
115
 
116
            $this->Cell(190, 6, utf8_decode($title), 1, 0, 'L', true);
117
            $this->Ln();
118
        }
119
    }
120
 
121
 
122
    /**
123
     * Create Table
124
     * @param string $title
125
     * @param array $content
126
     */
127
    function singleTable($title, $content) {
128
 
129
        // Header Table
130
        $this->SetFillColor(255, 255, 255);
131
        $this->SetDrawColor(0, 0, 0);
132
        $this->SetLineWidth(0);
133
        $this->SetFont('Arial', 'B', 9);
134
 
135
        $this->Cell(190, 6, utf8_decode($title), 0, 0, 'L', true);
136
        $this->Ln();
137
 
138
        // Body Table
139
        $this->SetFillColor(225, 255, 255);
140
        $this->SetTextColor(0);
141
        $this->SetFont('Arial', '', 9);
142
 
143
        foreach ($content as $rs) {
144
            if (isset($rs['title'])) {
145
                $this->Cell(40, 6, utf8_decode($rs['title']), 0, 0, 'L', false);
146
                $this->Cell(150, 6, utf8_decode($rs['content']), 0, 'L', false);
147
                $this->Ln();
148
            } else {
149
                if ($rs['content'] != "") {
150
                    $this->MultiCell(190, 6, utf8_decode($rs['content']), 0, 'L', false);
151
                }
152
            }
153
        }
154
        $this->Ln(5);
155
    }
156
 
7061 eleazar 157
    function optionTable($questionText, $options) {
158
 
159
 
160
        // Header Table
161
        $this->SetFillColor(255, 255, 255);
162
        $this->SetDrawColor(0, 0, 0);
163
        $this->SetLineWidth(0);
164
        $this->SetFont('Arial', 'B', 9);
165
 
166
        $this->MultiCell(190, 5, utf8_decode($questionText), 0, 'L', false);
167
 
168
        // Body Table
169
 
170
        $this->SetFillColor(204, 204, 204);
171
        $this->SetDrawColor(0, 0, 0);
172
        $this->SetLineWidth(0);
173
        $this->SetFont('Arial', 'B', 9);
174
 
175
        if (count($options)>0) {
176
 
7063 eleazar 177
            $this->Cell(182, 6, utf8_decode('Opcion :'), 1, 0, 'L', true);
7061 eleazar 178
            $this->Cell(8, 6, 'Sel.', 1, 0, 'C', true);
179
            $this->Ln();
180
 
181
            // Body Table
182
            $this->SetFillColor(225, 255, 255);
183
            $this->SetTextColor(0);
184
            $this->SetFont('Arial', '', 9);
185
 
186
            for ($i = 0; $i < count($options); $i++) {
187
 
7063 eleazar 188
                $this->Cell(182, 6, utf8_decode($options[$i]['text']), 1, 0, 'L', false);
7061 eleazar 189
                $this->Cell(8, 6, $options[$i]['selected'] ? 'X' : '', 1, 0, 'C', false);
190
 
191
                $this->Ln();
192
            }
193
        }
194
 
195
 
196
        $this->Ln();
197
    }
198
 
6898 eleazar 199
}