Proyectos de Subversion LeadersLinked - Backend

Rev

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