Meilleur approche pour la mise à jour du comptage
This commit is contained in:
parent
87e1a3faac
commit
788c2210b1
@ -163,7 +163,7 @@ class ComptageController extends Zend_Controller_Action
|
||||
$result = array(
|
||||
'resultat' => number_format($data['resultat'], 0, '', ' '),
|
||||
'uniteInsee' => number_format($data['uniteInsee'], 0, '', ' '),
|
||||
'dateAjout' => substr($data['dateAjout'],6,2).'/'.substr($data['dateAjout'],4,2).'/'.substr($data['dateAjout'],6,2)
|
||||
'dateAjout' => substr($data['dateAjout'],6,2).'/'.substr($data['dateAjout'],4,2).'/'.substr($data['dateAjout'],0,4)
|
||||
.' '.substr($data['dateAjout'],8,2).':'.substr($data['dateAjout'],10,2).':'.substr($data['dateAjout'],12,2),
|
||||
);
|
||||
$this->view->result = $result;
|
||||
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_ProfilExtraction extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'profilExtraction';
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<?php
|
||||
class Application_Model_RefExport extends Zend_Db_Table_Abstract
|
||||
{
|
||||
protected $_name = 'refexport';
|
||||
}
|
@ -45,18 +45,19 @@
|
||||
|
||||
<fieldset>
|
||||
<legend>Comptages</legend>
|
||||
<table style="width:100%">
|
||||
<table class="comptages" style="width:100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Resultat</th>
|
||||
<th>Résultat</th>
|
||||
<th>Nombre d'unité Insee</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($this->comptages as $comptage):?>
|
||||
<tr>
|
||||
<th><?=$comptage['dateAjout']?></th>
|
||||
<th><?=substr($comptage['dateAjout'],8,2).'/'.substr($comptage['dateAjout'],5,2).'/'.substr($comptage['dateAjout'],0,4)
|
||||
.' '.substr($comptage['dateAjout'],11,2).':'.substr($comptage['dateAjout'],14,2).':'.substr($comptage['dateAjout'],17,2)?></th>
|
||||
<th><?=number_format($comptage['resultat'], 0, '', ' ')?></th>
|
||||
<th><?=number_format($comptage['uniteInsee'], 0, '', ' ')?></th>
|
||||
</tr>
|
||||
|
@ -16,12 +16,19 @@ $(document).ready(function(){
|
||||
$("a.update").click(function(e){
|
||||
e.preventDefault();
|
||||
var href = $(this).attr('href');
|
||||
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);
|
||||
var $firstHTML = '<tr id="ligneUpdate"><td colspan="3" align="center"><img src="/themes/default/images/ajax.gif"/></td></tr>';
|
||||
$('table.comptages').prepend($firstHTML);
|
||||
$.getJSON(href, function(data, status){
|
||||
|
||||
if (status=='success') {
|
||||
$('tr#ligneUpdate').html(
|
||||
'<td>'+data.dateAjout+'</td>' +
|
||||
'<td>'+data.resultat+'</td>' +
|
||||
'<td>'+data.uniteInsee+'</td>'
|
||||
);
|
||||
} else {
|
||||
$('tr#ligneUpdate').html('<td colspan="3" align="center">Une erreur est survenue.</td>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user