Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15152 | Ir a la última revisión | | 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
use LeadersLinked\Model\Competency;
7
use LeadersLinked\Model\CompetencyType;
8
use LeadersLinked\Model\Behavior;
9
 
10
class JobPdf extends FPDF {
11
 
12
    /**
13
     * Header PDF
14
     */
15
    function Header() {
16
 
17
        if ($this->header != '') {
18
            $this->Image($this->header, 10, 8, 190);
19
            $this->SetY(55);
20
        }
21
    }
22
 
23
    /**
24
     * Custom Header PDF
25
     */
26
    function customHeader() {
27
        $this->SetFont('Arial', 'B', 11);
28
        $this->Cell(60, 10, utf8_decode('DESCRIPCIÓN DE CARGOS DE TRABAJO'));
29
        $this->Ln(10);
30
    }
31
 
32
    /**
33
     * Footer PDF
34
     */
35
    function Footer() {
36
        if ($this->footer != '') {
37
            $this->SetY(-40);
38
            $this->Image($this->footer, 10, $this->getY(), 190);
39
        }
40
    }
41
 
42
    /**
43
     * Section Signature
44
     */
45
    function sectionSignature() {
46
 
47
        $this->SetFont('Arial', 'B', 9);
48
        $this->Cell(60, 10, utf8_decode('Elaborado por:'));
49
        $this->Ln(8);
50
        $this->Cell(60, 10, utf8_decode('Firma:'));
51
        $this->Ln(8);
52
        $this->Cell(60, 10, utf8_decode('Fecha:'));
53
        $this->Ln(8);
54
    }
55
 
56
    /**
57
     * Section Scale
58
     */
59
    function sectionScale() {
60
        $this->SetFillColor(225, 255, 255);
61
        $this->SetTextColor(0);
62
        $this->SetFont('Arial', 'B', 9);
63
 
64
 
65
        $this->Cell(35, 8, utf8_decode(' Escala/Niveles:'), 1, 0, 'L', false);
66
 
67
        $this->SetFillColor(225, 255, 255);
68
        $this->SetTextColor(0);
69
        $this->SetFont('Arial', '', 9);
70
 
71
        $this->Cell(155, 8, utf8_decode(' 1: Mínimo  2: Medio  3: Medio-Alto  4: Alto  N/A: No aplica
72
'), 1, 'L', false);
73
        $this->Ln(15);
74
    }
75
 
76
    /**
77
     * Create Table
78
     * @param string $title
79
     * @param array $content
80
     */
81
    function borderTable($title, $content) {
82
 
83
        // Header Table
84
        $this->SetFillColor(204, 204, 204);
85
        $this->SetDrawColor(0, 0, 0);
86
        $this->SetLineWidth(0);
87
        $this->SetFont('Arial', 'B', 9);
88
 
89
        $this->Cell(190, 6, utf8_decode($title), 1, 0, 'L', true);
90
        $this->Ln();
91
 
92
        // Body Table
93
        $this->SetFillColor(225, 255, 255);
94
        $this->SetTextColor(0);
95
 
96
        foreach ($content as $rs) {
97
            if (isset($rs['title'])) {
98
 
99
                $this->SetFont('Arial', 'B', 9);
100
 
101
                $this->Cell(40, 10, utf8_decode($rs['title']), 1, 0, 'L', false);
102
                $this->Cell(150, 10, utf8_decode($rs['content']), 1, 'L', false);
103
                $this->Ln();
104
            } else {
105
 
106
                $this->SetFont('Arial', '', 9);
107
                $this->MultiCell(190, 6, utf8_decode($rs['content']), 1, 'L', false);
108
            }
109
        }
110
        $this->Ln(5);
111
    }
112
 
113
    /**
114
     * Create Table
115
     * @param string $title
116
     * @param array $content
117
     */
118
    function singleTable($title, $content) {
119
 
120
        // Header Table
121
        $this->SetFillColor(255, 255, 255);
122
        $this->SetDrawColor(0, 0, 0);
123
        $this->SetLineWidth(0);
124
        $this->SetFont('Arial', 'B', 9);
125
 
126
        $this->Cell(190, 6, utf8_decode($title), 0, 0, 'L', true);
127
        $this->Ln();
128
 
129
        // Body Table
130
        $this->SetFillColor(225, 255, 255);
131
        $this->SetTextColor(0);
132
        $this->SetFont('Arial', '', 9);
133
 
134
        foreach ($content as $rs) {
135
            if (isset($rs['title'])) {
136
                $this->Cell(40, 6, utf8_decode($rs['title']), 0, 0, 'L', false);
137
                $this->Cell(150, 6, utf8_decode($rs['content']), 0, 'L', false);
138
                $this->Ln();
139
            } else {
140
                $this->MultiCell(190, 6, utf8_decode($rs['content']), 0, 'L', false);
141
            }
142
        }
143
        $this->Ln(5);
144
    }
145
 
146
    /**
147
     * Create Competency Table
148
     * @param string $index
149
     * @param CompetencyType $competenceType
150
     * @param Competency $competency
151
     * @param Behavior[] $behaviors
152
     */
153
    function competencyTable($index, $competenceType, $competency, $behaviors) {
154
 
155
 
156
        // Header Table
157
        $this->SetFillColor(255, 255, 255);
158
        $this->SetDrawColor(0, 0, 0);
159
        $this->SetLineWidth(0);
160
        $this->SetFont('Arial', 'B', 9);
161
 
162
        $this->MultiCell(190, 5, $index . '- ' . utf8_decode($competenceType->name) . ': ' . utf8_decode($competency->name), 0, 'L', false);
163
 
164
 
165
 
166
        // Body Table
167
        $this->SetFillColor(225, 255, 255);
168
        $this->SetTextColor(0);
169
        $this->SetFont('Arial', '', 9);
170
 
171
        $this->MultiCell(190, 6, utf8_decode(strip_tags($competency->description)), 0, 'L', false);
172
 
173
        $this->Ln(3);
174
 
175
        $this->SetFillColor(204, 204, 204);
176
        $this->SetDrawColor(0, 0, 0);
177
        $this->SetLineWidth(0);
178
        $this->SetFont('Arial', 'B', 9);
179
 
180
        if (count($behaviors)>0) {
181
 
182
            $this->Cell(150, 6, utf8_decode('Conductas observables :'), 1, 0, 'L', true);
183
            $this->Cell(8, 6, '1', 1, 0, 'C', true);
184
            $this->Cell(8, 6, '2', 1, 0, 'C', true);
185
            $this->Cell(8, 6, '3', 1, 0, 'C', true);
186
            $this->Cell(8, 6, '4', 1, 0, 'C', true);
187
            $this->Cell(8, 6, 'N/A', 1, 0, 'C', true);
188
            $this->Ln();
189
 
190
            // Body Table
191
            $this->SetFillColor(225, 255, 255);
192
            $this->SetTextColor(0);
193
            $this->SetFont('Arial', '', 9);
194
 
195
            for ($i = 0; $i < count($behaviors); $i++) {
196
 
197
                $this->Cell(150, 6, utf8_decode($behaviors[$i]['description']), 1, 0, 'L', false);
198
                $this->Cell(8, 6, $behaviors[$i]['level'] == '1' ? 'X' : '', 1, 0, 'C', false);
199
                $this->Cell(8, 6, $behaviors[$i]['level'] == '2' ? 'X' : '', 1, 0, 'C', false);
200
                $this->Cell(8, 6, $behaviors[$i]['level'] == '3' ? 'X' : '', 1, 0, 'C', false);
201
                $this->Cell(8, 6, $behaviors[$i]['level'] == '4' ? 'X' : '', 1, 0, 'C', false);
202
                $this->Cell(8, 6, $behaviors[$i]['level'] == '0' ? 'X' : '', 1, 0, 'C', false);
203
 
204
                $this->Ln();
205
            }
206
        }
207
 
208
 
209
        $this->Ln();
210
    }
211
 
212
}