enrichissement par un admin

This commit is contained in:
Damien LASSERRE 2012-04-12 09:25:37 +00:00
parent 62fc0c17d5
commit 4ad4c24221
5 changed files with 29 additions and 6 deletions

View File

@ -30,6 +30,7 @@ class DashboardController extends Libs_Controller
public function ciblageAction()
{
require_once('Scores/Field.php');
$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini');
$object = new Object_Dashboard();
$request = $this->getRequest();
$comptage = $object->ciblagedetail($request->getParam('id'));
@ -40,7 +41,7 @@ class DashboardController extends Libs_Controller
$this->view->criteres = $comptage['criteres'];
$this->view->comptages = $comptage['comptages'];
$this->view->enrichissements = $enrichissement;
$this->view->pathfile = $config->path->data;
}
public function rcomptageAction()
@ -80,7 +81,7 @@ class DashboardController extends Libs_Controller
{
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini');
//Criteres => Comptages (last) => enrichissement_identifiants => enrichissement_commandes
$enrichissementsM = new Table_EnrichissementIdentifiants();
@ -125,6 +126,7 @@ class DashboardController extends Libs_Controller
->where('i.dateStart != ?', '0000-00-00 00:00:00');
$fini = $enrichissementsM->fetchAll($sql)->toArray();
$this->view->fini = $fini;
$this->view->pathfile = $config->path->data;
}
/**

View File

@ -69,6 +69,7 @@ class EnrichissementController extends Zend_Controller_Action
*/
public function commandeAction()
{
set_time_limit(60);
$this->_helper->layout()->disableLayout();
$request = $this->getRequest();
@ -128,9 +129,9 @@ class EnrichissementController extends Zend_Controller_Action
'error' => '',
'dateAdded' => date('YmdHms'),
);
$identifiantsM = new Table_EnrichissementIdentifiants();
$idIdentifiant = $identifiantsM->insert($data);
exec('php '.APPLICATION_PATH.'/../batch/enrichissement.php --id '.$idIdentifiant, $info = array()) or die(print_r($info));
}
/**
@ -215,5 +216,24 @@ class EnrichissementController extends Zend_Controller_Action
}
public function downloadAction()
{
$id = $this->getRequest()->getParam('id');
if(!empty($id)) {
$table = new Table_EnrichissementIdentifiants();
$sql = $table->select()
->where('id = ?', $id);
$result = $table->fetchRow($sql);
if(!empty($result)) {
$result->toArray();
$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini');
if(file_exists($result['fichier']))
echo file_get_contents($result['fichier']);
else
echo 'Le fichier n\'éxiste plus...';
}
}
exit;
}
}

View File

@ -63,7 +63,7 @@
<th><?=$item['dateAdded']?></th>
<th><?=$item['reference']?></th>
<th><?=number_format($item['nbLigneTotales'], 0, '', ' ')?></th>
<th><?=$item['fichier']?></th>
<td><a href="/enrichissement/download/id/<?=$item['id']?>"><?php echo $item['fichier']; ?></a></td>
</tr>
<?php endforeach;?>
</tbody>

View File

@ -58,7 +58,7 @@ Enrichissement à partir d'un ciblage
<td><?=$item['reference']?></td>
<td><?=number_format($item['nbLigneTotales'], 0, ',', ' ')?></td>
<td><?=$item['dateAdded']?></td>
<td><?=$item['fichier']?></td>
<td><a href="<?php echo $this->pathfile.'/'.$item['fichier']?>"><?php echo $item['fichier']; ?></a></td>
</tr>
<?php endforeach;?>
</tbody>

View File

@ -81,7 +81,8 @@ if ($opts->id)
if ( count($identifiants)>0 && count($dataProfil)>0 )
{
$outFile = uniqid($commande->reference.'-').'.csv';
$config = new Zend_Config_Ini(APPLICATION_PATH.'/configs/configuration.ini');
$outFile = $config->path->data.'/'.uniqid($commande->reference.'-').'.csv';
require_once 'Scores/Enrichissement.php';
$dico = new Enrichissement();