Exemple #1
0
 private function __construct($tree_id, $tree_name, $tree_title, $imported)
 {
     if (strpos($tree_title, '%') === false) {
         // Allow users to translate tree titles.
         //$tree_title=WT_I18N::Translate($tree_title);
     }
     $this->tree_id = $tree_id;
     $this->tree_name = $tree_name;
     $this->tree_name_url = rawurlencode($tree_name);
     $this->tree_name_html = WT_Filter::escapeHtml($tree_name);
     $this->tree_title = $tree_title;
     $this->tree_title_html = '<span dir="auto">' . WT_Filter::escapeHtml($tree_title) . '</span>';
     $this->imported = $imported;
 }
Exemple #2
0
 public function __construct()
 {
     parent::__construct();
     $this->surname = WT_Filter::get('surname');
     $this->soundex_std = WT_Filter::getBool('soundex_std');
     $this->soundex_dm = WT_Filter::getBool('soundex_dm');
     if ($this->surname) {
         $this->setPageTitle(WT_I18N::translate('Branches of the %s family', WT_Filter::escapeHtml($this->surname)));
         $this->loadIndividuals();
         $self = WT_Individual::getInstance(WT_USER_GEDCOM_ID);
         if ($self) {
             $this->loadAncestors(WT_Individual::getInstance(WT_USER_GEDCOM_ID), 1);
         }
     } else {
         $this->setPageTitle(WT_I18N::translate('Branches'));
     }
 }
function format_surname_list($surnames, $style, $totals, $script)
{
    global $GEDCOM;
    $html = array();
    foreach ($surnames as $surn => $surns) {
        // Each surname links back to the indilist
        if ($surn) {
            $url = $script . '?surname=' . urlencode($surn) . '&amp;ged=' . rawurlencode($GEDCOM);
        } else {
            $url = $script . '?alpha=,&amp;ged=' . rawurlencode($GEDCOM);
        }
        // If all the surnames are just case variants, then merge them into one
        // Comment out this block if you want SMITH listed separately from Smith
        $first_spfxsurn = null;
        foreach ($surns as $spfxsurn => $indis) {
            if ($first_spfxsurn) {
                if (WT_I18N::strtoupper($spfxsurn) == WT_I18N::strtoupper($first_spfxsurn)) {
                    $surns[$first_spfxsurn] = array_merge($surns[$first_spfxsurn], $surns[$spfxsurn]);
                    unset($surns[$spfxsurn]);
                }
            } else {
                $first_spfxsurn = $spfxsurn;
            }
        }
        $subhtml = '<a href="' . $url . '" dir="auto">' . WT_Filter::escapeHtml(implode(WT_I18N::$list_separator, array_keys($surns))) . '</a>';
        if ($totals) {
            $subtotal = 0;
            foreach ($surns as $indis) {
                $subtotal += count($indis);
            }
            $subhtml .= '&nbsp;(' . WT_I18N::number($subtotal) . ')';
        }
        $html[] = $subhtml;
    }
    switch ($style) {
        case 1:
            return '<ul><li>' . implode('</li><li>', $html) . '</li></ul>';
        case 2:
            return implode(WT_I18N::$list_separator, $html);
        case 3:
            $i = 0;
            $count = count($html);
            $col = 1;
            if ($count > 36) {
                $col = 4;
            } else {
                if ($count > 18) {
                    $col = 3;
                } else {
                    if ($count > 6) {
                        $col = 2;
                    }
                }
            }
            $newcol = ceil($count / $col);
            $html2 = '<table class="list_table"><tr>';
            $html2 .= '<td class="list_value" style="padding: 14px;">';
            foreach ($html as $surns) {
                $html2 .= $surns . '<br>';
                $i++;
                if ($i == $newcol && $i < $count) {
                    $html2 .= '</td><td class="list_value" style="padding: 14px;">';
                    $newcol = $i + ceil($count / $col);
                }
            }
            $html2 .= '</td></tr></table>';
            return $html2;
    }
}
Exemple #4
0
 protected function _addName($type, $full, $gedcom)
 {
     global $UNKNOWN_NN, $UNKNOWN_PN;
     ////////////////////////////////////////////////////////////////////////////
     // Extract the structured name parts - use for "sortable" names and indexes
     ////////////////////////////////////////////////////////////////////////////
     $sublevel = 1 + (int) $gedcom[0];
     $NPFX = preg_match("/\n{$sublevel} NPFX (.+)/", $gedcom, $match) ? $match[1] : '';
     $GIVN = preg_match("/\n{$sublevel} GIVN (.+)/", $gedcom, $match) ? $match[1] : '';
     $SURN = preg_match("/\n{$sublevel} SURN (.+)/", $gedcom, $match) ? $match[1] : '';
     $NSFX = preg_match("/\n{$sublevel} NSFX (.+)/", $gedcom, $match) ? $match[1] : '';
     $NICK = preg_match("/\n{$sublevel} NICK (.+)/", $gedcom, $match) ? $match[1] : '';
     // SURN is an comma-separated list of surnames...
     if ($SURN) {
         $SURNS = preg_split('/ *, */', $SURN);
     } else {
         $SURNS = array();
     }
     // ...so is GIVN - but nobody uses it like that
     $GIVN = str_replace('/ *, */', ' ', $GIVN);
     ////////////////////////////////////////////////////////////////////////////
     // Extract the components from NAME - use for the "full" names
     ////////////////////////////////////////////////////////////////////////////
     // Fix bad slashes.  e.g. 'John/Smith' => 'John/Smith/'
     if (substr_count($full, '/') % 2 == 1) {
         $full = $full . '/';
     }
     // GEDCOM uses "//" to indicate an unknown surname
     $full = preg_replace('/\\/\\//', '/@N.N./', $full);
     // Extract the surname.
     // Note, there may be multiple surnames, e.g. Jean /Vasquez/ y /Cortes/
     if (preg_match('/\\/.*\\//', $full, $match)) {
         $surname = str_replace('/', '', $match[0]);
     } else {
         $surname = '';
     }
     // If we don’t have a SURN record, extract it from the NAME
     if (!$SURNS) {
         if (preg_match_all('/\\/([^\\/]*)\\//', $full, $matches)) {
             // There can be many surnames, each wrapped with '/'
             $SURNS = $matches[1];
             foreach ($SURNS as $n => $SURN) {
                 // Remove surname prefixes, such as "van de ", "d'" and "'t " (lower case only)
                 $SURNS[$n] = preg_replace('/^(?:[a-z]+ |[a-z]+\' ?|\'[a-z]+ )+/', '', $SURN);
             }
         } else {
             // It is valid not to have a surname at all
             $SURNS = array('');
         }
     }
     // If we don’t have a GIVN record, extract it from the NAME
     if (!$GIVN) {
         $GIVN = preg_replace(array('/ ?\\/.*\\/ ?/', '/ ?".+"/', '/ {2,}/', '/^ | $/'), array(' ', ' ', ' ', ''), $full);
     }
     // Add placeholder for unknown given name
     if (!$GIVN) {
         $GIVN = '@P.N.';
         $pos = strpos($full, '/');
         $full = substr($full, 0, $pos) . '@P.N. ' . substr($full, $pos);
     }
     // The NPFX field might be present, but not appear in the NAME
     if ($NPFX && strpos($full, "{$NPFX} ") !== 0) {
         $full = "{$NPFX} {$full}";
     }
     // The NSFX field might be present, but not appear in the NAME
     if ($NSFX && strrpos($full, " {$NSFX}") !== strlen($full) - strlen(" {$NSFX}")) {
         $full = "{$full} {$NSFX}";
     }
     // GEDCOM nicknames should be specificied in a NICK field, or in the
     // NAME filed, surrounded by ASCII quotes (or both).
     if ($NICK) {
         // NICK field found.  Add localised quotation marks.
         // GREG 28/Jan/12 - these localised quotation marks apparantly cause problems with LTR names on RTL
         // pages and vice-versa.  Just use straight ASCII quotes.  Keep the old code, so that we keep the
         // translations.
         if (false) {
             $QNICK = WT_I18N::translate('“%s”', $NICK);
         } else {
             $QNICK = '"' . $NICK . '"';
         }
         if (preg_match('/(^| |"|«|“|\'|‹|‘|„)' . preg_quote($NICK, '/') . '( |"|»|”|\'|›|’|”|$)/', $full)) {
             // NICK present in name.  Localise ASCII quotes (but leave others).
             // GREG 28/Jan/12 - redundant - see comment above.
             // $full=str_replace('"'.$NICK.'"', $QNICK, $full);
         } else {
             // NICK not present in NAME.
             $pos = strpos($full, '/');
             if ($pos === false) {
                 // No surname - append it
                 $full .= ' ' . $QNICK;
             } else {
                 // Insert before surname
                 $full = substr($full, 0, $pos) . $QNICK . ' ' . substr($full, $pos);
             }
         }
     }
     // Remove slashes - they don’t get displayed
     // $fullNN keeps the @N.N. placeholders, for the database
     // $full is for display on-screen
     $fullNN = str_replace('/', '', $full);
     // Insert placeholders for any missing/unknown names
     if (strpos($full, '@N.N.') !== false) {
         $full = str_replace('@N.N.', $UNKNOWN_NN, $full);
     }
     if (strpos($full, '@P.N.') !== false) {
         $full = str_replace('@P.N.', $UNKNOWN_PN, $full);
     }
     $full = '<span class="NAME" dir="auto" translate="no">' . preg_replace('/\\/([^\\/]*)\\//', '<span class="SURN">$1</span>', WT_Filter::escapeHtml($full)) . '</span>';
     // The standards say you should use a suffix of '*' for preferred name
     $full = preg_replace('/([^ >]*)\\*/', '<span class="starredname">\\1</span>', $full);
     // Remove prefered-name indicater - they don’t go in the database
     $GIVN = str_replace('*', '', $GIVN);
     $fullNN = str_replace('*', '', $fullNN);
     foreach ($SURNS as $SURN) {
         // Scottish 'Mc and Mac ' prefixes both sort under 'Mac'
         if (strcasecmp(substr($SURN, 0, 2), 'Mc') == 0) {
             $SURN = substr_replace($SURN, 'Mac', 0, 2);
         } elseif (strcasecmp(substr($SURN, 0, 4), 'Mac ') == 0) {
             $SURN = substr_replace($SURN, 'Mac', 0, 4);
         }
         $this->_getAllNames[] = array('type' => $type, 'sort' => $SURN . ',' . $GIVN, 'full' => $full, 'fullNN' => $fullNN, 'surname' => $surname, 'givn' => $GIVN, 'surn' => $SURN);
     }
 }
Exemple #5
0
 function print_time_fact(WT_Fact $event)
 {
     global $basexoffset, $baseyoffset, $factcount, $TEXT_DIRECTION, $WT_IMAGES, $placements;
     $desc = $event->getValue();
     // check if this is a family fact
     $gdate = $event->getDate();
     $date = $gdate->MinDate();
     $date = $date->convert_to_cal('gregorian');
     $year = $date->y;
     $month = max(1, $date->m);
     $day = max(1, $date->d);
     $xoffset = $basexoffset + 22;
     $yoffset = $baseyoffset + ($year - $this->baseyear) * $this->scale - $this->scale;
     $yoffset = $yoffset + $month / 12 * $this->scale;
     $yoffset = $yoffset + $day / 30 * ($this->scale / 12);
     $yoffset = (int) $yoffset;
     $place = (int) ($yoffset / $this->bheight);
     $i = 1;
     $j = 0;
     $tyoffset = 0;
     while (isset($placements[$place])) {
         if ($i == $j) {
             $tyoffset = $this->bheight * $i;
             $i++;
         } else {
             $tyoffset = -1 * $this->bheight * $j;
             $j++;
         }
         $place = (int) (($yoffset + $tyoffset) / $this->bheight);
     }
     $yoffset += $tyoffset;
     $xoffset += abs($tyoffset);
     $placements[$place] = $yoffset;
     echo "<div id=\"fact{$factcount}\" style=\"position:absolute; " . ($TEXT_DIRECTION == "ltr" ? "left: " . $xoffset : "right: " . $xoffset) . "px; top:" . $yoffset . "px; font-size: 8pt; height: " . $this->bheight . "px;\" onmousedown=\"factMouseDown(this, '" . $factcount . "', " . ($yoffset - $tyoffset) . ");\">";
     echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"cursor: hand;\"><tr><td>";
     echo "<img src=\"" . $WT_IMAGES["hline"] . "\" name=\"boxline{$factcount}\" id=\"boxline{$factcount}\" height=\"3\" align=\"left\" width=\"10\" alt=\"\" style=\"padding-";
     if ($TEXT_DIRECTION == "ltr") {
         echo "left";
     } else {
         echo "right";
     }
     echo ": 3px;\">";
     $col = $event->temp % 6;
     echo "</td><td valign=\"top\" class=\"person" . $col . "\">";
     if (count($this->pids) > 6) {
         echo $event->getParent()->getFullName() . ' — ';
     }
     $record = $event->getParent();
     echo $event->getLabel();
     echo ' — ';
     if ($record instanceof WT_Individual) {
         echo format_fact_date($event, $record, false, false);
     } elseif ($record instanceof WT_Family) {
         echo $gdate->Display(false);
         if ($record->getHusband() && $record->getHusband()->getBirthDate()->isOK()) {
             $ageh = get_age_at_event(WT_Date::GetAgeGedcom($record->getHusband()->getBirthDate(), $gdate), false);
         } else {
             $ageh = null;
         }
         if ($record->getWife() && $record->getWife()->getBirthDate()->isOK()) {
             $agew = get_age_at_event(WT_Date::GetAgeGedcom($record->getWife()->getBirthDate(), $gdate), false);
         } else {
             $agew = null;
         }
         if ($ageh && $agew) {
             echo '<span class="age"> ', WT_I18N::translate('Husband’s age'), ' ', $ageh, ' ', WT_I18N::translate('Wife’s age'), ' ', $agew, '</span>';
         } elseif ($ageh) {
             echo '<span class="age"> ', WT_I18N::translate('Age'), ' ', $ageh, '</span>';
         } elseif ($agew) {
             echo '<span class="age"> ', WT_I18N::translate('Age'), ' ', $ageh, '</span>';
         }
     }
     echo ' ' . WT_Filter::escapeHtml($desc);
     if (!$event->getPlace()->isEmpty()) {
         echo ' — ' . $event->getPlace()->getShortName();
     }
     // print spouse name for marriage events
     if (isset($event->spouse)) {
         $spouse = $event->spouse;
     } else {
         $spouse = null;
     }
     if ($spouse) {
         for ($p = 0; $p < count($this->pids); $p++) {
             if ($this->pids[$p] == $spouse->getXref()) {
                 break;
             }
         }
         if ($p == count($this->pids)) {
             $p = $event->temp;
         }
         if ($spouse->getXref() != $this->pids[$p]) {
             echo ' <a href="', $spouse->getHtmlUrl(), '">', $spouse->getFullName(), '</a>';
         } else {
             echo ' <a href="', $event->getParent()->getHtmlUrl(), '">', $event->getParent()->getFullName(), '</a>';
         }
     }
     echo "</td></tr></table>";
     echo "</div>";
     if ($TEXT_DIRECTION == 'ltr') {
         $img = "dline2";
         $ypos = "0%";
     } else {
         $img = "dline";
         $ypos = "100%";
     }
     $dyoffset = $yoffset - $tyoffset + $this->bheight / 3;
     if ($tyoffset < 0) {
         $dyoffset = $yoffset + $this->bheight / 3;
         if ($TEXT_DIRECTION == 'ltr') {
             $img = "dline";
             $ypos = "100%";
         } else {
             $img = "dline2";
             $ypos = "0%";
         }
     }
     // print the diagnal line
     echo "<div id=\"dbox{$factcount}\" style=\"position:absolute; " . ($TEXT_DIRECTION == "ltr" ? "left: " . ($basexoffset + 25) : "right: " . ($basexoffset + 25)) . "px; top:" . $dyoffset . "px; font-size: 8pt; height: " . abs($tyoffset) . "px; width: " . abs($tyoffset) . "px;";
     echo " background-image: url('" . $WT_IMAGES[$img] . "');";
     echo " background-position: 0% {$ypos};\">";
     echo "</div>";
 }
function print_findindi_link($element_id, $indiname = '', $ged = WT_GEDCOM)
{
    return '<a href="#" onclick="findIndi(document.getElementById(\'' . $element_id . '\'), document.getElementById(\'' . $indiname . '\'), \'' . WT_Filter::escapeHtml($ged) . '\'); return false;" class="icon-button_indi" title="' . WT_I18N::translate('Find an individual') . '"></a>';
}
Exemple #7
0
     $falpha = '';
     $show_all_firstnames = 'no';
 } else {
     $givn_initials = WT_Query_Name::givenAlpha($surname, $alpha, $show_marnm, true, WT_GED_ID);
     // Break long lists by initial letter of given name
     if ($surname || $show_all == 'yes') {
         // Don't show the list until we have some filter criteria
         $show = $falpha || $show_all_firstnames == 'yes' ? 'indi' : 'none';
         $list = array();
         foreach ($givn_initials as $givn_initial => $count) {
             switch ($givn_initial) {
                 case '@':
                     $html = $UNKNOWN_PN;
                     break;
                 default:
                     $html = WT_Filter::escapeHtml($givn_initial);
                     break;
             }
             if ($count) {
                 if ($show == 'indi' && $givn_initial == $falpha && $show_all_firstnames == 'no') {
                     $list[] = '<a class="warning" href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . WT_I18N::number($count) . '">' . $html . '</a>';
                 } else {
                     $list[] = '<a href="' . $url . '&amp;falpha=' . rawurlencode($givn_initial) . '" title="' . WT_I18N::number($count) . '">' . $html . '</a>';
                 }
             } else {
                 $list[] = $html;
             }
         }
         // Search spiders don't get the "show all" option as the other links give them everything.
         if (!$SEARCH_SPIDER) {
             if ($show_all_firstnames == 'yes') {
Exemple #8
0
function media_object_info(WT_Media $media)
{
    $xref = $media->getXref();
    $gedcom = WT_Tree::getNameFromId($media->getGedcomId());
    $name = $media->getFullName();
    $html = '<b>' . $name . '</b>' . '<div><i>' . WT_Filter::escapeHtml($media->getNote()) . '</i></div>' . '<br>' . '<a href="' . $media->getHtmlUrl() . '">' . WT_I18N::translate('View') . '</a>';
    $html .= ' - ' . '<a onclick="window.open(\'addmedia.php?action=editmedia&amp;pid=' . $xref . '&ged=' . WT_Filter::escapeJs($gedcom) . '\', \'_blank\', edit_window_specs)" href="#">' . WT_I18N::Translate('Edit') . '</a>' . ' - ' . '<a onclick="return delete_media(\'' . WT_Filter::escapeJs(WT_I18N::translate('Are you sure you want to delete “%s”?', strip_tags($media->getFullName()))) . '\', \'' . $media->getXref() . '\', \'' . WT_Filter::escapeJs($gedcom) . '\');" href="#">' . WT_I18N::Translate('Delete') . '</a>' . ' - ';
    if (array_key_exists('GEDFact_assistant', WT_Module::getActiveModules())) {
        $html .= '<a onclick="return ilinkitem(\'' . $xref . '\', \'manage\', \'' . $gedcom . '\')" href="#">' . WT_I18N::Translate('Manage links') . '</a>';
    } else {
        global $TEXT_DIRECTION;
        $classSuffix = $TEXT_DIRECTION == 'rtl' ? '_rtl' : '';
        $menu = new WT_Menu();
        $menu->addLabel(WT_I18N::translate('Set link'));
        $menu->addClass('', 'submenu');
        $submenu = new WT_Menu(WT_I18N::translate('To individual'));
        $submenu->addClass("submenuitem" . $classSuffix);
        $submenu->addOnClick("return ilinkitem('{$xref}', 'person', '{$gedcom}')");
        $menu->addSubMenu($submenu);
        $submenu = new WT_Menu(WT_I18N::translate('To family'));
        $submenu->addClass("submenuitem" . $classSuffix);
        $submenu->addOnClick("return ilinkitem('{$xref}', 'family', '{$gedcom}')");
        $menu->addSubMenu($submenu);
        $submenu = new WT_Menu(WT_I18N::translate('To source'));
        $submenu->addClass("submenuitem" . $classSuffix);
        $submenu->addOnClick("return ilinkitem('{$xref}', 'source', '{$gedcom}')");
        $menu->addSubMenu($submenu);
        $html .= '<div style="display:inline-block;">' . $menu->getMenu() . '</div>';
    }
    $html .= '<br><br>';
    $linked = array();
    foreach ($media->linkedIndividuals('OBJE') as $link) {
        $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>';
    }
    foreach ($media->linkedFamilies('OBJE') as $link) {
        $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>';
    }
    foreach ($media->linkedSources('OBJE') as $link) {
        $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>';
    }
    foreach ($media->linkedNotes('OBJE') as $link) {
        // Invalid GEDCOM - you cannot link a NOTE to an OBJE
        $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>';
    }
    foreach ($media->linkedRepositories('OBJE') as $link) {
        // Invalid GEDCOM - you cannot link a REPO to an OBJE
        $linked[] = '<a href="' . $link->getHtmlUrl() . '">' . $link->getFullName() . '</a>';
    }
    if ($linked) {
        $html .= '<ul>';
        foreach ($linked as $link) {
            $html .= '<li>' . $link . '</li>';
        }
        $html .= '</ul>';
    } else {
        $html .= '<div class="error">' . WT_I18N::translate('This media object is not linked to any other record.') . '</div>';
    }
    return $html;
}
Exemple #9
0
<?php 
    $menu_items = array(WT_MenuBar::getGedcomMenu(), WT_MenuBar::getMyPageMenu(), WT_MenuBar::getChartsMenu(), WT_MenuBar::getListsMenu(), WT_MenuBar::getCalendarMenu(), WT_MenuBar::getReportsMenu(), WT_MenuBar::getSearchMenu());
    foreach (WT_MenuBar::getModuleMenus() as $menu) {
        $menu_items[] = $menu;
    }
    // Print the menu bar
    echo '<div id="topMenu">', '<ul id="main-menu">';
    foreach ($menu_items as $menu) {
        if ($menu) {
            echo getMenuAsCustomList($menu);
        }
    }
    echo '</ul>';
    echo '<div id="menu-right">', '<ul class="makeMenu">';
    if (WT_USER_ID) {
        echo '<li><a href="edituser.php" class="link">', WT_Filter::escapeHtml(Auth::user()->getRealName()), '</a></li><li>', logout_link(), '</li>';
        if (WT_USER_CAN_ACCEPT && exists_pending_change()) {
            echo ' <li><a href="#" onclick="window.open(\'edit_changes.php\',\'_blank\', chan_window_specs); return false;" style="color:red;">', WT_I18N::translate('Pending changes'), '</a></li>';
        }
    } else {
        echo '<li>', login_link(), '</li>';
    }
    $menu = WT_MenuBar::getFavoritesMenu();
    if ($menu) {
        echo $menu->getMenuAsList();
    }
    $menu = WT_MenuBar::getLanguageMenu();
    if ($menu) {
        echo $menu->getMenuAsList();
    }
    $menu = WT_MenuBar::getThemeMenu();
Exemple #10
0
    public function configureBlock($block_id)
    {
        if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
            set_block_setting($block_id, 'gedcom', WT_Filter::post('gedcom'));
            set_block_setting($block_id, 'title', WT_Filter::post('title'));
            set_block_setting($block_id, 'html', WT_Filter::post('html'));
            set_block_setting($block_id, 'show_timestamp', WT_Filter::postBool('show_timestamp'));
            set_block_setting($block_id, 'timestamp', WT_Filter::post('timestamp'));
            $languages = array();
            foreach (WT_I18N::installed_languages() as $code => $name) {
                if (WT_Filter::postBool('lang_' . $code)) {
                    $languages[] = $code;
                }
            }
            set_block_setting($block_id, 'languages', implode(',', $languages));
            exit;
        }
        require_once WT_ROOT . 'includes/functions/functions_edit.php';
        $templates = array(WT_I18N::translate('Keyword examples') => '#getAllTagsTable#', WT_I18N::translate('Narrative description') => WT_I18N::translate('This GEDCOM (family tree) was last updated on #gedcomUpdated#. There are #totalSurnames# surnames in this family tree. The earliest recorded event is the #firstEventType# of #firstEventName# in #firstEventYear#. The most recent event is the #lastEventType# of #lastEventName# in #lastEventYear#.<br><br>If you have any comments or feedback please contact #contactWebmaster#.'), WT_I18N::translate('Statistics') => '<div class="gedcom_stats">
				<span style="font-weight: bold"><a href="index.php?command=gedcom">#gedcomTitle#</a></span><br>
				' . WT_I18N::translate('This family tree was last updated on %s.', '#gedcomUpdated#') . '
				<table id="keywords">
					<tr>
						<td valign="top" class="width20">
							<table cellspacing="1" cellpadding="0">
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Individuals') . '</td>
									<td class="facts_value" align="right"><a href="indilist.php?surname_sublist=no">#totalIndividuals#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Males') . '</td>
									<td class="facts_value" align="right">#totalSexMales#<br>#totalSexMalesPercentage#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Females') . '</td>
									<td class="facts_value" align="right">#totalSexFemales#<br>#totalSexFemalesPercentage#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Total surnames') . '</td>
									<td class="facts_value" align="right"><a href="indilist.php?show_all=yes&amp;surname_sublist=yes&amp;ged=' . WT_GEDURL . '">#totalSurnames#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Families') . '</td>
									<td class="facts_value" align="right"><a href="famlist.php?ged=' . WT_GEDURL . '">#totalFamilies#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Sources') . '</td>
									<td class="facts_value" align="right"><a href="sourcelist.php?ged=' . WT_GEDURL . '">#totalSources#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Media objects') . '</td>
									<td class="facts_value" align="right"><a href="medialist.php?ged=' . WT_GEDURL . '">#totalMedia#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Repositories') . '</td>
									<td class="facts_value" align="right"><a href="repolist.php?ged=' . WT_GEDURL . '">#totalRepositories#</a></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Total events') . '</td>
									<td class="facts_value" align="right">#totalEvents#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Total users') . '</td>
									<td class="facts_value" align="right">#totalUsers#</td>
								</tr>
							</table>
						</td>
						<td><br></td>
						<td valign="top">
							<table cellspacing="1" cellpadding="0" border="0">
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Earliest birth year') . '</td>
									<td class="facts_value" align="right">#firstBirthYear#</td>
									<td class="facts_value">#firstBirth#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Latest birth year') . '</td>
									<td class="facts_value" align="right">#lastBirthYear#</td>
									<td class="facts_value">#lastBirth#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Earliest death year') . '</td>
									<td class="facts_value" align="right">#firstDeathYear#</td>
									<td class="facts_value">#firstDeath#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Latest death year') . '</td>
									<td class="facts_value" align="right">#lastDeathYear#</td>
									<td class="facts_value">#lastDeath#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Individual who lived the longest') . '</td>
									<td class="facts_value" align="right">#longestLifeAge#</td>
									<td class="facts_value">#longestLife#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Average age at death') . '</td>
									<td class="facts_value" align="right">#averageLifespan#</td>
									<td class="facts_value"></td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Family with the most children') . '</td>
									<td class="facts_value" align="right">#largestFamilySize#</td>
									<td class="facts_value">#largestFamily#</td>
								</tr>
								<tr>
									<td class="facts_label">' . WT_I18N::translate('Average number of children per family') . '</td>
									<td class="facts_value" align="right">#averageChildren#</td>
									<td class="facts_value"></td>
								</tr>
							</table>
						</td>
					</tr>
				</table><br>
				<span style="font-weight: bold">' . WT_I18N::translate('Most common surnames') . '</span><br>
				#commonSurnames#
			</div>');
        $title = get_block_setting($block_id, 'title');
        $html = get_block_setting($block_id, 'html');
        // title
        echo '<tr><td class="descriptionbox wrap">', WT_Gedcom_Tag::getLabel('TITL'), '</td><td class="optionbox"><input type="text" name="title" size="30" value="', WT_Filter::escapeHtml($title), '"></td></tr>';
        // templates
        echo '<tr><td class="descriptionbox wrap">', WT_I18N::translate('Templates'), help_link('block_html_template', $this->getName()), '</td><td class="optionbox">';
        // The CK editor needs lots of help to load/save data :-(
        if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
            $ckeditor_onchange = 'CKEDITOR.instances.html.setData(document.block.html.value);';
        } else {
            $ckeditor_onchange = '';
        }
        echo '<select name="template" onchange="document.block.html.value=document.block.template.options[document.block.template.selectedIndex].value;', $ckeditor_onchange, '">';
        echo '<option value="', WT_Filter::escapeHtml($html), '">', WT_I18N::translate('Custom'), '</option>';
        foreach ($templates as $title => $template) {
            echo '<option value="', WT_Filter::escapeHtml($template), '">', $title, '</option>';
        }
        echo '</select></td></tr>';
        // gedcom
        $gedcom = get_block_setting($block_id, 'gedcom');
        if (count(WT_Tree::getAll()) > 1) {
            if ($gedcom == '__current__') {
                $sel_current = ' selected="selected"';
            } else {
                $sel_current = '';
            }
            if ($gedcom == '__default__') {
                $sel_default = ' selected="selected"';
            } else {
                $sel_default = '';
            }
            echo '<tr><td class="descriptionbox wrap">', WT_I18N::translate('Family tree'), '</td><td class="optionbox">', '<select name="gedcom">', '<option value="__current__"', $sel_current, '>', WT_I18N::translate('Current'), '</option>', '<option value="__default__"', $sel_default, '>', WT_I18N::translate('Default'), '</option>';
            foreach (WT_Tree::getAll() as $tree) {
                if ($tree->tree_name == $gedcom) {
                    $sel = ' selected="selected"';
                } else {
                    $sel = '';
                }
                echo '<option value="', $tree->tree_name, '"', $sel, ' dir="auto">', $tree->tree_title_html, '</option>';
            }
            echo '</select></td></tr>';
        }
        // html
        echo '<tr><td colspan="2" class="descriptionbox">', WT_I18N::translate('Content'), help_link('block_html_content', $this->getName()), '</td></tr><tr>', '<td colspan="2" class="optionbox">';
        echo '<textarea name="html" class="html-edit" rows="10" style="width:98%;">', WT_Filter::escapeHtml($html), '</textarea>';
        echo '</td></tr>';
        $show_timestamp = get_block_setting($block_id, 'show_timestamp', false);
        echo '<tr><td class="descriptionbox wrap">';
        echo WT_I18N::translate('Show the date and time of update');
        echo '</td><td class="optionbox">';
        echo edit_field_yes_no('show_timestamp', $show_timestamp);
        echo '<input type="hidden" name="timestamp" value="', WT_TIMESTAMP, '">';
        echo '</td></tr>';
        $languages = get_block_setting($block_id, 'languages');
        echo '<tr><td class="descriptionbox wrap">';
        echo WT_I18N::translate('Show this block for which languages?');
        echo '</td><td class="optionbox">';
        echo edit_language_checkboxes('lang_', $languages);
        echo '</td></tr>';
    }
Exemple #11
0
function myplot($mytitle, $n, $xdata, $xtitle, $ydata, $ytitle, $legend)
{
    global $percentage, $male_female;
    global $ymax, $scalefactor, $datastring, $imgurl;
    //Google Chart API only allows text encoding for numbers less than 100
    //and it does not allow adjusting the y-axis range, so we must find the maximum y-value
    //in order to adjust beforehand by changing the numbers
    if ($male_female == 1) {
        $stop = 2;
    } else {
        $stop = count($ydata);
    }
    $yprocentmax = 0;
    if ($percentage) {
        for ($i = 0; $i < $stop; $i++) {
            $ytotal = 0;
            $ymax = 0;
            $yprocent = 0;
            if (isset($ydata[$i])) {
                for ($j = 0; $j < count($ydata[$i]); $j++) {
                    if ($ydata[$i][$j] > $ymax) {
                        $ymax = $ydata[$i][$j];
                    }
                    $ytotal += $ydata[$i][$j];
                }
                $yt[$i] = $ytotal;
                if ($ytotal > 0) {
                    $yprocent = round($ymax / $ytotal * 100, 1);
                }
                if ($yprocentmax < $yprocent) {
                    $yprocentmax = $yprocent;
                }
            }
        }
        $ymax = $yprocentmax;
        if ($ymax > 0) {
            $scalefactor = 100.0 / $ymax;
        } else {
            $scalefactor = 0;
        }
        $datastring = 'chd=t:';
        for ($i = 0; $i < $stop; $i++) {
            if (isset($ydata[$i])) {
                for ($j = 0; $j < count($ydata[$i]); $j++) {
                    if ($yt[$i] > 0) {
                        $datastring .= round($ydata[$i][$j] / $yt[$i] * 100 * $scalefactor, 1);
                    } else {
                        $datastring .= '0';
                    }
                    if (!($j == count($ydata[$i]) - 1)) {
                        $datastring .= ',';
                    }
                }
                if (!($i == $stop - 1)) {
                    $datastring .= '|';
                }
            }
        }
    } else {
        for ($i = 0; $i < $stop; $i++) {
            for ($j = 0; $j < count($ydata[$i]); $j++) {
                if ($ydata[$i][$j] > $ymax) {
                    $ymax = $ydata[$i][$j];
                }
            }
        }
        if ($ymax > 0) {
            $scalefactor = 100.0 / $ymax;
        } else {
            $scalefactor = 0;
        }
        $datastring = 'chd=t:';
        for ($i = 0; $i < $stop; $i++) {
            for ($j = 0; $j < count($ydata[$i]); $j++) {
                $datastring .= round($ydata[$i][$j] * $scalefactor, 1);
                if (!($j == count($ydata[$i]) - 1)) {
                    $datastring .= ',';
                }
            }
            if (!($i == $stop - 1)) {
                $datastring .= '|';
            }
        }
    }
    $colors = array('0000FF', 'FFA0CB', '9F00FF', 'FF7000', '905030', 'FF0000', '00FF00', 'F0F000');
    $colorstring = 'chco=';
    for ($i = 0; $i < $stop; $i++) {
        if (isset($colors[$i])) {
            $colorstring .= $colors[$i];
            if ($i != $stop - 1) {
                $colorstring .= ',';
            }
        }
    }
    $titleLength = strpos($mytitle . "\n", "\n");
    $title = substr($mytitle, 0, $titleLength);
    $imgurl = 'https://chart.googleapis.com/chart?cht=bvg&amp;chs=950x300&amp;chf=bg,s,ffffff00|c,s,ffffff00&amp;chtt=' . rawurlencode($title) . '&amp;' . $datastring . '&amp;' . $colorstring . '&amp;chbh=';
    if (count($ydata) > 3) {
        $imgurl .= '5,1';
    } else {
        if (count($ydata) < 2) {
            $imgurl .= '45,1';
        } else {
            $imgurl .= '20,3';
        }
    }
    $imgurl .= '&amp;chxt=x,x,y,y&amp;chxl=0:|';
    for ($i = 0; $i < count($xdata); $i++) {
        $imgurl .= $xdata[$i] . '|';
    }
    $imgurl .= '1:||||' . rawurlencode($xtitle) . '|2:|';
    $imgurl .= '0|';
    if ($percentage) {
        for ($i = 1; $i < 11; $i++) {
            if ($ymax < 11) {
                $imgurl .= round($ymax * $i / 10, 1) . '|';
            } else {
                $imgurl .= round($ymax * $i / 10, 0) . '|';
            }
        }
        $imgurl .= '3:||%|';
    } else {
        if ($ymax < 11) {
            for ($i = 1; $i < $ymax + 1; $i++) {
                $imgurl .= round($ymax * $i / $ymax, 0) . '|';
            }
        } else {
            for ($i = 1; $i < 11; $i++) {
                $imgurl .= round($ymax * $i / 10, 0) . '|';
            }
        }
        $imgurl .= '3:||' . rawurlencode($ytitle) . '|';
    }
    //only show legend if y-data is non-2-dimensional
    if (count($ydata) > 1) {
        $imgurl .= '&amp;chdl=';
        for ($i = 0; $i < count($legend); $i++) {
            $imgurl .= rawurlencode($legend[$i]);
            if (!($i == count($legend) - 1)) {
                $imgurl .= '|';
            }
        }
    }
    // in PHP 5.3.0 we can use
    //$title = strstr($mytitle, '|', true);
    $title = substr($mytitle, 0, strpos($mytitle, '|'));
    echo '<img src="', $imgurl, '" width="950" height="300" alt="', WT_Filter::escapeHtml($title), '" title="', WT_Filter::escapeHtml($title), '">';
}
    // Look for PGV in some nearby directories
    $pgv_dirs = array();
    $dir = opendir(realpath('..'));
    while (($subdir = readdir($dir)) !== false) {
        if (is_dir('../' . $subdir) && file_exists('../' . $subdir . '/config.php')) {
            $pgv_dirs[] = '../' . $subdir;
        }
    }
    closedir($dir);
    echo '<form action="', WT_SCRIPT_NAME, '" method="post">', '<p>', WT_I18N::translate('Where is your PhpGedView installation?'), '</p>', '<dl>', '<dt>', WT_I18N::translate('Installation directory'), '</dt>';
    switch (count($pgv_dirs)) {
        case '0':
            echo '<dd><input type="text" name="PGV_PATH" size="40" value="" autofocus></dd>';
            break;
        case '1':
            echo '<dd><input type="text" name="PGV_PATH" size="40" value="' . WT_Filter::escapeHtml($pgv_dirs[0]) . '" autofocus></dd>';
            break;
        default:
            echo '<dd><input type="text" name="PGV_PATH" size="40" value="" autofocus></dd>';
            echo '<dt>', 'PhpGedView might be found in these locations', '</dt>';
            echo '<dd>';
            foreach ($pgv_dirs as $pgvpath) {
                echo '<p class="pgv">', $pgvpath, '</p>';
            }
            echo '</dd>';
            break;
    }
    echo '</dl>', '<div class="center"><input type="submit" value="' . WT_I18N::translate('next') . '"></div>', '</form>', '</div>';
    exit;
}
// Run in a transaction
Exemple #13
0
 private function edit()
 {
     require_once WT_ROOT . 'includes/functions/functions_edit.php';
     if (WT_USER_CAN_EDIT) {
         if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
             $block_id = WT_Filter::postInteger('block_id');
             if ($block_id) {
                 WT_DB::prepare("UPDATE `##block` SET gedcom_id=?, xref=? WHERE block_id=?")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $block_id));
             } else {
                 WT_DB::prepare("INSERT INTO `##block` (gedcom_id, xref, module_name, block_order) VALUES (?, ?, ?, ?)")->execute(array(WT_Filter::postInteger('gedcom_id'), WT_Filter::post('xref', WT_REGEX_XREF), $this->getName(), 0));
                 $block_id = WT_DB::getInstance()->lastInsertId();
             }
             set_block_setting($block_id, 'title', WT_Filter::post('title'));
             set_block_setting($block_id, 'story_body', WT_Filter::post('story_body'));
             $languages = array();
             foreach (WT_I18N::installed_languages() as $code => $name) {
                 if (WT_Filter::postBool('lang_' . $code)) {
                     $languages[] = $code;
                 }
             }
             set_block_setting($block_id, 'languages', implode(',', $languages));
             $this->config();
         } else {
             $block_id = WT_Filter::getInteger('block_id');
             $controller = new WT_Controller_Page();
             if ($block_id) {
                 $controller->setPageTitle(WT_I18N::translate('Edit story'));
                 $title = get_block_setting($block_id, 'title');
                 $story_body = get_block_setting($block_id, 'story_body');
                 $gedcom_id = WT_DB::prepare("SELECT gedcom_id FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
                 $xref = WT_DB::prepare("SELECT xref FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOne();
             } else {
                 $controller->setPageTitle(WT_I18N::translate('Add a story'));
                 $title = '';
                 $story_body = '';
                 $gedcom_id = WT_GED_ID;
                 $xref = WT_Filter::get('xref', WT_REGEX_XREF);
             }
             $controller->pageHeader()->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
             if (array_key_exists('ckeditor', WT_Module::getActiveModules())) {
                 ckeditor_WT_Module::enableEditor($controller);
             }
             echo '<form name="story" method="post" action="module.php?mod=', $this->getName(), '&amp;mod_action=admin_edit">';
             echo WT_Filter::getCsrf();
             echo '<input type="hidden" name="save" value="1">';
             echo '<input type="hidden" name="block_id" value="', $block_id, '">';
             echo '<input type="hidden" name="gedcom_id" value="', WT_GED_ID, '">';
             echo '<table id="story_module">';
             echo '<tr><th>';
             echo WT_I18N::translate('Story title');
             echo '</th></tr><tr><td><textarea name="title" rows="1" cols="90" tabindex="2">', WT_Filter::escapeHtml($title), '</textarea></td></tr>';
             echo '<tr><th>';
             echo WT_I18N::translate('Story');
             echo '</th></tr><tr><td>';
             echo '<textarea name="story_body" class="html-edit" rows="10" cols="90" tabindex="2">', WT_Filter::escapeHtml($story_body), '</textarea>';
             echo '</td></tr>';
             echo '</table><table id="story_module2">';
             echo '<tr>';
             echo '<th>', WT_I18N::translate('Individual'), '</th>';
             echo '<th>', WT_I18N::translate('Show this block for which languages?'), '</th>';
             echo '</tr>';
             echo '<tr>';
             echo '<td class="optionbox">';
             echo '<input data-autocomplete-type="INDI" type="text" name="xref" id="pid" size="4" value="' . $xref . '">';
             echo print_findindi_link('pid');
             if ($xref) {
                 $person = WT_Individual::getInstance($xref);
                 if ($person) {
                     echo ' ', $person->format_list('span');
                 }
             }
             echo '</td>';
             $languages = get_block_setting($block_id, 'languages');
             echo '<td class="optionbox">';
             echo edit_language_checkboxes('lang_', $languages);
             echo '</td></tr></table>';
             echo '<p><input type="submit" value="', WT_I18N::translate('save'), '" tabindex="5">';
             echo '</p>';
             echo '</form>';
             exit;
         }
     } else {
         header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
         exit;
     }
 }
                }
            }
            break;
    }
}
if ($custom_themes) {
    echo '<br>', WT_I18N::translate('You should consult the theme’s author to confirm compatibility with this version of webtrees.');
    echo '<br>', '<button type="submit" name="themes" value="disable">', WT_I18N::translate('Disable these themes'), '</button> — ', WT_I18N::translate('You can re-enable these themes after the upgrade.');
    echo '<br>', '<button type="submit" name="themes" value="ignore">', WT_I18N::translate('Upgrade anyway'), '</button> — ', WT_I18N::translate('Caution: old themes may not work, or they may prevent webtrees from working.');
    echo '</li></ul></form>';
    exit;
} else {
    if ($themes_action != 'ignore') {
        echo '<br>', WT_I18N::translate('No custom themes are enabled.'), $icon_success;
    }
    echo '<input type="hidden" name="themes" value="', WT_Filter::escapeHtml($themes_action), '">';
}
echo '</li>';
flush();
////////////////////////////////////////////////////////////////////////////////
// Make a backup of genealogy data
////////////////////////////////////////////////////////////////////////////////
echo '<li>', WT_I18N::translate('Export all family trees to GEDCOM files…');
foreach (WT_Tree::getAll() as $tree) {
    reset_timeout();
    $filename = WT_DATA_DIR . $tree->tree_name . date('-Y-m-d') . '.ged';
    if ($tree->exportGedcom($filename)) {
        echo '<br>', WT_I18N::translate('Family tree exported to %s.', '<span dir="ltr">' . $filename . '</span>'), $icon_success;
    } else {
        echo '<br>', WT_I18N::translate('Unable to create %s.  Check the permissions.', '<span dir="ltr">' . $filename . '</span>'), $icon_failure;
    }
        WT_DB::exec("LOCK TABLE" . " `##individuals` WRITE," . " `##individuals` AS individuals2 READ," . " `##families` WRITE," . " `##families` AS families2 READ," . " `##sources` WRITE," . " `##sources` AS sources2 READ," . " `##media` WRITE," . " `##media` AS media2 READ," . " `##other` WRITE," . " `##other` AS other2 READ," . " `##name` WRITE," . " `##name` AS name2 READ," . " `##placelinks` WRITE," . " `##placelinks` AS placelinks2 READ," . " `##change` WRITE," . " `##change` AS change2 READ," . " `##dates` WRITE," . " `##dates` AS dates2 READ," . " `##default_resn` WRITE," . " `##default_resn` AS default_resn2 READ," . " `##hit_counter` WRITE," . " `##hit_counter` AS hit_counter2 READ," . " `##link` WRITE," . " `##link` AS link2 READ");
        try {
            WT_DB::prepare("INSERT INTO `##individuals` (i_id, i_file, i_rin, i_sex, i_gedcom)" . " SELECT i_id, ?, i_rin, i_sex, i_gedcom FROM `##individuals` AS individuals2 WHERE i_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##families` (f_id, f_file, f_husb, f_wife, f_gedcom, f_numchil)" . " SELECT f_id, ?, f_husb, f_wife, f_gedcom, f_numchil FROM `##families` AS families2 WHERE f_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##sources` (s_id, s_file, s_name, s_gedcom)" . " SELECT s_id, ?, s_name, s_gedcom FROM `##sources` AS sources2 WHERE s_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##media` (m_id, m_ext, m_type, m_titl, m_filename, m_file, m_gedcom)" . " SELECT m_id, m_ext, m_type, m_titl, m_filename, ?, m_gedcom FROM `##media` AS media2 WHERE m_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##other` (o_id, o_file, o_type, o_gedcom)" . " SELECT o_id, ?, o_type, o_gedcom FROM `##other` AS other2 WHERE o_file = ? AND o_type NOT IN ('HEAD', 'TRLR')")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##name` (n_file, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm)" . " SELECT ?, n_id, n_num, n_type, n_sort, n_full, n_surname, n_surn, n_givn, n_soundex_givn_std, n_soundex_surn_std, n_soundex_givn_dm, n_soundex_surn_dm FROM `##name` AS name2 WHERE n_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##placelinks` (pl_p_id, pl_gid, pl_file)" . " SELECT pl_p_id, pl_gid, ? FROM `##placelinks` AS placelinks2 WHERE pl_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##dates` (d_day, d_month, d_mon, d_year, d_julianday1, d_julianday2, d_fact, d_gid, d_file, d_type)" . " SELECT d_day, d_month, d_mon, d_year, d_julianday1, d_julianday2, d_fact, d_gid, ?, d_type FROM `##dates` AS dates2 WHERE d_file = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##default_resn` (gedcom_id, xref, tag_type, resn, comment, updated)" . " SELECT ?, xref, tag_type, resn, comment, updated FROM `##default_resn` AS default_resn2 WHERE gedcom_id = ?")->execute(array($ged2_id, WT_GED_ID));
            WT_DB::prepare("INSERT INTO `##link` (l_file, l_from, l_type, l_to)" . " SELECT ?, l_from, l_type, l_to FROM `##link` AS link2 WHERE l_file = ?")->execute(array($ged2_id, WT_GED_ID));
            // This table may contain old (deleted) references, which could clash.  IGNORE these.
            WT_DB::prepare("INSERT IGNORE INTO `##change` (change_time, status, gedcom_id, xref, old_gedcom, new_gedcom, user_id)" . " SELECT change_time, status, ?, xref, old_gedcom, new_gedcom, user_id FROM `##change` AS change2 WHERE gedcom_id = ?")->execute(array($ged2_id, WT_GED_ID));
            // This table may contain old (deleted) references, which could clash.  IGNORE these.
            WT_DB::prepare("INSERT IGNORE INTO `##hit_counter` (gedcom_id, page_name, page_parameter, page_count)" . " SELECT ?, page_name, page_parameter, page_count FROM `##hit_counter` AS hit_counter2 WHERE gedcom_id = ? AND page_name <> 'index.php'")->execute(array($ged2_id, WT_GED_ID));
            echo '<p>', WT_I18N::translate('The family trees were merged successfully.'), '</p>';
        } catch (Exception $ex) {
            WT_DB::exec("ROLLBACK");
            echo '<p>', WT_I18N::translate('Oops!  An unexpected database error occurred.'), '</p>';
            echo '<pre>', $ex, '</pre>';
        }
        WT_DB::exec("UNLOCK TABLES");
        WT_DB::exec("COMMIT");
    }
}
echo '<form method="POST" action="', WT_SCRIPT_NAME, '">';
echo '<input type="hidden" name="go" value="1">';
echo '<p>', WT_I18N::translate('Copy all the records from %1$s into %2$s.', WT_Filter::escapeHtml($WT_TREE->tree_title), select_edit_control('ged2_id', WT_Tree::getIdList(), null, $ged2_id)), '</p>';
echo '<input type="submit" value="', WT_I18N::translate('continue'), '">';
echo '</form>';
    $currentFieldSearch = $controller->getField($i);
    // Get this field’s name and the search criterion
    $currentField = substr($currentFieldSearch, 0, strrpos($currentFieldSearch, ':'));
    // Get the actual field name
    ?>
				<input tabindex="<?php 
    echo $i + 1;
    ?>
" type="text" id="value<?php 
    echo $i;
    ?>
" name="values[<?php 
    echo $i;
    ?>
]" value="<?php 
    echo WT_Filter::escapeHtml($controller->getValue($i));
    ?>
"<?php 
    echo substr($controller->getField($i), -4) == 'PLAC' ? 'data-autocomplete-type="PLAC"' : '';
    ?>
>
			<?php 
    if (preg_match("/^NAME:/", $currentFieldSearch) > 0) {
        ?>
				<select name="fields[<?php 
        echo $i;
        ?>
]">
					<option value="<?php 
        echo $currentField;
        ?>
Exemple #17
0
         foreach ($options as $option) {
             $opt = explode('=>', $option);
             list($value, $display) = $opt;
             if (substr($display, 0, 18) == 'WT_I18N::translate' || substr($display, 0, 15) == 'WT_I18N::number' || substr($display, 0, 23) == 'WT_Gedcom_Tag::getLabel') {
                 eval("\$display={$display};");
             }
             echo '<option value="', WT_Filter::escapeHtml($value), '"';
             if ($opt[0] == $input['default']) {
                 echo ' selected="selected"';
             }
             echo '>', WT_Filter::escapeHtml($display), '</option>';
         }
         echo '</select>';
     }
     if (isset($input['lookup'])) {
         echo '<input type="hidden" name="type[', WT_Filter::escapeHtml($input['name']), ']" value="', WT_Filter::escapeHtml($input['lookup']), '">';
         if ($input['lookup'] == 'INDI') {
             echo print_findindi_link('pid');
         } elseif ($input['lookup'] == 'PLAC') {
             echo print_findplace_link($input['name']);
         } elseif ($input['lookup'] == 'FAM') {
             echo print_findfamily_link('famid');
         } elseif ($input['lookup'] == 'SOUR') {
             echo print_findsource_link($input['name']);
         } elseif ($input['lookup'] == 'DATE') {
             echo ' <a href="#" onclick="cal_toggleDate(\'div_', WT_Filter::EscapeJs($input['name']), '\', \'', WT_Filter::EscapeJs($input['name']), '\'); return false;" class="icon-button_calendar" title="', WT_I18N::translate('Select a date'), '"></a>';
             echo '<div id="div_', WT_Filter::EscapeHtml($input['name']), '" style="position:absolute;visibility:hidden;background-color:white;"></div>';
         }
     }
     echo '</td></tr>';
 }
Exemple #18
0
    private function adminPlaces()
    {
        require WT_ROOT . 'includes/functions/functions_edit.php';
        $action = WT_Filter::get('action');
        $parent = WT_Filter::get('parent');
        $inactive = WT_Filter::getBool('inactive');
        $deleteRecord = WT_Filter::get('deleteRecord');
        if (!isset($parent)) {
            $parent = 0;
        }
        $controller = new WT_Controller_Page();
        $controller->restrictAccess(Auth::isAdmin());
        if ($action == 'ExportFile' && Auth::isAdmin()) {
            Zend_Session::writeClose();
            $tmp = $this->placeIdToHierarchy($parent);
            $maxLevel = $this->getHighestLevel();
            if ($maxLevel > 8) {
                $maxLevel = 8;
            }
            $tmp[0] = 'places';
            $outputFileName = preg_replace('/[:;\\/\\\\(\\)\\{\\}\\[\\] $]/', '_', implode('-', $tmp)) . '.csv';
            header('Content-Type: application/octet-stream');
            header('Content-Disposition: attachment; filename="' . $outputFileName . '"');
            echo '"', WT_I18N::translate('Level'), '";"', WT_I18N::translate('Country'), '";';
            if ($maxLevel > 0) {
                echo '"', WT_I18N::translate('State'), '";';
            }
            if ($maxLevel > 1) {
                echo '"', WT_I18N::translate('County'), '";';
            }
            if ($maxLevel > 2) {
                echo '"', WT_I18N::translate('City'), '";';
            }
            if ($maxLevel > 3) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            if ($maxLevel > 4) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            if ($maxLevel > 5) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            if ($maxLevel > 6) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            if ($maxLevel > 7) {
                echo '"', WT_I18N::translate('Place'), '";';
            }
            echo '"', WT_I18N::translate('Longitude'), '";"', WT_I18N::translate('Latitude'), '";';
            echo '"', WT_I18N::translate('Zoom level'), '";"', WT_I18N::translate('Icon'), '";', WT_EOL;
            $this->outputLevel($parent);
            exit;
        }
        $controller->setPageTitle(WT_I18N::translate('Google Maps™'))->pageHeader();
        ?>
		<table id="gm_config">
			<tr>
				<th>
					<a href="module.php?mod=googlemap&amp;mod_action=admin_config">
						<?php 
        echo WT_I18N::translate('Google Maps™ preferences');
        ?>
					</a>
				</th>
				<th>
					<a class="current" href="module.php?mod=googlemap&amp;mod_action=admin_places">
						<?php 
        echo WT_I18N::translate('Geographic data');
        ?>
					</a>
				</th>
				<th>
					<a href="module.php?mod=googlemap&amp;mod_action=admin_placecheck">
						<?php 
        echo WT_I18N::translate('Place check');
        ?>
					</a>
				</th>
			</tr>
		</table>
		<?php 
        if ($action == 'ImportGedcom') {
            $placelist = array();
            $j = 0;
            $gedcom_records = WT_DB::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")->execute(array(WT_GED_ID, WT_GED_ID))->fetchOneColumn();
            foreach ($gedcom_records as $gedrec) {
                $i = 1;
                $placerec = get_sub_record(2, '2 PLAC', $gedrec, $i);
                while (!empty($placerec)) {
                    if (preg_match("/2 PLAC (.+)/", $placerec, $match)) {
                        $placelist[$j] = array();
                        $placelist[$j]['place'] = trim($match[1]);
                        if (preg_match("/4 LATI (.*)/", $placerec, $match)) {
                            $placelist[$j]['lati'] = trim($match[1]);
                            if ($placelist[$j]['lati'][0] != 'N' && $placelist[$j]['lati'][0] != 'S') {
                                if ($placelist[$j]['lati'] < 0) {
                                    $placelist[$j]['lati'][0] = 'S';
                                } else {
                                    $placelist[$j]['lati'] = 'N' . $placelist[$j]['lati'];
                                }
                            }
                        } else {
                            $placelist[$j]['lati'] = NULL;
                        }
                        if (preg_match("/4 LONG (.*)/", $placerec, $match)) {
                            $placelist[$j]['long'] = trim($match[1]);
                            if ($placelist[$j]['long'][0] != 'E' && $placelist[$j]['long'][0] != 'W') {
                                if ($placelist[$j]['long'] < 0) {
                                    $placelist[$j]['long'][0] = 'W';
                                } else {
                                    $placelist[$j]['long'] = 'E' . $placelist[$j]['long'];
                                }
                            }
                        } else {
                            $placelist[$j]['long'] = NULL;
                        }
                        $j = $j + 1;
                    }
                    $i = $i + 1;
                    $placerec = get_sub_record(2, '2 PLAC', $gedrec, $i);
                }
            }
            asort($placelist);
            $prevPlace = '';
            $prevLati = '';
            $prevLong = '';
            $placelistUniq = array();
            $j = 0;
            foreach ($placelist as $k => $place) {
                if ($place['place'] != $prevPlace) {
                    $placelistUniq[$j] = array();
                    $placelistUniq[$j]['place'] = $place['place'];
                    $placelistUniq[$j]['lati'] = $place['lati'];
                    $placelistUniq[$j]['long'] = $place['long'];
                    $j = $j + 1;
                } elseif ($place['place'] == $prevPlace && ($place['lati'] != $prevLati || $place['long'] != $prevLong)) {
                    if ($placelistUniq[$j - 1]['lati'] == 0 || $placelistUniq[$j - 1]['long'] == 0) {
                        $placelistUniq[$j - 1]['lati'] = $place['lati'];
                        $placelistUniq[$j - 1]['long'] = $place['long'];
                    } elseif ($place['lati'] != '0' || $place['long'] != '0') {
                        echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>';
                    }
                }
                $prevPlace = $place['place'];
                $prevLati = $place['lati'];
                $prevLong = $place['long'];
            }
            $highestIndex = $this->getHighestIndex();
            $default_zoom_level = array(4, 7, 10, 12);
            foreach ($placelistUniq as $k => $place) {
                $parent = preg_split('/ *, */', $place['place']);
                $parent = array_reverse($parent);
                $parent_id = 0;
                for ($i = 0; $i < count($parent); $i++) {
                    if (!isset($default_zoom_level[$i])) {
                        $default_zoom_level[$i] = $default_zoom_level[$i - 1];
                    }
                    $escparent = $parent[$i];
                    if ($escparent == '') {
                        $escparent = 'Unknown';
                    }
                    $row = WT_DB::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ?")->execute(array($i, $parent_id, $escparent))->fetchOneRow();
                    if ($i < count($parent) - 1) {
                        // Create higher-level places, if necessary
                        if (empty($row)) {
                            $highestIndex++;
                            WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom) VALUES (?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $default_zoom_level[$i]));
                            echo WT_Filter::escapeHtml($escparent), '<br>';
                            $parent_id = $highestIndex;
                        } else {
                            $parent_id = $row->pl_id;
                        }
                    } else {
                        // Create lowest-level place, if necessary
                        if (empty($row->pl_id)) {
                            $highestIndex++;
                            WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom) VALUES (?, ?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $default_zoom_level[$i]));
                            echo WT_Filter::escapeHtml($escparent), '<br>';
                        } else {
                            if (empty($row->pl_long) && empty($row->pl_lati) && $place['lati'] != '0' && $place['long'] != '0') {
                                WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $row->pl_id));
                                echo WT_Filter::escapeHtml($escparent), '<br>';
                            }
                        }
                    }
                }
            }
            $parent = 0;
        }
        if ($action == 'ImportFile') {
            $placefiles = array();
            $this->findFiles(WT_MODULES_DIR . 'googlemap/extra');
            sort($placefiles);
            ?>
		<form method="post" enctype="multipart/form-data" id="importfile" name="importfile" action="module.php?mod=googlemap&amp;mod_action=admin_places&amp;action=ImportFile2">
			<table class="gm_plac_edit">
				<tr>
					<th><?php 
            echo WT_I18N::translate('File containing places (CSV)');
            ?>
</th>
					<td><input type="file" name="placesfile" size="50"></td>
				</tr>
				<?php 
            if (count($placefiles) > 0) {
                ?>
				<tr>
					<th><?php 
                echo WT_I18N::translate('Server file containing places (CSV)'), help_link('PLIF_LOCALFILE', 'googlemap');
                ?>
</th>
					<td>
						<select name="localfile">
							<option></option>
							<?php 
                foreach ($placefiles as $p => $placefile) {
                    ?>
							<option value="<?php 
                    echo WT_Filter::escapeHtml($placefile);
                    ?>
"><?php 
                    if (substr($placefile, 0, 1) == "/") {
                        echo substr($placefile, 1);
                    } else {
                        echo $placefile;
                    }
                    ?>
</option>
							<?php 
                }
                ?>
						</select>
					</td>
				</tr>
				<?php 
            }
            ?>
				<tr>
					<th><?php 
            echo WT_I18N::translate('Delete all existing geographic data before importing the file.');
            ?>
</th>
					<td><input type="checkbox" name="cleardatabase"></td>
				</tr>
				<tr>
					<th><?php 
            echo WT_I18N::translate('Do not create new locations, just import coordinates for existing locations.');
            ?>
</th>
					<td><input type="checkbox" name="updateonly"></td>
				</tr>
				<tr>
					<th><?php 
            echo WT_I18N::translate('Overwrite existing coordinates.');
            ?>
</th>
					<td><input type="checkbox" name="overwritedata"></td>
				</tr>
			</table>
			<input id="savebutton" type="submit" value="<?php 
            echo WT_I18N::translate('Continue adding');
            ?>
"><br>
		</form>
		<?php 
            exit;
        }
        if ($action == 'ImportFile2') {
            $country_names = array();
            foreach (WT_Stats::iso3166() as $key => $value) {
                $country_names[$key] = WT_I18N::translate($key);
            }
            if (isset($_POST['cleardatabase'])) {
                WT_DB::exec("DELETE FROM `##placelocation` WHERE 1=1");
            }
            if (!empty($_FILES['placesfile']['tmp_name'])) {
                $lines = file($_FILES['placesfile']['tmp_name']);
            } elseif (!empty($_REQUEST['localfile'])) {
                $lines = file(WT_MODULES_DIR . 'googlemap/extra' . $_REQUEST['localfile']);
            }
            // Strip BYTE-ORDER-MARK, if present
            if (!empty($lines[0]) && substr($lines[0], 0, 3) == WT_UTF8_BOM) {
                $lines[0] = substr($lines[0], 3);
            }
            asort($lines);
            $highestIndex = $this->getHighestIndex();
            $placelist = array();
            $j = 0;
            $maxLevel = 0;
            foreach ($lines as $p => $placerec) {
                $fieldrec = explode(';', $placerec);
                if ($fieldrec[0] > $maxLevel) {
                    $maxLevel = $fieldrec[0];
                }
            }
            $fields = count($fieldrec);
            $set_icon = true;
            if (!is_dir(WT_MODULES_DIR . 'googlemap/places/flags/')) {
                $set_icon = false;
            }
            foreach ($lines as $p => $placerec) {
                $fieldrec = explode(';', $placerec);
                if (is_numeric($fieldrec[0]) && $fieldrec[0] <= $maxLevel) {
                    $placelist[$j] = array();
                    $placelist[$j]['place'] = '';
                    for ($ii = $fields - 4; $ii > 1; $ii--) {
                        if ($fieldrec[0] > $ii - 2) {
                            $placelist[$j]['place'] .= $fieldrec[$ii] . ',';
                        }
                    }
                    foreach ($country_names as $countrycode => $countryname) {
                        if ($countrycode == strtoupper($fieldrec[1])) {
                            $fieldrec[1] = $countryname;
                            break;
                        }
                    }
                    $placelist[$j]['place'] .= $fieldrec[1];
                    $placelist[$j]['long'] = $fieldrec[$fields - 4];
                    $placelist[$j]['lati'] = $fieldrec[$fields - 3];
                    $placelist[$j]['zoom'] = $fieldrec[$fields - 2];
                    if ($set_icon) {
                        $placelist[$j]['icon'] = trim($fieldrec[$fields - 1]);
                    } else {
                        $placelist[$j]['icon'] = '';
                    }
                    $j = $j + 1;
                }
            }
            $prevPlace = '';
            $prevLati = '';
            $prevLong = '';
            $placelistUniq = array();
            $j = 0;
            foreach ($placelist as $k => $place) {
                if ($place['place'] != $prevPlace) {
                    $placelistUniq[$j] = array();
                    $placelistUniq[$j]['place'] = $place['place'];
                    $placelistUniq[$j]['lati'] = $place['lati'];
                    $placelistUniq[$j]['long'] = $place['long'];
                    $placelistUniq[$j]['zoom'] = $place['zoom'];
                    $placelistUniq[$j]['icon'] = $place['icon'];
                    $j = $j + 1;
                } elseif ($place['place'] == $prevPlace && ($place['lati'] != $prevLati || $place['long'] != $prevLong)) {
                    if ($placelistUniq[$j - 1]['lati'] == 0 || $placelistUniq[$j - 1]['long'] == 0) {
                        $placelistUniq[$j - 1]['lati'] = $place['lati'];
                        $placelistUniq[$j - 1]['long'] = $place['long'];
                        $placelistUniq[$j - 1]['zoom'] = $place['zoom'];
                        $placelistUniq[$j - 1]['icon'] = $place['icon'];
                    } elseif ($place['lati'] != '0' || $place['long'] != '0') {
                        echo 'Difference: previous value = ', $prevPlace, ', ', $prevLati, ', ', $prevLong, ' current = ', $place['place'], ', ', $place['lati'], ', ', $place['long'], '<br>';
                    }
                }
                $prevPlace = $place['place'];
                $prevLati = $place['lati'];
                $prevLong = $place['long'];
            }
            $default_zoom_level = array();
            $default_zoom_level[0] = 4;
            $default_zoom_level[1] = 7;
            $default_zoom_level[2] = 10;
            $default_zoom_level[3] = 12;
            foreach ($placelistUniq as $k => $place) {
                $parent = explode(',', $place['place']);
                $parent = array_reverse($parent);
                $parent_id = 0;
                for ($i = 0; $i < count($parent); $i++) {
                    $escparent = $parent[$i];
                    if ($escparent == '') {
                        $escparent = 'Unknown';
                    }
                    $row = WT_DB::prepare("SELECT pl_id, pl_long, pl_lati, pl_zoom, pl_icon FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place")->execute(array($i, $parent_id, $escparent))->fetchOneRow();
                    if (empty($row)) {
                        // this name does not yet exist: create entry
                        if (!isset($_POST['updateonly'])) {
                            $highestIndex = $highestIndex + 1;
                            if ($i + 1 == count($parent)) {
                                $zoomlevel = $place['zoom'];
                            } elseif (isset($default_zoom_level[$i])) {
                                $zoomlevel = $default_zoom_level[$i];
                            } else {
                                $zoomlevel = $this->getSetting('GM_MAX_ZOOM');
                            }
                            if ($place['lati'] == '0' || $place['long'] == '0' || $i + 1 < count($parent)) {
                                WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $zoomlevel, $place['icon']));
                            } else {
                                //delete leading zero
                                $pl_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $place['lati']);
                                $pl_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $place['long']);
                                if ($pl_lati >= 0) {
                                    $place['lati'] = 'N' . abs($pl_lati);
                                } elseif ($pl_lati < 0) {
                                    $place['lati'] = 'S' . abs($pl_lati);
                                }
                                if ($pl_long >= 0) {
                                    $place['long'] = 'E' . abs($pl_long);
                                } elseif ($pl_long < 0) {
                                    $place['long'] = 'W' . abs($pl_long);
                                }
                                WT_DB::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")->execute(array($highestIndex, $parent_id, $i, $escparent, $place['long'], $place['lati'], $zoomlevel, $place['icon']));
                            }
                            $parent_id = $highestIndex;
                        }
                    } else {
                        $parent_id = $row->pl_id;
                        if (isset($_POST['overwritedata']) && $i + 1 == count($parent)) {
                            WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $place['zoom'], $place['icon'], $parent_id));
                        } else {
                            if (($row->pl_long == '0' || $row->pl_long == null) && ($row->pl_lati == '0' || $row->pl_lati == null)) {
                                WT_DB::prepare("UPDATE `##placelocation` SET pl_lati=?, pl_long=? WHERE pl_id=?")->execute(array($place['lati'], $place['long'], $parent_id));
                            }
                            if (empty($row->pl_icon) && !empty($place['icon'])) {
                                WT_DB::prepare("UPDATE `##placelocation` SET pl_icon=? WHERE pl_id=?")->execute(array($place['icon'], $parent_id));
                            }
                        }
                    }
                }
            }
            $parent = 0;
        }
        if ($action == 'DeleteRecord') {
            $exists = WT_DB::prepare("SELECT 1 FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($deleteRecord))->fetchOne();
            if (!$exists) {
                WT_DB::prepare("DELETE FROM `##placelocation` WHERE pl_id=?")->execute(array($deleteRecord));
            } else {
                echo '<table class="facts_table"><tr><td>', WT_I18N::translate('Location not removed: this location contains sub-locations'), '</td></tr></table>';
            }
        }
        ?>
		<script>
		function updateList(inactive) {
			window.location.href='<?php 
        if (strstr($_SERVER['REQUEST_URI'], '&inactive', true)) {
            $uri = strstr($_SERVER['REQUEST_URI'], '&inactive', true);
        } else {
            $uri = $_SERVER['REQUEST_URI'];
        }
        echo $uri, '&inactive=';
        ?>
'+inactive;
		}

		function edit_place_location(placeid) {
			window.open('module.php?mod=googlemap&mod_action=places_edit&action=update&placeid='+placeid, '_blank', gmap_window_specs);
			return false;
		}

		function add_place_location(placeid) {
			window.open('module.php?mod=googlemap&mod_action=places_edit&action=add&placeid='+placeid, '_blank', gmap_window_specs);
			return false;
		}

		function delete_place(placeid) {
			var answer=confirm('<?php 
        echo WT_I18N::translate('Remove this location?');
        ?>
');
			if (answer == true) {
				window.location = '<?php 
        echo $_SERVER['REQUEST_URI'];
        ?>
&action=DeleteRecord&deleteRecord=' + placeid;
			}
		}
		</script>
		<?php 
        echo '<div id="gm_breadcrumb">';
        $where_am_i = $this->placeIdToHierarchy($parent);
        foreach (array_reverse($where_am_i, true) as $id => $place) {
            if ($id == $parent) {
                if ($place != 'Unknown') {
                    echo WT_Filter::escapeHtml($place);
                } else {
                    echo WT_I18N::translate('unknown');
                }
            } else {
                echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $id, '&inactive=', $inactive, '">';
                if ($place != 'Unknown') {
                    echo WT_Filter::escapeHtml($place), '</a>';
                } else {
                    echo WT_I18N::translate('unknown'), '</a>';
                }
            }
            echo ' - ';
        }
        echo '<a href="module.php?mod=googlemap&mod_action=admin_places&parent=0&inactive=', $inactive, '">', WT_I18N::translate('Top level'), '</a></div>';
        echo '<form name="active" method="post" action="module.php?mod=googlemap&mod_action=admin_places&parent=', $parent, '&inactive=', $inactive, '"><div id="gm_active">';
        echo '<label for="inactive">', WT_I18N::translate('Show inactive places'), '</label>';
        echo '<input type="checkbox" name="inactive" id="inactive"';
        if ($inactive) {
            echo ' checked="checked"';
        }
        echo ' onclick="updateList(this.checked)"';
        echo '>', help_link('PLE_ACTIVE', 'googlemap'), '</div></form>';
        $placelist = $this->getPlaceListLocation($parent, $inactive);
        echo '<div class="gm_plac_edit">';
        echo '<table class="gm_plac_edit"><tr>';
        echo '<th>', WT_Gedcom_Tag::getLabel('PLAC'), '</th>';
        echo '<th>', WT_Gedcom_Tag::getLabel('LATI'), '</th>';
        echo '<th>', WT_Gedcom_Tag::getLabel('LONG'), '</th>';
        echo '<th>', WT_I18N::translate('Zoom level'), '</th>';
        echo '<th>', WT_I18N::translate('Icon'), '</th>';
        echo '<th>';
        echo WT_I18N::translate('Edit'), '</th><th>', WT_I18N::translate('Delete'), '</th></tr>';
        if (count($placelist) == 0) {
            echo '<tr><td colspan="7" class="accepted">', WT_I18N::translate('No places found'), '</td></tr>';
        }
        foreach ($placelist as $place) {
            echo '<tr><td><a href="module.php?mod=googlemap&mod_action=admin_places&parent=', $place['place_id'], '&inactive=', $inactive, '">';
            if ($place['place'] != 'Unknown') {
                echo WT_Filter::escapeHtml($place['place']), '</a></td>';
            } else {
                echo WT_I18N::translate('unknown'), '</a></td>';
            }
            echo '<td>', $place['lati'], '</td>';
            echo '<td>', $place['long'], '</td>';
            echo '<td>', $place['zoom'], '</td>';
            echo '<td>';
            if ($place['icon'] == NULL || $place['icon'] == '') {
                if ($place['lati'] == NULL || $place['long'] == NULL || $place['lati'] == '0' && $place['long'] == '0') {
                    echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_yellow.png">';
                } else {
                    echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/mm_20_red.png">';
                }
            } else {
                echo '<img src="', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place['icon'], '" width="25" height="15">';
            }
            echo '</td>';
            echo '<td class="narrow"><a href="#" onclick="edit_place_location(', $place['place_id'], ');return false;" class="icon-edit" title="', WT_I18N::translate('Edit'), '"></a></td>';
            $noRows = WT_DB::prepare("SELECT COUNT(pl_id) FROM `##placelocation` WHERE pl_parent_id=?")->execute(array($place['place_id']))->fetchOne();
            if ($noRows == 0) {
                ?>
				<td><a href="#" onclick="delete_place(<?php 
                echo $place['place_id'];
                ?>
);return false;" class="icon-delete" title="<?php 
                echo WT_I18N::translate('Remove');
                ?>
"></a></td>
		<?php 
            } else {
                ?>
				<td><i class="icon-delete-grey"></i></td>
		<?php 
            }
            ?>
			</tr>
			<?php 
        }
        ?>
		</table>
		</div>

		<table id="gm_manage">
			<tr>
				<td>
					<?php 
        echo WT_I18N::translate('Add  a new geographic location');
        ?>
				</td>
				<td>
					<form action="?" onsubmit="add_place_location(this.parent_id.options[this.parent_id.selectedIndex].value); return false;">
						<?php 
        echo select_edit_control('parent_id', $where_am_i, WT_I18N::translate('Top level'), $parent);
        ?>
						<input type="submit" value="<?php 
        echo WT_I18N::translate('Add');
        ?>
">
					</form>
				</td>
			</tr>
			<tr>
				<td>
					<?php 
        echo WT_I18N::translate('Import all places from a family tree');
        ?>
				</td>
				<td>
					<form action="module.php" method="get">
						<input type="hidden" name="mod" value="googlemap">
						<input type="hidden" name="mod_action" value="admin_places">
						<input type="hidden" name="action" value="ImportGedcom">
						<?php 
        echo select_edit_control('ged', WT_Tree::getNameList(), null, WT_GEDCOM);
        ?>
						<input type="submit" value="<?php 
        echo WT_I18N::translate('Import');
        ?>
">
					</form>
				</td>
			</tr>
			<tr>
				<td>
					<?php 
        echo WT_I18N::translate('Upload geographic data');
        ?>
				</td>
				<td>
					<form action="module.php" method="get">
						<input type="hidden" name="mod" value="googlemap">
						<input type="hidden" name="mod_action" value="admin_places">
						<input type="hidden" name="action" value="ImportFile">
						<input type="submit" value="<?php 
        echo WT_I18N::translate('Upload');
        ?>
">
					</form>
				</td>
			</tr>
			<tr>
				<td>
					<?php 
        echo WT_I18N::translate('Download geographic data');
        ?>
				</td>
				<td>
					<form action="module.php" method="get">
						<input type="hidden" name="mod" value="googlemap">
						<input type="hidden" name="mod_action" value="admin_places">
						<input type="hidden" name="action" value="ExportFile">
						<?php 
        echo select_edit_control('parent', $where_am_i, WT_I18N::translate('All'), WT_GED_ID);
        ?>
						<input type="submit" value="<?php 
        echo WT_I18N::translate('Download');
        ?>
">
					</form>
				</td>
			</tr>
		</table>
		<?php 
    }
Exemple #19
0
            ?>
').toggle();">
				</span>
			<?php 
        }
        ?>
			<br>
		<?php 
    } else {
        echo '<div class="error">', WT_I18N::translate('This information is private and cannot be shown.'), '</div>';
        ?>
			<input type="hidden" name="pids[<?php 
        echo $p;
        ?>
]" value="<?php 
        echo WT_Filter::escapeHtml($pid);
        ?>
">
				<br>
				<a href="timeline.php?<?php 
        echo $controller->pidlinks;
        ?>
&amp;scale=<?php 
        echo $controller->scale;
        ?>
&amp;remove=<?php 
        echo $pid;
        ?>
&amp;ged=<?php 
        echo WT_GEDURL;
        ?>
Exemple #20
0
				</label>
			</div>
			<div>
				<label for="username">', WT_I18N::translate('Desired user name'), help_link('username'), '<input type="text" id="username" name="user_name" required maxlength="32" value="', WT_Filter::escapeHtml($user_name), '">
				</label>
			</div>
			<div>
				<label for="user_password01">', WT_I18N::translate('Desired password'), help_link('password'), '<input type="password" id="user_password01" name="user_password01" value="', WT_Filter::escapeHtml($user_password01), '" required placeholder="', WT_I18N::plural('Use at least %s character.', 'Use at least %s characters.', WT_MINIMUM_PASSWORD_LENGTH, WT_I18N::number(WT_MINIMUM_PASSWORD_LENGTH)), '" pattern="' . WT_REGEX_PASSWORD . '" onchange="form.user_password02.pattern = regex_quote(this.value);">
				</label>
			</div>
			<div>
				<label for="user_password02">', WT_I18N::translate('Confirm password'), help_link('password_confirm'), '<input type="password" id="user_password02" name="user_password02" value="', WT_Filter::escapeHtml($user_password02), '" required placeholder="', WT_I18N::translate('Type the password again.'), '" pattern="' . WT_REGEX_PASSWORD . '">
				</label>
			</div>
			<div>
				<label for="user_comments">', WT_I18N::translate('Comments'), help_link('register_comments'), '<textarea cols="50" rows="5" id="user_comments" name="user_comments" required placeholder="', WT_I18N::translate('Explain why you are requesting an account.'), '">', WT_Filter::escapeHtml($user_comments), '</textarea>
				</label>
			</div>
			<hr>
			<div id="registration-submit">
				<input type="submit" value="', WT_I18N::translate('continue'), '">
			</div>
		</form>
	</div>
	</div>';
        break;
    case 'userverify':
        if (!WT_Site::preference('USE_REGISTRATION_MODULE')) {
            header('Location: ' . WT_SERVER_NAME . WT_SCRIPT_PATH);
            exit;
        }
Exemple #21
0
<tr><td><?php 
                echo WT_Filter::escapeHtml($user->getUserName()), " - ", WT_Filter::escapeHtml($user->getRealName()), ":&nbsp;&nbsp;", WT_I18N::translate('User didn’t verify within 7 days.');
                $ucnt++;
                ?>
</td><td><input type="checkbox" checked="checked" name="del_<?php 
                echo $user->getUserId();
                ?>
" value="1"></td></tr><?php 
            }
        }
        // Check users not verified by admin
        foreach (User::all() as $user) {
            if (!$user->getSetting('verified_by_admin') && $user->getSetting('verified')) {
                ?>
<tr><td><?php 
                echo WT_Filter::escapeHtml($user->getUserName()), " - ", WT_Filter::escapeHtml($user->getRealName()), ":&nbsp;&nbsp;", WT_I18N::translate('User not verified by administrator.');
                ?>
</td><td><input type="checkbox" name="del_<?php 
                echo $user->getUserId();
                ?>
" value="1"></td></tr><?php 
                $ucnt++;
            }
        }
        if ($ucnt == 0) {
            echo "<tr><td class=\"accepted\" colspan=\"2\">";
            echo WT_I18N::translate('Nothing found to cleanup'), "</td></tr>";
        }
        ?>
	</table>
	<p>
Exemple #22
0
 /**
  * print information for a name record
  *
  * @param WT_Fact $event the event object
  */
 function print_name_record(WT_Fact $event)
 {
     global $WT_TREE;
     $factrec = $event->getGedcom();
     // Create a dummy record, so we can extract the formatted NAME value from the event.
     $dummy = new WT_Individual('xref', "0 @xref@ INDI\n1 DEAT Y\n" . $factrec, null, WT_GED_ID);
     $all_names = $dummy->getAllNames();
     $primary_name = $all_names[0];
     $this->name_count++;
     if ($this->name_count > 1) {
         echo '<h3 class="name_two">', $dummy->getFullName(), '</h3>';
     }
     //Other names accordion element
     echo '<div class="indi_name_details';
     if ($event->isOld()) {
         echo ' old';
     }
     if ($event->isNew()) {
         echo ' new';
     }
     echo '">';
     echo '<div class="name1">';
     echo '<dl><dt class="label">', WT_I18N::translate('Name'), '</dt>';
     $dummy->setPrimaryName(0);
     echo '<dd class="field">', $dummy->getFullName();
     if ($this->name_count == 1) {
         if (Auth::isAdmin()) {
             $user = User::findByGenealogyRecord($WT_TREE, $this->record);
             if ($user) {
                 echo '<span> - <a class="warning" href="admin_users.php?filter=' . WT_Filter::escapeHtml($user->getUserName()) . '">' . WT_Filter::escapeHtml($user->getUserName()) . '</a></span>';
             }
         }
     }
     if ($this->record->canEdit() && !$event->isOld()) {
         echo "<div class=\"deletelink\"><a class=\"deleteicon\" href=\"#\" onclick=\"return delete_fact('" . WT_I18N::translate('Are you sure you want to delete this fact?') . "', '" . $this->record->getXref() . "', '" . $event->getFactId() . "');\" title=\"" . WT_I18N::translate('Delete this name') . "\"><span class=\"link_text\">" . WT_I18N::translate('Delete this name') . "</span></a></div>";
         echo "<div class=\"editlink\"><a href=\"#\" class=\"editicon\" onclick=\"edit_name('" . $this->record->getXref() . "', '" . $event->getFactId() . "'); return false;\" title=\"" . WT_I18N::translate('Edit name') . "\"><span class=\"link_text\">" . WT_I18N::translate('Edit name') . "</span></a></div>";
     }
     echo '</dd>';
     echo '</dl>';
     echo '</div>';
     $ct = preg_match_all('/\\n2 (\\w+) (.*)/', $factrec, $nmatch, PREG_SET_ORDER);
     for ($i = 0; $i < $ct; $i++) {
         echo '<div>';
         $fact = $nmatch[$i][1];
         if ($fact != 'SOUR' && $fact != 'NOTE' && $fact != 'SPFX') {
             echo '<dl><dt class="label">', WT_Gedcom_Tag::getLabel($fact, $this->record), '</dt>';
             echo '<dd class="field">';
             // Before using dir="auto" on this field, note that Gecko treats this as an inline element but WebKit treats it as a block element
             if (isset($nmatch[$i][2])) {
                 $name = WT_Filter::escapeHtml($nmatch[$i][2]);
                 $name = str_replace('/', '', $name);
                 $name = preg_replace('/(\\S*)\\*/', '<span class="starredname">\\1</span>', $name);
                 switch ($fact) {
                     case 'TYPE':
                         echo WT_Gedcom_Code_Name::getValue($name, $this->record);
                         break;
                     case 'SURN':
                         // The SURN field is not necessarily the surname.
                         // Where it is not a substring of the real surname, show it after the real surname.
                         $surname = WT_Filter::escapeHtml($primary_name['surname']);
                         if (strpos($primary_name['surname'], str_replace(',', ' ', $nmatch[$i][2])) !== false) {
                             echo $surname;
                         } else {
                             echo WT_I18N::translate('%1$s (%2$s)', $surname, $name);
                         }
                         break;
                     default:
                         echo $name;
                         break;
                 }
             }
             echo '</dd>';
             echo '</dl>';
         }
         echo '</div>';
     }
     if (preg_match("/\n2 SOUR/", $factrec)) {
         echo '<div id="indi_sour" class="clearfloat">', print_fact_sources($factrec, 2), '</div>';
     }
     if (preg_match("/\n2 NOTE/", $factrec)) {
         echo '<div id="indi_note" class="clearfloat">', print_fact_notes($factrec, 2), '</div>';
     }
     echo '</div>';
 }
/**
 * Print SOUR structure
 *
 *  This function prints the input array of SOUR sub-records built by the
 *  getSourceStructure() function.
 */
function printSourceStructure($textSOUR)
{
    global $WT_TREE;
    $html = '';
    if ($textSOUR['PAGE']) {
        $html .= WT_Gedcom_Tag::getLabelValue('PAGE', WT_Filter::expandUrls($textSOUR['PAGE']));
    }
    if ($textSOUR['EVEN']) {
        $html .= WT_Gedcom_Tag::getLabelValue('EVEN', WT_Filter::escapeHtml($textSOUR['EVEN']));
        if ($textSOUR['ROLE']) {
            $html .= WT_Gedcom_Tag::getLabelValue('ROLE', WT_Filter::escapeHtml($textSOUR['ROLE']));
        }
    }
    if ($textSOUR['DATE'] || count($textSOUR['TEXT'])) {
        if ($textSOUR['DATE']) {
            $date = new WT_Date($textSOUR['DATE']);
            $html .= WT_Gedcom_Tag::getLabelValue('DATA:DATE', $date->Display(false));
        }
        foreach ($textSOUR['TEXT'] as $text) {
            $html .= WT_Gedcom_Tag::getLabelValue('TEXT', WT_Filter::formatText($text, $WT_TREE));
        }
    }
    if ($textSOUR['QUAY'] != '') {
        $html .= WT_Gedcom_Tag::getLabelValue('QUAY', WT_Gedcom_Code_Quay::getValue($textSOUR['QUAY']));
    }
    return '<div class="indent">' . $html . '</div>';
}
        }
        // Total filtered/unfiltered rows
        $recordsFiltered = WT_DB::prepare("SELECT FOUND_ROWS()")->fetchColumn();
        $recordsTotal = WT_DB::prepare($SELECT2 . $WHERE)->execute($args)->fetchColumn();
        header('Content-type: application/json');
        echo json_encode(array('sEcho' => WT_Filter::getInteger('sEcho'), 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data));
        exit;
}
$controller->pageHeader()->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript('
		jQuery("#log_list").dataTable( {
			dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\',
			processing: true,
			serverSide: true,
			ajax: "' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?action=load_json&from=' . $from . '&to=' . $to . '&type=' . $type . '&text=' . rawurlencode($text) . '&ip=' . rawurlencode($ip) . '&user='******'&gedc=' . rawurlencode($gedc) . '",
			' . WT_I18N::datatablesI18N(array(10, 20, 50, 100, 500, 1000, -1)) . ',
			jQueryUI: true,
			autoWidth: false,
			sorting: [[ 0, "desc" ]],
			pageLength: ' . Auth::user()->getSetting('admin_site_log_page_size', 20) . ',
			pagingType: "full_numbers"
		});
	');
$url = WT_SCRIPT_NAME . '?from=' . rawurlencode($from) . '&amp;to=' . rawurlencode($to) . '&amp;type=' . rawurlencode($type) . '&amp;text=' . rawurlencode($text) . '&amp;ip=' . rawurlencode($ip) . '&amp;user='******'&amp;gedc=' . rawurlencode($gedc);
$users_array = array();
foreach (User::all() as $tmp_user) {
    $users_array[$tmp_user->getUserName()] = $tmp_user->getUserName();
}
echo '<form name="logs" method="get" action="' . WT_SCRIPT_NAME . '">', '<input type="hidden" name="action", value="show">', '<table class="site_logs">', '<tr>', '<td colspan="6">', WT_I18N::translate('From %s to %s', '<input class="log-date" name="from" value="' . WT_Filter::escapeHtml($from) . '">', '<input class="log-date" name="to" value="' . WT_Filter::escapeHtml($to) . '">'), '</td>', '</tr><tr>', '<td>', WT_I18N::translate('Type'), '<br>', select_edit_control('type', array('' => '', 'auth' => 'auth', 'config' => 'config', 'debug' => 'debug', 'edit' => 'edit', 'error' => 'error', 'media' => 'media', 'search' => 'search'), null, $type, ''), '</td>', '<td>', WT_I18N::translate('Message'), '<br><input class="log-filter" name="text" value="', WT_Filter::escapeHtml($text), '"> ', '</td>', '<td>', WT_I18N::translate('IP address'), '<br><input class="log-filter" name="ip" value="', WT_Filter::escapeHtml($ip), '"> ', '</td>', '<td>', WT_I18N::translate('User'), '<br>', select_edit_control('user', $users_array, '', $user, ''), '</td>', '<td>', WT_I18N::translate('Family tree'), '<br>', select_edit_control('gedc', WT_Tree::getNameList(), '', $gedc, Auth::isAdmin() ? '' : 'disabled'), '</td>', '</tr><tr>', '<td colspan="6">', '<input type="submit" value="', WT_I18N::translate('Filter'), '">', '<input type="submit" value="', WT_I18N::translate('Export'), '" onclick="document.logs.action.value=\'export\';return true;" ', $action == 'show' ? '' : 'disabled="disabled"', '>', '<input type="submit" value="', WT_I18N::translate('Delete'), '" onclick="if (confirm(\'', WT_Filter::escapeHtml(WT_I18N::translate('Permanently delete these records?')), '\')) {document.logs.action.value=\'delete\';return true;} else {return false;}" ', $action == 'show' ? '' : 'disabled="disabled"', '>', '</td>', '</tr>', '</table>', '</form>';
if ($action) {
    echo '<br>', '<table id="log_list">', '<thead>', '<tr>', '<th>', WT_I18N::translate('Timestamp'), '</th>', '<th>', WT_I18N::translate('Type'), '</th>', '<th>', WT_I18N::translate('Message'), '</th>', '<th>', WT_I18N::translate('IP address'), '</th>', '<th>', WT_I18N::translate('User'), '</th>', '<th>', WT_I18N::translate('Family tree'), '</th>', '</tr>', '</thead>', '<tbody>', '</tbody>', '</table>';
}
Exemple #25
0
     echo '</div>';
 }
 // Output Media
 if ($type == "media") {
     global $dirs;
     $medialist = WT_Query_Media::mediaList('', 'include', 'title', $filter);
     echo '<div id="find-output">';
     if ($medialist) {
         foreach ($medialist as $media) {
             echo '<div class="find-media-media">';
             echo '<div class="find-media-thumb">', $media->displayImage(), '</div>';
             echo '<div class="find-media-details">', $media->getFullName(), '</div>';
             if (!$embed) {
                 echo '<p><a href="#" dir="auto" onclick="pasteid(\'', $media->getXref(), '\');">', $media->getFilename(), '</a></p>';
             } else {
                 echo '<p><a href="#" dir="auto" onclick="pasteid(\'', $media->getXref(), '\', \'', '\', \'', WT_Filter::escapeJs($media->getFilename()), '\');">', WT_Filter::escapeHtml($media->getFilename()), '</a></p> ';
             }
             if ($media->fileExists()) {
                 $imgsize = $media->getImageAttributes();
                 echo WT_Gedcom_Tag::getLabelValue('__IMAGE_SIZE__', $imgsize['WxH']);
             }
             echo '<ul>';
             $found = false;
             foreach ($media->linkedIndividuals('OBJE') as $indindividual) {
                 echo '<li>', $indindividual->getFullName(), '</li>';
                 $found = true;
             }
             foreach ($media->linkedFamilies('OBJE') as $family) {
                 echo '<li>', $family->getFullName(), '</li>';
                 $found = true;
             }
Exemple #26
0
    ?>
	<div id="header">
		<div class="header_img">
			<img src="<?php 
    echo WT_CSS_URL;
    ?>
images/webtrees.png" width="242" height="50" alt="<?php 
    echo WT_WEBTREES;
    ?>
">
		</div>
		<ul id="extra-menu" class="makeMenu">
			<li>
				<?php 
    if (WT_USER_ID) {
        echo '<a href="edituser.php">', WT_I18N::translate('Logged in as '), ' ', WT_Filter::escapeHtml(Auth::user()->getRealName()), '</a></li> <li>', logout_link();
    } else {
        echo login_link();
    }
    ?>
			</li>
			<?php 
    echo WT_MenuBar::getFavoritesMenu();
    ?>
			<?php 
    echo WT_MenuBar::getThemeMenu();
    ?>
			<?php 
    echo WT_MenuBar::getLanguageMenu();
    ?>
		</ul>
Exemple #27
0
 public function displayImage()
 {
     if ($this->isExternal() || !file_exists($this->getServerFilename('thumb'))) {
         // Use an icon
         $mime_type = str_replace('/', '-', $this->mimeType());
         $image = '<i' . ' dir="' . 'auto' . '"' . ' class="' . 'icon-mime-' . $mime_type . '"' . ' title="' . strip_tags($this->getFullName()) . '"' . '></i>';
     } else {
         $imgsize = getimagesize($this->getServerFilename('thumb'));
         // Use a thumbnail image
         $image = '<img' . ' dir="' . 'auto' . '"' . ' src="' . $this->getHtmlUrlDirect('thumb') . '"' . ' alt="' . strip_tags($this->getFullName()) . '"' . ' title="' . strip_tags($this->getFullName()) . '"' . ' ' . $imgsize[3] . '>';
     }
     return '<a' . ' class="' . 'gallery' . '"' . ' href="' . $this->getHtmlUrlDirect('main') . '"' . ' type="' . $this->mimeType() . '"' . ' data-obje-url="' . $this->getHtmlUrl() . '"' . ' data-obje-note="' . WT_Filter::escapeHtml($this->getNote()) . '"' . ' data-title="' . WT_Filter::escapeHtml($this->getFullName()) . '"' . '>' . $image . '</a>';
 }
Exemple #28
0
    public function downloadForm($clip_ctrl)
    {
        global $GEDCOM_MEDIA_PATH;
        $pid = WT_Filter::get('pid', WT_REGEX_XREF);
        $out = '<script>';
        $out .= 'function cancelDownload() {
				var link = "module.php?mod=' . $this->getName() . '&mod_action=ajax&sb_action=clippings&pid=' . $pid . '";
				jQuery("#sb_clippings_content").load(link);
			}';
        $out .= '</script>';
        $out .= '<form method="get" action="module.php">
		<input type="hidden" name="mod" value="clippings">
		<input type="hidden" name="mod_action" value="index">
		<input type="hidden" name="pid" value="' . $pid . '">
		<input type="hidden" name="action" value="download">
		<table>
		<tr><td colspan="2" class="topbottombar"><h2>' . WT_I18N::translate('Download') . '</h2></td></tr>
		<tr><td class="descriptionbox width50 wrap">' . WT_I18N::translate('Zip file(s)') . help_link('zip') . '</td>
		<td class="optionbox"><input type="checkbox" name="Zip" value="yes" checked="checked"></td></tr>

		<tr><td class="descriptionbox width50 wrap">' . WT_I18N::translate('Include media (automatically zips files)') . help_link('include_media') . '</td>
		<td class="optionbox"><input type="checkbox" name="IncludeMedia" value="yes" checked="checked"></td></tr>
		';
        if (WT_USER_GEDCOM_ADMIN) {
            $out .= '<tr><td class="descriptionbox width50 wrap">' . WT_I18N::translate('Apply privacy settings?') . help_link('apply_privacy') . '</td>' . '<td class="optionbox">' . '	<input type="radio" name="privatize_export" value="none" checked="checked"> ' . WT_I18N::translate('None') . '<br>' . '	<input type="radio" name="privatize_export" value="gedadmin"> ' . WT_I18N::translate('Manager') . '<br>' . '	<input type="radio" name="privatize_export" value="user"> ' . WT_I18N::translate('Member') . '<br>' . '	<input type="radio" name="privatize_export" value="visitor"> ' . WT_I18N::translate('Visitor') . '</td></tr>';
        } elseif (WT_USER_CAN_ACCESS) {
            $out .= '<tr><td class="descriptionbox width50 wrap">' . WT_I18N::translate('Apply privacy settings?') . help_link('apply_privacy') . '</td>' . '<td class="list_value">' . '	<input type="radio" name="privatize_export" value="user" checked="checked"> ' . WT_I18N::translate('Member') . '<br>' . '	<input type="radio" name="privatize_export" value="visitor"> ' . WT_I18N::translate('Visitor') . '</td></tr>';
        }
        $out .= '
		<tr><td class="descriptionbox width50 wrap">' . WT_I18N::translate('Convert from UTF-8 to ANSI (ISO-8859-1)') . help_link('utf8_ansi') . '</td>
		<td class="optionbox"><input type="checkbox" name="convert" value="yes"></td></tr>

		<tr>
		<td class="descriptionbox width50 wrap">' . WT_I18N::translate('Add the GEDCOM media path to filenames') . help_link('GEDCOM_MEDIA_PATH') . '</td>
		<td class="optionbox">
		<input type="checkbox" name="conv_path" value="' . WT_Filter::escapeHtml($GEDCOM_MEDIA_PATH) . '">
		<span dir="auto">' . WT_Filter::escapeHtml($GEDCOM_MEDIA_PATH) . '</span></td>
		</tr>

		<input type="hidden" name="conv_path" value="' . $clip_ctrl->conv_path . '">

		</td></tr>

		<tr><td class="topbottombar" colspan="2">
		<input type="button" value="' . WT_I18N::translate('Cancel') . '" onclick="cancelDownload();">
		<input type="submit" value="' . WT_I18N::translate('Download') . '">
		</form>';
        return $out;
    }
Exemple #29
0
			jQuery("#fan_chart")
				.click(function(e) {
					jQuery(".fan_chart_menu").hide();
				});
			return "' . strip_tags($controller->root->getFullName()) . '";
		})();
	');
?>
<div id="page-fan">
	<h2><?php 
echo $controller->getPageTitle();
?>
</h2>
	<form name="people" method="get" action="?">
		<input type="hidden" name="ged" value="<?php 
echo WT_Filter::escapeHtml(WT_GEDCOM);
?>
">
		<table class="list_table">
			<tr>
				<td class="descriptionbox">
					<label for="rootid">
						<?php 
echo WT_I18N::translate('Individual');
?>
					</label>
				</td>
				<td class="optionbox">
					<input class="pedigree_form" data-autocomplete-type="INDI" type="text" name="rootid" id="rootid" size="3" value="<?php 
echo $controller->rootid;
?>
/**
 * print the information for an individual chart box
 *
 * find and print a given individuals information for a pedigree chart
 *
 * @param string $pid The Gedcom Xref ID of the individual  to print
 * @param string $currpid
 * @param string $censyear
 *
 */
function print_pedigree_person_nav2($pid, $currpid, $censyear)
{
    global $PEDIGREE_FULL_DETAILS;
    global $TEXT_DIRECTION, $DEFAULT_PEDIGREE_GENERATIONS, $OLD_PGENS, $talloffset, $PEDIGREE_LAYOUT;
    global $show_full;
    global $SEARCH_SPIDER;
    global $spouselinks, $parentlinks, $step_parentlinks, $persons, $person_step, $person_parent;
    global $natdad, $natmom, $censyear;
    if (empty($show_full)) {
        $show_full = 0;
    }
    if (empty($PEDIGREE_FULL_DETAILS)) {
        $PEDIGREE_FULL_DETAILS = 0;
    }
    if (!isset($OLD_PGENS)) {
        $OLD_PGENS = $DEFAULT_PEDIGREE_GENERATIONS;
    }
    if (!isset($talloffset)) {
        $talloffset = $PEDIGREE_LAYOUT;
    }
    $person = WT_Individual::getInstance($pid);
    if ($pid == false || empty($person)) {
        $spouselinks = false;
        $parentlinks = false;
        $step_parentlinks = false;
    }
    $tmp = array('M' => '', 'F' => 'F', 'U' => 'NN');
    $isF = $tmp[$person->getSex()];
    $spouselinks = "";
    $parentlinks = "";
    $step_parentlinks = "";
    if ($person->canShowName() && !$SEARCH_SPIDER) {
        //-- draw a box for the family popup
        if ($TEXT_DIRECTION == "rtl") {
            $spouselinks .= "<table class=\"rtlnav person_box{$isF}\"><tr><td align=\"right\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">";
            $spouselinks .= "<b>" . WT_I18N::translate('Family') . "</b> (" . $person->getFullName() . ")<br>";
            $parentlinks .= "<table class=\"rtlnav person_box{$isF}\"><tr><td align=\"right\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">";
            $parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>";
            $step_parentlinks .= "<table class=\"rtlnav person_box{$isF}\"><tr><td align=\"right\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">";
            $step_parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>";
        } else {
            $spouselinks .= "<table class=\"ltrnav person_box{$isF}\"><tr><td align=\"left\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">";
            $spouselinks .= "<b>" . WT_I18N::translate('Family') . "</b> (" . $person->getFullName() . ")<br>";
            $parentlinks .= "<table class=\"ltrnav person_box{$isF}\"><tr><td align=\"left\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">";
            $parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>";
            $step_parentlinks .= "<table class=\"ltrnav person_box{$isF}\"><tr><td align=\"left\" style=\"font-size:10px;font-weight:normal;\" class=\"name2 nowrap\">";
            $step_parentlinks .= "<b>" . WT_I18N::translate('Parents') . "</b> (" . $person->getFullName() . ")<br>";
        }
        $persons = "";
        $person_parent = "";
        $person_step = "";
        //-- Parent families --------------------------------------
        foreach ($person->getChildFamilies() as $family) {
            $husb = $family->getHusband();
            $wife = $family->getWife();
            $children = $family->getChildren();
            $num = count($children);
            $marrdate = $family->getMarriageDate();
            //-- Get Parent Children’s Name, DOB, DOD --------------------------
            if (isset($children)) {
                $chBLDarray = array();
                foreach ($children as $child) {
                    $chnam = $child->getAllNames();
                    $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
                    $chfulln = str_replace('"', "", $chfulln);
                    // Must remove quotes completely here
                    $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
                    $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
                    // Child’s Full Name
                    $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2;
                    // Child’s Date of Birth (Julian)
                    $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2;
                    // Child’s Date of Death (Julian)
                    $chBLD = $chfulln . ", " . $chdob . ", " . $chdod;
                    array_push($chBLDarray, $chBLD);
                }
            }
            //-- Parent Husband ------------------------------
            if ($husb || $num > 0) {
                if ($husb) {
                    //-- Parent Husbands Parents ----------------------
                    $gparent = WT_Individual::getInstance($husb->getXref());
                    $parfams = $gparent->getChildFamilies();
                    foreach ($parfams as $pfamily) {
                        $phusb = $pfamily->getHusband();
                        $pwife = $pfamily->getWife();
                        if ($phusb) {
                            $pHusbFBP = $phusb->getBirthPlace();
                        }
                        if ($pwife) {
                            $pHusbMBP = $pwife->getBirthPlace();
                        }
                    }
                    //-- Parent Husbands Details ----------------------
                    $person_parent = "Yes";
                    if ($husb->canShowName()) {
                        $nam = $husb->getAllNames();
                        $fulln = rtrim($nam[0]['givn'], '*') . "&nbsp;" . $nam[0]['surname'];
                        $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
                        $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
                        for ($i = 0; $i < count($nam); $i++) {
                            if ($nam[$i]['type'] == '_MARNM') {
                                $fulmn = rtrim($nam[$i]['givn'], '*') . "&nbsp;" . $nam[$i]['surname'];
                            }
                        }
                        $parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"insertRowToTable(";
                        $parentlinks .= "'" . $husb->getXref() . "',";
                        // pid = PID
                        $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
                        // nam = Name
                        if (isset($fulmn)) {
                            $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
                            // mnam = Full Married Name
                        } else {
                            $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
                            // mnam = Full Name
                        }
                        if ($currpid == "Wife" || $currpid == "Husband") {
                            $parentlinks .= "'Father in Law',";
                            // label = 1st Gen Male Relationship
                        } else {
                            $parentlinks .= "'Grand-Father',";
                            // label = 2st Gen Male Relationship
                        }
                        $parentlinks .= "'" . $husb->getSex() . "',";
                        // sex = Gender
                        $parentlinks .= "''" . ",";
                        // cond = Condition (Married etc)
                        if ($marrdate) {
                            $parentlinks .= "'" . ($marrdate->minJD() + $marrdate->maxJD()) / 2 . "',";
                            // dom = Date of Marriage (Julian)
                        }
                        $parentlinks .= "'" . ($husb->getBirthDate()->minJD() + $husb->getBirthDate()->maxJD()) / 2 . "',";
                        // dob = Date of Birth
                        if ($husb->getbirthyear() >= 1) {
                            $parentlinks .= "'" . ($censyear - $husb->getbirthyear()) . "',";
                            // age =  Census Year - Year of Birth
                        } else {
                            $parentlinks .= "''" . ",";
                            // age =  Undefined
                        }
                        $parentlinks .= "'" . ($husb->getDeathDate()->minJD() + $husb->getDeathDate()->maxJD()) / 2 . "',";
                        // dod = Date of Death
                        $parentlinks .= "''" . ",";
                        // occu  = Occupation
                        $parentlinks .= "'" . WT_Filter::escapeHtml($husb->getBirthPlace()) . "'" . ",";
                        // birthpl = Individuals Birthplace
                        if (isset($pHusbFBP)) {
                            $parentlinks .= "'" . WT_Filter::escapeHtml($pHusbFBP) . "'" . ",";
                            // fbirthpl = Fathers Birthplace
                        } else {
                            $parentlinks .= "'UNK, UNK, UNK, UNK'" . ",";
                            // fbirthpl = Fathers Birthplace
                        }
                        if (isset($pHusbMBP)) {
                            $parentlinks .= "'" . WT_Filter::escapeHtml($pHusbMBP) . "'" . ",";
                            // mbirthpl = Mothers Birthplace
                        } else {
                            $parentlinks .= "'UNK, UNK, UNK, UNK'" . ",";
                            // mbirthpl = Mothers Birthplace
                        }
                        if (isset($chBLDarray) && $husb->getSex() == "F") {
                            $chBLDarray = implode("::", $chBLDarray);
                            $parentlinks .= "'" . $chBLDarray . "'";
                            // Array of Children (name, birthdate, deathdate)
                        } else {
                            $parentlinks .= "''";
                        }
                        $parentlinks .= ");\">";
                        $parentlinks .= $husb->getFullName();
                        // Full Name (Link)
                        $parentlinks .= "</a>";
                    } else {
                        $parentlinks .= WT_I18N::translate('Private');
                    }
                    $natdad = "yes";
                }
            }
            //-- Parent Wife ------------------------------
            if ($wife || $num > 0) {
                if ($wife) {
                    //-- Parent Wifes Parents ----------------------
                    $gparent = WT_Individual::getInstance($wife->getXref());
                    $parfams = $gparent->getChildFamilies();
                    foreach ($parfams as $pfamily) {
                        $pwhusb = $pfamily->getHusband();
                        $pwwife = $pfamily->getWife();
                        if ($pwhusb) {
                            $pWifeFBP = $pwhusb->getBirthPlace();
                        }
                        if ($pwwife) {
                            $pWifeMBP = $pwwife->getBirthPlace();
                        }
                    }
                    //-- Parent Wifes Details ----------------------
                    $person_parent = "Yes";
                    if ($wife->canShowName()) {
                        $nam = $wife->getAllNames();
                        $fulln = rtrim($nam[0]['givn'], '*') . "&nbsp;" . $nam[0]['surname'];
                        $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
                        $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
                        $husbnam = null;
                        for ($i = 0; $i < count($nam); $i++) {
                            if ($nam[$i]['type'] == '_MARNM') {
                                $fulmn = rtrim($nam[$i]['givn'], '*') . "&nbsp;" . $nam[$i]['surname'];
                            }
                        }
                        $parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"insertRowToTable(";
                        $parentlinks .= "'" . $wife->getXref() . "',";
                        // pid = PID
                        $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
                        // nam = Name
                        if (isset($fulmn)) {
                            $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulmn)) . "',";
                            // mnam = Full Married Name
                        } else {
                            $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
                            // mnam = Full Name
                        }
                        if ($currpid == "Wife" || $currpid == "Husband") {
                            $parentlinks .= "'Mother in Law',";
                            // label = 1st Gen Female Relationship
                        } else {
                            $parentlinks .= "'Grand-Mother',";
                            // label = 2st Gen Female Relationship
                        }
                        $parentlinks .= "'" . $wife->getSex() . "',";
                        // sex = Gender
                        $parentlinks .= "''" . ",";
                        // cond = Condition (Married etc)
                        if ($marrdate) {
                            $parentlinks .= "'" . ($marrdate->minJD() + $marrdate->maxJD()) / 2 . "',";
                            // dom = Date of Marriage (Julian)
                        }
                        $parentlinks .= "'" . ($wife->getBirthDate()->minJD() + $wife->getBirthDate()->maxJD()) / 2 . "',";
                        // dob = Date of Birth
                        if ($wife->getbirthyear() >= 1) {
                            $parentlinks .= "'" . ($censyear - $wife->getbirthyear()) . "',";
                            // age =  Census Year - Year of Birth
                        } else {
                            $parentlinks .= "''" . ",";
                            // age =  Undefined
                        }
                        $parentlinks .= "'" . ($wife->getDeathDate()->minJD() + $wife->getDeathDate()->maxJD()) / 2 . "',";
                        // dod = Date of Death
                        $parentlinks .= "''" . ",";
                        // occu  = Occupation
                        $parentlinks .= "'" . WT_Filter::escapeHtml($wife->getBirthPlace()) . "'" . ",";
                        // birthpl = Individuals Birthplace
                        if (isset($pWifeFBP)) {
                            $parentlinks .= "'" . WT_Filter::escapeHtml($pWifeFBP) . "'" . ",";
                            // fbirthpl = Fathers Birthplace
                        } else {
                            $parentlinks .= "'UNK, UNK, UNK, UNK'" . ",";
                            // fbirthpl = Fathers Birthplace Not Known
                        }
                        if (isset($pWifeMBP)) {
                            $parentlinks .= "'" . WT_Filter::escapeHtml($pWifeMBP) . "'" . ",";
                            // mbirthpl = Mothers Birthplace
                        } else {
                            $parentlinks .= "'UNK, UNK, UNK, UNK'" . ",";
                            // mbirthpl = Mothers Birthplace Not Known
                        }
                        if (isset($chBLDarray) && $wife->getSex() == "F") {
                            $chBLDarray = implode("::", $chBLDarray);
                            $parentlinks .= "'" . $chBLDarray . "'";
                            // Array of Children (name, birthdate, deathdate)
                        } else {
                            $parentlinks .= "''";
                        }
                        $parentlinks .= ");\">";
                        $parentlinks .= $wife->getFullName();
                        // Full Name (Link)
                        $parentlinks .= "</a>";
                    } else {
                        $parentlinks .= WT_I18N::translate('Private');
                    }
                    $natmom = "yes";
                }
            }
        }
        //-- Step families -----------------------------------------
        foreach ($person->getChildStepFamilies() as $family) {
            $husb = $family->getHusband();
            $wife = $family->getWife();
            $children = $family->getChildren();
            $num = count($children);
            $marrdate = $family->getMarriageDate();
            //-- Get StepParent’s Children’s Name, DOB, DOD --------------------------
            if (isset($children)) {
                $chBLDarray = array();
                foreach ($children as $child) {
                    $chnam = $child->getAllNames();
                    $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
                    $chfulln = str_replace('"', "", $chfulln);
                    // Must remove quotes completely here
                    $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
                    $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
                    // Child’s Full Name
                    $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2;
                    // Child’s Date of Birth (Julian)
                    $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2;
                    // Child’s Date of Death (Julian)
                    $chBLD = $chfulln . ", " . $chdob . ", " . $chdod;
                    array_push($chBLDarray, $chBLD);
                }
            }
            //-- Step Husband --------------------------------------
            if ($natdad == "yes") {
            } else {
                if (($husb || $num > 0) && $husb !== $person) {
                    if ($husb) {
                        //-- Step Husbands Parents -----------------------------
                        $gparent = WT_Individual::getInstance($husb->getXref());
                        $parfams = $gparent->getChildFamilies();
                        foreach ($parfams as $pfamily) {
                            $phusb = $pfamily->getHusband();
                            $pwife = $pfamily->getWife();
                            if ($phusb) {
                                $pHusbFBP = $phusb->getBirthPlace();
                            }
                            if ($pwife) {
                                $pHusbMBP = $pwife->getBirthPlace();
                            }
                        }
                        //-- Step Husband Details ------------------------------
                        $person_step = "Yes";
                        if ($husb->canShowName()) {
                            $nam = $husb->getAllNames();
                            $fulln = rtrim($nam[0]['givn'], '*') . "&nbsp;" . $nam[0]['surname'];
                            $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
                            $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
                            for ($i = 0; $i < count($nam); $i++) {
                                if ($nam[$i]['type'] == '_MARNM') {
                                    $fulmn = rtrim($nam[$i]['givn'], '*') . "&nbsp;" . $nam[$i]['surname'];
                                }
                            }
                            $parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"insertRowToTable(";
                            $parentlinks .= "'" . $husb->getXref() . "',";
                            // pid = PID
                            $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
                            // nam = Name
                            if (isset($fulmn)) {
                                $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
                                // mnam = Full Married Name
                            } else {
                                $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
                                // mnam = Full Name
                            }
                            if ($currpid == "Wife" || $currpid == "Husband") {
                                $parentlinks .= "'Step Father-in-Law',";
                                // label = 1st Gen Male Relationship
                            } else {
                                $parentlinks .= "'Step Grand-Father',";
                                // label = 2st Gen Male Relationship
                            }
                            $parentlinks .= "'" . $husb->getSex() . "',";
                            // sex = Gender
                            $parentlinks .= "''" . ",";
                            // cond = Condition (Married etc)
                            if ($marrdate) {
                                $parentlinks .= "'" . ($marrdate->minJD() + $marrdate->maxJD()) / 2 . "',";
                                // dom = Date of Marriage (Julian)
                            }
                            $parentlinks .= "'" . ($husb->getBirthDate()->minJD() + $husb->getBirthDate()->maxJD()) / 2 . "',";
                            // dob = Date of Birth
                            if ($husb->getbirthyear() >= 1) {
                                $parentlinks .= "'" . ($censyear - $husb->getbirthyear()) . "',";
                                // age =  Census Year - Year of Birth
                            } else {
                                $parentlinks .= "''" . ",";
                                // age =  Undefined
                            }
                            $parentlinks .= "'" . ($husb->getDeathDate()->minJD() + $husb->getDeathDate()->maxJD()) / 2 . "',";
                            // dod = Date of Death
                            $parentlinks .= "''" . ",";
                            // occu  = Occupation
                            $parentlinks .= "'" . WT_Filter::escapeHtml($husb->getBirthPlace()) . "'" . ",";
                            // birthpl = Individuals Birthplace
                            if (isset($pHusbFBP)) {
                                $parentlinks .= "'" . WT_Filter::escapeHtml($pHusbFBP) . "'" . ",";
                                // fbirthpl = Fathers Birthplace
                            } else {
                                $parentlinks .= "'UNK, UNK, UNK, UNK'" . ",";
                                // fbirthpl = Fathers Birthplace
                            }
                            if (isset($pHusbMBP)) {
                                $parentlinks .= "'" . WT_Filter::escapeHtml($pHusbMBP) . "'" . ",";
                                // mbirthpl = Mothers Birthplace
                            } else {
                                $parentlinks .= "'UNK, UNK, UNK, UNK'" . ",";
                                // mbirthpl = Mothers Birthplace
                            }
                            if (isset($chBLDarray) && $husb->getSex() == "F") {
                                $chBLDarray = implode("::", $chBLDarray);
                                $parentlinks .= "'" . $chBLDarray . "'";
                                // Array of Children (name, birthdate, deathdate)
                            } else {
                                $parentlinks .= "''";
                            }
                            $parentlinks .= ");\">";
                            $parentlinks .= $husb->getFullName();
                            // Full Name (Link)
                            $parentlinks .= "</a>";
                        } else {
                            $parentlinks .= WT_I18N::translate('Private');
                        }
                    }
                }
            }
            //-- Step Wife ----------------------------------------
            if ($natmom == "yes") {
            } else {
                if ($wife || $num > 0) {
                    if ($wife) {
                        //-- Step Wifes Parents ---------------------------
                        $gparent = WT_Individual::getInstance($wife->getXref());
                        $parfams = $gparent->getChildFamilies();
                        foreach ($parfams as $pfamily) {
                            $pwhusb = $pfamily->getHusband();
                            $pwwife = $pfamily->getWife();
                            if ($pwhusb) {
                                $pWifeFBP = $pwhusb->getBirthPlace();
                            }
                            if ($pwwife) {
                                $pWifeMBP = $pwwife->getBirthPlace();
                            }
                        }
                        //-- Step Wife Details ------------------------------
                        $person_step = "Yes";
                        if ($wife->canShowName()) {
                            $nam = $wife->getAllNames();
                            $fulln = rtrim($nam[0]['givn'], '*') . "&nbsp;" . $nam[0]['surname'];
                            $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
                            $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
                            $husbnam = null;
                            for ($i = 0; $i < count($nam); $i++) {
                                if ($nam[$i]['type'] == '_MARNM') {
                                    $fulmn = rtrim($nam[$i]['givn'], '*') . "&nbsp;" . $nam[$i]['surname'];
                                }
                            }
                            $parentlinks .= "<a class=\"linka\" href=\"#\" onclick=\"insertRowToTable(";
                            $parentlinks .= "'" . $wife->getXref() . "',";
                            // pid = PID
                            $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
                            // nam = Name
                            if (isset($fulmn)) {
                                $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulmn)) . "',";
                                // mnam = Full Married Name
                            } else {
                                $parentlinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
                                // mnam = Full Name
                            }
                            if ($currpid == "Wife" || $currpid == "Husband") {
                                $parentlinks .= "'Step Mother-in-Law',";
                                // label = 1st Gen Female Relationship
                            } else {
                                $parentlinks .= "'Step Grand-Mother',";
                                // label = 2st Gen Female Relationship
                            }
                            $parentlinks .= "'" . $wife->getSex() . "',";
                            // sex = Gender
                            $parentlinks .= "''" . ",";
                            // cond = Condition (Married etc)
                            if ($marrdate) {
                                $parentlinks .= "'" . ($marrdate->minJD() + $marrdate->maxJD()) / 2 . "',";
                                // dom = Date of Marriage (Julian)
                            }
                            $parentlinks .= "'" . ($wife->getBirthDate()->minJD() + $wife->getBirthDate()->maxJD()) / 2 . "',";
                            // dob = Date of Birth
                            if ($wife->getbirthyear() >= 1) {
                                $parentlinks .= "'" . ($censyear - $wife->getbirthyear()) . "',";
                                // age =  Census Year - Year of Birth
                            } else {
                                $parentlinks .= "''" . ",";
                                // age =  Undefined
                            }
                            $parentlinks .= "'" . ($wife->getDeathDate()->minJD() + $wife->getDeathDate()->maxJD()) / 2 . "',";
                            // dod = Date of Death
                            $parentlinks .= "''" . ",";
                            // occu  = Occupation
                            $parentlinks .= "'" . WT_Filter::escapeHtml($wife->getBirthPlace()) . "'" . ",";
                            // birthpl = Individuals Birthplace
                            if (isset($pWifeFBP)) {
                                $parentlinks .= "'" . WT_Filter::escapeHtml($pWifeFBP) . "'" . ",";
                                // fbirthpl = Fathers Birthplace
                            } else {
                                $parentlinks .= "'UNK, UNK, UNK, UNK'" . ",";
                                // fbirthpl = Fathers Birthplace Not Known
                            }
                            if (isset($pWifeMBP)) {
                                $parentlinks .= "'" . WT_Filter::escapeHtml($pWifeMBP) . "'" . ",";
                                // mbirthpl = Mothers Birthplace
                            } else {
                                $parentlinks .= "'UNK, UNK, UNK, UNK'" . ",";
                                // mbirthpl = Mothers Birthplace Not Known
                            }
                            if (isset($chBLDarray) && $wife->getSex() == "F") {
                                $chBLDarray = implode("::", $chBLDarray);
                                $parentlinks .= "'" . $chBLDarray . "'";
                                // Array of Children (name, birthdate, deathdate)
                            } else {
                                $parentlinks .= "''";
                            }
                            $parentlinks .= ");\">";
                            $parentlinks .= $wife->getFullName();
                            // Full Name (Link)
                            $parentlinks .= "</a>";
                        } else {
                            $parentlinks .= WT_I18N::translate('Private');
                        }
                    }
                }
            }
        }
        // Spouse Families ------------------------------------------
        foreach ($person->getSpouseFamilies() as $family) {
            $spouse = $family->getSpouse($person);
            $children = $family->getChildren();
            $num = count($children);
            $marrdate = $family->getMarriageDate();
            $is_wife = $family->getWife();
            //-- Get Spouse’s Children’s Name, DOB, DOD --------------------------
            if (isset($children)) {
                $chBLDarray = array();
                foreach ($children as $child) {
                    $chnam = $child->getAllNames();
                    $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
                    $chfulln = str_replace('"', "", $chfulln);
                    // Must remove quotes completely here
                    $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
                    $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
                    // Child’s Full Name
                    $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2;
                    // Child’s Date of Birth (Julian)
                    $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2;
                    // Child’s Date of Death (Julian)
                    $chBLD = $chfulln . ", " . $chdob . ", " . $chdod;
                    array_push($chBLDarray, $chBLD);
                }
            }
            //-- Spouse -----------------------------------------
            if ($spouse || $num > 0) {
                if ($spouse) {
                    //-- Spouse Parents -----------------------------
                    $gparent = WT_Individual::getInstance($spouse->getXref());
                    $spousefams = $gparent->getChildFamilies();
                    foreach ($spousefams as $pfamily) {
                        $phusb = $pfamily->getHusband();
                        $pwife = $pfamily->getWife();
                        if ($phusb) {
                            $pSpouseFBP = $phusb->getBirthPlace();
                        }
                        if ($pwife) {
                            $pSpouseMBP = $pwife->getBirthPlace();
                        }
                    }
                    //-- Spouse Details -----------------------------
                    if ($spouse->canShowName()) {
                        $nam = $spouse->getAllNames();
                        $fulln = rtrim($nam[0]['givn'], '*') . "&nbsp;" . $nam[0]['surname'];
                        $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
                        $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
                        // If spouse is a wife, then get her married name or default to her birth name
                        for ($i = 0; $i < count($nam); $i++) {
                            if ($nam[$i]['type'] == '_MARNM' && $is_wife) {
                                $fulmn = rtrim($nam[$i]['givn'], '*') . "&nbsp;" . $nam[$i]['surname'];
                            } else {
                                $fulmn = $fulln;
                            }
                        }
                        $spouselinks .= "<a href=\"#\" onclick=\"insertRowToTable(";
                        $spouselinks .= "'" . $spouse->getXref() . "',";
                        // pid = PID
                        $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
                        // nam = Name
                        if (isset($fulmn)) {
                            $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulmn)) . "',";
                            // mnam = Full Married Name
                        } else {
                            $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
                            // mnam = Full Name
                        }
                        if ($currpid == "Son" || $currpid == "Daughter") {
                            if ($spouse->getSex() == "M") {
                                $spouselinks .= "'Son in Law',";
                                // label = Male Relationship
                            } else {
                                $spouselinks .= "'Daughter in Law',";
                                // label = Female Relationship
                            }
                        } else {
                            if ($spouse->getSex() == "M") {
                                $spouselinks .= "'Brother in Law',";
                                // label = Male Relationship
                            } else {
                                $spouselinks .= "'Sister in Law',";
                                // label = Female Relationship
                            }
                        }
                        $spouselinks .= "'" . $spouse->getSex() . "',";
                        // sex = Gender
                        $spouselinks .= "''" . ",";
                        // cond = Condition (Married etc)
                        if ($marrdate) {
                            $spouselinks .= "'" . ($marrdate->minJD() + $marrdate->maxJD()) / 2 . "',";
                            // dom = Date of Marriage (Julian)
                        }
                        $spouselinks .= "'" . ($spouse->getBirthDate()->minJD() + $spouse->getBirthDate()->maxJD()) / 2 . "',";
                        // dob = Date of Birth
                        if ($spouse->getbirthyear() >= 1) {
                            $spouselinks .= "'" . ($censyear - $spouse->getbirthyear()) . "',";
                            // age =  Census Year - Year of Birth
                        } else {
                            $spouselinks .= "''" . ",";
                            // age =  Undefined
                        }
                        $spouselinks .= "'" . ($spouse->getDeathDate()->minJD() + $spouse->getDeathDate()->maxJD()) / 2 . "',";
                        // dod = Date of Death
                        $spouselinks .= "''" . ",";
                        // occu  = Occupation
                        $spouselinks .= "'" . WT_Filter::escapeHtml($spouse->getBirthPlace()) . "'" . ",";
                        // birthpl = Individuals Birthplace
                        if (isset($pSpouseFBP)) {
                            $spouselinks .= "'" . WT_Filter::escapeHtml($pSpouseFBP) . "'" . ",";
                            // fbirthpl = Fathers Birthplace
                        } else {
                            $spouselinks .= "'UNK, UNK, UNK, UNK'" . ",";
                            // fbirthpl = Fathers Birthplace Not Known
                        }
                        if (isset($pSpouseMBP)) {
                            $spouselinks .= "'" . WT_Filter::escapeHtml($pSpouseMBP) . "'" . ",";
                            // mbirthpl = Mothers Birthplace
                        } else {
                            $spouselinks .= "'UNK, UNK, UNK, UNK'" . ",";
                            // mbirthpl = Mothers Birthplace Not Known
                        }
                        if (isset($chBLDarray) && $spouse->getSex() == "F") {
                            $chBLDarray = implode("::", $chBLDarray);
                            $spouselinks .= "'" . $chBLDarray . "'";
                            // Array of Children (name, birthdate, deathdate)
                        } else {
                            $spouselinks .= "''";
                        }
                        $spouselinks .= ");\">";
                        $spouselinks .= $spouse->getFullName();
                        // Full Name (Link)
                        $spouselinks .= "</a>";
                    } else {
                        $spouselinks .= WT_I18N::translate('Private');
                    }
                    $spouselinks .= "</a>";
                    if ($spouse->getFullName() != "") {
                        $persons = "Yes";
                    }
                }
            }
            // Children -------------------------------------
            $spouselinks .= "<ul class=\"clist\">";
            foreach ($children as $child) {
                if ($child) {
                    $persons = "Yes";
                    //-- Childs Parents ---------------------
                    $gparent = WT_Individual::getInstance($child->getXref());
                    foreach ($gparent->getChildFamilies() as $family) {
                        $husb = $family->getHusband();
                        $wife = $family->getWife();
                        if ($husb) {
                            $ChildFBP = $husb->getBirthPlace();
                        }
                        if ($wife) {
                            $ChildMBP = $wife->getBirthPlace();
                        }
                    }
                    // Get Child’s Children
                    $chBLDarray = array();
                    foreach ($child->getSpouseFamilies() as $childfamily) {
                        $chchildren = $childfamily->getChildren();
                        foreach ($chchildren as $chchild) {
                            $chnam = $chchild->getAllNames();
                            $chfulln = rtrim($chnam[0]['givn'], '*') . " " . $chnam[0]['surname'];
                            $chfulln = str_replace('"', "", $chfulln);
                            // Must remove quotes completely here
                            $chfulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
                            $chfulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $chfulln);
                            // Child’s Full Name
                            $chdob = ($chchild->getBirthDate()->minJD() + $chchild->getBirthDate()->maxJD()) / 2;
                            // Child’s Date of Birth (Julian)
                            $chdod = ($chchild->getDeathDate()->minJD() + $chchild->getDeathDate()->maxJD()) / 2;
                            // Child’s Date of Death (Julian)
                            $chBLD = $chfulln . ", " . $chdob . ", " . $chdod;
                            array_push($chBLDarray, $chBLD);
                        }
                    }
                    // Get Childs marriage status ------------
                    $marrdate = "";
                    $chhusbnam = null;
                    foreach ($child->getSpouseFamilies() as $childfamily) {
                        $marrdate = $childfamily->getMarriageDate();
                        if ($childfamily->getHusband()) {
                            $chhusbnam = $childfamily->getHusband()->getAllNames();
                        }
                    }
                    // Childs Details -------------------------
                    $spouselinks .= "<li>";
                    if ($child->canShowName()) {
                        $nam = $child->getAllNames();
                        $fulln = rtrim($nam[0]['givn'], '*') . "&nbsp;" . $nam[0]['surname'];
                        $fulln = str_replace("@N.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
                        $fulln = str_replace("@P.N.", "(" . WT_I18N::translate('unknown') . ")", $fulln);
                        $husbnam = null;
                        // Get childs married name if available
                        $chfulmn = null;
                        $chnam = $child->getAllNames();
                        if ($chhusbnam[0]['surname'] == "@N.N." || $chhusbnam[0]['surname'] == "") {
                            // if Husband or his name is not known then use wifes birth name
                            $husbnam = $nam[0]['surname'];
                        } else {
                            $husbnam = $chhusbnam[0]['surname'];
                        }
                        for ($i = 0; $i < count($nam); $i++) {
                            if ($chnam[$i]['type'] == '_MARNM') {
                                $chfulmn = rtrim($chnam[$i]['givn'], '*') . "&nbsp;" . $husbnam;
                            }
                        }
                        $spouselinks .= "<a href=\"#\" onclick=\"insertRowToTable(";
                        $spouselinks .= "'" . $child->getXref() . "',";
                        // pid = PID
                        $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
                        // nam = Name
                        if (isset($chfulmn)) {
                            $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($chfulmn)) . "',";
                            // mnam = Full Married Name
                        } else {
                            $spouselinks .= "'" . WT_Filter::escapeHtml(strip_tags($fulln)) . "',";
                            // mnam = Full Name
                        }
                        if ($currpid == "Son" || $currpid == "Daughter") {
                            if ($child->getSex() == "M") {
                                $spouselinks .= "'Grand-Son',";
                                // label = Male Relationship
                            } else {
                                $spouselinks .= "'Grand-Daughter',";
                                // label = Female Relationship
                            }
                        } else {
                            if ($child->getSex() == "M") {
                                $spouselinks .= "'Nephew',";
                                // label = Male Relationship
                            } else {
                                $spouselinks .= "'Niece',";
                                // label = Female Relationship
                            }
                        }
                        $spouselinks .= "'" . $child->getSex() . "',";
                        // sex = Gender
                        $spouselinks .= "''" . ",";
                        // cond = Condition (Married etc)
                        if ($marrdate) {
                            $spouselinks .= "'" . ($marrdate->minJD() + $marrdate->maxJD()) / 2 . "',";
                            // dom = Date of Marriage (Julian)
                        } else {
                            $spouselinks .= "'nm'" . ",";
                        }
                        $spouselinks .= "'" . ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2 . "',";
                        // dob = Date of Birth
                        if ($child->getbirthyear() >= 1) {
                            $spouselinks .= "'" . ($censyear - $child->getbirthyear()) . "',";
                            // age =  Census Year - Year of Birth
                        } else {
                            $spouselinks .= "''" . ",";
                            // age =  Undefined
                        }
                        $spouselinks .= "'" . ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2 . "',";
                        // dod = Date of Death
                        $spouselinks .= "''" . ",";
                        // occu  = Occupation
                        $spouselinks .= "'" . WT_Filter::escapeHtml($child->getBirthPlace()) . "'" . ",";
                        // birthpl = Individuals Birthplace
                        if (isset($ChildFBP)) {
                            $spouselinks .= "'" . WT_Filter::escapeHtml($ChildFBP) . "'" . ",";
                            // fbirthpl = Fathers Birthplace
                        } else {
                            $spouselinks .= "'UNK, UNK, UNK, UNK'" . ",";
                            // fbirthpl = Fathers Birthplace Not Known
                        }
                        if (isset($ChildMBP)) {
                            $spouselinks .= "'" . WT_Filter::escapeHtml($ChildMBP) . "'" . ",";
                            // mbirthpl = Mothers Birthplace
                        } else {
                            $spouselinks .= "'UNK, UNK, UNK, UNK'" . ",";
                            // mbirthpl = Mothers Birthplace Not Known
                        }
                        if (isset($chBLDarray) && $child->getSex() == "F") {
                            $chBLDarray = implode("::", $chBLDarray);
                            $spouselinks .= "'" . $chBLDarray . "'";
                            // Array of Children (name, birthdate, deathdate)
                        } else {
                            $spouselinks .= "''";
                        }
                        $spouselinks .= ");\">";
                        $spouselinks .= $child->getFullName();
                        // Full Name (Link)
                        $spouselinks .= "</a>";
                        $spouselinks .= "</li>";
                    } else {
                        $spouselinks .= WT_I18N::translate('Private');
                    }
                }
            }
            $spouselinks .= "</ul>";
        }
        if ($persons != "Yes") {
            $spouselinks .= "(" . WT_I18N::translate('none') . ")</td></tr></table>";
        } else {
            $spouselinks .= "</td></tr></table>";
        }
        if ($person_parent != "Yes") {
            $parentlinks .= "(" . WT_I18N::translate_c('unknown family', 'unknown') . ")</td></tr></table>";
        } else {
            $parentlinks .= "</td></tr></table>";
        }
        if ($person_step != "Yes") {
            $step_parentlinks .= "(" . WT_I18N::translate_c('unknown family', 'unknown') . ")</td></tr></table>";
        } else {
            $step_parentlinks .= "</td></tr></table>";
        }
    }
}