1]
);
}
if ($fields === false) {
$fields = [];
ui_print_empty_data(__('No fields defined'));
} else {
$table = new stdClass();
$table->width = '100%';
$table->class = 'info_table';
$table->head = [];
$table->head[0] = __('Field');
$table->size[0] = '20%';
$table->head[1] = __('Display on front').ui_print_help_tip(__('The fields with display on front enabled will be displayed into the agent details'), true);
$table->size[1] = '20%';
$table->head[2] = __('Description');
$table->align = [];
$table->align[1] = 'left';
$table->align[2] = 'left';
$table->data = [];
foreach ($fields as $field) {
$data[0] = ''.$field['name'].'';
if ($field['display_on_front']) {
$data[1] = html_print_image('images/tick.png', true, ['class' => 'invert_filter']);
} else {
$data[1] = html_print_image('images/delete.png', true, ['class' => 'invert_filter']);
}
$custom_value = db_get_all_rows_sql(
'select tagent_custom_data.description,tagent_custom_fields.is_password_type from tagent_custom_fields
INNER JOIN tagent_custom_data ON tagent_custom_fields.id_field = tagent_custom_data.id_field where tagent_custom_fields.id_field = '.$field['id_field'].' and tagent_custom_data.id_agent = '.$id_agente
);
if ($custom_value[0]['description'] === false || $custom_value[0]['description'] == '') {
$custom_value[0]['description'] = '-'.__('empty').'-';
} else {
$custom_value[0]['description'] = ui_bbcode_to_html($custom_value[0]['description']);
}
if ($custom_value[0]['is_password_type']) {
$data[2] = '••••••••';
} else {
$data[2] = $custom_value[0]['description'];
}
array_push($table->data, $data);
}
html_print_table($table);
}