예제 #1
0
파일: find.php 프로젝트: sadr110/webtrees
function getPreselectedTags(&$preselDefault, &$preselCustom)
{
    global $qs;
    $all = strlen($qs) ? explode(',', strtoupper($qs)) : array();
    $preselDefault = array();
    $preselCustom = array();
    foreach ($all as $one) {
        if (WT_Gedcom_Tag::isTag($one)) {
            $preselDefault[] = $one;
        } else {
            $preselCustom[] = $one;
        }
    }
}
예제 #2
0
 public function __construct()
 {
     // Automatically fix broken links
     if ($this->record && $this->record->canEdit()) {
         $broken_links = 0;
         foreach ($this->record->getFacts('HUSB|WIFE|CHIL|FAMS|FAMC|REPO') as $fact) {
             if (!$fact->isOld() && $fact->getTarget() === null) {
                 $this->record->deleteFact($fact->getFactId(), false);
                 WT_FlashMessages::addMessage(WT_I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue()));
                 $broken_links = true;
             }
         }
         foreach ($this->record->getFacts('NOTE|SOUR|OBJE') as $fact) {
             // These can be links or inline.  Only delete links.
             if (!$fact->isOld() && $fact->getTarget() === null && preg_match('/^@.*@$/', $fact->getValue())) {
                 $this->record->deleteFact($fact->getFactId(), false);
                 WT_FlashMessages::addMessage(WT_I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue()));
                 $broken_links = true;
             }
         }
         if ($broken_links) {
             // Reload the updated family
             $this->record = WT_GedcomRecord::getInstance($this->record->getXref());
         }
     }
     parent::__construct();
     // We want robots to index this page
     $this->setMetaRobots('index,follow');
     // Set a page title
     if ($this->record) {
         $this->setCanonicalUrl($this->record->getHtmlUrl());
         if ($this->record->canShowName()) {
             // e.g. "John Doe" or "1881 Census of Wales"
             $this->setPageTitle($this->record->getFullName());
         } else {
             // e.g. "Individual" or "Source"
             $record = $this->record;
             $this->setPageTitle(WT_Gedcom_Tag::getLabel($record::RECORD_TYPE));
         }
     } else {
         // No such record
         $this->setPageTitle(WT_I18N::translate('Private'));
     }
 }
예제 #3
0
function print_indi_form($nextaction, WT_Individual $person = null, WT_Family $family = null, WT_Fact $name_fact = null, $famtag = 'CHIL', $gender = 'U')
{
    global $WORD_WRAPPED_NOTES, $NPFX_accept, $SHOW_GEDCOM_RECORD, $bdm, $STANDARD_NAME_FACTS, $ADVANCED_NAME_FACTS;
    global $QUICK_REQUIRED_FACTS, $QUICK_REQUIRED_FAMFACTS, $controller;
    $SURNAME_TRADITION = get_gedcom_setting(WT_GED_ID, 'SURNAME_TRADITION');
    if ($person) {
        $xref = $person->getXref();
    } elseif ($family) {
        $xref = $family->getXref();
    } else {
        $xref = 'new';
    }
    $name_fields = array();
    if ($name_fact) {
        $name_fact_id = $name_fact->getFactId();
        $name_type = $name_fact->getAttribute('TYPE');
        $namerec = $name_fact->getGedcom();
        // Populate the standard NAME field and subfields
        foreach ($STANDARD_NAME_FACTS as $tag) {
            if ($tag == 'NAME') {
                $name_fields[$tag] = $name_fact->getValue();
            } else {
                $name_fields[$tag] = $name_fact->getAttribute($tag);
            }
        }
    } else {
        $name_fact_id = null;
        $name_type = null;
        $namerec = null;
        // Populate the standard NAME field and subfields
        foreach ($STANDARD_NAME_FACTS as $tag) {
            $name_fields[$tag] = '';
        }
    }
    $bdm = '';
    // used to copy '1 SOUR' to '2 SOUR' for BIRT DEAT MARR
    echo '<div id="edit_interface-page">';
    echo '<h4>', $controller->getPageTitle(), '</h4>';
    init_calendar_popup();
    echo '<form method="post" name="addchildform" onsubmit="return checkform();">';
    echo '<input type="hidden" name="ged" value="', WT_Filter::escapeHtml(WT_GEDCOM), '">';
    echo '<input type="hidden" name="action" value="', $nextaction, '">';
    echo '<input type="hidden" name="fact_id" value="', $name_fact_id, '">';
    echo '<input type="hidden" name="xref" value="', $xref, '">';
    echo '<input type="hidden" name="famtag" value="', $famtag, '">';
    echo '<input type="hidden" name="gender" value="', $gender, '">';
    echo '<input type="hidden" name="goto" value="">';
    // set by javascript
    echo WT_Filter::getCsrf();
    echo '<table class="facts_table">';
    switch ($nextaction) {
        case 'add_child_to_family_action':
        case 'add_child_to_individual_action':
            // When adding a new child, specify the pedigree
            add_simple_tag('0 PEDI');
            break;
        case 'update':
            // When adding/editing a name, specify the type
            add_simple_tag('0 TYPE ' . $name_type, '', '', null, $person);
            break;
    }
    $new_marnm = '';
    // Inherit surname from parents, spouse or child
    if (!$namerec) {
        // We’ll need the parent’s name to set the child’s surname
        if ($family) {
            $father = $family->getHusband();
            if ($father && $father->getFirstFact('NAME')) {
                $father_name = $father->getFirstFact('NAME')->getValue();
            } else {
                $father_name = '';
            }
            $mother = $family->getWife();
            if ($mother && $mother->getFirstFact('NAME')) {
                $mother_name = $mother->getFirstFact('NAME')->getValue();
            } else {
                $mother_name = '';
            }
        } else {
            $father_name = '';
            $mother_name = '';
        }
        // We’ll need the spouse/child’s name to set the spouse/parent’s surname
        if ($person && $person->getFirstFact('NAME')) {
            $indi_name = $person->getFirstFact('NAME')->getValue();
        } else {
            $indi_name = '';
        }
        // Different cultures do surnames differently
        switch ($SURNAME_TRADITION) {
            case 'spanish':
                //Mother: Maria /AAAA BBBB/
                //Father: Jose  /CCCC DDDD/
                //Child:  Pablo /CCCC AAAA/
                switch ($nextaction) {
                    case 'add_child_to_family_action':
                        if (preg_match('/\\/(\\S+) \\S+\\//', $mother_name, $matchm) && preg_match('/\\/(\\S+) \\S+\\//', $father_name, $matchf)) {
                            $name_fields['SURN'] = $matchf[1] . ' ' . $matchm[1];
                            $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/';
                        }
                        break;
                    case 'add_parent_to_individual_action':
                        if ($famtag == 'HUSB' && preg_match('/\\/(\\S+) \\S+\\//', $indi_name, $match)) {
                            $name_fields['SURN'] = $match[1];
                            $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/';
                        }
                        if ($famtag == 'WIFE' && preg_match('/\\/\\S+ (\\S+)\\//', $indi_name, $match)) {
                            $name_fields['SURN'] = $match[1];
                            $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/';
                        }
                        break;
                    case 'add_child_to_individual_action':
                    case 'add_spouse_to_individual_action':
                    case 'add_spouse_to_family_action':
                        break;
                }
                break;
            case 'portuguese':
                //Mother: Maria /AAAA BBBB/
                //Father: Jose  /CCCC DDDD/
                //Child:  Pablo /BBBB DDDD/
                switch ($nextaction) {
                    case 'add_child_to_family_action':
                        if (preg_match('/\\/\\S+\\s+(\\S+)\\//', $mother_name, $matchm) && preg_match('/\\/\\S+\\s+(\\S+)\\//', $father_name, $matchf)) {
                            $name_fields['SURN'] = $matchf[1] . ' ' . $matchm[1];
                            $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/';
                        }
                        break;
                    case 'add_parent_to_individual_action':
                        if ($famtag == 'HUSB' && preg_match('/\\/\\S+\\s+(\\S+)\\//', $indi_name, $match)) {
                            $name_fields['SURN'] = $match[1];
                            $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/';
                        }
                        if ($famtag == 'WIFE' && preg_match('/\\/(\\S+)\\s+\\S+\\//', $indi_name, $match)) {
                            $name_fields['SURN'] = $match[1];
                            $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/';
                        }
                        break;
                    case 'add_child_to_individual_action':
                    case 'add_spouse_to_individual_action':
                    case 'add_spouse_to_family_action':
                        break;
                }
                break;
            case 'icelandic':
                // Sons get their father’s given name plus “sson”
                // Daughters get their father’s given name plus “sdottir”
                switch ($nextaction) {
                    case 'add_child_to_family_action':
                        if ($gender == 'M' && preg_match('/(\\S+)\\s+\\/.*\\//', $father_name, $match)) {
                            $name_fields['SURN'] = preg_replace('/s$/', '', $match[1]) . 'sson';
                            $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/';
                        }
                        if ($gender == 'F' && preg_match('/(\\S+)\\s+\\/.*\\//', $father_name, $match)) {
                            $name_fields['SURN'] = preg_replace('/s$/', '', $match[1]) . 'sdottir';
                            $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/';
                        }
                        break;
                    case 'add_parent_to_individual_action':
                        if ($famtag == 'HUSB' && preg_match('/(\\S+)sson\\s+\\/.*\\//i', $indi_name, $match)) {
                            $name_fields['GIVN'] = $match[1];
                            $name_fields['NAME'] = $name_fields['GIVN'] . ' //';
                        }
                        if ($famtag == 'WIFE' && preg_match('/(\\S+)sdottir\\s+\\/.*\\//i', $indi_name, $match)) {
                            $name_fields['GIVN'] = $match[1];
                            $name_fields['NAME'] = $name_fields['GIVN'] . ' //';
                        }
                        break;
                    case 'add_child_to_individual_action':
                    case 'add_spouse_to_individual_action':
                    case 'add_spouse_to_family_action':
                        break;
                }
                break;
            case 'patrilineal':
                // Father gives his surname to his children
                switch ($nextaction) {
                    case 'add_child_to_family_action':
                        if (preg_match('/\\/((?:[a-z]{2,3} )*)(.*)\\//i', $father_name, $match)) {
                            $name_fields['SURN'] = $match[2];
                            $name_fields['SPFX'] = trim($match[1]);
                            $name_fields['NAME'] = "/{$match[1]}{$match[2]}/";
                        }
                        break;
                    case 'add_parent_to_individual_action':
                        if ($famtag == 'HUSB' && preg_match('/\\/((?:[a-z]{2,3} )*)(.*)\\//i', $indi_name, $match)) {
                            $name_fields['SURN'] = $match[2];
                            $name_fields['SPFX'] = trim($match[1]);
                            $name_fields['NAME'] = "/{$match[1]}{$match[2]}/";
                        }
                        break;
                    case 'add_child_to_individual_action':
                    case 'add_spouse_to_individual_action':
                    case 'add_spouse_to_family_action':
                        break;
                }
                break;
            case 'matrilineal':
                // Mother gives her surname to her children
                switch ($nextaction) {
                    case 'add_child_to_family_action':
                        if (preg_match('/\\/((?:[a-z]{2,3} )*)(.*)\\//i', $mother, $match)) {
                            $name_fields['SURN'] = $match[2];
                            $name_fields['SPFX'] = trim($match[1]);
                            $name_fields['NAME'] = "/{$match[1]}{$match[2]}/";
                        }
                        break;
                    case 'add_parent_to_individual_action':
                        if ($famtag == 'WIFE' && preg_match('/\\/((?:[a-z]{2,3} )*)(.*)\\//i', $indi_name, $match)) {
                            $name_fields['SURN'] = $match[2];
                            $name_fields['SPFX'] = trim($match[1]);
                            $name_fields['NAME'] = "/{$match[1]}{$match[2]}/";
                        }
                        break;
                    case 'add_child_to_individual_action':
                    case 'add_spouse_to_individual_action':
                    case 'add_spouse_to_family_action':
                        break;
                }
                break;
            case 'paternal':
            case 'polish':
            case 'lithuanian':
                // Father gives his surname to his wife and children
                switch ($nextaction) {
                    case 'add_spouse_to_individual_action':
                        if ($famtag == 'WIFE' && preg_match('/\\/(.*)\\//', $indi_name, $match)) {
                            if ($SURNAME_TRADITION == 'polish') {
                                $match[1] = preg_replace(array('/ski$/', '/cki$/', '/dzki$/', '/żki$/'), array('ska', 'cka', 'dzka', 'żka'), $match[1]);
                            } elseif ($SURNAME_TRADITION == 'lithuanian') {
                                $match[1] = preg_replace(array('/as$/', '/is$/', '/ys$/', '/us$/'), array('ienė', 'ienė', 'ienė', 'ienė'), $match[1]);
                            }
                            $new_marnm = $match[1];
                        }
                        break;
                    case 'add_child_to_family_action':
                        if (preg_match('/\\/((?:[a-z]{2,3} )*)(.*)\\//i', $father_name, $match)) {
                            $name_fields['SURN'] = $match[2];
                            if ($SURNAME_TRADITION == 'polish' && $gender == 'F') {
                                $match[2] = preg_replace(array('/ski$/', '/cki$/', '/dzki$/', '/żki$/'), array('ska', 'cka', 'dzka', 'żka'), $match[2]);
                            } elseif ($SURNAME_TRADITION == 'lithuanian' && $gender == 'F') {
                                $match[2] = preg_replace(array('/as$/', '/a$/', '/is$/', '/ys$/', '/ius$/', '/us$/'), array('aitė', 'aitė', 'ytė', 'ytė', 'iūtė', 'utė'), $match[2]);
                            }
                            $name_fields['SPFX'] = trim($match[1]);
                            $name_fields['NAME'] = "/{$match[1]}{$match[2]}/";
                        }
                        break;
                    case 'add_child_to_individual_action':
                        if ($person->getSex() == 'M' && preg_match('/\\/((?:[a-z]{2,3} )*)(.*)\\//i', $indi_name, $match)) {
                            $name_fields['SURN'] = $match[2];
                            if ($SURNAME_TRADITION == 'polish' && $gender == 'F') {
                                $match[2] = preg_replace(array('/ski$/', '/cki$/', '/dzki$/', '/żki$/'), array('ska', 'cka', 'dzka', 'żka'), $match[2]);
                            } elseif ($SURNAME_TRADITION == 'lithuanian' && $gender == 'F') {
                                $match[2] = preg_replace(array('/as$/', '/a$/', '/is$/', '/ys$/', '/ius$/', '/us$/'), array('aitė', 'aitė', 'ytė', 'ytė', 'iūtė', 'utė'), $match[2]);
                            }
                            $name_fields['SPFX'] = trim($match[1]);
                            $name_fields['NAME'] = "/{$match[1]}{$match[2]}/";
                        }
                        break;
                    case 'add_parent_to_individual_action':
                        if ($famtag == 'HUSB' && preg_match('/\\/((?:[a-z]{2,3} )*)(.*)\\//i', $indi_name, $match)) {
                            if ($SURNAME_TRADITION == 'polish' && $gender == 'M') {
                                $match[2] = preg_replace(array('/ska$/', '/cka$/', '/dzka$/', '/żka$/'), array('ski', 'cki', 'dzki', 'żki'), $match[2]);
                            } elseif ($SURNAME_TRADITION == 'lithuanian') {
                                // not a complete list as the rules are somewhat complicated but will do 95% correctly
                                $match[2] = preg_replace(array('/aitė$/', '/ytė$/', '/iūtė$/', '/utė$/'), array('as', 'is', 'ius', 'us'), $match[2]);
                            }
                            $name_fields['SPFX'] = trim($match[1]);
                            $name_fields['SURN'] = $match[2];
                            $name_fields['NAME'] = "/{$match[1]}{$match[2]}/";
                        }
                        if ($famtag == 'WIFE' && preg_match('/\\/((?:[a-z]{2,3} )*)(.*)\\//i', $indi_name, $match)) {
                            if ($SURNAME_TRADITION == 'lithuanian') {
                                $match[2] = preg_replace(array('/as$/', '/is$/', '/ys$/', '/us$/'), array('ienė', 'ienė', 'ienė', 'ienė'), $match[2]);
                                $match[2] = preg_replace(array('/aitė$/', '/ytė$/', '/iūtė$/', '/utė$/'), array('ienė', 'ienė', 'ienė', 'ienė'), $match[2]);
                            }
                            $new_marnm = $match[2];
                        }
                        break;
                    case 'add_spouse_to_family_action':
                        break;
                }
                break;
        }
    }
    // Initialise an empty name field
    if (empty($name_fields['NAME'])) {
        $name_fields['NAME'] = '//';
    }
    // Populate any missing 2 XXXX fields from the 1 NAME field
    $npfx_accept = implode('|', $NPFX_accept);
    if (preg_match("/((({$npfx_accept})\\.? +)*)([^\n\\/\"]*)(\"(.*)\")? *\\/(([a-z]{2,3} +)*)(.*)\\/ *(.*)/i", $name_fields['NAME'], $name_bits)) {
        if (empty($name_fields['NPFX'])) {
            $name_fields['NPFX'] = $name_bits[1];
        }
        if (empty($name_fields['SPFX']) && empty($name_fields['SURN'])) {
            $name_fields['SPFX'] = trim($name_bits[7]);
            // For names with two surnames, there will be four slashes.
            // Turn them into a list
            $name_fields['SURN'] = preg_replace('~/[^/]*/~', ',', $name_bits[9]);
        }
        if (empty($name_fields['GIVN'])) {
            $name_fields['GIVN'] = $name_bits[4];
        }
        // Don’t automatically create an empty NICK - it is an “advanced” field.
        if (empty($name_fields['NICK']) && !empty($name_bits[6]) && !preg_match('/^2 NICK/m', $namerec)) {
            $name_fields['NICK'] = $name_bits[6];
        }
    }
    // Edit the standard name fields
    foreach ($name_fields as $tag => $value) {
        add_simple_tag("0 {$tag} {$value}");
    }
    // Get the advanced name fields
    $adv_name_fields = array();
    if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $ADVANCED_NAME_FACTS, $match)) {
        foreach ($match[1] as $tag) {
            $adv_name_fields[$tag] = '';
        }
    }
    // This is a custom tag, but webtrees uses it extensively.
    if ($SURNAME_TRADITION == 'paternal' || $SURNAME_TRADITION == 'polish' || $SURNAME_TRADITION == 'lithuanian' || strpos($namerec, '2 _MARNM') !== false) {
        $adv_name_fields['_MARNM'] = '';
    }
    if (isset($adv_name_fields['TYPE'])) {
        unset($adv_name_fields['TYPE']);
    }
    foreach ($adv_name_fields as $tag => $dummy) {
        // Edit existing tags
        if (preg_match_all("/2 {$tag} (.+)/", $namerec, $match)) {
            foreach ($match[1] as $value) {
                if ($tag == '_MARNM') {
                    $mnsct = preg_match('/\\/(.+)\\//', $value, $match2);
                    $marnm_surn = '';
                    if ($mnsct > 0) {
                        $marnm_surn = $match2[1];
                    }
                    add_simple_tag("2 _MARNM " . $value);
                    add_simple_tag("2 _MARNM_SURN " . $marnm_surn);
                } else {
                    add_simple_tag("2 {$tag} {$value}", '', WT_Gedcom_Tag::getLabel("NAME:{$tag}", $person));
                }
            }
        }
        // Allow a new row to be entered if there was no row provided
        if (count($match[1]) == 0 && empty($name_fields[$tag]) || $tag != '_HEB' && $tag != 'NICK') {
            if ($tag == '_MARNM') {
                if (strstr($ADVANCED_NAME_FACTS, '_MARNM') == false) {
                    add_simple_tag("0 _MARNM");
                    add_simple_tag("0 _MARNM_SURN {$new_marnm}");
                }
            } else {
                add_simple_tag("0 {$tag}", '', WT_Gedcom_Tag::getLabel("NAME:{$tag}", $person));
            }
        }
    }
    // Handle any other NAME subfields that aren’t included above (SOUR, NOTE, _CUSTOM, etc)
    if ($namerec) {
        $gedlines = explode("\n", $namerec);
        // -- find the number of lines in the record
        $fields = explode(' ', $gedlines[0]);
        $glevel = $fields[0];
        $level = $glevel;
        $type = trim($fields[1]);
        $tags = array();
        $i = 0;
        do {
            if ($type != 'TYPE' && !isset($name_fields[$type]) && !isset($adv_name_fields[$type])) {
                $text = '';
                for ($j = 2; $j < count($fields); $j++) {
                    if ($j > 2) {
                        $text .= ' ';
                    }
                    $text .= $fields[$j];
                }
                while ($i + 1 < count($gedlines) && preg_match("/" . ($level + 1) . " (CON[CT]) ?(.*)/", $gedlines[$i + 1], $cmatch) > 0) {
                    if ($cmatch[1] == "CONT") {
                        $text .= "\n";
                    }
                    if ($WORD_WRAPPED_NOTES) {
                        $text .= ' ';
                    }
                    $text .= $cmatch[2];
                    $i++;
                }
                add_simple_tag($level . ' ' . $type . ' ' . $text);
            }
            $tags[] = $type;
            $i++;
            if (isset($gedlines[$i])) {
                $fields = explode(' ', $gedlines[$i]);
                $level = $fields[0];
                if (isset($fields[1])) {
                    $type = $fields[1];
                }
            }
        } while ($level > $glevel && $i < count($gedlines));
    }
    // If we are adding a new individual, add the basic details
    if ($nextaction != 'update') {
        echo '</table><br><table class="facts_table">';
        // 1 SEX
        if ($famtag == "HUSB" || $gender == "M") {
            add_simple_tag("0 SEX M");
        } elseif ($famtag == "WIFE" || $gender == "F") {
            add_simple_tag("0 SEX F");
        } else {
            add_simple_tag("0 SEX");
        }
        $bdm = "BD";
        if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) {
            foreach ($matches[1] as $match) {
                if (!in_array($match, explode('|', WT_EVENTS_DEAT))) {
                    addSimpleTags($match);
                }
            }
        }
        //-- if adding a spouse add the option to add a marriage fact to the new family
        if ($nextaction == 'add_spouse_to_individual_action' || $nextaction == 'add_spouse_to_family_action') {
            $bdm .= "M";
            if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FAMFACTS, $matches)) {
                foreach ($matches[1] as $match) {
                    addSimpleTags($match);
                }
            }
        }
        if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) {
            foreach ($matches[1] as $match) {
                if (in_array($match, explode('|', WT_EVENTS_DEAT))) {
                    addSimpleTags($match);
                }
            }
        }
    }
    echo keep_chan($person);
    echo "</table>";
    if ($nextaction == 'update') {
        // GEDCOM 5.5.1 spec says NAME doesn’t get a OBJE
        print_add_layer('SOUR');
        print_add_layer('NOTE');
        print_add_layer('SHARED_NOTE');
    } else {
        print_add_layer('SOUR', 1);
        print_add_layer('OBJE', 1);
        print_add_layer('NOTE', 1);
        print_add_layer('SHARED_NOTE', 1);
    }
    // If we are editing an existing name, allow raw GEDCOM editing
    if ($name_fact && (Auth::isAdmin() || $SHOW_GEDCOM_RECORD)) {
        echo '<br><br><a href="edit_interface.php?action=editrawfact&amp;xref=', $xref, '&amp;fact_id=', $name_fact->getFactId(), '&amp;ged=', WT_GEDURL, '">', WT_I18N::translate('Edit raw GEDCOM'), '</a>';
    }
    echo '<p id="save-cancel">';
    echo '<input type="submit" class="save" value="', WT_I18N::translate('save'), '">';
    if (preg_match('/^add_(child|spouse|parent|unlinked_indi)/', $nextaction)) {
        echo '<input type="submit" class="save" value="', WT_I18N::translate('go to new individual'), '" onclick="document.addchildform.goto.value=\'new\';">';
    }
    echo '<input type="button" class="cancel" value="', WT_I18N::translate('close'), '" onclick="window.close();">';
    echo '</p>';
    echo '</form>';
    $controller->addInlineJavascript('
	SURNAME_TRADITION="' . $SURNAME_TRADITION . '";
	gender="' . $gender . '";
	famtag="' . $famtag . '";
	function trim(str) {
		str=str.replace(/\\s\\s+/g, " ");
		return str.replace(/(^\\s+)|(\\s+$)/g, "");
	}

	function lang_class(str) {
		if (str.match(/[\\u0370-\\u03FF]/)) return "greek";
		if (str.match(/[\\u0400-\\u04FF]/)) return "cyrillic";
		if (str.match(/[\\u0590-\\u05FF]/)) return "hebrew";
		if (str.match(/[\\u0600-\\u06FF]/)) return "arabic";
		return "latin"; // No matched text implies latin :-)
	}

	// Generate a full name from the name components
	function generate_name() {
		var frm =document.forms[0];
		var npfx=frm.NPFX.value;
		var givn=frm.GIVN.value;
		var spfx=frm.SPFX.value;
		var surn=frm.SURN.value;
		var nsfx=frm.NSFX.value;
		if (SURNAME_TRADITION=="polish" && (gender=="F" || famtag=="WIFE")) {
			surn=surn.replace(/ski$/, "ska");
			surn=surn.replace(/cki$/, "cka");
			surn=surn.replace(/dzki$/, "dzka");
			surn=surn.replace(/żki$/, "żka");
		}
		// Commas are used in the GIVN and SURN field to separate lists of surnames.
		// For example, to differentiate the two Spanish surnames from an English
		// double-barred name.
		// Commas *may* be used in other fields, and will form part of the NAME.
		if (WT_LOCALE=="vi" || WT_LOCALE=="hu") {
			// Default format: /SURN/ GIVN
			return trim(npfx+" /"+trim(spfx+" "+surn).replace(/ *, */g, " ")+"/ "+givn.replace(/ *, */g, " ")+" "+nsfx);
		} else if (WT_LOCALE=="zh") {
			// Default format: /SURN/GIVN
			return trim(npfx+" /"+trim(spfx+" "+surn).replace(/ *, */g, " ")+"/"+givn.replace(/ *, */g, " ")+" "+nsfx);
		} else {
			// Default format: GIVN /SURN/
			return trim(npfx+" "+givn.replace(/ *, */g, " ")+" /"+trim(spfx+" "+surn).replace(/ *, */g, " ")+"/ "+nsfx);
		}
	}

	// Update the NAME and _MARNM fields from the name components
	// and also display the value in read-only "gedcom" format.
	function updatewholename() {
		// don’t update the name if the user manually changed it
		if (manualChange) return;
		// Update NAME field from components and display it
		var frm =document.forms[0];
		var npfx=frm.NPFX.value;
		var givn=frm.GIVN.value;
		var spfx=frm.SPFX.value;
		var surn=frm.SURN.value;
		var nsfx=frm.NSFX.value;
		document.getElementById("NAME").value=generate_name();
		document.getElementById("NAME_display").innerText=frm.NAME.value;
		// Married names inherit some NSFX values, but not these
		nsfx=nsfx.replace(/^(I|II|III|IV|V|VI|Junior|Jr\\.?|Senior|Sr\\.?)$/i, "");
		// Update _MARNM field from _MARNM_SURN field and display it
		// Be careful of mixing latin/hebrew/etc. character sets.
		var ip=document.getElementsByTagName("input");
		var marnm_id="";
		var romn="";
		var heb="";
		for (var i=0; i<ip.length; i++) {
			var val=ip[i].value;
			if (ip[i].id.indexOf("_HEB")==0)
				heb=val;
			if (ip[i].id.indexOf("ROMN")==0)
				romn=val;
			if (ip[i].id.indexOf("_MARNM")==0) {
				if (ip[i].id.indexOf("_MARNM_SURN")==0) {
					var msurn="";
					if (val!="") {
						var lc=lang_class(document.getElementById(ip[i].id).value);
						if (lang_class(frm.NAME.value)==lc)
							msurn=trim(npfx+" "+givn+" /"+val+"/ "+nsfx);
						else if (lc=="hebrew")
							msurn=heb.replace(/\\/.*\\//, "/"+val+"/");
						else if (lang_class(romn)==lc)
							msurn=romn.replace(/\\/.*\\//, "/"+val+"/");
					}
					document.getElementById(marnm_id).value=msurn;
					document.getElementById(marnm_id+"_display").innerHTML=msurn;
				} else {
					marnm_id=ip[i].id;
				}
			}
		}
	}

	// Toggle the name editor fields between
	// <input type="hidden"> <span style="display:inline">
	// <input type="text">   <span style="display:hidden">
	var oldName = "";
	var manualChange = false;
	function convertHidden(eid) {
		var input1 = jQuery("#" + eid);
		var input2 = jQuery("#" + eid + "_display");
		// Note that IE does not allow us to change the type of an input, so we must create a new one.
		if (input1.attr("type")=="hidden") {
			input1.replaceWith(input1.clone().attr("type", "text"));
			input2.hide();
		} else {
			input1.replaceWith(input1.clone().attr("type", "hidden"));
			input2.show();
		}
	}

	/**
	 * if the user manually changed the NAME field, then update the textual
	 * HTML representation of it
	 * If the value changed set manualChange to true so that changing
	 * the other fields doesn’t change the NAME line
	 */
	function updateTextName(eid) {
		var element = document.getElementById(eid);
		if (element) {
			if (element.value!=oldName) manualChange = true;
			var delement = document.getElementById(eid+"_display");
			if (delement) {
				delement.innerHTML = element.value;
			}
		}
	}

	function checkform() {
		var ip=document.getElementsByTagName("input");
		for (var i=0; i<ip.length; i++) {
			// ADD slashes to _HEB and _AKA names
			if (ip[i].id.indexOf("_AKA")==0 || ip[i].id.indexOf("_HEB")==0 || ip[i].id.indexOf("ROMN")==0)
				if (ip[i].value.indexOf("/")<0 && ip[i].value!="")
					ip[i].value=ip[i].value.replace(/([^\\s]+)\\s*$/, "/$1/");
			// Blank out temporary _MARNM_SURN
			if (ip[i].id.indexOf("_MARNM_SURN")==0)
					ip[i].value="";
			// Convert "xxx yyy" and "xxx y yyy" surnames to "xxx,yyy"
			if ((SURNAME_TRADITION=="spanish" || "SURNAME_TRADITION"=="portuguese") && ip[i].id.indexOf("SURN")==0) {
				ip[i].value=document.forms[0].SURN.value.replace(/^\\s*([^\\s,]{2,})\\s+([iIyY] +)?([^\\s,]{2,})\\s*$/, "$1,$3");
			}
		}
		return true;
	}

	// If the name isn’t initially formed from the components in a standard way,
	// then don’t automatically update it.
	if (document.getElementById("NAME").value!=generate_name() && document.getElementById("NAME").value!="//") {
		convertHidden("NAME");
	}
	');
    echo '</div>';
}
예제 #4
0
    public function getBlock($block_id, $template = true, $cfg = null)
    {
        global $ctype, $controller;
        $show_unassigned = get_block_setting($block_id, 'show_unassigned', true);
        $show_other = get_block_setting($block_id, 'show_other', true);
        $show_future = get_block_setting($block_id, 'show_future', true);
        $block = get_block_setting($block_id, 'block', true);
        if ($cfg) {
            foreach (array('show_unassigned', 'show_other', 'show_future', 'block') as $name) {
                if (array_key_exists($name, $cfg)) {
                    ${$name} = $cfg[$name];
                }
            }
        }
        $id = $this->getName() . $block_id;
        $class = $this->getName() . '_block';
        if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && WT_USER_ID) {
            $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
        } else {
            $title = '';
        }
        $title .= $this->getTitle() . help_link('todo', $this->getName());
        $table_id = Uuid::uuid4();
        // create a unique ID
        $controller->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript('
				jQuery("#' . $table_id . '").dataTable({
					dom: \'t\',
					' . WT_I18N::datatablesI18N() . ',
					autoWidth: false,
					paginate: false,
					lengthChange: false,
					filter: false,
					info: true,
					jQueryUI: true,
					columns: [
						/* 0-DATE */   		{ visible: false },
						/* 1-Date */		{ dataSort: 0 },
						/* 1-Record */ 		null,
						/* 2-Username */	null,
						/* 3-Text */		null
					]
				});
			jQuery("#' . $table_id . '").css("visibility", "visible");
			jQuery(".loading-image").css("display", "none");
			');
        $content = '';
        $content .= '<div class="loading-image">&nbsp;</div>';
        $content .= '<table id="' . $table_id . '" style="visibility:hidden;">';
        $content .= '<thead><tr>';
        $content .= '<th>DATE</th>';
        //hidden by datables code
        $content .= '<th>' . WT_Gedcom_Tag::getLabel('DATE') . '</th>';
        $content .= '<th>' . WT_I18N::translate('Record') . '</th>';
        if ($show_unassigned || $show_other) {
            $content .= '<th>' . WT_I18N::translate('Username') . '</th>';
        }
        $content .= '<th>' . WT_Gedcom_Tag::getLabel('TEXT') . '</th>';
        $content .= '</tr></thead><tbody>';
        $found = false;
        $end_jd = $show_future ? 99999999 : WT_CLIENT_JD;
        foreach (get_calendar_events(0, $end_jd, '_TODO', WT_GED_ID) as $fact) {
            $record = $fact->getParent();
            $user_name = $fact->getAttribute('_WT_USER');
            if ($user_name == WT_USER_NAME || !$user_name && $show_unassigned || $user_name && $show_other) {
                $content .= '<tr>';
                //-- Event date (sortable)
                $content .= '<td>';
                //hidden by datables code
                $content .= $fact->getDate()->JD();
                $content .= '</td>';
                $content .= '<td class="wrap">' . $fact->getDate()->Display(empty($SEARCH_SPIDER)) . '</td>';
                $content .= '<td class="wrap"><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></td>';
                if ($show_unassigned || $show_other) {
                    $content .= '<td class="wrap">' . $user_name . '</td>';
                }
                $text = $fact->getValue();
                $content .= '<td class="wrap">' . $text . '</td>';
                $content .= '</tr>';
                $found = true;
            }
        }
        $content .= '</tbody></table>';
        if (!$found) {
            $content .= '<p>' . WT_I18N::translate('There are no research tasks in this family tree.') . '</p>';
        }
        if ($template) {
            if ($block) {
                require WT_THEME_DIR . 'templates/block_small_temp.php';
            } else {
                require WT_THEME_DIR . 'templates/block_main_temp.php';
            }
        } else {
            return $content;
        }
    }
예제 #5
0
 /**
  * print a family descendancy
  *
  * @param WT_Individual $person
  * @param WT_Family     $family
  * @param int           $depth the descendancy depth to show
  *
  * @return void
  */
 function print_family_descendancy(WT_Individual $person, WT_Family $family, $depth)
 {
     global $WT_IMAGES, $Dindent, $personcount;
     // print marriage info
     echo '<li>';
     echo '<img src="', $WT_IMAGES['spacer'], '" height="2" width="', $Dindent + 4, '" alt="">';
     echo '<span class="details1" style="white-space:nowrap;">';
     echo "<a href=\"#\" onclick=\"expand_layer('" . $family->getXref() . $personcount . "'); return false;\" class=\"top\"><i id=\"" . $family->getXref() . $personcount . "_img\" class=\"icon-minus\" title=\"" . WT_I18N::translate('View family') . "\"></i></a>";
     if ($family->canShow()) {
         foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) {
             echo ' <a href="', $family->getHtmlUrl(), '" class="details1">', $fact->summary(), '</a>';
         }
     }
     echo '</span>';
     // print spouse
     $spouse = $family->getSpouse($person);
     echo '<ul style="list-style:none; display:block;" id="' . $family->getXref() . $personcount . '">';
     echo '<li>';
     echo '<table border="0" cellpadding="0" cellspacing="0"><tr><td>';
     print_pedigree_person($spouse, 1, 0, $personcount);
     echo '</td>';
     // check if spouse has parents and add an arrow
     echo '<td>&nbsp;</td>';
     echo '<td>';
     if ($spouse) {
         foreach ($spouse->getChildFamilies() as $cfamily) {
             foreach ($cfamily->getSpouses() as $parent) {
                 print_url_arrow($parent->getXref() . $personcount . $person->getXref(), '?rootid=' . $parent->getXref() . '&amp;generations=' . $this->generations . '&amp;chart_style=' . $this->chart_style . '&amp;show_full=' . $this->show_full . '&amp;box_width=' . $this->box_width . '&amp;ged=' . WT_GEDURL, WT_I18N::translate('Start at parents'), 2);
                 $personcount++;
                 // only show the arrow for one of the parents
                 break;
             }
         }
     }
     if ($this->show_full) {
         echo '<br><br>&nbsp;';
     }
     echo '</td></tr>';
     // children
     $children = $family->getChildren();
     echo '<tr><td colspan="3" class="details1" >&nbsp;&nbsp;';
     if ($children) {
         echo WT_Gedcom_Tag::getLabel('NCHI') . ': ' . count($children);
     } else {
         // Distinguish between no children (NCHI 0) and no recorded
         // children (no CHIL records)
         if (strpos($family->getGedcom(), '\\n1 NCHI 0')) {
             echo WT_Gedcom_Tag::getLabel('NCHI') . ': ' . count($children);
         } else {
             echo WT_I18N::translate('No children');
         }
     }
     echo '</td></tr></table>';
     echo '</li>';
     if ($depth > 1) {
         foreach ($children as $child) {
             $personcount++;
             $this->print_child_descendancy($child, $depth - 1);
         }
     }
     echo '</ul>';
     echo '</li>';
 }
예제 #6
0
 public function getBlock($block_id, $template = true, $cfg = null)
 {
     global $ctype, $show_full, $PEDIGREE_FULL_DETAILS, $controller;
     self::updateSchema();
     // make sure the favorites table has been created
     $action = WT_Filter::get('action');
     switch ($action) {
         case 'deletefav':
             $favorite_id = WT_Filter::getInteger('favorite_id');
             if ($favorite_id) {
                 self::deleteFavorite($favorite_id);
             }
             break;
         case 'addfav':
             $gid = WT_Filter::get('gid', WT_REGEX_XREF);
             $favnote = WT_Filter::get('favnote');
             $url = WT_Filter::getUrl('url');
             $favtitle = WT_Filter::get('favtitle');
             if ($gid) {
                 $record = WT_GedcomRecord::getInstance($gid);
                 if ($record && $record->canShow()) {
                     self::addFavorite(array('user_id' => $ctype == 'user' ? WT_USER_ID : null, 'gedcom_id' => WT_GED_ID, 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => $favnote, 'title' => $favtitle));
                 }
             } elseif ($url) {
                 self::addFavorite(array('user_id' => $ctype == 'user' ? WT_USER_ID : null, 'gedcom_id' => WT_GED_ID, 'gid' => null, 'type' => 'URL', 'url' => $url, 'note' => $favnote, 'title' => $favtitle ? $favtitle : $url));
             }
             break;
     }
     $block = get_block_setting($block_id, 'block', false);
     if ($cfg) {
         foreach (array('block') as $name) {
             if (array_key_exists($name, $cfg)) {
                 ${$name} = $cfg[$name];
             }
         }
     }
     // Override GEDCOM configuration temporarily
     if (isset($show_full)) {
         $saveShowFull = $show_full;
     }
     $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
     $show_full = 1;
     $PEDIGREE_FULL_DETAILS = 1;
     $userfavs = $this->getFavorites($ctype == 'user' ? WT_USER_ID : WT_GED_ID);
     if (!is_array($userfavs)) {
         $userfavs = array();
     }
     $id = $this->getName() . $block_id;
     $class = $this->getName() . '_block';
     $title = $this->getTitle();
     if (WT_USER_ID) {
         $controller->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
     }
     $content = '';
     $style = 2;
     // 1 means "regular box", 2 means "wide box"
     if ($userfavs) {
         foreach ($userfavs as $key => $favorite) {
             if (isset($favorite['id'])) {
                 $key = $favorite['id'];
             }
             $removeFavourite = '<a class="font9" href="index.php?ctype=' . $ctype . '&amp;action=deletefav&amp;favorite_id=' . $key . '" onclick="return confirm(\'' . WT_I18N::translate('Are you sure you want to remove this item from your list of favorites?') . '\');">' . WT_I18N::translate('Remove') . '</a> ';
             if ($favorite['type'] == 'URL') {
                 $content .= '<div id="boxurl' . $key . '.0" class="person_box">';
                 if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) {
                     $content .= $removeFavourite;
                 }
                 $content .= '<a href="' . $favorite['url'] . '"><b>' . $favorite['title'] . '</b></a>';
                 $content .= '<br>' . $favorite['note'];
                 $content .= '</div>';
             } else {
                 $record = WT_GedcomRecord::getInstance($favorite['gid']);
                 if ($record && $record->canShow()) {
                     if ($record instanceof WT_Individual) {
                         $content .= '<div id="box' . $favorite["gid"] . '.0" class="person_box action_header';
                         switch ($record->getsex()) {
                             case 'M':
                                 break;
                             case 'F':
                                 $content .= 'F';
                                 break;
                             case 'U':
                                 $content .= 'NN';
                                 break;
                         }
                         $content .= '">';
                         if ($ctype == "user" || WT_USER_GEDCOM_ADMIN) {
                             $content .= $removeFavourite;
                         }
                         ob_start();
                         print_pedigree_person($record, $style, 1, $key);
                         $content .= ob_get_clean();
                         $content .= $favorite['note'];
                         $content .= '</div>';
                     } else {
                         $content .= '<div id="box' . $favorite['gid'] . '.0" class="person_box">';
                         if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) {
                             $content .= $removeFavourite;
                         }
                         $content .= $record->format_list('span');
                         $content .= '<br>' . $favorite['note'];
                         $content .= '</div>';
                     }
                 }
             }
         }
     }
     if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) {
         $uniqueID = Uuid::uuid4();
         // This block can theoretically appear multiple times, so use a unique ID.
         $content .= '<div class="add_fav_head">';
         $content .= '<a href="#" onclick="return expand_layer(\'add_fav' . $uniqueID . '\');">' . WT_I18N::translate('Add a new favorite') . '<i id="add_fav' . $uniqueID . '_img" class="icon-plus"></i></a>';
         $content .= '</div>';
         $content .= '<div id="add_fav' . $uniqueID . '" style="display: none;">';
         $content .= '<form name="addfavform" method="get" action="index.php">';
         $content .= '<input type="hidden" name="action" value="addfav">';
         $content .= '<input type="hidden" name="ctype" value="' . $ctype . '">';
         $content .= '<input type="hidden" name="ged" value="' . WT_GEDCOM . '">';
         $content .= '<div class="add_fav_ref">';
         $content .= '<input type="radio" name="fav_category" value="record" checked="checked" onclick="jQuery(\'#gid' . $uniqueID . '\').removeAttr(\'disabled\'); jQuery(\'#url, #favtitle\').attr(\'disabled\',\'disabled\').val(\'\');">';
         $content .= '<label for="gid' . $uniqueID . '">' . WT_I18N::translate('Enter an individual, family, or source ID') . '</label>';
         $content .= '<input class="pedigree_form" data-autocomplete-type="IFSRO" type="text" name="gid" id="gid' . $uniqueID . '" size="5" value="">';
         $content .= ' ' . print_findindi_link('gid' . $uniqueID);
         $content .= ' ' . print_findfamily_link('gid' . $uniqueID);
         $content .= ' ' . print_findsource_link('gid' . $uniqueID);
         $content .= ' ' . print_findrepository_link('gid' . $uniqueID);
         $content .= ' ' . print_findnote_link('gid' . $uniqueID);
         $content .= ' ' . print_findmedia_link('gid' . $uniqueID);
         $content .= '</div>';
         $content .= '<div class="add_fav_url">';
         $content .= '<input type="radio" name="fav_category" value="url" onclick="jQuery(\'#url, #favtitle\').removeAttr(\'disabled\'); jQuery(\'#gid' . $uniqueID . '\').attr(\'disabled\',\'disabled\').val(\'\');">';
         $content .= '<input type="text" name="url" id="url" size="20" value="" placeholder="' . WT_Gedcom_Tag::getLabel('URL') . '" disabled="disabled"> ';
         $content .= '<input type="text" name="favtitle" id="favtitle" size="20" value="" placeholder="' . WT_I18N::translate('Title') . '" disabled="disabled">';
         $content .= '<p>' . WT_I18N::translate('Enter an optional note about this favorite') . '</p>';
         $content .= '<textarea name="favnote" rows="6" cols="50"></textarea>';
         $content .= '</div>';
         $content .= '<input type="submit" value="' . WT_I18N::translate('Add') . '">';
         $content .= '</form></div>';
     }
     if ($template) {
         if ($block) {
             require WT_THEME_DIR . 'templates/block_small_temp.php';
         } else {
             require WT_THEME_DIR . 'templates/block_main_temp.php';
         }
     } else {
         return $content;
     }
     // Restore GEDCOM configuration
     unset($show_full);
     if (isset($saveShowFull)) {
         $show_full = $saveShowFull;
     }
     $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
 }
예제 #7
0
function print_main_media(WT_Fact $fact, $level)
{
    $factrec = $fact->getGedcom();
    $parent = $fact->getParent();
    if ($fact->isNew()) {
        $styleadd = 'new';
        $can_edit = $level == 1 && $fact->canEdit();
    } elseif ($fact->isOld()) {
        $styleadd = 'old';
        $can_edit = false;
    } else {
        $styleadd = '';
        $can_edit = $level == 1 && $fact->canEdit();
    }
    // -- find source for each fact
    preg_match_all('/(?:^|\\n)' . $level . ' OBJE @(.*)@/', $factrec, $matches);
    foreach ($matches[1] as $xref) {
        $media = WT_Media::getInstance($xref);
        // Allow access to "1 OBJE @non_existent_source@", so it can be corrected/deleted
        if (!$media || $media->canShow()) {
            if ($level > 1) {
                echo '<tr class="row_obje2">';
            } else {
                echo '<tr>';
            }
            echo '<td class="descriptionbox';
            if ($level > 1) {
                echo ' rela';
            }
            echo ' ', $styleadd, ' width20">';
            preg_match("/^\\d (\\w*)/", $factrec, $factname);
            $factlines = explode("\n", $factrec);
            // 1 BIRT Y\n2 SOUR ...
            $factwords = explode(" ", $factlines[0]);
            // 1 BIRT Y
            $factname = $factwords[1];
            // BIRT
            if ($factname == 'EVEN' || $factname == 'FACT') {
                // Add ' EVEN' to provide sensible output for an event with an empty TYPE record
                $ct = preg_match("/2 TYPE (.*)/", $factrec, $ematch);
                if ($ct > 0) {
                    $factname = $ematch[1];
                    echo $factname;
                } else {
                    echo WT_Gedcom_Tag::getLabel($factname, $parent);
                }
            } else {
                if ($can_edit) {
                    echo '<a onclick="window.open(\'addmedia.php?action=editmedia&amp;pid=', $media->getXref(), '\', \'_blank\', edit_window_specs); return false;" href="#" title="', WT_I18N::translate('Edit'), '">';
                    echo WT_Gedcom_Tag::getLabel($factname, $parent), '</a>';
                    echo '<div class="editfacts">';
                    echo '<div class="editlink"><a class="editicon" onclick="window.open(\'addmedia.php?action=editmedia&amp;pid=', $media->getXref(), '\', \'_blank\', edit_window_specs); return false;" href="#" title="', WT_I18N::translate('Edit'), '"><span class="link_text">', WT_I18N::translate('Edit'), '</span></a></div>';
                    echo '<div class="copylink"><a class="copyicon" href="#" onclick="jQuery.post(\'action.php\',{action:\'copy-fact\', type:\'\', factgedcom:\'' . rawurlencode($factrec) . '\'},function(){location.reload();})" title="' . WT_I18N::translate('Copy') . '"><span class="link_text">' . WT_I18N::translate('Copy') . '</span></a></div>';
                    echo '<div class="deletelink"><a class="deleteicon" onclick="return delete_fact(\'', WT_I18N::translate('Are you sure you want to delete this fact?'), '\', \'', $parent->getXref(), '\', \'', $fact->getFactId(), '\');" href="#" title="', WT_I18N::translate('Delete'), '"><span class="link_text">', WT_I18N::translate('Delete'), '</span></a></div>';
                    echo '</div>';
                } else {
                    echo WT_Gedcom_Tag::getLabel($factname, $parent);
                }
            }
            echo '</td>';
            echo '<td class="optionbox ', $styleadd, ' wrap">';
            if ($media) {
                echo '<span class="field">';
                echo $media->displayImage();
                if (empty($SEARCH_SPIDER)) {
                    echo '<a href="' . $media->getHtmlUrl() . '">';
                }
                echo '<em>';
                foreach ($media->getAllNames() as $name) {
                    if ($name['type'] != 'TITL') {
                        echo '<br>';
                    }
                    echo $name['full'];
                }
                echo '</em>';
                if (empty($SEARCH_SPIDER)) {
                    echo '</a>';
                }
                echo '</span>';
                echo WT_Gedcom_Tag::getLabelValue('FORM', $media->mimeType());
                $imgsize = $media->getImageAttributes('main');
                if (!empty($imgsize['WxH'])) {
                    echo WT_Gedcom_Tag::getLabelValue('__IMAGE_SIZE__', $imgsize['WxH']);
                }
                if ($media->getFilesizeraw() > 0) {
                    echo WT_Gedcom_Tag::getLabelValue('__FILE_SIZE__', $media->getFilesize());
                }
                $mediatype = $media->getMediaType();
                if ($mediatype) {
                    echo WT_Gedcom_Tag::getLabelValue('TYPE', WT_Gedcom_Tag::getFileFormTypeValue($mediatype));
                }
                switch ($media->isPrimary()) {
                    case 'Y':
                        echo WT_Gedcom_Tag::getLabelValue('_PRIM', WT_I18N::translate('yes'));
                        break;
                    case 'N':
                        echo WT_Gedcom_Tag::getLabelValue('_PRIM', WT_I18N::translate('no'));
                        break;
                }
                echo print_fact_notes($media->getGedcom(), 1);
                echo print_fact_sources($media->getGedcom(), 1);
            } else {
                echo $xref;
            }
            echo '</td></tr>';
        }
    }
}
예제 #8
0
 function getLabel($tag)
 {
     return WT_Gedcom_Tag::getLabel(preg_replace('/:(SDX|BEGINS|EXACT|CONTAINS)$/', '', $tag));
 }
예제 #9
0
/**
 * Populates the global $tags array with any missing sub-tags.
 *
 * @param string $level1tag the type of the level 1 gedcom record
 * @param bool   $add_date
 */
function insert_missing_subtags($level1tag, $add_date = false)
{
    global $tags, $date_and_time, $level2_tags, $ADVANCED_PLAC_FACTS, $ADVANCED_NAME_FACTS;
    global $nondatefacts, $nonplacfacts;
    // handle  MARRiage TYPE
    $type_val = '';
    if (substr($level1tag, 0, 5) == 'MARR_') {
        $type_val = substr($level1tag, 5);
        $level1tag = 'MARR';
    }
    foreach ($level2_tags as $key => $value) {
        if ($key == 'DATE' && in_array($level1tag, $nondatefacts) || $key == 'PLAC' && in_array($level1tag, $nonplacfacts)) {
            continue;
        }
        if (in_array($level1tag, $value) && !in_array($key, $tags)) {
            if ($key == 'TYPE') {
                add_simple_tag('2 TYPE ' . $type_val, $level1tag);
            } elseif ($level1tag == '_TODO' && $key == 'DATE') {
                add_simple_tag('2 ' . $key . ' ' . strtoupper(date('d M Y')), $level1tag);
            } elseif ($level1tag == '_TODO' && $key == '_WT_USER') {
                add_simple_tag('2 ' . $key . ' ' . WT_USER_NAME, $level1tag);
            } else {
                if ($level1tag == 'TITL' && strstr($ADVANCED_NAME_FACTS, $key) !== false) {
                    add_simple_tag('2 ' . $key, $level1tag);
                } else {
                    if ($level1tag == 'NAME' && strstr($ADVANCED_NAME_FACTS, $key) !== false) {
                        add_simple_tag('2 ' . $key, $level1tag);
                    } else {
                        if ($level1tag != 'TITL' && $level1tag != 'NAME') {
                            add_simple_tag('2 ' . $key, $level1tag);
                        }
                    }
                }
            }
            switch ($key) {
                // Add level 3/4 tags as appropriate
                case 'PLAC':
                    if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $ADVANCED_PLAC_FACTS, $match)) {
                        foreach ($match[1] as $tag) {
                            add_simple_tag("3 {$tag}", '', WT_Gedcom_Tag::getLabel("{$level1tag}:PLAC:{$tag}"));
                        }
                    }
                    add_simple_tag('3 MAP');
                    add_simple_tag('4 LATI');
                    add_simple_tag('4 LONG');
                    break;
                case 'FILE':
                    add_simple_tag('3 FORM');
                    break;
                case 'EVEN':
                    add_simple_tag('3 DATE');
                    add_simple_tag('3 PLAC');
                    break;
                case 'STAT':
                    if (WT_Gedcom_Code_Temp::isTagLDS($level1tag)) {
                        add_simple_tag('3 DATE', '', WT_Gedcom_Tag::getLabel('STAT:DATE'));
                    }
                    break;
                case 'DATE':
                    if (in_array($level1tag, $date_and_time)) {
                        add_simple_tag('3 TIME');
                    }
                    // TIME is NOT a valid 5.5.1 tag
                    break;
                case 'HUSB':
                case 'WIFE':
                    add_simple_tag('3 AGE');
                    break;
                case 'FAMC':
                    if ($level1tag == 'ADOP') {
                        add_simple_tag('3 ADOP BOTH');
                    }
                    break;
            }
        } elseif ($key == 'DATE' && $add_date) {
            add_simple_tag('2 DATE', $level1tag, WT_Gedcom_Tag::getLabel("{$level1tag}:DATE"));
        }
    }
    // Do something (anything!) with unrecognized custom tags
    if (substr($level1tag, 0, 1) == '_' && $level1tag != '_UID' && $level1tag != '_TODO') {
        foreach (array('DATE', 'PLAC', 'ADDR', 'AGNC', 'TYPE', 'AGE') as $tag) {
            if (!in_array($tag, $tags)) {
                add_simple_tag("2 {$tag}");
                if ($tag == 'PLAC') {
                    if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $ADVANCED_PLAC_FACTS, $match)) {
                        foreach ($match[1] as $ptag) {
                            add_simple_tag("3 {$ptag}", '', WT_Gedcom_Tag::getLabel("{$level1tag}:PLAC:{$ptag}"));
                        }
                    }
                    add_simple_tag('3 MAP');
                    add_simple_tag('4 LATI');
                    add_simple_tag('4 LONG');
                }
            }
        }
    }
}
예제 #10
0
    private static function media_3_find()
    {
        $controller = new WT_Controller_Simple();
        $filter = WT_Filter::get('filter');
        $multiple = WT_Filter::getBool('multiple');
        $controller->setPageTitle(WT_I18N::translate('Find an individual'))->pageHeader();
        echo '<script>';
        ?>

			function pasterow(id, name, gend, yob, age, bpl) {
				window.opener.opener.insertRowToTable(id, name, '', gend, '', yob, age, 'Y', '', bpl);
			}

			function pasteid(id, name, thumb) {
				if (thumb) {
					window.opener.paste_id(id, name, thumb);
					<?php 
        if (!$multiple) {
            echo "window.close();";
        }
        ?>
				} else {
					// GEDFact_assistant ========================
					if (window.opener.document.getElementById('addlinkQueue')) {
						window.opener.insertRowToTable(id, name);
						// Check if Indi, Fam or source ===================
						/*
						if (id.match("I")=="I") {
							var win01 = window.opener.window.open('edit_interface.php?action=addmedia_links&noteid=newnote&pid='+id, 'win01', edit_window_specs);
							if (window.focus) {win01.focus();}
						} else if (id.match("F")=="F") {
							// TODO --- alert('Opening Navigator with family id entered will come later');
						}
						*/
					}
					window.opener.paste_id(id);
					if (window.opener.pastename) {
						window.opener.pastename(name);
					}
					<?php 
        if (!$multiple) {
            echo "window.close();";
        }
        ?>
				}
			}
			function checknames(frm) {
				if (document.forms[0].subclick) {
					button = document.forms[0].subclick.value;
				} else {
					button = "";
				}
				if (frm.filter.value.length<2&button!="all") {
					alert("<?php 
        echo WT_I18N::translate('Please enter more than one character');
        ?>
");
					frm.filter.focus();
					return false;
				}
				if (button=="all") {
					frm.filter.value = "";
				}
				return true;
			}
		<?php 
        echo '</script>';
        echo "<div align=\"center\">";
        echo "<table class=\"list_table width90\" border=\"0\">";
        echo "<tr><td style=\"padding: 10px;\" valign=\"top\" class=\"facts_label03 width90\">";
        // start column for find text header
        echo $controller->getPageTitle();
        echo "</td>";
        echo "</tr>";
        echo "</table>";
        echo "<br>";
        echo '<button onclick="window.close();">', WT_I18N::translate('close'), '</button>';
        echo "<br>";
        $filter = trim($filter);
        $filter_array = explode(' ', preg_replace('/ {2,}/', ' ', $filter));
        echo "<table class=\"tabs_table width90\"><tr>";
        $myindilist = search_indis_names($filter_array, array(WT_GED_ID), 'AND');
        if ($myindilist) {
            echo "<td class=\"list_value_wrap\"><ul>";
            usort($myindilist, array('WT_GedcomRecord', 'compare'));
            foreach ($myindilist as $indi) {
                $nam = WT_Filter::escapeHtml($indi->getFullName());
                echo "<li><a href=\"#\" onclick=\"pasterow(\n\t\t\t\t\t'" . $indi->getXref() . "' ,\n\t\t\t\t\t'" . $nam . "' ,\n\t\t\t\t\t'" . $indi->getSex() . "' ,\n\t\t\t\t\t'" . $indi->getbirthyear() . "' ,\n\t\t\t\t\t'" . (1901 - $indi->getbirthyear()) . "' ,\n\t\t\t\t\t'" . $indi->getbirthplace() . "'); return false;\">\n\t\t\t\t\t<b>" . $indi->getFullName() . "</b>&nbsp;&nbsp;&nbsp;";
                $born = WT_Gedcom_Tag::getLabel('BIRT');
                echo "</span><br><span class=\"list_item\">", $born, " ", $indi->getbirthyear(), "&nbsp;&nbsp;&nbsp;", $indi->getbirthplace(), "</span></a></li>";
                echo "<hr>";
            }
            echo '</ul></td></tr><tr><td class="list_label">', WT_I18N::translate('Total individuals: %s', count($myindilist)), '</tr></td>';
        } else {
            echo "<td class=\"list_value_wrap\">";
            echo WT_I18N::translate('No results found.');
            echo "</td></tr>";
        }
        echo "</table>";
        echo '</div>';
    }
예제 #11
0
     $text = WT_I18N::translate('In this field you would enter the citation text for this source.  Examples of data may be a transcription of the text from the source, or a description of what was in the citation.');
     break;
 case 'TIME':
     $title = WT_Gedcom_Tag::getLabel('TIME');
     $text = WT_I18N::translate('Enter the time for this event in 24-hour format with leading zeroes. Midnight is 00:00. Examples: 04:50 13:00 20:30.');
     break;
 case 'URL':
     $title = WT_Gedcom_Tag::getLabel('URL');
     $text = WT_I18N::translate('Enter the URL address including the http://.<br><br>An example URL looks like this: <b>http://www.webtrees.net/</b>.  Leave this field blank if you do not want to include a URL.');
     break;
 case '_HEB':
     $title = WT_Gedcom_Tag::getLabel('_HEB');
     $text = WT_I18N::translate('In many cultures it is customary to have a traditional name spelled in the traditional characters and also a romanized version of the name as it would be spelled or pronounced in languages based on the Latin alphabet, such as English.<br><br>If you prefer to use the Latin alphabet to enter the name in the standard name fields, then you can use this field to enter the same name in the non-Latin alphabet such as Greek, Hebrew, Russian, Arabic, or Chinese.  Both versions of the name will appear in lists and charts.<br><br>Although this field is labeled “Hebrew”, it is not restricted to containing only Hebrew characters.');
     break;
 case '_PRIM':
     $title = WT_Gedcom_Tag::getLabel('_PRIM');
     $text = WT_I18N::translate('Use this field to signal that this media item is the highlighted or primary item for the individual it is attached to.  The highlighted image is the one that will be used on charts and on the individual’s page.');
     break;
     //////////////////////////////////////////////////////////////////////////////
     // This section contains an entry for every configuration item
     //////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////
 // This section contains an entry for every configuration item
 //////////////////////////////////////////////////////////////////////////////
 case 'ADVANCED_NAME_FACTS':
     $title = WT_I18N::translate('Advanced name facts');
     $text = WT_I18N::translate('This is a comma separated list of GEDCOM fact tags that will be shown on the add/edit name form.  If you use non-Latin alphabets such as Hebrew, Greek, Cyrillic, or Arabic, you may want to add tags such as _HEB, ROMN, FONE, etc. to allow you to store names in several different alphabets.');
     break;
 case 'ADVANCED_PLAC_FACTS':
     $title = WT_I18N::translate('Advanced place name facts');
     $text = WT_I18N::translate('This is a comma separated list of GEDCOM fact tags that will be shown when you add or edit place names.  If you use non-Latin alphabets such as Hebrew, Greek, Cyrillic, or Arabic, you may want to add tags such as _HEB, ROMN, FONE, etc. to allow you to store place names in several different alphabets.');
예제 #12
0
 private function getDescendantsHtml(WT_Individual $individual, WT_Family $parents = null)
 {
     // A person has many names.  Select the one that matches the searched surname
     $person_name = '';
     foreach ($individual->getAllNames() as $name) {
         list($surn1) = explode(",", $name['sort']);
         if (stripos($surn1, $this->surname) !== false || stripos($this->surname, $surn1) !== false || $this->soundex_std && WT_Soundex::compare(WT_Soundex::soundex_std($surn1), WT_Soundex::soundex_std($this->surname)) || $this->soundex_dm && WT_Soundex::compare(WT_Soundex::soundex_dm($surn1), WT_Soundex::soundex_dm($this->surname))) {
             $person_name = $name['full'];
             break;
         }
     }
     // No matching name?  Typically children with a different surname.  The tree stops here.
     if (!$person_name) {
         return '<li title="' . strip_tags($individual->getFullName()) . '">' . $individual->getSexImage() . '…</li>';
     }
     // Is this individual one of our ancestors?
     $sosa = array_search($individual, $this->ancestors, true);
     if ($sosa) {
         $sosa_class = 'search_hit';
         $sosa_html = ' <a class="details1 ' . $individual->getBoxStyle() . '" title="' . WT_I18N::translate('Sosa') . '" href="relationship.php?pid2=' . WT_USER_ROOT_ID . '&amp;pid1=' . $individual->getXref() . '">' . $sosa . '</a>' . self::sosaGeneration($sosa);
     } else {
         $sosa_class = '';
         $sosa_html = '';
     }
     // Generate HTML for this individual, and all their descendants
     $indi_html = $individual->getSexImage() . '<a class="' . $sosa_class . '" href="' . $individual->getHtmlUrl() . '">' . $person_name . '</a> ' . $individual->getLifeSpan() . $sosa_html;
     // If this is not a birth pedigree (e.g. an adoption), highlight it
     if ($parents) {
         $pedi = '';
         foreach ($individual->getFacts('FAMC') as $fact) {
             if ($fact->getTarget() === $parents) {
                 $pedi = $fact->getAttribute('PEDI');
                 break;
             }
         }
         if ($pedi && $pedi != 'birth') {
             $indi_html = '<span class="red">' . WT_Gedcom_Code_Pedi::getValue($pedi, $individual) . '</span> ' . $indi_html;
         }
     }
     // spouses and children
     $spouse_families = $individual->getSpouseFamilies();
     if ($spouse_families) {
         usort($spouse_families, array('WT_Family', 'compareMarrDate'));
         $fam_html = '';
         foreach ($spouse_families as $family) {
             $fam_html .= $indi_html;
             // Repeat the individual details for each spouse.
             $spouse = $family->getSpouse($individual);
             if ($spouse) {
                 $sosa = array_search($spouse, $this->ancestors, true);
                 if ($sosa) {
                     $sosa_class = 'search_hit';
                     $sosa_html = ' <a class="details1 ' . $spouse->getBoxStyle() . '" title="' . WT_I18N::translate('Sosa') . '" href="relationship.php?pid2=' . WT_USER_ROOT_ID . '&amp;pid1=' . $spouse->getXref() . '"> ' . $sosa . ' </a>' . self::sosaGeneration($sosa);
                 } else {
                     $sosa_class = '';
                     $sosa_html = '';
                 }
                 $marriage_year = $family->getMarriageYear();
                 if ($marriage_year) {
                     $fam_html .= ' <a href="' . $family->getHtmlUrl() . '" title="' . strip_tags($family->getMarriageDate()->Display()) . '"><i class="icon-rings"></i>' . $marriage_year . '</a>';
                 } elseif ($family->getFirstFact('MARR')) {
                     $fam_html .= ' <a href="' . $family->getHtmlUrl() . '" title="' . WT_Gedcom_Tag::getLabel('MARR') . '"><i class="icon-rings"></i></a>';
                 } elseif ($family->getFirstFact('_NMR')) {
                     $fam_html .= ' <a href="' . $family->getHtmlUrl() . '" title="' . WT_Gedcom_Tag::getLabel('_NMR') . '"><i class="icon-rings"></i></a>';
                 }
                 $fam_html .= ' ' . $spouse->getSexImage() . '<a class="' . $sosa_class . '" href="' . $spouse->getHtmlUrl() . '">' . $spouse->getFullName() . '</a> ' . $spouse->getLifeSpan() . ' ' . $sosa_html;
             }
             $fam_html .= '<ol>';
             foreach ($family->getChildren() as $child) {
                 $fam_html .= $this->getDescendantsHtml($child, $family);
             }
             $fam_html .= '</ol>';
         }
         return '<li>' . $fam_html . '</li>';
     } else {
         // No spouses - just show the individual
         return '<li>' . $indi_html . '</li>';
     }
 }
예제 #13
0
				id="censYear" name="censYear">
		</select>
		<input type="hidden" id="prevYear" name="prevYear" value="">
	</div>

	<div class="cens_sour_scs">
		<div class="cens_sour_1">
			<div class="cens_sour_2"><?php 
echo WT_I18N::translate('Title');
?>
</div>
			<input id="Titl" name="Titl" type="text" value="">
		</div>
		<div class="cens_sour_1">
			<div class="cens_sour_2"><?php 
echo WT_Gedcom_Tag::getLabel('PAGE');
?>
</div>
			<input id="citation" name="citation" type="text" value="">
		</div>
		<div class="cens_sour_1">
			<div class="cens_sour_2"><?php 
echo WT_I18N::translate('Place');
?>
</div>
			<input id="locality" name="locality" type="text" value="">
		</div>
		<div class="cens_sour_1">
			<div class="cens_sour_2"><?php 
echo WT_I18N::translate('Notes');
?>
예제 #14
0
echo '>', WT_Gedcom_Tag::getLabel('DEAT'), '</option>';
echo '<option value="BURI"';
if ($filterev == "BURI") {
    echo ' selected="selected"';
}
echo '>', WT_Gedcom_Tag::getLabel('BURI'), '</option>';
echo '<option value="IMMI"';
if ($filterev == "IMMI") {
    echo ' selected="selected"';
}
echo '>', WT_Gedcom_Tag::getLabel('IMMI'), '</option>';
echo '<option value="EMIG"';
if ($filterev == "EMIG") {
    echo ' selected="selected"';
}
echo '>', WT_Gedcom_Tag::getLabel('EMIG'), '</option>';
echo '<option value="EVEN"';
if ($filterev == "EVEN") {
    echo ' selected="selected"';
}
echo '>', WT_I18N::translate('Custom event'), '</option>';
echo '</select>';
echo '</td></tr>';
echo '</table></form>';
echo "<table class=\"width100\">";
// Day/Month/Year and calendar selector
echo '<tr><td class="topbottombar width50">';
if ($action == 'today') {
    echo '<span class="error">', WT_I18N::translate('View day'), '</span>';
} else {
    echo "<a href=\"calendar.php?cal={$cal}&amp;day={$cal_date->d}&amp;month={$cal_month}&amp;year={$cal_date->y}&amp;filterev={$filterev}&amp;filterof={$filterof}&amp;filtersx={$filtersx}&amp;action=today\">", WT_I18N::translate('View day'), "</a>";
예제 #15
0
    public function getBlock($block_id, $template = true, $cfg = null)
    {
        global $ctype, $controller;
        $days = get_block_setting($block_id, 'days', 7);
        $infoStyle = get_block_setting($block_id, 'infoStyle', 'table');
        $calendar = get_block_setting($block_id, 'calendar', 'jewish');
        $block = get_block_setting($block_id, 'block', true);
        if ($cfg) {
            foreach (array('days', 'infoStyle', 'block') as $name) {
                if (array_key_exists($name, $cfg)) {
                    ${$name} = $cfg[$name];
                }
            }
        }
        $startjd = WT_CLIENT_JD;
        $endjd = WT_CLIENT_JD + $days - 1;
        $id = $this->getName() . $block_id;
        $class = $this->getName() . '_block';
        if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && WT_USER_ID) {
            $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>';
        } else {
            $title = '';
        }
        $title .= $this->getTitle();
        $content = '';
        // The standard anniversary rules cover most of the Yahrzeit rules, we just
        // need to handle a few special cases.
        // Fetch normal anniversaries...
        $yahrzeits = array();
        for ($jd = $startjd - 1; $jd <= $endjd + $days; ++$jd) {
            foreach (get_anniversary_events($jd, 'DEAT _YART') as $fact) {
                // Exact hebrew dates only
                $date = $fact->getDate();
                if ($date->MinDate() instanceof WT_Date_Jewish && $date->MinJD() == $date->MaxJD()) {
                    $fact->jd = $jd;
                    $yahrzeits[] = $fact;
                }
            }
        }
        // ...then adjust dates
        $jewish_calendar = new JewishCalendar();
        foreach ($yahrzeits as $yahrzeit) {
            if ($yahrzeit->getTag() == 'DEAT') {
                // Just DEAT, not _YART
                $today = new WT_Date_Jewish($yahrzeit->jd);
                $hd = $yahrzeit->getDate()->MinDate();
                $hd1 = new WT_Date_Jewish($hd);
                $hd1->y += 1;
                $hd1->setJdFromYmd();
                // Special rules.  See http://www.hebcal.com/help/anniv.html
                // Everything else is taken care of by our standard anniversary rules.
                if ($hd->d == 30 && $hd->m == 2 && $hd->y != 0 && $hd1->daysInMonth() < 30) {
                    // 30 CSH
                    // Last day in CSH
                    $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 3, 1) - 1;
                } elseif ($hd->d == 30 && $hd->m == 3 && $hd->y != 0 && $hd1->daysInMonth() < 30) {
                    // 30 KSL
                    // Last day in KSL
                    $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 4, 1) - 1;
                } elseif ($hd->d == 30 && $hd->m == 6 && $hd->y != 0 && $today->daysInMonth() < 30 && !$today->isLeapYear()) {
                    // 30 ADR
                    // Last day in SHV
                    $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 6, 1) - 1;
                }
            }
        }
        switch ($infoStyle) {
            case 'list':
                foreach ($yahrzeits as $yahrzeit) {
                    if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) {
                        $ind = $yahrzeit->getParent();
                        $content .= "<a href=\"" . $ind->getHtmlUrl() . "\" class=\"list_item name2\">" . $ind->getFullName() . "</a>" . $ind->getSexImage();
                        $content .= "<div class=\"indent\">";
                        $content .= $yahrzeit->getDate()->Display(true);
                        $content .= ', ' . WT_I18N::translate('%s year anniversary', $yahrzeit->anniv);
                        $content .= "</div>";
                    }
                }
                break;
            case 'table':
            default:
                $table_id = Uuid::uuid4();
                // table requires a unique ID
                $controller->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript('
					jQuery("#' . $table_id . '").dataTable({
						dom: \'t\',
						' . WT_I18N::datatablesI18N() . ',
						autoWidth: false,
						paginate: false,
						lengthChange: false,
						filter: false,
						info: true,
						jQueryUI: true,
						sorting: [[5,"asc"]],
						columns: [
							/* 0-name */ { dataSort: 1 },
							/* 1-NAME */ { visible: false },
							/* 2-date */ { dataSort: 3 },
							/* 3-DATE */ { visible: false },
							/* 4-Aniv */ { class: "center"},
							/* 5-yart */ { dataSort: 6 },
							/* 6-YART */ { visible: false }
						]
					});
					jQuery("#' . $table_id . '").css("visibility", "visible");
					jQuery(".loading-image").css("display", "none");
				');
                $content = '';
                $content .= '<div class="loading-image">&nbsp;</div>';
                $content .= '<table id="' . $table_id . '" class="width100" style="visibility:hidden;">';
                $content .= '<thead><tr>';
                $content .= '<th>' . WT_Gedcom_Tag::getLabel('NAME') . '</th>';
                $content .= '<th>' . WT_Gedcom_Tag::getLabel('NAME') . '</th>';
                $content .= '<th>' . WT_Gedcom_Tag::getLabel('DEAT') . '</th>';
                $content .= '<th>DEAT</th>';
                $content .= '<th><i class="icon-reminder" title="' . WT_I18N::translate('Anniversary') . '"></i></th>';
                $content .= '<th>' . WT_Gedcom_Tag::getLabel('_YART') . '</th>';
                $content .= '<th>_YART</th>';
                $content .= '</tr></thead><tbody>';
                foreach ($yahrzeits as $yahrzeit) {
                    if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) {
                        $content .= '<tr>';
                        $ind = $yahrzeit->getParent();
                        // Individual name(s)
                        $name = $ind->getFullName();
                        $url = $ind->getHtmlUrl();
                        $content .= '<td>';
                        $content .= '<a href="' . $url . '">' . $name . '</a>';
                        $content .= $ind->getSexImage();
                        $addname = $ind->getAddName();
                        if ($addname) {
                            $content .= '<br><a href="' . $url . '">' . $addname . '</a>';
                        }
                        $content .= '</td>';
                        $content .= '<td>' . $ind->getSortName() . '</td>';
                        // death/yahrzeit event date
                        $content .= '<td>' . $yahrzeit->getDate()->Display() . '</td>';
                        $content .= '<td>' . $yahrzeit->getDate()->minJD() . '</td>';
                        // sortable date
                        // Anniversary
                        $content .= '<td>' . $yahrzeit->anniv . '</td>';
                        // upcomming yahrzeit dates
                        switch ($calendar) {
                            case 'gregorian':
                                $today = new WT_Date_Gregorian($yahrzeit->jd);
                                break;
                            case 'jewish':
                            default:
                                $today = new WT_Date_Jewish($yahrzeit->jd);
                                break;
                        }
                        $td = new WT_Date($today->format('%@ %A %O %E'));
                        $content .= '<td>' . $td->Display() . '</td>';
                        $content .= '<td>' . $td->minJD() . '</td>';
                        // sortable date
                        $content .= '</tr>';
                    }
                }
                $content .= '</tbody></table>';
                break;
        }
        if ($template) {
            if ($block) {
                require WT_THEME_DIR . 'templates/block_small_temp.php';
            } else {
                require WT_THEME_DIR . 'templates/block_main_temp.php';
            }
        } else {
            return $content;
        }
    }
예제 #16
0
    public function configureBlock($block_id)
    {
        if (WT_Filter::postBool('save') && WT_Filter::checkCsrf()) {
            set_block_setting($block_id, 'filter', WT_Filter::post('filter', 'indi|event|all', 'all'));
            set_block_setting($block_id, 'controls', WT_Filter::postBool('controls'));
            set_block_setting($block_id, 'start', WT_Filter::postBool('start'));
            set_block_setting($block_id, 'filter_avi', WT_Filter::postBool('filter_avi'));
            set_block_setting($block_id, 'filter_bmp', WT_Filter::postBool('filter_bmp'));
            set_block_setting($block_id, 'filter_gif', WT_Filter::postBool('filter_gif'));
            set_block_setting($block_id, 'filter_jpeg', WT_Filter::postBool('filter_jpeg'));
            set_block_setting($block_id, 'filter_mp3', WT_Filter::postBool('filter_mp3'));
            set_block_setting($block_id, 'filter_ole', WT_Filter::postBool('filter_ole'));
            set_block_setting($block_id, 'filter_pcx', WT_Filter::postBool('filter_pcx'));
            set_block_setting($block_id, 'filter_pdf', WT_Filter::postBool('filter_pdf'));
            set_block_setting($block_id, 'filter_png', WT_Filter::postBool('filter_png'));
            set_block_setting($block_id, 'filter_tiff', WT_Filter::postBool('filter_tiff'));
            set_block_setting($block_id, 'filter_wav', WT_Filter::postBool('filter_wav'));
            set_block_setting($block_id, 'filter_audio', WT_Filter::postBool('filter_audio'));
            set_block_setting($block_id, 'filter_book', WT_Filter::postBool('filter_book'));
            set_block_setting($block_id, 'filter_card', WT_Filter::postBool('filter_card'));
            set_block_setting($block_id, 'filter_certificate', WT_Filter::postBool('filter_certificate'));
            set_block_setting($block_id, 'filter_coat', WT_Filter::postBool('filter_coat'));
            set_block_setting($block_id, 'filter_document', WT_Filter::postBool('filter_document'));
            set_block_setting($block_id, 'filter_electronic', WT_Filter::postBool('filter_electronic'));
            set_block_setting($block_id, 'filter_fiche', WT_Filter::postBool('filter_fiche'));
            set_block_setting($block_id, 'filter_film', WT_Filter::postBool('filter_film'));
            set_block_setting($block_id, 'filter_magazine', WT_Filter::postBool('filter_magazine'));
            set_block_setting($block_id, 'filter_manuscript', WT_Filter::postBool('filter_manuscript'));
            set_block_setting($block_id, 'filter_map', WT_Filter::postBool('filter_map'));
            set_block_setting($block_id, 'filter_newspaper', WT_Filter::postBool('filter_newspaper'));
            set_block_setting($block_id, 'filter_other', WT_Filter::postBool('filter_other'));
            set_block_setting($block_id, 'filter_painting', WT_Filter::postBool('filter_painting'));
            set_block_setting($block_id, 'filter_photo', WT_Filter::postBool('filter_photo'));
            set_block_setting($block_id, 'filter_tombstone', WT_Filter::postBool('filter_tombstone'));
            set_block_setting($block_id, 'filter_video', WT_Filter::postBool('filter_video'));
            exit;
        }
        require_once WT_ROOT . 'includes/functions/functions_edit.php';
        $filter = get_block_setting($block_id, 'filter', 'all');
        echo '<tr><td class="descriptionbox wrap width33">';
        echo WT_I18N::translate('Show only individuals, events, or all?');
        echo '</td><td class="optionbox">';
        echo select_edit_control('filter', array('indi' => WT_I18N::translate('Individuals'), 'event' => WT_I18N::translate('Facts and events'), 'all' => WT_I18N::translate('All')), null, $filter, '');
        echo '</td></tr>';
        $filters = array('avi' => get_block_setting($block_id, 'filter_avi', false), 'bmp' => get_block_setting($block_id, 'filter_bmp', true), 'gif' => get_block_setting($block_id, 'filter_gif', true), 'jpeg' => get_block_setting($block_id, 'filter_jpeg', true), 'mp3' => get_block_setting($block_id, 'filter_mp3', false), 'ole' => get_block_setting($block_id, 'filter_ole', true), 'pcx' => get_block_setting($block_id, 'filter_pcx', true), 'pdf' => get_block_setting($block_id, 'filter_pdf', false), 'png' => get_block_setting($block_id, 'filter_png', true), 'tiff' => get_block_setting($block_id, 'filter_tiff', true), 'wav' => get_block_setting($block_id, 'filter_wav', false), 'audio' => get_block_setting($block_id, 'filter_audio', false), 'book' => get_block_setting($block_id, 'filter_book', true), 'card' => get_block_setting($block_id, 'filter_card', true), 'certificate' => get_block_setting($block_id, 'filter_certificate', true), 'coat' => get_block_setting($block_id, 'filter_coat', true), 'document' => get_block_setting($block_id, 'filter_document', true), 'electronic' => get_block_setting($block_id, 'filter_electronic', true), 'fiche' => get_block_setting($block_id, 'filter_fiche', true), 'film' => get_block_setting($block_id, 'filter_film', true), 'magazine' => get_block_setting($block_id, 'filter_magazine', true), 'manuscript' => get_block_setting($block_id, 'filter_manuscript', true), 'map' => get_block_setting($block_id, 'filter_map', true), 'newspaper' => get_block_setting($block_id, 'filter_newspaper', true), 'other' => get_block_setting($block_id, 'filter_other', true), 'painting' => get_block_setting($block_id, 'filter_painting', true), 'photo' => get_block_setting($block_id, 'filter_photo', true), 'tombstone' => get_block_setting($block_id, 'filter_tombstone', true), 'video' => get_block_setting($block_id, 'filter_video', false));
        echo '<tr><td class="descriptionbox wrap width33">';
        echo WT_I18N::translate('Filter');
        ?>
	</td>
		<td class="optionbox">
			<center><b><?php 
        echo WT_Gedcom_Tag::getLabel('FORM');
        ?>
</b></center>
			<table class="width100">
				<tr>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_avi"
				<?php 
        if ($filters['avi']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;avi&nbsp;&nbsp;</td>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_bmp"
				<?php 
        if ($filters['bmp']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;bmp&nbsp;&nbsp;</td>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_gif"
				<?php 
        if ($filters['gif']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;gif&nbsp;&nbsp;</td>
				</tr>
		<tr>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_jpeg"
				<?php 
        if ($filters['jpeg']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;jpeg&nbsp;&nbsp;</td>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_mp3"
				<?php 
        if ($filters['mp3']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;mp3&nbsp;&nbsp;</td>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_ole"
				<?php 
        if ($filters['ole']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;ole&nbsp;&nbsp;</td>
		</tr>
		<tr>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_pcx"
				<?php 
        if ($filters['pcx']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;pcx&nbsp;&nbsp;</td>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_pdf"
				<?php 
        if ($filters['pdf']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;pdf&nbsp;&nbsp;</td>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_png"
				<?php 
        if ($filters['png']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;png&nbsp;&nbsp;</td>
		</tr>
		<tr>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_tiff"
				<?php 
        if ($filters['tiff']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;tiff&nbsp;&nbsp;</td>
			<td class="width33"><input type="checkbox" value="yes"
				name="filter_wav"
				<?php 
        if ($filters['wav']) {
            echo " checked=\"checked\"";
        }
        ?>
>&nbsp;&nbsp;wav&nbsp;&nbsp;</td>
					<td class="width33">&nbsp;</td>
					<td class="width33">&nbsp;</td>
				</tr>
			</table>
			<br>
			<center><b><?php 
        echo WT_Gedcom_Tag::getLabel('TYPE');
        ?>
</b></center>
			<table class="width100">
				<tr>
				<?php 
        //-- Build the list of checkboxes
        $i = 0;
        foreach (WT_Gedcom_Tag::getFileFormTypes() as $typeName => $typeValue) {
            $i++;
            if ($i > 3) {
                $i = 1;
                echo "</tr><tr>";
            }
            echo "<td class=\"width33\"><input type=\"checkbox\" value=\"yes\" name=\"filter_" . $typeName . "\"";
            if ($filters[$typeName]) {
                echo " checked=\"checked\"";
            }
            echo ">&nbsp;&nbsp;" . $typeValue . "&nbsp;&nbsp;</td>";
        }
        ?>
				</tr>
			</table>
	</td>
	</tr>

	<?php 
        $controls = get_block_setting($block_id, 'controls', true);
        echo '<tr><td class="descriptionbox wrap width33">';
        echo WT_I18N::translate('Show slide show controls?');
        echo '</td><td class="optionbox">';
        echo edit_field_yes_no('controls', $controls);
        echo '</td></tr>';
        $start = get_block_setting($block_id, 'start', false);
        echo '<tr><td class="descriptionbox wrap width33">';
        echo WT_I18N::translate('Start slide show on page load?');
        echo '</td><td class="optionbox">';
        echo edit_field_yes_no('start', $start);
        echo '</td></tr>';
    }
예제 #17
0
							<th class="topbottombar" width="20"  style="font-weight:100;" align="left"><?php 
    echo WT_I18N::translate('Navigator');
    ?>
</th>
						</tr>
					</thead>
					<tbody>
					</tbody>
				</table>
			</td>
		</tr>
		<?php 
    // Admin Option CHAN log update override =======================
    if (Auth::isAdmin()) {
        echo "<tr><td class=\"descriptionbox wrap width25\">";
        echo WT_Gedcom_Tag::getLabel('CHAN'), "</td><td class=\"optionbox wrap\">";
        if ($NO_UPDATE_CHAN) {
            echo "<input type=\"checkbox\" checked=\"checked\" name=\"preserve_last_changed\">";
        } else {
            echo "<input type=\"checkbox\" name=\"preserve_last_changed\">";
        }
        echo WT_I18N::translate('Do not update the “last change” record'), help_link('no_update_CHAN');
        echo "</td></tr>";
    }
    ?>
	</table>
	<input type="hidden" name="more_links" value="No_Values">
	<input type="hidden" name="exist_links" value="No_Values">
	<p id="save-cancel">
		<input type="submit" class="save" value="<?php 
    echo WT_I18N::translate('save');
예제 #18
0
파일: Base.php 프로젝트: brambravo/webtrees
/**
 * Variable lookup
 *
 * Retrieve predefined variables :
 * @ desc GEDCOM fact description, example:
 *        1 EVEN This is a description
 * @ fact GEDCOM fact tag, such as BIRT, DEAT etc.
 * $ WT_I18N::translate('....')
 * $ language_settings[]
 *
 *
 * Or retrieve variables preset with <SetVar> element
 *
 * If the variable is a date and 'date="1"' attribute is set then the date will be reformated
 * from Sep to September
 *
 * @param array $attrs an array of key value pairs for the attributes
 *
 * @see SetVarSHandler()
 */
function varSHandler($attrs)
{
    // @deprecated
    global $currentElement, $type, $parser;
    // Retrievable variables
    global $desc, $fact, $language_settings, $vars;
    if (empty($attrs['var'])) {
        die("<strong>REPORT ERROR var: </strong> The attribute \"var=\" is missing or not set in the XML file on line: " . xml_get_current_line_number($parser));
    }
    $var = $attrs['var'];
    // SetVar element preset variables
    if (!empty($vars[$var]['id'])) {
        $var = $vars[$var]['id'];
    } else {
        $tfact = $fact;
        if (($fact == "EVEN" || $fact == "FACT") && is_string($type) && $type != " ") {
            // Use :
            // n TYPE This text if string
            $tfact = $type;
        }
        $var = str_replace(array("@fact", "@desc"), array(WT_Gedcom_Tag::getLabel($tfact), $desc), $var);
        if (substr($var, 0, 18) == 'WT_I18N::translate' || substr($var, 0, 15) == 'WT_I18N::number') {
            eval("\$var={$var};");
        }
    }
    // Check if variable is set as a date and reformat the date
    if (isset($attrs['date'])) {
        if ($attrs['date'] === "1") {
            $g = new WT_Date($var);
            $var = $g->Display();
        }
    }
    $currentElement->addText($var);
}
예제 #19
0
function print_events_table($startjd, $endjd, $events = 'BIRT MARR DEAT', $only_living = false, $sort_by = 'anniv')
{
    global $controller;
    $html = '';
    $table_id = 'table-even-' . Uuid::uuid4();
    // lists requires a unique ID in case there are multiple lists per page
    $controller->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript('
			jQuery("#' . $table_id . '").dataTable({
				dom: \'t\',
				' . WT_I18N::datatablesI18N() . ',
				autoWidth: false,
				paging: false,
				lengthChange: false,
				filter: false,
				info: true,
				jQueryUI: true,
				sorting: [[ ' . ($sort_by == 'alpha' ? 1 : 3) . ', "asc"]],
				columns: [
					/* 0-Record */ { dataSort: 1 },
					/* 1-NAME */   { visible: false },
					/* 2-Date */   { dataSort: 3 },
					/* 3-DATE */   { visible: false },
					/* 4-Anniv. */ { dataSort: 5, class: "center" },
					/* 5-ANNIV  */ { type: "num", visible: false },
					/* 6-Event */  { class: "center" }
				]
			});
		');
    // Did we have any output?  Did we skip anything?
    $output = 0;
    $filter = 0;
    $filtered_events = array();
    foreach (get_events_list($startjd, $endjd, $events) as $fact) {
        $record = $fact->getParent();
        //-- only living people ?
        if ($only_living) {
            if ($record instanceof WT_Individual && $record->isDead()) {
                $filter++;
                continue;
            }
            if ($record instanceof WT_Family) {
                $husb = $record->getHusband();
                if (is_null($husb) || $husb->isDead()) {
                    $filter++;
                    continue;
                }
                $wife = $record->getWife();
                if (is_null($wife) || $wife->isDead()) {
                    $filter++;
                    continue;
                }
            }
        }
        //-- Counter
        $output++;
        if ($output == 1) {
            //-- table body
            $html .= '<table id="' . $table_id . '" class="width100">';
            $html .= '<thead><tr>';
            $html .= '<th>' . WT_I18N::translate('Record') . '</th>';
            $html .= '<th>NAME</th>';
            //hidden by datatables code
            $html .= '<th>' . WT_Gedcom_Tag::getLabel('DATE') . '</th>';
            $html .= '<th>DATE</th>';
            //hidden by datatables code
            $html .= '<th><i class="icon-reminder" title="' . WT_I18N::translate('Anniversary') . '"></i></th>';
            $html .= '<th>ANNIV</th>';
            $html .= '<th>' . WT_Gedcom_Tag::getLabel('EVEN') . '</th>';
            $html .= '</tr></thead><tbody>';
        }
        $filtered_events[] = $fact;
    }
    foreach ($filtered_events as $n => $fact) {
        $record = $fact->getParent();
        $html .= '<tr>';
        $html .= '<td>';
        $html .= '<a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a>';
        if ($record instanceof WT_Individual) {
            $html .= $record->getSexImage();
        }
        $html .= '</td>';
        $html .= '<td>' . $record->getSortName() . '</td>';
        $html .= '<td>' . $fact->getDate()->Display(empty($SEARCH_SPIDER)) . '</td>';
        $html .= '<td>' . $n . '</td>';
        $html .= '<td>' . WT_I18N::number($fact->anniv) . '</td>';
        $html .= '<td>' . $fact->anniv . '</td>';
        $html .= '<td>' . $fact->getLabel() . '</td>';
        $html .= '</tr>';
    }
    if ($output != 0) {
        $html .= '</tbody></table>';
    }
    // Print a final summary message about restricted/filtered facts
    $summary = '';
    if ($endjd == WT_CLIENT_JD) {
        // We're dealing with the Today’s Events block
        if ($output == 0) {
            if ($filter == 0) {
                $summary = WT_I18N::translate('No events exist for today.');
            } else {
                $summary = WT_I18N::translate('No events for living individuals exist for today.');
            }
        }
    } else {
        // We're dealing with the Upcoming Events block
        if ($output == 0) {
            if ($filter == 0) {
                if ($endjd == $startjd) {
                    $summary = WT_I18N::translate('No events exist for tomorrow.');
                } else {
                    // I18N: translation for %s==1 is unused; it is translated separately as “tomorrow”
                    $summary = WT_I18N::plural('No events exist for the next %s day.', 'No events exist for the next %s days.', $endjd - $startjd + 1, WT_I18N::number($endjd - $startjd + 1));
                }
            } else {
                if ($endjd == $startjd) {
                    $summary = WT_I18N::translate('No events for living individuals exist for tomorrow.');
                } else {
                    // I18N: translation for %s==1 is unused; it is translated separately as “tomorrow”
                    $summary = WT_I18N::plural('No events for living people exist for the next %s day.', 'No events for living people exist for the next %s days.', $endjd - $startjd + 1, WT_I18N::number($endjd - $startjd + 1));
                }
            }
        }
    }
    if ($summary != "") {
        $html .= '<strong>' . $summary . '</strong>';
    }
    return $html;
}
예제 #20
0
 private static function getAbbreviation($tag)
 {
     switch ($tag) {
         case 'BIRT':
             return WT_I18N::translate_c('Abbreviation for birth', 'b.');
         case 'MARR':
             return WT_I18N::translate_c('Abbreviation for marriage', 'm.');
         case 'DEAT':
             return WT_I18N::translate_c('Abbreviation for death', 'd.');
         default:
             return mb_substr(WT_Gedcom_Tag::getLabel($tag), 0, 1);
             // Just use the first letter of the full fact
     }
 }
예제 #21
0
        }
        ?>
><?php 
        echo WT_I18N::translate('Sounds like');
        ?>
</option>
							</select>
						</td>
						<?php 
        $j++;
        ?>
					</tr>
					<tr>
						<td class="list_label">
							<?php 
        echo WT_Gedcom_Tag::getLabel('SURN');
        ?>
						</td>
						<td class="list_value">
							<input type="text" name="values[<?php 
        echo $j;
        ?>
]" value="<?php 
        echo $controller->getValue($controller->getIndex('FAMC:WIFE:NAME:SURN:' . $motherSurnOption));
        ?>
">
							<select name="fields[<?php 
        echo $j;
        ?>
]">
								<option value="FAMC:WIFE:NAME:SURN:EXACT"<?php 
예제 #22
0
    public function getTabContent()
    {
        global $SHOW_LEVEL2_NOTES, $controller;
        ob_start();
        echo '<table class="facts_table">';
        ?>
		<tr>
			<td colspan="2" class="descriptionbox rela">
				<input id="checkbox_sour2" type="checkbox" <?php 
        if ($SHOW_LEVEL2_NOTES) {
            echo " checked=\"checked\"";
        }
        ?>
 onclick="jQuery('tr.row_sour2').toggle();">
				<label for="checkbox_sour2"><?php 
        echo WT_I18N::translate('Show all sources'), help_link('show_fact_sources');
        ?>
</label>
			</td>
		</tr>
		<?php 
        foreach ($this->get_facts() as $fact) {
            if ($fact->getTag() == 'SOUR') {
                print_main_sources($fact, 1);
            } else {
                for ($i = 2; $i < 4; ++$i) {
                    print_main_sources($fact, $i);
                }
            }
        }
        if (!$this->get_facts()) {
            echo '<tr><td id="no_tab4" colspan="2" class="facts_value">', WT_I18N::translate('There are no source citations for this individual.'), '</td></tr>';
        }
        // New Source Link
        if ($controller->record->canEdit()) {
            ?>
			<tr>
				<td class="facts_label">
					<?php 
            echo WT_Gedcom_Tag::getLabel('SOUR');
            ?>
				</td>
				<td class="facts_value">
					<a href="#" onclick="add_new_record('<?php 
            echo $controller->record->getXref();
            ?>
','SOUR'); return false;">
						<?php 
            echo WT_I18N::translate('Add a new source citation');
            ?>
					</a>
					<?php 
            echo help_link('add_source');
            ?>
				</td>
			</tr>
			<?php 
        }
        ?>
		</table>
		<?php 
        if (!$SHOW_LEVEL2_NOTES) {
            echo '<script>jQuery("tr.row_sour2").toggle();</script>';
        }
        return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>';
    }
예제 #23
0
function media_file_info($media_folder, $media_path, $file)
{
    $html = '<b>' . WT_Filter::escapeHtml($file) . '</b>';
    $full_path = WT_DATA_DIR . $media_folder . $media_path . $file;
    if ($file && file_exists($full_path)) {
        $size = @filesize($full_path);
        if ($size !== false) {
            $size = (int) (($size + 1023) / 1024);
            // Round up to next KB
            $size = WT_I18N::translate('%s KB', WT_I18N::number($size));
            $html .= WT_Gedcom_Tag::getLabelValue('__FILE_SIZE__', $size);
            $imgsize = @getimagesize($full_path);
            if (is_array($imgsize)) {
                $imgsize = WT_I18N::translate('%1$s × %2$s pixels', WT_I18N::number($imgsize['0']), WT_I18N::number($imgsize['1']));
                $html .= WT_Gedcom_Tag::getLabelValue('__IMAGE_SIZE__', $imgsize);
            }
        } else {
            $html .= '<div class="error">' . WT_I18N::translate('This media file exists, but cannot be accessed.') . '</div>';
        }
    } else {
        $html .= '<div class="error">' . WT_I18N::translate('This media file does not exist.') . '</div>';
    }
    return $html;
}
예제 #24
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>';
    }
예제 #25
0
파일: repo.php 프로젝트: jacoline/webtrees
// Sort the facts
usort($facts, function (WT_Fact $x, WT_Fact $y) {
    static $order = array('NAME' => 0, 'ADDR' => 1, 'NOTE' => 2, 'WWW' => 3, 'REFN' => 4, 'RIN' => 5, '_UID' => 6, 'CHAN' => 7);
    return (array_key_exists($x->getTag(), $order) ? $order[$x->getTag()] : PHP_INT_MAX) - (array_key_exists($y->getTag(), $order) ? $order[$y->getTag()] : PHP_INT_MAX);
});
// Print the facts
foreach ($facts as $fact) {
    print_fact($fact, $controller->record);
}
// new fact link
if ($controller->record->canEdit()) {
    print_add_new_fact($controller->record->getXref(), $facts, 'REPO');
    // new media
    if (get_gedcom_setting(WT_GED_ID, 'MEDIA_UPLOAD') >= WT_USER_ACCESS_LEVEL) {
        echo '<tr><td class="descriptionbox">';
        echo WT_Gedcom_Tag::getLabel('OBJE');
        echo '</td><td class="optionbox">';
        echo '<a href="#" onclick="window.open(\'addmedia.php?action=showmediaform&amp;linktoid=', $controller->record->getXref(), '\', \'_blank\', edit_window_specs); return false;">', WT_I18N::translate('Add a new media object'), '</a>';
        echo help_link('OBJE');
        echo '<br>';
        echo '<a href="#" onclick="window.open(\'inverselink.php?linktoid=', $controller->record->getXref(), '&amp;linkto=repository\', \'_blank\', find_window_specs); return false;">', WT_I18N::translate('Link to an existing media object'), '</a>';
        echo '</td></tr>';
    }
}
echo '</table>
	</div>';
// Sources linked to this repository
if ($linked_sour) {
    echo '<div id="source-repo">';
    echo format_sour_table($linked_sour);
    echo '</div>';
예제 #26
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 
    }
예제 #27
0
    public function getTabContent()
    {
        global $controller;
        ob_start();
        echo '<table class="facts_table">';
        foreach ($this->get_facts() as $fact) {
            if ($fact->getTag() == 'OBJE') {
                print_main_media($fact, 1);
            } else {
                for ($i = 2; $i < 4; ++$i) {
                    print_main_media($fact, $i);
                }
            }
        }
        if (!$this->get_facts()) {
            echo '<tr><td id="no_tab4" colspan="2" class="facts_value">', WT_I18N::translate('There are no media objects for this individual.'), '</td></tr>';
        }
        // New media link
        if ($controller->record->canEdit() && get_gedcom_setting(WT_GED_ID, 'MEDIA_UPLOAD') >= WT_USER_ACCESS_LEVEL) {
            ?>
			<tr>
				<td class="facts_label">
					<?php 
            echo WT_Gedcom_Tag::getLabel('OBJE');
            ?>
				</td>
				<td class="facts_value">
					<a href="#" onclick="window.open('addmedia.php?action=showmediaform&amp;linktoid=<?php 
            echo $controller->record->getXref();
            ?>
&amp;ged=<?php 
            echo WT_GEDURL;
            ?>
', '_blank', edit_window_specs); return false;">
						<?php 
            echo WT_I18N::translate('Add a new media object');
            ?>
					</a>
					<?php 
            echo help_link('OBJE');
            ?>
					<br>
					<a href="#" onclick="window.open('inverselink.php?linktoid=<?php 
            echo $controller->record->getXref();
            ?>
&amp;ged=<?php 
            echo WT_GEDURL;
            ?>
&amp;linkto=person', '_blank', find_window_specs); return false;">
						<?php 
            echo WT_I18N::translate('Link to an existing media object');
            ?>
					</a>
				</td>
			</tr>
			<?php 
        }
        ?>
		</table>
		<?php 
        return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>';
    }
예제 #28
0
/**
 * Print a new fact box on details pages
 *
 * @param string $id        the id of the person, family, source etc the fact will be added to
 * @param array  $usedfacts an array of facts already used in this record
 * @param string $type      the type of record INDI, FAM, SOUR etc
 */
function print_add_new_fact($id, $usedfacts, $type)
{
    global $WT_SESSION;
    // -- Add from clipboard
    if ($WT_SESSION->clipboard) {
        $newRow = true;
        foreach (array_reverse($WT_SESSION->clipboard, true) as $fact_id => $fact) {
            if ($fact["type"] == $type || $fact["type"] == 'all') {
                if ($newRow) {
                    $newRow = false;
                    echo '<tr><td class="descriptionbox">';
                    echo WT_I18N::translate('Add from clipboard'), '</td>';
                    echo '<td class="optionbox wrap"><form method="get" name="newFromClipboard" action="?" onsubmit="return false;">';
                    echo '<select id="newClipboardFact">';
                }
                echo '<option value="', WT_Filter::escapeHtml($fact_id), '">', WT_Gedcom_Tag::getLabel($fact['fact']);
                // TODO use the event class to store/parse the clipboard events
                if (preg_match('/^2 DATE (.+)/m', $fact['factrec'], $match)) {
                    $tmp = new WT_Date($match[1]);
                    echo '; ', $tmp->minDate()->format('%Y');
                }
                if (preg_match('/^2 PLAC ([^,\\n]+)/m', $fact['factrec'], $match)) {
                    echo '; ', $match[1];
                }
                echo '</option>';
            }
        }
        if (!$newRow) {
            echo '</select>';
            echo '&nbsp;&nbsp;<input type="button" value="', WT_I18N::translate('Add'), "\" onclick=\"return paste_fact('{$id}', '#newClipboardFact');\"> ";
            echo '</form></td></tr>', "\n";
        }
    }
    // -- Add from pick list
    switch ($type) {
        case "INDI":
            $addfacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'INDI_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
            $uniquefacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'INDI_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
            $quickfacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'INDI_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
            break;
        case "FAM":
            $addfacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'FAM_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
            $uniquefacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'FAM_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
            $quickfacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'FAM_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
            break;
        case "SOUR":
            $addfacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'SOUR_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
            $uniquefacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'SOUR_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
            $quickfacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'SOUR_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
            break;
        case "NOTE":
            $addfacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'NOTE_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
            $uniquefacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'NOTE_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
            $quickfacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'NOTE_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
            break;
        case "REPO":
            $addfacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'REPO_FACTS_ADD'), -1, PREG_SPLIT_NO_EMPTY);
            $uniquefacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'REPO_FACTS_UNIQUE'), -1, PREG_SPLIT_NO_EMPTY);
            $quickfacts = preg_split("/[, ;:]+/", get_gedcom_setting(WT_GED_ID, 'REPO_FACTS_QUICK'), -1, PREG_SPLIT_NO_EMPTY);
            break;
        default:
            return;
    }
    $addfacts = array_merge(CheckFactUnique($uniquefacts, $usedfacts, $type), $addfacts);
    $quickfacts = array_intersect($quickfacts, $addfacts);
    $translated_addfacts = array();
    foreach ($addfacts as $addfact) {
        $translated_addfacts[$addfact] = WT_Gedcom_Tag::getLabel($addfact);
    }
    uasort($translated_addfacts, function ($x, $y) {
        return WT_I18N::strcasecmp(WT_I18N::translate($x), WT_I18N::translate($y));
    });
    echo '<tr><td class="descriptionbox">';
    echo WT_I18N::translate('Fact or event');
    echo help_link('add_facts'), '</td>';
    echo '<td class="optionbox wrap">';
    echo '<form method="get" name="newfactform" action="?" onsubmit="return false;">';
    echo '<select id="newfact" name="newfact">';
    echo '<option value="" disabled selected>' . WT_I18N::translate('&lt;select&gt;') . '</option>';
    foreach ($translated_addfacts as $fact => $fact_name) {
        echo '<option value="', $fact, '">', $fact_name, '</option>';
    }
    if ($type == 'INDI' || $type == 'FAM') {
        echo '<option value="FACT">', WT_I18N::translate('Custom fact'), '</option>';
        echo '<option value="EVEN">', WT_I18N::translate('Custom event'), '</option>';
    }
    echo '</select>';
    echo '<input type="button" value="', WT_I18N::translate('Add'), '" onclick="add_record(\'' . $id . '\', \'newfact\');">';
    echo '<span class="quickfacts">';
    foreach ($quickfacts as $fact) {
        echo '<a href="#" onclick="add_new_record(\'' . $id . '\', \'' . $fact . '\');return false;">', WT_Gedcom_Tag::getLabel($fact), '</a>';
    }
    echo '</span></form>';
    echo '</td></tr>';
}
예제 #29
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>';
 }
예제 #30
0
            // dod       - Date of Death
            echo "'', ";
            // occu      - Occupation
            echo "'" . WT_Filter::escapeHtml($indi->getbirthplace()) . "', ";
            // birthpl   - Birthplace
            echo "'" . $FBP . "', ";
            // fbirthpl  - Father’s Birthplace
            echo "'" . $MBP . "', ";
            // mbirthpl  - Mother’s Birthplace
            echo "'" . $chBLDarray . "'";
            // chilBLD   - Array of Children (name, birthdate, deathdate)
            echo ");";
            echo "return false;\">";
            echo "<b>" . $indi->getFullName() . "</b>&nbsp;&nbsp;&nbsp;";
            // Name Link
            echo "</span><br><span class=\"list_item\">", WT_Gedcom_Tag::getLabel('BIRT', $indi), " ", $indi->getbirthyear(), "&nbsp;&nbsp;&nbsp;", $indi->getbirthplace(), "</span>";
            echo "</a>";
            echo "</li>";
            echo "<hr>";
        }
        echo '</ul></td></tr>';
    } else {
        echo "<tr><td class=\"list_value_wrap\">";
        echo WT_I18N::translate('No results found.');
        echo "</td></tr>";
    }
    echo "</table>";
}
echo '<button onclick="window.close();">', WT_I18N::translate('close'), '</button>';
echo "</div>";
// Close div that centers table