Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev Autor Línea Nro. Línea
1336 efrain 1
<?php
2
 
3
namespace LeadersLinked\Library;
4
 
5
use Fpdf\Fpdf;
6
 
7
class PerformanceEvaluationPdf 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);
1336 efrain 15
    }
16
 
17
    /**
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);
1336 efrain 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);
69
                $this->Cell(50, 10, utf8_decode($rs['title']), 1, 0, 'L', false);
70
                $this->Cell(140, 10, utf8_decode($rs['content']), 1, 'L', false);
71
                $this->Ln();
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
     * Create Section Option Table
101
     * @param string $content
102
     */
103
    function optionTable($title) {
104
 
105
        // Body Table
106
        $this->SetFillColor(225, 255, 255);
107
        $this->SetTextColor(0);
108
        $this->SetFont('Arial', 'B', 9);
109
        $this->Cell(50, 10, utf8_decode($title), 1, 0, 'L', false);
110
        $this->Cell(140, 10, '', 1, 'L', false);
111
        $this->Ln();
112
    }
113
 
114
    /**
115
     * Create Table
116
     * @param string $title
117
     * @param array $content
118
     */
119
    function singleTable($title, $content) {
120
 
121
        // Header Table
122
        $this->SetFillColor(255, 255, 255);
123
        $this->SetDrawColor(0, 0, 0);
124
        $this->SetLineWidth(0);
125
        $this->SetFont('Arial', 'B', 9);
126
 
127
        $this->Cell(190, 6, utf8_decode($title), 0, 0, 'L', true);
128
        $this->Ln();
129
 
130
        // Body Table
131
        $this->SetFillColor(225, 255, 255);
132
        $this->SetTextColor(0);
133
        $this->SetFont('Arial', '', 9);
134
 
135
        foreach ($content as $rs) {
136
            if (isset($rs['title'])) {
137
                $this->Cell(40, 6, utf8_decode($rs['title']), 0, 0, 'L', false);
138
                $this->Cell(150, 6, utf8_decode($rs['content']), 0, 'L', false);
139
                $this->Ln();
140
            } else {
141
                if ($rs['content'] != "") {
142
                    $this->MultiCell(190, 6, utf8_decode($rs['content']), 0, 'L', false);
143
                }
144
            }
145
        }
146
        $this->Ln(5);
147
    }
148
 
149
    /**
150
     * Create Competency Table
151
     * @param int $index
152
     * @param array $competency
153
     */
154
    function competencyTable($index, $competency) {
155
 
156
 
157
        // Header Table
158
        $this->SetFillColor(255, 255, 255);
159
        $this->SetDrawColor(0, 0, 0);
160
        $this->SetLineWidth(0);
161
        $this->SetFont('Arial', 'B', 9);
162
 
163
        $this->MultiCell(190, 5, $index . '- ' . utf8_decode($competency['type']) . ': ' . utf8_decode($competency['name']), 0, 'L', false);
164
 
165
        // Body Table
166
        $this->SetFillColor(225, 255, 255);
167
        $this->SetTextColor(0);
168
        $this->SetFont('Arial', '', 9);
169
 
170
        $this->MultiCell(190, 6, utf8_decode(strip_tags($competency['description'])), 0, 'L', false);
171
 
172
        $this->Ln(3);
173
 
174
        $this->SetFillColor(204, 204, 204);
175
        $this->SetDrawColor(0, 0, 0);
176
        $this->SetLineWidth(0);
177
        $this->SetFont('Arial', 'B', 9);
178
 
179
        $behaviors = $competency['behaviors'];
180
 
181
        if (count($behaviors) > 0) {
182
 
183
            $this->Cell(150, 6, utf8_decode('Conductas observables :'), 1, 0, 'L', true);
184
            $this->Cell(16, 6, 'Nivel', 1, 0, 'C', true);
185
            $this->Cell(24, 6, utf8_decode('Evaluación'), 1, 0, 'C', true);
186
            $this->Ln();
187
 
188
            // Body Table
189
            $this->SetFillColor(225, 255, 255);
190
            $this->SetTextColor(0);
191
 
192
 
193
            for ($i = 0; $i < count($behaviors); $i++) {
194
 
195
                $this->SetFont('Arial', '', 8.5);
196
 
197
                $this->Cell(150, 6, utf8_decode($behaviors[$i]['description']), 1, 0, 'L', false);
198
                $this->Cell(16, 6, $behaviors[$i]['level'] == '0' ? 'N/A' : $behaviors[$i]['level'], 1, 0, 'C', false);
199
                $this->Cell(24, 6, '', 1, 0, 'C', false);
200
 
201
                $this->Ln();
202
 
203
                $this->SetFont('Arial', 'B', 9);
204
 
205
                $this->Cell(190, 6, utf8_decode('Comentarios:'), 1, 0, 'L', false);
206
 
207
 
208
                $this->Ln();
209
            }
210
        }
211
 
212
 
213
        $this->Ln();
214
    }
215
 
216
}