Rev 15152 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
<?phpnamespace LeadersLinked\Library;use Fpdf\Fpdf;class UniqueSurveyReport extends FPDF {public $header;public $footer;/*** Header PDF*/function Header() {if ($this->header != '') {$this->Image($this->header, 10, 8, 190);$this->SetY(55);}}function customHeader($headerFormName,$headerUserName) {$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);if($headerUserName) {$this->SetFont('Arial', '', 10);$this->Cell(180, 10, $headerUserName, 0, 0, 'C');$this->setY($this->getY() + 10);}$this->SetFont('Arial', '', 10);$this->setY($this->getY() + 10);}/*** 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, 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();}}