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


PHP Note::getInstance方法代码示例

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


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

示例1: foreach

     foreach ($rows as $row) {
         $family = Family::getInstance($row->xref, $WT_TREE, $row->gedcom);
         if ($family->canShowName()) {
             $marriage_year = $family->getMarriageYear();
             if ($marriage_year) {
                 $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName() . ', <i>' . $marriage_year . '</i>');
             } else {
                 $data[] = array('value' => $family->getXref(), 'label' => $family->getFullName());
             }
         }
     }
     // Fetch all data, regardless of privacy
     $rows = get_NOTE_rows($WT_TREE, $term);
     // Filter for privacy
     foreach ($rows as $row) {
         $note = Note::getInstance($row->xref, $WT_TREE, $row->gedcom);
         if ($note->canShowName()) {
             $data[] = array('value' => $note->getXref(), 'label' => $note->getFullName());
         }
     }
     echo json_encode($data);
     return;
 case 'IFS':
     $data = array();
     // Fetch all data, regardless of privacy
     $rows = get_INDI_rows($WT_TREE, $term);
     // Filter for privacy
     foreach ($rows as $row) {
         $person = Individual::getInstance($row->xref, $WT_TREE, $row->gedcom);
         if ($person->canShowName()) {
             $data[] = array('value' => $person->getXref(), 'label' => str_replace(array('@N.N.', '@P.N.'), array(I18N::translateContext('Unknown surname', '…'), I18N::translateContext('Unknown given name', '…')), $row->n_full) . ', <i>' . $person->getLifeSpan() . '</i>');
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:autocomplete.php

示例2: autocomplete_NOTE

/**
* returns NOTEs (Shared) matching filter
* @return Array of string
*/
function autocomplete_NOTE($FILTER)
{
    global $TBLPREFIX, $gBitDb;
    $sql = "SELECT o_type AS type, o_id AS xref, o_file AS ged_id, o_gedcom AS gedrec FROM {$TBLPREFIX}other WHERE o_gedcom LIKE '%{$FILTER}%' AND o_type='NOTE' AND o_file=" . PGV_GED_ID;
    $rows = $gBitDb->query($sql, array("%{$FILTER}%", PGV_GED_ID), PGV_AUTOCOMPLETE_LIMIT);
    $data = array();
    while ($row = $rows->fetchRow()) {
        $note = Note::getInstance($row);
        if ($note->canDisplayName()) {
            $data[$row['xref']] = $note->getFullName();
        }
    }
    return $data;
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:18,代码来源:autocomplete.php

示例3: autocomplete_NOTE

/**
* returns NOTEs (Shared) matching filter
* @return Array of string
*/
function autocomplete_NOTE($FILTER)
{
    $rows = get_autocomplete_NOTE($FILTER);
    $data = array();
    foreach ($rows as $row) {
        $note = Note::getInstance($row);
        if ($note->canDisplayName()) {
            $data[$row["xref"]] = $note->getFullName();
        }
    }
    return $data;
}
开发者ID:rathervague,项目名称:phpgedview,代码行数:16,代码来源:autocomplete.php

示例4: search_notes

function search_notes($query, $geds, $match, $skip)
{
    global $TBLPREFIX, $GEDCOM, $DB_UTF8_COLLATION, $gBitDb;
    // No query => no results
    if (!$query) {
        return array();
    }
    // Convert the query into a SQL expression
    $querysql = array();
    // Convert the query into a regular expression
    $queryregex = array();
    foreach ($query as $q) {
        $queryregex[] = preg_quote(UTF8_strtoupper($q), '/');
        if ($DB_UTF8_COLLATION || !has_utf8($q)) {
            $querysql[] = "o_gedcom LIKE '%{$q}%'";
        } else {
            $querysql[] = "(o_gedcom LIKE '%{$q}% OR o_gedcom LIKE '%" . UTF8_strtoupper($q) . "%' OR o_gedcom LIKE '%" . UTF8_strtolower($q) . "%'";
        }
    }
    $sql = "SELECT 'NOTE' AS type, o_id AS xref, o_file AS ged_id, o_gedcom AS gedrec FROM {$TBLPREFIX}other WHERE (" . implode(" {$match} ", $querysql) . ") AND o_type='NOTE' AND o_file IN (" . implode(',', $geds) . ')';
    // Group results by gedcom, to minimise switching between privacy files
    $sql .= ' ORDER BY ged_id';
    // Tags we might not want to search
    if (PGV_USER_IS_ADMIN) {
        $skipregex = '/^\\d (_UID|_PGVU|FILE|FORM|TYPE|CHAN|SUBM|REFN) .*(' . implode('|', $queryregex) . ')/im';
    } else {
        $skipregex = '/^\\d (_UID|_PGVU|FILE|FORM|TYPE|CHAN|SUBM|REFN|RESN) .*(' . implode('|', $queryregex) . ')/im';
    }
    $list = array();
    $result = $gBitDb->query($sql);
    $GED_ID = PGV_GED_ID;
    while ($row = $result->fetchRow()) {
        // Switch privacy file if necessary
        if ($row['ged_id'] != $GED_ID) {
            $GEDCOM = get_gedcom_from_id($row['ged_id']);
            load_privacy_file($row['ged_id']);
            $GED_ID = $row['ged_id'];
        }
        $note = Note::getInstance($row);
        // SQL may have matched on private data or gedcom tags, so check again against privatized data.
        $gedrec = UTF8_strtoupper($note->getGedcomRecord());
        foreach ($queryregex as $q) {
            if (!preg_match('/(\\n\\d|^0 @' . PGV_REGEX_XREF . '@) ' . PGV_REGEX_TAG . ' .*' . $q . '/i', $gedrec)) {
                continue 2;
            }
        }
        if ($skip && preg_match($skipregex, $gedrec)) {
            continue;
        }
        $list[] = $note;
    }
    // Switch privacy file if necessary
    if ($GED_ID != PGV_GED_ID) {
        $GEDCOM = get_gedcom_from_id(PGV_GED_ID);
        load_privacy_file(PGV_GED_ID);
    }
    return $list;
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:58,代码来源:functions_db.php


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