132 lines
3.5 KiB
PHP
Raw Normal View History

2010-11-22 12:50:12 +00:00
<?php
class IndexController extends Zend_Controller_Action
{
2015-07-08 13:48:28 +00:00
protected $theme;
2010-11-22 12:50:12 +00:00
2017-02-13 12:02:09 +01:00
/**
* Logger
* @var \Monolog\Logger
*/
protected $logger;
2017-02-13 12:06:18 +01:00
public function init()
{
if (Zend_Registry::isRegistered('logger')) {
$this->logger = Zend_Registry::get('logger');
}
}
2014-10-30 13:53:19 +00:00
/**
* Page d'accueil et de redirection
*/
2010-11-22 12:50:12 +00:00
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;
2012-05-20 16:31:28 +00:00
$this->_redirect($lien);
}
elseif ( Zend_Registry::get('theme')->name=='mobile' )
2012-04-19 10:27:17 +00:00
{
2012-05-20 16:31:28 +00:00
//Afficher le menu pour la version mobile
2012-04-19 10:27:17 +00:00
}
2012-05-20 16:31:28 +00:00
else
{
2012-04-19 10:27:17 +00:00
$this->_forward('entreprise', 'recherche');
}
2010-11-22 12:50:12 +00:00
}
2012-05-20 16:31:28 +00:00
2012-03-22 08:31:33 +00:00
/**
* Retourne l'url pour le csv d'export du portefeuille
*/
public function portefeuillecsvAction()
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
2012-05-20 16:31:28 +00:00
2013-09-16 15:41:31 +00:00
//'login' and 'hach' detecte from AuthAdapter
2012-05-20 16:31:28 +00:00
2013-09-16 15:41:31 +00:00
$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');
2016-02-12 14:25:27 +00:00
$path = $c->profil->path->shared.'/temp/files/';
2013-09-16 15:41:31 +00:00
//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);
2012-05-20 16:31:28 +00:00
2013-09-16 15:41:31 +00:00
$log = Zend_Registry::get('config')->profil->path->data.'/log/altisys.log';
2012-05-20 16:31:28 +00:00
2013-09-16 15:41:31 +00:00
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;
}
2012-05-20 16:31:28 +00:00
}
}
2012-05-20 16:31:28 +00:00
2015-08-06 09:46:04 +00:00
public function odeaAction()
{
$this->redirect('http://odea.scores-decisions.com');
}
2014-10-30 13:53:19 +00:00
/**
* Display browser agent
*/
2014-06-17 12:39:34 +00:00
public function browserAction()
{
$info = get_browser();
echo $_SERVER['HTTP_USER_AGENT'];
echo "<pre>";
print_r($info);
echo "</pre>";
exit;
}
2010-11-22 12:50:12 +00:00
}