本文整理汇总了PHP中Fisharebest\Webtrees\Individual类的典型用法代码示例。如果您正苦于以下问题:PHP Individual类的具体用法?PHP Individual怎么用?PHP Individual使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Individual类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 '';
}
示例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 '';
}
示例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;
}
}
示例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);
}
}
示例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();
}
}
示例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 '';
}
}
示例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 '';
}
}
示例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 '';
}
}
示例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'));
}
}
示例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 '';
}
示例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 '';
}
}
示例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 '';
}
示例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 '';
}
示例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;
}
}
示例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 '';
}