From 18e8a54f05f192ad5a6445c804fac96fb91daa5b Mon Sep 17 00:00:00 2001 From: Arman KYOKCHAN Date: Wed, 28 Aug 2013 14:05:43 +0000 Subject: [PATCH] issue #0001687: storing data to session --- application/controllers/GiantController.php | 45 +++++++++++-------- .../default/scripts/giant/retevents.phtml | 45 +++---------------- .../views/default/scripts/giant/retrive.phtml | 4 +- public/themes/default/scripts/giant.js | 1 - 4 files changed, 35 insertions(+), 60 deletions(-) diff --git a/application/controllers/GiantController.php b/application/controllers/GiantController.php index 8bf2d88a3..94c48e595 100644 --- a/application/controllers/GiantController.php +++ b/application/controllers/GiantController.php @@ -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]; } } \ No newline at end of file diff --git a/application/views/default/scripts/giant/retevents.phtml b/application/views/default/scripts/giant/retevents.phtml index e0763801f..c0cf14a39 100644 --- a/application/views/default/scripts/giant/retevents.phtml +++ b/application/views/default/scripts/giant/retevents.phtml @@ -1,5 +1,5 @@
-

SURVEILLANCE

+

Events

source) ){ @@ -7,12 +7,9 @@ if ( empty($this->source) ){ - - - - - + +
Nombre d'entités affichéesresult->MonitoringEvents->MonitoringEvent)?>
Nombre de surveillancesval)?>result)?>
source) ){ -

Options de recherche

- -
- - -
-
-Tri - -par - -
- -
-
-" /> - -
-
-

Liste des surveillances

+ +

Liste des Evénements

curPage>=1) { ?>
"; + echo "

".$monitor_type->Company->Event[0]->EventCode."

"; } //Fin foreach?> diff --git a/public/themes/default/scripts/giant.js b/public/themes/default/scripts/giant.js index 2742d7d3f..969500991 100644 --- a/public/themes/default/scripts/giant.js +++ b/public/themes/default/scripts/giant.js @@ -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,