本文整理汇总了PHP中Fisharebest\Webtrees\Auth::isManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Auth::isManager方法的具体用法?PHP Auth::isManager怎么用?PHP Auth::isManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Auth
的用法示例。
在下文中一共展示了Auth::isManager方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 $ctype, $WT_TREE;
$days = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
$sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'date_desc');
$block = $this->getBlockSetting($block_id, 'block', '1');
$hide_empty = $this->getBlockSetting($block_id, 'hide_empty', '0');
foreach (array('days', 'infoStyle', 'sortStyle', 'hide_empty', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
${$name} = $cfg[$name];
}
}
$found_facts = FunctionsDb::getRecentChanges(WT_CLIENT_JD - $days);
if (!$found_facts && $hide_empty) {
return '';
}
// Print block header
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
$title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>';
} else {
$title = '';
}
$title .= I18N::plural('Changes in the last %s day', 'Changes in the last %s days', $days, I18N::number($days));
$content = '';
// Print block content
if (count($found_facts) == 0) {
$content .= I18N::plural('There have been no changes within the last %s day.', 'There have been no changes within the last %s days.', $days, I18N::number($days));
} else {
ob_start();
switch ($infoStyle) {
case 'list':
$content .= FunctionsPrintLists::changesList($found_facts, $sortStyle);
break;
case 'table':
// sortable table
$content .= FunctionsPrintLists::changesTable($found_facts, $sortStyle);
break;
}
$content .= ob_get_clean();
}
if ($template) {
if ($block) {
$class .= ' small_inner_block';
}
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
示例2: 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 $ctype, $WT_TREE;
$num = $this->getBlockSetting($block_id, 'num', '10');
$count_placement = $this->getBlockSetting($block_id, 'count_placement', 'before');
$block = $this->getBlockSetting($block_id, 'block', '0');
foreach (array('count_placement', 'num', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
${$name} = $cfg[$name];
}
}
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
$title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>';
} else {
$title = '';
}
$title .= $this->getTitle();
$content = '';
// load the lines from the file
$top10 = Database::prepare("SELECT page_parameter, page_count" . " FROM `##hit_counter`" . " WHERE gedcom_id = :tree_id AND page_name IN ('individual.php','family.php','source.php','repo.php','note.php','mediaviewer.php')" . " ORDER BY page_count DESC LIMIT :limit")->execute(array('tree_id' => $WT_TREE->getTreeId(), 'limit' => (int) $num))->fetchAssoc();
if ($block) {
$content .= '<table width="90%">';
} else {
$content .= '<table>';
}
foreach ($top10 as $id => $count) {
$record = GedcomRecord::getInstance($id, $WT_TREE);
if ($record && $record->canShow()) {
$content .= '<tr>';
if ($count_placement == 'before') {
$content .= '<td dir="ltr" style="text-align:right">[' . $count . ']</td>';
}
$content .= '<td class="name2" ><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></td>';
if ($count_placement == 'after') {
$content .= '<td dir="ltr" style="text-align:right">[' . $count . ']</td>';
}
$content .= '</tr>';
}
}
$content .= "</table>";
if ($template) {
if ($block) {
$class .= ' small_inner_block';
}
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
示例3: getBlock
/** {@inheritdoc} */
public function getBlock($block_id, $template = true, $cfg = array())
{
global $ctype, $WT_TREE;
$days = $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS);
$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_INFO_STYLE);
$sortStyle = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT_STYLE);
$show_user = $this->getBlockSetting($block_id, 'show_user', self::DEFAULT_SHOW_USER);
$block = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
$hide_empty = $this->getBlockSetting($block_id, 'hide_empty', self::DEFAULT_HIDE_EMPTY);
foreach (array('days', 'infoStyle', 'sortStyle', 'hide_empty', 'show_user', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
${$name} = $cfg[$name];
}
}
$records = $this->getRecentChanges($WT_TREE, WT_CLIENT_JD - $days);
if (empty($records) && $hide_empty) {
return '';
}
// Print block header
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
$title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>';
} else {
$title = '';
}
$title .= I18N::plural('Changes in the last %s day', 'Changes in the last %s days', $days, I18N::number($days));
$content = '';
// Print block content
if (count($records) == 0) {
$content .= I18N::plural('There have been no changes within the last %s day.', 'There have been no changes within the last %s days.', $days, I18N::number($days));
} else {
switch ($infoStyle) {
case 'list':
$content .= $this->changesList($records, $sortStyle, $show_user);
break;
case 'table':
$content .= $this->changesTable($records, $sortStyle, $show_user);
break;
}
}
if ($template) {
if ($block) {
$class .= ' small_inner_block';
}
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
示例4: 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 $ctype, $WT_TREE;
$days = $this->getBlockSetting($block_id, 'days', '7');
$filter = $this->getBlockSetting($block_id, 'filter', '1');
$onlyBDM = $this->getBlockSetting($block_id, 'onlyBDM', '0');
$infoStyle = $this->getBlockSetting($block_id, 'infoStyle', 'table');
$sortStyle = $this->getBlockSetting($block_id, 'sortStyle', 'alpha');
$block = $this->getBlockSetting($block_id, 'block', '1');
foreach (array('days', 'filter', 'onlyBDM', 'infoStyle', 'sortStyle', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
${$name} = $cfg[$name];
}
}
$startjd = WT_CLIENT_JD + 1;
$endjd = WT_CLIENT_JD + $days;
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
$title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>';
} else {
$title = '';
}
$title .= $this->getTitle();
$content = '';
switch ($infoStyle) {
case 'list':
// Output style 1: Old format, no visible tables, much smaller text. Better suited to right side of page.
$content .= FunctionsPrintLists::eventsList($startjd, $endjd, $onlyBDM ? 'BIRT MARR DEAT' : '', $filter, $sortStyle);
break;
case 'table':
// Style 2: New format, tables, big text, etc. Not too good on right side of page
ob_start();
$content .= FunctionsPrintLists::eventsTable($startjd, $endjd, $onlyBDM ? 'BIRT MARR DEAT' : '', $filter, $sortStyle);
$content .= ob_get_clean();
break;
}
if ($template) {
if ($block) {
$class .= ' small_inner_block';
}
return Theme::theme()->formatBlock($id, $title, $class, $content);
} else {
return $content;
}
}
示例5: foreach
} else {
echo '><p class="small text-muted">' . I18N::translate('Do not change to keep original filename.') . '</p>';
}
} else {
echo $fileName;
echo '<input name="filename" type="hidden" value="' . Filter::escapeHtml($fileName) . '" size="40">';
}
echo '</td>';
echo '</tr>';
}
// Box for user to choose the folder to store the image
if (!$isExternal) {
echo '<tr><td class="descriptionbox wrap width25">';
echo I18N::translate('Folder name on server'), '</td><td class="optionbox wrap">';
//-- don’t let regular users change the location of media items
if ($action !== 'update' || Auth::isManager($WT_TREE)) {
$mediaFolders = QueryMedia::folderList();
echo '<select name="folder_list" onchange="document.newmedia.folder.value=this.options[this.selectedIndex].value;">';
echo '<option ';
if ($folder == '') {
echo 'selected';
}
echo ' value=""> ', I18N::translate('Choose: '), ' </option>';
if (Auth::isAdmin()) {
echo '<option value="other" disabled>', I18N::translate('Other folder… please type in'), "</option>";
}
foreach ($mediaFolders as $f) {
echo '<option value="', $f, '" ';
if ($folder == $f) {
echo 'selected';
}
示例6: canEdit
/**
* Check whether this fact is protected against edit
*
* @return bool
*/
public function canEdit()
{
// Managers can edit anything
// Members cannot edit RESN, CHAN and locked records
return $this->parent->canEdit() && !$this->isPendingDeletion() && (Auth::isManager($this->parent->getTree()) || Auth::isEditor($this->parent->getTree()) && strpos($this->gedcom, "\n2 RESN locked") === false && $this->getTag() != 'RESN' && $this->getTag() != 'CHAN');
}
示例7: 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 $ctype, $WT_TREE;
$filter = $this->getBlockSetting($block_id, 'filter', 'all');
$controls = $this->getBlockSetting($block_id, 'controls', '1');
$start = $this->getBlockSetting($block_id, 'start', '0') || Filter::getBool('start');
// We can apply the filters using SQL
// Do not use "ORDER BY RAND()" - it is very slow on large tables. Use PHP::array_rand() instead.
$all_media = Database::prepare("SELECT m_id FROM `##media`" . " WHERE m_file = ?" . " AND m_ext IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')" . " AND m_type IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '')")->execute(array($WT_TREE->getTreeId(), $this->getBlockSetting($block_id, 'filter_avi', '0') ? 'avi' : null, $this->getBlockSetting($block_id, 'filter_bmp', '1') ? 'bmp' : null, $this->getBlockSetting($block_id, 'filter_gif', '1') ? 'gif' : null, $this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpg' : null, $this->getBlockSetting($block_id, 'filter_jpeg', '1') ? 'jpeg' : null, $this->getBlockSetting($block_id, 'filter_mp3', '0') ? 'mp3' : null, $this->getBlockSetting($block_id, 'filter_ole', '1') ? 'ole' : null, $this->getBlockSetting($block_id, 'filter_pcx', '1') ? 'pcx' : null, $this->getBlockSetting($block_id, 'filter_pdf', '0') ? 'pdf' : null, $this->getBlockSetting($block_id, 'filter_png', '1') ? 'png' : null, $this->getBlockSetting($block_id, 'filter_tiff', '1') ? 'tiff' : null, $this->getBlockSetting($block_id, 'filter_wav', '0') ? 'wav' : null, $this->getBlockSetting($block_id, 'filter_audio', '0') ? 'audio' : null, $this->getBlockSetting($block_id, 'filter_book', '1') ? 'book' : null, $this->getBlockSetting($block_id, 'filter_card', '1') ? 'card' : null, $this->getBlockSetting($block_id, 'filter_certificate', '1') ? 'certificate' : null, $this->getBlockSetting($block_id, 'filter_coat', '1') ? 'coat' : null, $this->getBlockSetting($block_id, 'filter_document', '1') ? 'document' : null, $this->getBlockSetting($block_id, 'filter_electronic', '1') ? 'electronic' : null, $this->getBlockSetting($block_id, 'filter_fiche', '1') ? 'fiche' : null, $this->getBlockSetting($block_id, 'filter_film', '1') ? 'film' : null, $this->getBlockSetting($block_id, 'filter_magazine', '1') ? 'magazine' : null, $this->getBlockSetting($block_id, 'filter_manuscript', '1') ? 'manuscript' : null, $this->getBlockSetting($block_id, 'filter_map', '1') ? 'map' : null, $this->getBlockSetting($block_id, 'filter_newspaper', '1') ? 'newspaper' : null, $this->getBlockSetting($block_id, 'filter_other', '1') ? 'other' : null, $this->getBlockSetting($block_id, 'filter_painting', '1') ? 'painting' : null, $this->getBlockSetting($block_id, 'filter_photo', '1') ? 'photo' : null, $this->getBlockSetting($block_id, 'filter_tombstone', '1') ? 'tombstone' : null, $this->getBlockSetting($block_id, 'filter_video', '0') ? 'video' : null))->fetchOneColumn();
// Keep looking through the media until a suitable one is found.
$random_media = null;
while ($all_media) {
$n = array_rand($all_media);
$media = Media::getInstance($all_media[$n], $WT_TREE);
if ($media->canShow() && !$media->isExternal()) {
// Check if it is linked to a suitable individual
foreach ($media->linkedIndividuals('OBJE') as $indi) {
if ($filter === 'all' || $filter === 'indi' && strpos($indi->getGedcom(), "\n1 OBJE @" . $media->getXref() . '@') !== false || $filter === 'event' && strpos($indi->getGedcom(), "\n2 OBJE @" . $media->getXref() . '@') !== false) {
// Found one :-)
$random_media = $media;
break 2;
}
}
}
unset($all_media[$n]);
}
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
$title = '<a class="icon-admin" title="' . I18N::translate('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>';
} else {
$title = '';
}
$title .= $this->getTitle();
if ($random_media) {
$content = "<div id=\"random_picture_container{$block_id}\">";
if ($controls) {
if ($start) {
$icon_class = 'icon-media-stop';
} else {
$icon_class = 'icon-media-play';
}
$content .= '<div dir="ltr" class="center" id="random_picture_controls' . $block_id . '"><br>';
$content .= "<a href=\"#\" onclick=\"togglePlay(); return false;\" id=\"play_stop\" class=\"" . $icon_class . "\" title=\"" . I18N::translate('Play') . "/" . I18N::translate('Stop') . '"></a>';
$content .= '<a href="#" onclick="jQuery(\'#block_' . $block_id . '\').load(\'index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '\');return false;" title="' . I18N::translate('Next image') . '" class="icon-media-next"></a>';
$content .= '</div><script>
var play = false;
function togglePlay() {
if (play) {
play = false;
jQuery("#play_stop").removeClass("icon-media-stop").addClass("icon-media-play");
}
else {
play = true;
playSlideShow();
jQuery("#play_stop").removeClass("icon-media-play").addClass("icon-media-stop");
}
}
function playSlideShow() {
if (play) {
window.setTimeout("reload_image()", 6000);
}
}
function reload_image() {
if (play) {
jQuery("#block_' . $block_id . '").load("index.php?ctype=' . $ctype . '&action=ajax&block_id=' . $block_id . '&start=1");
}
}
</script>';
}
if ($start) {
$content .= '<script>togglePlay();</script>';
}
$content .= '<div class="center" id="random_picture_content' . $block_id . '">';
$content .= '<table id="random_picture_box"><tr><td class="details1">';
$content .= $random_media->displayImage();
$content .= '<br>';
$content .= '<a href="' . $random_media->getHtmlUrl() . '"><b>' . $random_media->getFullName() . '</b></a><br>';
foreach ($random_media->linkedIndividuals('OBJE') as $individual) {
$content .= '<a href="' . $individual->getHtmlUrl() . '">' . I18N::translate('View this individual') . ' — ' . $individual->getFullName() . '</a><br>';
}
foreach ($random_media->linkedFamilies('OBJE') as $family) {
$content .= '<a href="' . $family->getHtmlUrl() . '">' . I18N::translate('View this family') . ' — ' . $family->getFullName() . '</a><br>';
}
foreach ($random_media->linkedSources('OBJE') as $source) {
$content .= '<a href="' . $source->getHtmlUrl() . '">' . I18N::translate('View this source') . ' — ' . $source->getFullName() . '</a><br>';
}
$content .= '<br><div class="indent">';
$content .= FunctionsPrint::printFactNotes($random_media->getGedcom(), "1", false);
$content .= '</div>';
//.........这里部分代码省略.........
示例8: header
/**
* Defined in session.php
*
* @global Tree $WT_TREE
*/
global $WT_TREE;
use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Module\CkeditorModule;
define('WT_SCRIPT_NAME', 'block_edit.php');
require './includes/session.php';
$block_id = Filter::getInteger('block_id');
$block = Database::prepare("SELECT SQL_CACHE * FROM `##block` WHERE block_id=?")->execute(array($block_id))->fetchOneRow();
// Check access. (1) the block must exist and be enabled, (2) gedcom blocks require
// managers, (3) user blocks require the user or an admin
$blocks = Module::getActiveBlocks($WT_TREE);
if (!$block || !array_key_exists($block->module_name, $blocks) || $block->gedcom_id && !Auth::isManager(Tree::findById($block->gedcom_id)) || $block->user_id && $block->user_id != Auth::id() && !Auth::isAdmin()) {
header('Location: ' . WT_BASE_URL);
return;
}
$block = $blocks[$block->module_name];
if (Filter::post('save')) {
$ctype = Filter::post('ctype', 'user', 'gedcom');
header('Location: ' . WT_BASE_URL . 'index.php?ctype=' . $ctype . '&ged=' . $WT_TREE->getNameUrl());
$block->configureBlock($block_id);
return;
}
$ctype = FIlter::get('ctype', 'user', 'gedcom');
$controller = new PageController();
$controller->setPageTitle(I18N::translate('Configure') . ' — ' . $block->getTitle())->pageHeader();
if (Module::getModuleByName('ckeditor')) {
CkeditorModule::enableEditor($controller);
示例9: 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, $ctype;
$show_last_update = $this->getBlockSetting($block_id, 'show_last_update', '1');
$show_common_surnames = $this->getBlockSetting($block_id, 'show_common_surnames', '1');
$stat_indi = $this->getBlockSetting($block_id, 'stat_indi', '1');
$stat_fam = $this->getBlockSetting($block_id, 'stat_fam', '1');
$stat_sour = $this->getBlockSetting($block_id, 'stat_sour', '1');
$stat_media = $this->getBlockSetting($block_id, 'stat_media', '1');
$stat_repo = $this->getBlockSetting($block_id, 'stat_repo', '1');
$stat_surname = $this->getBlockSetting($block_id, 'stat_surname', '1');
$stat_events = $this->getBlockSetting($block_id, 'stat_events', '1');
$stat_users = $this->getBlockSetting($block_id, 'stat_users', '1');
$stat_first_birth = $this->getBlockSetting($block_id, 'stat_first_birth', '1');
$stat_last_birth = $this->getBlockSetting($block_id, 'stat_last_birth', '1');
$stat_first_death = $this->getBlockSetting($block_id, 'stat_first_death', '1');
$stat_last_death = $this->getBlockSetting($block_id, 'stat_last_death', '1');
$stat_long_life = $this->getBlockSetting($block_id, 'stat_long_life', '1');
$stat_avg_life = $this->getBlockSetting($block_id, 'stat_avg_life', '1');
$stat_most_chil = $this->getBlockSetting($block_id, 'stat_most_chil', '1');
$stat_avg_chil = $this->getBlockSetting($block_id, 'stat_avg_chil', '1');
// This can be overriden when embedding in an HTML block
$block = '0';
$stat_link = '1';
foreach (array('show_common_surnames', 'stat_indi', 'stat_fam', 'stat_sour', 'stat_media', 'stat_surname', 'stat_events', 'stat_users', 'stat_first_birth', 'stat_last_birth', 'stat_first_death', 'stat_last_death', 'stat_long_life', 'stat_avg_life', 'stat_most_chil', 'stat_avg_chil', 'stat_link', 'block') as $name) {
if (array_key_exists($name, $cfg)) {
${$name} = $cfg[$name];
}
}
$id = $this->getName() . $block_id;
$class = $this->getName() . '_block';
if ($ctype === 'gedcom' && Auth::isManager($WT_TREE) || $ctype === 'user' && Auth::check()) {
$title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&ged=' . $WT_TREE->getNameHtml() . '&ctype=' . $ctype . '"></a>';
} else {
$title = '';
}
$title .= $this->getTitle();
$stats = new Stats($WT_TREE);
$content = '<b>' . $WT_TREE->getTitleHtml() . '</b><br>';
if ($show_last_update) {
$content .= '<div>' . I18N::translate('This family tree was last updated on %s.', strip_tags($stats->gedcomUpdated())) . '</div>';
}
/** Responsive Design */
$content .= '<div class="stat-table1">';
if ($stat_indi) {
$content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Individuals') . '</div><div class="facts_value stats_value stat-cell"><a href="' . "indilist.php?surname_sublist=no&ged=" . $WT_TREE->getNameUrl() . '">' . $stats->totalIndividuals() . '</a></div></div>';
$content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Males') . '</div><div class="facts_value stats_value stat-cell">' . $stats->totalSexMales() . '<br>' . $stats->totalSexMalesPercentage() . '</div></div>';
$content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Females') . '</div><div class="facts_value stats_value stat-cell">' . $stats->totalSexFemales() . '<br>' . $stats->totalSexFemalesPercentage() . '</div></div>';
}
if ($stat_surname) {
$content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Total surnames') . '</div><div class="facts_value stats_value stat-cell"><a href="indilist.php?show_all=yes&surname_sublist=yes&ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalSurnames() . '</a></div></div>';
}
if ($stat_fam) {
$content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Families') . '</div><div class="facts_value stats_value stat-cell"><a href="famlist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalFamilies() . '</a></div></div>';
}
if ($stat_sour) {
$content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Sources') . '</div><div class="facts_value stats_value stat-cell"><a href="sourcelist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalSources() . '</a></div></div>';
}
if ($stat_media) {
$content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Media objects') . '</div><div class="facts_value stats_value stat-cell"><a href="medialist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalMedia() . '</a></div></div>';
}
if ($stat_repo) {
$content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Repositories') . '</div><div class="facts_value stats_value stat-cell"><a href="repolist.php?ged=' . $WT_TREE->getNameUrl() . '">' . $stats->totalRepositories() . '</a></div></div>';
}
if ($stat_events) {
$content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Total events') . '</div><div class="facts_value stats_value stat-cell">' . $stats->totalEvents() . '</div></div>';
}
if ($stat_users) {
$content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Total users') . '</div><div class="facts_value stats_value stat-cell">';
if (Auth::isManager($WT_TREE)) {
$content .= '<a href="admin_users.php">' . $stats->totalUsers() . '</a>';
} else {
$content .= $stats->totalUsers();
}
$content .= '</div></div>';
}
if (!$block) {
$content .= '</div><div class="facts_table stat-table2">';
}
if ($stat_first_birth) {
$content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Earliest birth year') . '</div><div class="facts_value stats_value stat-cell">' . $stats->firstBirthYear() . '</div>';
if (!$block) {
$content .= '<div class="facts_value stat-cell left">' . $stats->firstBirth() . '</div>';
}
$content .= '</div>';
}
if ($stat_last_birth) {
$content .= '<div class="stat-row"><div class="facts_label stat-cell">' . I18N::translate('Latest birth year') . '</div><div class="facts_value stats_value stat-cell">' . $stats->lastBirthYear() . '</div>';
if (!$block) {
$content .= '<div class="facts_value stat-cell left">' . $stats->lastBirth() . '</div>';
}
//.........这里部分代码省略.........
示例10: header
$controller->setPageTitle(I18N::translate('Change the “My page” blocks'));
$can_reset = true;
}
} else {
if ($gedcom_id < 0) {
$controller->setPageTitle(I18N::translate('Set the default blocks for new family trees'));
$can_reset = false;
} else {
$controller->setPageTitle(I18N::translate('Change the “Home page” blocks'));
$can_reset = true;
}
}
// Only an admin can edit the "default" page
// Only managers can edit the "home page"
// Only a user or an admin can edit a user’s "my page"
if ($gedcom_id < 0 && !Auth::isAdmin() || $gedcom_id > 0 && !Auth::isManager(Tree::findById($gedcom_id)) || $user_id && Auth::id() != $user_id && !Auth::isAdmin()) {
header('Location: ' . WT_BASE_URL);
return;
}
$action = Filter::get('action');
if ($can_reset && Filter::post('default') === '1') {
if ($user_id) {
$defaults = FunctionsDb::getUserBlocks(-1);
} else {
$defaults = FunctionsDb::getTreeBlocks(-1);
}
$main = $defaults['main'];
$right = $defaults['side'];
} else {
if (isset($_REQUEST['main'])) {
$main = $_REQUEST['main'];
示例11: PageController
* 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\PageController;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
define('WT_SCRIPT_NAME', 'admin_trees_merge.php');
require './includes/session.php';
$controller = new PageController();
$controller->restrictAccess(Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Merge family trees'))->pageHeader();
?>
<ol class="breadcrumb small">
<li><a href="admin.php"><?php
echo I18N::translate('Control panel');
?>
</a></li>
<li><a href="admin_trees_manage.php"><?php
echo I18N::translate('Manage family trees');
?>
</a></li>
<li class="active"><?php
echo $controller->getPageTitle();
?>
</li>
</ol>
示例12: PageController
* You should have received a copy of the GNU General Public License
* 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\PageController;
define('WT_SCRIPT_NAME', 'admin_trees_check.php');
require './includes/session.php';
$controller = new PageController();
$controller->restrictAccess(Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Check for errors') . ' — ' . $WT_TREE->getTitleHtml())->pageHeader();
// We need to work with raw GEDCOM data, as we are looking for errors
// which may prevent the GedcomRecord objects from working.
$rows = Database::prepare("SELECT i_id AS xref, 'INDI' AS type, i_gedcom AS gedrec FROM `##individuals` WHERE i_file=?" . " UNION " . "SELECT f_id AS xref, 'FAM' AS type, f_gedcom AS gedrec FROM `##families` WHERE f_file=?" . " UNION " . "SELECT s_id AS xref, 'SOUR' AS type, s_gedcom AS gedrec FROM `##sources` WHERE s_file=?" . " UNION " . "SELECT m_id AS xref, 'OBJE' AS type, m_gedcom AS gedrec FROM `##media` WHERE m_file=?" . " UNION " . "SELECT o_id AS xref, o_type AS type, o_gedcom AS gedrec FROM `##other` WHERE o_file=? AND o_type NOT IN ('HEAD', 'TRLR')")->execute(array($WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId(), $WT_TREE->getTreeId()))->fetchAll();
$records = array();
foreach ($rows as $row) {
$records[$row->xref] = $row;
}
// Need to merge pending new/changed/deleted records
$rows = Database::prepare("SELECT xref, SUBSTRING_INDEX(SUBSTRING_INDEX(SUBSTRING_INDEX(CASE WHEN old_gedcom='' THEN new_gedcom ELSE old_gedcom END, '\n', 1), ' ', 3), ' ', -1) AS type, new_gedcom AS gedrec" . " FROM (" . " SELECT MAX(change_id) AS change_id" . " FROM `##change`" . " WHERE gedcom_id=? AND status='pending'" . " GROUP BY xref" . " ) AS t1" . " JOIN `##change` t2 USING (change_id)")->execute(array($WT_TREE->getTreeId()))->fetchAll();
foreach ($rows as $row) {
if ($row->gedrec) {
// new/updated record
$records[$row->xref] = $row;
} else {
// deleted record
示例13: PageController
*/
namespace Fisharebest\Webtrees;
/**
* Defined in session.php
*
* @global Tree $WT_TREE
*/
global $WT_TREE;
use Fisharebest\Webtrees\Controller\PageController;
use Fisharebest\Webtrees\Functions\FunctionsDb;
use Fisharebest\Webtrees\Functions\FunctionsPrint;
define('WT_SCRIPT_NAME', 'admin_site_merge.php');
require './includes/session.php';
$controller = new PageController();
$controller->restrictAccess(Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Merge records') . ' — ' . $WT_TREE->getTitleHtml())->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();');
$gid1 = Filter::post('gid1', WT_REGEX_XREF, Filter::get('gid1', WT_REGEX_XREF));
$gid2 = Filter::post('gid2', WT_REGEX_XREF, Filter::get('gid2', WT_REGEX_XREF));
$keep1 = Filter::postArray('keep1');
$keep2 = Filter::postArray('keep2');
$rec1 = GedcomRecord::getInstance($gid1, $WT_TREE);
$rec2 = GedcomRecord::getInstance($gid2, $WT_TREE);
if ($gid1 && !$rec1) {
FlashMessages::addMessage(I18N::translate('%1$s does not exist.', $gid1), 'danger');
}
if ($gid2 && !$rec2) {
FlashMessages::addMessage(I18N::translate('%1$s does not exist.', $gid2), 'danger');
}
if ($rec1 && $rec2 && $rec1->getXref() === $rec2->getXref()) {
FlashMessages::addMessage(I18N::translate('You entered the same IDs. You cannot merge the same records.'), 'danger');
}
示例14: foreach
$record = Family::getInstance($row->xref, $WT_TREE, $row->gedcom);
foreach ($record->getFacts() as $fact) {
$old_place = $fact->getAttribute('PLAC');
if (preg_match('/(^|, )' . preg_quote($search, '/') . '$/i', $old_place)) {
$new_place = preg_replace('/(^|, )' . preg_quote($search, '/') . '$/i', '$1' . $replace, $old_place);
$changes[$old_place] = $new_place;
if ($confirm == 'update') {
$gedcom = preg_replace('/(\\n2 PLAC (?:.*, )*)' . preg_quote($search, '/') . '(\\n|$)/i', '$1' . $replace . '$2', $fact->getGedcom());
$record->updateFact($fact->getFactId(), $gedcom, false);
}
}
}
}
}
$controller = new PageController();
$controller->restrictAccess(Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Update all the place names in a family tree') . ' — ' . $WT_TREE->getTitleHtml())->addInlineJavascript('autocomplete();')->pageHeader();
?>
<ol class="breadcrumb small">
<li><a href="admin.php"><?php
echo I18N::translate('Control panel');
?>
</a></li>
<li><a href="admin_trees_manage.php"><?php
echo I18N::translate('Manage family trees');
?>
</a></li>
<li class="active"><?php
echo $controller->getPageTitle();
?>
</li>
示例15: canEdit
/**
* Can we edit this record?
*
* @return bool
*/
public function canEdit()
{
return Auth::isManager($this->tree) || Auth::isEditor($this->tree) && strpos($this->gedcom, "\n1 RESN locked") === false;
}