Modification de giant

Création des acces au rapport ! + library réutilisable.
This commit is contained in:
Damien LASSERRE 2011-07-04 15:26:22 +00:00
parent 01de3df80d
commit c8ef0d9d17
9 changed files with 178 additions and 33 deletions

View File

@ -6,6 +6,8 @@ require_once ('Giant/CreditData.lib.php');
require_once ('Giant/Controller/RechercheController.php');
require_once ('Scores/Utilisateur.php');
require_once ('Giant/Functions.php');
require_once ('Giant/Controller/GiantController.php');
require_once ('Giant/Controller/IdentiteController.php');
class GiantController extends Zend_Controller_Action
{
@ -68,23 +70,20 @@ class GiantController extends Zend_Controller_Action
$this->view->soap = $ListeRapport->soapG;
}
public function fullAction()
public function rapportAction()
{
}
public function compactAction()
{
}
public function creditAction()
{
}
public function flexAction()
{
$rechercheParams = new RechercheHistorique();
if (count($rechercheParams->liste()) > 0)
{
$recherche = $rechercheParams->item(0);
$type = $recherche['type'];
$params = $recherche['params'];
}
$Full = new GiantRechercheController($params['pays'], $this->TestIndication);
$result = $Full->GetRapport($this->getRequest()->getParam('CompanyId'), $this->getRequest()->getParam('Type'));
$identiteController = new GiantIdentiteController($result);
$identiteController->ficheAction();
$this->view->fiche = $identiteController->getObjet('fiche');
}
}

View File

@ -1 +0,0 @@
<?php

View File

@ -5,7 +5,7 @@
</style>
<div id="center">
<span style="margin-right:5px;float: right;"><a class="tooltip" href="" title="<?php echo $this->modification?>">Dernières modifications au <?php echo date('d/m/Y'); ?></a></span>
<span style="margin-right:5px;float: right;"><a style="cursor:help;" class="tooltip" href="" title="<?php echo $this->modification?>">Dernières modifications au <?php echo date('d/m/Y'); ?></a></span>
<h1>Identite</h1>
<div class="paragraph">
<div id="identite">
@ -59,7 +59,7 @@
<?php endforeach;?>
</td>
<td class="StyleInfoData" width="300px">
<a id="r<?php echo $i?>" class="idpr" href="" >Consulter le rapport en immédiat</a>
<a id="r<?php echo $i?>" class="idpr" href="/giant/rapport/Type/<?php echo $rapport->DataSetType->_?>/CompanyId/<?php echo $this->CompanyId;?>/Version//Language/<?php echo $language;?>" >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>

View File

@ -0,0 +1,66 @@
<table>
<tr id="info">
<td width="30px"></td>
<td class="StyleInfoLib" width="250px">CompanyId</td>
<td class="StyleInfoData" width="300px"><?php echo $this->fiche['CompanyId'];?></td>
</tr>
<tr id="info">
<td width="30px"></td>
<td class="StyleInfoLib" width="250px">Vat</td>
<td class="StyleInfoData" width="300px"><?php echo $this->fiche['Vat']->VatNumber;?></td>
</tr>
<tr id="info">
<td width="30px"></td>
<td class="StyleInfoLib" width="250px">CompanyName</td>
<td class="StyleInfoData" width="300px"><?php echo $this->fiche['CompanyName']->_;?></td>
</tr>
<tr id="info">
<td width="30px"></td>
<td class="StyleInfoLib" width="250px">CompanyStatus</td>
<td class="StyleInfoData" width="300px"><?php echo $this->fiche['CompanyStatus'];?></td>
</tr>
<tr id="info">
<td width="30px"></td>
<td class="StyleInfoLib" width="250px">CompanyAddress</td>
<td class="StyleInfoData" width="300px">
<?php echo $this->fiche['CompanyAddress']->HouseNumber;?> <?php echo $this->fiche['CompanyAddress']->Street;?><br />
<?php echo $this->fiche['CompanyAddress']->PostCode;?> <?php echo $this->fiche['CompanyAddress']->City;?>
</td>
</tr>
<tr id="info">
<td width="30px"></td>
<td class="StyleInfoLib" width="250px">TelephoneNumber</td>
<td class="StyleInfoData" width="300px"><?php echo $this->fiche['TelephoneNumber']->_;?></td>
</tr>
<tr id="info">
<td width="30px"></td>
<td class="StyleInfoLib" width="250px">Telefax</td>
<td class="StyleInfoData" width="300px"><?php echo $this->fiche['Telefax'];?></td>
</tr>
<tr id="info">
<td width="30px"></td>
<td class="StyleInfoLib" width="250px">WebAddress</td>
<td class="StyleInfoData" width="300px"><?php echo $this->fiche['WebAddress'];?></td>
</tr>
<tr id="info">
<td width="30px"></td>
<td class="StyleInfoLib" width="250px">EmailAddress</td>
<td class="StyleInfoData" width="300px"><a href="mailto:"><?php echo $this->fiche['EmailAddress'];?></a></td>
</tr>
<tr id="info">
<td width="30px"></td>
<td class="StyleInfoLib" width="250px">IncorporationDate</td>
<td class="StyleInfoData" width="300px"><?php echo $this->fiche['IncorporationDate']->_;?></td>
</tr>
<tr id="info">
<td width="30px"></td>
<td class="StyleInfoLib" width="250px">LegalForm</td>
<td class="StyleInfoData" width="300px"><?php echo $this->fiche['LegalForm']->CountryLegalForm->_;?></td>
</tr>
<tr id="info">
<td width="30px"></td>
<td class="StyleInfoLib" width="250px">IsUltimateParent</td>
<td class="StyleInfoData" width="300px"><?php echo $this->fiche['IsUltimateParent'];?></td>
</tr>
</table>
<pre><?php print_r($this->fiche);?></pre>

View File

@ -0,0 +1,5 @@
<div id="center">
<div class="paragraph">
<?php echo $this->partial('giant/partials/fiche.phtml', null, array('fiche'=> $this->fiche));?>
</div>
</div>

View File

@ -5,4 +5,17 @@ Class GiantControllerLib
{
}
protected function parcourTableau($array)
{
$tableau = array();
foreach($array as $key => $element){
if((is_array($element)) && (($element instanceof stdClass)))
GiantControllerLib::parcourTableau($element);
else
return $element;
}
}
}

View File

@ -1,28 +1,72 @@
<?php
Class GiantIdentiteController extends GiantControllerLib
{
public function __construct()
protected $objet;
protected $datas = array();
protected $liste = array(
'CompanyId', 'Vat', 'CompanyName', 'CompanyStatus',
'CompanyAddress', 'TelephoneNumber', 'Telefax', 'WebAddress',
'EmailAddress', 'IncorporationDate', 'LegalForm', 'IsUltimateParent'
);
protected $FinancialSummary = array('Revenue', 'TotalEquity', 'WorkingCapital');
public function __construct($objet)
{
$this->objet = $objet;
}
public function ficheAction()
{
foreach($this->objet->DataSet->Company as $key => $valeur) {
foreach ($this->liste as $element) {
if ($element == $key) {
if(!is_array($valeur)) {
if(!empty($valeur)) {
$this->datas['fiche'][$key] = $valeur;
}
} else {
$this->datas['fiche'][$key] = parent::parcourTableau($valeur);
}
}
}
}
}
public function chiffreAction()
{
foreach ($this->objet->FinancialSummary[0] as $key => $valeur) {
foreach($this->FinancialSummary as $element) {
if (!empty($valeur)) {
$this->datas['chiffre'][$key] = $valeur->_;
}
}
}
}
public function secondaireAction()
public function secondairesAction()
{
foreach($this->objet->Branch as $key => $valeur) {
if($key != 'BranchAddress') {
if(!is_array($valeur))
$this->datas['secondaires'][$key] = $valeur;
else
$this->datas['secondaires'][$key] = parent::parcourTableau($valeur);
} else
$this->datas['secondaires'][$key] = $valeur[0];
}
}
public function pieceAction()
{
foreach($this->objet->Event as $key => $valeur) {
$this->datas['piece'][$valeur->Source->code][$valeur->Date] = array($valeur->Description, $valeur->FreeText);
}
}
public function getObjet($data)
{
return ($this->datas[$data]);
}
}

View File

@ -1,5 +1,7 @@
<?php
require_once ('Functions.php');
require_once ('Scores/Cache.php');
Class GiantRechercheController extends GiantFunctionController
{
protected $listAutorized = array(
@ -17,7 +19,7 @@ Class GiantRechercheController extends GiantFunctionController
$this->Provider->CountryCode = $CountryCode;
$this->Provider->ProviderId = parent::setCountryCode($CountryCode, $this->listAutorized);
$this->Provider->TestIndication = $TestIndication;
$this->soapG = new WSgiant($this->Provider);
$this->soapG = new WSgiant($this->Provider);
}
public function Liste($parametres, $page)
@ -100,6 +102,20 @@ Class GiantRechercheController extends GiantFunctionController
return (false);
}
public function GetRapport($CompanyId, $DataSetType)
{
$cache = new Cache('giant-'.$DataSetType.'-'.$CompanyId);
if(!$cache->exist()) {
$this->CreditData = new CreditData($this->soapG, $CompanyId);
$result = $this->CreditData->getMethode('OrderDataSet', array($DataSetType));
$result = $this->CreditData->getMethode('RetrieveDataSet', array($result->Order->InternalOrderId));
$cache->setBlock($result);
} else {
$result = $cache->getBlock();
}
return ($result);
}
public function ListeRapport($CompanyId)
{
$this->CreditData = new CreditData($this->soapG, $CompanyId);

View File

@ -1,10 +1,12 @@
<?php
define("DATA_SET_VERSION", 1.0);
Class CreditData extends GiantFunction
{
private $soapG;
private $soapG;
protected $companyId;
protected $methodes = array(
'RetreiveOptions', 'RetreiveOptions',
'RetreiveOptions', 'OrderDataSet',
'RetrieveOrderStatus', 'RetrieveDataSet',
'StartInvestigation', 'StartMonitoring',
'UpdateMonitoringOptions', 'StopMonitoring',
@ -31,13 +33,14 @@ Class CreditData extends GiantFunction
return ($result);
}
protected function OrderDataSet($DataSetType, $Version = null, $LanguageCode = null)
protected function OrderDataSet($DataSetType, $Version = null, $LanguageCode = 'en')
{
$parametres = new stdClass();
$parametres->companyId = $this->companyId;
$parametres->CompanyId = $this->companyId;
$parametres->DataSetType = $DataSetType;
$parametres->DataSetVersion = DATA_SET_VERSION;
$parametres->Version = $Version;
$parametres->LanguageCode = $LanguageCode;
$parametres->LanguageCode = 'en';
try {
$result = $this->soapG->OrderDataSet($parametres);
} catch (SoapFault $soapFault) {