Skip to content

Commit 0d71848

Browse files
committed
Fixed #84 -- Display descriptor translations
1 parent 9617f0e commit 0d71848

2 files changed

Lines changed: 21 additions & 18 deletions

File tree

template/plugin_thesaurus.php

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,16 @@
7676
foreach ($arr_IdentifierConceptListDesc as $key => $value) {
7777
if ($arr_IdentifierConceptListDesc[$key]['preferred_concept']=='Y') {
7878
$arr_TermListDesc=$arr_IdentifierConceptListDesc[$key]['TermListDesc'];
79-
$arr_PreferredDescriptors = array();
80-
foreach ($arr_TermListDesc as $key => $value) {
81-
if ($arr_TermListDesc[$key]['concept_preferred_term']=='Y' and $arr_TermListDesc[$key]['record_preferred_term']=='Y' and $arr_TermListDesc[$key]['term_string']!='' and $arr_TermListDesc[$key]['language_code']!='') {
82-
$arr_temp=array();
83-
$arr_temp['term_string']=$arr_TermListDesc[$key]['term_string'];
84-
$arr_temp['language_code']=$arr_TermListDesc[$key]['language_code'];
85-
$arr_temp['entry_version']=$arr_TermListDesc[$key]['entry_version'];
86-
$arr_PreferredDescriptors[]=$arr_temp;
79+
if ( $arr_TermListDesc ) {
80+
$arr_PreferredDescriptors = array();
81+
foreach ($arr_TermListDesc as $key => $value) {
82+
if ($arr_TermListDesc[$key]['concept_preferred_term']=='Y' and $arr_TermListDesc[$key]['record_preferred_term']=='Y' and $arr_TermListDesc[$key]['term_string']!='' and $arr_TermListDesc[$key]['language_code']!='') {
83+
$arr_temp=array();
84+
$arr_temp['term_string']=$arr_TermListDesc[$key]['term_string'];
85+
$arr_temp['language_code']=$arr_TermListDesc[$key]['language_code'];
86+
$arr_temp['entry_version']=$arr_TermListDesc[$key]['entry_version'];
87+
$arr_PreferredDescriptors[]=$arr_temp;
88+
}
8789
}
8890
}
8991
}
@@ -300,16 +302,17 @@
300302
// Termos preferidos
301303
foreach ($arr_IdentifierConceptListQualif as $key => $value) {
302304
if ($arr_IdentifierConceptListQualif[$key]['preferred_concept']=='Y') {
303-
// Termo preferido
304305
$arr_TermListQualif=$arr_IdentifierConceptListQualif[$key]['TermListQualif'];
305-
$arr_PreferredDescriptors = array();
306-
foreach ($arr_TermListQualif as $key => $value) {
307-
if ($arr_TermListQualif[$key]['concept_preferred_term']=='Y' and $arr_TermListQualif[$key]['record_preferred_term']=='Y' and $arr_TermListQualif[$key]['term_string']!='' and $arr_TermListQualif[$key]['language_code']!='') {
308-
$arr_temp=array();
309-
$arr_temp['term_string']=$arr_TermListQualif[$key]['term_string'];
310-
$arr_temp['language_code']=$arr_TermListQualif[$key]['language_code'];
311-
$arr_temp['entry_version']=$arr_TermListQualif[$key]['entry_version'];
312-
$arr_PreferredDescriptors[]=$arr_temp;
306+
if ( $arr_TermListQualif ) {
307+
$arr_PreferredDescriptors = array();
308+
foreach ($arr_TermListQualif as $key => $value) {
309+
if ($arr_TermListQualif[$key]['concept_preferred_term']=='Y' and $arr_TermListQualif[$key]['record_preferred_term']=='Y' and $arr_TermListQualif[$key]['term_string']!='' and $arr_TermListQualif[$key]['language_code']!='') {
310+
$arr_temp=array();
311+
$arr_temp['term_string']=$arr_TermListQualif[$key]['term_string'];
312+
$arr_temp['language_code']=$arr_TermListQualif[$key]['language_code'];
313+
$arr_temp['entry_version']=$arr_TermListQualif[$key]['entry_version'];
314+
$arr_PreferredDescriptors[]=$arr_temp;
315+
}
313316
}
314317
}
315318
}

template/treenode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<?php else : ?>
6565
<?php $term_lang = ( 'pt' == $lang ) ? 'pt-br' : $lang; ?>
6666
<?php foreach ($hierarchical_tree as $k => $v) : ?>
67-
<?php if ( 'filho' == $v['tipo'] and $v['tree_number_original'] == $ancestor ) : ?>
67+
<?php if ( 'filho' == $v['tipo'] and $v['tree_number_original'] == $ancestor and $v['term_string_translations'] ) : ?>
6868
<?php
6969
$xurl = real_site_url($ths_plugin_slug) . 'resource/?id=' . $v['id'];
7070
$term_string = wp_list_pluck( $v['term_string_translations'], 'term_string', 'language_code' );

0 commit comments

Comments
 (0)