예제 #1
0
 /**
  * print a child ascendancy
  *
  * @param Individual $individual
  * @param int        $sosa  child sosa number
  * @param int        $depth the ascendancy depth to show
  */
 public function printChildAscendancy(Individual $individual, $sosa, $depth)
 {
     echo '<li>';
     echo '<table><tbody><tr><td>';
     if ($sosa === 1) {
         echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="3" width="', Theme::theme()->parameter('chart-descendancy-indent'), '"></td><td>';
     } else {
         echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="3" width="2" alt="">';
         echo '<img src="', Theme::theme()->parameter('image-hline'), '" height="3" width="', Theme::theme()->parameter('chart-descendancy-indent') - 2, '"></td><td>';
     }
     FunctionsPrint::printPedigreePerson($individual, $this->showFull());
     echo '</td><td>';
     if ($sosa > 1) {
         FunctionsCharts::printUrlArrow('?rootid=' . $individual->getXref() . '&amp;PEDIGREE_GENERATIONS=' . $this->generations . '&amp;show_full=' . $this->showFull() . '&amp;chart_style=' . $this->chart_style . '&amp;ged=' . $individual->getTree()->getNameUrl(), I18N::translate('Ancestors of %s', $individual->getFullName()), 3);
     }
     echo '</td><td class="details1">&nbsp;<span class="person_box' . ($sosa === 1 ? 'NN' : ($sosa % 2 ? 'F' : '')) . '">', I18N::number($sosa), '</span> ';
     echo '</td><td class="details1">&nbsp;', FunctionsCharts::getSosaName($sosa), '</td>';
     echo '</tr></tbody></table>';
     // Parents
     $family = $individual->getPrimaryChildFamily();
     if ($family && $depth > 0) {
         // Marriage details
         echo '<span class="details1">';
         echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="2" width="', Theme::theme()->parameter('chart-descendancy-indent'), '" alt=""><a href="#" onclick="return expand_layer(\'sosa_', $sosa, '\');" class="top"><i id="sosa_', $sosa, '_img" class="icon-minus" title="', I18N::translate('View family'), '"></i></a>';
         echo ' <span class="person_box">', I18N::number($sosa * 2), '</span> ', I18N::translate('and');
         echo ' <span class="person_boxF">', I18N::number($sosa * 2 + 1), '</span>';
         if ($family->canShow()) {
             foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) {
                 echo ' <a href="', $family->getHtmlUrl(), '" class="details1">', $fact->summary(), '</a>';
             }
         }
         echo '</span>';
         // display parents recursively - or show empty boxes
         echo '<ul id="sosa_', $sosa, '" class="generation">';
         if ($family->getHusband()) {
             $this->printChildAscendancy($family->getHusband(), $sosa * 2, $depth - 1);
         }
         if ($family->getWife()) {
             $this->printChildAscendancy($family->getWife(), $sosa * 2 + 1, $depth - 1);
         }
         echo '</ul>';
     }
     echo '</li>';
 }
예제 #2
0
    echo FunctionsPrint::printFindIndividualLink('gid2');
    ?>
			<?php 
    echo FunctionsPrint::printFindFamilyLink('gid2');
    ?>
			<?php 
    echo FunctionsPrint::printFindSourceLink('gid2');
    ?>
			<?php 
    echo FunctionsPrint::printFindRepositoryLink('gid2');
    ?>
			<?php 
    echo FunctionsPrint::printFindMediaLink('gid2');
    ?>
			<?php 
    echo FunctionsPrint::printFindNoteLink('gid2');
    ?>
		</div>
	</div>

	<div class="form-group">
		<div class="col-sm-offset-3 col-sm-9">
			<button type="submit" class="btn btn-primary">
				<?php 
    echo I18N::translate('continue');
    ?>
			</button>
		</div>
	</div>

</form>
예제 #3
0
 /**
  * print information for a name record
  *
  * @param Fact $event the event object
  */
 public function printNameRecord(Fact $event)
 {
     $factrec = $event->getGedcom();
     // Create a dummy record, so we can extract the formatted NAME value from the event.
     $dummy = new Individual('xref', "0 @xref@ INDI\n1 DEAT Y\n" . $factrec, null, $event->getParent()->getTree());
     $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->isPendingDeletion()) {
         echo ' old';
     }
     if ($event->isPendingAddition()) {
         echo ' new';
     }
     echo '">';
     echo '<div class="name1">';
     echo '<dl><dt class="label">', I18N::translate('Name'), '</dt>';
     $dummy->setPrimaryName(0);
     echo '<dd class="field">', $dummy->getFullName();
     if ($this->name_count == 1) {
         if (Auth::isAdmin()) {
             $user = User::findByGenealogyRecord($this->record);
             if ($user) {
                 echo '<span> - <a class="warning" href="admin_users.php?filter=' . Filter::escapeHtml($user->getUserName()) . '">' . Filter::escapeHtml($user->getUserName()) . '</a></span>';
             }
         }
     }
     if ($this->record->canEdit() && !$event->isPendingDeletion()) {
         echo "<div class=\"deletelink\"><a class=\"deleteicon\" href=\"#\" onclick=\"return delete_fact('" . I18N::translate('Are you sure you want to delete this fact?') . "', '" . $this->record->getXref() . "', '" . $event->getFactId() . "');\" title=\"" . I18N::translate('Delete this name') . "\"><span class=\"link_text\">" . 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=\"" . I18N::translate('Edit name') . "\"><span class=\"link_text\">" . 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">', GedcomTag::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 = Filter::escapeHtml($nmatch[$i][2]);
                 $name = str_replace('/', '', $name);
                 $name = preg_replace('/(\\S*)\\*/', '<span class="starredname">\\1</span>', $name);
                 switch ($fact) {
                     case 'TYPE':
                         echo GedcomCodeName::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 = Filter::escapeHtml($primary_name['surname']);
                         if (strpos($primary_name['surname'], str_replace(',', ' ', $nmatch[$i][2])) !== false) {
                             echo '<span dir="auto">' . $surname . '</span>';
                         } else {
                             echo I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $surname . '</span>', '<span dir="auto">' . $name . '</span>');
                         }
                         break;
                     default:
                         echo '<span dir="auto">' . $name . '</span>';
                         break;
                 }
             }
             echo '</dd>';
             echo '</dl>';
         }
         echo '</div>';
     }
     if (preg_match("/\n2 SOUR/", $factrec)) {
         echo '<div id="indi_sour" class="clearfloat">', FunctionsPrintFacts::printFactSources($factrec, 2), '</div>';
     }
     if (preg_match("/\n2 NOTE/", $factrec)) {
         echo '<div id="indi_note" class="clearfloat">', FunctionsPrint::printFactNotes($factrec, 2), '</div>';
     }
     echo '</div>';
 }
예제 #4
0
 /**
  * Generate the HTML content of this tab.
  *
  * @return string
  */
 public function getTabContent()
 {
     global $WT_TREE, $controller;
     $html = '<div id="' . $this->getName() . '_content">';
     //Show Lightbox-Album header Links
     if (Auth::isEditor($WT_TREE)) {
         $html .= '<table class="facts_table"><tr><td class="descriptionbox rela">';
         // Add a new media object
         if ($WT_TREE->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($WT_TREE)) {
             $html .= '<span><a href="#" onclick="window.open(\'addmedia.php?action=showmediaform&linktoid=' . $controller->record->getXref() . '\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=780,width=600\');return false;">';
             $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/image_add.png" id="head_icon" class="icon" title="' . I18N::translate('Add a new media object') . '" alt="' . I18N::translate('Add a new media object') . '">';
             $html .= I18N::translate('Add a new media object');
             $html .= '</a></span>';
             // Link to an existing item
             $html .= '<span><a href="#" onclick="window.open(\'inverselink.php?linktoid=' . $controller->record->getXref() . '&linkto=person\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=300,width=450\');">';
             $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/image_link.png" id="head_icon" class="icon" title="' . I18N::translate('Link to an existing media object') . '" alt="' . I18N::translate('Link to an existing media object') . '">';
             $html .= I18N::translate('Link to an existing media object');
             $html .= '</a></span>';
         }
         if (Auth::isManager($WT_TREE) && $this->getMedia()) {
             // Popup Reorder Media
             $html .= '<span><a href="#" onclick="reorder_media(\'' . $controller->record->getXref() . '\')">';
             $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/images.png" id="head_icon" class="icon" title="' . I18N::translate('Re-order media') . '" alt="' . I18N::translate('Re-order media') . '">';
             $html .= I18N::translate('Re-order media');
             $html .= '</a></span>';
         }
         $html .= '</td></tr></table>';
     }
     // Used when sorting media on album tab page
     $html .= '<table class="facts_table"><tr><td class="facts_value">';
     // one-cell table - for presentation only
     $html .= '<ul class="album-list">';
     foreach ($this->getMedia() as $media) {
         //View Edit Menu ----------------------------------
         //Get media item Notes
         $haystack = $media->getGedcom();
         $needle = '1 NOTE';
         $before = substr($haystack, 0, strpos($haystack, $needle));
         $after = substr(strstr($haystack, $needle), strlen($needle));
         $notes = FunctionsPrint::printFactNotes($before . $needle . $after, 1, true);
         // Prepare Below Thumbnail  menu ----------------------------------------------------
         $menu = new Menu('<div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap">' . $media->getFullName() . '</div>');
         $menu->addClass('', 'submenu');
         // View Notes
         if (strpos($media->getGedcom(), "\n1 NOTE")) {
             $submenu = new Menu(I18N::translate('View notes'), '#', '', array('onclick' => 'modalNotes("' . Filter::escapeJs($notes) . '","' . I18N::translate('View notes') . '"); return false;'));
             $submenu->addClass("submenuitem");
             $menu->addSubmenu($submenu);
         }
         //View Details
         $submenu = new Menu(I18N::translate('View details'), $media->getHtmlUrl());
         $submenu->addClass("submenuitem");
         $menu->addSubmenu($submenu);
         //View Sources
         foreach ($media->getFacts('SOUR') as $source_fact) {
             $source = $source_fact->getTarget();
             if ($source && $source->canShow()) {
                 $submenu = new Menu(I18N::translate('Source') . ' – ' . $source->getFullName(), $source->getHtmlUrl());
                 $submenu->addClass('submenuitem');
                 $menu->addSubmenu($submenu);
             }
         }
         if (Auth::isEditor($media->getTree())) {
             // Edit Media
             $submenu = new Menu(I18N::translate('Edit media'), '#', '', array('onclick' => 'return window.open("addmedia.php?action=editmedia&pid=' . $media->getXref() . '", "_blank", edit_window_specs);'));
             $submenu->addClass("submenuitem");
             $menu->addSubmenu($submenu);
             if (Auth::isAdmin()) {
                 if (Module::getModuleByName('GEDFact_assistant')) {
                     $submenu = new Menu(I18N::translate('Manage links'), '#', '', array('onclick' => 'return window.open("inverselink.php?mediaid=' . $media->getXref() . '&linkto=manage", "_blank", find_window_specs);'));
                     $submenu->addClass("submenuitem");
                     $menu->addSubmenu($submenu);
                 } else {
                     $submenu = new Menu(I18N::translate('Link this media object to an individual'), '#', 'menu-obje-link-indi', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","person");'));
                     $submenu->addClass('submenuitem');
                     $menu->addSubmenu($submenu);
                     $submenu = new Menu(I18N::translate('Link this media object to a family'), '#', 'menu-obje-link-fam', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","family");'));
                     $submenu->addClass('submenuitem');
                     $menu->addSubmenu($submenu);
                     $submenu = new Menu(I18N::translate('Link this media object to a source'), '#', 'menu-obje-link-sour', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","source");'));
                     $submenu->addClass('submenuitem');
                     $menu->addSubmenu($submenu);
                 }
                 $submenu = new Menu(I18N::translate('Unlink media'), '#', '', array('onclick' => 'return unlink_media("' . I18N::translate('Are you sure you want to remove links to this media object?') . '", "' . $controller->record->getXref() . '", "' . $media->getXref() . '");'));
                 $submenu->addClass("submenuitem");
                 $menu->addSubmenu($submenu);
             }
         }
         $html .= '<li class="album-list-item">';
         $html .= '<div class="album-image">' . $media->displayImage() . '</div>';
         $html .= '<div class="album-title">' . $menu->getMenu() . '</div>';
         $html .= '</li>';
     }
     $html .= '</ul>';
     $html .= '</td></tr></table>';
     return $html;
 }
예제 #5
0
define('WT_SCRIPT_NAME', 'mediaviewer.php');
require './includes/session.php';
$controller = new MediaController();
if ($controller->record && $controller->record->canShow()) {
    $controller->pageHeader();
    if ($controller->record->isPendingDeletion()) {
        if (Auth::isModerator($controller->record->getTree())) {
            echo '<p class="ui-state-highlight">', I18N::translate('This media object has been deleted.  You should review the deletion and then %1$s or %2$s it.', '<a href="#" onclick="accept_changes(\'' . $controller->record->getXref() . '\');">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'accept') . '</a>', '<a href="#" onclick="reject_changes(\'' . $controller->record->getXref() . '\');">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'reject') . '</a>'), ' ', FunctionsPrint::helpLink('pending_changes'), '</p>';
        } elseif (Auth::isEditor($controller->record->getTree())) {
            echo '<p class="ui-state-highlight">', I18N::translate('This media object has been deleted.  The deletion will need to be reviewed by a moderator.'), ' ', FunctionsPrint::helpLink('pending_changes'), '</p>';
        }
    } elseif ($controller->record->isPendingAddtion()) {
        if (Auth::isModerator($controller->record->getTree())) {
            echo '<p class="ui-state-highlight">', I18N::translate('This media object has been edited.  You should review the changes and then %1$s or %2$s them.', '<a href="#" onclick="accept_changes(\'' . $controller->record->getXref() . '\');">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'accept') . '</a>', '<a href="#" onclick="reject_changes(\'' . $controller->record->getXref() . '\');">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'reject') . '</a>'), ' ', FunctionsPrint::helpLink('pending_changes'), '</p>';
        } elseif (Auth::isEditor($controller->record->getTree())) {
            echo '<p class="ui-state-highlight">', I18N::translate('This media object has been edited.  The changes need to be reviewed by a moderator.'), ' ', FunctionsPrint::helpLink('pending_changes'), '</p>';
        }
    }
} else {
    http_response_code(404);
    $controller->pageHeader();
    echo '<p class="ui-state-error">', I18N::translate('This media object does not exist or you do not have permission to view it.'), '</p>';
    return;
}
$controller->addInlineJavascript('
	jQuery("#media-tabs")
		.tabs({
			create: function(e, ui){
				jQuery(e.target).css("visibility", "visible");  // prevent FOUC
			}
		});
예제 #6
0
							size="12"
							name="gedcomid<?php 
            echo $tree->getTreeId();
            ?>
"
							id="gedcomid<?php 
            echo $tree->getTreeId();
            ?>
"
							value="<?php 
            echo Filter::escapeHtml($tree->getUserPreference($user, 'gedcomid'));
            ?>
"
						>
						<?php 
            echo FunctionsPrint::printFindIndividualLink('gedcomid' . $tree->getTreeId(), '', $tree);
            ?>
					</td>
					<td>
						<select name="RELATIONSHIP_PATH_LENGTH<?php 
            echo $tree->getTreeId();
            ?>
" id="RELATIONSHIP_PATH_LENGTH<?php 
            echo $tree->getTreeId();
            ?>
" class="relpath">
							<?php 
            for ($n = 0; $n <= 10; ++$n) {
                ?>
							<option value="<?php 
                echo $n;
예제 #7
0
			</div>

			<div class="label">
				<label for="form_rootid">
					<?php 
echo I18N::translate('Default individual');
?>
				</label>
			</div>
			<div class="value">
				<input data-autocomplete-type="INDI" type="text" name="form_rootid" id="form_rootid" value="<?php 
echo $WT_TREE->getUserPreference(Auth::user(), 'rootid');
?>
">
				<?php 
echo FunctionsPrint::printFindIndividualLink('form_rootid');
?>
				<br>
				<?php 
if ($default_individual) {
    ?>
				<?php 
    echo $default_individual->formatList('span');
    ?>
				<?php 
}
?>
				<p class="small text-muted">
					<?php 
echo I18N::translate('This individual will be selected by default when viewing charts and reports.');
?>
예제 #8
0
    /** {@inheritdoc} */
    public function getTabContent()
    {
        global $WT_TREE, $controller;
        ob_start();
        echo '<table class="facts_table">';
        foreach ($this->getFactsWithMedia() as $fact) {
            if ($fact->getTag() == 'OBJE') {
                FunctionsPrintFacts::printMainMedia($fact, 1);
            } else {
                for ($i = 2; $i < 4; ++$i) {
                    FunctionsPrintFacts::printMainMedia($fact, $i);
                }
            }
        }
        if (!$this->getFactsWithMedia()) {
            echo '<tr><td id="no_tab4" colspan="2" class="facts_value">', I18N::translate('There are no media objects for this individual.'), '</td></tr>';
        }
        // New media link
        if ($controller->record->canEdit() && $WT_TREE->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($controller->record->getTree())) {
            ?>
			<tr>
				<td class="facts_label">
					<?php 
            echo GedcomTag::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 $controller->record->getTree()->getNameUrl();
            ?>
', '_blank', edit_window_specs); return false;">
						<?php 
            echo I18N::translate('Add a new media object');
            ?>
					</a>
					<?php 
            echo FunctionsPrint::helpLink('OBJE');
            ?>
					<br>
					<a href="#" onclick="window.open('inverselink.php?linktoid=<?php 
            echo $controller->record->getXref();
            ?>
&amp;ged=<?php 
            echo $WT_TREE->getNameUrl();
            ?>
&amp;linkto=person', '_blank', find_window_specs); return false;">
						<?php 
            echo I18N::translate('Link to an existing media object');
            ?>
					</a>
				</td>
			</tr>
		<?php 
        }
        ?>
		</table>
		<?php 
        return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>';
    }
예제 #9
0
             }
         }
         echo GedcomTag::getLabelValue('FORM', $mediaobject->mimeType());
         echo GedcomTag::getLabelValue('__FILE_SIZE__', $mediaobject->getFilesize());
         $imgsize = $mediaobject->getImageAttributes();
         if ($imgsize['WxH']) {
             echo GedcomTag::getLabelValue('__IMAGE_SIZE__', $imgsize['WxH']);
         }
     } else {
         echo '<p class="ui-state-error">', I18N::translate('The file “%s” does not exist.', $mediaobject->getFilename()), '</p>';
     }
 }
 echo '<br>';
 echo '<div>';
 echo FunctionsPrintFacts::printFactSources($mediaobject->getGedcom(), 1);
 echo FunctionsPrint::printFactNotes($mediaobject->getGedcom(), 1);
 echo '</div>';
 foreach ($mediaobject->linkedIndividuals('OBJE') as $individual) {
     echo '<a href="' . $individual->getHtmlUrl() . '">' . I18N::translate('View individual') . ' — ' . $individual->getFullName() . '</a><br>';
 }
 foreach ($mediaobject->linkedFamilies('OBJE') as $family) {
     echo '<a href="' . $family->getHtmlUrl() . '">' . I18N::translate('View family') . ' — ' . $family->getFullName() . '</a><br>';
 }
 foreach ($mediaobject->linkedSources('OBJE') as $source) {
     echo '<a href="' . $source->getHtmlUrl() . '">' . I18N::translate('View source') . ' — ' . $source->getFullName() . '</a><br>';
 }
 echo '</td></tr></table>';
 echo '</td>';
 if (++$n % $columns == 0 && $n < $count) {
     echo '</tr><tr>';
 }
예제 #10
0
 /**
  * Prints descendency of passed in person
  *
  * @param Individual $person  person to print descendency for
  * @param int        $count   count of generations to print
  * @param bool       $showNav
  *
  * @return int
  */
 public function printDescendency($person, $count, $showNav = true)
 {
     global $lastGenSecondFam;
     if ($count > $this->dgenerations) {
         return 0;
     }
     $pid = $person->getXref();
     $tablealign = 'right';
     $otablealign = 'left';
     if (I18N::direction() === 'rtl') {
         $tablealign = 'left';
         $otablealign = 'right';
     }
     //-- put a space between families on the last generation
     if ($count == $this->dgenerations - 1) {
         if (isset($lastGenSecondFam)) {
             echo '<br>';
         }
         $lastGenSecondFam = true;
     }
     echo "<table id='table_{$pid}' class='hourglassChart' style='float:{$tablealign}'>";
     echo '<tr>';
     echo "<td style='text-align:{$tablealign}'>";
     $numkids = 0;
     $families = $person->getSpouseFamilies();
     $famNum = 0;
     $children = array();
     if ($count < $this->dgenerations) {
         // Put all of the children in a common array
         foreach ($families as $family) {
             $famNum++;
             foreach ($family->getChildren() as $child) {
                 $children[] = $child;
             }
         }
         $ct = count($children);
         if ($ct > 0) {
             echo "<table style='position: relative; top: auto; float: {$tablealign};'>";
             for ($i = 0; $i < $ct; $i++) {
                 $person2 = $children[$i];
                 $chil = $person2->getXref();
                 echo '<tr>';
                 echo '<td id="td_', $chil, '" class="', I18N::direction(), '" style="text-align:', $otablealign, '">';
                 $kids = $this->printDescendency($person2, $count + 1);
                 $numkids += $kids;
                 echo '</td>';
                 // Print the lines
                 if ($ct > 1) {
                     if ($i == 0) {
                         // First child
                         echo "<td style='vertical-align:bottom'><img alt='' class='line1 tvertline' id='vline_{$chil}' src='" . Theme::theme()->parameter('image-vline') . "' width='3'></td>";
                     } elseif ($i == $ct - 1) {
                         // Last child
                         echo "<td style='vertical-align:top'><img alt='' class='bvertline' id='vline_{$chil}' src='" . Theme::theme()->parameter('image-vline') . "' width='3'></td>";
                     } else {
                         // Middle child
                         echo '<td style="background: url(\'' . Theme::theme()->parameter('image-vline') . '\');"><img src=\'' . Theme::theme()->parameter('image-spacer') . '\' width="3" alt=""></td>';
                     }
                 }
                 echo '</tr>';
             }
             echo '</table>';
         }
         echo '</td>';
         echo '<td width="', $this->getBoxDimensions()->width, '">';
     }
     // Print the descendency expansion arrow
     if ($count == $this->dgenerations) {
         $numkids = 1;
         $tbwidth = $this->getBoxDimensions()->width + 16;
         for ($j = $count; $j < $this->dgenerations; $j++) {
             echo "<div style='width: ", $tbwidth, "px;'><br></div></td><td style='width:", $this->getBoxDimensions()->width, "px'>";
         }
         $kcount = 0;
         foreach ($families as $family) {
             $kcount += $family->getNumberOfChildren();
         }
         if ($kcount == 0) {
             echo "</td><td style='width:", $this->getBoxDimensions()->width, "px'>";
         } else {
             printf(self::LINK, $this->left_arrow, $pid, 'desc', $this->showFull(), $this->show_spouse);
             //-- move the arrow up to line up with the correct box
             if ($this->show_spouse) {
                 echo str_repeat('<br><br><br>', count($families));
             }
             echo "</td><td style='width:", $this->getBoxDimensions()->width, "px'>";
         }
     }
     echo '<table id="table2_' . $pid . '"><tr><td>';
     FunctionsPrint::printPedigreePerson($person, $this->showFull());
     echo '</td><td><img class="line2" src="' . Theme::theme()->parameter('image-hline') . '" width="7" height="3">';
     //----- Print the spouse
     if ($this->show_spouse) {
         foreach ($families as $family) {
             echo "</td></tr><tr><td style='text-align:{$otablealign}'>";
             //-- shrink the box for the spouses
             $tempw = $this->getBoxDimensions()->width;
             $temph = $this->getBoxDimensions()->height;
             $this->getBoxDimensions()->width -= 10;
             $this->getBoxDimensions()->height -= 10;
             FunctionsPrint::printPedigreePerson($family->getSpouse($person), $this->showFull());
             $this->getBoxDimensions()->width = $tempw;
             $this->getBoxDimensions()->height = $temph;
             $numkids += 0.95;
             echo "</td><td></td>";
         }
         //-- add offset divs to make things line up better
         if ($count == $this->dgenerations) {
             echo "<tr><td colspan '2'><div style='height:", $this->bhalfheight / 2, "px; width:", $this->getBoxDimensions()->width, "px;'><br></div>";
         }
     }
     echo "</td></tr></table>";
     // For the root person, print a down arrow that allows changing the root of tree
     if ($showNav && $count == 1) {
         // NOTE: If statement OK
         if ($person->canShowName()) {
             // -- print left arrow for decendants so that we can move down the tree
             $famids = $person->getSpouseFamilies();
             //-- make sure there is more than 1 child in the family with parents
             $cfamids = $person->getChildFamilies();
             $num = 0;
             foreach ($cfamids as $family) {
                 $num += $family->getNumberOfChildren();
             }
             if ($num > 0) {
                 echo '<div class="center" id="childarrow" style="position:absolute; width:', $this->getBoxDimensions()->width, 'px;">';
                 echo '<a href="#" class="icon-darrow"></a>';
                 echo '<div id="childbox">';
                 echo '<table class="person_box"><tr><td>';
                 foreach ($famids as $family) {
                     echo "<span class='name1'>" . I18N::translate('Family') . "</span>";
                     $spouse = $family->getSpouse($person);
                     if ($spouse) {
                         printf(self::SWITCH_LINK, $spouse->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $spouse->getFullName());
                     }
                     foreach ($family->getChildren() as $child) {
                         printf(self::SWITCH_LINK, $child->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $child->getFullName());
                     }
                 }
                 //-- print the siblings
                 foreach ($cfamids as $family) {
                     if ($family->getHusband() || $family->getWife()) {
                         echo "<span class='name1'>" . I18N::translate('Parents') . "</span>";
                         $husb = $family->getHusband();
                         if ($husb) {
                             printf(self::SWITCH_LINK, $husb->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $husb->getFullName());
                         }
                         $wife = $family->getWife();
                         if ($wife) {
                             printf(self::SWITCH_LINK, $wife->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $wife->getFullName());
                         }
                     }
                     // filter out root person from children array so only siblings remain
                     $siblings = array_filter($family->getChildren(), function (Individual $item) use($pid) {
                         return $item->getXref() != $pid;
                     });
                     $num = count($siblings);
                     if ($num) {
                         echo "<span class='name1'>";
                         echo $num > 1 ? I18N::translate('Siblings') : I18N::translate('Sibling');
                         echo "</span>";
                         foreach ($siblings as $child) {
                             printf(self::SWITCH_LINK, $child->getXref(), $this->show_spouse, $this->showFull(), $this->generations, $child->getFullName());
                         }
                     }
                 }
                 echo '</td></tr></table>';
                 echo '</div>';
                 echo '</div>';
             }
         }
     }
     echo '</td></tr></table>';
     return $numkids;
 }
예제 #11
0
                 if ($n > 2 && preg_match('/son|dau|chi/', $relationships[$n - 2])) {
                     $table[$x + 1][$y + 1] = '<div style="background:url(' . $diagonal1 . '); background-position: top right; width: 64px; height: 64px; text-align: center;"><div style="height: 32px; text-align: start;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="height: 32px; text-align: end;">' . $up_arrow . '</div></div>';
                     $x += 2;
                 } else {
                     $table[$x][$y + 1] = '<div style="background:url(' . Theme::theme()->parameter('image-vline') . ') repeat-y center; height: 64px; text-align:center; "><div style="display: inline-block; width: 50%; line-height: 32px;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="display: inline-block; width: 50%; line-height: 32px">' . $up_arrow . '</div></div>';
                 }
                 $y += 2;
                 break;
         }
         $max_x = max($max_x, $x);
         $min_y = min($min_y, $y);
         $max_y = max($max_y, $y);
     } else {
         $individual = Individual::getInstance($xref, $WT_TREE);
         ob_start();
         FunctionsPrint::printPedigreePerson($individual, $show_full);
         $table[$x][$y] = ob_get_clean();
     }
 }
 echo '<table style="border-collapse: collapse; margin: 20px 50px;">';
 for ($y = $max_y; $y >= $min_y; --$y) {
     echo '<tr>';
     for ($x = 0; $x <= $max_x; ++$x) {
         echo '<td style="padding: 0;">';
         if (isset($table[$x][$y])) {
             echo $table[$x][$y];
         }
         echo '</td>';
     }
     echo '</tr>';
 }
예제 #12
0
 /**
  * print cousins list
  *
  * @param string $famid family ID
  * @param int $show_full large or small box
  */
 public static function printCousins($famid, $show_full = 1)
 {
     global $WT_TREE;
     if ($show_full) {
         $bheight = Theme::theme()->parameter('chart-box-y');
     } else {
         $bheight = Theme::theme()->parameter('compact-chart-box-y');
     }
     $family = Family::getInstance($famid, $WT_TREE);
     $fchildren = $family->getChildren();
     $kids = count($fchildren);
     echo '<td valign="middle" height="100%">';
     if ($kids) {
         echo '<table cellspacing="0" cellpadding="0" border="0" ><tr valign="middle">';
         if ($kids > 1) {
             echo '<td rowspan="', $kids, '" valign="middle" align="right"><img width="3px" height="', ($bheight + 9) * ($kids - 1), 'px" src="', Theme::theme()->parameter('image-vline'), '" alt=""></td>';
         }
         $ctkids = count($fchildren);
         $i = 1;
         foreach ($fchildren as $fchil) {
             if ($i == 1) {
                 echo '<td><img width="10px" height="3px" align="top"';
             } else {
                 echo '<td><img width="10px" height="3px"';
             }
             if (I18N::direction() === 'ltr') {
                 echo ' style="padding-right: 2px;"';
             } else {
                 echo ' style="padding-left: 2px;"';
             }
             echo ' src="', Theme::theme()->parameter('image-hline'), '" alt=""></td><td>';
             FunctionsPrint::printPedigreePerson($fchil, $show_full);
             echo '</td></tr>';
             if ($i < $ctkids) {
                 echo '<tr>';
                 $i++;
             }
         }
         echo '</table>';
     } else {
         // If there is known that there are no children (as opposed to no known children)
         if (preg_match('/\\n1 NCHI (\\d+)/', $family->getGedcom(), $match) && $match[1] == 0) {
             echo ' <i class="icon-childless" title="', I18N::translate('This family remained childless'), '"></i>';
         }
     }
     echo '</td>';
 }
 /** {@inheritdoc} */
 public function getTabContent()
 {
     global $controller;
     $EXPAND_HISTO_EVENTS = false;
     $indifacts = array();
     // The individual’s own facts
     foreach ($controller->record->getFacts() as $fact) {
         switch ($fact->getTag()) {
             case 'SEX':
             case 'NAME':
             case 'SOUR':
             case 'OBJE':
             case 'NOTE':
             case 'FAMC':
             case 'FAMS':
                 break;
             default:
                 if (!array_key_exists('extra_info', Module::getActiveSidebars($controller->record->getTree())) || !ExtraInformationModule::showFact($fact)) {
                     $indifacts[] = $fact;
                 }
                 break;
         }
     }
     // Add spouse-family facts
     foreach ($controller->record->getSpouseFamilies() as $family) {
         foreach ($family->getFacts() as $fact) {
             switch ($fact->getTag()) {
                 case 'SOUR':
                 case 'NOTE':
                 case 'OBJE':
                 case 'CHAN':
                 case '_UID':
                 case 'RIN':
                 case 'HUSB':
                 case 'WIFE':
                 case 'CHIL':
                     break;
                 default:
                     $indifacts[] = $fact;
                     break;
             }
         }
         $spouse = $family->getSpouse($controller->record);
         if ($spouse) {
             foreach (self::spouseFacts($controller->record, $spouse) as $fact) {
                 $indifacts[] = $fact;
             }
         }
         foreach (self::childFacts($controller->record, $family, '_CHIL', '') as $fact) {
             $indifacts[] = $fact;
         }
     }
     foreach (self::parentFacts($controller->record, 1) as $fact) {
         $indifacts[] = $fact;
     }
     foreach (self::historicalFacts($controller->record) as $fact) {
         $indifacts[] = $fact;
     }
     foreach (self::associateFacts($controller->record) as $fact) {
         $indifacts[] = $fact;
     }
     Functions::sortFacts($indifacts);
     ob_start();
     echo '<table class="facts_table">';
     echo '<tbody>';
     if (!$indifacts) {
         echo '<tr><td colspan="2" class="facts_value">', I18N::translate('There are no facts for this individual.'), '</td></tr>';
     }
     echo '<tr><td colspan="2" class="descriptionbox rela"><form action="?"><input id="checkbox_rela_facts" type="checkbox" ';
     echo $controller->record->getTree()->getPreference('EXPAND_RELATIVES_EVENTS') ? 'checked' : '';
     echo ' onclick="jQuery(\'tr.rela\').toggle();"><label for="checkbox_rela_facts">', I18N::translate('Events of close relatives'), '</label>';
     if (file_exists(Site::getPreference('INDEX_DIRECTORY') . 'histo.' . WT_LOCALE . '.php')) {
         echo ' <input id="checkbox_histo" type="checkbox" ';
         echo $EXPAND_HISTO_EVENTS ? 'checked' : '';
         echo ' onclick="jQuery(\'tr.histo\').toggle();"><label for="checkbox_histo">', I18N::translate('Historical facts'), '</label>';
     }
     echo '</form></td></tr>';
     foreach ($indifacts as $fact) {
         FunctionsPrintFacts::printFact($fact, $controller->record);
     }
     //-- new fact link
     if ($controller->record->canEdit()) {
         FunctionsPrint::printAddNewFact($controller->record->getXref(), $indifacts, 'INDI');
     }
     echo '</tbody>';
     echo '</table>';
     if (!$controller->record->getTree()->getPreference('EXPAND_RELATIVES_EVENTS')) {
         echo '<script>jQuery("tr.rela").toggle();</script>';
     }
     if (!$EXPAND_HISTO_EVENTS) {
         echo '<script>jQuery("tr.histo").toggle();</script>';
     }
     return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>';
 }
예제 #14
0
    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) {
    FunctionsPrintFacts::printFact($fact, $controller->record);
}
// new fact link
if ($controller->record->canEdit()) {
    FunctionsPrint::printAddNewFact($controller->record->getXref(), $facts, 'SOUR');
    // new media
    if ($controller->record->getTree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($WT_TREE)) {
        echo '<tr><td class="descriptionbox">';
        echo GedcomTag::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;">', I18N::translate('Add a new media object'), '</a>';
        echo FunctionsPrint::helpLink('OBJE');
        echo '<br>';
        echo '<a href="#" onclick="window.open(\'inverselink.php?linktoid=', $controller->record->getXref(), '&amp;linkto=source\', \'_blank\', find_window_specs); return false;">', I18N::translate('Link to an existing media object'), '</a>';
        echo '</td></tr>';
    }
}
echo '</table>
	</div>';
// Individuals linked to this source
if ($linked_indi) {
    echo '<div id="indi-sources">', FunctionsPrintLists::individualTable($linked_indi), '</div>';
}
// Families linked to this source
if ($linked_fam) {
    echo '<div id="fam-sources">', FunctionsPrintLists::familyTable($linked_fam), '</div>';
}
예제 #15
0
 /**
  * Print a fact for an individual.
  *
  * @param Fact $event
  */
 public function printTimeFact(Fact $event)
 {
     global $basexoffset, $baseyoffset, $factcount, $placements;
     $desc = $event->getValue();
     // check if this is a family fact
     $gdate = $event->getDate();
     $date = $gdate->minimumDate();
     $date = $date->convertToCalendar('gregorian');
     $year = $date->y;
     $month = max(1, $date->m);
     $day = max(1, $date->d);
     $xoffset = $basexoffset + 22;
     $yoffset = $baseyoffset + ($year - $this->baseyear) * $this->scale - $this->scale;
     $yoffset = $yoffset + $month / 12 * $this->scale;
     $yoffset = $yoffset + $day / 30 * ($this->scale / 12);
     $yoffset = (int) $yoffset;
     $place = (int) ($yoffset / $this->bheight);
     $i = 1;
     $j = 0;
     $tyoffset = 0;
     while (isset($placements[$place])) {
         if ($i === $j) {
             $tyoffset = $this->bheight * $i;
             $i++;
         } else {
             $tyoffset = -1 * $this->bheight * $j;
             $j++;
         }
         $place = (int) (($yoffset + $tyoffset) / $this->bheight);
     }
     $yoffset += $tyoffset;
     $xoffset += abs($tyoffset);
     $placements[$place] = $yoffset;
     echo "<div id=\"fact{$factcount}\" style=\"position:absolute; " . (I18N::direction() === 'ltr' ? 'left: ' . $xoffset : 'right: ' . $xoffset) . 'px; top:' . $yoffset . "px; font-size: 8pt; height: " . $this->bheight . "px;\" onmousedown=\"factMouseDown(this, '" . $factcount . "', " . ($yoffset - $tyoffset) . ");\">";
     echo '<table cellspacing="0" cellpadding="0" border="0" style="cursor: hand;"><tr><td>';
     echo '<img src="' . Theme::theme()->parameter('image-hline') . '" name="boxline' . $factcount . '" id="boxline' . $factcount . '" height="3" width="10" style="padding-';
     if (I18N::direction() === 'ltr') {
         echo 'left: 3px;">';
     } else {
         echo 'right: 3px;">';
     }
     $col = array_search($event->getParent(), $this->people);
     if ($col === false) {
         // Marriage event - use the color of the husband
         $col = array_search($event->getParent()->getHusband(), $this->people);
     }
     if ($col === false) {
         // Marriage event - use the color of the wife
         $col = array_search($event->getParent()->getWife(), $this->people);
     }
     $col = $col % 6;
     echo '</td><td class="person' . $col . '">';
     if (count($this->people) > 6) {
         // We only have six colours, so show naes if more than this number
         echo $event->getParent()->getFullName() . ' — ';
     }
     $record = $event->getParent();
     echo $event->getLabel();
     echo ' — ';
     if ($record instanceof Individual) {
         echo FunctionsPrint::formatFactDate($event, $record, false, false);
     } elseif ($record instanceof Family) {
         echo $gdate->display();
         if ($record->getHusband() && $record->getHusband()->getBirthDate()->isOK()) {
             $ageh = FunctionsDate::getAgeAtEvent(Date::getAgeGedcom($record->getHusband()->getBirthDate(), $gdate));
         } else {
             $ageh = null;
         }
         if ($record->getWife() && $record->getWife()->getBirthDate()->isOK()) {
             $agew = FunctionsDate::getAgeAtEvent(Date::getAgeGedcom($record->getWife()->getBirthDate(), $gdate));
         } else {
             $agew = null;
         }
         if ($ageh && $agew) {
             echo '<span class="age"> ', I18N::translate('Husband’s age'), ' ', $ageh, ' ', I18N::translate('Wife’s age'), ' ', $agew, '</span>';
         } elseif ($ageh) {
             echo '<span class="age"> ', I18N::translate('Age'), ' ', $ageh, '</span>';
         } elseif ($agew) {
             echo '<span class="age"> ', I18N::translate('Age'), ' ', $ageh, '</span>';
         }
     }
     echo ' ' . Filter::escapeHtml($desc);
     if (!$event->getPlace()->isEmpty()) {
         echo ' — ' . $event->getPlace()->getShortName();
     }
     // Print spouses names for family events
     if ($event->getParent() instanceof Family) {
         echo ' — <a href="', $event->getParent()->getHtmlUrl(), '">', $event->getParent()->getFullName(), '</a>';
     }
     echo '</td></tr></table>';
     echo '</div>';
     if (I18N::direction() === 'ltr') {
         $img = 'image-dline2';
         $ypos = '0%';
     } else {
         $img = 'image-dline';
         $ypos = '100%';
     }
     $dyoffset = $yoffset - $tyoffset + $this->bheight / 3;
     if ($tyoffset < 0) {
         $dyoffset = $yoffset + $this->bheight / 3;
         if (I18N::direction() === 'ltr') {
             $img = 'image-dline';
             $ypos = '100%';
         } else {
             $img = 'image-dline2';
             $ypos = '0%';
         }
     }
     // Print the diagonal line
     echo '<div id="dbox' . $factcount . '" style="position:absolute; ' . (I18N::direction() === 'ltr' ? 'left: ' . ($basexoffset + 25) : 'right: ' . ($basexoffset + 25)) . 'px; top:' . $dyoffset . 'px; font-size: 8pt; height: ' . abs($tyoffset) . 'px; width: ' . abs($tyoffset) . 'px;';
     echo ' background-image: url(\'' . Theme::theme()->parameter($img) . '\');';
     echo ' background-position: 0% ' . $ypos . ';">';
     echo '</div>';
 }
예제 #16
0
    /**
     * This is a general purpose hook, allowing modules to respond to routes
     * of the form module.php?mod=FOO&mod_action=BAR
     *
     * @param string $mod_action
     */
    public function modAction($mod_action)
    {
        switch ($mod_action) {
            case 'ajax':
                $html = $this->getSidebarAjaxContent();
                header('Content-Type: text/html; charset=UTF-8');
                echo $html;
                break;
            case 'index':
                global $controller, $WT_TREE;
                $MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS');
                $clip_ctrl = new ClippingsCartController();
                $cart = Session::get('cart');
                $controller = new PageController();
                $controller->setPageTitle($this->getTitle())->pageHeader()->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();');
                echo '<script>';
                echo 'function radAncestors(elementid) {var radFamilies=document.getElementById(elementid);radFamilies.checked=true;}';
                echo '</script>';
                if (!$cart[$WT_TREE->getTreeId()]) {
                    echo '<h2>', I18N::translate('Family tree clippings cart'), '</h2>';
                }
                if ($clip_ctrl->action == 'add') {
                    $record = GedcomRecord::getInstance($clip_ctrl->id, $WT_TREE);
                    if ($clip_ctrl->type === 'FAM') {
                        ?>
					<form action="module.php" method="get">
						<input type="hidden" name="mod" value="clippings">
						<input type="hidden" name="mod_action" value="index">
						<input type="hidden" name="id" value="<?php 
                        echo $clip_ctrl->id;
                        ?>
">
						<input type="hidden" name="type" value="<?php 
                        echo $clip_ctrl->type;
                        ?>
">
						<input type="hidden" name="action" value="add1">
						<table>
							<thead>
								<tr>
									<td class="topbottombar">
										<?php 
                        echo I18N::translate('Add to the clippings cart');
                        ?>
									</td>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td class="optionbox">
										<input type="radio" name="others" value="parents">
										<?php 
                        echo $record->getFullName();
                        ?>
									</td>
								</tr>
								<tr>
									<td class="optionbox">
										<input type="radio" name="others" value="members" checked>
										<?php 
                        echo I18N::translate('%s and their children', $record->getFullName());
                        ?>
									</td>
								</tr>
								<tr>
									<td class="optionbox">
										<input type="radio" name="others" value="descendants">
										<?php 
                        echo I18N::translate('%s and their descendants', $record->getFullName());
                        ?>
									</td>
								</tr>
							</tbody>
							<tfoot>
								<tr>
									<td class="topbottombar"><input type="submit" value="<?php 
                        echo I18N::translate('continue');
                        ?>
">
									</td>
								</tr>
							</tfoot>
						</table>
					</form>
				<?php 
                    } elseif ($clip_ctrl->type === 'INDI') {
                        ?>
					<form action="module.php" method="get">
						<input type="hidden" name="mod" value="clippings">
						<input type="hidden" name="mod_action" value="index">
						<input type="hidden" name="id" value="<?php 
                        echo $clip_ctrl->id;
                        ?>
">
						<input type="hidden" name="type" value="<?php 
                        echo $clip_ctrl->type;
                        ?>
">
						<input type="hidden" name="action" value="add1">
						<table>
							<thead>
								<tr>
									<td class="topbottombar">
										<?php 
                        echo I18N::translate('Add to the clippings cart');
                        ?>
									</td>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td class="optionbox">
										<label>
											<input type="radio" name="others" checked value="none">
											<?php 
                        echo $record->getFullName();
                        ?>
										</label>
									</td>
								</tr>
								<tr>
									<td class="optionbox">
										<label>
											<input type="radio" name="others" value="parents">
											<?php 
                        if ($record->getSex() === 'F') {
                            echo I18N::translate('%s, her parents and siblings', $record->getFullName());
                        } else {
                            echo I18N::translate('%s, his parents and siblings', $record->getFullName());
                        }
                        ?>
										</label>
									</td>
								</tr>
								<tr>
									<td class="optionbox">
										<label>
											<input type="radio" name="others" value="members">
											<?php 
                        if ($record->getSex() === 'F') {
                            echo I18N::translate('%s, her spouses and children', $record->getFullName());
                        } else {
                            echo I18N::translate('%s, his spouses and children', $record->getFullName());
                        }
                        ?>
										</label>
									</td>
								</tr>
								<tr>
									<td class="optionbox">
										<label>
											<input type="radio" name="others" value="ancestors" id="ancestors">
											<?php 
                        if ($record->getSex() === 'F') {
                            echo I18N::translate('%s and her ancestors', $record->getFullName());
                        } else {
                            echo I18N::translate('%s and his ancestors', $record->getFullName());
                        }
                        ?>
										</label>
										<br>
										<?php 
                        echo I18N::translate('Number of generations');
                        ?>
										<input type="text" size="5" name="level1" value="<?php 
                        echo $MAX_PEDIGREE_GENERATIONS;
                        ?>
" onfocus="radAncestors('ancestors');">
									</td>
								</tr>
								<tr>
									<td class="optionbox">
										<label>
											<input type="radio" name="others" value="ancestorsfamilies" id="ancestorsfamilies">
											<?php 
                        if ($record->getSex() === 'F') {
                            echo I18N::translate('%s, her ancestors and their families', $record->getFullName());
                        } else {
                            echo I18N::translate('%s, his ancestors and their families', $record->getFullName());
                        }
                        ?>
										</label>
										<br>
										<?php 
                        echo I18N::translate('Number of generations');
                        ?>
										<input type="text" size="5" name="level2" value="<?php 
                        echo $MAX_PEDIGREE_GENERATIONS;
                        ?>
" onfocus="radAncestors('ancestorsfamilies');">
									</td>
								</tr>
								<tr>
									<td class="optionbox">
										<label>
											<input type="radio" name="others" value="descendants" id="descendants">
											<?php 
                        if ($record->getSex() === 'F') {
                            echo I18N::translate('%s, her spouses and descendants', $record->getFullName());
                        } else {
                            echo I18N::translate('%s, his spouses and descendants', $record->getFullName());
                        }
                        ?>
										</label>
										<br>
										<?php 
                        echo I18N::translate('Number of generations');
                        ?>
										<input type="text" size="5" name="level3" value="<?php 
                        echo $MAX_PEDIGREE_GENERATIONS;
                        ?>
" onfocus="radAncestors('descendants');">
									</td>
								</tr>
							</tbody>
							<tfoot>
								<tr>
									<td class="topbottombar">
										<input type="submit" value="<?php 
                        echo I18N::translate('continue');
                        ?>
">
									</td>
								</tr>
							</tfoot>
						</table>
					</form>
				<?php 
                    } elseif ($clip_ctrl->type === 'SOUR') {
                        ?>
					<form action="module.php" method="get">
						<input type="hidden" name="mod" value="clippings">
						<input type="hidden" name="mod_action" value="index">
						<input type="hidden" name="id" value="<?php 
                        echo $clip_ctrl->id;
                        ?>
">
						<input type="hidden" name="type" value="<?php 
                        echo $clip_ctrl->type;
                        ?>
">
						<input type="hidden" name="action" value="add1">
						<table>
							<thead>
								<tr>
									<td class="topbottombar">
										<?php 
                        echo I18N::translate('Add to the clippings cart');
                        ?>
									</td>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td class="optionbox">
										<label>
											<input type="radio" name="others" checked value="none">
											<?php 
                        echo $record->getFullName();
                        ?>
										</label>
									</td>
								</tr>
								<tr>
									<td class="optionbox">
										<label>
											<input type="radio" name="others" value="linked">
											<?php 
                        echo I18N::translate('%s and the individuals that reference it.', $record->getFullName());
                        ?>
										</label>
									</td>
								</tr>
							</tbody>
							<tfoot>
								<tr>
									<td class="topbottombar">
										<input type="submit" value="<?php 
                        echo I18N::translate('continue');
                        ?>
">
									</td>
								</tr>
							</tfoot>
						</table>
					</form>
				<?php 
                    }
                }
                if (!$cart[$WT_TREE->getTreeId()]) {
                    if ($clip_ctrl->action != 'add') {
                        echo I18N::translate('The clippings cart allows you to take extracts (“clippings”) from this family tree and bundle them up into a single file for downloading and subsequent importing into your own genealogy program. The downloadable file is recorded in GEDCOM format.<br><ul><li>How to take clippings?<br>This is really simple. Whenever you see a clickable name (individual, family, or source) you can go to the Details page of that name. There you will see the <b>Add to clippings cart</b> option. When you click that link you will be offered several options to download.</li><li>How to download?<br>Once you have items in your cart, you can download them just by clicking the “Download” link. Follow the instructions and links.</li></ul>');
                        ?>
					<form method="get" name="addin" action="module.php">
						<input type="hidden" name="mod" value="clippings">
						<input type="hidden" name="mod_action" value="index">
						<table>
							<thead>
								<tr>
									<td colspan="2" class="topbottombar">
										<?php 
                        echo I18N::translate('Add to the clippings cart');
                        ?>
									</td>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td class="optionbox">
										<input type="hidden" name="action" value="add">
										<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="5">
									</td>
									<td class="optionbox">
										<?php 
                        echo FunctionsPrint::printFindIndividualLink('cart_item_id');
                        ?>
										<?php 
                        echo FunctionsPrint::printFindFamilyLink('cart_item_id');
                        ?>
										<?php 
                        echo FunctionsPrint::printFindSourceLink('cart_item_id', '');
                        ?>
										<input type="submit" value="<?php 
                        echo I18N::translate('Add');
                        ?>
">
									</td>
								</tr>
							</tbody>
						</table>
					</form>
					<?php 
                    }
                    // -- end new lines
                    echo I18N::translate('Your clippings cart is empty.');
                } else {
                    // Keep track of the INDI from the parent page, otherwise it will
                    // get lost after ajax updates
                    $pid = Filter::get('pid', WT_REGEX_XREF);
                    if ($clip_ctrl->action !== 'download' && $clip_ctrl->action !== 'add') {
                        ?>
					<form method="get" action="module.php">
						<input type="hidden" name="mod" value="clippings">
						<input type="hidden" name="mod_action" value="index">
						<input type="hidden" name="action" value="download">
						<input type="hidden" name="pid" value="<?php 
                        echo $pid;
                        ?>
">
						<table>
							<tr>
								<td colspan="2" class="topbottombar">
									<h2><?php 
                        echo I18N::translate('Download');
                        ?>
</h2>
								</td>
							</tr>
							<tr>
								<td class="descriptionbox width50 wrap">
									<?php 
                        echo I18N::translate('To reduce the size of the download, you can compress the data into a .ZIP file. You will need to uncompress the .ZIP file before you can use it.');
                        ?>
								</td>
								<td class="optionbox wrap">
									<input type="checkbox" name="Zip" value="yes">
									<?php 
                        echo I18N::translate('Zip file(s)');
                        ?>
								</td>
							</tr>
							<tr>
								<td class="descriptionbox width50 wrap">
									<?php 
                        echo I18N::translate('Include media (automatically zips files)');
                        ?>
								</td>
								<td class="optionbox">
									<input type="checkbox" name="IncludeMedia" value="yes">
								</td>
							</tr>

							<?php 
                        if (Auth::isManager($WT_TREE)) {
                            ?>
								<tr>
									<td class="descriptionbox width50 wrap">
										<?php 
                            echo I18N::translate('Apply privacy settings');
                            ?>
									</td>
									<td class="optionbox">
										<input type="radio" name="privatize_export" value="none" checked>
										<?php 
                            echo I18N::translate('None');
                            ?>
										<br>
										<input type="radio" name="privatize_export" value="gedadmin">
										<?php 
                            echo I18N::translate('Manager');
                            ?>
										<br>
										<input type="radio" name="privatize_export" value="user">
										<?php 
                            echo I18N::translate('Member');
                            ?>
										<br>
										<input type="radio" name="privatize_export" value="visitor">
										<?php 
                            echo I18N::translate('Visitor');
                            ?>
									</td>
								</tr>
							<?php 
                        } elseif (Auth::isMember($WT_TREE)) {
                            ?>
								<tr>
									<td class="descriptionbox width50 wrap">
										<?php 
                            echo I18N::translate('Apply privacy settings');
                            ?>
									</td>
									<td class="optionbox">
										<input type="radio" name="privatize_export" value="user" checked> <?php 
                            echo I18N::translate('Member');
                            ?>
<br>
										<input type="radio" name="privatize_export" value="visitor"> <?php 
                            echo I18N::translate('Visitor');
                            ?>
									</td>
								</tr>
							<?php 
                        }
                        ?>

							<tr>
								<td class="descriptionbox width50 wrap">
									<?php 
                        echo I18N::translate('Convert from UTF-8 to ISO-8859-1');
                        ?>
								</td>
								<td class="optionbox">
									<input type="checkbox" name="convert" value="yes">
								</td>
							</tr>

							<tr>
								<td class="descriptionbox width50 wrap">
									<?php 
                        echo I18N::translate('Add the GEDCOM media path to filenames');
                        ?>
								</td>
								<td class="optionbox">
									<input type="checkbox" name="conv_path" value="<?php 
                        echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH'));
                        ?>
">
									<span dir="auto"><?php 
                        echo Filter::escapeHtml($WT_TREE->getPreference('GEDCOM_MEDIA_PATH'));
                        ?>
</span>
								</td>
							</tr>

							<tr>
								<td class="topbottombar" colspan="2">
									<input type="submit" value="<?php 
                        echo I18N::translate('Download');
                        ?>
">
								</td>
							</tr>
						</table>
					</form>
					<br>

					<form method="get" name="addin" action="module.php">
						<input type="hidden" name="mod" value="clippings">
						<input type="hidden" name="mod_action" value="index">
						<table>
							<thead>
								<tr>
									<td colspan="2" class="topbottombar" style="text-align:center; ">
										<?php 
                        echo I18N::translate('Add to the clippings cart');
                        ?>
									</td>
								</tr>
							</thead>
							<tbody>
								<tr>
									<td class="optionbox">
										<input type="hidden" name="action" value="add">
										<input type="text" data-autocomplete-type="IFSRO" name="id" id="cart_item_id" size="8">
									</td>
									<td class="optionbox">
										<?php 
                        echo FunctionsPrint::printFindIndividualLink('cart_item_id');
                        ?>
										<?php 
                        echo FunctionsPrint::printFindFamilyLink('cart_item_id');
                        ?>
										<?php 
                        echo FunctionsPrint::printFindSourceLink('cart_item_id');
                        ?>
										<input type="submit" value="<?php 
                        echo I18N::translate('Add');
                        ?>
">
									</td>
								</tr>
							</tbody>
							<tfoot>
								<tr>
									<th colspan="2">
										<a href="module.php?mod=clippings&amp;mod_action=index&amp;action=empty">
											<?php 
                        echo I18N::translate('Empty the clippings cart');
                        ?>
										</a>
									</th>
								</tr>
							</tfoot>
						</table>
					</form>

				<?php 
                    }
                    ?>

				<h2>
					<?php 
                    echo I18N::translate('Family tree clippings cart');
                    ?>
				</h2>
				<table id="mycart" class="sortable list_table width100">
					<thead>
						<tr>
							<th class="list_label"><?php 
                    echo I18N::translate('Record');
                    ?>
</th>
							<th class="list_label"><?php 
                    echo I18N::translate('Remove');
                    ?>
</th>
						</tr>
					</thead>
					<tbody>
						<?php 
                    foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
                        $record = GedcomRecord::getInstance($xref, $WT_TREE);
                        if ($record) {
                            switch ($record::RECORD_TYPE) {
                                case 'INDI':
                                    $icon = 'icon-indis';
                                    break;
                                case 'FAM':
                                    $icon = 'icon-sfamily';
                                    break;
                                case 'SOUR':
                                    $icon = 'icon-source';
                                    break;
                                case 'REPO':
                                    $icon = 'icon-repository';
                                    break;
                                case 'NOTE':
                                    $icon = 'icon-note';
                                    break;
                                case 'OBJE':
                                    $icon = 'icon-media';
                                    break;
                                default:
                                    $icon = 'icon-clippings';
                                    break;
                            }
                            ?>
								<tr>
									<td class="list_value">
										<i class="<?php 
                            echo $icon;
                            ?>
"></i>
										<?php 
                            echo '<a href="', $record->getHtmlUrl(), '">', $record->getFullName(), '</a>';
                            ?>
									</td>
									<td class="list_value center vmiddle"><a href="module.php?mod=clippings&amp;mod_action=index&amp;action=remove&amp;id=<?php 
                            echo $xref;
                            ?>
" class="icon-remove" title="<?php 
                            echo I18N::translate('Remove');
                            ?>
"></a></td>
								</tr>
								<?php 
                        }
                    }
                    ?>
				</table>
				<?php 
                }
                break;
            default:
                http_response_code(404);
                break;
        }
    }
예제 #17
0
    /**
     * Edit places.
     */
    private function placesEdit()
    {
        $GM_MAX_ZOOM = $this->getSetting('GM_MAX_ZOOM');
        $action = Filter::post('action', null, Filter::get('action'));
        $placeid = Filter::post('placeid', null, Filter::get('placeid'));
        $place_name = Filter::post('place_name', null, Filter::get('place_name'));
        $controller = new SimpleController();
        $controller->restrictAccess(Auth::isAdmin())->setPageTitle(I18N::translate('Geographic data'))->addInlineJavascript('$("<link>", {rel: "stylesheet", type: "text/css", href: "' . WT_STATIC_URL . WT_MODULES_DIR . 'googlemap/css/wt_v3_googlemap.css"}).appendTo("head");')->pageHeader();
        $where_am_i = $this->placeIdToHierarchy($placeid);
        $level = count($where_am_i);
        if ($action == 'addrecord' && Auth::isAdmin()) {
            $statement = Database::prepare("INSERT INTO `##placelocation` (pl_id, pl_parent_id, pl_level, pl_place, pl_long, pl_lati, pl_zoom, pl_icon) VALUES (?, ?, ?, ?, ?, ?, ?, ?)");
            if ($_POST['LONG_CONTROL'] == '' || $_POST['NEW_PLACE_LONG'] == '' || $_POST['NEW_PLACE_LATI'] == '') {
                $statement->execute(array($this->getHighestIndex() + 1, $placeid, $level, $_POST['NEW_PLACE_NAME'], null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon']));
            } else {
                $statement->execute(array($this->getHighestIndex() + 1, $placeid, $level, $_POST['NEW_PLACE_NAME'], $_POST['LONG_CONTROL'][3] . $_POST['NEW_PLACE_LONG'], $_POST['LATI_CONTROL'][3] . $_POST['NEW_PLACE_LATI'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon']));
            }
            $controller->addInlineJavaScript('closePopupAndReloadParent();');
            echo "<div class=\"center\"><button onclick=\"closePopupAndReloadParent();return false;\">", I18N::translate('close'), "</button></div>";
            exit;
        }
        if ($action == 'updaterecord' && Auth::isAdmin()) {
            $statement = Database::prepare("UPDATE `##placelocation` SET pl_place=?, pl_lati=?, pl_long=?, pl_zoom=?, pl_icon=? WHERE pl_id=?");
            if ($_POST['LONG_CONTROL'] == '' || $_POST['NEW_PLACE_LONG'] == '' || $_POST['NEW_PLACE_LATI'] == '') {
                $statement->execute(array($_POST['NEW_PLACE_NAME'], null, null, $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'], $placeid));
            } else {
                $statement->execute(array($_POST['NEW_PLACE_NAME'], $_POST['LATI_CONTROL'][3] . $_POST['NEW_PLACE_LATI'], $_POST['LONG_CONTROL'][3] . $_POST['NEW_PLACE_LONG'], $_POST['NEW_ZOOM_FACTOR'], $_POST['icon'], $placeid));
            }
            $controller->addInlineJavaScript('closePopupAndReloadParent();');
            echo "<div class=\"center\"><button onclick=\"closePopupAndReloadParent();return false;\">", I18N::translate('close'), "</button></div>";
            exit;
        }
        // Update placelocation STREETVIEW fields
        // TODO: This ought to be a POST request, rather than a GET request
        if ($action == 'update_sv_params' && Auth::isAdmin()) {
            Database::prepare("UPDATE `##placelocation` SET sv_lati=?, sv_long=?, sv_bearing=?, sv_elevation=?, sv_zoom=? WHERE pl_id=?")->execute(array(Filter::get('svlati'), Filter::get('svlong'), Filter::get('svbear'), Filter::get('svelev'), Filter::get('svzoom'), $placeid));
            $controller->addInlineJavaScript('window.close();');
            exit;
        }
        if ($action === 'update') {
            // --- find the place in the file
            $row = Database::prepare("SELECT pl_place, pl_lati, pl_long, pl_icon, pl_parent_id, pl_level, pl_zoom FROM `##placelocation` WHERE pl_id=?")->execute(array($placeid))->fetchOneRow();
            $place_name = $row->pl_place;
            $place_icon = $row->pl_icon;
            $selected_country = explode("/", $place_icon);
            if (isset($selected_country[1]) && $selected_country[1] != "flags") {
                $selected_country = $selected_country[1];
            } else {
                $selected_country = "Countries";
            }
            $parent_id = $row->pl_parent_id;
            $level = $row->pl_level;
            $zoomfactor = $row->pl_zoom;
            $parent_lati = 0.0;
            $parent_long = 0.0;
            if ($row->pl_lati !== null && $row->pl_long !== null) {
                $place_lati = (double) str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati);
                $place_long = (double) str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long);
            } else {
                $place_lati = 0.0;
                $place_long = 0.0;
                $zoomfactor = 1;
            }
            do {
                $row = Database::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom FROM `##placelocation` WHERE pl_id=?")->execute(array($parent_id))->fetchOneRow();
                if (!$row) {
                    break;
                }
                if ($row->pl_lati !== null && $row->pl_long !== null) {
                    $parent_lati = (double) str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati);
                    $parent_long = (double) str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long);
                    if ($zoomfactor == 1) {
                        $zoomfactor = $row->pl_zoom;
                    }
                }
                $parent_id = $row->pl_parent_id;
            } while ($row->pl_parent_id != 0 && $row->pl_lati === null && $row->pl_long === null);
            echo '<b>', Filter::escapeHtml(str_replace('Unknown', I18N::translate('unknown'), implode(I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>';
        }
        if ($action === 'add') {
            // --- find the parent place in the file
            if ($placeid != 0) {
                $place_lati = 0.0;
                $place_long = 0.0;
                $zoomfactor = 1;
                $parent_lati = 0.0;
                $parent_long = 0.0;
                $place_icon = '';
                $parent_id = $placeid;
                do {
                    $row = Database::prepare("SELECT pl_lati, pl_long, pl_parent_id, pl_zoom, pl_level FROM `##placelocation` WHERE pl_id=?")->execute(array($parent_id))->fetchOneRow();
                    if ($row->pl_lati !== null && $row->pl_long !== null) {
                        $parent_lati = str_replace(array('N', 'S', ','), array('', '-', '.'), $row->pl_lati);
                        $parent_long = str_replace(array('E', 'W', ','), array('', '-', '.'), $row->pl_long);
                        $zoomfactor = $row->pl_zoom;
                        if ($zoomfactor > $GM_MAX_ZOOM) {
                            $zoomfactor = $GM_MAX_ZOOM;
                        }
                        $level = $row->pl_level + 1;
                    }
                    $parent_id = $row->pl_parent_id;
                } while ($row->pl_parent_id != 0 && $row->pl_lati === null && $row->pl_long === null);
            } else {
                $place_lati = 0.0;
                $place_long = 0.0;
                $parent_lati = 0.0;
                $parent_long = 0.0;
                $place_icon = '';
                $parent_id = 0;
                $level = 0;
                $zoomfactor = $this->getSetting('GM_MIN_ZOOM');
            }
            $selected_country = 'Countries';
            if ($place_name == '') {
                echo '<b>', I18N::translate('unknown');
            } else {
                echo '<b>', $place_name;
            }
            if (count($where_am_i) > 0) {
                echo ', ', Filter::escapeHtml(str_replace('Unknown', I18N::translate('unknown'), implode(I18N::$list_separator, array_reverse($where_am_i, true)))), '</b><br>';
            }
            echo '</b><br>';
        }
        ?>

			<script src="<?php 
        echo $this->googleMapsScript();
        ?>
"></script>
			<script>
			var map;
			var marker;
			var zoom;
			var pl_name = '<?php 
        echo Filter::escapeJs($place_name);
        ?>
';
			if (<?php 
        echo $place_lati;
        ?>
 !== 0.0 && <?php 
        echo $place_long;
        ?>
 !== 0.0) {
				var latlng = new google.maps.LatLng(<?php 
        echo $place_lati;
        ?>
, <?php 
        echo $place_long;
        ?>
);
			} else {
				var latlng = new google.maps.LatLng(<?php 
        echo $parent_lati;
        ?>
, <?php 
        echo $parent_long;
        ?>
);
			}
			var pl_zoom = <?php 
        echo $zoomfactor;
        ?>
;
			var polygon1;
			var polygon2;
			var geocoder;
			var mapType;

			var infowindow = new google.maps.InfoWindow({
				//
			});

			function geocodePosition(pos) {
				geocoder.geocode({
					latLng: pos
				}, function(responses) {
					if (responses && responses.length > 0) {
						updateMarkerAddress(responses[0].formatted_address);
					} else {
						updateMarkerAddress('Cannot determine address at this location.');
					}
				});
			}

			function updateMap(event) {
				var point;
				var zoom = parseInt(document.editplaces.NEW_ZOOM_FACTOR.value);
				var latitude;
				var longitude;
				var i;
				var prec = 20;

				for (i=0;i<document.editplaces.NEW_PRECISION.length;i++) {
					if (document.editplaces.NEW_PRECISION[i].checked) {
						prec = document.editplaces.NEW_PRECISION[i].value;
					}
				}
				if ((document.editplaces.NEW_PLACE_LATI.value == '') ||
					(document.editplaces.NEW_PLACE_LONG.value == '')) {
					latitude = parseFloat(document.editplaces.parent_lati.value).toFixed(prec);
					longitude = parseFloat(document.editplaces.parent_long.value).toFixed(prec);
					point = new google.maps.LatLng(latitude, longitude);
				} else {
					latitude = parseFloat(document.editplaces.NEW_PLACE_LATI.value).toFixed(prec);
					longitude = parseFloat(document.editplaces.NEW_PLACE_LONG.value).toFixed(prec);
					document.editplaces.NEW_PLACE_LATI.value = latitude;
					document.editplaces.NEW_PLACE_LONG.value = longitude;

					if (event == 'flag_drag') {
						if (longitude < 0.0 ) {
							longitude = longitude * -1;
							document.editplaces.NEW_PLACE_LONG.value = longitude;
							document.editplaces.LONG_CONTROL.value = 'PL_W';
						} else {
							document.editplaces.NEW_PLACE_LONG.value = longitude;
							document.editplaces.LONG_CONTROL.value = 'PL_E';
						}
						if (latitude < 0.0 ) {
							latitude = latitude * -1;
							document.editplaces.NEW_PLACE_LATI.value = latitude;
							document.editplaces.LATI_CONTROL.value = 'PL_S';
						} else {
							document.editplaces.NEW_PLACE_LATI.value = latitude;
							document.editplaces.LATI_CONTROL.value = 'PL_N';
						}

						if (document.editplaces.LATI_CONTROL.value == 'PL_S') {
							latitude = latitude * -1;
						}
						if (document.editplaces.LONG_CONTROL.value == 'PL_W') {
							longitude = longitude * -1;
						}
						point = new google.maps.LatLng(latitude, longitude);
					} else {
						if (latitude < 0.0) {
							latitude = latitude * -1;
							document.editplaces.NEW_PLACE_LATI.value = latitude;
						}
						if (longitude < 0.0) {
							longitude = longitude * -1;
							document.editplaces.NEW_PLACE_LONG.value = longitude;
						}
						if (document.editplaces.LATI_CONTROL.value == 'PL_S') {
							latitude = latitude * -1;
						}
						if (document.editplaces.LONG_CONTROL.value == 'PL_W') {
							longitude = longitude * -1;
						}
						point = new google.maps.LatLng(latitude, longitude);
					}
				}

				map.setCenter(point);
				map.setZoom(zoom);
				marker.setPosition(point);

			}

			// === Create Borders for the UK Countries =========================================================
			function overlays() {

				// Define place LatLng arrays
				var polygon1;
				var num_arrays = "";
				if (pl_name == 'Scotland') {
					var returnGeom1 = '-2.02166,55.80611|-2.07972,55.86722|-2.13028,55.88583|-2.26028,55.91861|-2.37528,55.95694|-2.65722,56.05972|-2.82028,56.05694|-2.86618,56.02840|-2.89555,55.98861|-2.93500,55.96944|-3.01805,55.94944|-3.06750,55.94444|-3.25472,55.97166|-3.45472,55.99194|-3.66416,56.00652|-3.73722,56.05555|-3.57139,56.05360|-3.44111,56.01916|-3.39584,56.01083|-3.34403,56.02333|-3.13903,56.11084|-2.97611,56.19472|-2.91666,56.20499|-2.84695,56.18638|-2.78805,56.18749|-2.67937,56.21465|-2.58403,56.28264|-2.67208,56.32277|-2.76861,56.33180|-2.81528,56.37360|-2.81208,56.43958|-2.91653,56.45014|-2.99555,56.41416|-3.19042,56.35958|-3.27805,56.35750|-3.04055,56.45472|-2.95861,56.45611|-2.72084,56.48888|-2.64084,56.52250|-2.53126,56.57611|-2.48861,56.61416|-2.47805,56.71527|-2.39000,56.77166|-2.31986,56.79638|-2.21972,56.86777|-2.19708,56.94388|-2.16695,57.00055|-2.09334,57.07027|-2.05416,57.21861|-1.95889,57.33250|-1.85584,57.39889|-1.77334,57.45805|-1.78139,57.50555|-1.82195,57.57861|-1.86000,57.62138|-1.92972,57.67777|-2.02222,57.69388|-2.07555,57.69944|-2.14028,57.69056|-2.18611,57.66861|-2.39626,57.66638|-2.51000,57.67166|-2.78639,57.70222|-2.89806,57.70694|-2.96750,57.68027|-3.03847,57.66249|-3.12334,57.67166|-3.22334,57.69166|-3.28625,57.72499|-3.33972,57.72333|-3.48805,57.70945|-3.52222,57.66333|-3.59542,57.63666|-3.64063,57.63881|-3.75414,57.62504|-4.03986,57.55569|-4.19666,57.48584|-4.22889,57.51554|-4.17945,57.56249|-4.11139,57.59833|-4.08078,57.66533|-4.19139,57.67139|-4.25945,57.65527|-4.34361,57.60777|-4.41639,57.60166|-4.29666,57.67444|-4.08528,57.72611|-4.01908,57.70226|-3.96861,57.70250|-3.86556,57.76861|-3.81945,57.80458|-3.80681,57.85819|-3.85055,57.82000|-3.92639,57.80749|-4.04322,57.81438|-4.14973,57.82527|-4.29750,57.84638|-4.36250,57.89777|-4.24306,57.87028|-4.10666,57.85195|-4.01500,57.86777|-3.99166,57.90611|-3.99695,57.95056|-3.84500,58.02000|-3.56611,58.13916|-3.51319,58.16374|-3.45916,58.20305|-3.42028,58.24361|-3.33750,58.27694|-3.20555,58.30625|-3.10972,58.38166|-3.05792,58.45083|-3.02264,58.64653|-3.17639,58.64944|-3.35389,58.66055|-3.36931,58.59555|-3.57611,58.62194|-3.66028,58.61972|-3.71166,58.60374|-3.78264,58.56750|-3.84834,58.56000|-4.08056,58.55527|-4.27722,58.53361|-4.43653,58.54902|-4.50666,58.56777|-4.56055,58.57584|-4.59910,58.53027|-4.66805,58.48833|-4.76146,58.44604|-4.70195,58.50999|-4.70166,58.55861|-4.77014,58.60264|-5.00153,58.62416|-5.10945,58.50833|-5.16472,58.32527|-5.12639,58.28750|-5.07166,58.26472|-5.20361,58.25083|-5.39764,58.25055|-5.27389,58.11722|-5.31514,58.06416|-5.38416,58.08361|-5.45285,58.07416|-5.39805,58.03111|-5.26278,57.97111|-5.19334,57.95069|-5.12750,57.86944|-5.21750,57.90084|-5.33861,57.92083|-5.42876,57.90104|-5.45750,57.85889|-5.64445,57.89972|-5.62555,57.85222|-5.58153,57.81945|-5.60674,57.76618|-5.66305,57.78889|-5.71695,57.86944|-5.76695,57.86472|-5.81708,57.81944|-5.81084,57.63958|-5.69555,57.55944|-5.64361,57.55222|-5.53084,57.52833|-5.65305,57.50875|-5.75000,57.54834|-5.81569,57.57923|-5.85042,57.54972|-5.86695,57.46777|-5.81806,57.36250|-5.75111,57.34333|-5.50334,57.40111|-5.45126,57.41805|-5.49250,57.37083|-5.59884,57.33049|-5.57116,57.28411|-5.51266,57.27745|-5.40514,57.23097|-5.44972,57.22138|-5.49472,57.23888|-5.56066,57.25477|-5.64611,57.23499|-5.64751,57.16161|-5.55028,57.11639|-5.48166,57.11222|-5.40305,57.11062|-5.55945,57.09250|-5.65111,57.11611|-5.72472,57.11306|-5.77361,57.04556|-5.63139,56.98499|-5.56916,56.98972|-5.52403,56.99735|-5.57916,56.98000|-5.64611,56.97222|-5.73374,57.00909|-5.82584,57.00346|-5.91958,56.88708|-5.86528,56.87944|-5.74278,56.89374|-5.66292,56.86924|-5.73306,56.83916|-5.78584,56.83955|-5.85590,56.81430|-5.80208,56.79180|-5.84958,56.74444|-5.90500,56.75666|-5.96694,56.78027|-6.14000,56.75777|-6.19208,56.74888|-6.23452,56.71673|-6.19139,56.67972|-5.91916,56.67388|-5.82622,56.69156|-5.73945,56.71166|-5.55240,56.68886|-5.64861,56.68027|-5.69916,56.68278|-5.88261,56.65666|-5.97472,56.65138|-5.99584,56.61138|-5.93056,56.56972|-5.88416,56.55333|-5.79056,56.53805|-5.67695,56.49389|-5.56389,56.54056|-5.36334,56.66195|-5.23416,56.74333|-5.13236,56.79403|-5.31473,56.65666|-5.37405,56.55925|-5.31826,56.55633|-5.25080,56.55753|-5.37718,56.52112|-5.39866,56.47866|-5.19111,56.46194|-5.11556,56.51277|-5.07014,56.56069|-5.13555,56.48499|-5.22084,56.43583|-5.32764,56.43574|-5.42439,56.43091|-5.52611,56.37360|-5.57139,56.32833|-5.59653,56.25695|-5.57389,56.16000|-5.52000,56.16485|-5.56334,56.11333|-5.60139,56.07638|-5.64222,56.04305|-5.66039,55.98263|-5.62555,56.02055|-5.58014,56.01319|-5.63361,55.96611|-5.67697,55.88844|-5.64750,55.78139|-5.60986,55.75930|-5.66916,55.66166|-5.70166,55.58861|-5.71805,55.51500|-5.75916,55.41750|-5.79528,55.36027|-5.78166,55.29902|-5.73778,55.29222|-5.56694,55.31666|-5.51528,55.36347|-5.55520,55.41440|-5.48639,55.64306|-5.44597,55.70680|-5.38000,55.75027|-5.41889,55.90666|-5.39924,55.99972|-5.33895,56.03456|-5.30594,56.06922|-5.23889,56.11889|-5.03222,56.23250|-4.92229,56.27111|-4.97416,56.23333|-5.07222,56.18695|-5.20069,56.11861|-5.30906,56.00570|-5.34000,55.90201|-5.29250,55.84750|-5.20805,55.84444|-5.22458,55.90175|-5.17334,55.92916|-5.11000,55.90306|-5.01222,55.86694|-4.96195,55.88000|-4.89824,55.98145|-4.84623,56.08632|-4.86636,56.03178|-4.85461,55.98648|-4.77659,55.97977|-4.62723,55.94555|-4.52305,55.91861|-4.70972,55.93403|-4.75166,55.94611|-4.82406,55.94950|-4.87826,55.93653|-4.91639,55.70083|-4.87584,55.68194|-4.81361,55.64555|-4.68722,55.59750|-4.61361,55.49069|-4.63958,55.44264|-4.68250,55.43388|-4.74847,55.41055|-4.83715,55.31882|-4.84778,55.26944|-4.86542,55.22340|-4.93500,55.17860|-5.01250,55.13347|-5.05361,55.04902|-5.17834,54.98888|-5.18563,54.93622|-5.17000,54.89111|-5.11666,54.83180|-5.00500,54.76333|-4.96229,54.68125|-4.92250,54.64055|-4.85723,54.62958|-4.96076,54.79687|-4.92431,54.83708|-4.85222,54.86861|-4.80125,54.85556|-4.74055,54.82166|-4.68084,54.79972|-4.59861,54.78027|-4.55792,54.73903|-4.49639,54.69888|-4.37584,54.67666|-4.34569,54.70916|-4.35973,54.77111|-4.41111,54.82583|-4.42445,54.88152|-4.38479,54.90555|-4.35056,54.85903|-4.09555,54.76777|-3.95361,54.76749|-3.86972,54.80527|-3.81222,54.84888|-3.69250,54.88110|-3.61584,54.87527|-3.57111,54.99083|-3.44528,54.98638|-3.36056,54.97138|-3.14695,54.96500|-3.05103,54.97986|-3.01500,55.05222|-2.96278,55.03889|-2.69945,55.17722|-2.63055,55.25500|-2.46305,55.36111|-2.21236,55.42777|-2.18278,55.45985|-2.21528,55.50583|-2.27416,55.57527|-2.27916,55.64472|-2.22000,55.66499|-2.08361,55.78054|-2.02166,55.80611';
					num_arrays = 1;
				} else if (pl_name == 'England') {
					// England
					var returnGeom1 = '-4.74361,50.66750|-4.78361,50.59361|-4.91584,50.57722|-5.01750,50.54264|-5.02569,50.47271|-5.04729,50.42750|-5.15208,50.34374|-5.26805,50.27389|-5.43194,50.19326|-5.49584,50.21695|-5.54639,50.20527|-5.71000,50.12916|-5.71681,50.06083|-5.66174,50.03631|-5.58278,50.04777|-5.54166,50.07055|-5.53416,50.11569|-5.47055,50.12499|-5.33361,50.09138|-5.27666,50.05972|-5.25674,50.00514|-5.19306,49.95527|-5.16070,50.00319|-5.06555,50.03750|-5.07090,50.08166|-5.04806,50.17111|-4.95278,50.19333|-4.85750,50.23166|-4.76250,50.31138|-4.67861,50.32583|-4.54334,50.32222|-4.48278,50.32583|-4.42972,50.35139|-4.38000,50.36388|-4.16555,50.37028|-4.11139,50.33027|-4.05708,50.29791|-3.94389,50.31346|-3.87764,50.28139|-3.83653,50.22972|-3.78944,50.21222|-3.70666,50.20972|-3.65195,50.23111|-3.55139,50.43833|-3.49416,50.54639|-3.46181,50.58792|-3.41139,50.61610|-3.24416,50.67444|-3.17347,50.68833|-3.09445,50.69222|-2.97806,50.70638|-2.92750,50.73125|-2.88278,50.73111|-2.82305,50.72027|-2.77139,50.70861|-2.66195,50.67334|-2.56305,50.63222|-2.45861,50.57500|-2.44666,50.62639|-2.39097,50.64166|-2.19722,50.62611|-2.12195,50.60722|-2.05445,50.58569|-1.96437,50.59674|-1.95441,50.66536|-2.06681,50.71430|-1.93416,50.71277|-1.81639,50.72306|-1.68445,50.73888|-1.59278,50.72416|-1.33139,50.79138|-1.11695,50.80694|-1.15889,50.84083|-1.09445,50.84584|-0.92842,50.83966|-0.86584,50.79965|-0.90826,50.77396|-0.78187,50.72722|-0.74611,50.76583|-0.67528,50.78111|-0.57722,50.79527|-0.25500,50.82638|-0.19084,50.82583|-0.13805,50.81833|0.05695,50.78083|0.12334,50.75944|0.22778,50.73944|0.28695,50.76500|0.37195,50.81638|0.43084,50.83111|0.56722,50.84777|0.67889,50.87681|0.71639,50.90500|0.79334,50.93610|0.85666,50.92556|0.97125,50.98111|0.99778,51.01903|1.04555,51.04944|1.10028,51.07361|1.26250,51.10166|1.36889,51.13583|1.41111,51.20111|1.42750,51.33111|1.38556,51.38777|1.19195,51.37861|1.05278,51.36722|0.99916,51.34777|0.90806,51.34069|0.70416,51.37749|0.61972,51.38304|0.55945,51.40596|0.64236,51.44042|0.69750,51.47084|0.59195,51.48777|0.53611,51.48806|0.48916,51.48445|0.45215,51.45562|0.38894,51.44822|0.46500,51.50306|0.65195,51.53680|0.76695,51.52138|0.82084,51.53556|0.87528,51.56110|0.95250,51.60923|0.94695,51.72556|0.90257,51.73465|0.86306,51.71166|0.76140,51.69164|0.70111,51.71847|0.86211,51.77361|0.93236,51.80583|0.98278,51.82527|1.03569,51.77416|1.08834,51.77056|1.13222,51.77694|1.18139,51.78972|1.22361,51.80888|1.26611,51.83916|1.28097,51.88096|1.20834,51.95083|1.16347,52.02361|1.27750,51.98555|1.33125,51.92875|1.39028,51.96999|1.58736,52.08388|1.63000,52.19527|1.68576,52.32630|1.73028,52.41138|1.74945,52.45583|1.74590,52.62021|1.70250,52.71583|1.64528,52.77111|1.50361,52.83749|1.43222,52.87472|1.35250,52.90972|1.28222,52.92750|1.18389,52.93889|0.99472,52.95111|0.94222,52.95083|0.88472,52.96638|0.66722,52.97611|0.54778,52.96618|0.49139,52.93430|0.44431,52.86569|0.42903,52.82403|0.36334,52.78027|0.21778,52.80694|0.16125,52.86250|0.05778,52.88916|0.00211,52.87985|0.03222,52.91722|0.20389,53.02805|0.27666,53.06694|0.33916,53.09236|0.35389,53.18722|0.33958,53.23472|0.23555,53.39944|0.14347,53.47527|0.08528,53.48638|0.02694,53.50972|-0.10084,53.57306|-0.20722,53.63083|-0.26445,53.69083|-0.30166,53.71319|-0.39022,53.70794|-0.51972,53.68527|-0.71653,53.69638|-0.65445,53.72527|-0.60584,53.72972|-0.54916,53.70611|-0.42261,53.71755|-0.35728,53.73056|-0.29389,53.73666|-0.23139,53.72166|-0.10584,53.63166|-0.03472,53.62555|0.04416,53.63916|0.08916,53.62666|0.14945,53.58847|0.12639,53.64527|0.06264,53.70389|-0.12750,53.86388|-0.16916,53.91847|-0.21222,54.00833|-0.20569,54.05153|-0.16111,54.08806|-0.11694,54.13222|-0.20053,54.15171|-0.26250,54.17444|-0.39334,54.27277|-0.42166,54.33222|-0.45750,54.37694|-0.51847,54.44749|-0.56472,54.48000|-0.87584,54.57027|-1.06139,54.61722|-1.16528,54.64972|-1.30445,54.77138|-1.34556,54.87138|-1.41278,54.99944|-1.48292,55.08625|-1.51500,55.14972|-1.56584,55.28722|-1.58097,55.48361|-1.63597,55.58194|-1.69000,55.60556|-1.74695,55.62499|-1.81764,55.63306|-1.97681,55.75416|-2.02166,55.80611|-2.08361,55.78054|-2.22000,55.66499|-2.27916,55.64472|-2.27416,55.57527|-2.21528,55.50583|-2.18278,55.45985|-2.21236,55.42777|-2.46305,55.36111|-2.63055,55.25500|-2.69945,55.17722|-2.96278,55.03889|-3.01500,55.05222|-3.05103,54.97986|-3.13292,54.93139|-3.20861,54.94944|-3.28931,54.93792|-3.39166,54.87639|-3.42916,54.81555|-3.56916,54.64249|-3.61306,54.48861|-3.49305,54.40333|-3.43389,54.34806|-3.41056,54.28014|-3.38055,54.24444|-3.21472,54.09555|-3.15222,54.08194|-2.93097,54.15333|-2.81361,54.22277|-2.81750,54.14277|-2.83361,54.08500|-2.93250,53.95055|-3.05264,53.90764|-3.03708,53.74944|-2.99278,53.73277|-2.89979,53.72499|-2.97729,53.69382|-3.07306,53.59805|-3.10563,53.55993|-3.00678,53.41738|-2.95389,53.36027|-2.85736,53.32083|-2.70493,53.35062|-2.77639,53.29250|-2.89972,53.28916|-2.94250,53.31056|-3.02889,53.38191|-3.07248,53.40936|-3.16695,53.35708|-3.12611,53.32500|-3.08860,53.26001|-3.02000,53.24722|-2.95528,53.21555|-2.91069,53.17014|-2.89389,53.10416|-2.85695,53.03249|-2.77792,52.98514|-2.73109,52.96873|-2.71945,52.91902|-2.79278,52.90207|-2.85069,52.93875|-2.99389,52.95361|-3.08639,52.91611|-3.13014,52.88486|-3.13708,52.79312|-3.06806,52.77027|-3.01111,52.71166|-3.06666,52.63527|-3.11750,52.58666|-3.07089,52.55702|-3.00792,52.56902|-2.98028,52.53083|-3.02736,52.49792|-3.11916,52.49194|-3.19514,52.46722|-3.19611,52.41027|-3.02195,52.34027|-2.95486,52.33117|-2.99750,52.28139|-3.05125,52.23347|-3.07555,52.14804|-3.12222,52.11805|-3.11250,52.06945|-3.08500,52.01930|-3.04528,51.97639|-2.98889,51.92555|-2.91757,51.91569|-2.86639,51.92889|-2.77861,51.88583|-2.65944,51.81806|-2.68334,51.76957|-2.68666,51.71889|-2.66500,51.61500|-2.62916,51.64416|-2.57889,51.67777|-2.46056,51.74666|-2.40389,51.74041|-2.47166,51.72445|-2.55305,51.65722|-2.65334,51.56389|-2.77055,51.48916|-2.85278,51.44472|-2.96000,51.37499|-3.00695,51.30722|-3.01278,51.25632|-3.02834,51.20611|-3.30139,51.18111|-3.39361,51.18138|-3.43729,51.20638|-3.50722,51.22333|-3.57014,51.23027|-3.63222,51.21805|-3.70028,51.23000|-3.79250,51.23916|-3.88389,51.22416|-3.98472,51.21695|-4.11666,51.21222|-4.22805,51.18777|-4.22028,51.11054|-4.23702,51.04659|-4.30361,51.00416|-4.37639,50.99110|-4.42736,51.00958|-4.47445,51.01416|-4.52132,51.01424|-4.54334,50.92694|-4.56139,50.77625|-4.65139,50.71527|-4.74361,50.66750'; //|-3.08860,53.26001|-3.33639,53.34722|-3.38806,53.34361|-3.60986,53.27944|-3.73014,53.28944|-3.85445,53.28444|-4.01861,53.23750|-4.06639,53.22639|-4.15334,53.22556|-4.19639,53.20611|-4.33028,53.11222|-4.36097,53.02888|-4.55278,52.92889|-4.61889,52.90916|-4.72195,52.83611|-4.72778,52.78139|-4.53945,52.79306|-4.47722,52.85500|-4.41416,52.88472|-4.31292,52.90499|-4.23334,52.91499|-4.13569,52.87888|-4.13056,52.77777|-4.05334,52.71666|-4.10639,52.65084|-4.12597,52.60375|-4.08056,52.55333|-4.05972,52.48584|-4.09666,52.38583|-4.14305,52.32027|-4.19361,52.27638|-4.23166,52.24888|-4.52722,52.13083|-4.66945,52.13027|-4.73695,52.10361|-4.76778,52.06444|-4.84445,52.01388|-5.09945,51.96056|-5.23916,51.91638|-5.25889,51.87056|-5.18500,51.86958|-5.11528,51.83333|-5.10257,51.77895|-5.16111,51.76222|-5.24694,51.73027|-5.19111,51.70888|-5.00739,51.70349|-4.90875,51.71249|-4.86111,51.71334|-4.97061,51.67577|-5.02128,51.66861|-5.05139,51.62028|-5.00528,51.60638|-4.94139,51.59416|-4.89028,51.62694|-4.83569,51.64534|-4.79063,51.63340|-4.69028,51.66666|-4.64584,51.72666|-4.57445,51.73416|-4.43611,51.73722|-4.26222,51.67694|-4.19750,51.67916|-4.06614,51.66804|-4.11639,51.63416|-4.17750,51.62235|-4.25055,51.62861|-4.29208,51.60743|-4.27778,51.55666|-4.20486,51.53527|-3.94972,51.61278|-3.83792,51.61999|-3.78166,51.56750|-3.75160,51.52931|-3.67194,51.47388|-3.54250,51.39777|-3.40334,51.37972|-3.27097,51.38014|-3.16458,51.40909|-3.15166,51.45305|-3.11875,51.48750|-3.02111,51.52527|-2.95472,51.53972|-2.89278,51.53861|-2.84778,51.54500|-2.71472,51.58083|-2.66500,51.61500|-2.68666,51.71889|-2.68334,51.76957|-2.65944,51.81806|-2.77861,51.88583|-2.86639,51.92889|-2.91757,51.91569|-2.98889,51.92555|-3.04528,51.97639|-3.08500,52.01930|-3.11250,52.06945|-3.12222,52.11805|-3.07555,52.14804|-3.05125,52.23347|-2.99750,52.28139|-2.95486,52.33117|-3.02195,52.34027|-3.19611,52.41027|-3.19514,52.46722|-3.11916,52.49194|-3.02736,52.49792|-2.98028,52.53083|-3.00792,52.56902|-3.07089,52.55702|-3.11750,52.58666|-3.06666,52.63527|-3.01111,52.71166|-3.06806,52.77027|-3.13708,52.79312|-3.13014,52.88486|-3.08639,52.91611|-2.99389,52.95361|-2.85069,52.93875|-2.79278,52.90207|-2.71945,52.91902|-2.73109,52.96873|-2.77792,52.98514|-2.85695,53.03249|-2.89389,53.10416|-2.91069,53.17014|-2.95528,53.21555|-3.02000,53.24722|-3.08860,53.26001';
					// Wales Test
			//		var returnGeom2 = '-3.08860,53.26001|-3.33639,53.34722|-3.38806,53.34361|-3.60986,53.27944|-3.73014,53.28944|-3.85445,53.28444|-4.01861,53.23750|-4.06639,53.22639|-4.15334,53.22556|-4.19639,53.20611|-4.33028,53.11222|-4.36097,53.02888|-4.55278,52.92889|-4.61889,52.90916|-4.72195,52.83611|-4.72778,52.78139|-4.53945,52.79306|-4.47722,52.85500|-4.41416,52.88472|-4.31292,52.90499|-4.23334,52.91499|-4.13569,52.87888|-4.13056,52.77777|-4.05334,52.71666|-4.10639,52.65084|-4.12597,52.60375|-4.08056,52.55333|-4.05972,52.48584|-4.09666,52.38583|-4.14305,52.32027|-4.19361,52.27638|-4.23166,52.24888|-4.52722,52.13083|-4.66945,52.13027|-4.73695,52.10361|-4.76778,52.06444|-4.84445,52.01388|-5.09945,51.96056|-5.23916,51.91638|-5.25889,51.87056|-5.18500,51.86958|-5.11528,51.83333|-5.10257,51.77895|-5.16111,51.76222|-5.24694,51.73027|-5.19111,51.70888|-5.00739,51.70349|-4.90875,51.71249|-4.86111,51.71334|-4.97061,51.67577|-5.02128,51.66861|-5.05139,51.62028|-5.00528,51.60638|-4.94139,51.59416|-4.89028,51.62694|-4.83569,51.64534|-4.79063,51.63340|-4.69028,51.66666|-4.64584,51.72666|-4.57445,51.73416|-4.43611,51.73722|-4.26222,51.67694|-4.19750,51.67916|-4.06614,51.66804|-4.11639,51.63416|-4.17750,51.62235|-4.25055,51.62861|-4.29208,51.60743|-4.27778,51.55666|-4.20486,51.53527|-3.94972,51.61278|-3.83792,51.61999|-3.78166,51.56750|-3.75160,51.52931|-3.67194,51.47388|-3.54250,51.39777|-3.40334,51.37972|-3.27097,51.38014|-3.16458,51.40909|-3.15166,51.45305|-3.11875,51.48750|-3.02111,51.52527|-2.95472,51.53972|-2.89278,51.53861|-2.84778,51.54500|-2.71472,51.58083|-2.66500,51.61500|-2.68666,51.71889|-2.68334,51.76957|-2.65944,51.81806|-2.77861,51.88583|-2.86639,51.92889|-2.91757,51.91569|-2.98889,51.92555|-3.04528,51.97639|-3.08500,52.01930|-3.11250,52.06945|-3.12222,52.11805|-3.07555,52.14804|-3.05125,52.23347|-2.99750,52.28139|-2.95486,52.33117|-3.02195,52.34027|-3.19611,52.41027|-3.19514,52.46722|-3.11916,52.49194|-3.02736,52.49792|-2.98028,52.53083|-3.00792,52.56902|-3.07089,52.55702|-3.11750,52.58666|-3.06666,52.63527|-3.01111,52.71166|-3.06806,52.77027|-3.13708,52.79312|-3.13014,52.88486|-3.08639,52.91611|-2.99389,52.95361|-2.85069,52.93875|-2.79278,52.90207|-2.71945,52.91902|-2.73109,52.96873|-2.77792,52.98514|-2.85695,53.03249|-2.89389,53.10416|-2.91069,53.17014|-2.95528,53.21555|-3.02000,53.24722|-3.08860,53.26001';
					num_arrays = 2;
				} else if (pl_name == 'Wales') {
					var returnGeom1 = '-3.08860,53.26001|-3.33639,53.34722|-3.38806,53.34361|-3.60986,53.27944|-3.73014,53.28944|-3.85445,53.28444|-4.01861,53.23750|-4.06639,53.22639|-4.15334,53.22556|-4.19639,53.20611|-4.33028,53.11222|-4.36097,53.02888|-4.55278,52.92889|-4.61889,52.90916|-4.72195,52.83611|-4.72778,52.78139|-4.53945,52.79306|-4.47722,52.85500|-4.41416,52.88472|-4.31292,52.90499|-4.23334,52.91499|-4.13569,52.87888|-4.13056,52.77777|-4.05334,52.71666|-4.10639,52.65084|-4.12597,52.60375|-4.08056,52.55333|-4.05972,52.48584|-4.09666,52.38583|-4.14305,52.32027|-4.19361,52.27638|-4.23166,52.24888|-4.52722,52.13083|-4.66945,52.13027|-4.73695,52.10361|-4.76778,52.06444|-4.84445,52.01388|-5.09945,51.96056|-5.23916,51.91638|-5.25889,51.87056|-5.18500,51.86958|-5.11528,51.83333|-5.10257,51.77895|-5.16111,51.76222|-5.24694,51.73027|-5.19111,51.70888|-5.00739,51.70349|-4.90875,51.71249|-4.86111,51.71334|-4.97061,51.67577|-5.02128,51.66861|-5.05139,51.62028|-5.00528,51.60638|-4.94139,51.59416|-4.89028,51.62694|-4.83569,51.64534|-4.79063,51.63340|-4.69028,51.66666|-4.64584,51.72666|-4.57445,51.73416|-4.43611,51.73722|-4.26222,51.67694|-4.19750,51.67916|-4.06614,51.66804|-4.11639,51.63416|-4.17750,51.62235|-4.25055,51.62861|-4.29208,51.60743|-4.27778,51.55666|-4.20486,51.53527|-3.94972,51.61278|-3.83792,51.61999|-3.78166,51.56750|-3.75160,51.52931|-3.67194,51.47388|-3.54250,51.39777|-3.40334,51.37972|-3.27097,51.38014|-3.16458,51.40909|-3.15166,51.45305|-3.11875,51.48750|-3.02111,51.52527|-2.95472,51.53972|-2.89278,51.53861|-2.84778,51.54500|-2.71472,51.58083|-2.66500,51.61500|-2.68666,51.71889|-2.68334,51.76957|-2.65944,51.81806|-2.77861,51.88583|-2.86639,51.92889|-2.91757,51.91569|-2.98889,51.92555|-3.04528,51.97639|-3.08500,52.01930|-3.11250,52.06945|-3.12222,52.11805|-3.07555,52.14804|-3.05125,52.23347|-2.99750,52.28139|-2.95486,52.33117|-3.02195,52.34027|-3.19611,52.41027|-3.19514,52.46722|-3.11916,52.49194|-3.02736,52.49792|-2.98028,52.53083|-3.00792,52.56902|-3.07089,52.55702|-3.11750,52.58666|-3.06666,52.63527|-3.01111,52.71166|-3.06806,52.77027|-3.13708,52.79312|-3.13014,52.88486|-3.08639,52.91611|-2.99389,52.95361|-2.85069,52.93875|-2.79278,52.90207|-2.71945,52.91902|-2.73109,52.96873|-2.77792,52.98514|-2.85695,53.03249|-2.89389,53.10416|-2.91069,53.17014|-2.95528,53.21555|-3.02000,53.24722|-3.08860,53.26001';
					num_arrays = 1;
				} else if (pl_name == 'Ireland') {
					var returnGeom1 = '-8.17166,54.46388|-8.06555,54.37277|-7.94139,54.29944|-7.87576,54.28499|-7.86834,54.22764|-7.81805,54.19916|-7.69972,54.20250|-7.55945,54.12694|-7.31334,54.11250|-7.14584,54.22527|-7.17555,54.28916|-7.16084,54.33666|-7.05834,54.41000|-6.97445,54.40166|-6.92695,54.37916|-6.87305,54.34208|-6.85111,54.28972|-6.73473,54.18361|-6.65556,54.06527|-6.60584,54.04444|-6.44750,54.05833|-6.33889,54.11555|-6.26697,54.09983|-6.17403,54.07222|-6.10834,54.03638|-6.04389,54.03139|-5.96834,54.06389|-5.88500,54.11639|-5.87347,54.20916|-5.82500,54.23958|-5.74611,54.24806|-5.65556,54.22701|-5.60834,54.24972|-5.55916,54.29084|-5.57334,54.37704|-5.64502,54.49267|-5.70472,54.53361|-5.68055,54.57306|-5.59972,54.54194|-5.55097,54.50083|-5.54216,54.44903|-5.54643,54.40527|-5.50672,54.36444|-5.46111,54.38555|-5.43132,54.48596|-5.47945,54.53638|-5.53521,54.65090|-5.57431,54.67722|-5.62916,54.67945|-5.73674,54.67383|-5.80305,54.66138|-5.88257,54.60652|-5.92445,54.63180|-5.86681,54.68972|-5.81903,54.70972|-5.74672,54.72452|-5.68775,54.76335|-5.70931,54.83166|-5.74694,54.85361|-5.79139,54.85139|-6.03611,55.05778|-6.04250,55.10277|-6.03444,55.15458|-6.10125,55.20945|-6.14584,55.22069|-6.25500,55.21194|-6.37639,55.23916|-6.51556,55.23305|-6.61334,55.20722|-6.73028,55.18027|-6.82472,55.16806|-6.88972,55.16777|-6.96695,55.15611|-6.99416,55.11027|-7.05139,55.04680|-7.09500,55.03694|-7.25251,55.07059|-7.32639,55.04527|-7.40639,54.95333|-7.45805,54.85777|-7.55334,54.76277|-7.73916,54.71054|-7.82576,54.73416|-7.92639,54.70054|-7.85236,54.63388|-7.77750,54.62694|-7.83361,54.55389|-7.95084,54.53222|-8.04695,54.50722|-8.17166,54.46388';
					num_arrays = 1;
				} else if (pl_name == 'NC') {
					var returnGeom1 = '-81.65876,36.60938|-81.70390,36.55513|-81.70639,36.50804|-81.74665,36.39777|-81.90723,36.30804|-82.03195,36.12694|-82.08416,36.10146|-82.12826,36.11020|-82.21500,36.15833|-82.36375,36.11347|-82.43472,36.06013|-82.46236,36.01708|-82.56006,35.96263|-82.60042,35.99638|-82.62308,36.06121|-82.73500,36.01833|-82.84612,35.94944|-82.90451,35.88819|-82.93555,35.83846|-83.16000,35.76236|-83.24222,35.71944|-83.49222,35.57111|-83.56847,35.55861|-83.64416,35.56471|-83.73499,35.56638|-83.88222,35.51791|-83.98361,35.44944|-84.03639,35.35444|-84.04964,35.29117|-84.09042,35.25986|-84.15084,35.25388|-84.20521,35.25722|-84.29284,35.22596|-84.32471,34.98701|-83.09778,35.00027|-82.77722,35.09138|-82.59639,35.14972|-82.37999,35.21500|-82.27362,35.20583|-81.41306,35.17416|-81.05915,35.15333|-80.92666,35.10695|-80.78751,34.95610|-80.79334,34.82555|-79.66777,34.80694|-79.11555,34.34527|-78.57222,33.88166|-78.51806,33.87999|-78.43721,33.89804|-78.23735,33.91986|-78.15389,33.91471|-78.06974,33.89500|-78.02597,33.88936|-77.97611,33.94276|-77.95299,33.99243|-77.94499,34.06499|-77.92728,34.11756|-77.92250,33.99194|-77.92264,33.93715|-77.88215,34.06166|-77.86222,34.15083|-77.83501,34.19194|-77.75724,34.28527|-77.68222,34.36555|-77.63667,34.39805|-77.57363,34.43694|-77.45527,34.50403|-77.38173,34.51646|-77.37905,34.56294|-77.38572,34.61260|-77.40944,34.68916|-77.38847,34.73304|-77.33097,34.63992|-77.35024,34.60099|-77.30958,34.55972|-77.09424,34.67742|-76.75994,34.76659|-76.68325,34.79749|-76.66097,34.75781|-76.62611,34.71014|-76.50063,34.73617|-76.48138,34.77638|-76.38305,34.86423|-76.34326,34.88194|-76.27181,34.96263|-76.35125,35.02221|-76.32354,34.97429|-76.45319,34.93524|-76.43395,34.98782|-76.45356,35.06676|-76.52917,35.00444|-76.63382,34.98242|-76.69722,34.94887|-76.75306,34.90526|-76.81636,34.93944|-76.89000,34.95388|-76.93180,34.96957|-76.96501,34.99777|-77.06816,35.14978|-76.97639,35.06806|-76.86722,35.00000|-76.80531,34.98559|-76.72708,35.00152|-76.60402,35.07416|-76.56555,35.11486|-76.57305,35.16013|-76.66489,35.16694|-76.56361,35.23361|-76.48750,35.22582|-76.46889,35.27166|-76.50298,35.30791|-76.83251,35.39222|-77.02305,35.48694|-77.04958,35.52694|-76.91292,35.46166|-76.65250,35.41499|-76.61611,35.45888|-76.63195,35.52249|-76.58820,35.55104|-76.51556,35.53194|-76.56711,35.48494|-76.52251,35.40416|-76.46195,35.37221|-76.13319,35.35986|-76.04111,35.42416|-76.00223,35.46610|-75.97958,35.51666|-75.89362,35.57555|-75.83834,35.56694|-75.78944,35.57138|-75.74076,35.61846|-75.72084,35.69263|-75.72084,35.81451|-75.74917,35.87791|-75.78333,35.91972|-75.85083,35.97527|-75.94333,35.91777|-75.98944,35.88054|-75.98854,35.79110|-75.99388,35.71027|-76.02875,35.65409|-76.10320,35.66041|-76.13563,35.69239|-76.04475,35.68436|-76.04167,35.74916|-76.05305,35.79361|-76.05305,35.87375|-76.02653,35.96222|-76.07751,35.99319|-76.17472,35.99596|-76.27917,35.91915|-76.37986,35.95763|-76.42014,35.97874|-76.55375,35.93971|-76.66222,35.93305|-76.72952,35.93984|-76.73392,36.04760|-76.75384,36.09477|-76.76028,36.14513|-76.74610,36.22818|-76.70458,36.24673|-76.72764,36.16736|-76.71021,36.11752|-76.69117,36.07165|-76.65979,36.03312|-76.49527,36.00958|-76.37138,36.07694|-76.37084,36.14999|-76.21417,36.09471|-76.07591,36.17910|-76.18361,36.26915|-76.19965,36.31739|-76.13986,36.28805|-76.04274,36.21974|-76.00465,36.18110|-75.95287,36.19241|-75.97604,36.31138|-75.93895,36.28381|-75.85271,36.11069|-75.79315,36.07385|-75.79639,36.11804|-75.88333,36.29554|-75.94665,36.37194|-75.98694,36.41166|-76.03473,36.49666|-76.02899,36.55000|-78.44234,36.54986|-78.56594,36.55799|-80.27556,36.55110|-81.15361,36.56499|-81.38722,36.57695|-81.65876,36.60938';
					num_arrays = 1;
				} else {
					// show nothing
				}

			/*
				// Set borders and fill parameters ------- Not finished yet. ---------------
				if (map.mapTypeId == 'roadmap') {
					var colorStroke 	= "#444444";
					var weightStroke	= 1.2;
					var opacityFill		= 0.1;
				} else if (map.mapTypeId == 'satellite') {
					var colorStroke 	= "#000000";
					var weightStroke	= 0.1;
					var opacityFill		= 0;
				} else if (map.mapTypeId == 'hybrid') {
					var colorStroke 	= "#ffffff";
					var weightStroke	= 1.2;
					var opacityFill		= 0;
				} else if (map.mapTypeId == 'terrain') {
					var colorStroke 	= "#ffffff";
					var weightStroke	= 1.2;
					var opacityFill		= 0;
				}
				// -------------------------------------------------------------------------
			*/

				// If showing one country only (num_arrays == 1) ---------------------------
				// Calculate polygon
				if (num_arrays == 1 ) {
					var geomAry1 = returnGeom1.split('|');
					var XY1 = [];
					var points1 = [];
					for (var i = 0; i < geomAry1.length; i++) {
						XY1 = geomAry1[i].split(',');
						points1.push( new google.maps.LatLng(parseFloat(XY1[1]),parseFloat(XY1[0]))) ;
					}
					// Construct the polygon
					polygon1 = new google.maps.Polygon({
						paths: points1,
						strokeColor: "#888888",
						strokeOpacity: 0.8,
						strokeWeight: 1,
						fillColor: "#ff0000",
						fillOpacity: 0.15
					});
					polygon1.setMap(map);
				}

				// If showing two countries at the same time (num_arrays == 2) --------------
				if (num_arrays == 2) {
					// Calculate polygon1
					var geomAry1 = returnGeom1.split('|');
					var XY1 = [];
					var points1 = [];
					for (var i = 0; i < geomAry1.length; i++) {
						XY1 = geomAry1[i].split(',');
						points1.push( new google.maps.LatLng(parseFloat(XY1[1]),parseFloat(XY1[0]))) ;
					}

					// Construct polygon1
					polygon1 = new google.maps.Polygon({
						paths: points1,
						strokeColor: "#888888",
						strokeOpacity: 0.8,
						strokeWeight: 1,
						fillColor: "#ff0000",
						fillOpacity: 0.15
					});
					polygon1.setMap(map);

					// Calculate polygon2
					var geomAry2 = returnGeom2.split('|');
					var XY2 = [];
					var points2 = [];
					for (var i = 0; i < geomAry2.length; i++) {
						XY2 = geomAry2[i].split(',');
						points2.push( new google.maps.LatLng(parseFloat(XY2[1]),parseFloat(XY2[0]))) ;
					}

					// Construct polygon2
					polygon2 = new google.maps.Polygon({
						paths: points2,
						strokeColor: "#888888",
						strokeOpacity: 0.8,
						strokeWeight: 1,
						fillColor: "#ff0000",
						fillOpacity: 0.15
					});
					polygon2.setMap(map);
				}
			}

			// The HomeControl returns user to original position and style =================
			function HomeControl(controlDiv, map) {
				// Set CSS styles for the DIV containing the control
				// Setting padding to 5 px will offset the control from the edge of the map
				controlDiv.style.paddingTop = '5px';
				controlDiv.style.paddingRight = '0px';

				// Set CSS for the control border
				var controlUI = document.createElement('DIV');
				controlUI.style.backgroundColor = 'white';
				controlUI.style.color = 'black';
				controlUI.style.borderColor = 'black';
				controlUI.style.borderColor = 'black';
				controlUI.style.borderStyle = 'solid';
				controlUI.style.borderWidth = '2px';
				controlUI.style.cursor = 'pointer';
				controlUI.style.textAlign = 'center';
				controlUI.title = '';
				controlDiv.appendChild(controlUI);

				// Set CSS for the control interior
				var controlText = document.createElement('DIV');
				controlText.style.fontFamily = 'Arial,sans-serif';
				controlText.style.fontSize = '12px';
				controlText.style.paddingLeft = '15px';
				controlText.style.paddingRight = '15px';
				controlText.innerHTML = '<b><?php 
        echo I18N::translate('Redraw map');
        ?>
<\/b>';
				controlUI.appendChild(controlText);

				// Setup the click event listeners: simply set the map to original LatLng
				google.maps.event.addDomListener(controlUI, 'click', function() {
					map.setCenter(latlng);
					map.setZoom(pl_zoom);
					map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
				});
			}

			function loadMap(zoom, mapType) {
				var mapTyp;

				if (mapType) {
					mapTyp = mapType;
				} else {
					mapTyp = google.maps.MapTypeId.ROADMAP;
				}
				geocoder = new google.maps.Geocoder();
				if (!zoom) {
					zoom = pl_zoom;
				}
				// Define map
				var myOptions = {
					zoom: zoom,
					center: latlng,
					mapTypeId: mapTyp,// ROADMAP, SATELLITE, HYBRID, TERRAIN
					// mapTypeId: google.maps.MapTypeId.ROADMAP, // ROADMAP, SATELLITE, HYBRID, TERRAIN
					mapTypeControlOptions: {
						style: google.maps.MapTypeControlStyle.DROPDOWN_MENU // DEFAULT, DROPDOWN_MENU, HORIZONTAL_BAR
					},
					navigationControlOptions: {
					position: google.maps.ControlPosition.TOP_RIGHT, // BOTTOM, BOTTOM_LEFT, LEFT, TOP, etc
					style: google.maps.NavigationControlStyle.SMALL // ANDROID, DEFAULT, SMALL, ZOOM_PAN
					},
					streetViewControl: false, // Show Pegman or not
					scrollwheel: true
				};

				map = new google.maps.Map(document.getElementById('map_pane'), myOptions);

				overlays();

				// Close any infowindow when map is clicked
				google.maps.event.addListener(map, 'click', function() {
					infowindow.close();
				});

				// Create the DIV to hold the control and call HomeControl() passing in this DIV. --
				var homeControlDiv = document.createElement('DIV');
				var homeControl = new HomeControl(homeControlDiv, map);
				homeControlDiv.index = 1;
				map.controls[google.maps.ControlPosition.TOP_RIGHT].push(homeControlDiv);
				// ---------------------------------------------------------------------------------

				// Check for zoom changes
				google.maps.event.addListener(map, 'zoom_changed', function() {
					document.editplaces.NEW_ZOOM_FACTOR.value = map.zoom;
				});

				// Create the Main Location Marker
				<?php 
        if ($level < 3 && $place_icon != '') {
            echo 'var image = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place_icon, '",';
            echo 'new google.maps.Size(25, 15),';
            // Image size
            echo 'new google.maps.Point(0, 0),';
            // Image origin
            echo 'new google.maps.Point(12, 15)';
            // Image anchor
            echo ');';
            echo 'var iconShadow = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/flag_shadow.png",';
            echo 'new google.maps.Size(35, 45),';
            // Shadow size
            echo 'new google.maps.Point(0,0),';
            // Shadow origin
            echo 'new google.maps.Point(1, 45)';
            // Shadow anchor is base of flagpole
            echo ');';
            echo 'marker = new google.maps.Marker({';
            echo 'icon: image,';
            echo 'shadow: iconShadow,';
            echo 'position: latlng,';
            echo 'map: map,';
            echo 'title: pl_name,';
            echo 'draggable: true,';
            echo 'zIndex:1';
            echo '});';
        } else {
            echo 'marker = new google.maps.Marker({';
            echo 'position: latlng,';
            echo 'map: map,';
            echo 'title: pl_name,';
            echo 'draggable: true,';
            echo 'zIndex: 1';
            echo '});';
        }
        ?>

				var prec = 20;
				for (var i=0;i<document.editplaces.NEW_PRECISION.length;i++) {
					if (document.editplaces.NEW_PRECISION[i].checked) {
						prec = document.editplaces.NEW_PRECISION[i].value;
					}
				}

				// Set marker by clicking on map ---
				google.maps.event.addListener(map, 'click', function(event) {
					clearMarks();
					latlng = event.latLng;
					<?php 
        echo 'marker = new google.maps.Marker({';
        echo 'position: latlng,';
        echo 'map: map,';
        echo 'title: pl_name,';
        echo 'draggable: true,';
        echo 'zIndex: 1';
        echo '});';
        ?>
					var pos3 = marker.getPosition();
					document.getElementById('NEW_PLACE_LATI').value = parseFloat(pos3.lat()).toFixed(prec);
					document.getElementById('NEW_PLACE_LONG').value = parseFloat(pos3.lng()).toFixed(prec);
					updateMap('flag_drag');
					var currzoom = parseInt(document.editplaces.NEW_ZOOM_FACTOR.value);
					mapType = map.getMapTypeId();
					loadMap(currzoom, mapType);
				});

				// Set marker by drag-n-drop on map ---
				google.maps.event.addListener(marker, 'drag', function() {
					var pos1 = marker.getPosition();
					document.getElementById('NEW_PLACE_LATI').value = parseFloat(pos1.lat()).toFixed(prec);
					document.getElementById('NEW_PLACE_LONG').value = parseFloat(pos1.lng()).toFixed(prec);
				});
				google.maps.event.addListener(marker, 'dragend', function() {
					var pos2 = marker.getPosition();
					document.getElementById('NEW_PLACE_LATI').value = parseFloat(pos2.lat()).toFixed(prec);
					document.getElementById('NEW_PLACE_LONG').value = parseFloat(pos2.lng()).toFixed(prec);
					updateMap('flag_drag');
				});
			}

			function clearMarks() {
				marker.setMap(null);
			}

			function setLoc(lat, lng) {
				var prec = 20;
				for (var i=0;i<document.editplaces.NEW_PRECISION.length;i++) {
					if (document.editplaces.NEW_PRECISION[i].checked) {
						prec = document.editplaces.NEW_PRECISION[i].value;
					}
				}
				if (lat < 0.0) {
					document.editplaces.NEW_PLACE_LATI.value = (lat.toFixed(prec) * -1);
					document.editplaces.LATI_CONTROL.value = 'PL_S';
				} else {
					document.editplaces.NEW_PLACE_LATI.value = lat.toFixed(prec);
					document.editplaces.LATI_CONTROL.value = 'PL_N';
				}
				if (lng < 0.0) {
					document.editplaces.NEW_PLACE_LONG.value = (lng.toFixed(prec) * -1);
					document.editplaces.LONG_CONTROL.value = 'PL_W';
				} else {
					document.editplaces.NEW_PLACE_LONG.value = lng.toFixed(prec);
					document.editplaces.LONG_CONTROL.value = 'PL_E';
				}
				new google.maps.LatLng (lat.toFixed(prec), lng.toFixed(prec));
				updateMap();
			}

			function createMarker(i, point, name) {
				var contentString = '<div id="iwcontent_edit">'+name+'<\/div>';
				<?php 
        echo 'var image = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/marker_yellow.png",';
        echo 'new google.maps.Size(20, 34),';
        // Image size
        echo 'new google.maps.Point(0, 0),';
        // Image origin
        echo 'new google.maps.Point(10, 34)';
        // Image anchor
        echo ');';
        echo 'var iconShadow = new google.maps.MarkerImage("', WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/images/shadow50.png",';
        echo 'new google.maps.Size(37, 34),';
        // Shadow size
        echo 'new google.maps.Point(0, 0),';
        // Shadow origin
        echo 'new google.maps.Point(10, 34)';
        // Shadow anchor is base of image
        echo ');';
        ?>
				var marker = new google.maps.Marker({
					icon: image,
					shadow: iconShadow,
					map: map,
					position: point,
					zIndex: 0
				});

				google.maps.event.addListener(marker, 'click', function() {
					infowindow.close();
					infowindow.setContent(contentString);
					infowindow.open(map, marker);
				});

				google.maps.event.addListener(map, 'click', function() {
					infowindow.close();
				});

				return marker;
			}

			function change_icon() {
				window.open('module.php?mod=googlemap&mod_action=flags&countrySelected=<?php 
        echo $selected_country;
        ?>
', '_blank', indx_window_specs);
				return false;
			}

			function remove_icon() {
				document.editplaces.icon.value = '';
				document.getElementById('flagsDiv').innerHTML = '<a href="#" onclick="change_icon();return false;"><?php 
        echo I18N::translate('Change flag');
        ?>
</a>';
			}

			function addAddressToMap(response) {
				var bounds = new google.maps.LatLngBounds();
				if (!response ) {
					alert('<?php 
        echo I18N::translate('No places found');
        ?>
');
				} else {
					if (response.length > 0) {
						for (var i=0; i<response.length; i++) {
							// 5 decimal places is approx 1 metre accuracy.
							var name  = '<div id="gname" class="iwstyle">'+response[i].address_components[0].short_name+'<br>('+response[i].geometry.location.lng().toFixed(5)+','+response[i].geometry.location.lat().toFixed(5)+'';
								name +=	'<br><a href="#" onclick="setLoc(' + response[i].geometry.location.lat() + ', ' + response[i].geometry.location.lng() + ');"><div id="namelink"><?php 
        echo I18N::translate('Use this value');
        ?>
</div></a>';
								name += '</div>';
							var point = response[i].geometry.location;
							var marker = createMarker(i, point, name);
							bounds.extend(response[i].geometry.location);
						}

						<?php 
        if ($level > 0) {
            ?>
							map.fitBounds(bounds);
						<?php 
        }
        ?>
						var zoomlevel = map.getZoom();

						if (zoomlevel < <?php 
        echo $this->getSetting('GM_MIN_ZOOM');
        ?>
) {
							zoomlevel = <?php 
        echo $this->getSetting('GM_MIN_ZOOM');
        ?>
;
						}
						if (zoomlevel > <?php 
        echo $this->getSetting('GM_MAX_ZOOM');
        ?>
) {
							zoomlevel = <?php 
        echo $this->getSetting('GM_MAX_ZOOM');
        ?>
;
						}
						if (document.editplaces.NEW_ZOOM_FACTOR.value < zoomlevel) {
							zoomlevel = document.editplaces.NEW_ZOOM_FACTOR.value;
							if (zoomlevel < <?php 
        echo $this->getSetting('GM_MIN_ZOOM');
        ?>
) {
								zoomlevel = <?php 
        echo $this->getSetting('GM_MIN_ZOOM');
        ?>
;
							}
							if (zoomlevel > <?php 
        echo $this->getSetting('GM_MAX_ZOOM');
        ?>
) {
								zoomlevel = <?php 
        echo $this->getSetting('GM_MAX_ZOOM');
        ?>
;
							}
						}
						map.setCenter(bounds.getCenter());
						map.setZoom(zoomlevel);
					}
				}
			}

			function showLocation_level(address) {
				address += '<?php 
        if ($level > 0) {
            echo ', ', addslashes(implode(', ', array_reverse($where_am_i, true)));
        }
        ?>
';
				geocoder.geocode({'address': address}, addAddressToMap);
			}

			function showLocation_all(address) {
				geocoder.geocode({'address': address}, addAddressToMap);
			}

			function paste_char(value) {
				document.editplaces.NEW_PLACE_NAME.value += value;
			}
			window.onload = function() { loadMap(); };
		</script>
		<table><tr><td align="center">
		</td></tr></table>
		</body>
		<form method="post" id="editplaces" name="editplaces" action="module.php?mod=googlemap&amp;mod_action=places_edit">
			<input type="hidden" name="action" value="<?php 
        echo $action;
        ?>
record">
			<input type="hidden" name="placeid" value="<?php 
        echo $placeid;
        ?>
">
			<input type="hidden" name="level" value="<?php 
        echo $level;
        ?>
">
			<input type="hidden" name="icon" value="<?php 
        echo $place_icon;
        ?>
">
			<input type="hidden" name="parent_id" value="<?php 
        echo $parent_id;
        ?>
">
			<input type="hidden" name="place_long" value="<?php 
        echo $place_long;
        ?>
">
			<input type="hidden" name="place_lati" value="<?php 
        echo $place_lati;
        ?>
">
			<input type="hidden" name="parent_long" value="<?php 
        echo $parent_long;
        ?>
">
			<input type="hidden" name="parent_lati" value="<?php 
        echo $parent_lati;
        ?>
">

			<table class="facts_table">
			<tr>
				<td class="optionbox" colspan="3">
				<center><div id="map_pane" style="width: 100%; height: 300px;"></div></center>
				</td>
			</tr>
			<tr>
				<td class="descriptionbox"><?php 
        echo GedcomTag::getLabel('PLAC');
        ?>
</td>
				<td class="optionbox"><input type="text" id="new_pl_name" name="NEW_PLACE_NAME" value="<?php 
        echo Filter::escapeHtml($place_name);
        ?>
" size="25" class="address_input">
					<div id="INDI_PLAC_pop" style="display: inline;">
					<?php 
        echo FunctionsPrint::printSpecialCharacterLink('new_pl_name');
        ?>
</div></td><td class="optionbox">
					<label for="new_pl_name"><a href="#" onclick="showLocation_all(document.getElementById('new_pl_name').value); return false">&nbsp;<?php 
        echo I18N::translate('Search globally');
        ?>
</a></label>
					&nbsp;&nbsp;|&nbsp;&nbsp;
					<label for="new_pl_name"><a href="#" onclick="showLocation_level(document.getElementById('new_pl_name').value); return false">&nbsp;<?php 
        echo I18N::translate('Search locally');
        ?>
</a></label>
				</td>
			</tr>
			<tr>
				<td class="descriptionbox">
					<?php 
        echo I18N::translate('Precision');
        ?>
				</td>
				<?php 
        $exp = explode(".", $place_lati);
        if (isset($exp[1])) {
            $precision1 = strlen($exp[1]);
        } else {
            $precision1 = -1;
        }
        $exp = explode(".", $place_long);
        if (isset($exp[1])) {
            $precision2 = strlen($exp[1]);
        } else {
            $precision2 = -1;
        }
        $precision1 > $precision2 ? $precision = $precision1 : ($precision = $precision2);
        if ($precision == -1) {
            $level > 3 ? $precision = 3 : ($precision = $level);
        } elseif ($precision > 5) {
            $precision = 5;
        }
        ?>
				<td class="optionbox" colspan="2">
					<input type="radio" id="new_prec_0" name="NEW_PRECISION" onchange="updateMap();" <?php 
        if ($precision == $this->getSetting('GM_PRECISION_0')) {
            echo 'checked';
        }
        ?>
 value="<?php 
        echo $this->getSetting('GM_PRECISION_0');
        ?>
">
					<label for="new_prec_0"><?php 
        echo I18N::translate('Country');
        ?>
</label>
					<input type="radio" id="new_prec_1" name="NEW_PRECISION" onchange="updateMap();" <?php 
        if ($precision == $this->getSetting('GM_PRECISION_1')) {
            echo 'checked';
        }
        ?>
 value="<?php 
        echo $this->getSetting('GM_PRECISION_1');
        ?>
">
					<label for="new_prec_1"><?php 
        echo I18N::translate('State');
        ?>
</label>
					<input type="radio" id="new_prec_2" name="NEW_PRECISION" onchange="updateMap();" <?php 
        if ($precision == $this->getSetting('GM_PRECISION_2')) {
            echo 'checked';
        }
        ?>
 value="<?php 
        echo $this->getSetting('GM_PRECISION_2');
        ?>
">
					<label for="new_prec_2"><?php 
        echo I18N::translate('City');
        ?>
</label>
					<input type="radio" id="new_prec_3" name="NEW_PRECISION" onchange="updateMap();" <?php 
        if ($precision == $this->getSetting('GM_PRECISION_3')) {
            echo 'checked';
        }
        ?>
 value="<?php 
        echo $this->getSetting('GM_PRECISION_3');
        ?>
">
					<label for="new_prec_3"><?php 
        echo I18N::translate('Neighborhood');
        ?>
</label>
					<input type="radio" id="new_prec_4" name="NEW_PRECISION" onchange="updateMap();" <?php 
        if ($precision == $this->getSetting('GM_PRECISION_4')) {
            echo 'checked';
        }
        ?>
 value="<?php 
        echo $this->getSetting('GM_PRECISION_4');
        ?>
">
					<label for="new_prec_4"><?php 
        echo I18N::translate('House');
        ?>
</label>
					<input type="radio" id="new_prec_5" name="NEW_PRECISION" onchange="updateMap();" <?php 
        if ($precision >= $this->getSetting('GM_PRECISION_5')) {
            echo 'checked';
        }
        ?>
 value="<?php 
        echo $this->getSetting('GM_PRECISION_5');
        ?>
">
					<label for="new_prec_5"><?php 
        echo I18N::translate('Max');
        ?>
</label>
					<p class="small text-muted">
						<?php 
        echo I18N::translate('Here you can enter the precision.  Based on this setting the number of digits that will be used in the latitude and longitude is determined.');
        ?>
					</p>
				</td>
			</tr>
			<tr>
				<td class="descriptionbox"><?php 
        echo GedcomTag::getLabel('LATI');
        ?>
</td>
				<td class="optionbox" colspan="2">
					<input type="text" id="NEW_PLACE_LATI" name="NEW_PLACE_LATI" placeholder="<?php 
        echo I18N::translate('degrees');
        ?>
" value="<?php 
        echo abs($place_lati);
        ?>
" size="20" onchange="updateMap();">
					<select name="LATI_CONTROL" onchange="updateMap();">
						<option value="PL_N" <?php 
        if ($place_lati >= 0) {
            echo "selected";
        }
        echo ">", I18N::translate('north');
        ?>
</option>
						<option value="PL_S" <?php 
        if ($place_lati < 0) {
            echo "selected";
        }
        echo ">", I18N::translate('south');
        ?>
</option>
					</select>
				</td>
			</tr>
			<tr>
				<td class="descriptionbox"><?php 
        echo GedcomTag::getLabel('LONG');
        ?>
</td>
				<td class="optionbox" colspan="2">
					<input type="text" id="NEW_PLACE_LONG" name="NEW_PLACE_LONG" placeholder="<?php 
        echo I18N::translate('degrees');
        ?>
" value="<?php 
        echo abs($place_long);
        ?>
" size="20" onchange="updateMap();">
					<select name="LONG_CONTROL" onchange="updateMap();">
						<option value="PL_E" <?php 
        if ($place_long >= 0) {
            echo "selected";
        }
        echo ">", I18N::translate('east');
        ?>
</option>
						<option value="PL_W" <?php 
        if ($place_long < 0) {
            echo "selected";
        }
        echo ">", I18N::translate('west');
        ?>
</option>
					</select>
				</td>
			</tr>
			<tr>
				<td class="descriptionbox">
					<?php 
        echo I18N::translate('Zoom level');
        ?>
				</td>
				<td class="optionbox" colspan="2">
					<input type="text" id="NEW_ZOOM_FACTOR" name="NEW_ZOOM_FACTOR" value="<?php 
        echo $zoomfactor;
        ?>
" size="20" onchange="updateMap();">
					<p class="small text-muted">
						<?php 
        echo I18N::translate('Here the zoom level can be entered.  This value will be used as the minimal value when displaying this geographic location on a map.');
        ?>
					</p>
				</td>
			</tr>
			<tr>
				<td class="descriptionbox">
					<?php 
        echo I18N::translate('Flag');
        ?>
				</td>
				<td class="optionbox" colspan="2">
					<div id="flagsDiv">
						<?php 
        if ($place_icon) {
            ?>
			<img alt="<?php 
            echo I18N::translate('Flag');
            ?>
" src="<?php 
            echo WT_STATIC_URL, WT_MODULES_DIR, 'googlemap/', $place_icon;
            ?>
">&nbsp;&nbsp;
			<a href="#" onclick="change_icon();return false;"><?php 
            echo I18N::translate('Change flag');
            ?>
</a>&nbsp;&nbsp;
			<a href="#" onclick="remove_icon();return false;"><?php 
            echo I18N::translate('Remove flag');
            ?>
</a>
						<?php 
        } else {
            ?>
			<a href="#" onclick="change_icon();return false;"><?php 
            echo I18N::translate('Change flag');
            ?>
</a>
						<?php 
        }
        ?>
					</div>
					<p class="small text-muted">
						<?php 
        echo I18N::translate('Here an icon can be set or removed.  Using this link a flag can be selected.  When this geographic location is shown, this flag will be displayed.');
        ?>
					</p>
				</td>
			</tr>
			</table>
			<p id="save-cancel">
				<input type="submit" class="save" value="<?php 
        echo I18N::translate('save');
        ?>
">
				<input type="button" class="cancel" value="<?php 
        echo I18N::translate('close');
        ?>
" onclick="window.close();">
			</p>
		</form>
		<?php 
    }
예제 #18
0
파일: Fact.php 프로젝트: tunandras/webtrees
 /**
  * A one-line summary of the fact - for charts, etc.
  *
  * @return string
  */
 public function summary()
 {
     $attributes = array();
     $target = $this->getTarget();
     if ($target) {
         $attributes[] = $target->getFullName();
     } else {
         $value = $this->getValue();
         if ($value && $value != 'Y') {
             $attributes[] = '<span dir="auto">' . Filter::escapeHtml($value) . '</span>';
         }
         $date = $this->getDate();
         if ($this->getTag() == 'BIRT' && $this->getParent() instanceof Individual && $this->getParent()->getTree()->getPreference('SHOW_PARENTS_AGE')) {
             $attributes[] = $date->display() . FunctionsPrint::formatParentsAges($this->getParent(), $date);
         } else {
             $attributes[] = $date->display();
         }
         $place = $this->getPlace()->getShortName();
         if ($place) {
             $attributes[] = $place;
         }
     }
     $class = 'fact_' . $this->getTag();
     if ($this->isPendingAddition()) {
         $class .= ' new';
     } elseif ($this->isPendingDeletion()) {
         $class .= ' old';
     }
     return '<div class="' . $class . '">' . I18N::translate('<span class="label">%1$s:</span> <span class="field" dir="auto">%2$s</span>', $this->getLabel(), implode(' — ', $attributes)) . '</div>';
 }
예제 #19
0
파일: Stats.php 프로젝트: AlexSnet/webtrees
 /**
  * Events
  *
  * @param string $type
  * @param string $direction
  * @param string $facts
  *
  * @return string
  */
 private function eventQuery($type, $direction, $facts)
 {
     $eventTypes = array('BIRT' => I18N::translate('birth'), 'DEAT' => I18N::translate('death'), 'MARR' => I18N::translate('marriage'), 'ADOP' => I18N::translate('adoption'), 'BURI' => I18N::translate('burial'), 'CENS' => I18N::translate('census added'));
     $fact_query = "IN ('" . str_replace('|', "','", $facts) . "')";
     if ($direction != 'ASC') {
         $direction = 'DESC';
     }
     $rows = $this->runSql('' . ' SELECT SQL_CACHE' . ' d_gid AS id,' . ' d_year AS year,' . ' d_fact AS fact,' . ' d_type AS type' . ' FROM' . " `##dates`" . ' WHERE' . " d_file={$this->tree->getTreeId()} AND" . " d_gid<>'HEAD' AND" . " d_fact {$fact_query} AND" . ' d_julianday1<>0' . ' ORDER BY' . " d_julianday1 {$direction}, d_type LIMIT 1");
     if (!isset($rows[0])) {
         return '';
     }
     $row = $rows[0];
     $record = GedcomRecord::getInstance($row['id'], $this->tree);
     switch ($type) {
         default:
         case 'full':
             if ($record->canShow()) {
                 $result = $record->formatList('span', false, $record->getFullName());
             } else {
                 $result = I18N::translate('This information is private and cannot be shown.');
             }
             break;
         case 'year':
             $date = new Date($row['type'] . ' ' . $row['year']);
             $result = $date->display();
             break;
         case 'type':
             if (isset($eventTypes[$row['fact']])) {
                 $result = $eventTypes[$row['fact']];
             } else {
                 $result = GedcomTag::getLabel($row['fact']);
             }
             break;
         case 'name':
             $result = "<a href=\"" . $record->getHtmlUrl() . "\">" . $record->getFullName() . "</a>";
             break;
         case 'place':
             $fact = $record->getFirstFact($row['fact']);
             if ($fact) {
                 $result = FunctionsPrint::formatFactPlace($fact, true, true, true);
             } else {
                 $result = I18N::translate('Private');
             }
             break;
     }
     return $result;
 }
예제 #20
0
 /**
  * Prints pedigree of the person passed in
  *
  * @param Individual $person
  * @param int        $count
  */
 private function printPersonPedigree($person, $count)
 {
     if ($count >= $this->generations) {
         return;
     }
     $genoffset = $this->generations;
     // handle pedigree n generations lines
     //-- calculate how tall the lines should be
     $lh = ($this->bhalfheight + 4) * pow(2, $genoffset - $count - 1);
     //
     //Prints empty table columns for children w/o parents up to the max generation
     //This allows vertical line spacing to be consistent
     if (count($person->getChildFamilies()) == 0) {
         echo '<table>';
         $this->printEmptyBox($this->getBoxDimensions()->width, $this->getBoxDimensions()->height);
         //-- recursively get the father’s family
         $this->printPersonPedigree($person, $count + 1);
         echo '</td><td></tr>';
         $this->printEmptyBox($this->getBoxDimensions()->width, $this->getBoxDimensions()->height);
         //-- recursively get the mother’s family
         $this->printPersonPedigree($person, $count + 1);
         echo '</td><td></tr></table>';
     }
     // Empty box section done, now for regular pedigree
     foreach ($person->getChildFamilies() as $family) {
         echo '<table><tr><td class="tdbot">';
         // Determine line height for two or more spouces
         // And then adjust the vertical line for the root person only
         $famcount = 0;
         if ($this->show_spouse) {
             // count number of spouses
             $famcount += count($person->getSpouseFamilies());
         }
         $savlh = $lh;
         // Save current line height
         if ($count == 1 && $genoffset <= $famcount) {
             $linefactor = 0;
             // genoffset of 2 needs no adjustment
             if ($genoffset > 2) {
                 $tblheight = $this->getBoxDimensions()->height + 8;
                 if ($genoffset == 3) {
                     if ($famcount == 3) {
                         $linefactor = $tblheight / 2;
                     } elseif ($famcount > 3) {
                         $linefactor = $tblheight;
                     }
                 }
                 if ($genoffset == 4) {
                     if ($famcount == 4) {
                         $linefactor = $tblheight;
                     } elseif ($famcount > 4) {
                         $linefactor = ($famcount - $genoffset) * ($tblheight * 1.5);
                     }
                 }
                 if ($genoffset == 5) {
                     if ($famcount == 5) {
                         $linefactor = 0;
                     } elseif ($famcount > 5) {
                         $linefactor = $tblheight * ($famcount - $genoffset);
                     }
                 }
             }
             $lh = ($famcount - 1) * ($this->getBoxDimensions()->height + 8) - $linefactor;
             if ($genoffset > 5) {
                 $lh = $savlh;
             }
         }
         echo '<img class="line3 pvline"  src="', Theme::theme()->parameter('image-vline'), '" height="', $lh - 1, '" alt=""></td>', '<td>', '<img class="line4" src="', Theme::theme()->parameter('image-hline'), '" height="3" alt=""></td>', '<td>';
         $lh = $savlh;
         // restore original line height
         //-- print the father box
         FunctionsPrint::printPedigreePerson($family->getHusband(), $this->showFull());
         echo '</td>';
         if ($family->getHusband()) {
             echo '<td>';
             //-- recursively get the father’s family
             $this->printPersonPedigree($family->getHusband(), $count + 1);
             echo '</td>';
         } else {
             echo '<td>';
             if ($genoffset > $count) {
                 echo '<table>';
                 for ($i = 1; $i < pow(2, $genoffset - $count) / 2; $i++) {
                     $this->printEmptyBox($this->getBoxDimensions()->width, $this->getBoxDimensions()->height);
                     echo '</tr>';
                 }
                 echo '</table>';
             }
         }
         echo '</tr><tr>', '<td class="tdtop"><img class="pvline" src="', Theme::theme()->parameter('image-vline'), '" height="', $lh + 1, '"></td>', '<td><img class="line4" src="', Theme::theme()->parameter('image-hline'), '" height="3"></td>', '<td>';
         //-- print the mother box
         FunctionsPrint::printPedigreePerson($family->getWife(), $this->showFull());
         echo '</td>';
         if ($family->getWife()) {
             echo '<td>';
             //-- recursively print the mother’s family
             $this->printPersonPedigree($family->getWife(), $count + 1);
             echo '</td>';
         } else {
             echo '<td>';
             if ($count < $genoffset - 1) {
                 echo '<table>';
                 for ($i = 1; $i < pow(2, $genoffset - 1 - $count) / 2 + 1; $i++) {
                     $this->printEmptyBox();
                     echo '</tr>';
                     $this->printEmptyBox();
                     echo '</tr>';
                 }
                 echo '</table>';
             }
         }
         echo '</tr>', '</table>';
         break;
     }
 }
예제 #21
0
/**
 * Print a form to add an individual or edit an individual’s name
 *
 * @param string     $nextaction
 * @param Individual $person
 * @param Family     $family
 * @param Fact       $name_fact
 * @param string     $famtag
 * @param string     $gender
 */
function print_indi_form($nextaction, Individual $person = null, Family $family = null, Fact $name_fact = null, $famtag = 'CHIL', $gender = 'U')
{
    global $WT_TREE, $bdm, $controller;
    if ($person) {
        $xref = $person->getXref();
    } elseif ($family) {
        $xref = $family->getXref();
    } else {
        $xref = 'new';
    }
    // Different cultures do surnames differently
    $surname_tradition = SurnameTradition::create($WT_TREE->getPreference('SURNAME_TRADITION'));
    $name_fields = array();
    if ($name_fact) {
        // Editing an existing name
        $name_fact_id = $name_fact->getFactId();
        $name_type = $name_fact->getAttribute('TYPE');
        $namerec = $name_fact->getGedcom();
        foreach (Config::standardNameFacts() as $tag) {
            if ($tag === 'NAME') {
                $name_fields[$tag] = $name_fact->getValue();
            } else {
                $name_fields[$tag] = $name_fact->getAttribute($tag);
            }
        }
        // Populate any missing 2 XXXX fields from the 1 NAME field
        $npfx_accept = implode('|', Config::namePrefixes());
        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];
            }
            if (empty($name_fields['NICK']) && !empty($name_bits[6]) && !preg_match('/^2 NICK/m', $namerec)) {
                $name_fields['NICK'] = $name_bits[6];
            }
        }
    } else {
        // Creating a new name
        $name_fact_id = null;
        $name_type = null;
        $namerec = null;
        // Populate the standard NAME field and subfields
        foreach (Config::standardNameFacts() as $tag) {
            $name_fields[$tag] = '';
        }
        // Inherit surname from parents, spouse or child
        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 = null;
            $mother = null;
            $father_name = '';
            $mother_name = '';
        }
        if ($person && $person->getFirstFact('NAME')) {
            $indi_name = $person->getFirstFact('NAME')->getValue();
        } else {
            $indi_name = '';
        }
        switch ($nextaction) {
            case 'add_child_to_family_action':
                $name_fields = $surname_tradition->newChildNames($father_name, $mother_name, $gender) + $name_fields;
                break;
            case 'add_child_to_individual_action':
                if ($person->getSex() === 'F') {
                    $name_fields = $surname_tradition->newChildNames('', $indi_name, $gender) + $name_fields;
                } else {
                    $name_fields = $surname_tradition->newChildNames($indi_name, '', $gender) + $name_fields;
                }
                break;
            case 'add_parent_to_individual_action':
                $name_fields = $surname_tradition->newParentNames($indi_name, $gender) + $name_fields;
                break;
            case 'add_spouse_to_family_action':
                if ($father) {
                    $name_fields = $surname_tradition->newSpouseNames($father_name, $gender) + $name_fields;
                } else {
                    $name_fields = $surname_tradition->newSpouseNames($mother_name, $gender) + $name_fields;
                }
                break;
            case 'add_spouse_to_individual_action':
                $name_fields = $surname_tradition->newSpouseNames($indi_name, $gender) + $name_fields;
                break;
            case 'add_unlinked_indi_action':
            case 'update':
                if ($surname_tradition->hasSurnames()) {
                    $name_fields['NAME'] = '//';
                }
                break;
        }
    }
    $bdm = '';
    // used to copy '1 SOUR' to '2 SOUR' for BIRT DEAT MARR
    echo '<div id="edit_interface-page">';
    echo '<h4>', $controller->getPageTitle(), '</h4>';
    FunctionsPrint::initializeCalendarPopup();
    echo '<form method="post" name="addchildform" onsubmit="return checkform();">';
    echo '<input type="hidden" name="ged" value="', $WT_TREE->getNameHtml(), '">';
    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 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
            FunctionsEdit::addSimpleTag('0 PEDI');
            break;
        case 'update':
            // When adding/editing a name, specify the type
            FunctionsEdit::addSimpleTag('0 TYPE ' . $name_type, '', '', null, $person);
            break;
    }
    // First - new/existing standard name fields
    foreach ($name_fields as $tag => $value) {
        if (substr_compare($tag, '_', 0, 1) !== 0) {
            FunctionsEdit::addSimpleTag('0 ' . $tag . ' ' . $value);
        }
    }
    // Second - new/existing advanced name fields
    if ($surname_tradition->hasMarriedNames() || preg_match('/\\n2 _MARNM /', $namerec)) {
        $adv_name_fields = array('_MARNM' => '');
    } else {
        $adv_name_fields = array();
    }
    if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('ADVANCED_NAME_FACTS'), $match)) {
        foreach ($match[1] as $tag) {
            $adv_name_fields[$tag] = '';
        }
    }
    foreach (array_keys($adv_name_fields) as $tag) {
        // Edit existing tags, grouped together
        if (preg_match_all('/2 ' . $tag . ' (.+)/', $namerec, $match)) {
            foreach ($match[1] as $value) {
                FunctionsEdit::addSimpleTag('2 ' . $tag . ' ' . $value, '', GedcomTag::getLabel('NAME:' . $tag, $person));
                if ($tag === '_MARNM') {
                    preg_match_all('/\\/([^\\/]*)\\//', $value, $matches);
                    FunctionsEdit::addSimpleTag('2 _MARNM_SURN ' . implode(',', $matches[1]));
                }
            }
        }
        // Allow a new tag to be entered
        if (!array_key_exists($tag, $name_fields)) {
            FunctionsEdit::addSimpleTag('0 ' . $tag, '', GedcomTag::getLabel('NAME:' . $tag, $person));
            if ($tag === '_MARNM') {
                FunctionsEdit::addSimpleTag('0 _MARNM_SURN');
            }
        }
    }
    // Third - new/existing custom name fields
    foreach ($name_fields as $tag => $value) {
        if (substr_compare($tag, '_', 0, 1) === 0) {
            FunctionsEdit::addSimpleTag('0 ' . $tag . ' ' . $value);
            if ($tag === '_MARNM') {
                preg_match_all('/\\/([^\\/]*)\\//', $value, $matches);
                FunctionsEdit::addSimpleTag('2 _MARNM_SURN ' . implode(',', $matches[1]));
            }
        }
    }
    // Fourth - 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' && !array_key_exists($type, $name_fields) && !array_key_exists($type, $adv_name_fields)) {
                $text = '';
                for ($j = 2; $j < count($fields); $j++) {
                    if ($j > 2) {
                        $text .= ' ';
                    }
                    $text .= $fields[$j];
                }
                while ($i + 1 < count($gedlines) && preg_match('/' . ($level + 1) . ' CONT ?(.*)/', $gedlines[$i + 1], $cmatch) > 0) {
                    $text .= "\n" . $cmatch[2];
                    $i++;
                }
                FunctionsEdit::addSimpleTag($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') {
            FunctionsEdit::addSimpleTag("0 SEX M");
        } elseif ($famtag === 'WIFE' || $gender === 'F') {
            FunctionsEdit::addSimpleTag('0 SEX F');
        } else {
            FunctionsEdit::addSimpleTag('0 SEX');
        }
        $bdm = 'BD';
        if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) {
            foreach ($matches[1] as $match) {
                if (!in_array($match, explode('|', WT_EVENTS_DEAT))) {
                    FunctionsEdit::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 . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FAMFACTS'), $matches)) {
                foreach ($matches[1] as $match) {
                    FunctionsEdit::addSimpleTags($match);
                }
            }
        }
        if (preg_match_all('/(' . WT_REGEX_TAG . ')/', $WT_TREE->getPreference('QUICK_REQUIRED_FACTS'), $matches)) {
            foreach ($matches[1] as $match) {
                if (in_array($match, explode('|', WT_EVENTS_DEAT))) {
                    FunctionsEdit::addSimpleTags($match);
                }
            }
        }
    }
    echo keep_chan($person);
    echo '</table>';
    if ($nextaction === 'update') {
        // GEDCOM 5.5.1 spec says NAME doesn’t get a OBJE
        FunctionsEdit::printAddLayer('SOUR');
        FunctionsEdit::printAddLayer('NOTE');
        FunctionsEdit::printAddLayer('SHARED_NOTE');
        FunctionsEdit::printAddLayer('RESN');
    } else {
        FunctionsEdit::printAddLayer('SOUR', 1);
        FunctionsEdit::printAddLayer('NOTE', 1);
        FunctionsEdit::printAddLayer('SHARED_NOTE', 1);
        FunctionsEdit::printAddLayer('RESN', 1);
    }
    // If we are editing an existing name, allow raw GEDCOM editing
    if ($name_fact && (Auth::isAdmin() || $WT_TREE->getPreference('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_TREE->getNameUrl(), '">', I18N::translate('Edit raw GEDCOM'), '</a>';
    }
    echo '<p id="save-cancel">';
    echo '<input type="submit" class="save" value="', I18N::translate('save'), '">';
    if (preg_match('/^add_(child|spouse|parent|unlinked_indi)/', $nextaction)) {
        echo '<input type="submit" class="save" value="', I18N::translate('go to new individual'), '" onclick="document.addchildform.goto.value=\'new\';">';
    }
    echo '<input type="button" class="cancel" value="', I18N::translate('close'), '" onclick="window.close();">';
    echo '</p>';
    echo '</form>';
    $controller->addInlineJavascript('
	SURNAME_TRADITION="' . $WT_TREE->getPreference('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 npfx = jQuery("#NPFX").val();
		var givn = jQuery("#GIVN").val();
		var spfx = jQuery("#SPFX").val();
		var surn = jQuery("#SURN").val();
		var nsfx = jQuery("#NSFX").val();
		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;
		}
		var npfx = jQuery("#NPFX").val();
		var givn = jQuery("#GIVN").val();
		var spfx = jQuery("#SPFX").val();
		var surn = jQuery("#SURN").val();
		var nsfx = jQuery("#NSFX").val();
		var name = generate_name();
		jQuery("#NAME").val(name);
		jQuery("#NAME_display").text(name);
		// 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 = trim(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(name) === 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 = "";

	// Calls to generate_name() trigger an update - hence need to
	// set the manual change to true first.  We are probably
	// listening to the wrong events on the input fields...
	var manualChange = true;
	manualChange = generate_name() !== jQuery("#NAME").val();

	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>';
}
예제 #22
0
echo '<input type="hidden" name="ged" value="', $WT_TREE->getNameHtml(), '">';
echo '<input type="hidden" name="pid" value="', $pid, '">';
if ($linktoid) {
    echo '<input type="hidden" name="linktoid" value="', $linktoid, '">';
}
echo '<table class="facts_table">';
echo '<tr><td class="topbottombar" colspan="2">';
echo $controller->getPageTitle(), FunctionsPrint::helpLink('OBJE');
echo '</td></tr>';
if (!$linktoid && $action == 'create') {
    echo '<tr><td class="descriptionbox wrap width25">';
    echo I18N::translate('Enter an individual, family, or source ID');
    echo '</td><td class="optionbox wrap"><input type="text" data-autocomplete-type="IFS" name="linktoid" id="linktoid" size="6" value="">';
    echo ' ', FunctionsPrint::printFindIndividualLink('linktoid');
    echo ' ', FunctionsPrint::printFindFamilyLink('linktoid');
    echo ' ', FunctionsPrint::printFindSourceLink('linktoid');
    echo '<p class="small text-muted">', I18N::translate('Enter or search for the ID of the individual, family, or source to which this media object should be linked.'), '</p></td></tr>';
}
if ($media) {
    $gedrec = $media->getGedcom();
} else {
    $gedrec = '';
}
// 1 FILE
if (preg_match('/\\n\\d (FILE.*)/', $gedrec, $match)) {
    $gedfile = $match[1];
} elseif ($filename) {
    $gedfile = 'FILE ' . $filename;
} else {
    $gedfile = 'FILE';
}
예제 #23
0
$lastgenStart = (int) floor($controller->treesize / 2);
echo '<div id="pedigree_chart" class="layout', $controller->orientation, '">';
//Output the chart
foreach ($controller->nodes as $i => $node) {
    // -- draw the box
    printf('<div id="sosa_%s" class="shadow" style="%s:%spx; top:%spx">', $i + 1, $posn, $node["x"], $node["y"]);
    if ($controller->orientation === $controller::OLDEST_AT_TOP) {
        if ($i >= $lastgenStart) {
            echo $controller->gotoPreviousGen($i);
        }
    } else {
        if (!$i) {
            echo $controller->getMenu();
        }
    }
    FunctionsPrint::printPedigreePerson($controller->nodes[$i]['indi'], $controller->showFull());
    if ($controller->orientation === $controller::OLDEST_AT_TOP) {
        if (!$i) {
            echo $controller->getMenu();
        }
    } else {
        if ($i >= $lastgenStart) {
            echo $controller->gotoPreviousGen($i);
        }
    }
    echo '</div>';
}
echo '<canvas id="pedigree_canvas" width="' . $controller->chartsize['x'] . '" height="' . $controller->chartsize['y'] . '"><p>No lines between boxes? Unfortunately your browser does not support the HTML5 canvas feature.</p></canvas>';
echo '</div>';
//close #pedigree_chart
echo '</div>';
예제 #24
0
 /**
  * Print the facts
  */
 public function printFamilyFacts()
 {
     global $linkToID;
     $linkToID = $this->record->getXref();
     // -- Tell addmedia.php what to link to
     $indifacts = $this->record->getFacts();
     if ($indifacts) {
         Functions::sortFacts($indifacts);
         foreach ($indifacts as $fact) {
             FunctionsPrintFacts::printFact($fact, $this->record);
         }
     } else {
         echo '<tr><td class="messagebox" colspan="2">', I18N::translate('No facts exist for this family.'), '</td></tr>';
     }
     if (Auth::isEditor($this->record->getTree())) {
         FunctionsPrint::printAddNewFact($this->record->getXref(), $indifacts, 'FAM');
         echo '<tr><td class="descriptionbox">';
         echo I18N::translate('Note');
         echo '</td><td class="optionbox">';
         echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','NOTE');\">", I18N::translate('Add a note'), '</a>';
         echo '</td></tr>';
         echo '<tr><td class="descriptionbox">';
         echo I18N::translate('Shared note');
         echo '</td><td class="optionbox">';
         echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','SHARED_NOTE');\">", I18N::translate('Add a shared note'), '</a>';
         echo '</td></tr>';
         if ($this->record->getTree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($this->record->getTree())) {
             echo '<tr><td class="descriptionbox">';
             echo I18N::translate('Media object');
             echo '</td><td class="optionbox">';
             echo "<a href=\"#\" onclick=\"window.open('addmedia.php?action=showmediaform&amp;linktoid=" . $this->record->getXref() . "', '_blank', edit_window_specs); return false;\">", I18N::translate('Add a media object'), '</a>';
             echo FunctionsPrint::helpLink('OBJE');
             echo '<br>';
             echo "<a href=\"#\" onclick=\"window.open('inverselink.php?linktoid=" . $this->record->getXref() . "&amp;linkto=family', '_blank', find_window_specs); return false;\">", I18N::translate('Link to an existing media object'), '</a>';
             echo '</td></tr>';
         }
         echo '<tr><td class="descriptionbox">';
         echo I18N::translate('Source');
         echo '</td><td class="optionbox">';
         echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','SOUR');\">", I18N::translate('Add a source citation'), '</a>';
         echo '</td></tr>';
     }
 }
예제 #25
0
    /**
     * {@inhericDoc}
     * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
     */
    protected function renderContent()
    {
        if ($this->data->get('has_sosa', false)) {
            $table_id = $this->data->get('table_id');
            ?>
   
        
		<div id="sosa-fam-list" class="sosa-list">
			<table id="<?php 
            echo $table_id;
            ?>
">
				<thead>
					<tr>
						<th colspan="24">
							<div class="btn-toolbar">
								<div class="btn-group">
									<button
										type="button"
										data-filter-column="22"
										data-filter-value="N"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show individuals who are alive or couples where both partners are alive.');
            ?>
"
									>
									<?php 
            echo I18N::translate('Both alive');
            ?>
									</button>
									<button
										type="button"
										data-filter-column="22"
										data-filter-value="W"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show couples where only the female partner is deceased.');
            ?>
"
									>
									<?php 
            echo I18N::translate('Widower');
            ?>
									</button>
									<button
										type="button"
										data-filter-column="22"
										data-filter-value="H"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show couples where only the male partner is deceased.');
            ?>
"
									>
									<?php 
            echo I18N::translate('Widow');
            ?>
									</button>
									<button
										type="button"
										data-filter-column="22"
										data-filter-value="Y"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show individuals who are dead or couples where both partners are deceased.');
            ?>
"
									>
									<?php 
            echo I18N::translate('Both dead');
            ?>
									</button>
								</div>
								<div class="btn-group">
									<button
										type="button"
										data-filter-column="23"
										data-filter-value="R"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show “roots” couples or individuals.  These individuals may also be called “patriarchs”.  They are individuals who have no parents recorded in the database.');
            ?>
"
									>
									<?php 
            echo I18N::translate('Roots');
            ?>
									</button>
									<button
										type="button"
										data-filter-column="23"
										data-filter-value="L"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show “leaves” couples or individuals.  These are individuals who are alive but have no children recorded in the database.');
            ?>
"
									>
									<?php 
            echo I18N::translate('Leaves');
            ?>
									</button>
								</div>
								<div class="btn-group">
									<button
										type="button"
										data-filter-column="21"
										data-filter-value="U"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show couples with an unknown marriage date.');
            ?>
"
									>
									<?php 
            echo GedcomTag::getLabel('MARR');
            ?>
									</button>
									<button
										type="button"
										data-filter-column="21"
										data-filter-value="YES"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show couples who married more than 100 years ago.');
            ?>
"
									>
									<?php 
            echo GedcomTag::getLabel('MARR');
            ?>
&gt;100
									</button>
									<button
										type="button"
										data-filter-column="21"
										data-filter-value="Y100"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show couples who married within the last 100 years.');
            ?>
"
									>
									<?php 
            echo GedcomTag::getLabel('MARR');
            ?>
&lt;=100
									</button>
									<button
										type="button"
										data-filter-column="21"
										data-filter-value="D"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show divorced couples.');
            ?>
"
									>
									<?php 
            echo GedcomTag::getLabel('DIV');
            ?>
									</button>
									<button
										type="button"
										data-filter-column="21"
										data-filter-value="M"
										class="ui-state-default"
										title="<?php 
            echo I18N::translate('Show couples where either partner married more than once.');
            ?>
"
									>
									<?php 
            echo I18N::translate('Multiple marriages');
            ?>
									</button>
								</div>
							</div>
						</th>
					</tr>
					<tr>
						<th><?php 
            echo I18N::translate('Sosa');
            ?>
</th>
						<th>SOSA</th>
						<th><?php 
            echo GedcomTag::getLabel('GIVN');
            ?>
</th>
						<th><?php 
            echo GedcomTag::getLabel('SURN');
            ?>
</th>
						<th>HUSB:GIVN_SURN</th>
						<th>HUSB:SURN_GIVN</th>
						<th><?php 
            echo GedcomTag::getLabel('AGE');
            ?>
</th>
						<th>AGE</th>
						<th><?php 
            echo GedcomTag::getLabel('GIVN');
            ?>
</th>
						<th><?php 
            echo GedcomTag::getLabel('SURN');
            ?>
</th>
						<th>WIFE:GIVN_SURN</th>
						<th>WIFE:SURN_GIVN</th>
						<th><?php 
            echo GedcomTag::getLabel('AGE');
            ?>
</th>
						<th>AGE</th>
						<th><?php 
            echo GedcomTag::getLabel('MARR');
            ?>
</th>
						<th>MARR:DATE</th>
						<th><?php 
            echo GedcomTag::getLabel('PLAC');
            ?>
</th>';
						<?php 
            if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
                ?>
						<th><i class="icon-source" title="<?php 
                echo I18N::translate('Sourced marriage');
                ?>
" border="0"></i></th>
						<th>SORT_MARRSC</th>
						<?php 
            } else {
                ?>
						<th>&nbsp;</th>
						<th></th>
						<?php 
            }
            ?>
						<th><i class="icon-children" title="<?php 
            echo I18N::translate('Children');
            ?>
"></i></th>
						<th>NCHI</th>
						<th>MARR</th>
						<th>DEAT</th>
						<th>TREE</th>
					</tr>
				</thead>
				<tbody>
			
			<?php 
            foreach ($this->data->get('sosa_list') as $sosa => $family) {
                /** @var \Fisharebest\Webtrees\Family $person */
                //PERSO Create decorator for Family
                $dfamily = new Family($family);
                $husb = $family->getHusband();
                if (is_null($husb)) {
                    $husb = new Individual('H', '0 @H@ INDI', null, $family->getTree());
                }
                $dhusb = new \MyArtJaub\Webtrees\Individual($husb);
                $wife = $family->getWife();
                if (is_null($wife)) {
                    $wife = new Individual('W', '0 @W@ INDI', null, $family->getTree());
                }
                $dwife = new \MyArtJaub\Webtrees\Individual($wife);
                $mdate = $family->getMarriageDate();
                if ($family->isPendingAddtion()) {
                    $class = ' class="new"';
                } elseif ($family->isPendingDeletion()) {
                    $class = ' class="old"';
                } else {
                    $class = '';
                }
                ?>
			
        		<tr <?php 
                echo $class;
                ?>
>
        			<td class="transparent"><?php 
                echo I18N::translate('%1$d/%2$d', $sosa, ($sosa + 1) % 10);
                ?>
</td>
        			<td class="transparent"><?php 
                echo $sosa;
                ?>
</td>
        			<!--  HUSBAND -->
        			<td colspan="2">
        			<?php 
                foreach ($husb->getAllNames() as $num => $name) {
                    if ($name['type'] == 'NAME') {
                        $title = '';
                    } else {
                        $title = 'title="' . strip_tags(GedcomTag::getLabel($name['type'], $husb)) . '"';
                    }
                    if ($num == $husb->getPrimaryName()) {
                        $class = ' class="name2"';
                        $sex_image = $husb->getSexImage();
                        list($surn, $givn) = explode(',', $name['sort']);
                    } else {
                        $class = '';
                        $sex_image = '';
                    }
                    ?>
        				<a <?php 
                    echo $title . ' ' . $class;
                    ?>
 href="<?php 
                    echo $husb->getHtmlUrl();
                    ?>
">
        					<?php 
                    echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']);
                    ?>
        				</a>
        				<?php 
                    echo $sex_image . FunctionsPrint::formatSosaNumbers($dhusb->getSosaNumbers(), 1, 'smaller');
                    ?>
        				<br/>
            		<?php 
                }
                echo $husb->getPrimaryParentsNames('parents details1', 'none');
                ?>
            		</td>
            		<!-- Dummy column to match colspan in header -->
            		<td style="display:none;"></td>
            		<td>
            			<?php 
                echo Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . 'AAAA' . Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn));
                ?>
            		</td>
            		<td>
            			<?php 
                echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn));
                ?>
            		</td>
            		<?php 
                $hdate = $husb->getBirthDate();
                ?>
            		<td><?php 
                Date::getAge($hdate, $mdate, 2);
                ?>
</td>
            		<td><?php 
                Date::getAge($hdate, $mdate, 1);
                ?>
</td>
            		<!--  WIFE -->
        			<td colspan="2">
        			<?php 
                foreach ($wife->getAllNames() as $num => $name) {
                    if ($name['type'] == 'NAME') {
                        $title = '';
                    } else {
                        $title = 'title="' . strip_tags(GedcomTag::getLabel($name['type'], $wife)) . '"';
                    }
                    if ($num == $wife->getPrimaryName()) {
                        $class = ' class="name2"';
                        $sex_image = $wife->getSexImage();
                        list($surn, $givn) = explode(',', $name['sort']);
                    } else {
                        $class = '';
                        $sex_image = '';
                    }
                    ?>
        				<a <?php 
                    echo $title . ' ' . $class;
                    ?>
 href="<?php 
                    echo $wife->getHtmlUrl();
                    ?>
">
        					<?php 
                    echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']);
                    ?>
        				</a>
        				<?php 
                    echo $sex_image . FunctionsPrint::formatSosaNumbers($dwife->getSosaNumbers(), 1, 'smaller');
                    ?>
        				<br/>
            		<?php 
                }
                echo $wife->getPrimaryParentsNames('parents details1', 'none');
                ?>
            		</td>
            		<!-- Dummy column to match colspan in header -->
            		<td style="display:none;"></td>
            		<td>
            			<?php 
                echo Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . 'AAAA' . Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn));
                ?>
            		</td>
            		<td>
            			<?php 
                echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn));
                ?>
            		</td>
            		<?php 
                $wdate = $wife->getBirthDate();
                ?>
            		<td><?php 
                Date::getAge($wdate, $mdate, 2);
                ?>
</td>
            		<td><?php 
                Date::getAge($wdate, $mdate, 1);
                ?>
</td>
            		<td><?php 
                if ($marriage_dates = $family->getAllMarriageDates()) {
                    foreach ($marriage_dates as $n => $marriage_date) {
                        if ($n) {
                            echo '<br>';
                        }
                        ?>
        					<div><?php 
                        echo $marriage_date->display(true);
                        ?>
</div>
        				<?php 
                    }
                } elseif ($family->getFacts('_NMR')) {
                    echo I18N::translate('no');
                } elseif ($family->getFacts('MARR')) {
                    echo I18N::translate('yes');
                } else {
                    echo '&nbsp;';
                }
                ?>
            		</td>
            		<td><?php 
                echo $marriage_dates ? $marriage_date->julianDay() : 0;
                ?>
</td>
            		<td><?php 
                foreach ($family->getAllMarriagePlaces() as $n => $marriage_place) {
                    $tmp = new Place($marriage_place, $family->getTree());
                    if ($n) {
                        ?>
<br><?php 
                    }
                    ?>
        				<a href="'<?php 
                    echo $tmp->getURL();
                    ?>
" title="<?php 
                    echo strip_tags($tmp->getFullName());
                    ?>
">
        					<?php 
                    echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName());
                    ?>
        				</a>
        			<?php 
                }
                ?>
        			</td>
        			<?php 
                if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
                    $isMSourced = $dfamily->isMarriageSourced();
                    ?>
				   	<td><?php 
                    echo FunctionsPrint::formatIsSourcedIcon('E', $isMSourced, 'MARR', 1, 'medium');
                    ?>
</td>
					<td><?php 
                    echo $isMSourced;
                    ?>
</td>
					<?php 
                } else {
                    ?>
					<td>&nbsp;</td>
					<td></td>
					<?php 
                }
                ?>
					<?php 
                $nchi = $family->getNumberOfChildren();
                ?>
					<td><?php 
                echo I18N::number($nchi);
                ?>
</td>
					<td><?php 
                echo $nchi;
                ?>
</td>
					<td><?php 
                if (!$mdate->isOK()) {
                    echo 'U';
                } else {
                    if (Date::compare($mdate, new Date(date('Y') - 100)) > 0) {
                        echo 'Y100';
                    } else {
                        echo 'YES';
                    }
                }
                if ($family->getFacts(WT_EVENTS_DIV)) {
                    echo 'D';
                }
                if (count($husb->getSpouseFamilies()) > 1 || count($wife->getSpouseFamilies()) > 1) {
                    echo 'M';
                }
                ?>
					</td>
					<td><?php 
                if ($husb->isDead() && $wife->isDead()) {
                    echo 'Y';
                }
                if ($husb->isDead() && !$wife->isDead()) {
                    if ($wife->getSex() == 'F') {
                        echo 'H';
                    }
                    if ($wife->getSex() == 'M') {
                        echo 'W';
                    }
                    // male partners
                }
                if (!$husb->isDead() && $wife->isDead()) {
                    if ($husb->getSex() == 'M') {
                        echo 'W';
                    }
                    if ($husb->getSex() == 'F') {
                        echo 'H';
                    }
                    // female partners
                }
                if (!$husb->isDead() && !$wife->isDead()) {
                    echo 'N';
                }
                ?>
        			</td>
        			<td><?php 
                if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) {
                    echo 'R';
                } elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() < 1) {
                    echo 'L';
                } else {
                    echo '&nbsp;';
                }
                ?>
			         </td>
				</tr>
        	<?php 
            }
            ?>
        	</tbody>
        	<tfoot>
				<tr>
					<th colspan="24">
						<div class="btn-toolbar">
							<div class="btn-group">
								<button type="button" class="ui-state-default btn-toggle-parents">
									<?php 
            echo I18N::translate('Show parents');
            ?>
								</button>
								<button id="btn-toggle-statistics-<?php 
            echo $table_id;
            ?>
" type="button" class="ui-state-default btn-toggle-statistics">
									<?php 
            echo I18N::translate('Show statistics charts');
            ?>
								</button>
							</div>
						</div>
					</th>
				</tr>
			</tfoot>
        	</table>
				<div id="fam_list_table-charts_<?php 
            echo $table_id;
            ?>
" style="display:none">
					<table class="list-charts">
						<tr>
							<td><?php 
            echo $this->data->get('chart_births');
            ?>
</td>
							<td><?php 
            echo $this->data->get('chart_marriages');
            ?>
</td>
						</tr>
						<tr>
							<td colspan="2"><?php 
            echo $this->data->get('chart_ages');
            ?>
</td>
						</tr>
					</table>
				</div>
			</div>
		<?php 
        } else {
            ?>
        <p class="warning"><?php 
            echo I18N::translate('No family has been found for generation %d', $this->data->get('generation'));
            ?>
</p>
        <?php 
        }
    }
예제 #26
0
 /**
  * Print a row for the media tab on the individual page.
  *
  * @param Fact $fact
  * @param int $level
  */
 public static function printMainMedia(Fact $fact, $level)
 {
     $factrec = $fact->getGedcom();
     $parent = $fact->getParent();
     if ($fact->isPendingAddition()) {
         $styleadd = 'new';
         $can_edit = $level == 1 && $fact->canEdit();
     } elseif ($fact->isPendingDeletion()) {
         $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 = Media::getInstance($xref, $fact->getParent()->getTree());
         // 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 GedcomTag::getLabel($factname, $parent);
                 }
             } elseif ($can_edit) {
                 echo '<a onclick="window.open(\'addmedia.php?action=editmedia&amp;pid=', $media->getXref(), '\', \'_blank\', edit_window_specs); return false;" href="#" title="', I18N::translate('Edit'), '">';
                 echo GedcomTag::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="', I18N::translate('Edit'), '"><span class="link_text">', 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="' . I18N::translate('Copy') . '"><span class="link_text">' . I18N::translate('Copy') . '</span></a></div>';
                 echo '<div class="deletelink"><a class="deleteicon" onclick="return delete_fact(\'', I18N::translate('Are you sure you want to delete this fact?'), '\', \'', $parent->getXref(), '\', \'', $fact->getFactId(), '\');" href="#" title="', I18N::translate('Delete'), '"><span class="link_text">', I18N::translate('Delete'), '</span></a></div>';
                 echo '</div>';
             } else {
                 echo GedcomTag::getLabel($factname, $parent);
             }
             echo '</td>';
             echo '<td class="optionbox ', $styleadd, ' wrap">';
             if ($media) {
                 echo '<span class="field">';
                 echo $media->displayImage();
                 echo '<a href="' . $media->getHtmlUrl() . '">';
                 echo '<em>';
                 foreach ($media->getAllNames() as $name) {
                     if ($name['type'] != 'TITL') {
                         echo '<br>';
                     }
                     echo $name['full'];
                 }
                 echo '</em>';
                 echo '</a>';
                 echo '</span>';
                 echo GedcomTag::getLabelValue('FORM', $media->mimeType());
                 $imgsize = $media->getImageAttributes('main');
                 if (!empty($imgsize['WxH'])) {
                     echo GedcomTag::getLabelValue('__IMAGE_SIZE__', $imgsize['WxH']);
                 }
                 if ($media->getFilesizeraw() > 0) {
                     echo GedcomTag::getLabelValue('__FILE_SIZE__', $media->getFilesize());
                 }
                 $mediatype = $media->getMediaType();
                 if ($mediatype) {
                     echo GedcomTag::getLabelValue('TYPE', GedcomTag::getFileFormTypeValue($mediatype));
                 }
                 switch ($media->isPrimary()) {
                     case 'Y':
                         echo GedcomTag::getLabelValue('_PRIM', I18N::translate('yes'));
                         break;
                     case 'N':
                         echo GedcomTag::getLabelValue('_PRIM', I18N::translate('no'));
                         break;
                 }
                 echo FunctionsPrint::printFactNotes($media->getGedcom(), 1);
                 echo self::printFactSources($media->getGedcom(), 1);
             } else {
                 echo $xref;
             }
             echo '</td></tr>';
         }
     }
 }
예제 #27
0
&amp;filterof=<?php 
echo $filterof;
?>
&amp;filtersx=<?php 
echo $filtersx;
?>
&amp;view=<?php 
echo $view;
?>
">
						<?php 
echo $today->format('%Y');
?>
					</a>
					<?php 
echo FunctionsPrint::helpLink('annivers_year_select');
?>
				</td>

				<td class="descriptionbox vmiddle">
					<?php 
echo I18N::translate('Show');
?>
				</td>

				<td class="optionbox vmiddle">
					<?php 
if (!$WT_TREE->getPreference('HIDE_LIVE_PEOPLE') || Auth::check()) {
    ?>
					<select class="list_value" name="filterof" onchange="document.dateform.submit();">
						<option value="all" <?php 
예제 #28
0
    /**
     * {@inhericDoc}
     * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
     */
    protected function renderContent()
    {
        if ($this->data->get('has_sosa', false)) {
            $table_id = $this->data->get('table_id');
            ?>
   
        
        <div id="sosa-indi-list" class="sosa-list">
        	<table id="<?php 
            echo $table_id;
            ?>
">
				<thead>
    				<tr>
    					<th colspan="22">
    						<div class="btn-toolbar">
    							<div class="btn-group">
    								<button
    									class="ui-state-default"
    									data-filter-column="18"
    									data-filter-value="M"
    									title="<?php 
            echo I18N::translate('Show only males.');
            ?>
"
    									type="button"
    								><?php 
            echo Individual::sexImage('M', 'large');
            ?>
    								</button>
    								<button
    									class="ui-state-default"
    									data-filter-column="18"
    									data-filter-value="F"
    									title="<?php 
            echo I18N::translate('Show only females.');
            ?>
"
    									type="button"
    								>
    									<?php 
            echo Individual::sexImage('F', 'large');
            ?>
    								</button>
    								<button
    									class="ui-state-default"
    									data-filter-column="18"
    									data-filter-value="U"
    									title="<?php 
            echo I18N::translate('Show only individuals for whom the gender is not known.');
            ?>
"
    									type="button"
    								>
    									<?php 
            echo Individual::sexImage('U', 'large');
            ?>
    								</button>
    							</div>
    							<div class="btn-group">
    								<button
    									class="ui-state-default"
    									data-filter-column="20"
    									data-filter-value="N"
    									title="<?php 
            echo I18N::translate('Show individuals who are alive or couples where both partners are alive.');
            ?>
"
    									type="button"
    								>
    									<?php 
            echo I18N::translate('Alive');
            ?>
    								</button>
    								<button
    									class="ui-state-default"
    									data-filter-column="20"
    									data-filter-value="Y"
    									title="<?php 
            echo I18N::translate('Show individuals who are dead or couples where both partners are deceased.');
            ?>
"
    									type="button"
    								>
    									<?php 
            echo I18N::translate('Dead');
            ?>
    								</button>
    								<button
    									class="ui-state-default"
    									data-filter-column="20"
    									data-filter-value="YES"
    									title="<?php 
            echo I18N::translate('Show individuals who died more than 100 years ago.');
            ?>
"
    									type="button"
    								><?php 
            echo GedcomTag::getLabel('DEAT');
            ?>
&gt;100
    								</button>
    								<button
    									class="ui-state-default"
    									data-filter-column="20"
    									data-filter-value="Y100"
    									title="<?php 
            echo I18N::translate('Show individuals who died within the last 100 years.');
            ?>
"
    									type="button"
    								><?php 
            echo GedcomTag::getLabel('DEAT');
            ?>
&lt;=100
    								</button>
    							</div>
    							<div class="btn-group">
    								<button
    									class="ui-state-default"
    									data-filter-column="19"
    									data-filter-value="YES"
    									title="<?php 
            echo I18N::translate('Show individuals born more than 100 years ago.');
            ?>
"
    									type="button"
    								><?php 
            echo GedcomTag::getLabel('BIRT');
            ?>
&gt;100
    								</button>
    								<button
    									class="ui-state-default"
    									data-filter-column="19"
    									data-filter-value="Y100"
    									title="<?php 
            echo I18N::translate('Show individuals born within the last 100 years.');
            ?>
"
    									type="button"
    								><?php 
            echo GedcomTag::getLabel('BIRT');
            ?>
&lt;=100
    								</button>
    							</div>
    							<div class="btn-group">
    								<button
    									class="ui-state-default"
    									data-filter-column="21"
    									data-filter-value="R"
    									title="<?php 
            echo I18N::translate('Show “roots” couples or individuals.  These individuals may also be called “patriarchs”.  They are individuals who have no parents recorded in the database.');
            ?>
"
    									type="button"
    								>
    									<?php 
            echo I18N::translate('Roots');
            ?>
    								</button>
    								<button
    									class="ui-state-default"
    									data-filter-column="21"
    									data-filter-value="L"
    									title="<?php 
            echo I18N::translate('Show “leaves” couples or individuals.  These are individuals who are alive but have no children recorded in the database.');
            ?>
"
    									type="button"
    								>
    									<?php 
            echo I18N::translate('Leaves');
            ?>
    								</button>
    							</div>
    						</div>
    					</th>
    				</tr>
					<tr>
						<th><?php 
            echo I18N::translate('Sosa');
            ?>
</th>
						<th><?php 
            echo GedcomTag::getLabel('INDI');
            ?>
</th>
						<th><?php 
            echo GedcomTag::getLabel('GIVN');
            ?>
</th>
						<th><?php 
            echo GedcomTag::getLabel('SURN');
            ?>
</th>
						<th>GIVN</th>
						<th>SURN</th>
						<th><?php 
            echo GedcomTag::getLabel('BIRT');
            ?>
</th>
						<th>SORT_BIRT</th>
						<th><?php 
            echo GedcomTag::getLabel('PLAC');
            ?>
</th>
						<?php 
            if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
                ?>
						<th><i class="icon-source" title="<?php 
                echo I18N::translate('Sourced birth');
                ?>
" border="0"></i></th>
						<th>SORT_BIRTSC</th>
						<?php 
            } else {
                ?>
						<th></th>
						<th></th>
						<?php 
            }
            ?>
						<th><?php 
            echo GedcomTag::getLabel('DEAT');
            ?>
</th>
						<th>SORT_DEAT</th>
						<th><?php 
            echo GedcomTag::getLabel('AGE');
            ?>
</th>
						<th>AGE</th>
						<th><?php 
            echo GedcomTag::getLabel('PLAC');
            ?>
</th>
						<?php 
            if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
                ?>
						<th><i class="icon-source" title="<?php 
                echo I18N::translate('Sourced death');
                ?>
" border="0"></i></th>
						<th>SORT_DEATSC</th>
						<?php 
            } else {
                ?>
						<th></th>
						<th></th>
						<?php 
            }
            ?>
						<th>SEX</th>
						<th>BIRT</th>
						<th>DEAT</th>
						<th>TREE</th>
					</tr>
				</thead>
			<tbody>
			
			<?php 
            foreach ($this->data->get('sosa_list') as $sosa => $person) {
                /** @var \Fisharebest\Webtrees\Individual $person */
                if ($person->isPendingAddtion()) {
                    $class = ' class="new"';
                } elseif ($person->isPendingDeletion()) {
                    $class = ' class="old"';
                } else {
                    $class = '';
                }
                $dperson = new \MyArtJaub\Webtrees\Individual($person);
                ?>
			
        		<tr <?php 
                echo $class;
                ?>
>
        			<td class="transparent"><?php 
                echo $sosa;
                ?>
</td>
        			<td class="transparent"><?php 
                echo $person->getXref();
                ?>
</td>
        			<td colspan="2">
        			<?php 
                foreach ($person->getAllNames() as $num => $name) {
                    if ($name['type'] == 'NAME') {
                        $title = '';
                    } else {
                        $title = 'title="' . strip_tags(GedcomTag::getLabel($name['type'], $person)) . '"';
                    }
                    if ($num == $person->getPrimaryName()) {
                        $class = ' class="name2"';
                        $sex_image = $person->getSexImage();
                        list($surn, $givn) = explode(',', $name['sort']);
                    } else {
                        $class = '';
                        $sex_image = '';
                    }
                    ?>
        				<a <?php 
                    echo $title . ' ' . $class;
                    ?>
 href="<?php 
                    echo $person->getHtmlUrl();
                    ?>
">
        					<?php 
                    echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']);
                    ?>
        				</a>
        				<?php 
                    echo $sex_image . FunctionsPrint::formatSosaNumbers($dperson->getSosaNumbers(), 1, 'smaller');
                    ?>
        				<br/>
            		<?php 
                }
                echo $person->getPrimaryParentsNames('parents details1', 'none');
                ?>
            		</td>
            		<td style="display:none;"></td>
            		<td>
            			<?php 
                echo Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn)) . 'AAAA' . Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn));
                ?>
            		</td>
            		<td>
            			<?php 
                echo Filter::escapeHtml(str_replace('@N.N.', 'AAAA', $surn)) . 'AAAA' . Filter::escapeHtml(str_replace('@P.N.', 'AAAA', $givn));
                ?>
            		</td>
            		<td>
            		<?php 
                if ($birth_dates = $person->getAllBirthDates()) {
                    foreach ($birth_dates as $num => $birth_date) {
                        if ($num) {
                            ?>
<br/><?php 
                        }
                        ?>
    						<?php 
                        echo $birth_date->display(true);
                    }
                } else {
                    $birth_date = new Date('');
                    if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES')) {
                        $birth_date = $person->getEstimatedBirthDate();
                        echo $birth_date->display(true);
                    } else {
                        echo '&nbsp;';
                    }
                    $birth_dates[0] = new Date('');
                }
                ?>
            		</td>
            		<td><?php 
                echo $birth_date->julianDay();
                ?>
</td>
        			<td>
        			<?php 
                foreach ($person->getAllBirthPlaces() as $n => $birth_place) {
                    $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree());
                    if ($n) {
                        ?>
<br><?php 
                    }
                    ?>
        				<a href="'<?php 
                    echo $tmp->getURL();
                    ?>
" title="<?php 
                    echo strip_tags($tmp->getFullName());
                    ?>
">
        					<?php 
                    echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName());
                    ?>
        				</a>
        			<?php 
                }
                ?>
        			</td>
        			<?php 
                if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
                    $isBSourced = $dperson->isBirthSourced();
                    ?>
				   	<td><?php 
                    echo FunctionsPrint::formatIsSourcedIcon('E', $isBSourced, 'BIRT', 1, 'medium');
                    ?>
</td>
					<td><?php 
                    echo $isBSourced;
                    ?>
</td>
					<?php 
                } else {
                    ?>
					<td>&nbsp;</td>
					<td></td>
					<?php 
                }
                ?>
					<td>
					<?php 
                if ($death_dates = $person->getAllDeathDates()) {
                    foreach ($death_dates as $num => $death_date) {
                        if ($num) {
                            ?>
<br/><?php 
                        }
                        ?>
					 		<?php 
                        echo $death_date->display(true);
                    }
                } else {
                    $death_date = $person->getEstimatedDeathDate();
                    if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES') && $death_date->minimumJulianDay() < WT_CLIENT_JD) {
                        echo $death_date->display(true);
                    } elseif ($person->isDead()) {
                        echo I18N::translate('yes');
                        $death_date = new Date('');
                    } else {
                        echo '&nbsp;';
                        $death_date = new Date('');
                    }
                    $death_dates[0] = new Date('');
                }
                ?>
			         </td>
			         <td><?php 
                echo $death_date->julianDay();
                ?>
</td>
			         <td><?php 
                echo Date::getAge($birth_dates[0], $death_dates[0], 2);
                ?>
</td>
			         <td><?php 
                echo Date::getAge($birth_dates[0], $death_dates[0], 1);
                ?>
</td>
			         <td>
        			 <?php 
                foreach ($person->getAllDeathPlaces() as $n => $death_place) {
                    $tmp = new Place($death_place, $person->getTree());
                    if ($n) {
                        ?>
<br><?php 
                    }
                    ?>
        				<a href="'<?php 
                    echo $tmp->getURL();
                    ?>
" title="<?php 
                    echo strip_tags($tmp->getFullName());
                    ?>
">
        					<?php 
                    echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName());
                    ?>
        				</a>
        			<?php 
                }
                ?>
        			</td>
        			<?php 
                if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
                    $isDSourced = $dperson->isDeathSourced();
                    ?>
				   	<td><?php 
                    echo FunctionsPrint::formatIsSourcedIcon('E', $isDSourced, 'DEAT', 1, 'medium');
                    ?>
</td>
					<td><?php 
                    echo $isDSourced;
                    ?>
</td>
					<?php 
                } else {
                    ?>
					<td>&nbsp;</td>
					<td></td>
					<?php 
                }
                ?>
					<td><?php 
                echo $person->getSex();
                ?>
</td>
					<td>
					<?php 
                if (!$person->canShow() || Date::compare($birth_date, new Date(date('Y') - 100)) > 0) {
                    echo 'Y100';
                } else {
                    echo 'YES';
                }
                ?>
        			</td>
        			<td>
        			<?php 
                if (Date::compare($death_dates[0], new Date(date('Y') - 100)) > 0) {
                    echo 'Y100';
                } elseif ($death_dates[0]->minimumJulianDay() || $person->isDead()) {
                    echo 'YES';
                } else {
                    echo 'N';
                }
                ?>
			         </td>
			         <td>
					<?php 
                if (!$person->getChildFamilies()) {
                    echo 'R';
                } elseif (!$person->isDead() && $person->getNumberOfChildren() < 1) {
                    echo 'L';
                } else {
                    echo '&nbsp;';
                }
                ?>
					</td>
				</tr>
        	<?php 
            }
            ?>
        	</tbody>
        	<tfoot>
				<tr>
					<th class="ui-state-default" colspan="22">
						<div class="center">
							<?php 
            echo I18N::translate('Number of Sosa ancestors: %1$s known / %2$s theoretical (%3$s)', I18N::number($this->data->get('sosa_count')), I18N::number($this->data->get('sosa_theo')), I18N::percentage($this->data->get('sosa_ratio'), 2));
            ?>
							<?php 
            if ($this->data->get('sosa_hidden') > 0) {
                echo '[' . I18N::translate('%s hidden', I18N::number($this->data->get('sosa_hidden'))) . ']';
            }
            ?>
						</div>
					</th>
				</tr>
				<tr>
					<th colspan="22">
						<div class="btn-toolbar">
							<div class="btn-group">
								<button type="button" class="ui-state-default btn-toggle-parents">
									<?php 
            echo I18N::translate('Show parents');
            ?>
								</button>
								<button id="btn-toggle-statistics-<?php 
            echo $table_id;
            ?>
" type="button" class="ui-state-default btn-toggle-statistics">
									<?php 
            echo I18N::translate('Show statistics charts');
            ?>
								</button>
							</div>
						</div>
					</th>
				</tr>
			</tfoot>
        	</table>
				<div id="indi_list_table-charts_<?php 
            echo $table_id;
            ?>
" style="display:none">
					<table class="list-charts">
						<tr>
							<td><?php 
            echo $this->data->get('chart_births');
            ?>
</td>
							<td><?php 
            echo $this->data->get('chart_deaths');
            ?>
</td>
						</tr>
						<tr>
							<td colspan="2"><?php 
            echo $this->data->get('chart_ages');
            ?>
</td>
						</tr>
					</table>
				</div>
			</div>
		<?php 
        }
    }
예제 #29
0
    echo '<p class="ui-state-error">', $controller->error_message, '</p>';
    return;
}
switch ($controller->chart_style) {
    case 0:
        // List
        echo '<ul id="ancestry_chart" class="chart_common">';
        $controller->printChildAscendancy($controller->root, 1, $controller->generations - 1);
        echo '</ul>';
        echo '<br>';
        break;
    case 1:
        echo '<div id="ancestry_booklet">';
        // Booklet
        // first page : show indi facts
        FunctionsPrint::printPedigreePerson($controller->root, $controller->showFull());
        // process the tree
        $ancestors = $controller->sosaAncestors($controller->generations - 1);
        $ancestors = array_filter($ancestors);
        // The SOSA array includes empty placeholders
        foreach ($ancestors as $sosa => $individual) {
            foreach ($individual->getChildFamilies() as $family) {
                FunctionsCharts::printSosaFamily($family->getXref(), $individual->getXref(), $sosa, '', '', '', $controller->show_cousins, $controller->showFull());
            }
        }
        echo '</div>';
        break;
    case 2:
        // Individual list
        $ancestors = $controller->sosaAncestors($controller->generations);
        $ancestors = array_filter($ancestors);
예제 #30
0
?>
						</label>
					</td>
					<td class="optionbox" colspan="3">
						<input id="place" data-autocomplete-type="PLAC" type="text" size="30" name="place">
					</td>
					<td class="optionbox">
						<label for="newpid">
							<?php 
echo I18N::translate('Individual');
?>
						</label>
					</td>
					<td class="optionbox">
						<input id="newpid" class="pedigree_form" data-autocomplete-type="INDI" type="text" size="5" name="newpid"><?php 
echo FunctionsPrint::printFindIndividualLink('newpid');
?>

					</td>
				</tr>
				<tr>
					<td class="optionbox">
						<label for="beginYear">
							<?php 
echo I18N::translate('Start year');
?>
						</label>
					</td>
					<td class="optionbox">
						<input id="beginYear" type="text" name="beginYear" size="5">
					</td>