{# IMPROVEMENTS: Make a query which will used to get the answers of current user of current login. Now we're using loop to match the user which is not recomended. Remove {% for notallowed in userDetails.whoCanUpdateCustomFields %} this block and used listOfNonEditableField in WhoCanUpdateCustomFieldRepository.php file as I'm using in the UserRegistration.php in validateAndUpdateCustomFieldData_part1 method #} {% set fieldSection = '' %} {% for fieldKey, field in fieldLIst %} {# dispaly field sections #} {% if field.customFieldSections.name is defined and field.customFieldSections.name != fieldSection %} {% if fieldKey != 0 %}


{% endif %} {# display section name #}

{{ field.customFieldSections.name|trans }}:

{% if field.customFieldSections.description is not empty and app.request.attributes.get('_route') != 'users_profile' %} {% endif %}
{% else %}


{% endif %} {# To prevent errors, because this vbaseariable is only use in profile managemnet #} {% set LockSymbol = '' %} {% set answers = '' %} {% set a___ = '' %} {% set filePath = '' %} {% set lockField = '' %} {# BEGIN:: These codes for the profile management #} {# show custom field lock options #} {% if source_file == 'profile' %} {# get answer of custom fields based on the user's profile #} {% if userDetails.category == 's' %} {% set answers = field.sAnswersRegardingCFs %} {% elseif userDetails.category == 't' %} {% set answers = field.tAnswerRegardingCFs %} {% elseif userDetails.category == 'a' %} {% set answers = field.aAnswerRegardingCFs %} {% endif %} {# loop through all the answer object and find the user who'es profiled matched -- IMPROVE #} {% for ans in answers.toArray() %} {% if ans.User.id == userDetails.id %} {# save answer of current field. #} {% set a___ = ans.answers %} {% endif %} {% endfor %} {# get the file path if exits #} {% set pathOfFile = 'custom_fields/'~userDetails.id ~'/'~ field.id %} {% set filePath = getUploadedFile(true,pathOfFile,true) %} {# if current user is admin then assign lock field option #} {% if is_granted('ROLE_ADMIN') and app.request.attributes.get('_route') == 'users_profile' %} {# lock field #} {% set LockSymbol = '' %} {% endif %} {# identityfying lock fields #} {% for notallowed in userDetails.whoCanUpdateCustomFields %} {% if notallowed.getCustomFieldRef().toArray() is not empty and notallowed.getCustomFieldRef().toArray()[0].id == field.id %} {% set lockField = 'disabled="disabled"' %} {# if current user is admin then assign lock field option #} {% if is_granted('ROLE_ADMIN') and app.request.attributes.get('_route') != 'my_profile' %} {# Unlock field #} {% set LockSymbol = '' %} {% endif %} {% endif %} {% endfor %} {% endif %} {# END:: Profile Management codes#} {# This field is require or not .#} {% set requireClass = '' %} {% set requireSymbol = '' %} {% if field.is_require %} {% set requireSymbol = '*' %} {% set requireClass = 'r__q' %} {% endif %} {% if field.type == "radio" %} {# radio fields #}
{% for key, fieldOption in field.options %} {% endfor %} {# to send data on the server. #}
{{ (field.getHelpMessage()) }}
{% elseif field.type == "checkbox" %}
{% for fieldOption in field.options %} {% endfor %} {# to send data on the server. #}
{{ (field.getHelpMessage()) }}
{% elseif field.type == "dropdown" %} {# dropdown fields #}
{{ (field.getHelpMessage()) }}
{% elseif field.type == "textarea" %} {# text area field #}
{{ (field.getHelpMessage()) }}
{% elseif field.type == "date" %} {# only date #}
{{ (field.getHelpMessage()) }}
{% elseif field.type == "time" %} {# only time fileds #}
{{ (field.getHelpMessage()) }}
{% elseif field.Type == "datetime" %} {# date time #}
{{ (field.getHelpMessage()) }}
{% elseif field.Type == "file" %} {# Simple Custom Fields #}
{% if filePath is not empty %} {#filePath#} View File? {% endif %} {{ (field.getHelpMessage()) }}
{% else %} {# Simple Custom Fields #}
{{ (field.getHelpMessage()) }}
{% endif %} {% if field.customFieldSections.name is defined %} {% set fieldSection = field.customFieldSections.name %} {% else %} {% set fieldSection = '' %} {% endif %} {% endfor %}