Proyectos de Subversion LeadersLinked - Backend

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
2667 eleazar 1
<?php
2
 
3
namespace LeadersLinked\Library;
4
 
5
use Fpdf\Fpdf;
6
 
7
class InterviewPDF extends FPDF {
8
 
9
    /**
10
     * Header PDF
11
     */
12
    function Header() {
13
 
14
        if ($this->header != '') {
15
            $this->Image($this->header, 10, 8, 190);
16
            $this->SetY(55);
17
        }
18
    }
19
 
20
    /**
21
     * Footer PDF
22
     */
23
    function Footer() {
24
        if ($this->footer != '') {
25
            $this->SetY(-40);
26
            $this->Image($this->footer, 10, $this->getY(), 190);
27
        }
28
    }
29
 
30
    /**
31
     * Section Scale
32
     */
33
    function sectionScale() {
34
        $this->SetFillColor(225, 255, 255);
35
        $this->SetTextColor(0);
36
        $this->SetFont('Arial', 'B', 9);
37
 
38
 
39
        $this->Cell(35, 8, utf8_decode(' Escala/Niveles:'), 1, 0, 'L', false);
40
 
41
        $this->SetFillColor(225, 255, 255);
42
        $this->SetTextColor(0);
43
        $this->SetFont('Arial', '', 9);
44
 
45
        $this->Cell(155, 8, utf8_decode(' 1: Mínimo  2: Medio  3: Medio-Alto  4: Alto  N/A: No aplica
46
'), 1, 'L', false);
47
        $this->Ln(15);
48
    }
49
 
50
    /**
51
     * Create Table
52
     * @param string $title
53
     * @param array $content
54
     */
55
    function borderTable($title, $content) {
56
 
57
        // Header Table
58
        $this->SetFillColor(204, 204, 204);
59
        $this->SetDrawColor(0, 0, 0);
60
        $this->SetLineWidth(0);
61
        $this->SetFont('Arial', 'B', 9);
62
 
63
        $this->Cell(190, 6, utf8_decode($title), 1, 0, 'L', true);
64
        $this->Ln();
65
 
66
        // Body Table
67
        $this->SetFillColor(225, 255, 255);
68
        $this->SetTextColor(0);
69
 
70
        foreach ($content as $rs) {
71
            if (isset($rs['title'])) {
72
 
73
                $this->SetFont('Arial', 'B', 9);
2967 eleazar 74
                $this->Cell(50, 10, utf8_decode($rs['title']), 1, 0, 'L', false);
75
                $this->MultiCell(140, 10, utf8_decode($rs['content']), 1, 'L', false);
2965 eleazar 76
                $this->Ln();
2667 eleazar 77
            } else {
78
 
79
                $this->SetFont('Arial', '', 9);
80
                $this->MultiCell(190, 6, utf8_decode($rs['content']), 1, 'L', false);
81
            }
82
        }
83
        $this->Ln(5);
84
    }
85
 
86
    /**
87
     * title option table
88
     * @param string $title
89
     */
90
    function titleOptionTable($title) {
91
 
92
        if ($title != '') {
93
            // Body Table
94
            $this->SetFillColor(204, 204, 204);
95
            $this->SetDrawColor(0, 0, 0);
96
            $this->SetLineWidth(0);
97
            $this->SetFont('Arial', 'B', 9);
98
 
99
            $this->Cell(190, 6, utf8_decode($title), 1, 0, 'L', true);
100
            $this->Ln();
101
        }
102
    }
103
 
104
 
105
    /**
106
     * Create Table
107
     * @param string $title
108
     * @param array $content
109
     */
110
    function singleTable($title, $content) {
111
 
112
        // Header Table
113
        $this->SetFillColor(255, 255, 255);
114
        $this->SetDrawColor(0, 0, 0);
115
        $this->SetLineWidth(0);
116
        $this->SetFont('Arial', 'B', 9);
117
 
118
        $this->Cell(190, 6, utf8_decode($title), 0, 0, 'L', true);
119
        $this->Ln();
120
 
121
        // Body Table
122
        $this->SetFillColor(225, 255, 255);
123
        $this->SetTextColor(0);
124
        $this->SetFont('Arial', '', 9);
125
 
126
        foreach ($content as $rs) {
127
            if (isset($rs['title'])) {
128
                $this->Cell(40, 6, utf8_decode($rs['title']), 0, 0, 'L', false);
129
                $this->Cell(150, 6, utf8_decode($rs['content']), 0, 'L', false);
130
                $this->Ln();
131
            } else {
132
                if ($rs['content'] != "") {
133
                    $this->MultiCell(190, 6, utf8_decode($rs['content']), 0, 'L', false);
134
                }
135
            }
136
        }
137
        $this->Ln(5);
138
    }
139
 
140
    /**
141
     * Create Competency Table
142
     * @param int $index
143
     * @param array $competency
144
     */
145
    function competencyTable($index, $competency) {
146
 
147
 
148
        // Header Table
149
        $this->SetFillColor(255, 255, 255);
150
        $this->SetDrawColor(0, 0, 0);
151
        $this->SetLineWidth(0);
152
        $this->SetFont('Arial', 'B', 9);
153
 
154
        $this->MultiCell(190, 5, $index . '- ' . utf8_decode($competency['type']) . ': ' . utf8_decode($competency['name']), 0, 'L', false);
155
 
156
        // Body Table
157
        $this->SetFillColor(225, 255, 255);
158
        $this->SetTextColor(0);
159
        $this->SetFont('Arial', '', 9);
160
 
161
        $this->MultiCell(190, 6, utf8_decode(strip_tags($competency['description'])), 0, 'L', false);
162
 
163
        $this->Ln(3);
164
 
165
        $this->SetFillColor(204, 204, 204);
166
        $this->SetDrawColor(0, 0, 0);
167
        $this->SetLineWidth(0);
168
        $this->SetFont('Arial', 'B', 9);
169
 
170
        $behaviors = $competency['behaviors'];
171
 
172
        if (count($behaviors) > 0) {
173
 
174
            $this->Cell(150, 6, utf8_decode('Conductas observables :'), 1, 0, 'L', true);
175
            $this->Cell(16, 6, 'Nivel', 1, 0, 'C', true);
176
            $this->Cell(24, 6, utf8_decode('Evaluación'), 1, 0, 'C', true);
177
            $this->Ln();
178
 
179
            // Body Table
180
            $this->SetFillColor(225, 255, 255);
181
            $this->SetTextColor(0);
182
 
4256 eleazar 183
 
2667 eleazar 184
 
185
            for ($i = 0; $i < count($behaviors); $i++) {
186
 
4263 eleazar 187
                switch ($behaviors[$i]['evaluation']) {
4257 eleazar 188
                    case "0":
4261 eleazar 189
                        $evaluation = "0%";
4257 eleazar 190
                        break;
191
                    case "1":
192
                        $evaluation = "25%";
193
                        break;
194
                    case "2":
195
                        $evaluation = "50%";
196
                        break;
197
                    case "3":
198
                        $evaluation = "75%";
199
                        break;
200
                    case "4":
201
                        $evaluation = "100%";
202
                        break;
203
                    default :
204
                        $evaluation = "ERROR";
205
                        break;
206
                }
207
 
2667 eleazar 208
                $this->SetFont('Arial', '', 8.5);
209
 
210
                $this->Cell(150, 6, utf8_decode($behaviors[$i]['description']), 1, 0, 'L', false);
211
                $this->Cell(16, 6, $behaviors[$i]['level'] == '0' ? 'N/A' : $behaviors[$i]['level'], 1, 0, 'C', false);
4265 eleazar 212
                $this->Cell(24, 6, $evaluation, 1, 0, 'C', false);
4061 eleazar 213
 
2667 eleazar 214
                $this->Ln();
215
 
2900 eleazar 216
                $this->SetFont('Arial', '', 9);
2667 eleazar 217
 
4268 eleazar 218
                $this->Cell(190, 6, utf8_decode('Comentarios: ') . utf8_decode($behaviors[$i]['comment']), 1, 0, 'B', false);
2667 eleazar 219
 
220
 
221
                $this->Ln();
222
            }
223
        }
224
 
225
 
226
        $this->Ln();
227
    }
228
 
229
}