Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15461 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
15461 efrain 1
<?php
2
 
3
namespace LeadersLinked\Library;
4
 
5
use Fpdf\Fpdf;
6
use Laminas\Mvc\I18n\Translator;
7
use LeadersLinked\Model\Competency;
8
 
9
class RecruitmentSelectionInterviewPDF extends FPDF {
10
 
11
    const MAX_Y_ADD_PAGE = 240;
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
     * Header PDF
33
     */
34
    function Header() {
35
        if ($this->header != '') {
36
            $this->Image($this->header, 10, 1, 190);
37
            $this->SetY(55);
38
        }
39
    }
40
 
41
    /**
42
     * Footer PDF
43
     */
44
    function Footer() {
45
        if ($this->footer != '') {
46
            $this->SetY(-40);
47
            $this->Image($this->footer, 10,$this->getY() , 190);
48
        }
49
    }
50
 
51
    /**
52
     * Section Scale
53
     */
54
    function sectionScale() {
55
        $this->SetFillColor(225, 255, 255);
56
        $this->SetTextColor(0);
57
        $this->SetFont('Arial', 'B', 9);
58
 
59
 
16768 efrain 60
        $this->Cell(35, 8, Functions::utf8_decode(' Escala/Niveles:'), 1, 0, 'L', false);
15461 efrain 61
 
62
        $this->SetFillColor(225, 255, 255);
63
        $this->SetTextColor(0);
64
        $this->SetFont('Arial', '', 9);
65
 
16768 efrain 66
        $this->Cell(155, 8, Functions::utf8_decode(' 1: Mínimo  2: Medio  3: Medio-Alto  4: Alto  N/A: No aplica '), 1, 'L', false);
15461 efrain 67
        $this->Ln(15);
68
    }
69
 
70
    /**
71
     * Create Table
72
     * @param string $title
73
     * @param array $content
74
     */
75
    function borderTable($title, $content) {
76
 
77
        // Header Table
78
        $this->SetFillColor(204, 204, 204);
79
        $this->SetDrawColor(0, 0, 0);
80
        $this->SetLineWidth(0);
81
        $this->SetFont('Arial', 'B', 9);
82
 
16768 efrain 83
        $this->Cell(190, 6, Functions::utf8_decode($title), 1, 0, 'L', true);
15461 efrain 84
        $this->Ln();
85
 
86
        // Body Table
87
        $this->SetFillColor(225, 255, 255);
88
        $this->SetTextColor(0);
89
 
90
        foreach ($content as $rs) {
91
            if (isset($rs['title'])) {
92
 
93
                $this->SetFont('Arial', 'B', 9);
16768 efrain 94
                $this->Cell(50, 10, Functions::utf8_decode($rs['title']), 1, 0, 'L', false);
95
                $this->Cell(140, 10, Functions::utf8_decode($rs['content']), 1, 'L', false);
15461 efrain 96
                $this->Ln();
97
            } else {
98
 
99
                $this->SetFont('Arial', '', 9);
16768 efrain 100
                $this->MultiCell(190, 6, Functions::utf8_decode($rs['content']), 1, 'L', false);
15461 efrain 101
            }
102
 
103
            $y = $this->getY();
104
            if($y >= self::MAX_Y_ADD_PAGE) {
105
                $this->addPage();
106
            }
107
        }
108
        $this->Ln(5);
109
 
110
        $y = $this->getY();
111
        if($y >= self::MAX_Y_ADD_PAGE) {
112
            $this->addPage();
113
        }
114
    }
115
 
116
    /**
117
     * title option table
118
     * @param string $title
119
     */
120
    function titleOptionTable($title) {
121
 
122
        if ($title != '') {
123
            // Body Table
124
            $this->SetFillColor(204, 204, 204);
125
            $this->SetDrawColor(0, 0, 0);
126
            $this->SetLineWidth(0);
127
            $this->SetFont('Arial', 'B', 9);
128
 
16768 efrain 129
            $this->Cell(190, 6, Functions::utf8_decode($title), 1, 0, 'L', true);
15461 efrain 130
            $this->Ln();
131
        }
132
    }
133
 
134
    /**
135
     * Create Section Option Table
136
     * @param string $content
137
     */
138
    function optionTable($title) {
139
 
140
        // Body Table
141
        $this->SetFillColor(225, 255, 255);
142
        $this->SetTextColor(0);
143
        $this->SetFont('Arial', 'B', 9);
16768 efrain 144
        $this->Cell(50, 10, Functions::utf8_decode($title), 1, 0, 'L', false);
15461 efrain 145
        $this->Cell(140, 10, '', 1, 'L', false);
146
        $this->Ln();
147
    }
148
 
149
    /**
150
     * Create Table
151
     * @param string $title
152
     * @param array $content
153
     */
154
    function singleTable($title, $content) {
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
 
16768 efrain 162
        $this->Cell(190, 6, Functions::utf8_decode($title), 0, 0, 'L', true);
15461 efrain 163
        $this->Ln();
164
 
165
        // Body Table
166
        $this->SetFillColor(225, 255, 255);
167
        $this->SetTextColor(0);
168
        $this->SetFont('Arial', '', 9);
169
 
170
        foreach ($content as $rs) {
171
            if (isset($rs['title'])) {
16768 efrain 172
                $this->Cell(40, 6, Functions::utf8_decode($rs['title']), 0, 0, 'L', false);
173
                $this->Cell(150, 6, Functions::utf8_decode($rs['content']), 0, 'L', false);
15461 efrain 174
                $this->Ln();
175
            } else {
176
                if ($rs['content'] != "") {
16768 efrain 177
                    $this->MultiCell(190, 6, Functions::utf8_decode($rs['content']), 0, 'L', false);
15461 efrain 178
                }
179
            }
180
 
181
            $y = $this->getY();
182
            if($y >= self::MAX_Y_ADD_PAGE) {
183
                $this->addPage();
184
            }
185
        }
186
        $this->Ln(5);
187
 
188
        $y = $this->getY();
189
        if($y >= self::MAX_Y_ADD_PAGE) {
190
            $this->addPage();
191
        }
192
    }
193
 
194
    /**
195
     *
196
     * @param string $status
197
     * @param string $comment
198
     * @param int $points
199
     */
200
    function evaluationTable($status, $comment, $points)
201
    {
202
 
203
 
204
        // Header Table
205
        $this->SetFillColor(204, 204, 204);
206
        $this->SetDrawColor(0, 0, 0);
207
        $this->SetLineWidth(0);
208
        $this->SetFont('Arial', 'B', 9);
209
 
16768 efrain 210
        $this->Cell(90, 6, Functions::utf8_decode('Resumen General Final'), 1, 0, 'L', true);
211
        $this->Cell(24, 6, Functions::utf8_decode('Estatus'), 1, 0, 'L', true);
15461 efrain 212
        $this->Cell(36, 6, $status, 1, 0, 'C', true);
213
 
16768 efrain 214
        $this->Cell(24, 6, Functions::utf8_decode('Evaluación'), 1, 0, 'L', true);
15461 efrain 215
        $this->Cell(16, 6, '' . $points, 1, 0, 'C', true);
216
        $this->Ln();
217
        $this->SetFont('Arial', 'B', 9);
16768 efrain 218
        $this->Cell(190, 8, Functions::utf8_decode('Comentario final'), 0, 0, 'L', false);
15461 efrain 219
        $this->Ln();
220
        $this->SetFont('Arial', '', 9);
221
 
16768 efrain 222
        $this->MultiCell(190, 80, Functions::utf8_decode($comment), 1, 'J', false);
15461 efrain 223
 
224
 
225
        /*
16768 efrain 226
        $this->Cell(160, 6, Functions::utf8_decode('Resumen General Final'), 1, 0, 'L', true);
227
        $this->Cell(30, 6, Functions::utf8_decode('Evaluación'), 1, 0, 'C', true);
15461 efrain 228
        $this->Ln();
229
 
230
 
231
 
232
        $this->SetFillColor(225, 255, 255);
233
        $this->SetTextColor(0);
234
        $this->SetFont('Arial', 'B', 9);
235
 
236
 
16768 efrain 237
        $this->Cell(35, 8, Functions::utf8_decode(' Escala/Niveles:'), 1, 0, 'L', false);
15461 efrain 238
 
239
        $this->SetFillColor(225, 255, 255);
240
        $this->SetTextColor(0);
241
        $this->SetFont('Arial', '', 9);
242
 
16768 efrain 243
        $this->Cell(125, 8, Functions::utf8_decode(' 1: Mínimo  2: Medio  3: Medio-Alto  4: Alto  N/A: No aplica '), 1, 'L', false);
244
        $this->Cell(30, 8, Functions::utf8_decode(' N/A '), 1, 0, 'C', false);
15461 efrain 245
        $this->Ln();
246
        $this->SetFont('Arial', 'B', 9);
16768 efrain 247
        $this->Cell(190, 8, Functions::utf8_decode('Comentario final'), 1, 0, 'L', false);
15461 efrain 248
        $this->Ln();
249
        $this->SetFont('Arial', '', 9);
16768 efrain 250
        $this->MultiCell(190, 80, Functions::utf8_decode('   '), 1, 'J', false);
15461 efrain 251
        */
252
 
253
 
254
 
255
    }
256
 
257
    /**
258
     * Create Competency Table
259
     * @param int $index
260
     * @param array $competency_selected
261
     *  @param array $competencies
262
     * @param array $competency_types
263
     * @param array $behaviors
264
     */
265
    function competencyTable($index, $competency_selected, $competencies, $competency_types, $behaviors, $evaluation, $last) {
266
 
267
        /*
268
         uuid] => 64597e43-4a44-416a-9d30-f88cfbf2021a [competency_type_uuid] => dd955db7-3bd4-4408-8ef9-11fea6780a63 [behaviors] => Array ( [0] => stdClass Object ( [uuid] => 9ad8fa37-1290-4182-962a-6e29ef1d6119 [level] => 1 ) [1] => stdClass Object ( [uuid] => aedb8677-93c5-463a-9042-4f75d1fa2b86 [level] => 2 ) [2] => stdClass Object ( [uuid] => 6a8c6427-b51e-4deb-8438-5d24b25b645f [level] => 3 ) [3] => stdClass Object ( [uuid] => d0890a5f-c23e-4ca0-a3ba-ac1b15ce68b3 [level] => 4 ) ) ) stdClass Object ( [26] => stdClass Object ( [id] => 26 [competency_id_default] => [competency_type_id] => 7 [company_id] => 1 [name] => Comunicación [uuid] => 64597e43-4a44-416a-9d30-f88cfbf2021a [description] =>
269
         */
270
 
271
        $competency = [];
272
        foreach($competencies as $competency)
273
        {
274
            if($competency_selected->uuid == $competency->uuid) {
275
                break;
276
            }
277
        }
278
 
279
        foreach($competency_types as $competency_type)
280
        {
281
            if($competency_selected->competency_type_uuid == $competency_type->uuid) {
282
                break;
283
            }
284
        }
285
 
286
 
287
 
288
        // Header Table
289
        $this->SetFillColor(255, 255, 255);
290
        $this->SetDrawColor(0, 0, 0);
291
        $this->SetLineWidth(0);
292
        $this->SetFont('Arial', 'B', 9);
293
 
16768 efrain 294
        $this->MultiCell(190, 5, $index . '- ' . Functions::utf8_decode($competency_type->name) . ': ' . Functions::utf8_decode($competency->name), 0, 'L', false);
15461 efrain 295
 
296
        // Body Table
297
        $this->SetFillColor(225, 255, 255);
298
        $this->SetTextColor(0);
299
        $this->SetFont('Arial', '', 9);
300
 
16768 efrain 301
        $this->MultiCell(190, 6, Functions::utf8_decode(strip_tags($competency->description)), 0, 'L', false);
15461 efrain 302
 
303
        $this->Ln(3);
304
 
305
 
306
        $y = $this->getY();
307
        if( $y >= self::MAX_Y_ADD_PAGE) {
308
            $this->addPage();
309
            $first  = true;
310
        }
311
 
312
        if ($competency_selected->behaviors) {
313
 
314
            $first = true;
315
 
316
 
317
            $max = count($competency_selected->behaviors);
318
            for($i = 0; $i < $max; $i++)
319
            {
320
 
321
 
322
                $competency_behavior = $competency_selected->behaviors[$i];
323
 
324
                $comment = 0;
325
                $points = 0;
326
                foreach($evaluation as $itemEvaluation)
327
                {
328
                    if($itemEvaluation->competency == $competency_selected->uuid
329
                        && $itemEvaluation->behavior == $competency_behavior->uuid) {
330
 
331
                            $comment = $itemEvaluation->comment;
332
                            $points = $itemEvaluation->points;
333
 
334
                        break;
335
                    }
336
                }
337
 
338
 
339
                foreach($behaviors as $behavior)
340
                {
341
                    if($competency_behavior->uuid == $behavior->uuid) {
342
                        break;
343
                    }
344
                }
345
 
346
                if($first) {
347
                    $this->SetFillColor(204, 204, 204);
348
                    $this->SetDrawColor(0, 0, 0);
349
                    $this->SetLineWidth(0);
350
                    $this->SetFont('Arial', 'B', 9);
351
 
16768 efrain 352
                    $this->Cell(150, 6, Functions::utf8_decode('Conductas observables :'), 1, 0, 'L', true);
15461 efrain 353
                    $this->Cell(16, 6, 'Nivel', 1, 0, 'C', true);
16768 efrain 354
                    $this->Cell(24, 6, Functions::utf8_decode('Evaluación'), 1, 0, 'C', true);
15461 efrain 355
                    $this->Ln();
356
 
357
                    // Body Table
358
                    $this->SetFillColor(225, 255, 255);
359
                    $this->SetTextColor(0);
360
                    $first = false;
361
                }
362
 
363
 
364
                $this->SetFont('Arial', '', 8.5);
365
 
16768 efrain 366
                $this->Cell(150, 6, Functions::utf8_decode($behavior->description), 1, 0, 'L', false);
15461 efrain 367
                //$this->Cell(16, 6, $competency_behavior->level == '0' ? 'N/A' : $competency_behavior->level, 1, 0, 'C', false);
368
                $this->Cell(16, 6, $competency_behavior->level, 1, 0, 'C', false);
369
                $this->Cell(24, 6, '' . $points, 1, 0, 'C', false);
370
 
371
                $this->Ln();
372
 
373
                $this->SetFont('Arial', 'B', 9);
374
 
16768 efrain 375
                $this->Cell(190, 6, Functions::utf8_decode('Comentarios: '), 1, 0, 'L', false);
15461 efrain 376
                $this->Ln();
377
 
378
                $this->SetFont('Arial', '', 9);
16768 efrain 379
                $this->Cell(190, 6, Functions::utf8_decode($comment), 1, 0, 'L', false);
15461 efrain 380
                $this->Ln();
381
 
382
 
383
 
384
 
385
                $y = $this->getY();
386
                if( ($y >= self::MAX_Y_ADD_PAGE) && ($max - 1 > $i)) {
387
                    $this->addPage();
388
                    $first  = true;
389
                }
390
            }
391
        }
392
 
393
 
394
        $this->Ln();
395
 
396
        if(!$last) {
397
 
398
            $y = $this->getY();
399
            if($y >= self::MAX_Y_ADD_PAGE) {
400
                $this->addPage();
401
            } else {
402
 
403
            }
404
        }
405
    }
406
 
407
 
408
 
409
 
410
}