Rev 15461 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
<?php
namespace LeadersLinked\Library;
use Fpdf\Fpdf;
use Laminas\Mvc\I18n\Translator;
use LeadersLinked\Model\Competency;
class RecruitmentSelectionInterviewPDF extends FPDF {
const MAX_Y_ADD_PAGE = 240;
/**
*
* @var string
*/
public $header;
/**
*
* @var string
*/
public $footer;
/**
*
* @var Translator
*/
public $translator;
/**
* Header PDF
*/
function Header() {
if ($this->header != '') {
$this->Image($this->header, 10, 1, 190);
$this->SetY(55);
}
}
/**
* Footer PDF
*/
function Footer() {
if ($this->footer != '') {
$this->SetY(-40);
$this->Image($this->footer, 10,$this->getY() , 190);
}
}
/**
* Section Scale
*/
function sectionScale() {
$this->SetFillColor(225, 255, 255);
$this->SetTextColor(0);
$this->SetFont('Arial', 'B', 9);
$this->Cell(35, 8, Functions::utf8_decode(' Escala/Niveles:'), 1, 0, 'L', false);
$this->SetFillColor(225, 255, 255);
$this->SetTextColor(0);
$this->SetFont('Arial', '', 9);
$this->Cell(155, 8, Functions::utf8_decode(' 1: Mínimo 2: Medio 3: Medio-Alto 4: Alto N/A: No aplica '), 1, 'L', false);
$this->Ln(15);
}
/**
* Create Table
* @param string $title
* @param array $content
*/
function borderTable($title, $content) {
// Header Table
$this->SetFillColor(204, 204, 204);
$this->SetDrawColor(0, 0, 0);
$this->SetLineWidth(0);
$this->SetFont('Arial', 'B', 9);
$this->Cell(190, 6, Functions::utf8_decode($title), 1, 0, 'L', true);
$this->Ln();
// Body Table
$this->SetFillColor(225, 255, 255);
$this->SetTextColor(0);
foreach ($content as $rs) {
if (isset($rs['title'])) {
$this->SetFont('Arial', 'B', 9);
$this->Cell(50, 10, Functions::utf8_decode($rs['title']), 1, 0, 'L', false);
$this->Cell(140, 10, Functions::utf8_decode($rs['content']), 1, 'L', false);
$this->Ln();
} else {
$this->SetFont('Arial', '', 9);
$this->MultiCell(190, 6, Functions::utf8_decode($rs['content']), 1, 'L', false);
}
$y = $this->getY();
if($y >= self::MAX_Y_ADD_PAGE) {
$this->addPage();
}
}
$this->Ln(5);
$y = $this->getY();
if($y >= self::MAX_Y_ADD_PAGE) {
$this->addPage();
}
}
/**
* title option table
* @param string $title
*/
function titleOptionTable($title) {
if ($title != '') {
// Body Table
$this->SetFillColor(204, 204, 204);
$this->SetDrawColor(0, 0, 0);
$this->SetLineWidth(0);
$this->SetFont('Arial', 'B', 9);
$this->Cell(190, 6, Functions::utf8_decode($title), 1, 0, 'L', true);
$this->Ln();
}
}
/**
* Create Section Option Table
* @param string $content
*/
function optionTable($title) {
// Body Table
$this->SetFillColor(225, 255, 255);
$this->SetTextColor(0);
$this->SetFont('Arial', 'B', 9);
$this->Cell(50, 10, Functions::utf8_decode($title), 1, 0, 'L', false);
$this->Cell(140, 10, '', 1, 'L', false);
$this->Ln();
}
/**
* Create Table
* @param string $title
* @param array $content
*/
function singleTable($title, $content) {
// Header Table
$this->SetFillColor(255, 255, 255);
$this->SetDrawColor(0, 0, 0);
$this->SetLineWidth(0);
$this->SetFont('Arial', 'B', 9);
$this->Cell(190, 6, Functions::utf8_decode($title), 0, 0, 'L', true);
$this->Ln();
// Body Table
$this->SetFillColor(225, 255, 255);
$this->SetTextColor(0);
$this->SetFont('Arial', '', 9);
foreach ($content as $rs) {
if (isset($rs['title'])) {
$this->Cell(40, 6, Functions::utf8_decode($rs['title']), 0, 0, 'L', false);
$this->Cell(150, 6, Functions::utf8_decode($rs['content']), 0, 'L', false);
$this->Ln();
} else {
if ($rs['content'] != "") {
$this->MultiCell(190, 6, Functions::utf8_decode($rs['content']), 0, 'L', false);
}
}
$y = $this->getY();
if($y >= self::MAX_Y_ADD_PAGE) {
$this->addPage();
}
}
$this->Ln(5);
$y = $this->getY();
if($y >= self::MAX_Y_ADD_PAGE) {
$this->addPage();
}
}
/**
*
* @param string $status
* @param string $comment
* @param int $points
*/
function evaluationTable($status, $comment, $points)
{
// Header Table
$this->SetFillColor(204, 204, 204);
$this->SetDrawColor(0, 0, 0);
$this->SetLineWidth(0);
$this->SetFont('Arial', 'B', 9);
$this->Cell(90, 6, Functions::utf8_decode('Resumen General Final'), 1, 0, 'L', true);
$this->Cell(24, 6, Functions::utf8_decode('Estatus'), 1, 0, 'L', true);
$this->Cell(36, 6, $status, 1, 0, 'C', true);
$this->Cell(24, 6, Functions::utf8_decode('Evaluación'), 1, 0, 'L', true);
$this->Cell(16, 6, '' . $points, 1, 0, 'C', true);
$this->Ln();
$this->SetFont('Arial', 'B', 9);
$this->Cell(190, 8, Functions::utf8_decode('Comentario final'), 0, 0, 'L', false);
$this->Ln();
$this->SetFont('Arial', '', 9);
$this->MultiCell(190, 80, Functions::utf8_decode($comment), 1, 'J', false);
/*
$this->Cell(160, 6, Functions::utf8_decode('Resumen General Final'), 1, 0, 'L', true);
$this->Cell(30, 6, Functions::utf8_decode('Evaluación'), 1, 0, 'C', true);
$this->Ln();
$this->SetFillColor(225, 255, 255);
$this->SetTextColor(0);
$this->SetFont('Arial', 'B', 9);
$this->Cell(35, 8, Functions::utf8_decode(' Escala/Niveles:'), 1, 0, 'L', false);
$this->SetFillColor(225, 255, 255);
$this->SetTextColor(0);
$this->SetFont('Arial', '', 9);
$this->Cell(125, 8, Functions::utf8_decode(' 1: Mínimo 2: Medio 3: Medio-Alto 4: Alto N/A: No aplica '), 1, 'L', false);
$this->Cell(30, 8, Functions::utf8_decode(' N/A '), 1, 0, 'C', false);
$this->Ln();
$this->SetFont('Arial', 'B', 9);
$this->Cell(190, 8, Functions::utf8_decode('Comentario final'), 1, 0, 'L', false);
$this->Ln();
$this->SetFont('Arial', '', 9);
$this->MultiCell(190, 80, Functions::utf8_decode(' '), 1, 'J', false);
*/
}
/**
* Create Competency Table
* @param int $index
* @param array $competency_selected
* @param array $competencies
* @param array $competency_types
* @param array $behaviors
*/
function competencyTable($index, $competency_selected, $competencies, $competency_types, $behaviors, $evaluation, $last) {
/*
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] =>
*/
$competency = [];
foreach($competencies as $competency)
{
if($competency_selected->uuid == $competency->uuid) {
break;
}
}
foreach($competency_types as $competency_type)
{
if($competency_selected->competency_type_uuid == $competency_type->uuid) {
break;
}
}
// Header Table
$this->SetFillColor(255, 255, 255);
$this->SetDrawColor(0, 0, 0);
$this->SetLineWidth(0);
$this->SetFont('Arial', 'B', 9);
$this->MultiCell(190, 5, $index . '- ' . Functions::utf8_decode($competency_type->name) . ': ' . Functions::utf8_decode($competency->name), 0, 'L', false);
// Body Table
$this->SetFillColor(225, 255, 255);
$this->SetTextColor(0);
$this->SetFont('Arial', '', 9);
$this->MultiCell(190, 6, Functions::utf8_decode(strip_tags($competency->description)), 0, 'L', false);
$this->Ln(3);
$y = $this->getY();
if( $y >= self::MAX_Y_ADD_PAGE) {
$this->addPage();
$first = true;
}
if ($competency_selected->behaviors) {
$first = true;
$max = count($competency_selected->behaviors);
for($i = 0; $i < $max; $i++)
{
$competency_behavior = $competency_selected->behaviors[$i];
$comment = 0;
$points = 0;
foreach($evaluation as $itemEvaluation)
{
if($itemEvaluation->competency == $competency_selected->uuid
&& $itemEvaluation->behavior == $competency_behavior->uuid) {
$comment = $itemEvaluation->comment;
$points = $itemEvaluation->points;
break;
}
}
foreach($behaviors as $behavior)
{
if($competency_behavior->uuid == $behavior->uuid) {
break;
}
}
if($first) {
$this->SetFillColor(204, 204, 204);
$this->SetDrawColor(0, 0, 0);
$this->SetLineWidth(0);
$this->SetFont('Arial', 'B', 9);
$this->Cell(150, 6, Functions::utf8_decode('Conductas observables :'), 1, 0, 'L', true);
$this->Cell(16, 6, 'Nivel', 1, 0, 'C', true);
$this->Cell(24, 6, Functions::utf8_decode('Evaluación'), 1, 0, 'C', true);
$this->Ln();
// Body Table
$this->SetFillColor(225, 255, 255);
$this->SetTextColor(0);
$first = false;
}
$this->SetFont('Arial', '', 8.5);
$this->Cell(150, 6, Functions::utf8_decode($behavior->description), 1, 0, 'L', false);
//$this->Cell(16, 6, $competency_behavior->level == '0' ? 'N/A' : $competency_behavior->level, 1, 0, 'C', false);
$this->Cell(16, 6, $competency_behavior->level, 1, 0, 'C', false);
$this->Cell(24, 6, '' . $points, 1, 0, 'C', false);
$this->Ln();
$this->SetFont('Arial', 'B', 9);
$this->Cell(190, 6, Functions::utf8_decode('Comentarios: '), 1, 0, 'L', false);
$this->Ln();
$this->SetFont('Arial', '', 9);
$this->Cell(190, 6, Functions::utf8_decode($comment), 1, 0, 'L', false);
$this->Ln();
$y = $this->getY();
if( ($y >= self::MAX_Y_ADD_PAGE) && ($max - 1 > $i)) {
$this->addPage();
$first = true;
}
}
}
$this->Ln();
if(!$last) {
$y = $this->getY();
if($y >= self::MAX_Y_ADD_PAGE) {
$this->addPage();
} else {
}
}
}
}