예제 #1
0
 /**
  * check (blood) relationship between partners
  * 
  * @param type $person
  * @param type $spouse
  * @return string (relationship name)
  */
 private function checkRelationship($person, $spouse)
 {
     $controller = new RelationshipController();
     $paths = $controller->calculateRelationships($person, $spouse, 1);
     foreach ($paths as $path) {
         $relationships = $controller->oldStyleRelationshipPath($path);
         if (empty($relationships)) {
             // Cannot see one of the families/individuals, due to privacy;
             continue;
         }
         foreach (array_keys($path) as $n) {
             if ($n % 2 === 1) {
                 switch ($relationships[$n]) {
                     case 'sis':
                     case 'bro':
                     case 'sib':
                         return Functions::getRelationshipNameFromPath(implode('', $relationships), $person, $spouse);
                 }
             }
         }
     }
 }
예제 #2
0
 /**
  * Returns HTML code for a graph showing the dispersion of ancestors across grand-parents
  * @return string HTML code
  */
 private function htmlAncestorDispersionG3()
 {
     $ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(3);
     $size = '700x300';
     $color_motmot = 'ffd1dc';
     $color_motfat = 'b998a0';
     $color_fatfat = '577292';
     $color_fatmot = '84beff';
     $color_shared = '777777';
     $total_fatfat = array_key_exists(1, $ancestorsDispGen2) ? $ancestorsDispGen2[1] : 0;
     $total_fatmot = array_key_exists(2, $ancestorsDispGen2) ? $ancestorsDispGen2[2] : 0;
     $total_motfat = array_key_exists(4, $ancestorsDispGen2) ? $ancestorsDispGen2[4] : 0;
     $total_motmot = array_key_exists(8, $ancestorsDispGen2) ? $ancestorsDispGen2[8] : 0;
     $total_sha = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0;
     $total = $total_fatfat + $total_fatmot + $total_motfat + $total_motmot + $total_sha;
     $chd = $this->arrayToExtendedEncoding(array(4095 * Functions::safeDivision($total_fatfat, $total), 4095 * Functions::safeDivision($total_fatmot, $total), 4095 * Functions::safeDivision($total_sha, $total), 4095 * Functions::safeDivision($total_motfat, $total), 4095 * Functions::safeDivision($total_motmot, $total)));
     $chart_title = I18N::translate('Known Sosa ancestors\' dispersion - G3');
     $chl = \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1) . '|' . \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1) . '|' . I18N::translate('Shared') . ' - ' . I18N::percentage(Functions::safeDivision($total_sha, $total), 1) . '|' . \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_motfat, $total), 1) . '|' . \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_motmot, $total), 1);
     return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&amp;chd=e:{$chd}&amp;chs={$size}&amp;chco={$color_fatfat},{$color_fatmot},{$color_shared},{$color_motfat},{$color_motmot}&amp;chf=bg,s,ffffff00&amp;chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />";
 }
예제 #3
0
 /**
  * builds and returns sosa relationship name in the active language
  *
  * @param string $sosa sosa number
  *
  * @return string
  */
 public static function getSosaName($sosa)
 {
     $path = '';
     while ($sosa > 1) {
         if ($sosa % 2 == 1) {
             $sosa -= 1;
             $path = 'mot' . $path;
         } else {
             $path = 'fat' . $path;
         }
         $sosa /= 2;
     }
     return Functions::getRelationshipNameFromPath($path, null, null);
 }
예제 #4
0
                 if ($n > 2 && preg_match('/fat|mot|par/', $relationships[$n - 2])) {
                     $table[$x + 1][$y - 1] = '<div style="background:url(' . $diagonal2 . '); width: 64px; height: 64px; text-align: center;"><div style="height: 32px; text-align: end;">' . 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: start;">' . $down_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: 64px;">' . 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: 64px;">' . $down_arrow . '</div></div>';
                 }
                 $y -= 2;
                 break;
             case 'fat':
             case 'mot':
             case 'par':
                 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;">';
예제 #5
0
    /**
     * {@inhericDoc}
     * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent()
     */
    protected function renderContent()
    {
        ?>
            <div id="maj-sosa-missing-page" class="center">
    			<h2><?php 
        echo $this->data->get('title');
        ?>
</h2>
    			
    			<?php 
        if ($this->data->get('is_setup')) {
            $this->renderSosaHeader();
            if ($this->data->get('has_missing', false)) {
                $table_id = $this->data->get('table_id');
                ?>
    			<div id="sosa-indi-missing" class="smissing-list">
                	<table id="<?php 
                echo $table_id;
                ?>
">
        				<thead>     
            				<tr>
    							<th colspan="16">
    								<div class="btn-toolbar">
    									<div class="btn-group">
    										<button
    											class="ui-state-default"
    											data-filter-column="15"
    											data-filter-value="M"
    											title="<?php 
                I18N::translate('Show only males.');
                ?>
"
    											type="button"
    										>
    										<?php 
                echo Individual::sexImage('M', 'large');
                ?>
    										</button>
    										<button
    											class="ui-state-default"
    											data-filter-column="15"
    											data-filter-value="F"
    											title="<?php 
                I18N::translate('Show only females.');
                ?>
"
    											type="button"
    										>
    										<?php 
                echo Individual::sexImage('F', 'large');
                ?>
    										</button>
    										<button
    											class="ui-state-default"
    											data-filter-column="15"
    											data-filter-value="U"
    											title="<?php 
                I18N::translate('Show only individuals for whom the gender is not known.');
                ?>
"
    											type="button"
    										>
    										<?php 
                echo Individual::sexImage('U', 'large');
                ?>
    										</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>
        						<?php 
                if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
                    ?>
        						<th><i class="icon-source" title="<?php 
                    echo I18N::translate('Sourced individual');
                    ?>
" border="0"></i></th>
        						<th>SORT_BIRTSC</th>
        						<?php 
                } else {
                    ?>
        						<th></th>
        						<th></th>
        						<?php 
                }
                ?>
        						<th><?php 
                echo Functions::getRelationshipNameFromPath('fat');
                ?>
</th>
								<th><?php 
                echo Functions::getRelationshipNameFromPath('mot');
                ?>
</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>SEX</th>
        					</tr>
        				</thead>
        			<tbody>
        			
        			<?php 
                foreach ($this->data->get('missing_list') as $missing_tab) {
                    $person = $missing_tab['indi'];
                    /** @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 $missing_tab['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>                    		
                			<?php 
                    if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) {
                        $isISourced = $dperson->isSourced();
                        ?>
        				   	<td><?php 
                        echo FunctionsPrint::formatIsSourcedIcon('R', $isISourced, 'INDI', 1, 'medium');
                        ?>
</td>
        					<td><?php 
                        echo $isISourced;
                        ?>
</td>
        					<?php 
                    } else {
                        ?>
        					<td>&nbsp;</td>
        					<td></td>
        					<?php 
                    }
                    ?>
        					<td><?php 
                    echo $missing_tab['has_father'] ? '&nbsp;' : 'X';
                    ?>
</td>
        					<td><?php 
                    echo $missing_tab['has_mother'] ? '&nbsp;' : 'X';
                    ?>
</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 
                    echo $person->getSex();
                    ?>
</td>
        				</tr>
                	<?php 
                }
                ?>
                	</tbody>
                	<tfoot>
						<tr>
							<td class="ui-state-default" colspan="16">
								<div class="center">
									<?php 
                echo I18N::translate('Number of different missing ancestors: %s', I18N::number($this->data->get('missing_diff_count')));
                ?>
									<?php 
                if ($this->data->get('missing_hidden') > 0) {
                    echo ' [' . I18N::translate('%s hidden', I18N::number($this->data->get('missing_hidden'))) . ']';
                }
                ?>
									<?php 
                echo ' - ' . I18N::translate('Generation complete at %s', I18N::percentage($this->data->get('perc_sosa'), 2));
                ?>
									<?php 
                echo ' [' . I18N::translate('Potential %s', I18N::percentage($this->data->get('perc_sosa_potential'), 2)) . ']';
                ?>
								</div>
							</td>
						</tr>
					</tfoot>
                </table>
    			 <?php 
            } else {
                if ($this->data->get('generation', 0) > 0) {
                    ?>
 
    			<p><?php 
                    echo I18N::translate('No ancestors are missing for this generation. Generation complete at %s.', I18N::percentage($this->data->get('perc_sosa'), 2));
                    ?>
</p>
    			    <?php 
                }
            }
        } else {
            ?>
    			<p class="warning"><?php 
            echo I18N::translate('The list could not be displayed. Reasons might be:');
            ?>
<br/>
    				<ul>
    					<li><?php 
            echo I18N::translate('No Sosa root individual has been defined.');
            ?>
</li>
    					<li><?php 
            echo I18N::translate('The Sosa ancestors have not been computed yet.');
            ?>
</li>
    					<li><?php 
            echo I18N::translate('No generation were found.');
            ?>
</li>
    				</ul>
    			</p>
    			<?php 
        }
        ?>
    		</div> 
    		<?php 
    }