Code : Tout sélectionner
<?php
//Note moyenne presse et public
<?php if ($attribute_groups) { ?>
<?php foreach ($attribute_groups as $attribute_group) { ?>
<?php foreach ($attribute_group['attribute'] as $attribute) { ?>
<?php if ($attribute_group['name'] == 'Notation Presse') { ?>
$note1=<?php echo substr($attribute['text'], 0, -4); ?>;
$ref1=<?php echo substr($attribute['text'], -3); ?>;
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
<?php if ($attribute_groups) { ?>
<?php foreach ($attribute_groups as $attribute_group) { ?>
<?php foreach ($attribute_group['attribute'] as $attribute) { ?>
<?php if ($attribute_group['name'] == 'Notation Public') { ?>
$note2=<?php echo substr($attribute['text'], 0, -4); ?>;
$ref2=<?php echo substr($attribute['text'], -3); ?>;
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
//Moyenne des 2 en pourcentage
$moyenne=(+$note1+$note2)*100/(+$ref1+$ref2);
//Resultat note moyenne
echo $moyenne;
?>