Mise à jour du comptage OK

This commit is contained in:
Michael RICOIS 2012-02-22 20:28:44 +00:00
parent ba61d4c817
commit b530470273
3 changed files with 22 additions and 22 deletions

View File

@ -1,6 +1,5 @@
<?php
class ComptageController extends Libs_Controller
class ComptageController extends Zend_Controller_Action
{
public function init()
{
@ -69,13 +68,13 @@ class ComptageController extends Libs_Controller
//Comptage
require_once 'Scores/Ciblage.php';
$ciblage = new Ciblage($field->getValues());
$ciblage = new Ciblage($values);
$data = array(
'idDefinition' => $idCriteres,
'resultat' => $ciblage->execute(),
'uniteInsee' => $ciblage->calculRedevanceInsee(),
'dateAjout' => date('d/m/Y H:i:s'),
'dateAjout' => date('YmdHis'),
);
//Enregistrement
$comptageM = new Table_Comptages();
@ -84,7 +83,8 @@ class ComptageController extends Libs_Controller
$result = array(
'resultat' => number_format($data['resultat'], 0, '', ' '),
'uniteInsee' => number_format($data['dateAjout'], 0, '', ' '),
'dateAjout' => $data['dateAjout'],
'dateAjout' => substr($data['dateAjout'],6,2).'/'.substr($data['dateAjout'],4,2).'/'.substr($data['dateAjout'],6,2)
.' '.substr($data['dateAjout'],8,2).':'.substr($data['dateAjout'],10,2).':'.substr($data['dateAjout'],12,2),
);
$this->view->assign('result', $result);
}

View File

@ -21,13 +21,13 @@ Class Object_Dashboard
foreach($rows->toArray() as $item)
{
$info = array(
'id' => $item['id'],
'reference' => $item['reference'],
'dateCriteres' => $item['dateAjout'],
'id' => $item['id'],
'reference' => $item['reference'],
'dateCriteres' => $item['dateAjout'],
);
//Recherche des comptages
$sql = $comptagesM->select(true)
->columns(array('resultat', 'uniteInsee', 'dateAjout'))
->columns(array('resultat', 'uniteInsee', "DATE_FORMAT(dateAjout, '%d/%m/%Y %H:%i:%s') as dateAjout"))
->where('idDefinition = ?', $item['id'])
->order('dateAjout DESC')->limit(1);
$comptage = $comptagesM->fetchAll($sql)->toArray();
@ -55,9 +55,7 @@ Class Object_Dashboard
$auth = Zend_Auth::getInstance();
$user = $auth->getIdentity();
$db = Zend_Registry::get('db');
$criteresM = new Table_Criteres($db);
$criteresM = new Table_Criteres();
//Compter le nombre de page
$sql = $criteresM->select()
@ -82,13 +80,13 @@ Class Object_Dashboard
foreach($rows->toArray() as $item)
{
$info = array(
'id' => $item['id'],
'reference' => $item['reference'],
'dateCriteres' => $item['dateAjout'],
'id' => $item['id'],
'reference' => $item['reference'],
'dateCriteres' => $item['dateAjout'],
);
//Recherche des comptages
$sql = $comptagesM->select(true)
->columns(array('resultat', 'uniteInsee', 'dateAjout'))
->from($comptageM, array('resultat', 'uniteInsee', "DATE_FORMAT(dateAjout, '%d/%m/%Y %H:%i:%s') as dateAjout"))
->where('idDefinition = ?', $item['id'])
->order('dateAjout DESC')->limit(1);
$comptage = $comptagesM->fetchAll($sql)->toArray();

View File

@ -13,14 +13,16 @@ $(document).ready(function(){
}
});
$("a.update").click(function(){
$("a.update").click(function(e){
e.preventDefault();
var href = $(this).attr('href');
$(this).parent().parent().find('td.update').html('<img src="/themes/default/images/ajax.gif" />');
$.getJSON(href, function(data){
var ligne = $(this).parent().parent();
ligne.find('td.update').html('<img src="/themes/default/images/ajax.gif" />');
$.getJSON(href, function(data){
ligne.find('td.resultat').html(data.resultat);
ligne.find('td.insee').html(data.uniteInsee);
ligne.find('td.date').html(data.dateAjout);
});
});
$('a.enrichissementref').on('click', function(){