Esempio n. 1
0
 /**
  * Add additional options to the core formatFirstMajorFact function.
  * If no option is suitable, it will try returning the core function.
  *
  * Option 10 : display <i>factLabel shortFactDate shortFactPlace</i>
  *
  * @uses \MyArtJaub\Webtrees\Functions\FunctionsPrint
  * @param string $facts List of facts to find information from
  * @param int $style Style to apply to the information. Number >= 10 should be used in this function, lower number will return the core function.
  * @return string Formatted fact description
  */
 public function formatFirstMajorFact($facts, $style)
 {
     foreach ($this->gedcomrecord->getFacts($facts) as $fact) {
         // Only display if it has a date or place (or both)
         if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) {
             switch ($style) {
                 case 10:
                     return '<i>' . $fact->getLabel() . ' ' . mw\Functions\FunctionsPrint::formatFactDateShort($fact) . '&nbsp;' . mw\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') . '</i>';
                 default:
                     return $this->gedcomrecord->formatFirstMajorFact($facts, $style);
             }
         }
     }
     return '';
 }
 /**
  * Return the HTML code to display a row with all places found in a generation.
  *
  * @param array $data Data array
  * @param int $analysis_level Level of subdivision of analysis
  * @return string HTML code for all places row
  */
 protected function htmlGenerationAllPlacesRow($data, $analysis_level)
 {
     $html = '<table class="geodispersion_bigrow">
         <tr>';
     $sum_gen = $data['sum'];
     $unknownother = $data['unknown'] + $data['other'];
     foreach ($data['places'] as $placename => $dataplace) {
         $levels = array_map('trim', explode(',', $placename));
         $content = '';
         if (isset($dataplace['flag'])) {
             $content .= '<td class="geodispersion_flag">' . FunctionsPrint::htmlPlaceIcon($dataplace['place'], $dataplace['flag']) . '</td><td>';
         } else {
             $content .= '<td><span title="' . implode(I18N::$list_separator, array_reverse($levels)) . '">' . $levels[$analysis_level - 1] . '</span><br/>';
         }
         $count = $dataplace['count'];
         $content .= I18N::number($count);
         $perc = Functions::safeDivision($count, $sum_gen + $unknownother);
         $perc2 = Functions::safeDivision($count, $sum_gen);
         if ($perc2 >= 0.1) {
             $content .= '<br/><span class="small">(' . I18N::percentage($perc2, 1) . ')</span>';
         }
         $content .= '</td>';
         $html .= '
             <td class="geodispersion_rowitem" width="' . max(round(100 * $perc, 0), 1) . '%">
                 <table>
                     <tr>
                         <td>
                             <table>
                                 <tr>' . $content . '</tr>
                             </table>
                         </td>
                     </tr>
                 </table>
             </td>';
     }
     if ($unknownother > 0) {
         $perc = Functions::safeDivision($unknownother, $sum_gen + $unknownother);
         $html .= '<td class="geodispersion_unknownitem left" >' . I18N::number($unknownother);
         if ($perc >= 0.1) {
             $html .= '<br/><span class="small">(' . I18N::percentage($perc, 1) . ')</span>';
         }
         $html .= '</td>';
     }
     $html .= '</tr>
     </table>';
     return $html;
 }
Esempio n. 3
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 
        }
    }
Esempio n. 4
0
 /**
  * Print a lineage node, recursively.
  * @param LineageNode $node
  */
 private function printLineage(LineageNode $node)
 {
     echo '<ul>';
     $fam_nodes = $node->getFamiliesNodes();
     if (count($fam_nodes) > 0) {
         $is_first_family = true;
         foreach ($fam_nodes as $fam) {
             $node_indi = $node->getIndividual();
             echo '<li>';
             if ($is_first_family) {
                 echo FunctionsPrint::htmlIndividualForList($node_indi);
             } else {
                 echo FunctionsPrint::htmlIndividualForList($node_indi, false);
             }
             //Get individual's spouse
             $dfam = new Family($fam);
             $spouse = $dfam->getSpouseById($node_indi);
             //Print the spouse if relevant
             if ($spouse) {
                 $marrdate = I18N::translate('yes');
                 $marryear = '';
                 echo '&nbsp;<a href="' . $fam->getHtmlUrl() . '">';
                 if ($fam->getMarriageYear()) {
                     $marrdate = strip_tags($fam->getMarriageDate()->Display());
                     $marryear = $fam->getMarriageYear();
                 }
                 echo '<span class="details1" title="' . $marrdate . '"><i class="icon-rings"></i>' . $marryear . '</span></a>&nbsp;';
                 echo FunctionsPrint::htmlIndividualForList($spouse);
             }
             foreach ($fam_nodes[$fam] as $child_node) {
                 if ($child_node) {
                     $this->printLineage($child_node);
                 } else {
                     echo '<ul><li><strong>&hellip;</strong></li></ul>';
                 }
             }
             $is_first_family = false;
         }
     } else {
         echo '<li>';
         echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual());
         if ($node->hasFollowUpSurname()) {
             $url_base = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage';
             echo '&nbsp;' . '<a href="' . $url_base . '&surname=' . rawurlencode($node->getFollowUpSurname()) . '&amp;ged=' . $this->data->get('tree')->getNameUrl() . '">' . '(' . I18N::translate('Go to %s lineages', $node->getFollowUpSurname()) . ')' . '</a>';
         }
         echo '</li>';
     }
     echo '</ul>';
 }
Esempio n. 5
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 
        }
    }
Esempio n. 6
0
    /**
     * Render the Ajax response for the sortable table of Sosa family
     * @param AjaxController $controller
     */
    protected function renderFamSosaListIndi(AjaxController $controller)
    {
        global $WT_TREE;
        $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);
        $this->view_bag->set('has_sosa', false);
        if (count($listFamSosa) > 0) {
            $this->view_bag->set('has_sosa', true);
            $table_id = 'table-sosa-fam-' . Uuid::uuid4();
            $this->view_bag->set('table_id', $table_id);
            $controller->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addInlineJavascript('
                jQuery.fn.dataTableExt.oSort["unicode-asc"  ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))};
				jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))};
				jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);};
				jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);};
        
                jQuery("#' . $table_id . '").dataTable( {
					dom: \'<"H"<"filtersH_' . $table_id . '"><"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\',
                    ' . I18N::datatablesI18N(array(16, 32, 64, 128, -1)) . ',
					jQueryUI: true,
					autoWidth: false,
					processing: true,
					retrieve: true,
					columns: [
						/* 0-Sosa */  	   { dataSort: 1, class: "center"},
		                /* 1-SOSA */ 	   { type: "num", visible: false },
						/* 2-Husb Givn */  { dataSort: 4},
						/* 3-Husb Surn */  { dataSort: 5},
						/* 4-GIVN,SURN */  { type: "unicode", visible: false},
						/* 5-SURN,GIVN */  { type: "unicode", visible: false},
						/* 6-Husb Age  */  { dataSort: 7, class: "center"},
						/* 7-AGE       */  { type: "num", visible: false},
						/* 8-Wife Givn */  { dataSort: 10},
						/* 9-Wife Surn */  { dataSort: 11},
						/* 10-GIVN,SURN */ { type: "unicode", visible: false},
						/* 11-SURN,GIVN */ { type: "unicode", visible: false},
						/* 12-Wife Age  */ { dataSort: 13, class: "center"},
						/* 13-AGE       */ { type: "num", visible: false},
						/* 14-Marr Date */ { dataSort: 15, class: "center"},
						/* 15-MARR:DATE */ { visible: false},
						/* 16-Marr Plac */ { type: "unicode", class: "center"},
						/* 17-Marr Sour */ { dataSort : 18, class: "center", visible: ' . (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME) ? 'true' : 'false') . ' },
						/* 18-Sort Sour */ { visible: false},
						/* 19-Children  */ { dataSort: 20, class: "center"},
						/* 20-NCHI      */ { type: "num", visible: false},
						/* 21-MARR      */ { visible: false},
						/* 22-DEAT      */ { visible: false},
						/* 23-TREE      */ { visible: false}
					],
					sorting: [[0, "asc"]],
					displayLength: 16,
					pagingType: "full_numbers"
			   });
					
				jQuery("#' . $table_id . '")
				/* Hide/show parents */
				.on("click", ".btn-toggle-parents", function() {
					jQuery(this).toggleClass("ui-state-active");
					jQuery(".parents", jQuery(this).closest("table").DataTable().rows().nodes()).slideToggle();
				})
				/* Hide/show statistics */
				.on("click",  ".btn-toggle-statistics", function() {
					jQuery(this).toggleClass("ui-state-active");
					jQuery("#fam_list_table-charts_' . $table_id . '").slideToggle();
				})
				/* Filter buttons in table header */
				.on("click", "button[data-filter-column]", function() {
					var btn = $(this);
					// De-activate the other buttons in this button group
					btn.siblings().removeClass("ui-state-active");
					// Apply (or clear) this filter
					var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column"));
					if (btn.hasClass("ui-state-active")) {
						btn.removeClass("ui-state-active");
						col.search("").draw();
					} else {
						btn.addClass("ui-state-active");
						col.search(btn.data("filter-value")).draw();
					}
				});					
				
				jQuery("#sosa-fam-list").css("visibility", "visible");
				
				jQuery("#btn-toggle-statistics-' . $table_id . '").click();
           ');
            $stats = new Stats($WT_TREE);
            $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1;
            //-- init chart data
            $marr_by_age = array();
            for ($age = 0; $age <= $max_age; $age++) {
                $marr_by_age[$age] = '';
            }
            $birt_by_decade = array();
            $marr_by_decade = array();
            for ($year = 1550; $year < 2030; $year += 10) {
                $birt_by_decade[$year] = '';
                $marr_by_decade[$year] = '';
            }
            foreach ($listFamSosa as $sosa => $fid) {
                $sfamily = Family::getInstance($fid, $WT_TREE);
                if (!$sfamily || !$sfamily->canShow()) {
                    unset($sfamily[$sosa]);
                    continue;
                }
                $mdate = $sfamily->getMarriageDate();
                if (($husb = $sfamily->getHusband()) && ($hdate = $husb->getBirthDate()) && $hdate->isOK() && $mdate->isOK()) {
                    if (FunctionsPrint::isDateWithinChartsRange($hdate)) {
                        $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex();
                    }
                    $hage = Date::getAge($hdate, $mdate, 0);
                    if ($hage >= 0 && $hage <= $max_age) {
                        $marr_by_age[$hage] .= $husb->getSex();
                    }
                }
                if (($wife = $sfamily->getWife()) && ($wdate = $wife->getBirthDate()) && $wdate->isOK() && $mdate->isOK()) {
                    if (FunctionsPrint::isDateWithinChartsRange($wdate)) {
                        $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex();
                    }
                    $wage = Date::getAge($wdate, $mdate, 0);
                    if ($wage >= 0 && $wage <= $max_age) {
                        $marr_by_age[$wage] .= $wife->getSex();
                    }
                }
                if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) {
                    $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex();
                }
                $listFamSosa[$sosa] = $sfamily;
            }
            $this->view_bag->set('sosa_list', $listFamSosa);
            $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth')));
            $this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage')));
            $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage')));
        }
        ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render();
    }
Esempio n. 7
0
    /**
     * {@inheritDoc}
     * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent()
     */
    public function getSidebarContent()
    {
        global $controller;
        ob_start();
        $root = $controller->getSignificantIndividual();
        if ($root) {
            $dindi = new Individual($root);
            if (!$dindi->canDisplayIsSourced()) {
                echo '<div class="error">', I18N::translate('This information is private and cannot be shown.'), '</div>';
            } else {
                echo '
	                <table class="issourcedtable">
	                   <tr>
	                       <td class="slabel"> ' . GedcomTag::getLabel('INDI') . '</td>
	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1) . '</td>
	                   </tr>
	                   <tr>
	                       <td class="slabel">' . GedcomTag::getLabel('BIRT') . '</td>
	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1) . '</td>
	                   </tr>';
                $fams = $root->getSpouseFamilies();
                ($ct = count($fams)) > 1 ? $nb = 1 : ($nb = ' ');
                foreach ($fams as $fam) {
                    $dfam = new Family($fam);
                    echo '
	                    <tr>
	                       <td class="slabel right">
	                           <a href="' . $fam->getHtmlUrl() . '"> ' . GedcomTag::getLabel('MARR');
                    if ($ct > 1) {
                        echo ' ', $nb;
                        $nb++;
                    }
                    echo '     </a>
	                       </td>
	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dfam->isMarriageSourced(), 'MARR', 1) . '</td>
	                   </tr>';
                }
                if ($root->isDead()) {
                    echo '
	                    <tr>
	                       <td class="slabel">' . GedcomTag::getLabel('DEAT') . '</td>
	                       <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1) . '</td>
	                   </tr>';
                }
                echo '</table>';
            }
        }
        return ob_get_clean();
    }
Esempio n. 8
0
 /**
  * Return HTML Code to display individual in non structured list (e.g. Patronymic Lineages)
  *
  * @param \Fisharebest\Webtrees\Individual $individual Individual to print
  * @param bool $isStrong Bolden the name ?
  * @return string HTML Code for individual item
  */
 public static function htmlIndividualForList(\Fisharebest\Webtrees\Individual $individual, $isStrong = true)
 {
     $html = '';
     $tag = 'em';
     if ($isStrong) {
         $tag = 'strong';
     }
     if ($individual && $individual->canShow()) {
         $dindi = new Individual($individual);
         $html = $individual->getSexImage();
         $html .= '<a class="list_item" href="' . $individual->getHtmlUrl() . '" title="' . I18N::translate('Informations for individual %s', $individual->getXref()) . '">';
         $html .= '<' . $tag . '>' . $individual->getFullName() . '</' . $tag . '>&nbsp;(' . $individual->getXref() . ')&nbsp;';
         $html .= FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small');
         $html .= '&nbsp;<span><small><em>' . $dindi->formatFirstMajorFact(WT_EVENTS_BIRT, 10) . '</em></small></span>';
         $html .= '&nbsp;<span><small><em>' . $dindi->formatFirstMajorFact(WT_EVENTS_DEAT, 10) . '</em></small></span>';
         $html .= '</a>';
     } else {
         $html .= '<span class=\\"list_item\\"><' . $tag . '>' . I18N::translate('Private') . '</' . $tag . '></span>';
     }
     return $html;
 }
    /**
     * {@inheritDoc}
     * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderLeft()
     */
    public function hExtendIndiHeaderLeft(IndividualController $ctrlIndi)
    {
        $res = '';
        $dindi = new Individual($ctrlIndi->getSignificantIndividual());
        $titles = $dindi->getTitles();
        if (count($titles) > 0) {
            $res = '
	            <dl>
	               <dt class="label">' . I18N::translate('Titles') . '</dt>';
            foreach ($titles as $title => $props) {
                $res .= '<dd class="field">' . $title . ' ' . FunctionsPrint::getListFromArray($props) . '</dd>';
            }
            $res .= '</dl>';
        }
        return array('indi-header-titles', $res);
    }
Esempio n. 10
0
 /**
  * {@inhericDoc}
  * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend()
  */
 public function hRecordNameAppend(GedcomRecord $grec)
 {
     if ($grec instanceof \Fisharebest\Webtrees\Individual) {
         // Only apply to individuals
         $dindi = new Individual($grec);
         return FunctionsPrint::formatSosaNumbers($dindi->getSosaNumbers(), 1, 'small');
     }
     return '';
 }
    /**
     * {@inheritDoc}
     * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisTabGeneralView::htmlAnalysisData()
     */
    protected function htmlAnalysisData()
    {
        /** @var OutlineMap $map */
        $map = $this->data->get('map');
        $canvas = $map->getCanvas();
        $subdvisions_results = $this->data->get('results_by_subdivisions');
        $nb_found = $this->data->get('stats_gen_nb_found');
        $nb_other = $this->data->get('stats_gen_nb_other');
        $html = '<script>
			var tip = null;
			var tipText = "";
			var over = false;
			var isin = false;

			function addTip(node, txt){
			    jQuery(node).bind({
			    	mouseover : function(){
			    		oldisin = isin;
			    		isin = true;
			    		if(oldisin != isin){
			       			tipText = txt;
			       			tip.stop(true, true).fadeIn();
			       			over = true;
			       		}
			    	},
			    	mouseout : function(){
			    		oldisin = isin;
			    		isin = false;
			    		if(oldisin != isin){
			       			tip.stop(true, true).fadeOut("fast");
			       			over = false;
			       		}
			    	}

			    });
			}
			jQuery(document).ready(function() {
				tip = $("#geodispersion_tip").hide();

				var positionTab = jQuery("#geodispersion-tabs").offset();

				jQuery("#geodispersion_map").mousemove(function(e){
				    if (over){
					  tip.css("left", e.pageX + 20 - positionTab.left).css("top", e.pageY + 20 - positionTab.top);
				      tip.html(tipText);
				    }
				});

				var paper = new Raphael(document.getElementById("geodispersion_map"), ' . $canvas->width . ', ' . $canvas->height . ');
				var background = paper.rect(0, 0, ' . $canvas->width . ', ' . $canvas->height . ');
				background.attr({"fill" : "' . $canvas->background_color . '", "stroke" : "' . $canvas->background_stroke . '", "stroke-width": 1, "stroke-linejoin": "round" });
				var attr = { fill: "' . $canvas->default_color . '", stroke: "' . $canvas->default_stroke . '", "stroke-width": 1, "stroke-linejoin": "round" };
				var map = {};
		';
        foreach ($subdvisions_results as $name => $location) {
            $html .= 'map.area' . $location['id'] . ' = paper.path("' . $location['coord'] . '").attr(attr);';
            if (isset($location['transparency'])) {
                $textToolTip = '<strong>' . $location['displayname'] . '</strong><br/>';
                if ($this->data->get('use_flags') && $location['flag'] != '') {
                    $textToolTip .= '<span class="geodispersion_flag">' . FunctionsPrint::htmlPlaceIcon($location['place'], $location['flag']) . '</span><br/>';
                }
                $textToolTip .= I18N::translate('%d individuals', $location['count']) . '<br/>' . I18N::percentage(Functions::safeDivision($location['count'], $nb_found - $nb_other), 1);
                $html .= 'addTip(map.area' . $location['id'] . '.node, "' . Filter::escapeJs($textToolTip) . '");';
                $html .= 'map.area' . $location['id'] . '.attr({"fill" : "' . $canvas->max_color . '", "fill-opacity" : ' . $location['transparency'] . ' });';
                $html .= 'map.area' . $location['id'] . '.mouseover(function () {' . 'map.area' . $location['id'] . '.stop().animate({"fill" : "' . $canvas->hover_color . '", "fill-opacity" : 1}, 100, "linear");' . '});' . 'map.area' . $location['id'] . '.mouseout(function () {' . 'map.area' . $location['id'] . '.stop().animate({"fill" : "' . $canvas->max_color . '", "fill-opacity" : ' . $location['transparency'] . '}, 100, "linear");' . '});';
            }
        }
        $html .= '});
            </script>
            
            <div id="geodispersion_map"></div>
    	   <div id="geodispersion_tip"></div>';
        return $html;
    }
Esempio n. 12
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 
    }