extranet/application/controllers/PrintController.php

62 lines
1.3 KiB
PHP

<?php
class PrintController extends Zend_Controller_Action
{
public function init(){}
public function indexAction(){}
public function pdfAction()
{
/*
* Recup controller / action / paramètres
* identite-fiche-siret-id.pdf
*/
$request = $this->getRequest();
$fichier = $request->getParam('fichier');
if (substr($fichier,-4)!='.pdf') {
echo 'Fichier incorrect';
exit;
}
$fichier = str_replace('.pdf', '', $fichier);
$elements = explode('-', $fichier);
$controller = $elements[0];
$action = $elements[1];
switch($controller){
case 'identite':
switch($action){
case 'fiche':
$params['siret'] = $elements[2];
$params['id'] = $elements[3];
break;
}
break;
}
$params['print'] = 'pdf';
// Désactivation affichage
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$content = $this->view->action($action, $controller, null, $params);
}
public function ecranAction()
{
//Affichage + script javascript window.print
/*
* Recup controller / action / paramètres
* identite-fiche-siret-id
*/
$request = $this->getRequest();
$params = $request->getParams();
print_r($params);
exit;
$this->_forward($action, $controller, null, $params);
}
}