Gestion des dates

This commit is contained in:
Michael RICOIS 2013-01-09 11:13:44 +00:00
parent 92e7788117
commit e1305a5365
4 changed files with 71 additions and 37 deletions

View File

@ -226,7 +226,15 @@ class GestionController extends Zend_Controller_Action
*/
public function ciblagesAction()
{
$comptagesM = new Application_Model_Comptages();
$request = $this->getRequest();
$month = $request->getParam('month', date('m'));
$year = $request->getParam('year', date('Y'));
$this->view->assign('month', $month);
$this->view->assign('year', $year);
$comptagesM = new Application_Model_Comptages();
$sql = $comptagesM->select()->setIntegrityCheck(false)
->from('ciblage_comptages', array(
@ -237,7 +245,9 @@ class GestionController extends Zend_Controller_Action
))
->join('ciblage_criteres', 'ciblage_comptages.idDefinition = ciblage_criteres.id', array('ciblage_criteres.reference'))
->order('ciblage_comptages.dateAjout DESC')
->group('ciblage_criteres.id');
->group('ciblage_criteres.id')
->where("ciblage_comptages.dateAjout LIKE '".$year."-".$month."%'")
->order('ciblage_comptages.dateAjout DESC');
$comptages = $comptagesM->fetchAll($sql)->toArray();
Zend_Registry::get('firebug')->info($comptages);
@ -245,6 +255,11 @@ class GestionController extends Zend_Controller_Action
$this->view->comptages = $comptages;
}
public function ciblagecriteresAction()
{
}
/**
* List customers
*/

View File

@ -1,27 +1,46 @@
<?php
$YearBegin = 2012;
$Years = date('Y') - $YearBegin;
?>
<div id="dashboard">
<h2>Liste des ciblages</h2>
<div>
<table>
<tr>
<th><b>Id</b></th>
<th><b>Date de création</b></th>
<th><b>Référence</b></th>
<th><b>Résultat</b></th>
<th><b>Insee</b></th>
<th><b>Actions</b></th>
</tr>
<?php foreach($this->comptages as $comptage): ?>
<tr>
<td><?=$comptage['idDefinition']?></td>
<td><?=$comptage['dateAjout']?></td>
<td><?=$comptage['reference']?></td>
<td><?=$comptage['resultat']?></td>
<td><?=$comptage['uniteInsee']?></td>
<td>
<a href="">Actualiser</a>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<form method="post" action="">
<select name="year">
<?php for ($i=0 ; $i<=$Years ; $i++ ) {?>
<?php $select=''; if ($YearBegin+$Years-$i==$this->year) $select = ' selected';?>
<option value="<?=$YearBegin+$Years-$i?>"<?=$select?>><?=$YearBegin+$Years-$i?></option>
<?php }?>
</select>
<select name="month">
<?php for ( $i=1 ; $i<=12 ; $i++ ) {?>
<?php $select=''; if ($i==$this->month) $select = ' selected';?>
<option value="<?=$i?>"<?=$select?>><?=str_pad($i, 2, '0', STR_PAD_LEFT)?></option>
<?php }?>
</select>
<input type="submit" name="submit" value="Ok"/>
</form>
<h2>Liste des ciblages</h2>
<div>
<table>
<tr>
<th><b>Id</b></th>
<th><b>Date de création</b></th>
<th><b>Référence</b></th>
<th><b>Résultat</b></th>
<th><b>Insee</b></th>
<th><b>Actions</b></th>
</tr>
<?php foreach($this->comptages as $comptage): ?>
<tr>
<td><?=$comptage['idDefinition']?></td>
<td><?=$comptage['dateAjout']?></td>
<td><?=$comptage['reference']?></td>
<td><?=$comptage['resultat']?></td>
<td><?=$comptage['uniteInsee']?></td>
<td>
<a href="">Actualiser</a>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>

View File

@ -1,14 +1,14 @@
<?php
$YearBegin = 2012;
$Years = date('Y') - $YearsBegin;
$Years = date('Y') - $YearBegin;
?>
<div id="dashboard">
<div>
<form method="post" action="">
<select name="year">
<?php for ($i=0 ; $i<$Years ; $i++ ) {?>
<?php $select=''; if ($i==$this->year) $select = ' selected';?>
<option value="<?=$YearBegin+$i?>"<?=$slect?>><?=$YearBegin+$i?></option>
<?php for ($i=0 ; $i<=$Years ; $i++ ) {?>
<?php $select=''; if ($YearBegin+$Years-$i==$this->year) $select = ' selected';?>
<option value="<?=$YearBegin+$Years-$i?>"<?=$select?>><?=$YearBegin+$Years-$i?></option>
<?php }?>
</select>
<select name="month">
@ -32,7 +32,7 @@ $Years = date('Y') - $YearsBegin;
<th><b>Reférence ciblage</b></th>
<th><b>Actions</b></th>
</tr>
<?php foreach($this->commandes as $item): ?>
<?php foreach($this->commandes as $item): ?>
<tr>
<td><?=$item['dateAdded']?></td>
<td><?=$item['commandeReference']?></td>
@ -45,7 +45,7 @@ $Years = date('Y') - $YearsBegin;
<a href="<?=$this->url(array('controller'=> 'gestion','action'=>'extract', 'id'=>$item['id']))?>">Extraire les sirets</a>
</td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</table>
</div>
</div>

View File

@ -1,13 +1,13 @@
<?php
$YearBegin = 2012;
$Years = date('Y') - $YearsBegin;
$Years = date('Y') - $YearBegin;
?>
<div id="dashboard">
<form method="post" action="">
<select name="year">
<?php for ($i=0 ; $i<$Years ; $i++ ) {?>
<?php $select=''; if ($i==$this->year) $select = ' selected';?>
<option value="<?=$YearBegin+$i?>"<?=$slect?>><?=$YearBegin+$i?></option>
<?php for ($i=0 ; $i<=$Years ; $i++ ) {?>
<?php $select=''; if ($YearBegin+$Years-$i==$this->year) $select = ' selected';?>
<option value="<?=$YearBegin+$Years-$i?>"<?=$select?>><?=$YearBegin+$Years-$i?></option>
<?php }?>
</select>
<select name="month">