'siret,id', 'identite-fichepc' => 'siret,id', 'identite-etablissements' => 'siret,id,actif', 'identite-liens' => 'siret,id', 'identite-groupe' => 'siret', 'identite-evenements' => 'siret,id', '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', 'juridique-annonces' => 'siret,id,idAnn,vue,p', 'juridique-infosreg' => 'siret,id', 'juridique-competences' => 'siret,id,type', 'juridique-marques' => 'siret,id,idObject', 'evaluation-indiscore' => 'siret,id', 'evaluation-indiscore2' => 'siret,id', 'evaluation-indiscore3' => 'siret,id', 'evaluation-scoring' => 'siret,id', 'pieces-bilans' => 'siret,id', 'pieces-actes' => 'siret,id', 'giant-full' => 'Pays,Type,CompanyId', 'giant-compact' => 'Pays,Type,CompanyId', 'giant-creditrecommendation' => 'Pays,Type,CompanyId', 'surveillance-fichier' => 'nomFic,filtre', ); protected $pagePDF = array( 'identite-fiche' => 'siret,id', 'identite-fichepc' => 'siret,id', 'identite-etablissements' => 'siret,id,actif', 'identite-liens' => 'siret,id', 'identite-groupe' => 'siret', 'identite-evenements' => 'siret,id', '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', 'juridique-annonces' => 'siret,id,idAnn,vue,p', 'juridique-infosreg' => 'siret,id', 'juridique-competences' => 'siret,id,type', 'juridique-marques' => 'siret,id,idObject', 'evaluation-indiscore' => 'siret,id', 'evaluation-indiscore2' => 'siret,id', 'evaluation-indiscore3' => 'siret,id', 'evaluation-scoring' => 'siret,id', 'pieces-bilans' => 'siret,id', 'pieces-actes' => 'siret,id', 'giant-full' => 'Pays,Type,CompanyId', 'giant-compact' => 'Pays,Type,CompanyId', 'giant-creditrecommendation' => 'Pays,Type,CompanyId', ); protected $pageXML = array( 'identite-fiche' => 'siret,id', 'identite-fichepc' => 'siret,id', 'identite-etablissements' => 'siret,id,actif', 'identite-liens' => 'siret,id', 'identite-evenements' => 'siret,id', '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', 'juridique-annonces' => 'siret,id,idAnn,vue,p', 'juridique-infosreg' => 'siret,id', 'juridique-competences' => 'siret,id,type', 'juridique-marques' => 'siret,id,idObject', 'evaluation-indiscore' => 'siret,id', 'evaluation-indiscore2' => 'siret,id', 'evaluation-indiscore3' => 'siret,id', ); 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; } public function filename($type, $params = array()) { $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; } 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); $c = Zend_Registry::get('config'); $path = realpath($c->profil->path->files).'/'; file_put_contents($path.$filename.'.xml', $content); } } }