Issue #0001889: [IndiScore] Afficher l'histroque des scores

This commit is contained in:
Aram HARUTYUNYAN 2014-04-21 11:46:07 +00:00
parent 4e7055929d
commit f0e537ed31
3 changed files with 115 additions and 1 deletions

View File

@ -55,6 +55,40 @@ class EvaluationController extends Zend_Controller_Action
$this->view->assign('min', $bornes[$score]['min']);
$this->view->assign('max', $bornes[$score]['max']);
}
/**
* graphique de l'historique des scores
* @param array $infos
* @param string $siren
* @param string $type
* @return array $dates
*/
protected function scoresHistoChart($infos, $siren, $type)
{
require_once("Vendors/ChartDirector/phpchartdir.php");
$hChart = 240;
$labels = range(1, count($infos));
$c = new XYChart($hChart*2, $hChart);
$c->setPlotArea($hChart/10, $hChart/20, $hChart*18/10, $hChart*8/10);
$c->xAxis->setLabels($labels);
$c->xAxis->setLabelStep(1);
$textBoxObj = $c->addText($hChart*18/10, $hChart/15, $type, "arialbi.ttf", 11, 0xaaaaaa);
$textBoxObj->setAlignment(TopRight);
$layer = $c->addSplineLayer();
$layer->setDataLabelFormat("{value}");
$layer->setLineWidth(2);
$dataSetObj = $layer->addDataSet($infos, 0xFF8888, "Target Group");
$dataSetObj->setDataSymbol(CircleSymbol, 5, 0xFF5555);
$fChart = fopen('themes/default/images/charts/scoresHisto-'.$siren.'-'.$type.'.png', "w");
fwrite($fChart, $c->makeChart2('png'));
fclose($fChart);
}
/**
* IndiScore
@ -83,11 +117,47 @@ class EvaluationController extends Zend_Controller_Action
$email = $request->getParam('email', '');
$ws = new WsScores();
$infos = $ws->getIndiScore(substr($this->siret, 0,9), 0, 1, $plus, $ref, $encours, $email);
$infos = 12;//$ws->getIndiScore(substr($this->siret, 0,9), 0, 1, $plus, $ref, $encours, $email);
if ($infos === false) $this->forward('soap', 'error');
} else {
$infos = $this->getRequest()->getParam('infos');
}
$histoScores = $ws->getScoresHisto($this->siret, 'indiscore');
if ($histoScores->nbReponses>1)
{
foreach($histoScores->result as $score)
{
$scoreVals[] = $score->value;
}
$source = array(
'ajout' => $this->view->translate(''),
'ancien' => $this->view->translate(''),
'bilans1' => $this->view->translate('publication bilan'),
'bilans2' => $this->view->translate('publication bilan'),
'bilansasso'=> $this->view->translate(''),
'bodacc' => $this->view->translate('publication bodacc'),
'collecte' => $this->view->translate('publication légale'),
'dirigeants'=> $this->view->translate('modification de l\'administration'),
'impayes' => $this->view->translate(''),
'insee' => $this->view->translate('modification identitaire'),
'jour' => $this->view->translate(''),
'liens' => $this->view->translate('mise à jour de la structure du groupe'),
'modifenc' => $this->view->translate(''),
'privileges'=> $this->view->translate(''),
'regulier' => $this->view->translate('modification identitaire'),
'rncs' => $this->view->translate('')
);
$this->scoresHistoChart($scoreVals, substr($this->siret, 0,9), $histoScores->type);
$this->view->assign('source', $source);
$this->view->assign('scores', $histoScores->result);
$this->view->assign('type', $histoScores->type);
}
$this->view->assign('siret', $this->siret);
$this->view->assign('typeScore', $user->getTypeScore());
$this->view->assign('indiscore', $infos);

View File

@ -235,6 +235,30 @@ if ($this->indiscore->Enseigne!='' && $this->indiscore->Sigle!='') {
</table>
</div>
<h2><?=$this->translate('Historique des scores');?></h2>
<div class="paragraph">
<table>
<tr>
<td width="30">&nbsp;</td>
<?php if($this->scores) {?>
<td class="StyleInfoData">
<ol>
<?php foreach($this->scores as $score){?>
<?php $date = new Zend_Date($score->date, 'yyyy-MM-dd');?>
<?php $motif = ($score->motif!='' && $this->source[$score->motif]!='')?" (".$this->source[$score->motif].")":'';?>
<li style="margin: 0px; padding: 3px;"><?=$date->toString('dd/MM/yyyy').' - '.$score->value.$motif?></li>
<?php }?>
</ol>
<img src="/themes/default/images/charts/scoresHisto-<?=substr($this->siret, 0,9);?>-<?=$this->type;?>.png" />
</td>
<?php } else {?>
<td class="StyleInfoData"><?=$this->translate('Aucune information sur l\'historique disponible.');?></td>
<?php }?>
</tr>
</table>
</div>
<h2>Conclusion</h2>
<div class="paragraph">
<table>

View File

@ -3037,6 +3037,26 @@ class WsScores
}
}
}
/**
* getScoreHistorique pour les derniers 5 ans
* @param string $siret
* @param string $type
*/
public function getScoresHisto($siret, $type = 'indiscore')
{
$params = new stdClass();
$params->siret = $siret;
$params->type = $type;
try {
$client = $this->loadClient('interne');
$reponse = $client->getScoresHisto($params);
return $reponse->getScoresHistoResult;
} catch (SoapFault $fault) {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
/**
* getNextLogin