Mise à jour complete avec enregistrement html pour les pdf

This commit is contained in:
Michael RICOIS 2011-04-29 07:46:29 +00:00
parent 041db0ff82
commit 8e88313ee0
14 changed files with 137 additions and 13 deletions

View File

@ -8,9 +8,10 @@ appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
autoloaderNamespaces[] = "Application_"
resources.frontController.plugins.Menu = "Application_Controller_Plugin_Menu"
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Auth"
resources.frontController.plugins.Auth = "Application_Controller_Plugin_Cgu"
resources.frontController.plugins.Menu = "Application_Controller_Plugin_Menu"
resources.frontController.plugins.Pdf = "Application_Controller_Plugin_Pdf"
resources.frontController.plugins.Cgu = "Application_Controller_Plugin_Cgu"
resources.layout.layout = "main"
resources.layout.layoutPath = APPLICATION_PATH "/views/default"
resources.view.basePath = APPLICATION_PATH "/views/default"

View File

@ -23,4 +23,4 @@ webservices.interne.options.soap_version = SOAP_1_2
webservices.entreprise.wsdl = "http://webservice.sd.lan/entreprise/v0.2?wsdl-auto"
webservices.entreprise.options.trace = 1
webservices.entreprise.options.soap_version = SOAP_1_2
webservices.entreprise.options.soap_version = SOAP_1_2

View File

@ -9,7 +9,7 @@ class IdentiteController extends Zend_Controller_Action
$request = $this->getRequest();
$this->siret = $request->getParam('siret');
$this->id = $request->getParam('id', 0);
require_once 'Scores/WsScores.php';
require_once 'Scores/Utilisateur.php';
require_once 'Scores/SessionEntreprise.php';
@ -124,8 +124,17 @@ class IdentiteController extends Zend_Controller_Action
);
$dBlock[$item] = $display;
}
require_once 'Scores/Logo.php';
$logo = new Logo($infos->Siren, $infos->Isin);
$logoImg = array(
'label' => 'Logo',
'texte' => $logo->affiche(),
);
Zend_Registry::get('firebug')->info($infos);
$this->view->assign('dBlock', $dBlock);
$this->view->assign('logo', $logoImg);
$this->view->assign('dateDerMaj', $dateDerMaj);
$this->view->assign('datemajTexte', $datemajTexte);
$this->view->assign('raisonSociale', $session->getRaisonSociale());

View File

@ -0,0 +1,62 @@
<?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);
}
}

View File

@ -1,14 +1,25 @@
<?php if ($this->navigation()->menu()->hasPages()) { ?>
<div id="menu">
<div id="logo">
<img src="/themes/default/images/logos/logo_sd.gif" width="200" height="65" />
</div>
<?php
/*
$this->navigation()->menu()->setPartial('scripts/menu.phtml');
echo $this->navigation()->menu()->render();
*/
echo $this->navigation()->menu();
?>
<div class="icones">
<?php if ($this->print) {?>
<a target="_blank" title="Impression" href="/editer/ecran/<?=$this->print.'.html'?>">
<img alt="Impression" src="/themes/default/images/interfaces/printer.png">
</a>
<?php }?>
<?php if ($this->pdf) {?>
<a target="_blank" title="Impression" href="/editer/pdf/<?=$this->pdf.'.pdf'?>">
<img alt="Impression" src="/themes/default/images/interfaces/pdf.png">
</a>
<?php }?>
</div>
</div>
<script>
$('#menu ul.navigation').accordion({
@ -17,4 +28,5 @@ $('#menu ul.navigation').accordion({
collapsible: true,
active: <?php echo $this->menuScript(); ?>
});
</script>
</script>
<?php }?>

View File

@ -0,0 +1 @@
<?php

View File

@ -15,9 +15,7 @@ echo $this->partial('identite/fiche-item.phtml', $this->dBlock['SiretSiege']);
echo $this->partial('identite/fiche-item.phtml', $this->dBlock['TvaNumero']);
echo $this->partial('identite/fiche-item.phtml', $this->dBlock['Isin']);
echo $this->partial('identite/fiche-item.phtml', $this->dBlock['Capitalisation']);
?>
//Logo
<?php
echo $this->partial('identite/fiche-item.phtml', $this->logo);
echo $this->partial('identite/fiche-item.phtml', $this->dBlock['NumRC']);
echo $this->partial('identite/fiche-item.phtml', $this->dBlock['AutreId']);
echo $this->partial('identite/fiche-item.phtml', $this->dBlock['Actif']);

View File

@ -10,12 +10,25 @@ class Application_Controller_Plugin_Menu extends Zend_Controller_Plugin_Abstract
$siret = $request->getParam('siret', null);
$id = $request->getParam('id', null);
$layout = Zend_Layout::getMVCInstance();
if ($layout->isEnabled()) {
if ($layout->isEnabled() && $request->getControllerName()!='print') {
require_once 'Scores/Menu.php';
$computeMenu = new Menu($siret, $id);
$menu = $computeMenu->getMenu();
$view = $layout->getView();
$view->navigation($menu);
//Gestion affichage Lien PDF
require_once 'Scores/PagePrint.php';
$page = new PagePrint($request->getControllerName(), $request->getActionName());
if ($page->exportable('print')){
$view->print = $page->filename('print', $request->getParams());
}
if ($page->exportable('pdf')){
$view->pdf = $page->filename('pdf', $request->getParams());
}
//Gestion affichage Lien XML
}
}
}

View File

@ -0,0 +1,16 @@
<?php
class Application_Controller_Plugin_Pdf extends Zend_Controller_Plugin_Abstract
{
public function dispatchLoopShutdown()
{
require_once 'Scores/PagePrint.php';
$controller = $this->_request->getControllerName();
$action = $this->_request->getActionName();
$page = new PagePrint($controller, $action);
if ($page->exportable('pdf')){
$layout = $this->_response->getBody();
$filename = $page->filename('pdf', $this->_request->getParams());
file_put_contents(APPLICATION_PATH.'/../cache/pages/'.$filename.'.html', $layout);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -97,3 +97,10 @@ table {
border-collapse:separate;
border-spacing:4px;
}
.confidentiel {
border-top:1px solid;
padding-top:5px;
font-style:italic;
font-size:9px;
}

View File

@ -89,3 +89,8 @@ div#menu ul.navigation li a.ui-state-hover,
div#menu ul.navigation li a.ui-state-active {
border: 0;
}
div#menu div.icones {
text-align:center;
margin-top:5px;
}