2011-04-29 09:49:05 +02:00
|
|
|
<?php
|
|
|
|
class PagePrint
|
|
|
|
{
|
|
|
|
protected $controller = null;
|
|
|
|
protected $action = null;
|
|
|
|
|
|
|
|
protected $pagePRINT = array(
|
|
|
|
'identite-fiche' => 'siret,id',
|
2011-07-13 12:06:39 +02:00
|
|
|
'identite-fichepc' => 'siret,id',
|
2011-05-25 11:24:02 +02:00
|
|
|
'identite-etablissements' => 'siret,id,actif',
|
|
|
|
'identite-liens' => 'siret,id',
|
2012-03-29 15:43:16 +02:00
|
|
|
'identite-groupe' => 'siret',
|
2011-05-25 11:24:02 +02:00
|
|
|
'identite-evenements' => 'siret,id',
|
2011-07-13 12:06:39 +02:00
|
|
|
'dirigeant-liste' => 'siret,id',
|
|
|
|
'dirigeant-histo' => 'siret,id',
|
|
|
|
'finance-synthese' => 'siret,id,typeBilan',
|
|
|
|
'finance-bilan' => 'siret,id,typeBilan',
|
|
|
|
'finance-ratios' => 'siret,id,typeBilan,mil',
|
|
|
|
'finance-liasse' => 'siret,id,unit,date',
|
|
|
|
'finance-bourse' => 'siret,id',
|
|
|
|
'finance-banque' => 'siret,id',
|
2012-06-21 17:08:17 +02:00
|
|
|
'juridique-annonces' => 'siret,id,idAnn,vue,p',
|
2011-07-13 12:06:39 +02:00
|
|
|
'juridique-infosreg' => 'siret,id',
|
|
|
|
'juridique-competences' => 'siret,id,type',
|
|
|
|
'juridique-marques' => 'siret,id,idObject',
|
2011-08-12 10:50:10 +02:00
|
|
|
'evaluation-indiscore' => 'siret,id',
|
|
|
|
'evaluation-indiscore2' => 'siret,id',
|
|
|
|
'evaluation-indiscore3' => 'siret,id',
|
|
|
|
'evaluation-scoring' => 'siret,id',
|
2011-09-06 10:18:33 +02:00
|
|
|
'pieces-bilans' => 'siret,id',
|
|
|
|
'pieces-actes' => 'siret,id',
|
2011-09-05 16:31:19 +02:00
|
|
|
'giant-full' => 'Pays,Type,CompanyId',
|
2011-09-06 14:40:31 +02:00
|
|
|
'giant-compact' => 'Pays,Type,CompanyId',
|
|
|
|
'giant-creditrecommendation' => 'Pays,Type,CompanyId',
|
2012-02-02 11:09:29 +01:00
|
|
|
'surveillance-fichier' => 'nomFic,filtre',
|
2011-04-29 09:49:05 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
protected $pagePDF = array(
|
|
|
|
'identite-fiche' => 'siret,id',
|
2011-07-13 12:06:39 +02:00
|
|
|
'identite-fichepc' => 'siret,id',
|
2011-05-25 11:24:02 +02:00
|
|
|
'identite-etablissements' => 'siret,id,actif',
|
|
|
|
'identite-liens' => 'siret,id',
|
2012-03-29 15:43:16 +02:00
|
|
|
'identite-groupe' => 'siret',
|
2011-05-25 11:24:02 +02:00
|
|
|
'identite-evenements' => 'siret,id',
|
2011-07-13 12:06:39 +02:00
|
|
|
'dirigeant-liste' => 'siret,id',
|
|
|
|
'dirigeant-histo' => 'siret,id',
|
|
|
|
'finance-synthese' => 'siret,id,typeBilan',
|
|
|
|
'finance-bilan' => 'siret,id,typeBilan',
|
|
|
|
'finance-ratios' => 'siret,id,typeBilan,mil',
|
|
|
|
'finance-liasse' => 'siret,id,unit,date',
|
|
|
|
'finance-bourse' => 'siret,id',
|
|
|
|
'finance-banque' => 'siret,id',
|
2012-06-21 17:08:17 +02:00
|
|
|
'juridique-annonces' => 'siret,id,idAnn,vue,p',
|
2011-07-13 12:06:39 +02:00
|
|
|
'juridique-infosreg' => 'siret,id',
|
|
|
|
'juridique-competences' => 'siret,id,type',
|
|
|
|
'juridique-marques' => 'siret,id,idObject',
|
2011-08-12 10:50:10 +02:00
|
|
|
'evaluation-indiscore' => 'siret,id',
|
|
|
|
'evaluation-indiscore2' => 'siret,id',
|
|
|
|
'evaluation-indiscore3' => 'siret,id',
|
|
|
|
'evaluation-scoring' => 'siret,id',
|
2011-09-06 10:18:33 +02:00
|
|
|
'pieces-bilans' => 'siret,id',
|
|
|
|
'pieces-actes' => 'siret,id',
|
2011-09-05 16:31:19 +02:00
|
|
|
'giant-full' => 'Pays,Type,CompanyId',
|
2011-09-06 14:40:31 +02:00
|
|
|
'giant-compact' => 'Pays,Type,CompanyId',
|
|
|
|
'giant-creditrecommendation' => 'Pays,Type,CompanyId',
|
2011-04-29 09:49:05 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
protected $pageXML = array(
|
|
|
|
'identite-fiche' => 'siret,id',
|
2011-07-13 12:06:39 +02:00
|
|
|
'identite-fichepc' => 'siret,id',
|
2011-05-25 11:24:02 +02:00
|
|
|
'identite-etablissements' => 'siret,id,actif',
|
|
|
|
'identite-liens' => 'siret,id',
|
|
|
|
'identite-evenements' => 'siret,id',
|
2011-07-13 12:06:39 +02:00
|
|
|
'dirigeant-liste' => 'siret,id',
|
|
|
|
'dirigeant-histo' => 'siret,id',
|
|
|
|
'finance-synthese' => 'siret,id,typeBilan',
|
|
|
|
'finance-bilan' => 'siret,id,typeBilan',
|
|
|
|
'finance-ratios' => 'siret,id,typeBilan,mil',
|
|
|
|
'finance-liasse' => 'siret,id,unit,date',
|
|
|
|
'finance-bourse' => 'siret,id',
|
|
|
|
'finance-banque' => 'siret,id',
|
2012-06-21 17:08:17 +02:00
|
|
|
'juridique-annonces' => 'siret,id,idAnn,vue,p',
|
2011-07-13 12:06:39 +02:00
|
|
|
'juridique-infosreg' => 'siret,id',
|
|
|
|
'juridique-competences' => 'siret,id,type',
|
|
|
|
'juridique-marques' => 'siret,id,idObject',
|
2011-08-12 10:50:10 +02:00
|
|
|
'evaluation-indiscore' => 'siret,id',
|
|
|
|
'evaluation-indiscore2' => 'siret,id',
|
|
|
|
'evaluation-indiscore3' => 'siret,id',
|
2011-04-29 09:49:05 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
public function __construct($controller, $action)
|
|
|
|
{
|
|
|
|
$this->controller = $controller;
|
|
|
|
$this->action = $action;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getTypeElement($type)
|
|
|
|
{
|
|
|
|
$element = array();
|
|
|
|
switch($type){
|
|
|
|
case 'print':
|
|
|
|
$element = $this->pagePRINT;
|
|
|
|
break;
|
|
|
|
case 'pdf':
|
|
|
|
$element = $this->pagePDF;
|
|
|
|
break;
|
|
|
|
case 'xml':
|
|
|
|
$element = $this->pageXML;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return $element;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function exportable($type)
|
|
|
|
{
|
|
|
|
$element = $this->getTypeElement($type);
|
|
|
|
if (array_key_exists($this->controller.'-'.$this->action, $element)){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-05-24 08:25:58 +02:00
|
|
|
public function filename($type, $params = array())
|
2011-04-29 09:49:05 +02:00
|
|
|
{
|
|
|
|
$element = $this->getTypeElement($type);
|
|
|
|
$filename = $this->controller.'-'.$this->action;
|
|
|
|
$key = $this->controller.'-'.$this->action;
|
|
|
|
if (array_key_exists($key, $element)){
|
|
|
|
$part = explode(',', $element[$key]);
|
|
|
|
foreach( $part as $item ){
|
|
|
|
if (!empty($params[$item])){
|
|
|
|
$filename.= '-'.$params[$item];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $filename;
|
|
|
|
}
|
|
|
|
|
2011-05-24 08:25:58 +02:00
|
|
|
public function objectToXML($object, $params)
|
|
|
|
{
|
|
|
|
require_once 'XML/Serializer.php';
|
|
|
|
$options = array (
|
|
|
|
'addDecl' => TRUE,
|
|
|
|
'encoding' => 'UTF-8',
|
|
|
|
'indent' => ' ',
|
|
|
|
'rootName' => 'root',
|
|
|
|
'defaultTagName' => 'element',
|
|
|
|
);
|
|
|
|
// Instantiate the serializer with the options
|
|
|
|
$Serializer = new XML_Serializer($options);
|
|
|
|
// Serialize the data structure
|
|
|
|
$result = $Serializer->serialize($object);
|
|
|
|
if($result === true) {
|
|
|
|
$content = $Serializer->getSerializedData();
|
|
|
|
$filename = $this->filename('xml', $params);
|
2012-11-05 16:33:01 +01:00
|
|
|
$c = Zend_Registry::get('config');
|
2012-11-16 15:12:03 +01:00
|
|
|
$path = realpath($c->profil->path->files).'/';
|
2012-11-05 16:33:01 +01:00
|
|
|
file_put_contents($path.$filename.'.xml', $content);
|
2011-05-24 08:25:58 +02:00
|
|
|
}
|
|
|
|
}
|
2011-04-29 09:49:05 +02:00
|
|
|
}
|