_helper->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); } public function indexAction() { $request = $this->getRequest(); print_r($request->getParams()); exit; } /** * Gestion du chargement des logos */ public function logoAction() { $file = $this->getRequest()->getParam('fichier'); $explode = explode('.', $file); switch ($explode[1]) { case 'png' : $content_type = 'image/png'; break; case 'gif' : $content_type = 'image/gif'; break; case 'jpeg': case 'jpg' : $content_type = 'image/jpeg'; break; } $configuration = Zend_Registry::get('configuration'); $path = realpath($configuration->path->data).'/'.$configuration->path->logos; if ( file_exists($path.'/'.$file) ) { header('Content-Transfer-Encoding: none'); header('Content-type: ' . $content_type.''); header('Content-Length: ' . filesize($path.'/'.$file)); header('Content-MD5: ' . base64_encode(md5_file($path.'/'.$file))); header('Content-Disposition: filename="' . basename($path.'/'.$file) . '"'); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); ini_set('zlib.output_compression', '0'); echo file_get_contents($path.'/'.$file); } else { echo 'Impossible de charger le logo.'; } exit; } /** * Gestion du chargement des images du cache */ public function imgcacheAction() { $content_type = 'image/png'; $path = APPLICATION_PATH.'/../cache/pages/imgcache/'; $file = $this->getRequest()->getParam('fichier'); if ( file_exists($path.$file) ) { header('Content-Transfer-Encoding: none'); header('Content-type: ' . $content_type.''); header('Content-Length: ' . filesize($path.$file)); header('Content-MD5: ' . base64_encode(md5_file($path.$file))); header('Content-Disposition: filename="' . basename($path.$file) . '"'); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); ini_set('zlib.output_compression', '0'); echo file_get_contents($path.$file); } else { echo 'Impossible de charger le fichier.'; } } /** * Gestion du chargement des fichiers des marques */ public function marqueAction() { $configuration = Zend_Registry::get('configuration'); $directory = realpath($configuration->path->data).'/'.$configuration->path->marques; $file = $this->getRequest()->getParam('fichier'); //On affiche le fichier en vérifiant qu'il existe if(file_exists($directory.'/'.$file) && filesize($directory.'/'.$file)>0) { //On affiche le fichier header("Pragma: public"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: must-revalidate"); header("Content-type: application/pdf"); header("Content-Disposition: inline; filename=\"$file\""); print file_get_contents($directory.'/'.$file); }else{ echo "Erreur lors de l'affichage du fichier."; } } /** * Gestion des fichiers Actes et Bilans */ public function pdfAction() { $configuration = Zend_Registry::get('configuration'); $directory = realpath($configuration->path->data).'/'.$configuration->path->pdf; $file = $this->getRequest()->getParam('fichier'); $output_file = $directory.'/'.$file; if (file_exists($output_file) && filesize($output_file)>0) { $content_type = 'application/pdf'; header('Content-type: '.$content_type.''); header('Content-Length: '.filesize($output_file)); header('Content-MD5: '.base64_encode(md5_file($output_file))); header('Content-Disposition: inline; filename="'.basename($output_file).'"'); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); ini_set('zlib.output_compression','0'); echo file_get_contents($output_file); } else { echo "Erreur lors de l'affichage du fichier."; } } /** * Gestion des liasses au formats excel */ public function liasseAction() { $file = $this->getRequest()->getParam('fichier'); $content_type = 'application/vnd.ms-excel'; $path = APPLICATION_PATH.'/../cache/liasse/'; //Envoi du fichier sur la sortie standard if ( file_exists($path.$file) ) { header('Content-Transfer-Encoding: none'); header('Content-type: ' . $content_type.''); header('Content-Length: ' . filesize($path.$file)); header('Content-MD5: ' . base64_encode(md5_file($path.$file))); header('Content-Disposition: filename="' . basename($path.$file) . '"'); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); ini_set('zlib.output_compression', '0'); echo file_get_contents($path.$file); } else { echo 'Impossible de charger le fichier.'; } } /** * Gestion des log de consommation */ public function consommationAction() { $file = $this->getRequest()->getParam('fichier'); $content_type = 'application/csv-tab-delimited-table'; $path = APPLICATION_PATH.'/../cache/consommation/'; //Envoi du fichier sur la sortie standard if ( file_exists($path.$file) ) { header('Content-Transfer-Encoding: none'); header('Content-type: ' . $content_type.''); header('Content-Length: ' . filesize($path.$file)); header('Content-MD5: ' . base64_encode(md5_file($path.$file))); header('Content-Disposition: filename="' . basename($path.$file) . '"'); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); ini_set('zlib.output_compression', '0'); echo file_get_contents($path.$file); } else { echo 'Impossible de charger le fichier.'; } } /** * Export du portefeuille au format CSV */ public function portefeuilleAction() { $file = $this->getRequest()->getParam('fichier'); $content_type = 'application/csv-tab-delimited-table'; $path = APPLICATION_PATH.'/../cache/surveillance/'; //Envoi du fichier sur la sortie standard if ( file_exists($path.$file) ) { header('Content-Transfer-Encoding: none'); header('Content-type: ' . $content_type.''); header('Content-Length: ' . filesize($path.$file)); header('Content-MD5: ' . base64_encode(md5_file($path.$file))); header('Content-Disposition: filename="' . basename($path.$file) . '"'); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); ini_set('zlib.output_compression', '0'); echo file_get_contents($path.$file); } else { echo 'Impossible de charger le fichier.'; } } /** * Export de la liste des surveillances au format CSV */ public function surveillanceAction() { $file = $this->getRequest()->getParam('fichier'); $content_type = 'application/csv-tab-delimited-table'; $path = APPLICATION_PATH.'/../cache/surveillance/'; //Envoi du fichier sur la sortie standard if ( file_exists($path.$file) ) { header('Content-Transfer-Encoding: none'); header('Content-type: ' . $content_type.''); header('Content-Length: ' . filesize($path.$file)); header('Content-MD5: ' . base64_encode(md5_file($path.$file))); header('Content-Disposition: filename="' . basename($path.$file) . '"'); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); ini_set('zlib.output_compression', '0'); echo file_get_contents($path.$file); } else { echo 'Impossible de charger le fichier.'; } } /** * Gestion des fichiers bilan saisie par les clients */ public function bilanclientAction() { $configuration = Zend_Registry::get('configuration'); $directory = realpath($configuration->path->data).'/bilanclient'; $file = $this->getRequest()->getParam('fichier'); $output_file = $directory.'/'.$file; if (file_exists($output_file) && filesize($output_file)>0) { $explode = explode('.', $output_file); switch ($explode[1]) { case 'pdf' : $content_type = 'application/pdf'; break; case 'tiff' : $content_type = 'image/tiff'; break; } header('Content-type: '.$content_type.''); header('Content-Length: '.filesize($output_file)); header('Content-MD5: '.base64_encode(md5_file($output_file))); header('Content-Disposition: inline; filename="'.basename($output_file).'"'); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); ini_set('zlib.output_compression','0'); echo file_get_contents($output_file); } else { echo "Erreur lors de l'affichage du fichier."; } } /** * Gestion des kbis */ public function kbisAction() { $directory = realpath(APPLICATION_PATH . '/../cache/kbis/'); $file = $this->getRequest()->getParam('fichier'); $output_file = $directory.'/'.$file; if (file_exists($output_file) && filesize($output_file)>0) { $content_type = 'application/pdf'; header('Content-type: '.$content_type.''); header('Content-Length: '.filesize($output_file)); header('Content-MD5: '.base64_encode(md5_file($output_file))); header('Content-Disposition: inline; filename="'.basename($output_file).'"'); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); ini_set('zlib.output_compression','0'); echo file_get_contents($output_file); } else { echo "Erreur lors de l'affichage du fichier."; } } /** * Gestion des rapports personnalisés */ public function customrapportAction() { $directory = realpath(APPLICATION_PATH . '/../cache/pages/'); $file = $this->getRequest()->getParam('fichier'); $output_file = $directory.'/'.$file; if (file_exists($output_file) && filesize($output_file)>0) { $content_type = 'application/pdf'; header('Content-type: '.$content_type.''); header('Content-Length: '.filesize($output_file)); header('Content-MD5: '.base64_encode(md5_file($output_file))); header('Content-Disposition: inline; filename="'.basename($output_file).'"'); header('Cache-Control: private, max-age=0, must-revalidate'); header('Pragma: public'); ini_set('zlib.output_compression','0'); echo file_get_contents($output_file); } else { echo "Impossible de charger le fichier."; } } }