2011-04-29 07:49:05 +00:00
|
|
|
<?php
|
2013-11-29 13:54:52 +00:00
|
|
|
class Scores_Export_Print
|
2011-04-29 07:49:05 +00:00
|
|
|
{
|
|
|
|
protected $controller = null;
|
|
|
|
protected $action = null;
|
2013-09-16 15:41:31 +00:00
|
|
|
|
2011-04-29 07:49:05 +00:00
|
|
|
protected $pagePRINT = array(
|
|
|
|
'identite-fiche' => 'siret,id',
|
2011-07-13 10:06:39 +00:00
|
|
|
'identite-fichepc' => 'siret,id',
|
2011-05-25 09:24:02 +00:00
|
|
|
'identite-etablissements' => 'siret,id,actif',
|
|
|
|
'identite-liens' => 'siret,id',
|
2012-03-29 13:43:16 +00:00
|
|
|
'identite-groupe' => 'siret',
|
2011-05-25 09:24:02 +00:00
|
|
|
'identite-evenements' => 'siret,id',
|
2011-07-13 10:06:39 +00: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 15:08:17 +00:00
|
|
|
'juridique-annonces' => 'siret,id,idAnn,vue,p',
|
2011-07-13 10:06:39 +00:00
|
|
|
'juridique-infosreg' => 'siret,id',
|
|
|
|
'juridique-competences' => 'siret,id,type',
|
|
|
|
'juridique-marques' => 'siret,id,idObject',
|
2011-08-12 08:50:10 +00:00
|
|
|
'evaluation-indiscore' => 'siret,id',
|
|
|
|
'evaluation-indiscore2' => 'siret,id',
|
|
|
|
'evaluation-indiscore3' => 'siret,id',
|
|
|
|
'evaluation-scoring' => 'siret,id',
|
2013-09-16 15:41:31 +00:00
|
|
|
'evaluation-valorisation' => 'siret,id',
|
2011-09-06 08:18:33 +00:00
|
|
|
'pieces-bilans' => 'siret,id',
|
|
|
|
'pieces-actes' => 'siret,id',
|
2013-10-23 14:20:56 +00:00
|
|
|
'giant-full' => 'Pays,Type,CompanyId,Language',
|
|
|
|
'giant-compact' => 'Pays,Type,CompanyId,Language',
|
|
|
|
'giant-creditrecommendation' => 'Pays,Type,CompanyId,Language',
|
2012-02-02 10:09:29 +00:00
|
|
|
'surveillance-fichier' => 'nomFic,filtre',
|
2013-10-04 12:41:24 +00:00
|
|
|
'worldcheck-matchcontent' => 'matchIdentifier',
|
2011-04-29 07:49:05 +00:00
|
|
|
);
|
2013-09-16 15:41:31 +00:00
|
|
|
|
2011-04-29 07:49:05 +00:00
|
|
|
protected $pagePDF = array(
|
|
|
|
'identite-fiche' => 'siret,id',
|
2011-07-13 10:06:39 +00:00
|
|
|
'identite-fichepc' => 'siret,id',
|
2011-05-25 09:24:02 +00:00
|
|
|
'identite-etablissements' => 'siret,id,actif',
|
|
|
|
'identite-liens' => 'siret,id',
|
2012-03-29 13:43:16 +00:00
|
|
|
'identite-groupe' => 'siret',
|
2011-05-25 09:24:02 +00:00
|
|
|
'identite-evenements' => 'siret,id',
|
2011-07-13 10:06:39 +00: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 15:08:17 +00:00
|
|
|
'juridique-annonces' => 'siret,id,idAnn,vue,p',
|
2011-07-13 10:06:39 +00:00
|
|
|
'juridique-infosreg' => 'siret,id',
|
|
|
|
'juridique-competences' => 'siret,id,type',
|
|
|
|
'juridique-marques' => 'siret,id,idObject',
|
2011-08-12 08:50:10 +00:00
|
|
|
'evaluation-indiscore' => 'siret,id',
|
|
|
|
'evaluation-indiscore2' => 'siret,id',
|
|
|
|
'evaluation-indiscore3' => 'siret,id',
|
|
|
|
'evaluation-scoring' => 'siret,id',
|
2013-09-16 15:41:31 +00:00
|
|
|
'evaluation-valorisation' => 'siret,id',
|
2011-09-06 08:18:33 +00:00
|
|
|
'pieces-bilans' => 'siret,id',
|
|
|
|
'pieces-actes' => 'siret,id',
|
2013-10-23 14:20:56 +00:00
|
|
|
'giant-full' => 'Pays,Type,CompanyId,Language',
|
|
|
|
'giant-compact' => 'Pays,Type,CompanyId,Language',
|
|
|
|
'giant-creditrecommendation' => 'Pays,Type,CompanyId,Language',
|
2013-10-04 12:41:24 +00:00
|
|
|
'worldcheck-matchcontent' => 'matchIdentifier',
|
2011-04-29 07:49:05 +00:00
|
|
|
);
|
2013-09-16 15:41:31 +00:00
|
|
|
|
2011-04-29 07:49:05 +00:00
|
|
|
protected $pageXML = array(
|
|
|
|
'identite-fiche' => 'siret,id',
|
2011-07-13 10:06:39 +00:00
|
|
|
'identite-fichepc' => 'siret,id',
|
2011-05-25 09:24:02 +00:00
|
|
|
'identite-etablissements' => 'siret,id,actif',
|
|
|
|
'identite-liens' => 'siret,id',
|
|
|
|
'identite-evenements' => 'siret,id',
|
2011-07-13 10:06:39 +00: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 15:08:17 +00:00
|
|
|
'juridique-annonces' => 'siret,id,idAnn,vue,p',
|
2011-07-13 10:06:39 +00:00
|
|
|
'juridique-infosreg' => 'siret,id',
|
|
|
|
'juridique-competences' => 'siret,id,type',
|
|
|
|
'juridique-marques' => 'siret,id,idObject',
|
2011-08-12 08:50:10 +00:00
|
|
|
'evaluation-indiscore' => 'siret,id',
|
|
|
|
'evaluation-indiscore2' => 'siret,id',
|
|
|
|
'evaluation-indiscore3' => 'siret,id',
|
2013-09-16 15:41:31 +00:00
|
|
|
'evaluation-valorisation' => 'siret,id',
|
2013-10-23 14:20:56 +00:00
|
|
|
'giant-full' => 'Pays,Type,CompanyId,Language',
|
|
|
|
'giant-compact' => 'Pays,Type,CompanyId,Language',
|
|
|
|
'giant-creditrecommendation' => 'Pays,Type,CompanyId,Language',
|
2013-10-04 12:41:24 +00:00
|
|
|
'worldcheck-matchcontent' => 'matchIdentifier',
|
2011-04-29 07:49:05 +00:00
|
|
|
);
|
2013-09-16 15:41:31 +00:00
|
|
|
|
2011-04-29 07:49:05 +00:00
|
|
|
public function __construct($controller, $action)
|
|
|
|
{
|
|
|
|
$this->controller = $controller;
|
|
|
|
$this->action = $action;
|
|
|
|
}
|
2013-09-16 15:41:31 +00:00
|
|
|
|
2011-04-29 07:49:05 +00:00
|
|
|
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;
|
|
|
|
}
|
2013-09-16 15:41:31 +00:00
|
|
|
|
2011-04-29 07:49:05 +00:00
|
|
|
public function exportable($type)
|
|
|
|
{
|
|
|
|
$element = $this->getTypeElement($type);
|
|
|
|
if (array_key_exists($this->controller.'-'.$this->action, $element)){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2013-09-16 15:41:31 +00:00
|
|
|
|
2011-05-24 06:25:58 +00:00
|
|
|
public function filename($type, $params = array())
|
2011-04-29 07:49:05 +00: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;
|
|
|
|
}
|
2013-09-16 15:41:31 +00:00
|
|
|
|
2011-05-24 06:25:58 +00:00
|
|
|
public function objectToXML($object, $params)
|
|
|
|
{
|
2013-10-04 12:41:24 +00:00
|
|
|
$serializer = new Scores_Serializer_Adapter_Xml();
|
|
|
|
try {
|
|
|
|
$content = $serializer->serialize($object);
|
2011-05-24 06:25:58 +00:00
|
|
|
$filename = $this->filename('xml', $params);
|
2012-11-05 15:33:01 +00:00
|
|
|
$c = Zend_Registry::get('config');
|
2012-11-16 14:12:03 +00:00
|
|
|
$path = realpath($c->profil->path->files).'/';
|
2012-11-05 15:33:01 +00:00
|
|
|
file_put_contents($path.$filename.'.xml', $content);
|
2013-10-04 12:41:24 +00:00
|
|
|
} catch (Zend_Serializer_Exception $e) {
|
|
|
|
//Error
|
2011-05-24 06:25:58 +00:00
|
|
|
}
|
|
|
|
}
|
2011-04-29 07:49:05 +00:00
|
|
|
}
|