| Server IP : 54.36.91.62 / Your IP : 216.73.217.112 Web Server : Apache System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : coopiak ( 151928) PHP Version : 8.3.23 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/coopiak/amisdesseniors-fr/lorient/components/com_rsform/views/directory/ |
Upload File : |
<?php
/**
* @package RSForm! Pro
* @copyright (C) 2007-2019 www.rsjoomla.com
* @license GPL, http://www.gnu.org/copyleft/gpl.html
*/
defined('_JEXEC') or die;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\HTML\HTMLHelper;
class RsformViewDirectory extends HtmlView
{
public function display( $tpl = null )
{
$this->app = Factory::getApplication();
$this->params = $this->app->getParams('com_rsform');
$this->template = $this->get('template');
$this->directory = $this->get('directory');
if (!$this->directory->enablepdf)
{
throw new Exception(Text::_('JERROR_ALERTNOAUTHOR'), 500);
}
parent::display($tpl);
// Build the PDF Document string from the document buffer
$contents = ob_get_contents();
ob_end_clean();
$filename = $this->directory->filename;
// Build root without Joomla! folder
if ($folder = Uri::root(true))
{
$site_path = substr(str_replace(DIRECTORY_SEPARATOR, '/', JPATH_SITE), 0, -strlen($folder));
}
else
{
$site_path = str_replace(DIRECTORY_SEPARATOR, '/', JPATH_SITE);
}
// Add own CSS
if ($css_path = realpath($site_path.'/' . HTMLHelper::_('stylesheet', 'com_rsform/directory.css', array('pathOnly' => true, 'relative' => true))))
{
$contents = '<link rel="stylesheet" href="' . $this->escape($css_path) . '" type="text/css"/>' . $contents;
}
// Allow plugins to use their own PDF library
$this->app->triggerEvent('onRsformPdfView', array($contents, $filename));
/*
* Setup external configuration options
*/
define('K_TCPDF_EXTERNAL_CONFIG', true);
define("K_PATH_MAIN", JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/tcpdf');
define("K_PATH_URL", JPATH_BASE);
define("K_PATH_FONTS", K_PATH_MAIN.'/fonts/');
define("K_PATH_CACHE", K_PATH_MAIN."/cache");
define("K_PATH_URL_CACHE", K_PATH_URL."/cache");
define("K_PATH_IMAGES", K_PATH_MAIN."/images");
define("K_BLANK_IMAGE", K_PATH_IMAGES."/_blank.png");
define("K_CELL_HEIGHT_RATIO", 1.25);
define("K_TITLE_MAGNIFICATION", 1.3);
define("K_SMALL_RATIO", 2/3);
define("HEAD_MAGNIFICATION", 1.1);
/*
* Create the pdf document
*/
if (!class_exists('TCPDF'))
{
require_once JPATH_ADMINISTRATOR . '/components/com_rsform/helpers/tcpdf/tcpdf.php';
}
$pdf = new TCPDF();
$pdf->SetMargins(15, 27, 15);
$pdf->SetAutoPageBreak(true, 25);
$pdf->SetHeaderMargin(5);
$pdf->SetFooterMargin(10);
$pdf->setImageScale(4);
$document = Factory::getDocument();
// Set PDF Metadata
$pdf->SetCreator($document->getGenerator());
$pdf->SetTitle($document->getTitle());
$pdf->SetSubject($document->getDescription());
$pdf->SetKeywords($document->getMetaData('keywords'));
// Set PDF Header data
$pdf->setHeaderData('', 0, $document->getTitle(), null);
// Set RTL
$lang = Factory::getLanguage();
$pdf->setRTL($lang->isRTL());
// Set Font
$font = 'freesans';
$pdf->setHeaderFont(array($font, '', 10));
$pdf->setFooterFont(array($font, '', 8));
// Initialize PDF Document
if (is_callable(array($pdf, 'AliasNbPages'))) {
$pdf->AliasNbPages();
}
$pdf->AddPage();
$pdf->WriteHTML($contents, true);
$data = $pdf->Output('', 'S');
// Build the PDF Document string from the document buffer
header('Content-Type: application/pdf; charset=utf-8');
header('Content-disposition: attachment; filename="'.$filename.'"', true);
echo $data;
$this->app->close();
}
}