本文整理汇总了PHP中Fisharebest\Webtrees\Family::canEdit方法的典型用法代码示例。如果您正苦于以下问题:PHP Family::canEdit方法的具体用法?PHP Family::canEdit怎么用?PHP Family::canEdit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Family
的用法示例。
在下文中一共展示了Family::canEdit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Startup activity
*
* @param GedcomRecord|null $record
*/
public function __construct(GedcomRecord $record = null)
{
$this->record = $record;
// Automatically fix broken links
if ($this->record && $this->record->canEdit()) {
$broken_links = 0;
foreach ($this->record->getFacts('HUSB|WIFE|CHIL|FAMS|FAMC|REPO') as $fact) {
if (!$fact->isPendingDeletion() && $fact->getTarget() === null) {
$this->record->deleteFact($fact->getFactId(), false);
FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue()));
$broken_links = true;
}
}
foreach ($this->record->getFacts('NOTE|SOUR|OBJE') as $fact) {
// These can be links or inline. Only delete links.
if (!$fact->isPendingDeletion() && $fact->getTarget() === null && preg_match('/^@.*@$/', $fact->getValue())) {
$this->record->deleteFact($fact->getFactId(), false);
FlashMessages::addMessage(I18N::translate('The link from “%1$s” to “%2$s” has been deleted.', $this->record->getFullName(), $fact->getValue()));
$broken_links = true;
}
}
if ($broken_links) {
// Reload the updated family
$this->record = GedcomRecord::getInstance($this->record->getXref(), $this->record->getTree());
}
}
parent::__construct();
// We want robots to index this page
$this->setMetaRobots('index,follow');
// Set a page title
if ($this->record) {
if ($this->record->canShowName()) {
// e.g. "John Doe" or "1881 Census of Wales"
$this->setPageTitle($this->record->getFullName());
} else {
// e.g. "Individual" or "Source"
$record = $this->record;
$this->setPageTitle(GedcomTag::getLabel($record::RECORD_TYPE));
}
} else {
// No such record
$this->setPageTitle(I18N::translate('Private'));
}
}
示例2: 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';
}
//.........这里部分代码省略.........