Rev 7061 | Rev 15154 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
<?php
namespace LeadersLinked\Library;
use Fpdf\Fpdf;
class UniqueSurveyReport extends FPDF {
/**
* Header PDF
*/
function Header() {
$this->Image($_SERVER['DOCUMENT_ROOT'] . '/pdf/header_background.png', 10, 8, 190);
$this->Image($_SERVER['DOCUMENT_ROOT'] . '/pdf/header_logo.png', 130, 20, 60);
}
function customHeader($headerFormName) {
$s = utf8_decode(' Página: ' . $this->PageNo());
$this->SetFont('Arial', '', 10);
$this->SetY(40);
$this->Cell(190, 10, $s, 0, 0, 'R');
$this->SetFont('Arial', 'B', 15);
$this->SetY(50);
$this->Cell(180, 10, $headerFormName, 0, 0, 'C');
$this->setY($this->getY() + 8);
$this->SetFont('Arial', '', 10);
$this->setY($this->getY() + 10);
}
/**
* Footer PDF
*/
function Footer() {
$this->SetY(-30);
$this->Image($_SERVER['DOCUMENT_ROOT'] . '/pdf/footer_background.jpg', 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, utf8_decode(' Escala/Niveles:'), 1, 0, 'L', false);
$this->SetFillColor(225, 255, 255);
$this->SetTextColor(0);
$this->SetFont('Arial', '', 9);
$this->Cell(155, 8, 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, 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, utf8_decode($rs['title']), 1, 0, 'L', false);
$this->MultiCell(140, 10, utf8_decode($rs['content']), 1, 'L', false);
$this->Ln();
} else {
$this->SetFont('Arial', '', 9);
$this->MultiCell(190, 6, utf8_decode($rs['content']), 1, 'L', false);
}
}
$this->Ln(5);
}
/**
* 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, utf8_decode($title), 1, 0, 'L', true);
$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, 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, utf8_decode($rs['title']), 0, 0, 'L', false);
$this->Cell(150, 6, utf8_decode($rs['content']), 0, 'L', false);
$this->Ln();
} else {
if ($rs['content'] != "") {
$this->MultiCell(190, 6, utf8_decode($rs['content']), 0, 'L', false);
}
}
}
$this->Ln(5);
}
function optionTable($questionText, $options) {
// Header Table
$this->SetFillColor(255, 255, 255);
$this->SetDrawColor(0, 0, 0);
$this->SetLineWidth(0);
$this->SetFont('Arial', 'B', 9);
$this->MultiCell(190, 5, utf8_decode($questionText), 0, 'L', false);
// Body Table
$this->SetFillColor(204, 204, 204);
$this->SetDrawColor(0, 0, 0);
$this->SetLineWidth(0);
$this->SetFont('Arial', 'B', 9);
if (count($options)>0) {
$this->Cell(182, 6, utf8_decode('Opcion :'), 1, 0, 'L', true);
$this->Cell(8, 6, 'Sel.', 1, 0, 'C', true);
$this->Ln();
// Body Table
$this->SetFillColor(225, 255, 255);
$this->SetTextColor(0);
$this->SetFont('Arial', '', 9);
for ($i = 0; $i < count($options); $i++) {
$this->Cell(182, 6, utf8_decode($options[$i]['text']), 1, 0, 'L', false);
$this->Cell(8, 6, $options[$i]['selected'] ? 'X' : '', 1, 0, 'C', false);
$this->Ln();
}
}
$this->Ln();
}
}