本文整理汇总了PHP中Fisharebest\Webtrees\Functions\Functions类的典型用法代码示例。如果您正苦于以下问题:PHP Functions类的具体用法?PHP Functions怎么用?PHP Functions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Functions类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: generate
/**
* Generate the likely value of this census column, based on available information.
*
* @param Individual $individual
* @param Individual|null $head
*
* @return string
*/
public function generate(Individual $individual, Individual $head = null)
{
if ($head === null) {
return '';
} elseif ($individual == $head) {
return 'head';
} else {
return Functions::getCloseRelationshipName($head, $individual);
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:18,代码来源:CensusColumnRelationToHead.php
示例2: getFacts
/**
* Return a list of facts
*
* @return Fact[]
*/
public function getFacts()
{
$facts = $this->record->getFacts();
// Add some dummy facts to show additional information
if ($this->record->fileExists()) {
// get height and width of image, when available
$imgsize = $this->record->getImageAttributes();
if (!empty($imgsize['WxH'])) {
$facts[] = new Fact('1 __IMAGE_SIZE__ ' . $imgsize['WxH'], $this->record, 0);
}
//Prints the file size
$facts[] = new Fact('1 __FILE_SIZE__ ' . $this->record->getFilesize(), $this->record, 0);
}
Functions::sortFacts($facts);
return $facts;
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:21,代码来源:MediaController.php
示例3: menuLogin
public function menuLogin()
{
if (Auth::check() || Auth::isSearchEngine()) {
return null;
} else {
return '<div class="menu-login btn-group">' . '<a href="' . WT_LOGIN_URL . '?url=' . rawurlencode(Functions::getQueryUrl()) . '" class="btn btn-default">' . I18N::translate('Sign in') . '</a></div>';
}
}
开发者ID:bxbroze,项目名称:justlight,代码行数:8,代码来源:theme.php
示例4: formatFactPlace
/**
* print fact PLACe TEMPle STATus
*
* @param Fact $event gedcom fact record
* @param bool $anchor to print a link to placelist
* @param bool $sub_records to print place subrecords
* @param bool $lds to print LDS TEMPle and STATus
*
* @return string HTML
*/
public static function formatFactPlace(Fact $event, $anchor = false, $sub_records = false, $lds = false)
{
if ($anchor) {
// Show the full place name, for facts/events tab
$html = '<a href="' . $event->getPlace()->getURL() . '">' . $event->getPlace()->getFullName() . '</a>';
} else {
// Abbreviate the place name, for chart boxes
return ' - ' . $event->getPlace()->getShortName();
}
if ($sub_records) {
$placerec = Functions::getSubRecord(2, '2 PLAC', $event->getGedcom());
if (!empty($placerec)) {
if (preg_match_all('/\\n3 (?:_HEB|ROMN) (.+)/', $placerec, $matches)) {
foreach ($matches[1] as $match) {
$wt_place = new Place($match, $event->getParent()->getTree());
$html .= ' - ' . $wt_place->getFullName();
}
}
$map_lati = "";
$cts = preg_match('/\\d LATI (.*)/', $placerec, $match);
if ($cts > 0) {
$map_lati = $match[1];
$html .= '<br><span class="label">' . GedcomTag::getLabel('LATI') . ': </span>' . $map_lati;
}
$map_long = '';
$cts = preg_match('/\\d LONG (.*)/', $placerec, $match);
if ($cts > 0) {
$map_long = $match[1];
$html .= ' <span class="label">' . GedcomTag::getLabel('LONG') . ': </span>' . $map_long;
}
if ($map_lati && $map_long) {
$map_lati = trim(strtr($map_lati, "NSEW,�", " - -. "));
// S5,6789 ==> -5.6789
$map_long = trim(strtr($map_long, "NSEW,�", " - -. "));
// E3.456� ==> 3.456
$html .= ' <a rel="nofollow" href="https://maps.google.com/maps?q=' . $map_lati . ',' . $map_long . '" class="icon-googlemaps" title="' . I18N::translate('Google Maps™') . '"></a>';
$html .= ' <a rel="nofollow" href="https://www.bing.com/maps/?lvl=15&cp=' . $map_lati . '~' . $map_long . '" class="icon-bing" title="' . I18N::translate('Bing Maps™') . '"></a>';
$html .= ' <a rel="nofollow" href="https://www.openstreetmap.org/#map=15/' . $map_lati . '/' . $map_long . '" class="icon-osm" title="' . I18N::translate('OpenStreetMap™') . '"></a>';
}
if (preg_match('/\\d NOTE (.*)/', $placerec, $match)) {
$html .= '<br>' . self::printFactNotes($placerec, 3);
}
}
}
if ($lds) {
if (preg_match('/2 TEMP (.*)/', $event->getGedcom(), $match)) {
$html .= '<br>' . I18N::translate('LDS temple') . ': ' . GedcomCodeTemp::templeName($match[1]);
}
if (preg_match('/2 STAT (.*)/', $event->getGedcom(), $match)) {
$html .= '<br>' . I18N::translate('Status') . ': ' . GedcomCodeStat::statusName($match[1]);
if (preg_match('/3 DATE (.*)/', $event->getGedcom(), $match)) {
$date = new Date($match[1]);
$html .= ', ' . GedcomTag::getLabel('STAT:DATE') . ': ' . $date->display();
}
}
}
return $html;
}
开发者ID:jflash,项目名称:webtrees,代码行数:68,代码来源:FunctionsPrint.php
示例5: adminPlaces
//.........这里部分代码省略.........
<a href="?mod=googlemap&mod_action=admin_config" role="tab">
<?php
echo I18N::translate('Google Maps™ preferences');
?>
</a>
</li>
<li role="presentation" class="active">
<a href="#">
<?php
echo I18N::translate('Geographic data');
?>
</a>
</li>
<li role="presentation">
<a href="?mod=googlemap&mod_action=admin_placecheck">
<?php
echo I18N::translate('Place check');
?>
</a>
</li>
</ul>
<h2><?php
echo I18N::translate('Geographic data');
?>
</h2>
<?php
if ($action == 'ImportGedcom') {
$placelist = array();
$j = 0;
$gedcom_records = Database::prepare("SELECT i_gedcom FROM `##individuals` WHERE i_file=? UNION ALL SELECT f_gedcom FROM `##families` WHERE f_file=?")->execute(array($WT_TREE->getTreeId(), $WT_TREE->getTreeId()))->fetchOneColumn();
foreach ($gedcom_records as $gedrec) {
$i = 1;
$placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i);
while (!empty($placerec)) {
if (preg_match("/2 PLAC (.+)/", $placerec, $match)) {
$placelist[$j] = array();
$placelist[$j]['place'] = trim($match[1]);
if (preg_match("/4 LATI (.*)/", $placerec, $match)) {
$placelist[$j]['lati'] = trim($match[1]);
if ($placelist[$j]['lati'][0] != 'N' && $placelist[$j]['lati'][0] != 'S') {
if ($placelist[$j]['lati'] < 0) {
$placelist[$j]['lati'][0] = 'S';
} else {
$placelist[$j]['lati'] = 'N' . $placelist[$j]['lati'];
}
}
} else {
$placelist[$j]['lati'] = null;
}
if (preg_match("/4 LONG (.*)/", $placerec, $match)) {
$placelist[$j]['long'] = trim($match[1]);
if ($placelist[$j]['long'][0] != 'E' && $placelist[$j]['long'][0] != 'W') {
if ($placelist[$j]['long'] < 0) {
$placelist[$j]['long'][0] = 'W';
} else {
$placelist[$j]['long'] = 'E' . $placelist[$j]['long'];
}
}
} else {
$placelist[$j]['long'] = null;
}
$j = $j + 1;
}
$i = $i + 1;
$placerec = Functions::getSubRecord(2, '2 PLAC', $gedrec, $i);
开发者ID:bxbroze,项目名称:webtrees,代码行数:67,代码来源:GoogleMapsModule.php
示例6: checkRelationship
/**
* check (blood) relationship between partners
*
* @param type $person
* @param type $spouse
* @return string (relationship name)
*/
private function checkRelationship($person, $spouse)
{
$controller = new RelationshipController();
$paths = $controller->calculateRelationships($person, $spouse, 1);
foreach ($paths as $path) {
$relationships = $controller->oldStyleRelationshipPath($path);
if (empty($relationships)) {
// Cannot see one of the families/individuals, due to privacy;
continue;
}
foreach (array_keys($path) as $n) {
if ($n % 2 === 1) {
switch ($relationships[$n]) {
case 'sis':
case 'bro':
case 'sib':
return Functions::getRelationshipNameFromPath(implode('', $relationships), $person, $spouse);
}
}
}
}
}
开发者ID:bxbroze,项目名称:webtrees,代码行数:29,代码来源:FancyTreeviewClass.php
示例7: htmlAncestorDispersionG3
/**
* Returns HTML code for a graph showing the dispersion of ancestors across grand-parents
* @return string HTML code
*/
private function htmlAncestorDispersionG3()
{
$ancestorsDispGen2 = $this->sosa_provider->getAncestorDispersionForGen(3);
$size = '700x300';
$color_motmot = 'ffd1dc';
$color_motfat = 'b998a0';
$color_fatfat = '577292';
$color_fatmot = '84beff';
$color_shared = '777777';
$total_fatfat = array_key_exists(1, $ancestorsDispGen2) ? $ancestorsDispGen2[1] : 0;
$total_fatmot = array_key_exists(2, $ancestorsDispGen2) ? $ancestorsDispGen2[2] : 0;
$total_motfat = array_key_exists(4, $ancestorsDispGen2) ? $ancestorsDispGen2[4] : 0;
$total_motmot = array_key_exists(8, $ancestorsDispGen2) ? $ancestorsDispGen2[8] : 0;
$total_sha = array_key_exists(-1, $ancestorsDispGen2) ? $ancestorsDispGen2[-1] : 0;
$total = $total_fatfat + $total_fatmot + $total_motfat + $total_motmot + $total_sha;
$chd = $this->arrayToExtendedEncoding(array(4095 * Functions::safeDivision($total_fatfat, $total), 4095 * Functions::safeDivision($total_fatmot, $total), 4095 * Functions::safeDivision($total_sha, $total), 4095 * Functions::safeDivision($total_motfat, $total), 4095 * Functions::safeDivision($total_motmot, $total)));
$chart_title = I18N::translate('Known Sosa ancestors\' dispersion - G3');
$chl = \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatfat, $total), 1) . '|' . \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('fatmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_fatmot, $total), 1) . '|' . I18N::translate('Shared') . ' - ' . I18N::percentage(Functions::safeDivision($total_sha, $total), 1) . '|' . \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motfat') . ' - ' . I18N::percentage(Functions::safeDivision($total_motfat, $total), 1) . '|' . \Fisharebest\Webtrees\Functions\Functions::getRelationshipNameFromPath('motmot') . ' - ' . I18N::percentage(Functions::safeDivision($total_motmot, $total), 1);
return "<img src=\"https://chart.googleapis.com/chart?cht=p&chp=1.5708&chd=e:{$chd}&chs={$size}&chco={$color_fatfat},{$color_fatmot},{$color_shared},{$color_motfat},{$color_motmot}&chf=bg,s,ffffff00&chl={$chl}\" alt=\"" . $chart_title . "\" title=\"" . $chart_title . "\" />";
}
开发者ID:jon48,项目名称:webtrees-lib,代码行数:24,代码来源:SosaStatsController.php
示例8: foreach
$sourceDATE = '';
$sourceQUAY = '';
if (!empty($gedrec)) {
preg_match_all('/\\n(1 (?!FILE|FORM|TYPE|TITL|_PRIM|_THUM|CHAN|DATA).*(\\n[2-9] .*)*)/', $gedrec, $matches);
foreach ($matches[1] as $subrec) {
$pieces = explode("\n", $subrec);
foreach ($pieces as $piece) {
$ft = preg_match("/(\\d) (\\w+)(.*)/", $piece, $match);
if ($ft == 0) {
continue;
}
$subLevel = $match[1];
$fact = trim($match[2]);
$event = trim($match[3]);
if ($fact === 'NOTE' || $fact === 'TEXT') {
$event .= Functions::getCont($subLevel + 1, $subrec);
}
if ($sourceSOUR !== '' && $subLevel <= $sourceLevel) {
// Get rid of all saved Source data
FunctionsEdit::addSimpleTag($sourceLevel . ' SOUR ' . $sourceSOUR);
FunctionsEdit::addSimpleTag($sourceLevel + 1 . ' PAGE ' . $sourcePAGE);
FunctionsEdit::addSimpleTag($sourceLevel + 2 . ' TEXT ' . $sourceTEXT);
FunctionsEdit::addSimpleTag($sourceLevel + 2 . ' DATE ' . $sourceDATE, '', GedcomTag::getLabel('DATA:DATE'));
FunctionsEdit::addSimpleTag($sourceLevel + 1 . ' QUAY ' . $sourceQUAY);
$sourceSOUR = '';
}
if ($fact === 'SOUR') {
$sourceLevel = $subLevel;
$sourceSOUR = $event;
$sourcePAGE = '';
$sourceTEXT = '';
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:31,代码来源:addmedia.php
示例9: restrictAccess
/**
* Restrict access
*
* @param bool $condition
*
* @return $this
*/
public function restrictAccess($condition)
{
if ($condition !== true) {
header('Location: ' . WT_LOGIN_URL . '?url=' . rawurlencode(Functions::getQueryUrl()));
exit;
}
return $this;
}
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:15,代码来源:PageController.php
示例10: printFamily
/**
* Print a family group.
*
* @param Family $family
* @param string $type
* @param string $label
*/
private function printFamily(Family $family, $type, $label)
{
global $controller;
if ($family->getTree()->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) {
$access_level = Auth::PRIV_HIDE;
} else {
$access_level = Auth::accessLevel($family->getTree());
}
?>
<table>
<tr>
<td>
<i class="icon-cfamily"></i>
</td>
<td>
<span class="subheaders"> <?php
echo $label;
?>
</span>
<a class="noprint" href="<?php
echo $family->getHtmlUrl();
?>
"> - <?php
echo I18N::translate('View this family');
?>
</a>
</td>
</tr>
</table>
<table class="facts_table">
<?php
///// HUSB /////
$found = false;
foreach ($family->getFacts('HUSB', false, $access_level) as $fact) {
$found |= !$fact->isPendingDeletion();
$person = $fact->getTarget();
if ($person instanceof Individual) {
if ($fact->isPendingAddition()) {
$class = 'facts_label new';
} elseif ($fact->isPendingDeletion()) {
$class = 'facts_label old';
} else {
$class = 'facts_label';
}
?>
<tr>
<td class="<?php
echo $class;
?>
">
<?php
echo Functions::getCloseRelationshipName($controller->record, $person);
?>
</td>
<td class="<?php
echo $controller->getPersonStyle($person);
?>
">
<?php
echo Theme::theme()->individualBoxLarge($person);
?>
</td>
</tr>
<?php
}
}
if (!$found && $family->canEdit()) {
?>
<tr>
<td class="facts_label"></td>
<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php
echo $family->getXref();
?>
', 'HUSB');"><?php
echo 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 Individual) {
$found |= !$fact->isPendingDeletion();
if ($fact->isPendingAddition()) {
$class = 'facts_label new';
} elseif ($fact->isPendingDeletion()) {
$class = 'facts_label old';
} else {
$class = 'facts_label';
}
//.........这里部分代码省略.........
开发者ID:tronsmit,项目名称:webtrees,代码行数:101,代码来源:RelativesTabModule.php
示例11: AjaxController
$action = Filter::get('action');
// The default view depends on whether we are logged in
if (Auth::check()) {
$ctype = Filter::get('ctype', 'gedcom|user', 'user');
} else {
$ctype = 'gedcom';
}
// Get the blocks list
if ($ctype === 'user') {
$blocks = FunctionsDb::getUserBlocks(Auth::id());
} else {
$blocks = FunctionsDb::getTreeBlocks($WT_TREE->getTreeId());
}
$active_blocks = Module::getActiveBlocks($WT_TREE);
// The latest version is shown on the administration page. This updates it every day.
Functions::fetchLatestVersion();
// We generate individual blocks using AJAX
if ($action === 'ajax') {
$controller = new AjaxController();
$controller->pageHeader();
// Check we’re displaying an allowable block.
$block_id = Filter::getInteger('block_id');
if (array_key_exists($block_id, $blocks['main'])) {
$module_name = $blocks['main'][$block_id];
} elseif (array_key_exists($block_id, $blocks['side'])) {
$module_name = $blocks['side'][$block_id];
} else {
return;
}
if (array_key_exists($module_name, $active_blocks)) {
echo $active_blocks[$module_name]->getBlock($block_id);
开发者ID:AlexSnet,项目名称:webtrees,代码行数:31,代码来源:index.php
示例12: getGedcomValue
/**
* get gedcom tag value
*
* @param string $tag The tag to find, use : to delineate subtags
* @param int $level The gedcom line level of the first tag to find, setting level to 0 will cause it to use 1+ the level of the incoming record
* @param string $gedrec The gedcom record to get the value from
*
* @return string the value of a gedcom tag from the given gedcom record
*/
private function getGedcomValue($tag, $level, $gedrec)
{
global $WT_TREE;
if (empty($gedrec)) {
return '';
}
$tags = explode(':', $tag);
$origlevel = $level;
if ($level == 0) {
$level = $gedrec[0] + 1;
}
$subrec = $gedrec;
foreach ($tags as $t) {
$lastsubrec = $subrec;
$subrec = Functions::getSubRecord($level, "{$level} {$t}", $subrec);
if (empty($subrec) && $origlevel == 0) {
$level--;
$subrec = Functions::getSubRecord($level, "{$level} {$t}", $lastsubrec);
}
if (empty($subrec)) {
if ($t == "TITL") {
$subrec = Functions::getSubRecord($level, "{$level} ABBR", $lastsubrec);
if (!empty($subrec)) {
$t = "ABBR";
}
}
if (empty($subrec)) {
if ($level > 0) {
$level--;
}
$subrec = Functions::getSubRecord($level, "@ {$t}", $gedrec);
if (empty($subrec)) {
return '';
}
}
}
$level++;
}
$level--;
$ct = preg_match("/{$level} {$t}(.*)/", $subrec, $match);
if ($ct == 0) {
$ct = preg_match("/{$level} @.+@ (.+)/", $subrec, $match);
}
if ($ct == 0) {
$ct = preg_match("/@ {$t} (.+)/", $subrec, $match);
}
if ($ct > 0) {
$value = trim($match[1]);
if ($t == 'NOTE' && preg_match('/^@(.+)@$/', $value, $match)) {
$note = Note::getInstance($match[1], $WT_TREE);
if ($note) {
$value = $note->getNote();
} else {
//-- set the value to the id without the @
$value = $match[1];
}
}
if ($level != 0 || $t != "NOTE") {
$value .= Functions::getCont($level + 1, $subrec);
}
return $value;
}
return "";
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:73,代码来源:ReportParserGenerate.php
示例13: foreach
// at a scale of 25 or higher, show every year
$mod = 25 / $controller->scale;
if ($mod < 1) {
$mod = 1;
}
for ($i = $controller->baseyear + 1; $i < $controller->topyear; $i++) {
if ($i % $mod === 0) {
echo '<div id="scale' . $i . '" style="position:absolute; ' . (I18N::direction() === 'ltr' ? 'left: ' . $basexoffset : 'right: ' . $basexoffset) . 'px; top:' . ($baseyoffset + ($i - $controller->baseyear) * $controller->scale - $controller->scale / 2) . 'px; font-size: 7pt; text-align:' . (I18N::direction() === 'ltr' ? 'left' : 'right') . ';">';
echo $i . '—';
echo '</div>';
}
}
echo '<div id="scale' . $controller->topyear . '" style="position:absolute; ' . (I18N::direction() === 'ltr' ? 'left: ' . $basexoffset : 'right: ' . $basexoffset) . 'px; top:' . ($baseyoffset + ($controller->topyear - $controller->baseyear) * $controller->scale) . 'px; font-size: 7pt; text-align:' . (I18N::direction() === 'ltr' ? 'left' : 'right') . ';">';
echo $controller->topyear . '—';
echo '</div>';
Functions::sortFacts($controller->indifacts);
$factcount = 0;
foreach ($controller->indifacts as $fact) {
$controller->printTimeFact($fact);
$factcount++;
}
// print the age boxes
foreach ($controller->people as $p => $indi) {
$pid = $indi->getXref();
$ageyoffset = $baseyoffset + $controller->bheight * $p;
$col = $p % 6;
?>
<div id="agebox<?php
echo $p;
?>
" style="cursor:move; position:absolute; <?php
开发者ID:josefpavlik,项目名称:webtrees,代码行数:31,代码来源:timeline.php
示例14: foreach
global $WT_TREE;
use Fisharebest\Webtrees\Functions\Functions;
define('WT_SCRIPT_NAME', 'expand_view.php');
require './includes/session.php';
header('Content-Type: text/html; charset=UTF-8');
$individual = Individual::getInstance(Filter::get('pid', WT_REGEX_XREF), $WT_TREE);
if (!$individual || !$individual->canShow()) {
return I18N::translate('Private');
}
$facts = $individual->getFacts();
foreach ($individual->getSpouseFamilies() as $family) {
foreach ($family->getFacts() as $fact) {
$facts[] = $fact;
}
}
Functions::sortFacts($facts);
foreach ($facts as $fact) {
switch ($fact->getTag()) {
case 'ADDR':
case 'ALIA':
case 'ASSO':
case 'CHAN':
case 'CHIL':
case 'EMAIL':
case 'FAMC':
case 'FAMS':
case 'HUSB':
case 'NAME':
case 'NOTE':
case 'OBJE':
case 'PHON':
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:expand_view.php
示例15: foreach
$chdod = $chchild->getDeathDate()->julianDay();
// Child’s Date of Death (Julian)
$chBLD = $chfulln . ', ' . $chdob . ', ' . $chdod;
array_push($chBLDarray, $chBLD);
}
}
// Get Spouse child’s details
$nam = $child->getAllNames();
$fulln = strip_tags($nam[0]['full']);
$fulmn = $fulln;
foreach ($nam as $n) {
if ($n['type'] === '_MARNM') {
$fulmn = strip_tags($n['full']);
}
}
$label = Functions::getCloseRelationshipName($person, $child);
$menu = new Menu($label);
print_pedigree_person_nav_cens($child->getXref(), $label, $censyear);
$submenu = new Menu($spouselinks);
$menu->addSubmenu($submenu);
?>
<tr>
<td align="left" class="linkcell optionbox">
<?php
echo $menu->getMenu();
?>
</td>
<td align="left" class="facts_value">
<?php
echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=" . $child->getXref() . "&gedcom=" . $child->getTree()->getNameUrl() . "\">";
echo $headImg2;
开发者ID:jflash,项目名称:webtrees,代码行数:31,代码来源:census-edit.php
示例16: max
if ($n > 2 && preg_match('/fat|mot|par/', $relationships[$n - 2])) {
$table[$x + 1][$y - 1] = '<div style="background:url(' . $diagonal2 . '); width: 64px; height: 64px; text-align: center;"><div style="height: 32px; text-align: end;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="height: 32px; text-align: start;">' . $down_arrow . '</div></div>';
$x += 2;
} else {
$table[$x][$y - 1] = '<div style="background:url(' . Theme::theme()->parameter('image-vline') . ') repeat-y center; height: 64px; text-align: center;"><div style="display: inline-block; width:50%; line-height: 64px;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="display: inline-block; width:50%; line-height: 64px;">' . $down_arrow . '</div></div>';
}
$y -= 2;
break;
case 'fat':
case 'mot':
case 'par':
if ($n > 2 && preg_match('/son|dau|chi/', $relationships[$n - 2])) {
$table[$x + 1][$y + 1] = '<div style="background:url(' . $diagonal1 . '); background-position: top right; width: 64px; height: 64px; text-align: center;"><div style="height: 32px; text-align: start;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="height: 32px; text-align: end;">' . $up_arrow . '</div></div>';
$x += 2;
} else {
$table[$x][$y + 1] = '<div style="background:url(' . Theme::theme()->parameter('image-vline') . ') repeat-y center; height: 64px; text-align:center; "><div style="display: inline-block; width: 50%; line-height: 32px;">' . Functions::getRelationshipNameFromPath($relationships[$n], Individual::getInstance($path[$n - 1], $WT_TREE), Individual::getInstance($path[$n + 1], $WT_TREE)) . '</div><div style="display: inline-block; width: 50%; line-height: 32px">' . $up_arrow . '</div></div>';
}
$y += 2;
break;
}
$max_x = max($max_x, $x);
$min_y = min($min_y, $y);
$max_y = max($max_y, $y);
} else {
$individual = Individual::getInstance($xref, $WT_TREE);
ob_start();
FunctionsPrint::printPedigreePerson($individual, $show_full);
$table[$x][$y] = ob_get_clean();
}
}
echo '<table style="border-collapse: collapse; margin: 20px 50px;">';
开发者ID:josefpavlik,项目名称:webtrees,代码行数:31,代码来源:relationship.php
示例17: getBlock
/**
* Generate the HTML content of this block.
*
* @param int $block_id
* @param bool $template
* @param string[] $cfg
*
* @return string
*/
public function getBlock($block_id, $template = true, $cfg = array())
{
global $WT_TREE;
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
$title = $this->getTitle();
$anonymous = 0;
$logged_in = array();
$content = '';
foreach (User::allLoggedIn() as $user) {
if (Auth::isAdmin() || $user->getPreference('visibleonline')) {
$logged_in[] = $user;
} else {
$anonymous++;
}
}
$count_logged_in = count($logged_in);
$content .= '<div class="logged_in_count">';
if ($anonymous) {
$content .= I18N::plural('%s anonymous signed-in user', '%s anonymous signed-in users', $anonymous, I18N::number($anonymous));
if ($count_logged_in) {
$content .= ' | ';
}
}
if ($count_logged_in) {
$content .= I18N::plural('%s signed-in user', '%s signed-in users', $count_logged_in, I18N::number($count_logged_in));
}
$content .= '</div>';
$content .= '<div class="logged_in_list">';
if (Auth::check()) {
foreach ($logged_in as $user) {
$individual = Individual::getInstance($WT_TREE->getUserPreference($user, 'gedcomid'), $WT_TREE);
$content .= '<div class="logged_in_name">';
if ($individual) {
$content .= '<a href="' . $individual->getHtmlUrl() . '">' . $user->getRealNameHtml() . '</a>';
} else {
$content .= $user->getRealNameHtml();
}
$content .= ' - ' . Filter::escapeHtml($user->getUserName());
if (Auth::id() != $user->getUserId() && $user->getPreference('contactmethod') != 'none') {
$content .= ' <a class="icon-email" href="#" onclick="return message(\'' . Filter::escapeHtml($user->getUserName()) . '\', \'\', \'' . Filter::escapeHtml(Functions::getQueryUrl()) . '\');" title="' . I18N::translate('Send a message') . '"></a>';
}
$content .= '</div>';
}
}
$content .= '</div>';
if ($anonymous === 0 && $count_logged_in === 0) {
return '';
}
if ($template) {
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:64,代码来源:LoggedInUsersModule.php
示例18: drawFamily
/**
* Format a family.
*
* @param Family $family
* @param string $title
*/
private function drawFamily(Family $family, $title)
{
global $controller;
?>
<tr>
<td class="center" colspan="2">
<a class="famnav_title" href="<?php
echo $family->getHtmlUrl();
?>
">
<?php
echo $title;
?>
</a>
</td>
</tr>
<?php
foreach ($family->getSpouses() as $spouse) {
$menu = new Menu(Functions::getCloseRelationshipName($controller->record, $spouse));
$menu->addClass('', 'submenu flyout');
$menu->addSubmenu(new Menu($this->getParents($spouse)));
?>
<tr>
<td class="facts_label">
<?php
echo $menu->getMenu();
?>
</td>
<td class="center <?php
echo $controller->getPersonStyle($spouse);
?>
nam">
<a class="famnav_link" href="<?php
echo $spouse->getHtmlUrl();
?>
">
<?php
echo $spouse->getFullName();
?>
</a>
<div class="font9">
<?php
echo $spouse->getLifeSpan();
?>
</div>
</td>
</tr>
<?php
}
foreach ($family->getChildren() as $child) {
$menu = new Menu(Functions::getCloseRelationshipName($controller->record, $child));
$menu->addClass('', 'submenu flyout');
$menu->addSubmenu(new Menu($this->getFamily($child)));
?>
<tr>
<td class="facts_label">
<?php
echo $menu->getMenu();
?>
</td>
<td class="center <?php
echo $controller->getPersonStyle($child);
?>
nam">
<a class="famnav_link" href="<?php
echo $child->getHtmlUrl();
?>
">
<?php
echo $child->getFullName();
?>
</a>
<div class="font9">
<?php
echo $child->getLifeSpan();
?>
</div>
</td>
</tr>
<?php
}
}
开发者ID:tunandras,项目名称:webtrees,代码行数:88,代码来源:FamilyNavigatorModule.php
示例19: censusNavigatorFamily
/**
* Create a family on the census navigator.
*
* @param CensusInterface $census
* @param Family $family
* @param Individual $head
*
* @return string
*/
public static function censusNavigatorFamily(CensusInterface $census, Family $family, Individual $head)
{
$headImg2 = '<i class="icon-button_head" title="' . I18N::translate('Head of household') . '"></i>';
foreach ($family->getSpouses() as $spouse) {
$menu = new Menu(Functions::getCloseRelationshipName($head, $spouse));
foreach ($spouse->getChildFamilies() as $grandparents) {
foreach ($grandparents->getSpouses() as $grandparent) {
$submenu = new Menu(Functions::getCloseRelationshipName($head, $grandparent) . ' - ' . $grandparent->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $grandparent, $head)) . '");'));
$submenu->addClass('submenuitem', '');
$menu->addSubmenu($submenu);
$menu->addClass('', 'submenu');
}
}
?>
<tr>
<td class="optionbox">
<?php
echo $menu->getMenu();
?>
</td>
<td class="facts_value nowrap">
<a href="#" onclick="return appendCensusRow('<?php
echo Filter::escapeJs(self::censusTableRow($census, $spouse, $head));
?>
');">
<?php
echo $spouse->getFullName();
?>
</a>
</td>
<td class="facts_value">
<?php
if ($head !== $spouse) {
?>
<a href="edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=<?php
echo $spouse->getXref();
?>
&gedcom=<?php
echo $spouse->getTree()->getNameUrl();
?>
&census=<?php
echo get_class($census);
?>
">
<?php
echo $headImg2;
?>
</a>
<?php
}
?>
</td>
</tr>
<?php
}
foreach ($family->getChildren() as $child) {
$menu = new Menu(Functions::getCloseRelationshipName($head, $child));
foreach ($child->getSpouseFamilies() as $spouse_family) {
foreach ($spouse_family->getSpouses() as $spouse_family_spouse) {
if ($spouse_family_spouse != $child) {
$submenu = new Menu(Functions::getCloseRelationshipName($head, $spouse_family_spouse) . ' - ' . $spouse_family_spouse->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_spouse, $head)) . '");'));
$submenu->addClass('submenuitem', '');
$menu->addSubmenu($submenu);
$menu->addClass('', 'submenu');
}
}
foreach ($spouse_family->getChildren() as $spouse_family_child) {
$submenu = new Menu(Functions::getCloseRelationshipName($head, $spouse_family_child) . ' - ' . $spouse_family_child->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_child, $head)) . '");'));
$submenu->addClass('submenuitem', '');
$menu->addSubmenu($submenu);
$menu->addClass('', 'submenu');
}
}
?>
<tr>
<td class="optionbox">
<?php
echo $menu->getMenu();
?>
</td>
<td class="facts_value">
<a href="#" onclick="return appendCensusRow('<?php
echo Filter::escapeJs(self::censusTableRow($census, $child, $head));
?>
');">
<?php
echo $child->getFullName();
?>
</a>
</td>
<td class="facts_value">
//.........这里部分代码省略.........
开发者ID:tronsmit,项目名称:webtrees,代码行数:101,代码来源:CensusAssistantModule.php
|
请发表评论