$user_id = $user_obj->user_id; $user_form_id = User::getMeta($user_id, $user_fields['registration-form']); $user_form = User::getRegistrationForm($user_form_id); $assessment_protege_id = User::getMeta($user_id, $user_fields['assessment-protege'] . $raw_stage_name); $assessment_savant_id = User::getMeta($user_id, $user_fields['assessment-savant'] . $raw_stage_name); $assessment_protege_fields = SiteHelper::protege_assessment_relation(); $assessment_savant_fields = SiteHelper::savant_assessment_relation(); $assessment_protege_form_id = $assessment_protege_fields[$raw_stage_name]['form-id']; $assessment_savant_form_id = $assessment_savant_fields[$raw_stage_name]['form-id']; $assessment_protege_fields_id = $assessment_protege_fields[$raw_stage_name]['fields']; $assessment_savant_fields_id = $assessment_savant_fields[$raw_stage_name]['fields']; $protege_model = \RGFormsModel::get_lead($assessment_protege_id); $savant_model = \RGFormsModel::get_lead($assessment_savant_id); $protege_link_text = 'Edit'; $savant_link_text = 'Edit'; $user_consultant = User::getByCode($user_form[36]); if ($raw_stage_name === 'PRE') { foreach ($assessment_savant_fields_id as $id) { if ($savant_model[$id]) { $savant_link_text = 'Show'; } } $protege_link_text = ' - '; } else { foreach ($assessment_savant_fields_id as $id) { if ($savant_model[$id]) { $savant_link_text = 'Show'; } } foreach ($assessment_protege_fields_id as $id) { if ($protege_model[$id]) {