本文整理汇总了PHP中Fisharebest\Webtrees\Individual类的典型用法代码示例。如果您正苦于以下问题:PHP Individual类的具体用法?PHP Individual怎么用?PHP Individual使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Individual类的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)
{
foreach ($individual->getFacts('OCCU') as $fact) {
return $fact->getValue();
}
return '';
}
开发者ID:tunandras,项目名称:webtrees,代码行数:15,代码来源:CensusColumnOccupation.php
示例2: 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)
{
foreach ($individual->getAllNames() as $name) {
return $name['surn'] . ', ' . $name['givn'];
}
return '';
}
开发者ID:AlexSnet,项目名称:webtrees,代码行数:15,代码来源:CensusColumnSurnameGivenNames.php
示例3: getChartMenu
/**
* Return a menu item for this chart.
*
* We can only do this if the GD2 library is installed with TrueType support.
*
* @return Menu|null
*/
public function getChartMenu(Individual $individual)
{
if (function_exists('imagettftext')) {
return new Menu($this->getTitle(), 'fanchart.php?rootid=' . $individual->getXref() . '&ged=' . $individual->getTree()->getNameUrl(), 'menu-chart-fanchart', array('rel' => 'nofollow'));
} else {
return null;
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:15,代码来源:FanChartModule.php
示例4: 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 ($individual->getSex() === 'F') {
return '';
} else {
return (string) Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:16,代码来源:CensusColumnAgeMale.php
示例5: getSpouseById
/**
* Find the spouse of a person, using the Xref comparison.
*
* @param Individual $person
*
* @return Individual|null
*/
public function getSpouseById(\Fisharebest\Webtrees\Individual $person)
{
if ($this->gedcomrecord->getWife() && $person->getXref() === $this->gedcomrecord->getWife()->getXref()) {
return $this->gedcomrecord->getHusband();
} else {
return $this->gedcomrecord->getWife();
}
}
开发者ID:jon48,项目名称:webtrees-lib,代码行数:15,代码来源:Family.php
示例6: 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 ($individual->getBirthDate()->julianDay() + 365 >= $this->date()->julianDay()) {
// Use the GEDCOM month, as we need this in English - for the US census
return ucfirst(strtolower($individual->getBirthDate()->minimumDate()->format('%O')));
} else {
return '';
}
}
开发者ID:tunandras,项目名称:webtrees,代码行数:17,代码来源:CensusColumnMonthIfBornWithinYear.php
示例7: 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)
{
$birth_date = $individual->getBirthDate();
if ($birth_date->minimumJulianDay() === $birth_date->maximumJulianDay()) {
return $birth_date->minimumDate()->format('%j/%n');
} else {
return '';
}
}
开发者ID:AlexSnet,项目名称:webtrees,代码行数:17,代码来源:CensusColumnBirthDaySlashMonth.php
示例8: 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)
{
$sex = $individual->getSex();
if ($sex === 'M' || $sex === 'F') {
return $sex;
} else {
return '';
}
}
开发者ID:tunandras,项目名称:webtrees,代码行数:17,代码来源:CensusColumnSexMF.php
示例9: getChartMenu
/**
* Return a menu item for this chart.
*
* @param Individual $individual
*
* @return Menu|null
*/
public function getChartMenu(Individual $individual)
{
$tree = $individual->getTree();
$gedcomid = $tree->getUserPreference(Auth::user(), 'gedcomid');
if ($gedcomid) {
return new Menu(I18N::translate('Relationship to me'), 'relationship.php?pid1=' . $gedcomid . '&pid2=' . $individual->getXref() . '&ged=' . $tree->getNameUrl(), 'menu-chart-relationship', array('rel' => 'nofollow'));
} else {
return new Menu(I18N::translate('Relationships'), 'relationship.php?pid1=' . $individual->getXref() . '&ged=' . $tree->getNameUrl(), 'menu-chart-relationship', array('rel' => 'nofollow'));
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:17,代码来源:RelationshipsChartModule.php
示例10: 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)
{
foreach ($individual->getSpouseFamilies() as $family) {
foreach ($family->getFacts('MARR') as $fact) {
if ($fact->getDate()->julianDay() + 365 >= $this->date()->julianDay()) {
return 'Y';
}
}
}
return '';
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:19,代码来源:CensusColumnMarriedWithinYear.php
示例11: 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)
{
switch ($individual->getSex()) {
case 'M':
return $this->male;
case 'F':
return $this->female;
default:
return '';
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:19,代码来源:CensusColumnSexMF.php
示例12: 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)
{
foreach ($individual->getSpouseFamilies() as $family) {
foreach ($family->getFacts('MARR') as $fact) {
if ($fact->getDate()->julianDay() + 365 >= $this->date()->julianDay()) {
// Use the GEDCOM month, as we need this in English - for the US census
return ucfirst(strtolower($fact->getDate()->minimumDate()->format('%O')));
}
}
}
return '';
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:20,代码来源:CensusColumnMonthIfMarriedWithinYear.php
示例13: 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)
{
foreach ($individual->getAllNames() as $name) {
$given = $name['givn'];
if (strpos($given, ' ') === false) {
return $given;
} else {
return substr($given, 0, strpos($given, ' ') + 2);
}
}
return '';
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:20,代码来源:CensusColumnGivenNameInitial.php
示例14: 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 ($individual->getSex() === 'M') {
return '';
} else {
$years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
if ($years > 15) {
$years -= $years % 5;
}
return (string) $years;
}
}
开发者ID:tunandras,项目名称:webtrees,代码行数:20,代码来源:CensusColumnAgeFemale5Years.php
示例15: 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 ($individual->getBirthDate()->isOK()) {
foreach ($individual->getSpouseFamilies() as $family) {
foreach ($family->getFacts('MARR', true) as $fact) {
if ($fact->getDate()->isOK()) {
return Date::getAge($individual->getBirthDate(), $fact->getDate(), 0);
}
}
}
}
return '';
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:21,代码来源:CensusColumnAgeMarried.php
示例16: 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)
{
$birth_place = $individual->getBirthPlace();
$census_place = $this->place();
// Ignore the census country
if ($birth_place === $census_place) {
return '';
}
if (substr($birth_place, -strlen($census_place) - 2) === ', ' . $census_place) {
return substr($birth_place, 0, -strlen($census_place) - 2);
} else {
return $birth_place;
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:22,代码来源:CensusColumnBirthPlace.php
示例17: 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 ($individual->getSex() !== 'F') {
return '';
}
$count = 0;
foreach ($individual->getSpouseFamilies() as $family) {
foreach ($family->getChildren() as $child) {
if ($child->getBirthDate()->isOK() && Date::compare($child->getBirthDate(), $this->date()) < 0 && $child->getBirthDate() != $child->getDeathDate() && (!$child->getDeathDate()->isOK() || Date::compare($child->getDeathDate(), $this->date()) > 0)) {
$count++;
}
}
}
return (string) $count;
}
开发者ID:tunandras,项目名称:webtrees,代码行数:23,代码来源:CensusColumnChildrenLiving.php
示例18: __construct
/**
* Create the chart controller
*
* @param int $show_full needed for use by charts module
*/
public function __construct($show_full = 1)
{
global $WT_TREE;
parent::__construct();
$rootid = Filter::get('rootid', WT_REGEX_XREF);
$this->root = Individual::getInstance($rootid, $WT_TREE);
if (!$this->root) {
// Missing root individual? Show the chart for someone.
$this->root = $this->getSignificantIndividual();
}
if (!$this->root || !$this->root->canShowName()) {
http_response_code(404);
$this->error_message = I18N::translate('This individual does not exist or you do not have permission to view it.');
}
// Extract parameter from form
if ($show_full) {
$this->show_full = Filter::getInteger('show_full', 0, 1, $WT_TREE->getPreference('PEDIGREE_FULL_DETAILS'));
} else {
$this->show_full = 0;
}
$this->box = new \stdClass();
if ($this->showFull()) {
$this->box->width = Theme::theme()->parameter('chart-box-x');
$this->box->height = Theme::theme()->parameter('chart-box-y');
} else {
$this->box->width = Theme::theme()->parameter('compact-chart-box-x');
$this->box->height = Theme::theme()->parameter('compact-chart-box-y');
}
}
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:34,代码来源:ChartController.php
示例19: 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)
{
$marriage_date = null;
foreach ($individual->getSpouseFamilies() as $family) {
foreach ($family->getFacts('MARR', true) as $fact) {
if ($fact->getDate()->isOK() && Date::compare($fact->getDate(), $this->date()) <= 0) {
$marriage_date = $fact->getDate();
}
}
}
if ($marriage_date === null) {
return '';
} else {
return (string) Date::getAge($marriage_date, $this->date(), 0);
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:24,代码来源:CensusColumnYearsMarried.php
示例20: 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)
{
$place = $individual->getBirthPlace();
// Did we emigrate or naturalise?
foreach ($individual->getFacts('IMMI|EMIG|NATU', true) as $fact) {
if (Date::compare($fact->getDate(), $this->date()) <= 0) {
$place = $fact->getPlace()->getGedcomName();
}
}
$place = explode(', ', $place);
$place = end($place);
if ($place === 'England' || $place === 'Scotland' || $place === 'Wales') {
return 'British';
} else {
return $place;
}
}
开发者ID:tronsmit,项目名称:webtrees,代码行数:25,代码来源:CensusColumnNationality.php
注:本文中的Fisharebest\Webtrees\Individual类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论