issue #0001687: monitoring interface && event search

This commit is contained in:
Arman KYOKCHAN 2013-08-20 07:06:30 +00:00
parent 7a2593fd00
commit 51ff973e2e
4 changed files with 320 additions and 0 deletions

View File

@ -330,4 +330,35 @@ class GiantController extends Zend_Controller_Action
endforeach;
$this->view->val = $merged;
}
public function retriveAction()
{
$this->view->headScript()->appendFile('/themes/default/scripts/giant_monitoring.js', 'text/javascript');
$giantController = new GiantControllerLib();
$result = $giantController->retrive(
1,
$this->TestIndication,
'RetrieveMonitoringEventsForCustomer'
);
$this->view->result = $result;
$merged =Array();
foreach ($result->MonitoringEvents->MonitoringEvent as $MonitoringEvent):
if ($merged[$MonitoringEvent->ProviderOrderId]){
array_push($merged[$MonitoringEvent->ProviderOrderId],$MonitoringEvent) ;
} else {
$merged[$MonitoringEvent->ProviderOrderId][]=$MonitoringEvent;
}
endforeach;
$this->view->val = $merged;
$merged_siren =Array();
foreach ($result->MonitoringEvents->MonitoringEvent as $MonitoringEvent):
if ($merged_siren[$MonitoringEvent->Company->CompanyId]){
array_push($merged_siren[$MonitoringEvent->Company->CompanyId],$MonitoringEvent) ;
} else {
$merged_siren[$MonitoringEvent->Company->CompanyId][]=$MonitoringEvent;
}
endforeach;
$this->view->val_siren = $merged_siren;
}
}

View File

@ -0,0 +1,268 @@
<div id="center">
<h1 class="titre">SURVEILLANCE</h1>
<div class="paragraph">
<?php
if ( empty($this->source) ){
?>
<table id="info">
<tr>
<td width="200" class="StyleInfoLib">Nombre d'entités affichées</td>
<td><?=count($this->result->MonitoringEvents->MonitoringEvent)?></td>
</tr>
<tr>
<td width="200" class="StyleInfoLib">Nombre de surveillances</td>
<td><?=count($this->val)?></td>
</tr>
</table>
<?php
} else {
?>
<table id="info">
<tr>
<td width="200" class="StyleInfoLib">Nombre de surveillances <?=$this->source?></td>
<td><?=$this->nbSurveillances?></td>
</tr>
</table>
<?php
}
?>
</div>
<h2>Options de recherche</h2>
<div class="paragraph">
<label>Afficher uniquement les suveillances de type</label>
<select name="type">
<option value="">toutes</option>
<?=$this->selectTri?>
</select>
</div>
<div class="paragraph">
Tri
<select name="triMode">
<option value="asc"<?=($this->triMode=='asc')? ' selected' : ''?>>croissant</option>
<option value="desc"<?=($this->triMode=='desc')? ' selected' : ''?>>décroissant</option>
</select>
par
<select name="tri">
<option value="siren"<?=($this->tri=='siren')? ' selected' : ''?>>Siren</option>
<option value="ref"<?=($this->tri=='ref')? ' selected' : ''?>>Référence</option>
<option value="rs"<?=($this->tri=='rs')? ' selected' : ''?>>Raison Sociale</option>
<option value="dateAjout"<?=($this->tri=='dateAjout')? ' selected' : ''?>>Date d'ajout</option>
<option value="dateDerEnvoi"<?=($this->tri=='dateDerEnvoi')? ' selected' : ''?>>Date d'envoi</option>
</select>
</div>
<div class="paragraph" id="formSurveillance">
<form name="recherche" action="<?=$this->url(array('controller'=>'surveillance', 'action'=>'liste'))?>">
<input type="text" name="q" class="search" value="<?=($this->q != null)? $this->q : "Siren, Référence, Raison Sociale"?>" />
<input type="submit" value="Rechercher" class="submit"/>
</form>
</div>
<h2>Liste des surveillances</h2>
<div class="paragraph">
<?php if ($this->curPage>=1) { ?>
<a class="pagination" href="<?=$this->url(array('action' => 'liste', 'page' => $this->curPage-1))?>"
title="Page précédente..."> &lt;&lt; </a>
<?php } ?>
<?php if ($this->curPage!=$this->totPage) { ?>
<span>Page <select name="page">
<?php for ($i=1;$i<$this->totPage+1;$i++) {?>
<option value="<?=$this->url(array('action' => 'liste', 'page' => $i-1))?>"
<?=($i==$this->curPage+1)? ' selected' : ''?>><?=$i?></option>
<?php }?></select> / <?=$this->totPage?>
</span>
<?php } ?>
<?php if ($this->curPage+1<$this->totPage) { ?>
<a class="pagination" href="<?=$this->url(array('action' => 'liste', 'page' => $this->curPage+1))?>"
title="Page suivante..."> &gt;&gt; </a>
<?php } ?>
</div>
<div class="paragraph">
<table class="tablesorter" id="surveillance" width="570">
<thead>
<tr>
<th width="75">Siren</th>
<th width="150">Raison Sociale</th>
<th width="90">Référence</th>
<th width="150">Surveillance</th>
<th width="75">Ajout le</th>
<th width="75">Envoyé le</th>
</tr>
</thead>
<tbody>
<?php foreach ($this->surveillances as $item) {?>
<tr>
<td class="aleft">
<a href="<?=$this->url(array(
'controller' => 'identite',
'action' => 'fiche',
'siret' => $item['siren'].$item['nic'],
))?>"><?=$item['siren']?></a>
</td>
<td>
<?=$item['rs']?><br/><i><?=$item['cp']?> <?=$item['ville']?></i>
</td>
<td>
<?php
foreach ($this->listSources as $source) {
$ok = false;
foreach ($item['sources'] as $surveillance) {
if ( $surveillance['source'] == $source ) {
if ($surveillance['ref'] != '') { ?><p><?=$surveillance['ref']?></p><?php }
else { ?><p>-</p><?php }
$ok = true;
}
}
if ( $ok === false ) {?><p>-</p><?php }
}
?>
</td>
<td>
<?php
foreach ($this->listSources as $source) {
?>
<div class="action">
</div>
<?php } //Fin foreach?>
</td>
<td>
<?php
foreach ($this->listSources as $source) {
$ok = false;
foreach ($item['sources'] as $surveillance) {
if ( $surveillance['source'] == $source ) {
?>
<p><?=substr($surveillance['dateAjout'], 8, 2).'/'.
substr($surveillance['dateAjout'], 5, 2).'/'.
substr($surveillance['dateAjout'], 0, 4)?></p>
<?php
$ok = true;
}
}
if ( $ok === false ) {?><p>-</p><?php }
}
?>
</td>
<td>
<?php
foreach ($this->listSources as $source) {
$ok = false;
foreach ($item['sources'] as $surveillance) {
if ( $surveillance['source'] == $source ) {
$pDate = substr($surveillance['dateDerEnvoi'], 8, 2).'/'.
substr($surveillance['dateDerEnvoi'], 5, 2).'/'.
substr($surveillance['dateDerEnvoi'], 0, 4);
if ($pDate != '00/00/0000') {
echo '<p>'.$pDate.'</p>';
} else {
echo '<p>-</p>';
}
$ok = true;
}
}
if ( $ok === false ) {?><p>-</p><?php }
}
?>
</td>
<?php } ?>
</tbody>
</table>
</div>
<div class="paragraph">
<?php if ($this->curPage>=1) { ?>
<a class="pagination" href="<?=$this->url(array('action' => 'liste', 'page' => $this->curPage-1))?>"
title="Page précédente..."> &lt;&lt; </a>
<?php } ?>
<?php if ($this->curPage!=$this->totPage) { ?>
<span>Page <select name="page">
<?php for ($i=1;$i<$this->totPage+1;$i++) {?>
<option value="<?=$this->url(array('action' => 'liste', 'page' => $i-1))?>"
<?=($i==$this->curPage+1)? ' selected' : ''?>><?=$i?></option>
<?php }?></select> / <?=$this->totPage?>
</span>
<?php } ?>
<?php if ($this->curPage+1<$this->totPage) { ?>
<a class="pagination" href="<?=$this->url(array('action' => 'liste', 'page' => $this->curPage+1))?>"
title="Page suivante..."> &gt;&gt; </a>
<?php } ?>
</div>
</div>
<pre><? print_r($this->val_siren); ?></pre>
<script type="text/javascript">
function submitTri() {
var tri = $('select[name=tri] option:selected').val();
var triMode = $('select[name=triMode] option:selected').val();
var source = $('select[name=type] option:selected').val();
window.location.href = '<?=$this->url(array(
'controller'=>'surveillance' ,
'action'=>'liste',
'q' => $this->q,
), null, true)?>/source/'+source+'/tri/'+tri+'/triMode/'+triMode;
}
$(document).ready(function() {
$('select[name=page]').change(function(){
window.location.href = $(this).val();
});
$('select[name=type]').change(function() {
submitTri();
});
$('select[name=tri]').change(function() {
submitTri();
});
$('input[name=q]').focusin(function(){
var txt = 'Siren, Référence, Raison Sociale';
var val = $(this).val();
if ( val == '' || val == txt ) { $(this).val(''); }
}).focusout(function(){
var txt = 'Siren, Référence, Raison Sociale';
var val = $(this).val();
if ( val == '' ){ $(this).val(txt); }
});
<?php
if ($source == '') {
?>
$('#surveillance').tablesorter({
headers: {
2: { sorter: false },
3: { sorter: false },
4: { sorter: false },
5: { sorter: false }
}
});
<?php
} else {
?>
$('#surveillance').tablesorter({
headers: {
3: { sorter: false }
}
});
<?php
}
?>
});
</script>

View File

@ -135,6 +135,13 @@ Class GiantControllerLib
$result = $rapport->GetRetriveMonitoring($CompanyId, $StartFrom,$InternalOrderId,$EventType);
return ($result);
}
public function retrive($StartFrom,$TestIndication,$EventType)
{
$Utilisateur = new Scores_Utilisateur();
$rapport = new GiantRechercheController('FR', $TestIndication);
$result = $rapport->GetRetrive($StartFrom,$TestIndication,$EventType);
return ($result);
}
protected function parcourTableau($array)
{
$tableau = array();
@ -334,6 +341,12 @@ Class GiantRechercheController extends GiantFunction
$result = $this->CreditData->getMethode('RetrieveMonitoringEventsFor'.$EventType, array($CompanyId, $StartFrom, $InternalOrderId));
return ($result);
}
public function GetRetrive($StartFrom,$TestIndication, $EventType)
{
$this->CreditData = new CreditData($this->soapG);
$result = $this->CreditData->getMethode($EventType, array($CompanyId,$StartFrom));
return ($result);
}
public function ListeRapport($CompanyId)
{
$this->CreditData = new CreditData($this->soapG, $CompanyId);

View File

@ -394,6 +394,11 @@ class Menu
'action' => 'liste',
'permission' => 'SURVLISTE'
),
array(
'label' => "Monitoring",
'controller' => 'giant',
'action' => 'retrive',
),
array(
'label' => "Surveillances fichier",
'controller' => 'surveillance',
@ -728,6 +733,9 @@ class Menu
}
return true;
break;
case 'giant':
return true;
break;
case 'user':
switch($action){
case 'liste':