Protection boucle foreach

This commit is contained in:
Michael RICOIS 2011-08-26 08:37:51 +00:00
parent f9193bf2bf
commit e6a65368fe

View File

@ -16,10 +16,12 @@ Class RatiosData
public function __construct($ratios)
{
//Organisation des ratios secteurs
foreach($ratios->RatiosSecteur->item as $item){
foreach($item->liste->item as $ratiosItem){
$this->ratiosSecteur[$item->annee][$ratiosItem->id] = $ratiosItem->val;
}
if (count($ratios->RatiosSecteur->item)>0){
foreach($ratios->RatiosSecteur->item as $item){
foreach($item->liste->item as $ratiosItem){
$this->ratiosSecteur[$item->annee][$ratiosItem->id] = $ratiosItem->val;
}
}
}
//Orgnaisation des informations des ratios
foreach($ratios->RatiosInfos->item as $item){
@ -27,17 +29,19 @@ Class RatiosData
}
//Orgnaisation RatiosEntrep et RatiosEntrepEvol
foreach($ratios->BilansInfos->item as $item)
{
$this->bilansInfo[$item->typeBilan][$item->dateCloture] = $item;
foreach($item->RatiosEntrep->item as $ratiosItem){
$this->ratiosEntrep[$item->typeBilan][$item->dateCloture][$ratiosItem->id] = $ratiosItem->val;
if (count($ratios->BilansInfos->item)>0){
foreach($ratios->BilansInfos->item as $item)
{
$this->bilansInfo[$item->typeBilan][$item->dateCloture] = $item;
foreach($item->RatiosEntrep->item as $ratiosItem){
$this->ratiosEntrep[$item->typeBilan][$item->dateCloture][$ratiosItem->id] = $ratiosItem->val;
}
foreach($item->RatiosEntrepEvol->item as $ratiosItem){
$this->ratiosEntrepEvol[$item->typeBilan][$item->dateCloture][$ratiosItem->id] = $ratiosItem->val;
}
//Comptage de bilans
$this->{'nbBilan'.$item->typeBilan}++;
}
foreach($item->RatiosEntrepEvol->item as $ratiosItem){
$this->ratiosEntrepEvol[$item->typeBilan][$item->dateCloture][$ratiosItem->id] = $ratiosItem->val;
}
//Comptage de bilans
$this->{'nbBilan'.$item->typeBilan}++;
}
}