issue #0001687: events generation

This commit is contained in:
Arman KYOKCHAN 2013-09-03 08:14:01 +00:00
parent 8ffb6ec145
commit c6e408bde7
3 changed files with 60 additions and 184 deletions

View File

@ -384,11 +384,14 @@ class GiantController extends Zend_Controller_Action
public function reteventsAction()
{
$this->_helper->layout()->disableLayout();
$this->view->headLink()->appendStylesheet('/themes/default/styles/giant.css', 'all');
$this->view->headScript()->appendFile('/themes/default/scripts/giant_monitoring.js', 'text/javascript');
$this->view->headScript()->appendFile('/themes/default/scripts/giant.js', 'text/javascript');
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
$result = $auth->getStorage()->read($identity);
$result = $result->result->mon_result;
$merged_siren =Array();
$merged_siren = Array();
foreach ($result->MonitoringEvents->MonitoringEvent as $MonitoringEvent):
if ($merged_siren[$MonitoringEvent->Company->CompanyId]){
array_push($merged_siren[$MonitoringEvent->Company->Event[0]->EventCode],$MonitoringEvent) ;
@ -397,6 +400,16 @@ class GiantController extends Zend_Controller_Action
}
endforeach;
$type = $this->getRequest()->getParam('Type');
$this->view->result = $merged_siren[$type];
$id = $this->getRequest()->getParam('Id');
$merged = Array();
foreach ($merged_siren[$type] as $MonitoringEvent):
if ($merged[$MonitoringEvent->ProviderOrderId]){
array_push($merged[$MonitoringEvent->ProviderOrderId],$MonitoringEvent) ;
} else {
$merged[$MonitoringEvent->ProviderOrderId][]=$MonitoringEvent;
}
endforeach;
$this->view->result = $merged[$id];
}
}

View File

@ -1,181 +1,44 @@
<div id="center">
<h1 class="titre">Events</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)?></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>Liste des Evénements</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="110">Raison Sociale</th>
<th width="150">Surveillance</th>
<th width="110">Ajout le</th>
<th width="110">Envoyé le</th>
</tr>
</thead>
<tbody><pre><? print_r($this->result);?></pre>
<?php foreach ($this->val_siren as $monitor) {?>
<pre><? //print_r($monitor);?></pre>
<tr>
<td class="aleft">
<p><?=$monitor[0]->Company->CompanyId ?></p>
</td>
<td>
<p><?=$monitor[0]->Company->CompanyName['0']->_ ?></p>
</td>
<td style='text-align: left'>
<?php
foreach ($monitor as $monitor_type) {
echo "<a class='ev_code' href='/giant/retrive/Type/".$monitor_type->Company->Event[0]->EventCode."'><p>".$monitor_type->Company->Event[0]->EventCode."</p></a>";
} //Fin foreach?>
</td>
<td>
<?php
foreach ($monitor as $monitor_type) {
echo "<p>".$this->action('ret', 'giant',null,array('date_st'=>$monitor_type->ProviderOrderId)).'</p>';
}
?>
</td>
<td>
<?php
foreach ($monitor as $monitor_type) {
echo "<p>".$monitor_type->Company->Event[0]->Date->_."</p>";
}
?>
</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>
<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>
<?function emp_check($val){echo (empty($val))?'NC':$val;}
$wdate = new WDate();?>
<div class='acord'>
<?foreach ($this->result as $report):?><pre><? print_r($report);?></pre>
<div id="accordion">
<h3>GENERAL.ADDRESS_CHANGE</h3>
<div>
<h2 class="radius">Données officielles</h2><br /><br />
<div class="gen_div">
<div><div class="left_div"><b>ProviderEventId</b></div> <div class="right_div"><?emp_check($report->ProviderEventId)?></div></div>
<div><div class="left_div"><b>InternalEventId</b></div> <div class="right_div"><?emp_check($report->InternalEventId)?></div></div>
<div><div class="left_div"><b>CompanyId </b></div> <div class="right_div"><?emp_check($report->Company->CompanyId)?></div></div>
<div><div class="left_div"><b>CompanyName </b></div> <div class="right_div"><?emp_check($report->Company->CompanyName[0]->_)?></div></div>
<div><div class="left_div"><b>EventCode </b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->EventCode)?></div></div>
<div><div class="left_div"><b>Source </b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->Source->_)?></div></div>
<div><div class="left_div"><b>Description </b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->Description->_)?></div></div>
<div><div class="left_div"><b>FreeText </b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->FreeText->_)?></div></div>
</div>
<br /><br />
<h2 class="radius">Données officielles</h2><br /><br />
<div class="gen_div">
<div><div class="left_div"><b>OldCompanyName</b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->Value[0]->Company[0]->CompanyName[0]->_)?></div></div>
<div><div class="left_div"><b>NewCompanyName</b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->Value[1]->Company[0]->CompanyName[0]->_)?></div></div>
</div><br /><br />
<h2 class="radius">Old Address</h2><br /><br />
<div class="gen_div">
<div><div class="left_div"><b>Street</b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->Value[0]->Company[0]->CompanyAddress[0]->Street)?></div></div>
<div><div class="left_div"><b>HouseNumber</b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->Value[0]->Company[0]->CompanyAddress[0]->HouseNumber)?></div></div>
<div><div class="left_div"><b>PostCode </b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->Value[0]->Company[0]->CompanyAddress[0]->PostCode)?></div></div>
<div><div class="left_div"><b>City </b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->Value[0]->Company[0]->CompanyAddress[0]->City)?></div></div>
<div><div class="left_div"><b>Country </b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->Value[0]->Company[0]->CompanyAddress[0]->Country)?></div></div>
</div><br /><br />
<h2 class="radius">New Address</h2><br /><br />
<div class="gen_div">
<div><div class="left_div"><b>Street</b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->Value[1]->Company[0]->CompanyAddress[0]->Street)?></div></div>
<div><div class="left_div"><b>HouseNumber</b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->Value[1]->Company[0]->CompanyAddress[0]->HouseNumber)?></div></div>
<div><div class="left_div"><b>PostCode </b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->Value[1]->Company[0]->CompanyAddress[0]->PostCode)?></div></div>
<div><div class="left_div"><b>City </b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->Value[1]->Company[0]->CompanyAddress[0]->City)?></div></div>
<div><div class="left_div"><b>Country </b></div> <div class="right_div"><?emp_check($report->Company->Event[0]->Value[1]->Company[0]->CompanyAddress[0]->Country)?></div></div>
</div>
<hr style="border:1px dotted silver" />
<?endforeach;?>
</div></div></div>

View File

@ -146,7 +146,7 @@ par
<td style='text-align: left'>
<?php
foreach ($merged_type as $monitor_type) {
echo "<a class='ev_code' title='".$monitor_type[0]->Company->Event[0]->EventCode."' href='/giant/retevents/Type/".$monitor_type[0]->Company->Event[0]->EventCode."'><p>".$monitor_type[0]->Company->Event[0]->EventCode."</p></a>";
echo "<a class='ev_code' title='".$monitor_type[0]->Company->Event[0]->EventCode."' href='/giant/retevents/Type/".$monitor_type[0]->Company->Event[0]->EventCode."/Id/".$monitor_type[0]->ProviderOrderId."'><p>".$monitor_type[0]->Company->Event[0]->EventCode."</p></a>";
} //Fin foreach?>
</td>