Historiques des ciblages

This commit is contained in:
Michael RICOIS 2012-01-05 15:40:03 +00:00
parent aaf0f079d0
commit dbf289f202

View File

@ -76,31 +76,62 @@ class DashboardController extends Zend_Controller_Action
{
$request = $this->getRequest();
$page = $request->getParam('page', 1);
$offset = 20;
//Liste des ciblages par paquet de n
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$db = Zend_Registry::get('db');
$criteresM = new Application_Model_Criteres($db);
//Compter le nombre de page
$sql = $criteresM->select()
->columns(array('id', 'reference', 'dateAjout'))
->where("idClient = ? AND login = ?", array($user->idClient, $user->username))
->from($criteresM, array('nb' => 'COUNT(*)'))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username);
$count = $criteresM->fetchRow($sql);
$nbCiblage = $count->nb;
//Récupérer les informations
$position = ($page-1)*$offset+1;
$sql = $criteresM->select()
->from($criteresM, array('id', 'reference', 'dateAjout'))
->where("idClient = ?", $user->idClient)
->where("login = ?", $user->username)
->order('dateAjout DESC')
->limit(1,5);
->limitPage($position, $offset);
$rows = $criteresM->fetchAll($sql);
$results = array();
$comptagesM = new Application_Model_Comptages();
foreach($rows->toArray() as $item) {
$comptagesM = new Application_Model_Comptages($db);
foreach($rows->toArray() as $item)
{
$info = array(
'id' => $item['id'],
'reference' => $item['reference'],
'dateCriteres' => $item['dateAjout'],
);
//Recherche des comptages
$sql = $comptagesM->select()
->columns(array('resultat', 'uniteInsee', 'tarif', 'dateAjout'))
$sql = $comptagesM->select(true)
->columns(array('resultat', 'uniteInsee', 'dateAjout'))
->where('idDefinition = ?', $item['id'])
->order('dateAjout DESC')->limit(1);
$comptage = $comptagesM->fetchRow($sql)->toArray();
$comptage = $comptagesM->fetchAll($sql)->toArray();
$results = array_merge($item, $comptage);
if (count($comptage)>0){
$info['resultat'] = $comptage[0]['resultat'];
$info['uniteInsee'] = $comptage[0]['uniteInsee'];
$info['dateComptage'] = $comptage[0]['dateAjout'];
}
$results[] = $info;
}
$this->view->assign('comptages', $results);
$this->view->assign('ciblages', $results);
$this->view->assign('nbCiblage', $nbCiblage);
}
/**
@ -112,6 +143,10 @@ class DashboardController extends Zend_Controller_Action
/**
* Recherche un comptage avec la référence ou la date
*/
public function rcomptageAction(){}
public function rcomptageAction()
{
}
}