当前位置: 首页>>代码示例>>PHP>>正文


PHP GedcomRecord::getInstance方法代码示例

本文整理汇总了PHP中Fisharebest\Webtrees\GedcomRecord::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP GedcomRecord::getInstance方法的具体用法?PHP GedcomRecord::getInstance怎么用?PHP GedcomRecord::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fisharebest\Webtrees\GedcomRecord的用法示例。


在下文中一共展示了GedcomRecord::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: canShowByType

 /**
  * Each object type may have its own special rules, and re-implement this function.
  *
  * @param int $access_level
  *
  * @return bool
  */
 protected function canShowByType($access_level)
 {
     // Hide media objects if they are attached to private records
     $linked_ids = Database::prepare("SELECT l_from FROM `##link` WHERE l_to = ? AND l_file = ?")->execute(array($this->xref, $this->tree->getTreeId()))->fetchOneColumn();
     foreach ($linked_ids as $linked_id) {
         $linked_record = GedcomRecord::getInstance($linked_id, $this->tree);
         if ($linked_record && !$linked_record->canShow($access_level)) {
             return false;
         }
     }
     // ... otherwise apply default behaviour
     return parent::canShowByType($access_level);
 }
开发者ID:jflash,项目名称:webtrees,代码行数:20,代码来源:Media.php

示例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 . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;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;
     }
 }
开发者ID:josefpavlik,项目名称:webtrees,代码行数:60,代码来源:TopPageViewsModule.php

示例3: modAction

 /**
  * This is a general purpose hook, allowing modules to respond to routes
  * of the form module.php?mod=FOO&mod_action=BAR
  *
  * @param string $mod_action
  */
 public function modAction($mod_action)
 {
     global $WT_TREE;
     switch ($mod_action) {
         case 'menu-add-favorite':
             // Process the "add to user favorites" menu item on indi/fam/etc. pages
             $record = GedcomRecord::getInstance(Filter::post('xref', WT_REGEX_XREF), $WT_TREE);
             if (Auth::check() && $record->canShowName()) {
                 self::addFavorite(array('user_id' => Auth::id(), 'gedcom_id' => $record->getTree()->getTreeId(), 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => null, 'title' => null));
                 FlashMessages::addMessage(I18N::translate('“%s” has been added to your favorites.', $record->getFullName()));
             }
             break;
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:20,代码来源:UserFavoritesModule.php

示例4: __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'));
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:49,代码来源:GedcomRecordController.php

示例5: mediaQuery

    /**
     * Search for a media object.
     */
    private static function mediaQuery()
    {
        global $WT_TREE;
        $iid2 = Filter::get('iid', WT_REGEX_XREF);
        $controller = new SimpleController();
        $controller->setPageTitle(I18N::translate('Link to an existing media object'))->pageHeader();
        $record = GedcomRecord::getInstance($iid2, $WT_TREE);
        if ($record) {
            $headjs = '';
            if ($record instanceof Family) {
                if ($record->getHusband()) {
                    $headjs = $record->getHusband()->getXref();
                } elseif ($record->getWife()) {
                    $headjs = $record->getWife()->getXref();
                }
            }
            ?>
			<script>
				function insertId() {
					if (window.opener.document.getElementById('addlinkQueue')) {
						// alert('Please move this alert window and examine the contents of the pop-up window, then click OK')
						window.opener.insertRowToTable('<?php 
            echo $record->getXref();
            ?>
', '<?php 
            echo htmlspecialchars($record->getFullName());
            ?>
', '<?php 
            echo $headjs;
            ?>
');
						window.close();
					}
				}
			</script>
			<?php 
        } else {
            ?>
			<script>
				function insertId() {
					window.opener.alert('<?php 
            echo $iid2;
            ?>
 - <?php 
            echo I18N::translate('Not a valid individual, family, or source ID');
            ?>
');
					window.close();
				}
			</script>
			<?php 
        }
        ?>
		<script>window.onLoad = insertId();</script>
		<?php 
    }
开发者ID:tronsmit,项目名称:webtrees,代码行数:59,代码来源:CensusAssistantModule.php

示例6: 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());
     }
 }
开发者ID:tunandras,项目名称:webtrees,代码行数:28,代码来源:Fact.php

示例7: createRecord

 /**
  * Create a new record from GEDCOM data.
  *
  * @param string $gedcom
  *
  * @throws \Exception
  *
  * @return GedcomRecord
  */
 public function createRecord($gedcom)
 {
     if (preg_match('/^0 @(' . WT_REGEX_XREF . ')@ (' . WT_REGEX_TAG . ')/', $gedcom, $match)) {
         $xref = $match[1];
         $type = $match[2];
     } else {
         throw new \Exception('Invalid argument to GedcomRecord::createRecord(' . $gedcom . ')');
     }
     if (strpos("\r", $gedcom) !== false) {
         // MSDOS line endings will break things in horrible ways
         throw new \Exception('Evil line endings found in GedcomRecord::createRecord(' . $gedcom . ')');
     }
     // webtrees creates XREFs containing digits.  Anything else (e.g. “new”) is just a placeholder.
     if (!preg_match('/\\d/', $xref)) {
         $xref = $this->getNewXref($type);
         $gedcom = preg_replace('/^0 @(' . WT_REGEX_XREF . ')@/', '0 @' . $xref . '@', $gedcom);
     }
     // Create a change record, if not already present
     if (!preg_match('/\\n1 CHAN/', $gedcom)) {
         $gedcom .= "\n1 CHAN\n2 DATE " . date('d M Y') . "\n3 TIME " . date('H:i:s') . "\n2 _WT_USER " . Auth::user()->getUserName();
     }
     // Create a pending change
     Database::prepare("INSERT INTO `##change` (gedcom_id, xref, old_gedcom, new_gedcom, user_id) VALUES (?, ?, '', ?, ?)")->execute(array($this->tree_id, $xref, $gedcom, Auth::id()));
     Log::addEditLog('Create: ' . $type . ' ' . $xref);
     // Accept this pending change
     if (Auth::user()->getPreference('auto_accept')) {
         FunctionsImport::acceptAllChanges($xref, $this->tree_id);
     }
     // Return the newly created record.  Note that since GedcomRecord
     // has a cache of pending changes, we cannot use it to create a
     // record with a newly created pending change.
     return GedcomRecord::getInstance($xref, $this, $gedcom);
 }
开发者ID:AlexSnet,项目名称:webtrees,代码行数:42,代码来源:Tree.php

示例8: changesTable

    /**
     * Print a table of events
     *
     * @param string[] $change_ids
     * @param string $sort
     *
     * @return string
     */
    public static function changesTable($change_ids, $sort)
    {
        global $controller, $WT_TREE;
        $n = 0;
        $table_id = 'table-chan-' . Uuid::uuid4();
        // lists requires a unique ID in case there are multiple lists per page
        switch ($sort) {
            case 'name':
                //name
                $aaSorting = "[5,'asc'], [4,'desc']";
                break;
            case 'date_asc':
                //date ascending
                $aaSorting = "[4,'asc'], [5,'asc']";
                break;
            case 'date_desc':
                //date descending
                $aaSorting = "[4,'desc'], [5,'asc']";
                break;
        }
        $html = '';
        $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("#' . $table_id . '").dataTable({
					dom: \'t\',
					paging: false,
					autoWidth:false,
					lengthChange: false,
					filter: false,
					' . I18N::datatablesI18N() . ',
					jQueryUI: true,
					sorting: [' . $aaSorting . '],
					columns: [
						/* 0-Type */    { sortable: false, class: "center" },
						/* 1-Record */  { dataSort: 5 },
						/* 2-Change */  { dataSort: 4 },
						/* 3-By */      null,
						/* 4-DATE */    { visible: false },
						/* 5-SORTNAME */{ type: "unicode", visible: false }
					]
				});
			');
        //-- table header
        $html .= '<table id="' . $table_id . '" class="width100">';
        $html .= '<thead><tr>';
        $html .= '<th></th>';
        $html .= '<th>' . I18N::translate('Record') . '</th>';
        $html .= '<th>' . GedcomTag::getLabel('CHAN') . '</th>';
        $html .= '<th>' . GedcomTag::getLabel('_WT_USER') . '</th>';
        $html .= '<th>DATE</th>';
        //hidden by datatables code
        $html .= '<th>SORTNAME</th>';
        //hidden by datatables code
        $html .= '</tr></thead><tbody>';
        //-- table body
        foreach ($change_ids as $change_id) {
            $record = GedcomRecord::getInstance($change_id, $WT_TREE);
            if (!$record || !$record->canShow()) {
                continue;
            }
            $html .= '<tr><td>';
            switch ($record::RECORD_TYPE) {
                case 'INDI':
                    $icon = $record->getSexImage('small');
                    break;
                case 'FAM':
                    $icon = '<i class="icon-button_family"></i>';
                    break;
                case 'OBJE':
                    $icon = '<i class="icon-button_media"></i>';
                    break;
                case 'NOTE':
                    $icon = '<i class="icon-button_note"></i>';
                    break;
                case 'SOUR':
                    $icon = '<i class="icon-button_source"></i>';
                    break;
                case 'REPO':
                    $icon = '<i class="icon-button_repository"></i>';
                    break;
                default:
                    $icon = '&nbsp;';
                    break;
            }
            $html .= '<a href="' . $record->getHtmlUrl() . '">' . $icon . '</a>';
            $html .= '</td>';
            ++$n;
            //-- Record name(s)
            $name = $record->getFullName();
            $html .= '<td class="wrap">';
            $html .= '<a href="' . $record->getHtmlUrl() . '">' . $name . '</a>';
//.........这里部分代码省略.........
开发者ID:tunandras,项目名称:webtrees,代码行数:101,代码来源:FunctionsPrintLists.php

示例9: getCartList

 /**
  * A list for the side bar.
  *
  * @return string
  */
 public function getCartList()
 {
     global $WT_TREE;
     $cart = Session::get('cart', array());
     if (!array_key_exists($WT_TREE->getTreeId(), $cart)) {
         $cart[$WT_TREE->getTreeId()] = array();
     }
     $pid = Filter::get('pid', WT_REGEX_XREF);
     if (!$cart[$WT_TREE->getTreeId()]) {
         $out = I18N::translate('Your clippings cart is empty.');
     } else {
         $out = '<ul>';
         foreach (array_keys($cart[$WT_TREE->getTreeId()]) as $xref) {
             $record = GedcomRecord::getInstance($xref, $WT_TREE);
             if ($record instanceof Individual || $record instanceof Family) {
                 switch ($record::RECORD_TYPE) {
                     case 'INDI':
                         $icon = 'icon-indis';
                         break;
                     case 'FAM':
                         $icon = 'icon-sfamily';
                         break;
                 }
                 $out .= '<li>';
                 if (!empty($icon)) {
                     $out .= '<i class="' . $icon . '"></i>';
                 }
                 $out .= '<a href="' . $record->getHtmlUrl() . '">';
                 if ($record instanceof Individual) {
                     $out .= $record->getSexImage();
                 }
                 $out .= ' ' . $record->getFullName() . ' ';
                 if ($record instanceof Individual && $record->canShow()) {
                     $out .= ' (' . $record->getLifeSpan() . ')';
                 }
                 $out .= '</a>';
                 $out .= '<a class="icon-remove remove_cart" href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;remove=' . $xref . '&amp;pid=' . $pid . '" title="' . I18N::translate('Remove') . '"></a>';
                 $out .= '</li>';
             }
         }
         $out .= '</ul>';
     }
     if ($cart[$WT_TREE->getTreeId()]) {
         $out .= '<br><a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;empty=true&amp;pid=' . $pid . '" class="remove_cart">' . I18N::translate('Empty the clippings cart') . '</a>' . '<br>' . '<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;download=true&amp;pid=' . $pid . '" class="add_cart">' . I18N::translate('Download') . '</a>';
     }
     $record = Individual::getInstance($pid, $WT_TREE);
     if ($record && !array_key_exists($record->getXref(), $cart[$WT_TREE->getTreeId()])) {
         $out .= '<br><a href="module.php?mod=' . $this->getName() . '&amp;mod_action=ajax&amp;sb_action=clippings&amp;add=' . $pid . '&amp;pid=' . $pid . '" class="add_cart"><i class="icon-clippings"></i> ' . I18N::translate('Add %s to the clippings cart', $record->getFullName()) . '</a>';
     }
     return $out;
 }
开发者ID:josefpavlik,项目名称:webtrees,代码行数:56,代码来源:ClippingsCartModule.php

示例10: header

 */
namespace Fisharebest\Webtrees;

/**
 * Defined in session.php
 *
 * @global Tree $WT_TREE
 */
global $WT_TREE;
use Fisharebest\Webtrees\Controller\GedcomRecordController;
use Fisharebest\Webtrees\Functions\FunctionsPrint;
use Fisharebest\Webtrees\Functions\FunctionsPrintFacts;
use Fisharebest\Webtrees\Functions\FunctionsPrintLists;
define('WT_SCRIPT_NAME', 'gedrecord.php');
require './includes/session.php';
$record = GedcomRecord::getInstance(Filter::get('pid', WT_REGEX_XREF), $WT_TREE);
if ($record instanceof Individual || $record instanceof Family || $record instanceof Source || $record instanceof Repository || $record instanceof Note || $record instanceof Media) {
    header('Location: ' . WT_BASE_URL . $record->getRawUrl());
    return;
}
$controller = new GedcomRecordController($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 record 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 record 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())) {
开发者ID:AlexSnet,项目名称:webtrees,代码行数:31,代码来源:gedrecord.php

示例11: calendar_list_text

/**
 * Format a list of facts for display
 *
 * @param Fact[] $list
 * @param string $tag1
 * @param string $tag2
 * @param bool   $show_sex_symbols
 *
 * @return string
 */
function calendar_list_text($list, $tag1, $tag2, $show_sex_symbols)
{
    global $males, $females, $WT_TREE;
    $html = '';
    foreach ($list as $id => $facts) {
        $tmp = GedcomRecord::getInstance($id, $WT_TREE);
        $html .= $tag1 . '<a href="' . $tmp->getHtmlUrl() . '">' . $tmp->getFullName() . '</a> ';
        if ($show_sex_symbols && $tmp instanceof Individual) {
            switch ($tmp->getSex()) {
                case 'M':
                    $html .= '<i class="icon-sex_m_9x9" title="' . I18N::translate('Male') . '"></i>';
                    ++$males;
                    break;
                case 'F':
                    $html .= '<i class="icon-sex_f_9x9" title="' . I18N::translate('Female') . '"></i>';
                    ++$females;
                    break;
                default:
                    $html .= '<i class="icon-sex_u_9x9" title="' . I18N::translateContext('unknown gender', 'Unknown') . '"></i>';
                    break;
            }
        }
        $html .= '<div class="indent">' . $facts . '</div>' . $tag2;
    }
    return $html;
}
开发者ID:josefpavlik,项目名称:webtrees,代码行数:36,代码来源:calendar.php

示例12: getMarriage

 /**
  * Determine if the family parents are married.
  * 
  * Don't use the default function because we want to privatize the record but display the name
  * and the parents of the spouse if the spouse him/herself is not private.
  * 
  * @param type $family
  * @return boolean
  */
 private function getMarriage($family)
 {
     $record = GedcomRecord::getInstance($family->getXref(), $this->tree);
     foreach ($record->getFacts('MARR', false, Auth::PRIV_HIDE) as $fact) {
         if ($fact) {
             return true;
         }
     }
 }
开发者ID:bxbroze,项目名称:webtrees,代码行数:18,代码来源:FancyTreeviewClass.php

示例13: 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, $controller, $WT_TREE;
        $show_other = $this->getBlockSetting($block_id, 'show_other', self::DEFAULT_SHOW_OTHER);
        $show_unassigned = $this->getBlockSetting($block_id, 'show_unassigned', self::DEFAULT_SHOW_UNASSIGNED);
        $show_future = $this->getBlockSetting($block_id, 'show_future', self::DEFAULT_SHOW_FUTURE);
        $block = $this->getBlockSetting($block_id, 'block', self::DEFAULT_BLOCK);
        foreach (array('show_unassigned', 'show_other', 'show_future', '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('Preferences') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
        } else {
            $title = '';
        }
        $title .= $this->getTitle();
        $table_id = Uuid::uuid4();
        // create a unique ID
        $controller->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addInlineJavascript('
			jQuery("#' . $table_id . '").dataTable({
				dom: \'t\',
				' . I18N::datatablesI18N() . ',
				autoWidth: false,
				paginate: false,
				lengthChange: false,
				filter: false,
				info: true,
				jQueryUI: true,
				columns: [
					null,
					null,
					null,
					null
				]
			});
			jQuery("#' . $table_id . '").css("visibility", "visible");
			jQuery(".loading-image").css("display", "none");
		');
        $content = '';
        $content .= '<div class="loading-image">&nbsp;</div>';
        $content .= '<table id="' . $table_id . '" style="visibility:hidden;">';
        $content .= '<thead><tr>';
        $content .= '<th>' . GedcomTag::getLabel('DATE') . '</th>';
        $content .= '<th>' . I18N::translate('Record') . '</th>';
        $content .= '<th>' . I18N::translate('Username') . '</th>';
        $content .= '<th>' . GedcomTag::getLabel('TEXT') . '</th>';
        $content .= '</tr></thead><tbody>';
        $found = false;
        $end_jd = $show_future ? 99999999 : WT_CLIENT_JD;
        $xrefs = Database::prepare("SELECT DISTINCT d_gid FROM `##dates`" . " WHERE d_file = :tree_id AND d_fact = '_TODO' AND d_julianday1 < :jd")->execute(array('tree_id' => $WT_TREE->getTreeId(), 'jd' => $end_jd))->fetchOneColumn();
        $facts = array();
        foreach ($xrefs as $xref) {
            $record = GedcomRecord::getInstance($xref, $WT_TREE);
            if ($record->canShow()) {
                foreach ($record->getFacts('_TODO') as $fact) {
                    $facts[] = $fact;
                }
            }
        }
        foreach ($facts as $fact) {
            $record = $fact->getParent();
            $user_name = $fact->getAttribute('_WT_USER');
            if ($user_name === Auth::user()->getUserName() || !$user_name && $show_unassigned || $user_name && $show_other) {
                $content .= '<tr>';
                $content .= '<td data-sort="' . $fact->getDate()->julianDay() . '">' . $fact->getDate()->display() . '</td>';
                $content .= '<td data-sort="' . Filter::escapeHtml($record->getSortName()) . '"><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></td>';
                $content .= '<td>' . $user_name . '</td>';
                $content .= '<td dir="auto">' . $fact->getValue() . '</td>';
                $content .= '</tr>';
                $found = true;
            }
        }
        $content .= '</tbody></table>';
        if (!$found) {
            $content .= '<p>' . I18N::translate('There are no research tasks in this family tree.') . '</p>';
        }
        if ($template) {
            if ($block) {
                $class .= ' small_inner_block';
            }
            return Theme::theme()->formatBlock($id, $title, $class, $content);
        } else {
            return $content;
        }
    }
开发者ID:fisharebest,项目名称:webtrees,代码行数:98,代码来源:ResearchTaskModule.php

示例14: array

            $diff_lines = array();
            foreach ($differences as $difference) {
                switch ($difference[1]) {
                    case MyersDiff::DELETE:
                        $diff_lines[] = '<del>' . $difference[0] . '</del>';
                        break;
                    case MyersDiff::INSERT:
                        $diff_lines[] = '<ins>' . $difference[0] . '</ins>';
                        break;
                    default:
                        $diff_lines[] = $difference[0];
                }
            }
            // Only convert valid xrefs to links
            $data[] = array($row->change_id, $row->change_time, I18N::translate($row->status), GedcomRecord::getInstance($row->xref, Tree::findByName($gedc)) ? "<a href='gedrecord.php?pid={$row->xref}&ged={$row->gedcom_name}'>{$row->xref}</a>" : $row->xref, '<div class="gedcom-data" dir="ltr">' . preg_replace_callback('/@(' . WT_REGEX_XREF . ')@/', function ($match) use($gedc) {
                return GedcomRecord::getInstance($match[1], Tree::findByName($gedc)) ? "<a href='#' onclick='return edit_raw(\"{$match[1]}\");'>{$match[0]}</a>" : $match[0];
            }, implode("\n", $diff_lines)) . '</div>', $row->user_name, $row->gedcom_name);
        }
        header('Content-type: application/json');
        // See http://www.datatables.net/usage/server-side
        echo json_encode(array('draw' => Filter::getInteger('draw'), 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data));
        return;
}
$controller->pageHeader()->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)->addExternalJavascript(WT_MOMENT_JS_URL)->addExternalJavascript(WT_BOOTSTRAP_DATETIMEPICKER_JS_URL)->addInlineJavascript('
		jQuery(".table-site-changes").dataTable( {
			processing: true,
			serverSide: true,
			ajax: "' . WT_BASE_URL . WT_SCRIPT_NAME . '?action=load_json&from=' . $from . '&to=' . $to . '&type=' . $type . '&oldged=' . rawurlencode($oldged) . '&newged=' . rawurlencode($newged) . '&xref=' . rawurlencode($xref) . '&user=' . rawurlencode($user) . '&gedc=' . rawurlencode($gedc) . '",
			' . I18N::datatablesI18N(array(10, 20, 50, 100, 500, 1000, -1)) . ',
			sorting: [[ 0, "desc" ]],
			pageLength: ' . Auth::user()->getPreference('admin_site_change_page_size', 10) . ',
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:31,代码来源:admin_site_change.php

示例15: 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;
     $sendmail = $this->getBlockSetting($block_id, 'sendmail', '1');
     $days = $this->getBlockSetting($block_id, 'days', '1');
     $block = $this->getBlockSetting($block_id, 'block', '1');
     foreach (array('days', 'sendmail', 'block') as $name) {
         if (array_key_exists($name, $cfg)) {
             ${$name} = $cfg[$name];
         }
     }
     $changes = Database::prepare("SELECT 1" . " FROM `##change`" . " WHERE status='pending'" . " LIMIT 1")->fetchOne();
     if ($changes === '1' && $sendmail === '1') {
         // There are pending changes - tell moderators/managers/administrators about them.
         if (WT_TIMESTAMP - Site::getPreference('LAST_CHANGE_EMAIL') > 60 * 60 * 24 * $days) {
             // Which users have pending changes?
             foreach (User::all() as $user) {
                 if ($user->getPreference('contactmethod') !== 'none') {
                     foreach (Tree::getAll() as $tree) {
                         if ($tree->hasPendingEdit() && Auth::isManager($tree, $user)) {
                             I18N::init($user->getPreference('language'));
                             Mail::systemMessage($tree, $user, I18N::translate('Pending changes'), I18N::translate('There are pending changes for you to moderate.') . Mail::EOL . Mail::EOL . '<a href="' . WT_BASE_URL . 'index.php?ged=' . $WT_TREE->getNameUrl() . '">' . WT_BASE_URL . 'index.php?ged=' . $WT_TREE->getNameUrl() . '</a>');
                             I18N::init(WT_LOCALE);
                         }
                     }
                 }
             }
             Site::setPreference('LAST_CHANGE_EMAIL', WT_TIMESTAMP);
         }
     }
     if (Auth::isEditor($WT_TREE) && $WT_TREE->hasPendingEdit()) {
         $id = $this->getName() . $block_id;
         $class = $this->getName() . '_block';
         if ($ctype === 'user' || Auth::isManager($WT_TREE)) {
             $title = '<a class="icon-admin" title="' . I18N::translate('Configure') . '" href="block_edit.php?block_id=' . $block_id . '&amp;ged=' . $WT_TREE->getNameHtml() . '&amp;ctype=' . $ctype . '"></a>';
         } else {
             $title = '';
         }
         $title .= $this->getTitle();
         $content = '';
         if (Auth::isModerator($WT_TREE)) {
             $content .= "<a href=\"#\" onclick=\"window.open('edit_changes.php','_blank', chan_window_specs); return false;\">" . I18N::translate('There are pending changes for you to moderate.') . "</a><br>";
         }
         if ($sendmail === '1') {
             $content .= I18N::translate('Last email reminder was sent ') . FunctionsDate::formatTimestamp(Site::getPreference('LAST_CHANGE_EMAIL')) . "<br>";
             $content .= I18N::translate('Next email reminder will be sent after ') . FunctionsDate::formatTimestamp(Site::getPreference('LAST_CHANGE_EMAIL') + 60 * 60 * 24 * $days) . "<br><br>";
         }
         $content .= '<ul>';
         $changes = Database::prepare("SELECT xref" . " FROM  `##change`" . " WHERE status='pending'" . " AND   gedcom_id=?" . " GROUP BY xref")->execute(array($WT_TREE->getTreeId()))->fetchAll();
         foreach ($changes as $change) {
             $record = GedcomRecord::getInstance($change->xref, $WT_TREE);
             if ($record->canShow()) {
                 $content .= '<li><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></li>';
             }
         }
         $content .= '</ul>';
         if ($template) {
             if ($block) {
                 $class .= ' small_inner_block';
             }
             return Theme::theme()->formatBlock($id, $title, $class, $content);
         } else {
             return $content;
         }
     }
 }
开发者ID:pal-saugstad,项目名称:webtrees,代码行数:75,代码来源:ReviewChangesModule.php


注:本文中的Fisharebest\Webtrees\GedcomRecord::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。