98 lines
2.9 KiB
PHP
98 lines
2.9 KiB
PHP
<?php
|
|
class IndexController extends Zend_Controller_Action
|
|
{
|
|
|
|
public function indexAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
$page = $request->getParam('page');
|
|
if ($page == 'annonces')
|
|
{
|
|
$siret = $request->getParam('siret');
|
|
$source = $request->getParam('source');
|
|
$idAnn = $request->getParam('idAnn');
|
|
$lien = '/juridique/annonces/siret/'.$siret;
|
|
if (!empty($source)) $lien.= '/source/'.$source;
|
|
if (!empty($idAnn)) $lien.= '/idAnn/'.$idAnn;
|
|
$this->_redirect($lien);
|
|
}
|
|
elseif ( Zend_Registry::get('theme')->name=='mobile' )
|
|
{
|
|
//Afficher le menu pour la version mobile
|
|
}
|
|
else
|
|
{
|
|
$this->_forward('entreprise', 'recherche');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Retourne l'url pour le csv d'export du portefeuille
|
|
*/
|
|
public function portefeuillecsvAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
//'login' and 'hach' detecte from AuthAdapter
|
|
|
|
$request = $this->getRequest();
|
|
$version = $request->getParam('v', 1);
|
|
|
|
if (intval($version) == 2) {
|
|
|
|
$log = Zend_Registry::get('config')->profil->path->data.'/log/altisys.log';
|
|
|
|
$user = new Scores_Utilisateur();
|
|
$login = $user->getLogin();
|
|
$idClient = $user->getIdClient();
|
|
|
|
$file = 'listesurv-score-'.$login.'-'.$idClient.'.csv';
|
|
|
|
$content_type = 'application/csv-tab-delimited-table';
|
|
$c = Zend_Registry::get('config');
|
|
$path = realpath($c->profil->path->files).'/';
|
|
//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);
|
|
file_put_contents($log, date('Y-m-d H:i:s')." APPEL ALTISYS - OK $file\n", FILE_APPEND);
|
|
} else {
|
|
echo 'Impossible de charger le fichier.';
|
|
file_put_contents($log, date('Y-m-d H:i:s')." APPEL ALTISYS - ERREUR $file\n", FILE_APPEND);
|
|
}
|
|
|
|
} else {
|
|
|
|
require_once 'Scores/WsScores.php';
|
|
|
|
$user = new Scores_Utilisateur();
|
|
$login = $user->getLogin();
|
|
$idClient = $user->getIdClient();
|
|
|
|
$ws = new WsScores();
|
|
$reponse = $ws->getPortefeuilleCsv($login, $idClient);
|
|
|
|
$log = Zend_Registry::get('config')->profil->path->data.'/log/altisys.log';
|
|
|
|
if ($reponse === false){
|
|
file_put_contents($log, date('Y-m-d H:i:s')." - URL = ERREUR\n", FILE_APPEND);
|
|
echo "Erreur";
|
|
} elseif (!empty($reponse->result->Url)) {
|
|
file_put_contents($log, date('Y-m-d H:i:s')." - URL = ".$reponse->result->Url."\n", FILE_APPEND);
|
|
echo $reponse->result->Url;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|