예제 #1
0
파일: find.php 프로젝트: sadr110/webtrees
 global $dirs;
 $medialist = WT_Query_Media::mediaList('', 'include', 'title', $filter);
 echo '<div id="find-output">';
 if ($medialist) {
     foreach ($medialist as $media) {
         echo '<div class="find-media-media">';
         echo '<div class="find-media-thumb">', $media->displayImage(), '</div>';
         echo '<div class="find-media-details">', $media->getFullName(), '</div>';
         if (!$embed) {
             echo '<p><a href="#" dir="auto" onclick="pasteid(\'', $media->getXref(), '\');">', $media->getFilename(), '</a></p>';
         } else {
             echo '<p><a href="#" dir="auto" onclick="pasteid(\'', $media->getXref(), '\', \'', '\', \'', WT_Filter::escapeJs($media->getFilename()), '\');">', WT_Filter::escapeHtml($media->getFilename()), '</a></p> ';
         }
         if ($media->fileExists()) {
             $imgsize = $media->getImageAttributes();
             echo WT_Gedcom_Tag::getLabelValue('__IMAGE_SIZE__', $imgsize['WxH']);
         }
         echo '<ul>';
         $found = false;
         foreach ($media->linkedIndividuals('OBJE') as $indindividual) {
             echo '<li>', $indindividual->getFullName(), '</li>';
             $found = true;
         }
         foreach ($media->linkedFamilies('OBJE') as $family) {
             echo '<li>', $family->getFullName(), '</li>';
             $found = true;
         }
         foreach ($media->linkedSources('OBJE') as $source) {
             echo '<li>', $source->getFullName(), '</li>';
             $found = true;
         }
예제 #2
0
function print_main_media(WT_Fact $fact, $level)
{
    $factrec = $fact->getGedcom();
    $parent = $fact->getParent();
    if ($fact->isNew()) {
        $styleadd = 'new';
        $can_edit = $level == 1 && $fact->canEdit();
    } elseif ($fact->isOld()) {
        $styleadd = 'old';
        $can_edit = false;
    } else {
        $styleadd = '';
        $can_edit = $level == 1 && $fact->canEdit();
    }
    // -- find source for each fact
    preg_match_all('/(?:^|\\n)' . $level . ' OBJE @(.*)@/', $factrec, $matches);
    foreach ($matches[1] as $xref) {
        $media = WT_Media::getInstance($xref);
        // Allow access to "1 OBJE @non_existent_source@", so it can be corrected/deleted
        if (!$media || $media->canShow()) {
            if ($level > 1) {
                echo '<tr class="row_obje2">';
            } else {
                echo '<tr>';
            }
            echo '<td class="descriptionbox';
            if ($level > 1) {
                echo ' rela';
            }
            echo ' ', $styleadd, ' width20">';
            preg_match("/^\\d (\\w*)/", $factrec, $factname);
            $factlines = explode("\n", $factrec);
            // 1 BIRT Y\n2 SOUR ...
            $factwords = explode(" ", $factlines[0]);
            // 1 BIRT Y
            $factname = $factwords[1];
            // BIRT
            if ($factname == 'EVEN' || $factname == 'FACT') {
                // Add ' EVEN' to provide sensible output for an event with an empty TYPE record
                $ct = preg_match("/2 TYPE (.*)/", $factrec, $ematch);
                if ($ct > 0) {
                    $factname = $ematch[1];
                    echo $factname;
                } else {
                    echo WT_Gedcom_Tag::getLabel($factname, $parent);
                }
            } else {
                if ($can_edit) {
                    echo '<a onclick="window.open(\'addmedia.php?action=editmedia&amp;pid=', $media->getXref(), '\', \'_blank\', edit_window_specs); return false;" href="#" title="', WT_I18N::translate('Edit'), '">';
                    echo WT_Gedcom_Tag::getLabel($factname, $parent), '</a>';
                    echo '<div class="editfacts">';
                    echo '<div class="editlink"><a class="editicon" onclick="window.open(\'addmedia.php?action=editmedia&amp;pid=', $media->getXref(), '\', \'_blank\', edit_window_specs); return false;" href="#" title="', WT_I18N::translate('Edit'), '"><span class="link_text">', WT_I18N::translate('Edit'), '</span></a></div>';
                    echo '<div class="copylink"><a class="copyicon" href="#" onclick="jQuery.post(\'action.php\',{action:\'copy-fact\', type:\'\', factgedcom:\'' . rawurlencode($factrec) . '\'},function(){location.reload();})" title="' . WT_I18N::translate('Copy') . '"><span class="link_text">' . WT_I18N::translate('Copy') . '</span></a></div>';
                    echo '<div class="deletelink"><a class="deleteicon" onclick="return delete_fact(\'', WT_I18N::translate('Are you sure you want to delete this fact?'), '\', \'', $parent->getXref(), '\', \'', $fact->getFactId(), '\');" href="#" title="', WT_I18N::translate('Delete'), '"><span class="link_text">', WT_I18N::translate('Delete'), '</span></a></div>';
                    echo '</div>';
                } else {
                    echo WT_Gedcom_Tag::getLabel($factname, $parent);
                }
            }
            echo '</td>';
            echo '<td class="optionbox ', $styleadd, ' wrap">';
            if ($media) {
                echo '<span class="field">';
                echo $media->displayImage();
                if (empty($SEARCH_SPIDER)) {
                    echo '<a href="' . $media->getHtmlUrl() . '">';
                }
                echo '<em>';
                foreach ($media->getAllNames() as $name) {
                    if ($name['type'] != 'TITL') {
                        echo '<br>';
                    }
                    echo $name['full'];
                }
                echo '</em>';
                if (empty($SEARCH_SPIDER)) {
                    echo '</a>';
                }
                echo '</span>';
                echo WT_Gedcom_Tag::getLabelValue('FORM', $media->mimeType());
                $imgsize = $media->getImageAttributes('main');
                if (!empty($imgsize['WxH'])) {
                    echo WT_Gedcom_Tag::getLabelValue('__IMAGE_SIZE__', $imgsize['WxH']);
                }
                if ($media->getFilesizeraw() > 0) {
                    echo WT_Gedcom_Tag::getLabelValue('__FILE_SIZE__', $media->getFilesize());
                }
                $mediatype = $media->getMediaType();
                if ($mediatype) {
                    echo WT_Gedcom_Tag::getLabelValue('TYPE', WT_Gedcom_Tag::getFileFormTypeValue($mediatype));
                }
                switch ($media->isPrimary()) {
                    case 'Y':
                        echo WT_Gedcom_Tag::getLabelValue('_PRIM', WT_I18N::translate('yes'));
                        break;
                    case 'N':
                        echo WT_Gedcom_Tag::getLabelValue('_PRIM', WT_I18N::translate('no'));
                        break;
                }
                echo print_fact_notes($media->getGedcom(), 1);
                echo print_fact_sources($media->getGedcom(), 1);
            } else {
                echo $xref;
            }
            echo '</td></tr>';
        }
    }
}
예제 #3
0
function media_file_info($media_folder, $media_path, $file)
{
    $html = '<b>' . WT_Filter::escapeHtml($file) . '</b>';
    $full_path = WT_DATA_DIR . $media_folder . $media_path . $file;
    if ($file && file_exists($full_path)) {
        $size = @filesize($full_path);
        if ($size !== false) {
            $size = (int) (($size + 1023) / 1024);
            // Round up to next KB
            $size = WT_I18N::translate('%s KB', WT_I18N::number($size));
            $html .= WT_Gedcom_Tag::getLabelValue('__FILE_SIZE__', $size);
            $imgsize = @getimagesize($full_path);
            if (is_array($imgsize)) {
                $imgsize = WT_I18N::translate('%1$s × %2$s pixels', WT_I18N::number($imgsize['0']), WT_I18N::number($imgsize['1']));
                $html .= WT_Gedcom_Tag::getLabelValue('__IMAGE_SIZE__', $imgsize);
            }
        } else {
            $html .= '<div class="error">' . WT_I18N::translate('This media file exists, but cannot be accessed.') . '</div>';
        }
    } else {
        $html .= '<div class="error">' . WT_I18N::translate('This media file does not exist.') . '</div>';
    }
    return $html;
}
예제 #4
0
function format_asso_rela_record(WT_Fact $event)
{
    global $SEARCH_SPIDER;
    $parent = $event->getParent();
    // To whom is this record an assocate?
    if ($parent instanceof WT_Individual) {
        // On an individual page, we just show links to the person
        $associates = array($parent);
    } elseif ($parent instanceof WT_Family) {
        // On a family page, we show links to both spouses
        $associates = $parent->getSpouses();
    } else {
        // On other pages, it does not make sense to show associates
        return '';
    }
    preg_match_all('/^1 ASSO @(' . WT_REGEX_XREF . ')@((\\n[2-9].*)*)/', $event->getGedcom(), $amatches1, PREG_SET_ORDER);
    preg_match_all('/\\n2 _?ASSO @(' . WT_REGEX_XREF . ')@((\\n[3-9].*)*)/', $event->getGedcom(), $amatches2, PREG_SET_ORDER);
    $html = '';
    // For each ASSO record
    foreach (array_merge($amatches1, $amatches2) as $amatch) {
        $person = WT_Individual::getInstance($amatch[1]);
        if ($person) {
            // Is there a "RELA" tag
            if (preg_match('/\\n[23] RELA (.+)/', $amatch[2], $rmatch)) {
                // Use the supplied relationship as a label
                $label = WT_Gedcom_Code_Rela::getValue($rmatch[1], $person);
            } else {
                // Use a default label
                $label = WT_Gedcom_Tag::getLabel('ASSO', $person);
            }
            $values = array('<a href="' . $person->getHtmlUrl() . '">' . $person->getFullName() . '</a>');
            if (!$SEARCH_SPIDER) {
                foreach ($associates as $associate) {
                    $relationship_name = get_associate_relationship_name($associate, $person);
                    if (!$relationship_name) {
                        $relationship_name = WT_Gedcom_Tag::getLabel('RELA');
                    }
                    if ($parent instanceof WT_Family) {
                        // For family ASSO records (e.g. MARR), identify the spouse with a sex icon
                        $relationship_name .= $associate->getSexImage();
                    }
                    $values[] = '<a href="relationship.php?pid1=' . $associate->getXref() . '&amp;pid2=' . $person->getXref() . '&amp;ged=' . WT_GEDURL . '">' . $relationship_name . '</a>';
                }
            }
            $value = implode(' — ', $values);
            // Use same markup as WT_Gedcom_Tag::getLabelValue()
            $asso = WT_I18N::translate('<span class="label">%1$s:</span> <span class="field" dir="auto">%2$s</span>', $label, $value);
        } else {
            $asso = WT_Gedcom_Tag::getLabelValue('ASSO', '<span class="error">' . $amatch[1] . '</span>');
        }
        $html .= '<div class="fact_ASSO">' . $asso . '</div>';
    }
    return $html;
}
예제 #5
0
function keep_chan(WT_GedcomRecord $record = null)
{
    global $NO_UPDATE_CHAN;
    if (Auth::isAdmin()) {
        $checked = $NO_UPDATE_CHAN ? ' checked="checked"' : '';
        if ($record) {
            $details = WT_Gedcom_Tag::getLabelValue('DATE', $record->lastChangeTimestamp()) . WT_Gedcom_Tag::getLabelValue('_WT_USER', $record->lastChangeUser());
        } else {
            $details = '';
        }
        return '<tr><td class="descriptionbox wrap width25">' . WT_Gedcom_Tag::getLabel('CHAN') . '</td><td class="optionbox wrap">' . '<input type="checkbox" name="keep_chan" value="1"' . $checked . '>' . WT_I18N::translate('Do not update the “last change” record') . help_link('no_update_CHAN') . $details . '</td></tr>';
    } else {
        return '';
    }
}
예제 #6
0
    function printFamily(WT_Family $family, $type, $label)
    {
        global $controller;
        global $personcount;
        // TODO: use a unique id instead?
        global $SHOW_PRIVATE_RELATIONSHIPS;
        if ($SHOW_PRIVATE_RELATIONSHIPS) {
            $access_level = WT_PRIV_HIDE;
        } else {
            $access_level = WT_USER_ACCESS_LEVEL;
        }
        ?>
		<table>
			<tr>
				<td>
					<i class="icon-cfamily"></i>
				</td>
				<td>
					<span class="subheaders"> <?php 
        echo $label;
        ?>
 </span> -
					<a href="<?php 
        echo $family->getHtmlUrl();
        ?>
"><?php 
        echo WT_I18N::translate('View family');
        ?>
</a>
				</td>
			</tr>
		</table>
		<table class="facts_table">
		<?php 
        ///// HUSB /////
        $found = false;
        foreach ($family->getFacts('HUSB', false, $access_level) as $fact) {
            $found |= !$fact->isOld();
            $person = $fact->getTarget();
            if ($person instanceof WT_Individual) {
                if ($fact->isNew()) {
                    $class = 'facts_label new';
                } elseif ($fact->isOld()) {
                    $class = 'facts_label old';
                } else {
                    $class = 'facts_label';
                }
                ?>
					<tr>
					<td class="<?php 
                echo $class;
                ?>
">
						<?php 
                echo get_close_relationship_name($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                print_pedigree_person($person, 2, 0, $personcount++);
                ?>
					</td>
					</tr>
				<?php 
            }
        }
        if (!$found && $family->canEdit()) {
            ?>
			<tr>
				<td class="facts_label">&nbsp;</td>
				<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php 
            echo $family->getXref();
            ?>
', 'HUSB');"><?php 
            echo WT_I18N::translate('Add a husband to this family');
            ?>
</a></td>
			</tr>
			<?php 
        }
        ///// WIFE /////
        $found = false;
        foreach ($family->getFacts('WIFE', false, $access_level) as $fact) {
            $person = $fact->getTarget();
            if ($person instanceof WT_Individual) {
                $found |= !$fact->isOld();
                if ($fact->isNew()) {
                    $class = 'facts_label new';
                } elseif ($fact->isOld()) {
                    $class = 'facts_label old';
                } else {
                    $class = 'facts_label';
                }
                ?>
				<tr>
					<td class="<?php 
                echo $class;
                ?>
">
						<?php 
                echo get_close_relationship_name($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                print_pedigree_person($person, 2, 0, $personcount++);
                ?>
					</td>
				</tr>
				<?php 
            }
        }
        if (!$found && $family->canEdit()) {
            ?>
			<tr>
				<td class="facts_label">&nbsp;</td>
				<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php 
            echo $family->getXref();
            ?>
', 'WIFE');"><?php 
            echo WT_I18N::translate('Add a wife to this family');
            ?>
</a></td>
			</tr>
			<?php 
        }
        ///// MARR /////
        $found = false;
        $prev = new WT_Date('');
        foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) {
            $found |= !$fact->isOld();
            if ($fact->isNew()) {
                $class = ' new';
            } elseif ($fact->isOld()) {
                $class = ' old';
            } else {
                $class = '';
            }
            ?>
			<tr>
				<td class="facts_label">
					&nbsp;
				</td>
				<td class="facts_value<?php 
            echo $class;
            ?>
">
					<?php 
            echo WT_Gedcom_Tag::getLabelValue($fact->getTag(), $fact->getDate()->Display(false) . ' — ' . $fact->getPlace()->getFullName());
            ?>
				</td>
			</tr>
			<?php 
            if (!$prev->isOK() && $fact->getDate()->isOK()) {
                $prev = $fact->getDate();
            }
        }
        if (!$found && $family->canShow() && $family->canEdit()) {
            // Add a new marriage
            ?>
			<tr>
				<td class="facts_label">
					&nbsp;
				</td>
				<td class="facts_value">
					<a href="#" onclick="return add_new_record('<?php 
            echo $family->getXref();
            ?>
', 'MARR');">
						<?php 
            echo WT_I18N::translate('Add marriage details');
            ?>
					</a>
				</td>
			</tr>
			<?php 
        }
        ///// CHIL /////
        $child_number = 0;
        foreach ($family->getFacts('CHIL', false, $access_level) as $fact) {
            $person = $fact->getTarget();
            if ($person instanceof WT_Individual) {
                if ($fact->isNew()) {
                    $child_number++;
                    $class = 'facts_label new';
                } elseif ($fact->isOld()) {
                    $class = 'facts_label old';
                } else {
                    $child_number++;
                    $class = 'facts_label';
                }
                $next = new WT_Date('');
                foreach ($person->getFacts(WT_EVENTS_BIRT) as $bfact) {
                    if ($bfact->getDate()->isOK()) {
                        $next = $bfact->getDate();
                        break;
                    }
                }
                ?>
				<tr>
					<td class="<?php 
                echo $class;
                ?>
">
						<?php 
                echo self::ageDifference($prev, $next, $child_number);
                ?>
						<?php 
                echo get_close_relationship_name($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                print_pedigree_person($person, 2, 0, $personcount++);
                ?>
					</td>
				</tr>
				<?php 
                $prev = $next;
            }
        }
        // Re-order children / add a new child
        if ($family->canEdit()) {
            if ($type == 'FAMS') {
                $child_u = WT_I18N::translate('Add a new son or daughter');
                $child_m = WT_I18N::translate('son');
                $child_f = WT_I18N::translate('daughter');
            } else {
                $child_u = WT_I18N::translate('Add a new brother or sister');
                $child_m = WT_I18N::translate('brother');
                $child_f = WT_I18N::translate('sister');
            }
            ?>
			<tr>
				<td class="facts_label">
					<?php 
            if (count($family->getChildren()) > 1) {
                ?>
					<a href="#" onclick="reorder_children('<?php 
                echo $family->getXref();
                ?>
');tabswitch(5);"><i class="icon-media-shuffle"></i> <?php 
                echo WT_I18N::translate('Re-order children');
                ?>
</a>
					<?php 
            }
            ?>
				</td>
				<td class="facts_value">
					<a href="#" onclick="return add_child_to_family('<?php 
            echo $family->getXref();
            ?>
');"><?php 
            echo $child_u;
            ?>
</a>
					<span style='white-space:nowrap;'>
						<a href="#" class="icon-sex_m_15x15" onclick="return add_child_to_family('<?php 
            echo $family->getXref();
            ?>
','M');"></a>
						<a href="#" class="icon-sex_f_15x15" onclick="return add_child_to_family('<?php 
            echo $family->getXref();
            ?>
','F');"></a>
					</span>
				</td>
			</tr>
			<?php 
        }
        echo '</table>';
        return;
    }
예제 #7
0
파일: Fact.php 프로젝트: brambravo/webtrees
 public function summary()
 {
     global $SHOW_PARENTS_AGE;
     $attributes = array();
     $target = $this->getTarget();
     if ($target) {
         $attributes[] = $target->getFullName();
     } else {
         $value = $this->getValue();
         if ($value && $value != 'Y') {
             $attributes[] = '<span dir="auto">' . WT_Filter::escapeHtml($value) . '</span>';
         }
         $date = $this->getDate();
         if ($this->getTag() == 'BIRT' && $SHOW_PARENTS_AGE && $this->getParent() instanceof WT_Individual) {
             $attributes[] = $date->display() . format_parents_age($this->getParent(), $date);
         } else {
             $attributes[] = $date->display();
         }
         $place = $this->getPlace()->getShortName();
         if ($place) {
             $attributes[] = $place;
         }
     }
     $html = WT_Gedcom_Tag::getLabelValue($this->getTag(), implode(' — ', $attributes), $this->getParent());
     if ($this->isNew()) {
         return '<div class="new">' . $html . '</div>';
     } elseif ($this->isOld()) {
         return '<div class="old">' . $html . '</div>';
     } else {
         return $html;
     }
 }
예제 #8
0
if ($controller->record->canShow()) {
    // Highlight image or silhouette
    echo '<div id="indi_mainimage">', $controller->record->displayImage(), '</div>';
    echo '<div id="header_accordion1">';
    // contain accordions for names
    echo '<h3 class="name_one ', $controller->getPersonStyle($controller->record), '"><span>', $controller->record->getFullName(), '</span>';
    // First name accordion header
    $bdate = $controller->record->getBirthDate();
    $ddate = $controller->record->getDeathDate();
    echo '<span class="header_age">';
    if ($bdate->isOK() && !$controller->record->isDead()) {
        // If living display age
        echo WT_Gedcom_Tag::getLabelValue('AGE', get_age_at_event(WT_Date::GetAgeGedcom($bdate), true), '', 'span');
    } elseif ($bdate->isOK() && $ddate->isOK()) {
        // If dead, show age at death
        echo WT_Gedcom_Tag::getLabelValue('AGE', get_age_at_event(WT_Date::GetAgeGedcom($bdate, $ddate), false), '', 'span');
    }
    echo '</span>';
    // Display summary birth/death info.
    echo '<span id="dates">', $controller->record->getLifeSpan(), '</span>';
    // Display gender icon
    foreach ($controller->record->getFacts() as $fact) {
        if ($fact->getTag() == 'SEX') {
            $controller->print_sex_record($fact);
        }
    }
    echo '</h3>';
    // close first name accordion header
    // Display name details
    foreach ($controller->record->getFacts() as $fact) {
        if ($fact->getTag() == 'NAME') {