Calcul avec flexicontent

More
6 years 8 months ago #68931 by id-pop
Replied by id-pop on topic Calcul avec flexicontent
Hi,
Thanks. I have created the fied and the new plugin template but I think I am missing elements...

Here is what I have done :

Fields for "sous-sequence" type (type id = 1) :
- Title
- Durée (field_id=166) : text field with time mask

Modules :
Module "sequence 1" :
- Article selection > Types : "sous-sequence" (type_id=1)
- Article selection > items : "Séquences en lien 1" (field_id=213)
- Display : select fields > custom fields : durée (field_id=166)
Module "sequence 2" :
- Article selection > Types : "sous-sequence" (id=1)
- Article selection > items : "Séquences en lien 1" (field_id=230)
- Display : select fields > custom fields : durée (field_id=166)

Fields for "Formation" type (type id = 2):
- Title
- Séquences en lien 1 (field_id = 213) : relation from "sous-sequence" type
- Séquence 1 mod (field_id = 310) : loadmodule "sequence 1"
- Séquences en lien 2 (field_id = 230) : relation from "sous-sequence" type
- Séquence 2 mod (field_id=311) : loadmodule "sequence 2"
- Durée totale (field_id=412) : textfield with value_custom.php fdisplay (not displayed in formular)
- Durée séquence 1 (field_id=413) : textfield with value_custom.php fdisplay (not displayed in formular)
- Durée séquence 2 (field_id=414) : textfield with value_custom.php fdisplay (not displayed in formular)

Template "formation" :
- Title
- Durée totale (field_id=412)
- Séquence 1 mod (field_id = 310)
- Durée séquence 1 (field_id=413)
- Séquence 2 mod (field_id=311)
- Durée séquence 2 (field_id=414)

Items :
item_id=1 :
- Type_id=1
- Title : SS1
- Durée (field_id=166) : 00:25
item_id=2 :
- Type_id=1
- Title : SS2
- Durée (field_id=166) : 00:05
item_id=3 :
- Type_id=1
- Title : SS3
- Durée (field_id=166) : 00:30
item_id=4 :
- Type_id=2
- Title : F1
- Séquences en lien 1 (field_id = 213) : item_id = 1 & 2
- Séquences en lien 2 (field_id = 230) : item_id = 2 & 3

It should display :
- F1
- Durée totale : 01:05 (00:25 + 00:05 + 00:05 + 00:30)
- SS1 : 00:25
- SS2 : 00:05
- Durée séquence 1 : 00:30 (00:25 + 00:05)
- SS2 : 00:05
- SS3 : 00:30
- Durée séquence 2 : 00:35 (00:05 + 00:30)

Thanks for your help

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

More
6 years 8 months ago - 6 years 8 months ago #68980 by ggppdk
Replied by ggppdk on topic Calcul avec flexicontent
Hello

please do it in steps, edit file:
plugins/flexicontent_fields/text/text/tmpl/value_mycustom.php

Remove all code from it !
and do the following

Example:
Field 45 is number
Field 46 is number

and e.g. we want the sum of them
Code:
<?php $val45 = !empty($item->fieldvalues[45]) ? $item->fieldvalues[45][0] : 0; $val46 = !empty($item->fieldvalues[46]) ? $item->fieldvalues[46][0] : 0; echo "Sum of fields is : " . ($val45 + $val46);

-- Also remember to go to the you new custom text field and set a default value e.g. "Dummy"
and set it to be loaded always, thus the field will be shown even if it has no value
(the field does not need value, since it is show values of other fields)


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 6 years 8 months ago by ggppdk.

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.253 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