issue #0001700: log Options using zend cache

This commit is contained in:
Arman KYOKCHAN 2013-09-13 14:01:17 +00:00
parent e79e6ff610
commit 29f94037b0
7 changed files with 45 additions and 18 deletions

View File

@ -229,8 +229,7 @@ class GiantController extends Zend_Controller_Action
{
$this->_helper->layout()->disableLayout();
$this->view->headLink()->appendStylesheet('/themes/default/styles/giant.css', 'all');
$form = new Application_Form_RechercheEntreprise();
$this->view->assign('form', $form);
$this->view->headScript()->appendFile('/themes/default/scripts/giant.js', 'text/javascript');
$this->view->lang = $this->getRequest()->getParam('lang');
$this->view->CompanyId = $this->getRequest()->getParam('CompanyId');
$this->view->Pays = $this->getRequest()->getParam('Pays');
@ -377,7 +376,7 @@ class GiantController extends Zend_Controller_Action
endforeach;
$this->view->val_siren = $merged_siren;
}
public function retAction()
{
@ -385,6 +384,18 @@ class GiantController extends Zend_Controller_Action
$resultDB = $giantController->retrivDB($this->getRequest()->getParam('date_st'));
print_r(serialize($resultDB[0]));
}
public function getpaysAction()
{
$this->_helper->layout()->disableLayout();
$pays = $this->getRequest()->getParam('Pays');
$result = new GiantControllerLib();
if(($value = $result->getCache($pays)) === false || empty($value->MonitoringOptions->MonitoringOption[0]->LanguageCodes->LanguageCode)) {
print_r(array('no'));
}
else {
print_r($value->MonitoringOptions->MonitoringOption[0]->LanguageCodes->LanguageCode);
}
}
public function reteventsAction()
{
$this->_helper->layout()->disableLayout();
@ -404,7 +415,7 @@ class GiantController extends Zend_Controller_Action
endforeach;
$type = $this->getRequest()->getParam('Type');
$id = $this->getRequest()->getParam('Id');
$merged = Array();
foreach ($merged_siren[$type] as $MonitoringEvent):
if ($merged[$MonitoringEvent->ProviderOrderId]){

View File

@ -30,16 +30,13 @@ if ( empty($this->source) ){
<h2>Options de surveillances</h2>
<div class='monitor_but'>
<a class="dial" title="Start Monitoring" href='/giant/startmonitoring/CompanyId/<?=$this->CompanyId?>/Pays/<?=$this->Pays?>/lang/<?=serialize($this->listeRapport->MonitoringOptions->MonitoringOption[0]->LanguageCodes->LanguageCode)?>/CompanyName/<?=str_replace(' ', '+', $this->raisonSociale)?>'>Start monitoring</a>
<a class="dial" title="Stop Monitoring" href='/giant/stopmonitoring/CompanyId/<?=$this->CompanyId?>/Pays/<?=$this->Pays?>/CompanyName/<?=str_replace(' ', '+', $this->raisonSociale)?>'>Stop monitoring</a>
<a class="dial" title="Update Monitoring" href='/giant/updatemonitoring/CompanyId/<?=$this->CompanyId?>/Pays/<?=$this->Pays?>/lang/<?=serialize($this->listeRapport->MonitoringOptions->MonitoringOption[0]->LanguageCodes->LanguageCode)?>/CompanyName/<?=str_replace(' ', '+', $this->raisonSociale)?>'>Update monitoring</a>
</div>
<h2>Liste des surveillances</h2>
<div class='monitor_but'>
<a class="dial" title="Start Monitoring" href='/giant/startmonitoring/CompanyId/<?=$this->CompanyId?>/Pays/<?=$this->Pays?>/lang/<?=serialize($this->listeRapport->MonitoringOptions->MonitoringOption[0]->LanguageCodes->LanguageCode)?>/CompanyName/<?=str_replace(' ', '+', $this->raisonSociale)?>'>Start New Monitoring</a>
</div>
<div class="paragraph">
<table class="tablesorter" id="surveillance" width="570">

View File

@ -77,4 +77,5 @@
</div>
<?endif?>
</div>
<script type="text/javascript" src="/themes/default/scripts/giant_monitoring.js" />
<script type="text/javascript" src="/themes/default/scripts/giant_monitoring.js" />
<script type="text/javascript" src="/themes/default/scripts/giant.js" />

View File

@ -10,10 +10,10 @@ require_once ('Partials.php');
Class GiantControllerLib
{
private $pathImg;
protected $configVal = array();
public function __construct($companyId)
{
$this->configVal = new Zend_Config_Ini( realpath(dirname(__FILE__)).'/giant_config.ini' );
@ -21,7 +21,13 @@ Class GiantControllerLib
$this->pathImg = $c->profil->path->pages.'/imgcache/'.$companyId;
}
public function getCache($pays){
$frontendOptions = array('lifetime' => $this->configVal->cache->lifetime,'automatic_serialization' => true);
$backendOptions = array('cache_dir' => '../data/cache/giant/');
$cache = Zend_Cache::factory('Output','File',$frontendOptions,$backendOptions);
$result = $cache->load('Pays_'.$pays);
return ($result);
}
public function commande($CompanyId, $Type, $Pays, $Language, $TestIndication)
{
$function = new GiantFunction();

View File

@ -19,7 +19,18 @@ $(document).ready( function()
$('<div id="dial"></div>').dialog(dlgOpts);
return false;
});
function getPays(){
$('select[name=LanguageCode]').fadeOut();
$("select[name=Pays] option:selected").each(function () {
var values = $(this).attr('value');
//alert(values);
$.post('/giant/getpays',{Pays: values}, function(data) {
alert(data);
});
});
$('select[name=LanguageCode]').fadeIn(500);
}
getPays();
$('.idpr,.id_cr').on('click', function(){
//e.preventDefault();
var n = $(this).attr('id');
@ -60,7 +71,9 @@ $(document).ready( function()
$(".lang").attr("src","/themes/default/images/drapeaux/"+this.value+".png");
$('.'+$.alink+'').fadeIn(500);
});
$('select[name=Pays]').on('change', function() {
getPays();
});
$(function() {
$( ".monitor_but a,.retrive_but a" )
.button();

View File

@ -334,7 +334,6 @@
.monitor_but {
width: 448px;
margin: 0 auto;
}
.monitor_but a {