Proyectos de Subversion LeadersLinked - Backend

Rev

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