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