Champ text multiple avec valeur automatique

More
5 years 4 months ago - 5 years 4 months ago #76857 by seabird
Bonjour,

J'ai créé un fieldGroup ( valeur unique) de champs textes .
Un des champs du groupe est en valeur automatique avec par exemple le code:
Code:
<?php $valeur1 = $item->fields["nombre-presents-lec"]->value[0]; $valeur2 = $item->fields["nombre-convoques-lec"]->value[0]; $total = $valeur1 / $valeur2; return round($total,2)*100;

Cela fonctionne sans problème.


Maintenant , je me pose une question.
Je veux créer un groupe de champ à valeurs multiples.
Comment faire maintenant pour affecter le champ automatique vu qu'il y aura maintenant plusieurs valeurs pour nombre-presents-lec et nombre-convoques-lec ?



Merci,

Eric
Last edit: 5 years 4 months ago by seabird.

Please Log in or Create an account to join the conversation.

More
5 years 4 months ago - 5 years 4 months ago #76858 by seabird
Re,

C'est bon , cela fonctionne.
J'ai résolu de cette façon:
Code:
<?php foreach($item->fields['nombre-presents-lec']->postdata as $i => $v) { $valeur1[$i] = $v; } foreach($item->fields['nombre-convoques-lec']->postdata as $i => $v) { $valeur2[$i] = $v; } $percentage = array_map(function ($a, $b) { return round(($a / $b)*100,2); }, $valeur1, $valeur2); return $percentage;

Eric
Last edit: 5 years 4 months ago by seabird.

Please Log in or Create an account to join the conversation.

More
5 years 4 months ago #76859 by micker
merci pour le partage !

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.355 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline