Analog::log('An error has occured, unable to get members list.', Analog::ERROR); die; } // Set PDF headings $doc_title = _T("Member's Cards"); $doc_subject = _T("Generated by Galette"); $doc_keywords = _T("Cards"); // Get fixed data from preferences // and convert strings to utf-8 for tcpdf $an_cot = '<strong>' . $preferences->pref_card_year . '</strong>'; $abrev = '<strong>' . $preferences->pref_card_abrev . '</strong>'; $print_logo = new Galette\Core\PrintLogo(); if ($logo->hasPicture()) { $logofile = $print_logo->getPath(); // Set logo size to max width 30 mm or max height 25 mm $ratio = $print_logo->getWidth() / $print_logo->getHeight(); if ($ratio < 1) { if ($print_logo->getHeight() > 16) { $hlogo = 25; } else { $hlogo = $print_logo->getHeight(); } $wlogo = round($hlogo * $ratio); } else { if ($print_logo->getWidth() > 16) { $wlogo = 30; } else { $wlogo = $print_logo->getWidth(); } $hlogo = round($wlogo / $ratio); }
/** * Draws PDF page header * * @param string $title Additionnal title to display just after logo * * @return void */ function PageHeader($title = null) { if (isset($this->_model)) { $html = null; if (trim($this->_model->hstyles) !== '') { $html .= "<style>\n" . $this->_model->hstyles . "\n</style>\n\n"; } $html .= $this->_model->hheader; $this->writeHtml($html, true, false, true, false, ''); if (trim($this->_model->title) !== '') { $htitle = ''; if (trim($this->_model->hstyles) !== '') { $htitle .= "<style>\n" . $this->_model->hstyles . "\n</style>\n\n"; } $htitle .= '<div id="pdf_title">' . $this->_model->htitle . '</div>'; $this->writeHtml($htitle); } if (trim($this->_model->subtitle) !== '') { $hsubtitle = ''; if (trim($this->_model->hstyles) !== '') { $hsubtitle .= "<style>\n" . $this->_model->hstyles . "\n</style>\n\n"; } $hsubtitle .= '<div id="pdf_subtitle">' . $this->_model->hsubtitle . '</div>'; $this->writeHtml($hsubtitle); } if (trim($this->_model->title) !== '' || trim($this->_model->subtitle) !== '') { $this->Ln(5); } } else { //default header $print_logo = new \Galette\Core\PrintLogo(); if ($print_logo->hasPicture()) { $logofile = $print_logo->getPath(); // Set logo size to max width 30 mm or max height 25 mm $ratio = $print_logo->getWidth() / $print_logo->getHeight(); if ($ratio < 1) { if ($print_logo->getHeight() > 16) { $hlogo = 25; } else { $hlogo = $print_logo->getHeight(); } $wlogo = round($hlogo * $ratio); } else { if ($print_logo->getWidth() > 16) { $wlogo = 30; } else { $wlogo = $print_logo->getWidth(); } $hlogo = round($wlogo / $ratio); } } $this->SetFont(self::FONT, 'B', self::FONT_SIZE + 4); $this->SetTextColor(0, 0, 0); $y = $this->GetY(); $this->Ln(2); $ystart = $this->GetY(); $this->Cell(0, 6, $this->preferences->pref_nom, 0, 1, 'L', 0, $this->preferences->pref_website); $this->SetFont(self::FONT, 'B', self::FONT_SIZE + 2); if ($title !== null) { $this->Cell(0, 6, $title, 0, 1, 'L', 0); } $yend = $this->getY(); //store position at the end of the text $this->SetY($ystart); $x = 190 - $wlogo; //right align $this->Image($logofile, $x, $this->GetY(), $wlogo, $hlogo); $this->y += $hlogo + 3; //if position after logo is < than position after text, //we have to change y if ($this->getY() < $yend) { $this->setY($yend); } } }