本文整理汇总了PHP中Fisharebest\Webtrees\Family类的典型用法代码示例。如果您正苦于以下问题:PHP Family类的具体用法?PHP Family怎么用?PHP Family使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Family类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Startup activity
*/
public function __construct()
{
global $WT_TREE;
$xref = Filter::get('famid', WT_REGEX_XREF);
$this->record = Family::getInstance($xref, $WT_TREE);
parent::__construct();
}
示例2: getIntance
/**
* Extend \Fisharebest\Webtrees\Family getInstance, in order to retrieve directly a \MyArtJaub\Webtrees\Family object
*
* @param string $xref
* @param Tree $tree
* @param string $gedcom
* @return NULL|\MyArtJaub\Webtrees\Family
*/
public static function getIntance($xref, Tree $tree, $gedcom = null)
{
$dfam = null;
$fam = fw\Family::getInstance($xref, $tree, $gedcom);
if ($fam) {
$dfam = new Family($fam);
}
return $dfam;
}
示例3: search
/**
* Autocomplete search for families.
*
* @param Tree $tree Search this tree
* @param string $query Search for this text
*
* @return string
*/
private function search(Tree $tree, $query)
{
if (strlen($query) < 2) {
return '';
}
$rows = Database::prepare("SELECT i_id AS xref" . " FROM `##individuals`, `##name`" . " WHERE (i_id LIKE CONCAT('%', :query_1, '%') OR n_sort LIKE CONCAT('%', :query_2, '%'))" . " AND i_id = n_id AND i_file = n_file AND i_file = :tree_id" . " ORDER BY n_sort COLLATE :collation" . " LIMIT 50")->execute(array('query_1' => $query, 'query_2' => $query, 'tree_id' => $tree->getTreeId(), 'collation' => I18N::collation()))->fetchAll();
$ids = array();
foreach ($rows as $row) {
$ids[] = $row->xref;
}
$vars = array();
if (empty($ids)) {
//-- no match : search for FAM id
$where = "f_id LIKE CONCAT('%', ?, '%')";
$vars[] = $query;
} else {
//-- search for spouses
$qs = implode(',', array_fill(0, count($ids), '?'));
$where = "(f_husb IN ({$qs}) OR f_wife IN ({$qs}))";
$vars = array_merge($vars, $ids, $ids);
}
$vars[] = $tree->getTreeId();
$rows = Database::prepare("SELECT f_id AS xref, f_file AS gedcom_id, f_gedcom AS gedcom FROM `##families` WHERE {$where} AND f_file=?")->execute($vars)->fetchAll();
$out = '<ul>';
foreach ($rows as $row) {
$family = Family::getInstance($row->xref, $tree, $row->gedcom);
if ($family->canShowName()) {
$out .= '<li><a href="' . $family->getHtmlUrl() . '">' . $family->getFullName() . ' ';
if ($family->canShow()) {
$marriage_year = $family->getMarriageYear();
if ($marriage_year) {
$out .= ' (' . $marriage_year . ')';
}
}
$out .= '</a></li>';
}
}
$out .= '</ul>';
return $out;
}
示例4: addSimpleTag
//.........这里部分代码省略.........
case 'SURN':
case '_HEB':
echo FunctionsPrint::helpLink($fact);
break;
}
}
// tag level
if ($level > 0) {
if ($fact === 'TEXT' && $level > 1) {
echo '<input type="hidden" name="glevels[]" value="', $level - 1, '">';
echo '<input type="hidden" name="islink[]" value="0">';
echo '<input type="hidden" name="tag[]" value="DATA">';
// leave data text[] value empty because the following TEXT line will cause the DATA to be added
echo '<input type="hidden" name="text[]" value="">';
}
echo '<input type="hidden" name="glevels[]" value="', $level, '">';
echo '<input type="hidden" name="islink[]" value="', $islink, '">';
echo '<input type="hidden" name="tag[]" value="', $fact, '">';
}
echo '</td>';
// value
echo '<td class="optionbox wrap">';
// retrieve linked NOTE
if ($fact === 'NOTE' && $islink) {
$note1 = Note::getInstance($value, $WT_TREE);
if ($note1) {
$noterec = $note1->getGedcom();
preg_match('/' . $value . '/i', $noterec, $notematch);
$value = $notematch[0];
}
}
// Show names for spouses in MARR/HUSB/AGE and MARR/WIFE/AGE
if ($fact === 'HUSB' || $fact === 'WIFE') {
$family = Family::getInstance($xref, $WT_TREE);
if ($family) {
$spouse_link = $family->getFirstFact($fact);
if ($spouse_link) {
$spouse = $spouse_link->getTarget();
if ($spouse) {
echo $spouse->getFullName();
}
}
}
}
if (in_array($fact, Config::emptyFacts()) && ($value === '' || $value === 'Y' || $value === 'y')) {
echo '<input type="hidden" id="', $element_id, '" name="', $element_name, '" value="', $value, '">';
if ($level <= 1) {
echo '<input type="checkbox" ';
if ($value) {
echo 'checked';
}
echo ' onclick="document.getElementById(\'' . $element_id . '\').value = (this.checked) ? \'Y\' : \'\';">';
echo I18N::translate('yes');
}
if ($fact === 'CENS' && $value === 'Y') {
echo self::censusDateSelector(WT_LOCALE, $xref);
if (Module::getModuleByName('GEDFact_assistant') && GedcomRecord::getInstance($xref, $WT_TREE) instanceof Individual) {
echo '<div></div><a href="#" style="display: none;" id="assistant-link" onclick="return activateCensusAssistant();">' . I18N::translate('Create a new shared note using assistant') . '</a></div>';
}
}
} elseif ($fact === 'TEMP') {
echo self::selectEditControl($element_name, GedcomCodeTemp::templeNames(), I18N::translate('No temple - living ordinance'), $value);
} elseif ($fact === 'ADOP') {
echo self::editFieldAdoption($element_name, $value, '', $person);
} elseif ($fact === 'PEDI') {
echo self::editFieldPedigree($element_name, $value, '', $person);
示例5: printCousins
/**
* print cousins list
*
* @param string $famid family ID
* @param int $show_full large or small box
*/
public static function printCousins($famid, $show_full = 1)
{
global $WT_TREE;
if ($show_full) {
$bheight = Theme::theme()->parameter('chart-box-y');
} else {
$bheight = Theme::theme()->parameter('compact-chart-box-y');
}
$family = Family::getInstance($famid, $WT_TREE);
$fchildren = $family->getChildren();
$kids = count($fchildren);
echo '<td valign="middle" height="100%">';
if ($kids) {
echo '<table cellspacing="0" cellpadding="0" border="0" ><tr valign="middle">';
if ($kids > 1) {
echo '<td rowspan="', $kids, '" valign="middle" align="right"><img width="3px" height="', ($bheight + 9) * ($kids - 1), 'px" src="', Theme::theme()->parameter('image-vline'), '" alt=""></td>';
}
$ctkids = count($fchildren);
$i = 1;
foreach ($fchildren as $fchil) {
if ($i == 1) {
echo '<td><img width="10px" height="3px" align="top"';
} else {
echo '<td><img width="10px" height="3px"';
}
if (I18N::direction() === 'ltr') {
echo ' style="padding-right: 2px;"';
} else {
echo ' style="padding-left: 2px;"';
}
echo ' src="', Theme::theme()->parameter('image-hline'), '" alt=""></td><td>';
FunctionsPrint::printPedigreePerson($fchil, $show_full);
echo '</td></tr>';
if ($i < $ctkids) {
echo '<tr>';
$i++;
}
}
echo '</table>';
} else {
// If there is known that there are no children (as opposed to no known children)
if (preg_match('/\\n1 NCHI (\\d+)/', $family->getGedcom(), $match) && $match[1] == 0) {
echo ' <i class="icon-childless" title="', I18N::translate('This family remained childless'), '"></i>';
}
}
echo '</td>';
}
示例6: FamilyController
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Fisharebest\Webtrees;
/**
* Defined in session.php
*
* @global Tree $WT_TREE
*/
global $WT_TREE;
use Fisharebest\Webtrees\Controller\FamilyController;
use Fisharebest\Webtrees\Functions\FunctionsCharts;
use Fisharebest\Webtrees\Functions\FunctionsPrint;
define('WT_SCRIPT_NAME', 'family.php');
require './includes/session.php';
$record = Family::getInstance(Filter::get('famid', WT_REGEX_XREF), $WT_TREE);
$controller = new FamilyController($record);
if ($controller->record && $controller->record->canShow()) {
$controller->pageHeader();
if ($controller->record->isPendingDeletion()) {
if (Auth::isModerator($controller->record->getTree())) {
echo '<p class="ui-state-highlight">', I18N::translate('This family has been deleted. You should review the deletion and then %1$s or %2$s it.', '<a href="#" onclick="accept_changes(\'' . $controller->record->getXref() . '\');">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'accept') . '</a>', '<a href="#" onclick="reject_changes(\'' . $controller->record->getXref() . '\');">' . I18N::translateContext('You should review the deletion and then accept or reject it.', 'reject') . '</a>'), ' ', FunctionsPrint::helpLink('pending_changes'), '</p>';
} elseif (Auth::isEditor($controller->record->getTree())) {
echo '<p class="ui-state-highlight">', I18N::translate('This family has been deleted. The deletion will need to be reviewed by a moderator.'), ' ', FunctionsPrint::helpLink('pending_changes'), '</p>';
}
} elseif ($controller->record->isPendingAddtion()) {
if (Auth::isModerator($controller->record->getTree())) {
echo '<p class="ui-state-highlight">', I18N::translate('This family has been edited. You should review the changes and then %1$s or %2$s them.', '<a href="#" onclick="accept_changes(\'' . $controller->record->getXref() . '\');">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'accept') . '</a>', '<a href="#" onclick="reject_changes(\'' . $controller->record->getXref() . '\');">' . I18N::translateContext('You should review the changes and then accept or reject them.', 'reject') . '</a>'), ' ', FunctionsPrint::helpLink('pending_changes'), '</p>';
} elseif (Auth::isEditor($controller->record->getTree())) {
echo '<p class="ui-state-highlight">', I18N::translate('This family has been edited. The changes need to be reviewed by a moderator.'), ' ', FunctionsPrint::helpLink('pending_changes'), '</p>';
}
示例7: print_indi_form
/**
* Print a form to add an individual or edit an individual’s name
*
* @param string $nextaction
* @param Individual $person
* @param Family $family
* @param Fact $name_fact
* @param string $famtag
* @param string $gender
*/
function print_indi_form($nextaction, Individual $person = null, Family $family = null, Fact $name_fact = null, $famtag = 'CHIL', $gender = 'U')
{
global $WT_TREE, $bdm, $controller;
if ($person) {
$xref = $person->getXref();
} elseif ($family) {
$xref = $family->getXref();
} else {
$xref = 'new';
}
// Different cultures do surnames differently
$surname_tradition = SurnameTradition::create($WT_TREE->getPreference('SURNAME_TRADITION'));
$name_fields = array();
if ($name_fact) {
// Editing an existing name
$name_fact_id = $name_fact->getFactId();
$name_type = $name_fact->getAttribute('TYPE');
$namerec = $name_fact->getGedcom();
foreach (Config::standardNameFacts() as $tag) {
if ($tag === 'NAME') {
$name_fields[$tag] = $name_fact->getValue();
} else {
$name_fields[$tag] = $name_fact->getAttribute($tag);
}
}
// Populate any missing 2 XXXX fields from the 1 NAME field
$npfx_accept = implode('|', Config::namePrefixes());
if (preg_match('/(((' . $npfx_accept . ')\\.? +)*)([^\\n\\/"]*)("(.*)")? *\\/(([a-z]{2,3} +)*)(.*)\\/ *(.*)/i', $name_fields['NAME'], $name_bits)) {
if (empty($name_fields['NPFX'])) {
$name_fields['NPFX'] = $name_bits[1];
}
if (empty($name_fields['SPFX']) && empty($name_fields['SURN'])) {
$name_fields['SPFX'] = trim($name_bits[7]);
// For names with two surnames, there will be four slashes.
// Turn them into a list
$name_fields['SURN'] = preg_replace('~/[^/]*/~', ',', $name_bits[9]);
}
if (empty($name_fields['GIVN'])) {
$name_fields['GIVN'] = $name_bits[4];
}
if (empty($name_fields['NICK']) && !empty($name_bits[6]) && !preg_match('/^2 NICK/m', $namerec)) {
$name_fields['NICK'] = $name_bits[6];
}
}
} else {
// Creating a new name
$name_fact_id = null;
$name_type = null;
$namerec = null;
// Populate the standard NAME field and subfields
foreach (Config::standardNameFacts() as $tag) {
$name_fields[$tag] = '';
}
// Inherit surname from parents, spouse or child
if ($family) {
$father = $family->getHusband();
if ($father && $father->getFirstFact('NAME')) {
$father_name = $father->getFirstFact('NAME')->getValue();
} else {
$father_name = '';
}
$mother = $family->getWife();
if ($mother && $mother->getFirstFact('NAME')) {
$mother_name = $mother->getFirstFact('NAME')->getValue();
} else {
$mother_name = '';
}
} else {
$father = null;
$mother = null;
$father_name = '';
$mother_name = '';
}
if ($person && $person->getFirstFact('NAME')) {
$indi_name = $person->getFirstFact('NAME')->getValue();
} else {
$indi_name = '';
}
switch ($nextaction) {
case 'add_child_to_family_action':
$name_fields = $surname_tradition->newChildNames($father_name, $mother_name, $gender) + $name_fields;
break;
case 'add_child_to_individual_action':
if ($person->getSex() === 'F') {
$name_fields = $surname_tradition->newChildNames('', $indi_name, $gender) + $name_fields;
} else {
$name_fields = $surname_tradition->newChildNames($indi_name, '', $gender) + $name_fields;
}
break;
case 'add_parent_to_individual_action':
//.........这里部分代码省略.........
示例8: renderFamSosaListIndi
/**
* 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] = '';
//.........这里部分代码省略.........
示例9: __construct
/**
* Startup activity
*/
public function __construct()
{
global $WT_TREE;
parent::__construct();
$this->setPageTitle(I18N::translate('Lifespans'));
$this->facts = explode('|', WT_EVENTS_BIRT . '|' . WT_EVENTS_DEAT . '|' . WT_EVENTS_MARR . '|' . WT_EVENTS_DIV);
$tmp = explode('\\', get_class(I18N::defaultCalendar()));
$cal = strtolower(array_pop($tmp));
$this->defaultCalendar = str_replace('calendar', '', $cal);
$filterPids = false;
// Request parameters
$clear = Filter::getBool('clear');
$newpid = Filter::get('newpid', WT_REGEX_XREF);
$addfam = Filter::getBool('addFamily');
$this->place = Filter::get('place');
$this->beginYear = Filter::getInteger('beginYear', 0, PHP_INT_MAX, null);
$this->endYear = Filter::getInteger('endYear', 0, PHP_INT_MAX, null);
$this->calendar = Filter::get('calendar', null, $this->defaultCalendar);
$this->strictDate = Filter::getBool('strictDate');
// Set up base color parameters
$this->colors['M'] = new ColorGenerator(240, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE * -1);
$this->colors['F'] = new ColorGenerator(00, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE);
// Build a list of people based on the input parameters
if ($clear) {
// Empty list & reset form
$xrefs = array();
$this->place = null;
$this->beginYear = null;
$this->endYear = null;
$this->calendar = $this->defaultCalendar;
} elseif ($this->place) {
// Get all individual & family records found for a place
$this->place_obj = new Place($this->place, $WT_TREE);
$xrefs = Database::prepare("SELECT DISTINCT `i_id` FROM `##placelinks`" . " JOIN `##individuals` ON `pl_gid`=`i_id` AND `pl_file`=`i_file`" . " WHERE `i_file`=:tree_id" . " AND `pl_p_id`=:place_id" . " UNION" . " SELECT DISTINCT `f_id` FROM `##placelinks`" . " JOIN `##families` ON `pl_gid`=`f_id` AND `pl_file`=`f_file`" . " WHERE `f_file`=:tree_id" . " AND `pl_p_id`=:place_id")->execute(array('tree_id' => $WT_TREE->getTreeId(), 'place_id' => $this->place_obj->getPlaceId()))->fetchOneColumn();
} else {
// Modify an existing list of records
$xrefs = Session::get(self::SESSION_DATA, array());
if ($newpid) {
$xrefs = array_merge($xrefs, $this->addFamily(Individual::getInstance($newpid, $WT_TREE), $addfam));
$xrefs = array_unique($xrefs);
} elseif (!$xrefs) {
$xrefs = $this->addFamily($this->getSignificantIndividual(), false);
}
}
$tmp = $this->getCalendarDate(unixtojd());
$this->currentYear = $tmp->today()->y;
$tmp = strtoupper(strtr($this->calendar, array('jewish' => 'hebrew', 'french' => 'french r')));
$this->calendarEscape = sprintf('@#D%s@', $tmp);
if ($xrefs) {
// ensure date ranges are valid in preparation for filtering list
if ($this->beginYear || $this->endYear) {
$filterPids = true;
if (!$this->beginYear) {
$tmp = new Date($this->calendarEscape . ' 1');
$this->beginYear = $tmp->minimumDate()->y;
}
if (!$this->endYear) {
$this->endYear = $this->currentYear;
}
$this->startDate = new Date($this->calendarEscape . $this->beginYear);
$this->endDate = new Date($this->calendarEscape . $this->endYear);
}
// Test each xref to see if the search criteria are met
foreach ($xrefs as $key => $xref) {
$valid = false;
$person = Individual::getInstance($xref, $WT_TREE);
if ($person) {
if ($person->canShow()) {
foreach ($person->getFacts() as $fact) {
if ($this->checkFact($fact)) {
$this->people[] = $person;
$valid = true;
break;
}
}
}
} else {
$family = Family::getInstance($xref, $WT_TREE);
if ($family && $family->canShow() && $this->checkFact($family->getMarriage())) {
$valid = true;
$this->people[] = $family->getHusband();
$this->people[] = $family->getWife();
}
}
if (!$valid) {
unset($xrefs[$key]);
// no point in storing a xref if we can't use it
}
}
Session::put(self::SESSION_DATA, $xrefs);
} else {
Session::forget(self::SESSION_DATA);
}
$this->people = array_filter(array_unique($this->people));
$count = count($this->people);
if ($count) {
// Build the subtitle
//.........这里部分代码省略.........
示例10: getTarget
/**
* Get the record to which this fact links
*
* @return Individual|Family|Source|Repository|Media|Note|null
*/
public function getTarget()
{
$xref = trim($this->getValue(), '@');
switch ($this->tag) {
case 'FAMC':
case 'FAMS':
return Family::getInstance($xref, $this->getParent()->getTree());
case 'HUSB':
case 'WIFE':
case 'CHIL':
return Individual::getInstance($xref, $this->getParent()->getTree());
case 'SOUR':
return Source::getInstance($xref, $this->getParent()->getTree());
case 'OBJE':
return Media::getInstance($xref, $this->getParent()->getTree());
case 'REPO':
return Repository::getInstance($xref, $this->getParent()->getTree());
case 'NOTE':
return Note::getInstance($xref, $this->getParent()->getTree());
default:
return GedcomRecord::getInstance($xref, $this->getParent()->getTree());
}
}
示例11: getStepFamilyLabel
/**
* Create a label for a step family
*
* @param Family $step_family
*
* @return string
*/
public function getStepFamilyLabel(Family $step_family)
{
foreach ($this->getChildFamilies() as $family) {
if ($family !== $step_family) {
// Must be a step-family
foreach ($family->getSpouses() as $parent) {
foreach ($step_family->getSpouses() as $step_parent) {
if ($parent === $step_parent) {
// One common parent - must be a step family
if ($parent->getSex() == 'M') {
// Father’s family with someone else
if ($step_family->getSpouse($step_parent)) {
return I18N::translate('Father’s family with %s', $step_family->getSpouse($step_parent)->getFullName());
} else {
return I18N::translate('Father’s family with an unknown individual');
}
} else {
// Mother’s family with someone else
if ($step_family->getSpouse($step_parent)) {
return I18N::translate('Mother’s family with %s', $step_family->getSpouse($step_parent)->getFullName());
} else {
return I18N::translate('Mother’s family with an unknown individual');
}
}
}
}
}
}
}
// Perahps same parents - but a different family record?
return I18N::translate('Family with parents');
}
示例12: array
//-- setup the arrays
$newvars = array();
foreach ($vars as $name => $var) {
$newvars[$name]['id'] = $var;
if (!empty($type[$name])) {
switch ($type[$name]) {
case 'INDI':
$record = Individual::getInstance($var, $WT_TREE);
if ($record && $record->canShowName()) {
$newvars[$name]['gedcom'] = $record->privatizeGedcom(Auth::accessLevel($WT_TREE));
} else {
$action = 'setup';
}
break;
case 'FAM':
$record = Family::getInstance($var, $WT_TREE);
if ($record && $record->canShowName()) {
$newvars[$name]['gedcom'] = $record->privatizeGedcom(Auth::accessLevel($WT_TREE));
} else {
$action = 'setup';
}
break;
case 'SOUR':
$record = Source::getInstance($var, $WT_TREE);
if ($record && $record->canShowName()) {
$newvars[$name]['gedcom'] = $record->privatizeGedcom(Auth::accessLevel($WT_TREE));
} else {
$action = 'setup';
}
break;
default:
示例13:
if ($linktoid == "") {
echo '<input class="pedigree_form" type="text" name="linktoid" id="linktopid" size="3" value="', $linktoid, '"> ';
echo FunctionsPrint::printFindIndividualLink('linktopid');
} else {
$record = Individual::getInstance($linktoid, $WT_TREE);
echo $record->formatList('span', false, $record->getFullName());
}
}
if ($linkto == "family") {
echo I18N::translate('Family'), '</td>';
echo '<td class="optionbox wrap">';
if ($linktoid == "") {
echo '<input class="pedigree_form" type="text" name="linktoid" id="linktofamid" size="3" value="', $linktoid, '"> ';
echo FunctionsPrint::printFindFamilyLink('linktofamid');
} else {
$record = Family::getInstance($linktoid, $WT_TREE);
echo $record->formatList('span', false, $record->getFullName());
}
}
if ($linkto == "source") {
echo I18N::translate('Source'), "</td>";
echo '<td class="optionbox wrap">';
if ($linktoid == "") {
echo '<input class="pedigree_form" type="text" name="linktoid" id="linktosid" size="3" value="', $linktoid, '"> ';
echo FunctionsPrint::printFindSourceLink('linktosid');
} else {
$record = Source::getInstance($linktoid, $WT_TREE);
echo $record->formatList('span', false, $record->getFullName());
}
}
if ($linkto == "repository") {
示例14: listStartHandler
//.........这里部分代码省略.........
if ($match[1] != "") {
$names = explode(" ", $match[1]);
foreach ($names as $n => $name) {
$sql_where .= " AND {$attr}.n_full LIKE CONCAT('%', :{$attr}name{$n}, '%')";
$sql_params[$attr . 'name' . $n] = $name;
}
}
// Let the DB do the name sorting even when no name was entered
if ($sortby == "NAME") {
$sortby = "";
$sql_order_by .= ($sql_order_by ? ", " : " ORDER BY ") . "{$attr}.n_sort";
}
}
unset($attrs[$attr]);
// This filter has been fully processed
} elseif (preg_match('/^(?:\\w+):PLAC CONTAINS (.+)$/', $value, $match)) {
$sql_join .= " JOIN `##places` AS {$attr}a ON ({$attr}a.p_file=f_file)";
$sql_join .= " JOIN `##placelinks` AS {$attr}b ON ({$attr}a.p_file={$attr}b.pl_file AND {$attr}b.pl_p_id={$attr}a.p_id AND {$attr}b.pl_gid=f_id)";
$sql_where .= " AND {$attr}a.p_place LIKE CONCAT('%', :{$attr}place, '%')";
$sql_params[$attr . 'place'] = $match[1];
// Don't unset this filter. This is just initial filtering
} elseif (preg_match('/^(\\w*):*(\\w*) CONTAINS (.+)$/', $value, $match)) {
$sql_where .= " AND f_gedcom LIKE CONCAT('%', :{$attr}contains1, '%', :{$attr}contains2, '%', :{$attr}contains3, '%')";
$sql_params[$attr . 'contains1'] = $match[1];
$sql_params[$attr . 'contains2'] = $match[2];
$sql_params[$attr . 'contains3'] = $match[3];
// Don't unset this filter. This is just initial filtering
}
}
}
$this->list = array();
$rows = Database::prepare($sql_select . $sql_join . $sql_where . $sql_order_by)->execute($sql_params)->fetchAll();
foreach ($rows as $row) {
$this->list[$row->xref] = Family::getInstance($row->xref, $WT_TREE, $row->gedcom);
}
break;
default:
throw new \DomainException('Invalid list name: ' . $listname);
}
$filters = array();
$filters2 = array();
if (isset($attrs['filter1']) && count($this->list) > 0) {
foreach ($attrs as $key => $value) {
if (preg_match("/filter(\\d)/", $key)) {
$condition = $value;
if (preg_match("/@(\\w+)/", $condition, $match)) {
$id = $match[1];
$value = "''";
if ($id == "ID") {
if (preg_match("/0 @(.+)@/", $this->gedrec, $match)) {
$value = "'" . $match[1] . "'";
}
} elseif ($id == "fact") {
$value = "'" . $this->fact . "'";
} elseif ($id == "desc") {
$value = "'" . $this->desc . "'";
} else {
if (preg_match("/\\d {$id} (.+)/", $this->gedrec, $match)) {
$value = "'" . str_replace("@", "", trim($match[1])) . "'";
}
}
$condition = preg_replace("/@{$id}/", $value, $condition);
}
//-- handle regular expressions
if (preg_match("/([A-Z:]+)\\s*([^\\s]+)\\s*(.+)/", $condition, $match)) {
$tag = trim($match[1]);
示例15: 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
}
}