issue #0001623: multiple language request && new interface

This commit is contained in:
Arman KYOKCHAN 2013-05-17 14:03:45 +00:00
parent 8ce9664076
commit 8ade58d38e
8 changed files with 147 additions and 94 deletions

View File

@ -98,6 +98,7 @@ class GiantController extends Zend_Controller_Action
$id = $giantController->commande($this->getRequest()->getParam('CompanyId'),
$this->getRequest()->getParam('Type'),
$this->getRequest()->getParam('Pays'),
$this->getRequest()->getParam('Language'),
$this->TestIndication
);
$creditrecommendationAction = array('getAvisDeCredit' => 'CreditRecommendation');
@ -125,6 +126,7 @@ class GiantController extends Zend_Controller_Action
$id = $giantController->commande($this->getRequest()->getParam('CompanyId'),
$this->getRequest()->getParam('Type'),
$this->getRequest()->getParam('Pays'),
$this->getRequest()->getParam('Language'),
$this->TestIndication
);
$compactAction = array('getAvisDeCredit' => 'CreditRecommendation', 'getPositionFinanciere' => 'FinancialSummary',
@ -155,6 +157,7 @@ class GiantController extends Zend_Controller_Action
$id = $giantController->commande($this->getRequest()->getParam('CompanyId'),
$this->getRequest()->getParam('Type'),
$this->getRequest()->getParam('Pays'),
$this->getRequest()->getParam('Language'),
$this->TestIndication
);
$fullAction = array('getAvisDeCredit' => 'CreditRecommendation', 'getComptesAnnuels' => 'AnnualAccounts', 'getPositionFinanciere' => 'FinancialSummary',

View File

@ -11,7 +11,7 @@ class Application_Model_RapportsGiants extends Zend_Db_Table_Abstract
return ($result);
}
public function getReportByIdAndType($companyId, $type)
public function getReportByIdAndType($companyId, $type, $Language)
{
if($type == 'CR') {
$where = 'type="FU" or type="CO" or type="CR"';
@ -20,7 +20,8 @@ class Application_Model_RapportsGiants extends Zend_Db_Table_Abstract
}
else $where = 'type = "FU"';
$sql = $this->select()
->where('companyId = ? and '.$where, $companyId);
->where('companyId = ? and '.$where, $companyId)
->where('lang = ?', $Language);
$result = $this->getAdapter()->fetchRow($sql);
/*if($type == 'FU') {
$where = $this->getAdapter()->quoteInto('companyId = ? AND type = "CR" OR type = "CO"' , $companyId);

View File

@ -41,26 +41,36 @@
<?php if(!empty($this->listeRapport)):?>
<h1>Liste des rapports<img style="margin-top:4px;float:right" src="/themes/default/images/giant/expanded.gif" ></h1>
<div class="paragraph">
<div id="radio">
<table>
<tr>
<td></td>
<td style="word-spacing: 2px;" align="center">
<input disabled="disabled" type="radio" name="lang1" /><input type="radio" name="lang2" checked="true" />
</td>
<td></td>
</tr>
<?php $i=1; foreach ($this->listeRapport->DataSetOptions->DataSetOption as $rapport):?>
<tr id="info">
<td class="StyleInfoLib" width="300px">
<img style="cursor:help" title="<?php echo htmlentities($this->description->Full);?>" class="tooltip" src="/themes/default/images/giant/tag_blue.png" /> - Rapport de Type <?php echo $rapport->DataSetType->_?>
<td class="StyleInfoLib" style="float:left;" >
<img style="cursor:help" title="<?php echo htmlentities($this->description->Full);?>" class="tooltip" src="/themes/default/images/giant/tag_blue.png" /><input type="radio" class="radio" id="radio<?php echo $i; ?>" value="<?php echo $rapport->DataSetType->_?>" name="radio" /><label class="radio_but" for="radio<?php echo $i; ?>">Rapport de Type <?php echo $rapport->DataSetType->_?></label>
</td>
<td align="center" class="StyleInfoData" width="200px">
<?php foreach ($rapport->LanguageCodes->LanguageCode as $language):?>
<img src="/themes/default/images/drapeaux/<?=$language;?>.png" />
<?php endforeach;?>
<td align="center" class="StyleInfoData lang_img <?=strtolower($rapport->DataSetType->_);?>">
<div class="lang_select">
<select class="lang_val">
<?php foreach ($rapport->LanguageCodes->LanguageCode as $key=>$language):?>
<option class="lang<?=$key;?>" value=<?=$language;?>><?=$language;?></option>
<?php endforeach;?>
</select>
</div>
<div class="lang_select">
<img class='lang'src="/themes/default/images/drapeaux/<?=$rapport->LanguageCodes->LanguageCode[0]?>.png" />
</div>
</td>
<td class="StyleInfoData" width="300px">
<a id="r<?php echo $i?>" class="idpr" href="/giant/<?=strtolower($rapport->DataSetType->_)?>/Pays/<?=$this->Pays; ?>/Type/<?php echo $rapport->DataSetType->_?>/CompanyId/<?php echo $this->CompanyId;?>/Language/en<?php //echo $language;?>" >Consulter le rapport en immédiat</a>
<td class="StyleInfoData lang_img <?=strtolower($rapport->DataSetType->_);?>">
<a id="r<?php echo $i?>" class="idpr" href="/giant/<?=strtolower($rapport->DataSetType->_)?>/Pays/<?=$this->Pays; ?>/Type/<?php echo $rapport->DataSetType->_?>/CompanyId/<?php echo $this->CompanyId;?>/Language/<?=$rapport->LanguageCodes->LanguageCode[0];?>" >Consulter le rapport en immédiat</a>
<div id="pr<?php echo $i?>" class="hide" style="display:none;">
<center><img style="padding-top:30%" src="/themes/default/images/giant/19-1.gif" /></center>
</div>
@ -69,7 +79,7 @@
<?php $i++;?>
<?php endforeach;?>
</table>
</div>
</div></div>
<?php endif; ?>
<?php if(!empty($this->listeRapport->InvestigationOptions)): ?>
<h1>Liste des investigations<img style="margin-top:4px;float:right" src="/themes/default/images/giant/expanded.gif" ></h1>

View File

@ -19,7 +19,7 @@ Class GiantControllerLib
}
public function commande($CompanyId, $Type, $Pays, $TestIndication)
public function commande($CompanyId, $Type, $Pays, $Language, $TestIndication)
{
$function = new GiantFunction();
$Utilisateur = new Scores_Utilisateur();
@ -27,18 +27,19 @@ Class GiantControllerLib
$Rapport = new Rapports($Pays, $TestIndication);
$CommandeP = new stdClass();
$id = $Rapport->getRapportExist($CompanyId, $Type);
$id = $Rapport->getRapportExist($CompanyId, $Type, $Language);
$report_id = $Rapport->getRapportExistId($CompanyId, $Type);
if(empty($id)) {
$rapport = new GiantRechercheController($Pays, $TestIndication);
$result = $rapport->GetRapport($CompanyId, $Type);
$result = $rapport->GetRapport($CompanyId, $Type, $Language);
$result = base64_encode(serialize($result));
$id = $Rapport->setReport($CompanyId,
$Type,
$Pays,
$result);
$result,
$Language);
$report_id = $Rapport->getRapportExistId($CompanyId, $Type);
}
@ -48,6 +49,7 @@ Class GiantControllerLib
$CommandeP->price = 0;
$CommandeP->pays = strtolower($Pays);
$CommandeP->rapportId = $report_id[0]['id'];
//$CommandeP->lang = $Utilisateur->getLang();
/*echo'<pre>';
print_r($report_id);
echo'</pre>';
@ -221,11 +223,11 @@ Class GiantRechercheController extends GiantFunction
return (false);
}
public function GetRapport($CompanyId, $DataSetType)
public function GetRapport($CompanyId, $DataSetType, $Language)
{
$this->CreditData = new CreditData($this->soapG, $CompanyId);
$result = $this->CreditData->getMethode('OrderDataSet', array($DataSetType));
$result = $this->CreditData->getMethode('RetrieveDataSet', array($result->Order->ProviderOrderId));
$result = $this->CreditData->getMethode('OrderDataSet', array($DataSetType, $Language));
$result = $this->CreditData->getMethode('RetrieveDataSet', array($result->Order->InternalOrderId));
return ($result);
}

View File

@ -1,89 +1,91 @@
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
* and open the template in the editor.
*/
Class Commandes
{
protected $enumerations = array('Full' => 'FU', 'Compact' => 'CO', 'CreditRecommendation' => 'CR');
public function __construct()
{
}
public function __construct()
{
}
public function setCommandes($parametres)
{
$commandes = new Application_Model_CommandesGiants();
$data = array( 'login' => $parametres->login,
'date' => $parametres->date,
'typeReport' => $parametres->typeReport,
'price' => $parametres->price,
'pays' => $parametres->pays,
'rapportId' => $parametres->rapportId
);
$commandes->insert($data);
}
public function getCommandesByLogin($login)
{
$commandes = new Application_Model_CommandesGiants();
return ($commandes->getCommandesGiantByLogin($login));
}
public function setCommandes($parametres)
{
$commandes = new Application_Model_CommandesGiants();
$data = array( 'login' => $parametres->login,
'date' => $parametres->date,
'typeReport' => $parametres->typeReport,
'price' => $parametres->price,
'pays' => $parametres->pays,
'rapportId' => $parametres->rapportId,
//'lang' => $parametres->lang
);
$commandes->insert($data);
}
public function getCommandesByLogin($login)
{
$commandes = new Application_Model_CommandesGiants();
return ($commandes->getCommandesGiantByLogin($login));
}
public function getCommandesByDate($date)
{
$commandes = new Application_Model_CommandesGiants();
return ($commandes->getCommandesGiantByDate($date));
}
public function getCommandesByDate($date)
{
$commandes = new Application_Model_CommandesGiants();
return ($commandes->getCommandesGiantByDate($date));
}
public function getCommandesByLoginAndDate($login, $date)
{
$commandes = new Application_Model_CommandesGiants();
return ($commandes->getCommandesGiantByLoginAndDate($login, $date));
}
public function getCommandesByLoginAndDate($login, $date)
{
$commandes = new Application_Model_CommandesGiants();
return ($commandes->getCommandesGiantByLoginAndDate($login, $date));
}
public function getCommandeExistToday($login, $date, $type, $pays)
{
$commande = new Application_Model_CommandesGiants();
$result = $commande->getCommandesGiantLoginDateReportType($login, $date, $type, $pays);
if(!empty($result))
return (true);
return (false);
}
public function getCommandeExistToday($login, $date, $type, $pays)
{
$commande = new Application_Model_CommandesGiants();
$result = $commande->getCommandesGiantLoginDateReportType($login, $date, $type, $pays);
if(!empty($result))
return (true);
return (false);
}
}
Class Rapports
{
protected $enumerations = array('Full' => 'FU', 'Compact' => 'CO', 'CreditRecommendation' => 'CR');
protected $enumerations = array('Full' => 'FU', 'Compact' => 'CO', 'CreditRecommendation' => 'CR');
public function __construct($countryCode, $TestIndication)
{
}
public function __construct($countryCode, $TestIndication)
{
}
public function setReport($companyId, $type, $pays, $reportSerial)
{
$report = new Application_Model_RapportsGiants();
public function setReport($companyId, $type, $pays, $reportSerial, $Language)
{
$report = new Application_Model_RapportsGiants();
$datas = array('companyId' => $companyId,
'date' => date('Y-m-d'),
'pays' => $pays,
'type' => $this->enumerations[$type],
'report' => $reportSerial
);
$report->insert($datas);
return ($reportSerial);
}
'date' => date('Y-m-d'),
'pays' => $pays,
'type' => $this->enumerations[$type],
'report' => $reportSerial,
'lang' => $Language
);
$report->insert($datas);
return ($reportSerial);
}
public function getRapportExist($companyId, $type)
{
$rapports = new Application_Model_RapportsGiants();
$id = $rapports->getReportByIdAndType($companyId, $this->enumerations[$type]);
return ($id);
}
public function getRapportExist($companyId, $type, $Language)
{
$rapports = new Application_Model_RapportsGiants();
$id = $rapports->getReportByIdAndType($companyId, $this->enumerations[$type], $Language);
return ($id);
}
public function getRapportExistId($companyId, $type)
{
$rapports = new Application_Model_RapportsGiants();
$id = $rapports->getReportById($companyId);
return ($id);
}
public function getRapportExistId($companyId, $type)
{
$rapports = new Application_Model_RapportsGiants();
$id = $rapports->getReportById($companyId);
return ($id);
}
}
?>

View File

@ -166,7 +166,7 @@ Class CreditData extends GiantFunction
return ($result);
}
protected function OrderDataSet($DataSetType, $Version = null, $LanguageCode = 'en')
protected function OrderDataSet($DataSetType, $LanguageCode, $Version = null)
{
$parametres = new stdClass();
$parametres->CompanyId = $this->companyId;

View File

@ -10,7 +10,6 @@ $(document).ready( function()
$('#p'+n).css('display', 'none');
}
});
$('.tooltip').each(function(){
var title = $(this).attr('title');
var width = $(this).attr('wdth');
@ -22,4 +21,22 @@ $(document).ready( function()
position: { at: "bottom center", my: "top center" }
});
});
$(function() {
$( "#radio" ).buttonset();
});
$('.radio').on('click', function() {
$('.lang_img').fadeOut();
$.alink = this.value.toLowerCase();
$.alink_h = this.value;
$(".idpr").attr("href","/giant/"+$.alink+"/Pays/"+location.pathname.match(/\/Pays\/([^\/]+)/)[1]+"/Type/"+$.alink_h+"/CompanyId/"+location.pathname.match(/\/CompanyId\/([^\/]+)/)[1]+"/Language/"+$('.lang0').text().substr($('.lang0').text().length - 2));
$(".lang").attr("src","/themes/default/images/drapeaux/"+$('.lang0').text().substr($('.lang0').text().length - 2)+".png");
$(".lang_val").val($('.lang0').text().substr($('.lang0').text().length - 2));
$('.'+$.alink+'').fadeIn(500);
});
$('select').on('change', function() {
$('.lang_img').fadeOut();
$(".idpr").attr("href","/giant/"+$.alink+"/Pays/"+location.pathname.match(/\/Pays\/([^\/]+)/)[1]+"/Type/"+$.alink_h+"/CompanyId/"+location.pathname.match(/\/CompanyId\/([^\/]+)/)[1]+"/Language/"+this.value);
$(".lang").attr("src","/themes/default/images/drapeaux/"+this.value+".png");
$('.'+$.alink+'').fadeIn(500);
});
});

View File

@ -254,3 +254,21 @@
width: 691px;
opacity:0.3;
}
.radio_but
{
width: 295px;
}
.lang_img
{
display: none;
float:right;
margin-left:3px;
}
.lang_select
{
float:right;
margin-left:3px;
}