issue #0001687: storing data to session

This commit is contained in:
Arman KYOKCHAN 2013-08-28 14:05:43 +00:00
parent 6eb3063e40
commit 18e8a54f05
4 changed files with 35 additions and 60 deletions

View File

@ -334,13 +334,22 @@ class GiantController extends Zend_Controller_Action
{
$this->view->headScript()->appendFile('/themes/default/scripts/giant_monitoring.js', 'text/javascript');
$giantController = new GiantControllerLib();
$auth = Zend_Auth::getInstance();
if ( $auth->hasIdentity() ) {
$identity = $auth->getIdentity();
}
$result = $auth->getStorage()->read($identity);
if(!empty($result->result->mon_result)){
$result = $result->result->mon_result;
}
else{
$result = $giantController->retrive(1,$this->TestIndication,'RetrieveMonitoringEventsForCustomer');
$sess = new stdClass();
$sess->mon_result = $result;
$identity->result = $sess;
$auth->getStorage()->write($identity);
}
$resultDB = $giantController->retrivDB();
$result = $giantController->retrive(
1,
$this->TestIndication,
'RetrieveMonitoringEventsForCustomer'
);
$this->view->resultDB = $resultDB;
$this->view->result = $result;
$merged =Array();
@ -363,15 +372,8 @@ class GiantController extends Zend_Controller_Action
endforeach;
$this->view->val_siren = $merged_siren;
$sess = new stdClass();
$sess->mon_result = $result;
$auth = Zend_Auth::getInstance();
if ( $auth->hasIdentity() ) {
$identity = $auth->getIdentity();
}
$identity->result = $sess;
$auth->getStorage()->write($identity);
}
public function retAction()
{
@ -385,9 +387,16 @@ class GiantController extends Zend_Controller_Action
$auth = Zend_Auth::getInstance();
$identity = $auth->getIdentity();
$result = $auth->getStorage()->read($identity);
$this->view->result = $result->result->mon_result;
unset($identity->result);
$auth->getStorage()->write($identity);
$result = $result->result->mon_result;
$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) ;
} else {
$merged_siren[$MonitoringEvent->Company->Event[0]->EventCode][]=$MonitoringEvent;
}
endforeach;
$type = $this->getRequest()->getParam('Type');
$this->view->result = $merged_siren[$type];
}
}

View File

@ -1,5 +1,5 @@
<div id="center">
<h1 class="titre">SURVEILLANCE</h1>
<h1 class="titre">Events</h1>
<div class="paragraph">
<?php
if ( empty($this->source) ){
@ -7,12 +7,9 @@ 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>
<td><?=count($this->result)?></td>
</tr>
</table>
<?php
} else {
@ -30,40 +27,10 @@ if ( empty($this->source) ){
<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>
<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))?>"
@ -95,7 +62,7 @@ par
<th width="110">Envoyé le</th>
</tr>
</thead>
<tbody>
<tbody><pre><? print_r($this->result);?></pre>
<?php foreach ($this->val_siren as $monitor) {?>
<pre><? //print_r($monitor);?></pre>
<tr>

View File

@ -1,5 +1,5 @@
<div id="center">
<h1 class="titre">SURVEILLANCE</h1>
<h1 class="titre">Surveillances</h1>
<div class="paragraph">
<?php
if ( empty($this->source) ){
@ -108,7 +108,7 @@ par
<td style='text-align: left'>
<?php
foreach ($monitor as $monitor_type) {
echo "<a class='ev_code' value='".serialize($monitor_type)."' title='".$monitor_type->Company->Event[0]->EventCode."' href='/giant/retevents/Type/".$monitor_type->Company->Event[0]->EventCode."'><p>".$monitor_type->Company->Event[0]->EventCode."</p></a>";
echo "<a class='ev_code' title='".$monitor_type->Company->Event[0]->EventCode."' href='/giant/retevents/Type/".$monitor_type->Company->Event[0]->EventCode."'><p>".$monitor_type->Company->Event[0]->EventCode."</p></a>";
} //Fin foreach?>
</td>
<td>

View File

@ -4,7 +4,6 @@ $(document).ready( function()
e.preventDefault();
var title = $(this).attr('title');
var href = $(this).attr('href');
alert($(this).attr('value'));
var dlgOpts = {
bgiframe: true,
title: title,