More compatibility with autoloading
This commit is contained in:
parent
05948d8bcc
commit
f7342f1ffa
@ -462,8 +462,7 @@ class EvaluationController extends Zend_Controller_Action
|
||||
file_put_contents($outfile, $xml);
|
||||
|
||||
//Génération du pdf
|
||||
require_once 'wkhtmltopdf/wkhtmltopdf.php';
|
||||
$wkhtmltopdf = new wkhtmltopdf();
|
||||
$wkhtmltopdf = new Scores_Wkhtml_Pdf();
|
||||
$wkhtmltopdf->setOptions('footer-right', 'Page [page] sur [toPage]');
|
||||
$wkhtmltopdf->setOptions('header-right', date('d/m/Y H:i:s'));
|
||||
$wkhtmltopdf->setOptions('disable-external-links');
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
class PrintController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
|
||||
public function init(){}
|
||||
|
||||
|
||||
/**
|
||||
* Renvoie les paramètres pour l'impression
|
||||
*/
|
||||
@ -94,9 +94,9 @@ class PrintController extends Zend_Controller_Action
|
||||
'params' => $params
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public function indexAction(){}
|
||||
|
||||
|
||||
/**
|
||||
* Imprime la page en PDF
|
||||
* Par défaut, le contenu html a déjà été enregistré..
|
||||
@ -109,13 +109,13 @@ class PrintController extends Zend_Controller_Action
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$fichier = $request->getParam('fichier');
|
||||
|
||||
|
||||
if (substr($fichier,-4)!='.pdf') {
|
||||
echo 'Fichier incorrect';
|
||||
exit;
|
||||
}
|
||||
$fichier = str_replace('.pdf', '', $fichier);
|
||||
|
||||
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = $c->profil->path->pages.'/'.$fichier.'.html';
|
||||
if (!file_exists($file))
|
||||
@ -123,20 +123,19 @@ class PrintController extends Zend_Controller_Action
|
||||
echo 'Fichier introuvable';
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'wkhtmltopdf/wkhtmltopdf.php';
|
||||
$pdf = new wkhtmltopdf();
|
||||
|
||||
$pdf = new Scores_Wkhtml_Pdf();
|
||||
$pdf->setOptions('footer-right', 'Page [page] sur [toPage]');
|
||||
$pdf->setOptions('header-right', date('d/m/Y H:i:s'));
|
||||
$output_file = $pdf->exec($file);
|
||||
|
||||
|
||||
//Envoi au navigateur
|
||||
if(!file_exists($output_file))
|
||||
{
|
||||
echo 'Impossible de générer le fichier PDF';
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$content_type = 'application/pdf';
|
||||
$dest = 'I';
|
||||
switch($dest)
|
||||
@ -172,7 +171,7 @@ class PrintController extends Zend_Controller_Action
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Imprime la page en activant le javascript d'impression
|
||||
* Il faut récupérer le controller et l'action du nom du fichier, ainsi que
|
||||
@ -184,12 +183,12 @@ class PrintController extends Zend_Controller_Action
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$fichier = $request->getParam('fichier', '');
|
||||
|
||||
|
||||
if (substr($fichier,-5)!='.html') {
|
||||
echo 'Fichier incorrect';
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$fichier = str_replace('.html', '', $fichier);
|
||||
$elements = $this->pageParams($fichier);
|
||||
if ($elements===false){
|
||||
@ -199,7 +198,7 @@ class PrintController extends Zend_Controller_Action
|
||||
$this->view->assign('action', $elements['action']);
|
||||
$this->view->assign('params', $elements['params']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Envoi le fichier XML de l'objet sérialiser sur la sortie standard
|
||||
*/
|
||||
@ -209,19 +208,19 @@ class PrintController extends Zend_Controller_Action
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
$request = $this->getRequest();
|
||||
$fichier = $request->getParam('fichier', '');
|
||||
|
||||
|
||||
if (substr($fichier,-4)!='.xml') {
|
||||
echo 'Fichier incorrect.';
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$c = Zend_Registry::get('config');
|
||||
$file = $c->profil->path->files.'/'.$fichier;
|
||||
if (!file_exists($file)){
|
||||
echo "Erreur lors de la génération du fichier.";
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
header("Content-type: application/xml");
|
||||
header("Content-Disposition: attachement; filename=\"$fichier\"");
|
||||
flush();
|
||||
|
@ -1,23 +1,23 @@
|
||||
<?php
|
||||
class DetectMobile
|
||||
class Scores_Mobile_Detect
|
||||
{
|
||||
public function isMobile()
|
||||
{
|
||||
if (isset($_SERVER['HTTP_X_WAP_PROFILE']) || isset($_SERVER['HTTP_PROFILE']))
|
||||
return true;
|
||||
|
||||
|
||||
if (isset ($_SERVER['HTTP_USER_AGENT']))
|
||||
{
|
||||
if (strpos ($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false)
|
||||
return true;
|
||||
|
||||
|
||||
if (strpos ($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (preg_match('#Android|BlackBerry|Cellphone|iPhone|iPod|hiptop|HTC|MIDP-2\.|MMEF20|MOT-V|NetFront|Newt|Nintendo Wii|Nintendo DS|Nitro|Nokia|Opera Mobi|Palm|PlayStation Portable|PSP|portalmmm|SonyEricsson|Symbian|UP.Browser|UP.Link|webOS|Windows CE|WinWAP|YahooSeeker/M1A1-R2D2|LGE VX|Maemo|phone)#', $_SERVER['HTTP_USER_AGENT']))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
class wkhtmltopdf
|
||||
class Scores_Wkhtml_Pdf
|
||||
{
|
||||
protected $wkhtml;
|
||||
|
Loading…
Reference in New Issue
Block a user