Log de consommation

This commit is contained in:
Michael RICOIS 2016-06-08 15:36:48 +02:00
parent 67cab71f1f
commit 0bfd53d9b1
4 changed files with 100 additions and 4 deletions

View File

@ -10,7 +10,57 @@ class User_LogController extends Zend_Controller_Action
}
public function indexAction(){}
public function authAction(){}
/**
* Liste des authentifications
*/
public function authAction()
{
$request = $this->getRequest();
// --- Année de départ
$user = new Scores_Utilisateur();
$startYear = substr($user->identity->dateDebutCompte,0,4);
if (empty($startYear)) {
$startYear = 2006;
}
// --- Date
$date = new Zend_Date();
$year = $date->toString('yyyy'); //Année en cours
$month = $date->toString('MM'); //Mois en cours
$nbYear = $year - $startYear + 1;
$selectYear = array();
for( $i=0; $i<$nbYear; $i++ ) {
$selectYear[] = $startYear + $i;
}
$this->view->Years = $selectYear;
$selectMonth = array('01','02','03','04','05','06','07','08','09','10','11','12');
$this->view->Months = $selectMonth;
$selectedYear = $request->getParam('y', date('Y'));
$this->view->year = $selectedYear;
$selectedMonth = $request->getParam('m', date('m'));
$this->view->month = $selectedMonth;
// --- Fin Date
$ws = new Scores_Ws_Client('account', '0.1');
$params = new stdClass();
$params->month = $selectedYear.'-'.$selectedMonth;
$params->type = 'OK';
$response = $ws->getAuthLog($params);
if ($response === false) {
$this->view->Error = true;
} else {
$this->view->List = $response->List->item;
}
}
public function consoAction(){}
public function consocsvAction(){}
public function consocsvAction(){}
}

View File

@ -1 +1,40 @@
<?php
<div id="center">
<h1>Historique de vos connexions</h1>
<div class="paragraph">
<form action="<?=$this->url(array('module'=>'user', 'controller'=>'log', 'action'=>'auth'), 'default', true)?>">
<select name="y" >
<?php foreach($this->Years as $year) { ?>
<option value="<?=$year?>" <?php if($year==$this->year) echo 'selected';?>><?=$year?></option>
<?php } ?>
</select>
<select name="m">
<?php foreach($this->Months as $month) { ?>
<option value="<?=$month?>" <?php if($month==$this->month) echo 'selected';?>><?=$month?></option>
<?php } ?>
</select>
<input type="submit" value="OK"/>
</form>
</div>
<h2>Détail</h2>
<?php if (count($this->List) > 0) {?>
<table class="table table-hover">
<thead>
<tr>
<th>Date</th>
<th>IP</th>
</tr>
</thead>
<tbody>
<?php foreach($this->List as $item) {?>
<tr>
<td><?=$item->Date?></td>
<td><?=$item->IP?></td>
</tr>
<?php }?>
</tbody>
</table>
<?php }?>
</div>

View File

@ -1 +1,7 @@
<?php
<div id="content">
<h1>Consommation cummulée au service</h1>
</div>

View File

@ -0,0 +1 @@
<?php