issue #0001700: log Options using zend cache
This commit is contained in:
parent
8d02ead01f
commit
efcd9b8394
@ -76,8 +76,7 @@ class GiantController extends Zend_Controller_Action
|
|||||||
$liste = $giantFunction->divCommande($listeCommandes, $total);
|
$liste = $giantFunction->divCommande($listeCommandes, $total);
|
||||||
$ListeRapport = new GiantRechercheController($params['pays'], $this->TestIndication);
|
$ListeRapport = new GiantRechercheController($params['pays'], $this->TestIndication);
|
||||||
$giantController = new GiantControllerLib($this->getRequest()->getParam('CompanyId'));
|
$giantController = new GiantControllerLib($this->getRequest()->getParam('CompanyId'));
|
||||||
$resultDB = $giantController->commandePays($this->getRequest()->getParam('CompanyId'),$params['pays'], $this->TestIndication);
|
$result = $giantController->commandePays($this->getRequest()->getParam('CompanyId'),$params['pays'], $this->TestIndication);
|
||||||
$result = unserialize($resultDB);
|
|
||||||
$this->view->total = $total;
|
$this->view->total = $total;
|
||||||
$this->view->listeCommandes = $liste;
|
$this->view->listeCommandes = $liste;
|
||||||
$this->view->modification = (isset($result->MonitoringOptions))?($ListeRapport->getModification($result->MonitoringOptions->MonitoringOption[0])):null;
|
$this->view->modification = (isset($result->MonitoringOptions))?($ListeRapport->getModification($result->MonitoringOptions->MonitoringOption[0])):null;
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* To change this template, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class Application_Model_PaysGiants extends Zend_Db_Table_Abstract
|
|
||||||
{
|
|
||||||
protected $_name = 'pays_giants';
|
|
||||||
public function getPays($pays)
|
|
||||||
{
|
|
||||||
$sql = $this->select()
|
|
||||||
->where('pays = ?', $pays);
|
|
||||||
$result = $this->getAdapter()->fetchRow($sql);
|
|
||||||
return ($result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
@ -10,10 +10,13 @@ require_once ('Partials.php');
|
|||||||
|
|
||||||
Class GiantControllerLib
|
Class GiantControllerLib
|
||||||
{
|
{
|
||||||
private $pathImg;
|
|
||||||
|
private $pathImg;
|
||||||
|
protected $configVal = array();
|
||||||
|
|
||||||
public function __construct($companyId)
|
public function __construct($companyId)
|
||||||
{
|
{
|
||||||
|
$this->configVal = new Zend_Config_Ini( realpath(dirname(__FILE__)).'/giant_config.ini' );
|
||||||
$c = Zend_Registry::get('config');
|
$c = Zend_Registry::get('config');
|
||||||
$this->pathImg = $c->profil->path->pages.'/imgcache/'.$companyId;
|
$this->pathImg = $c->profil->path->pages.'/imgcache/'.$companyId;
|
||||||
}
|
}
|
||||||
@ -29,58 +32,64 @@ Class GiantControllerLib
|
|||||||
|
|
||||||
switch ($Utilisateur->getIdClient()) {
|
switch ($Utilisateur->getIdClient()) {
|
||||||
case '0':
|
case '0':
|
||||||
$price = 0;
|
$price = $this->configVal->price->test;
|
||||||
break;
|
break;
|
||||||
case '1':
|
case '1':
|
||||||
$price = 7;
|
$price = $this->configVal->price->snd;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$price = 10;
|
$price = $this->configVal->price->other;
|
||||||
}
|
}
|
||||||
$id = $Rapport->getRapportExist($CompanyId, $Type, $Language);
|
$id = $Rapport->getRapportExist($CompanyId, $Type, $Language);
|
||||||
if(empty($id)) {
|
if(empty($id)) {
|
||||||
$rapport = new GiantRechercheController($Pays, $TestIndication);
|
$rapport = new GiantRechercheController($Pays, $TestIndication);
|
||||||
$result = $rapport->GetRapport($CompanyId, $Type, $Language);
|
$result = $rapport->GetRapport($CompanyId, $Type, $Language);
|
||||||
$result = base64_encode(serialize($result));
|
if (!empty($result)) {
|
||||||
$id = $Rapport->setReport($CompanyId,
|
$result = base64_encode(serialize($result));
|
||||||
$Type,
|
$id = $Rapport->setReport($CompanyId,
|
||||||
$Pays,
|
$Type,
|
||||||
$result,
|
$Pays,
|
||||||
$Language);
|
$result,
|
||||||
|
$Language);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$report_id = $Rapport->getRapportExistId($CompanyId, $Language);
|
$report_id = $Rapport->getRapportExistId($CompanyId, $Language);
|
||||||
|
if (!empty($report_id)) {
|
||||||
$CommandeP->login = $Utilisateur->getLogin();
|
$CommandeP->login = $Utilisateur->getLogin();
|
||||||
$CommandeP->date = date("Y-m-d");
|
$CommandeP->date = date("Y-m-d");
|
||||||
$CommandeP->typeReport = $function->getTypeReport($Type);
|
$CommandeP->typeReport = $function->getTypeReport($Type);
|
||||||
$CommandeP->price = $price;
|
$CommandeP->price = $price;
|
||||||
$CommandeP->pays = strtolower($Pays);
|
$CommandeP->pays = strtolower($Pays);
|
||||||
$CommandeP->rapportId = $report_id[0]['id'];
|
$CommandeP->rapportId = $report_id[0]['id'];
|
||||||
//$CommandeP->lang = $Utilisateur->getLang();
|
//$CommandeP->lang = $Utilisateur->getLang();
|
||||||
/*echo'<pre>';
|
/*echo'<pre>';
|
||||||
print_r($report_id);
|
print_r($report_id);
|
||||||
echo'</pre>';
|
echo'</pre>';
|
||||||
if(!$Commande->getCommandeExistToday($CommandeP->login, $CommandeP->date, $CommandeP->typeReport, $CommandeP->pays)) {
|
if(!$Commande->getCommandeExistToday($CommandeP->login, $CommandeP->date, $CommandeP->typeReport, $CommandeP->pays)) {
|
||||||
$Commande->setCommandes($CommandeP);
|
$Commande->setCommandes($CommandeP);
|
||||||
}*/
|
}*/
|
||||||
$Commande->setCommandes($CommandeP);
|
$Commande->setCommandes($CommandeP);
|
||||||
|
}
|
||||||
return ($id);
|
return ($id);
|
||||||
}
|
}
|
||||||
public function commandePays($CompanyId,$Pays,$TestIndication)
|
public function commandePays($CompanyId,$Pays,$TestIndication)
|
||||||
{
|
{
|
||||||
$Rapport = new Rapports($Pays, $TestIndication);
|
$frontendOptions = array(
|
||||||
$id = $Rapport->getPaysExist($Pays)['result'];
|
'lifetime' => $this->configVal->cache->lifetime,
|
||||||
if(empty($id)) {
|
'automatic_serialization' => true
|
||||||
|
);
|
||||||
|
$backendOptions = array('cache_dir' => '../data/cache/giant/');
|
||||||
|
$cache = Zend_Cache::factory('Output','File',$frontendOptions,$backendOptions);
|
||||||
|
if(($result = $cache->load('Pays_'.$Pays)) === false) {
|
||||||
$rapport = new GiantRechercheController($Pays, $TestIndication);
|
$rapport = new GiantRechercheController($Pays, $TestIndication);
|
||||||
$result = $rapport->ListeRapport($CompanyId);
|
$result = $rapport->ListeRapport($CompanyId);
|
||||||
$result = serialize($result);
|
if (!empty($result)) {
|
||||||
$id = $Rapport->setPaysReport($Pays,$result);
|
$cache->save($result, 'Pays_'.$Pays);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ($id);
|
return ($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function startmonitoring($CompanyId, $CategorieName, $EventType, $PreferredStartDate, $PreferredEndDate, $Version, $LanguageCode,$Pays,$TestIndication,$CompanyName)
|
public function startmonitoring($CompanyId, $CategorieName, $EventType, $PreferredStartDate, $PreferredEndDate, $Version, $LanguageCode,$Pays,$TestIndication,$CompanyName)
|
||||||
{
|
{
|
||||||
$Utilisateur = new Scores_Utilisateur();
|
$Utilisateur = new Scores_Utilisateur();
|
||||||
@ -148,7 +157,7 @@ Class GiantControllerLib
|
|||||||
$result = $rapport->GetRetriveMonitoring($CompanyId, $StartFrom,$InternalOrderId,$EventType);
|
$result = $rapport->GetRetriveMonitoring($CompanyId, $StartFrom,$InternalOrderId,$EventType);
|
||||||
return ($result);
|
return ($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function retrivDB($date_st)
|
public function retrivDB($date_st)
|
||||||
{
|
{
|
||||||
$Rapport = new Rapports();
|
$Rapport = new Rapports();
|
||||||
|
@ -108,16 +108,6 @@ Class Rapports
|
|||||||
$report->insert($datas);
|
$report->insert($datas);
|
||||||
return ($reportSerial);
|
return ($reportSerial);
|
||||||
}
|
}
|
||||||
public function setPaysReport($pays, $reportSerial)
|
|
||||||
{
|
|
||||||
$report = new Application_Model_PaysGiants();
|
|
||||||
$datas = array('date' => date('Y-m-d'),
|
|
||||||
'pays' => $pays,
|
|
||||||
'result' => $reportSerial,
|
|
||||||
);
|
|
||||||
$report->insert($datas);
|
|
||||||
return ($reportSerial);
|
|
||||||
}
|
|
||||||
public function getRapportExist($companyId, $type, $Language)
|
public function getRapportExist($companyId, $type, $Language)
|
||||||
{
|
{
|
||||||
$rapports = new Application_Model_RapportsGiants();
|
$rapports = new Application_Model_RapportsGiants();
|
||||||
@ -130,12 +120,6 @@ Class Rapports
|
|||||||
$id = $rapports->getReportById($companyId, $Language);
|
$id = $rapports->getReportById($companyId, $Language);
|
||||||
return ($id);
|
return ($id);
|
||||||
}
|
}
|
||||||
public function getPaysExist($pays)
|
|
||||||
{
|
|
||||||
$rapports = new Application_Model_PaysGiants();
|
|
||||||
$id = $rapports->getPays($pays);
|
|
||||||
return ($id);
|
|
||||||
}
|
|
||||||
public function getRetrive($date_st)
|
public function getRetrive($date_st)
|
||||||
{
|
{
|
||||||
$rapports = new Application_Model_MonitoringGiants();
|
$rapports = new Application_Model_MonitoringGiants();
|
||||||
|
6
library/Giant/giant_config.ini
Normal file
6
library/Giant/giant_config.ini
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[price]
|
||||||
|
test = "0"
|
||||||
|
snd = "7"
|
||||||
|
other = "10"
|
||||||
|
[cache]
|
||||||
|
lifetime = "30"
|
Loading…
Reference in New Issue
Block a user