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