Repaso de árbol genalógico

git-svn-id: https://192.168.0.254/svn/Proyectos.DoubleRGroup_Web/trunk@6 9702d7ca-3799-984c-9d87-892b02c0b615
This commit is contained in:
roberto 2014-03-10 18:19:46 +00:00
parent 62e8e1ebb3
commit 480d7c3ea2

View File

@ -42,110 +42,205 @@ function drg_horse_family_tree($atts, $content = null) {
while($horses->have_posts()): $horses->the_post();
$html .= '<span class="label">' . get_the_title() . '</span>';
// Padres
$valorPadre = get_post_meta(get_the_ID(), 'drg_horse_father', true);
$valorMadre = get_post_meta(get_the_ID(), 'drg_horse_mother', true);
if (!empty($valorPadre) || !empty($valorMadre)) {
$html .= '<div class="branch lv1">';
// Padre, si no tiene no sacamos nada más de sus predecesores
if (!empty($valorPadre)){
$html .= '<div class="entry';
if (empty($valorMadre))
$html .= ' sole"><span class="label">&#9794;&nbsp;' .$valorPadre . '</span>';
else
$html .= '"><span class="label">&#9794;&nbsp;' .$valorPadre . '</span>';
// Abuelos paternos
$valorAbuelo = get_post_meta(get_the_ID(), 'drg_horse_paternal_grandfather', true);
$valorAbuela = get_post_meta(get_the_ID(), 'drg_horse_paternal_grandmother', true);
if (!empty($valorAbuelo) || !empty($valorAbuela)) {
$html .= '<div class="branch lv2">';
// Abuelo paterno
if (!empty($valorAbuelo)){
$html .= '<div class="entry';
if (!empty($valorAbuela))
$html .= '"><span class="label">&#9794;&nbsp;' . $valorAbuelo . '</span>';
else
$html .= ' sole"><span class="label">&#9794;&nbsp;' . $valorAbuelo . '</span>';
// Bisabuelos paternos (1)
$valorBisAbuelo = get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandfather_1', true);
$valorBisAbuela = get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandmother_1', true);
if (!empty($valorBisAbuelo) || !empty($valorBisAbuela)) {
$html .= '<div class="branch lv3">';
//BisAbuelo paterno 1
if (!empty($valorBisAbuelo)){
$html .= '<div class="entry';
if (!empty($valorBisAbuela))
$html .= '"><span class="label">&#9794;&nbsp;' . $valorBisAbuelo . '</span></div>';
else
$html .= ' sole"><span class="label">&#9794;&nbsp;' . $valorBisAbuelo . '</span></div>';
}
//BisAbuela paterno 1
if (!empty($valorBisAbuela)){
$html .= '<div class="entry';
if (!empty($valorBisAbuelo))
$html .= '"><span class="label">&#9792&nbsp;' . $valorBisAbuela . '</span></div>';
else
$html .= ' sole"><span class="label">&#9792&nbsp;' . $valorBisAbuela . '</span></div>';
}
$html .= '</div>'; //BisAbuelos paterno
}
$html .= '</div>'; // Abuelos paterno
}
// Padres
$html .= '<div class="branch lv1">';
// Abuela paterna
if (!empty($valorAbuela)){
$html .= '<div class="entry';
if (!empty($valorAbuelo))
$html .= '"><span class="label">&#9792&nbsp;' . $valorAbuela . '</span>';
else
$html .= ' sole"><span class="label">&#9792&nbsp;' . $valorAbuela . '</span>';
// Bisabuelos paternos (2)
$valorBisAbuelo = get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandfather_2', true);
$valorBisAbuela = get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandmother_2', true);
if (!empty($valorBisAbuelo) || !empty($valorBisAbuela)) {
$html .= '<div class="branch lv3">';
//BisAbuelo paterno 2
if (!empty($valorBisAbuelo)){
$html .= '<div class="entry';
if (!empty($valorBisAbuela))
$html .= '"><span class="label">&#9794;&nbsp;' . $valorBisAbuelo . '</span></div>';
else
$html .= ' sole"><span class="label">&#9794;&nbsp;' . $valorBisAbuelo . '</span></div>';
}
//BisAbuela paterno 2
if (!empty($valorBisAbuela)){
$html .= '<div class="entry';
if (!empty($valorBisAbuelo))
$html .= '"><span class="label">&#9792&nbsp;' . $valorBisAbuela . '</span></div>';
else
$html .= ' sole"><span class="label">&#9792&nbsp;' . $valorBisAbuela . '</span></div>';
}
$html .= '</div>'; //BisAbuelos paternos
}
$html .= '</div>'; // Abuela paterna
}
$html .= '</div>'; // Abuelos paternos
}
// Padre
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_father', true) . '</span>';
// Abuelos paternos
$html .= '<div class="branch lv2">';
$html .= '</div>'; // Padre
}
// Madre, si no tiene no sacamos nada más de sus predecesores
if (!empty($valorMadre)) {
$html .= '<div class="entry';
if (empty($valorPadre))
$html .= ' sole"><span class="label">&#9792&nbsp;' .$valorMadre . '</span>';
else
$html .= '"><span class="label">&#9792&nbsp;' .$valorMadre . '</span>';
// Abuelo paterno
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_grandfather', true) . '</span>';
// Abuelos maternos
$valorAbuelo = get_post_meta(get_the_ID(), 'drg_horse_maternal_grandfather', true);
$valorAbuela = get_post_meta(get_the_ID(), 'drg_horse_maternal_grandmother', true);
if (!empty($valorAbuelo) || !empty($valorAbuela)) {
$html .= '<div class="branch lv2">';
// Abuelo materno
if (!empty($valorAbuelo)){
$html .= '<div class="entry';
if (!empty($valorAbuela))
$html .= '"><span class="label">&#9794;&nbsp;' . $valorAbuelo . '</span>';
else
$html .= ' sole"><span class="label">&#9794;&nbsp;' . $valorAbuelo . '</span>';
// Bisabuelos maternos (1)
$valorBisAbuelo = get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandfather_1', true);
$valorBisAbuela = get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandmother_1', true);
if (!empty($valorBisAbuelo) || !empty($valorBisAbuela)) {
$html .= '<div class="branch lv3">';
// Bisabuelos paternos (1)
// $html .= '<div class="branch lv3">';
// $html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandfather_1', true) . '</span></div>';
// $html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandmother_1', true) . '</span></div>';
// $html .= '</div>';
//BisAbuelo paterno 1
if (!empty($valorBisAbuelo)){
$html .= '<div class="entry';
if (!empty($valorBisAbuela))
$html .= '"><span class="label">&#9794;&nbsp;' . $valorBisAbuelo . '</span></div>';
else
$html .= ' sole"><span class="label">&#9794;&nbsp;' . $valorBisAbuelo . '</span></div>';
}
//BisAbuela paterno 1
if (!empty($valorBisAbuela)){
$html .= '<div class="entry';
if (!empty($valorBisAbuelo))
$html .= '"><span class="label">&#9792&nbsp;' . $valorBisAbuela . '</span></div>';
else
$html .= ' sole"><span class="label">&#9792&nbsp;' . $valorBisAbuela . '</span></div>';
}
$html .= '</div>'; //BisAbuelos materno
}
$html .= '</div>'; // Abuelo paterno
// Abuela paterna
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_grandmother', true) . '</span>';
// Bisabuelos paternos (2)
// $html .= '<div class="branch lv3">';
// $html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandfather_2', true) . '</span></div>';
// $html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandmother_2', true) . '</span></div>';
// $html .= '</div>';
$html .= '</div>'; // Abuelo materno
}
// Abuela materno
if (!empty($valorAbuela)){
$html .= '<div class="entry';
if (!empty($valorAbuelo))
$html .= '"><span class="label">&#9792&nbsp;' . $valorAbuela . '</span>';
else
$html .= ' sole"><span class="label">&#9792&nbsp;' . $valorAbuela . '</span>';
// Bisabuelos maternos (2)
$valorPadre = get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandfather_2', true);
$valorMadre = get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandmother_2', true);
if (!empty($valorPadre) || !empty($valorMadre)) {
$html .= '<div class="branch lv3">';
//BisAbuelo materno 2
if (!empty($valorBisAbuelo)){
$html .= '<div class="entry';
if (!empty($valorBisAbuela))
$html .= '"><span class="label">&#9794;&nbsp;' . $valorBisAbuelo . '</span></div>';
else
$html .= ' sole"><span class="label">&#9794;&nbsp;' . $valorBisAbuelo . '</span></div>';
}
//BisAbuela materna 2
if (!empty($valorBisAbuela)){
$html .= '<div class="entry';
if (!empty($valorBisAbuelo))
$html .= '"><span class="label">&#9792&nbsp;' . $valorBisAbuela . '</span></div>';
else
$html .= ' sole"><span class="label">&#9792&nbsp;' . $valorBisAbuela . '</span></div>';
}
$html .= '</div>'; //BisAbuelos maternos
}
$html .= '</div>'; // Abuela paterna
$html .= '</div>'; // Abuela materna
}
$html .= '</div>'; // Abuelos paternos
$html .= '</div>'; // Padre
// Madre
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_mother', true) . '</span>';
// Abuelos maternos
$html .= '<div class="branch lv2">';
// Abuelo materno
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_grandfather', true) . '</span>';
// Bisabuelos paternos (1)
// $html .= '<div class="branch lv3">';
// $html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandfather_1', true) . '</span></div>';
// $html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandmother_1', true) . '</span></div>';
// $html .= '</div>';
$html .= '</div>'; // Abuelo materno
// Abuela paterna
$html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_grandmother', true) . '</span>';
// Bisabuelos naternos (2)
// $html .= '<div class="branch lv3">';
// $html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandfather_2', true) . '</span></div>';
// $html .= '<div class="entry"><span class="label">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandmother_2', true) . '</span></div>';
// $html .= '</div>';
$html .= '</div>'; // Abuela paterna
$html .= '</div>'; // Abuelos maternos
$html .= '</div>'; // Madre
/*$html .= '<ul>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandfather_1', true) . '</a></li>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandmother_1', true) . '</a></li>';
$html .= '</ul>';
$html .= '</li>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_grandmother', true) . '</a>';
// Bisabuelos paternos (2)
$html .= '<ul>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandfather_2', true) . '</a></li>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_paternal_great_grandmother_2', true) . '</a></li>';
$html .= '</ul>';
$html .= '</li>';
$html .= '</ul>';
$html .= '</li>';
// Madre
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_mother', true) . '</a>';
// Abuelos paternos
$html .= '<ul>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_grandfather', true) . '</a>';
// Bisabuelos paternos (1)
$html .= '<ul>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandfather_1', true) . '</a></li>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandmother_1', true) . '</a></li>';
$html .= '</ul>';
$html .= '</li>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_grandmother', true) . '</a>';
// Bisabuelos paternos (2)
$html .= '<ul>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandfather_2', true) . '</a></li>';
$html .= '<li><a href="">' . get_post_meta(get_the_ID(), 'drg_horse_maternal_great_grandmother_2', true) . '</a></li>';
$html .= '</ul>';
$html .= '</li>';
$html .= '</ul>';
$html .= '</li>'; */
$html .= '</div>'; // Abuelos maternos
}
$html .= '</div>'; // Madre
}
$html .= '</div>'; // .branch lv1
}
endwhile;
$html .= '</div>'; // .branch lv1
$html .= '</div>'; // .horse-tree
wp_reset_query();
return $html;