Affichage de la liste des enrichissements avec possibilité de télécharger le fichier
This commit is contained in:
parent
ce3928354b
commit
d1f342dd3d
@ -193,6 +193,7 @@ class GestionController extends Zend_Controller_Action
|
||||
'e.nbLigneTotales',
|
||||
'e.uniteInsee',
|
||||
"DATE_FORMAT(e.dateAdded, '%Y/%m/%d %H:%i:%s') AS dateAdded",
|
||||
"DATE_FORMAT(e.dateStart, '%Y/%m/%d %H:%i:%s') AS dateStart",
|
||||
'e.fichier'
|
||||
))
|
||||
->join('ciblage_criteres', 'idCriteres = ciblage_criteres.id', array(
|
||||
@ -205,37 +206,48 @@ class GestionController extends Zend_Controller_Action
|
||||
|
||||
$this->view->commandes = $commandesM->fetchAll($sql)->toArray();
|
||||
}
|
||||
|
||||
public function downloadAction()
|
||||
|
||||
/**
|
||||
* Téléchargement des fichiers créer par les clients pour analyse
|
||||
*/
|
||||
public function enrichissementdlAction()
|
||||
{
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$request = $this->getRequest();
|
||||
|
||||
$c = Zend_Registry::get('config');
|
||||
$path = $c->profil->path->data.'/'.$date.'/';
|
||||
|
||||
$file = $request->getParam('q');
|
||||
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
//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.';
|
||||
}
|
||||
|
||||
$this->_helper->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
$identity = $auth->getIdentity();
|
||||
|
||||
$id = $this->getRequest()->getParam('id');
|
||||
|
||||
$table = new Application_Model_CiblageEnrichissementIdentifiants();
|
||||
$sql = $table->select()
|
||||
->where('id = ?', $id);
|
||||
$result = $table->fetchRow($sql);
|
||||
if( !empty($result) ) {
|
||||
$result = $result->toArray();
|
||||
$date = substr($result['dateAdded'],0,4).substr($result['dateAdded'],5,2);
|
||||
$c = Zend_Registry::get('config');
|
||||
$path = $c->profil->path->data.'/'.$date.'/';
|
||||
$file = $result['fichier'];
|
||||
}
|
||||
$content_type = 'application/csv-tab-delimited-table';
|
||||
//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.';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load enrichissement batch to complete data
|
||||
*/
|
||||
@ -243,7 +255,7 @@ class GestionController extends Zend_Controller_Action
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
$id = $request->getParam('id');
|
||||
exec('php '.APPLICATION_PATH.'/../batch/enrichissement.php --id '.$id.' &');
|
||||
exec('php '.APPLICATION_PATH.'/../scripts/jobs/enrichissement.php --id '.$id.' &');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,27 +21,31 @@ $Years = date('Y') - $YearBegin;
|
||||
</form>
|
||||
<h2>Liste des commandes</h2>
|
||||
<div>
|
||||
<table>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th><b>Date de création</b></th>
|
||||
<th><b>Référence</b></th>
|
||||
<th><b>Date</b></th>
|
||||
<th><b>login</b></th>
|
||||
<th><b>Références</b></th>
|
||||
<th><b>Résultat</b></th>
|
||||
<th><b>Insee</b></th>
|
||||
<th><b>login</b></th>
|
||||
<th><b>Reférence ciblage</b></th>
|
||||
<th><b>Fichier</b></th>
|
||||
</tr>
|
||||
<?php foreach($this->commandes as $item): ?>
|
||||
<?php foreach($this->commandes as $item) { ?>
|
||||
<tr>
|
||||
<td><?=$item['dateAdded']?></td>
|
||||
<td><?=$item['commandeReference']?></td>
|
||||
<td>
|
||||
<?=$item['dateAdded']?><br/>
|
||||
<?=$item['dateStart']?>
|
||||
</td>
|
||||
<td><?=$item['login']?></td>
|
||||
<td>
|
||||
<?=$item['commandeReference']?><br/>
|
||||
<?=$item['critereReference']?><br/>
|
||||
<a href="<?=$this->url(array('controller'=>'gestion','action'=>'enrichissementdl', 'id'=> $item['id']),
|
||||
'default', true)?>"><?=$item['fichier']?></a>
|
||||
</td>
|
||||
<td><?=$item['nbLigneTotales']?></td>
|
||||
<td><?=$item['uniteInsee']?></td>
|
||||
<td><?=$item['login']?></td>
|
||||
<td><?=$item['critereReference']?></td>
|
||||
<td><a href="<?=$this->url(array('controller'=>'gestion','action'=>'download','q'=>$item['fichier']))?>"><?=$item['fichier']?></a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user