Charge
This commit is contained in:
58
Controleur/ControleurAjaxgraphiquesinistres.php
Executable file
58
Controleur/ControleurAjaxgraphiquesinistres.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
require_once 'Framework/Controleur.php';
|
||||
require_once 'Modele/Synthese.php';
|
||||
|
||||
class ControleurAjaxgraphiquesinistres extends Controleur {
|
||||
private $menuvue;
|
||||
private $synthese;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
$this->synthese = new Synthese();
|
||||
}
|
||||
|
||||
public function index() {
|
||||
|
||||
// Répartition sinistres
|
||||
$claims = $this->synthese->getClaims();
|
||||
|
||||
$tabclaims = [
|
||||
'claimsLabels' => array_column($claims, 'claimsLabels'),
|
||||
'claimsValues' => array_column($claims, 'claimsValues')
|
||||
];
|
||||
|
||||
$dataTabClaims = json_encode($tabclaims, JSON_NUMERIC_CHECK);
|
||||
|
||||
|
||||
// Evolution des sinistres
|
||||
$claimsMonth = $this->synthese->getClaimsMonth();
|
||||
$claimsSingleMonth = $this->synthese->getClaimsSingleMonth();
|
||||
|
||||
$tabclaimsMonth = [
|
||||
'months' => array_column($claimsMonth, 'months'),
|
||||
'monthlyClaims' => array_column($claimsMonth, 'monthlyClaims'),
|
||||
'singleClaims' => array_column($claimsSingleMonth, 'singleClaims')
|
||||
];
|
||||
|
||||
$dataTabClaimsMonth = json_encode($tabclaimsMonth, JSON_NUMERIC_CHECK);
|
||||
|
||||
// SINISTRALITÉ
|
||||
$claimsLossRatio = $this->synthese->getClaimsLossRatio();
|
||||
|
||||
$tabLossRatio = [
|
||||
'lossRatioLabels' => array_column($claimsLossRatio, 'months'),
|
||||
'lossRatioValues' => array_column($claimsLossRatio, 'ratio')
|
||||
];
|
||||
|
||||
$dataLossRatio = json_encode($tabLossRatio, JSON_NUMERIC_CHECK);
|
||||
|
||||
$this->genererVueAjax(
|
||||
array
|
||||
(
|
||||
'dataTabClaims' => $dataTabClaims,
|
||||
'dataTabClaimsMonth' => $dataTabClaimsMonth,
|
||||
'dataLossRatio' => $dataLossRatio
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user