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


PHP Source::getInstance方法代码示例

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


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

示例1: withAuthors

 public function withAuthors()
 {
     if ($this->id) {
         $this->authors = Source::getInstance()->getAllAuthors($this->id);
     }
     return $this;
 }
开发者ID:krivov,项目名称:testBookCatalog,代码行数:7,代码来源:Book.php

示例2: addAuthorsToBook

 /**
  * @param      $authorsArray
  * @param Book $book
  */
 public function addAuthorsToBook($authorsArray, Book $book)
 {
     $authors = Source::getInstance()->getAllAuthors(NULL, $authorsArray);
     if ($authors) {
         $queryDelete = "DELETE FROM book_author WHERE id_book = " . $book->id;
         $res = mysqli_query(Source::$_connection, $queryDelete);
         $values = array();
         foreach ($authors as $author) {
             $values[] = "(" . $book->id . ", " . $author->id . ")";
         }
         $queryAdd = "INSERT INTO book_author (id_book, id_author) VALUES " . implode(",", $values);
         $res = mysqli_query(Source::$_connection, $queryAdd);
         if ($res) {
             $book->authors = $authors;
         }
     }
 }
开发者ID:krivov,项目名称:testBookCatalog,代码行数:21,代码来源:Source.php

示例3: array

 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>');
         }
     }
     // Fetch all data, regardless of privacy
     $rows = get_SOUR_rows($WT_TREE, $term);
     // Filter for privacy
     foreach ($rows as $row) {
         $source = Source::getInstance($row->xref, $WT_TREE, $row->gedcom);
         if ($source->canShowName()) {
             $data[] = array('value' => $source->getXref(), 'label' => $source->getFullName());
         }
     }
     // Fetch all data, regardless of privacy
     $rows = get_FAM_rows($WT_TREE, $term);
     // Filter for privacy
     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());
开发者ID:tronsmit,项目名称:webtrees,代码行数:31,代码来源:autocomplete.php

示例4: header

<?php

/**
 * Created by PhpStorm.
 * User: Sergey Krivov (sergey@krivov.info)
 * Date: 09.02.2016
 * Time: 14:59
 */
$book = NULL;
if (isset($_GET['id'])) {
    $book = Source::getInstance()->getBook($_GET['id']);
}
if ($book) {
    $book->withAuthors();
    require "view/book.php";
} else {
    header("Location: /");
}
开发者ID:krivov,项目名称:testBookCatalog,代码行数:18,代码来源:book.php

示例5:

<?php

/**
 * Created by PhpStorm.
 * User: Sergey Krivov (sergey@krivov.info)
 * Date: 10.02.2016
 * Time: 01:43
 */
if (isset($_GET['id'])) {
    $book = Source::getInstance()->getBook($_GET['id']);
    if ($book) {
        Source::getInstance()->deleteBook($book);
    }
}
header("Location: /");
开发者ID:krivov,项目名称:testBookCatalog,代码行数:15,代码来源:delete.php

示例6: Book

<?php

/**
 * Created by PhpStorm.
 * User: Sergey Krivov (sergey@krivov.info)
 * Date: 09.02.2016
 * Time: 15:03
 */
$book = new Book();
$authors = Source::getInstance()->getAllAuthors();
if (isset($_GET['id'])) {
    $book = Source::getInstance()->getBook($_GET['id']);
    if (!$book) {
        header("Location: /");
    }
    $book->withAuthors();
}
if (isset($_POST['book'])) {
    if (isset($_GET['id'])) {
        Source::getInstance()->editBook($book, $_POST['book']);
    } else {
        $book = new Book($_POST['book']);
        Source::getInstance()->addBook($book, $_POST['book']['authors']);
    }
    if (count($book->_errors) == 0) {
        header("Location: /?page=book&id=" . $book->id);
    }
}
require "view/form.php";
开发者ID:krivov,项目名称:testBookCatalog,代码行数:29,代码来源:form.php

示例7: isset

<?php

/**
 * Created by PhpStorm.
 * User: Sergey Krivov (sergey@krivov.info)
 * Date: 09.02.2016
 * Time: 15:00
 */
$page = isset($_GET['p']) ? (int) $_GET['p'] : 1;
$limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5;
$order = isset($_GET['order']) && $_GET['order'] === 'DESC' ? $_GET['order'] : 'ASC';
$orderField = isset($_GET['order_field']) && $_GET['order_field'] === 'date' ? $_GET['order_field'] : 'name';
$count = Source::getInstance()->getBookCount();
$allBooks = Source::getInstance()->getAllBooks($page, $limit, $order, $orderField);
require "view/index.php";
开发者ID:krivov,项目名称:testBookCatalog,代码行数:15,代码来源:index.php

示例8: autocomplete_SOUR_TITL

/**
* returns SOUR:TITL matching filter
* @return Array of string
*/
function autocomplete_SOUR_TITL($FILTER)
{
    $rows = get_autocomplete_SOUR_TITL($FILTER);
    $data = array();
    foreach ($rows as $row) {
        $source = Source::getInstance($row);
        if ($source->canDisplayName()) {
            $data[] = $source->getFullName();
        }
    }
    return $data;
}
开发者ID:rathervague,项目名称:phpgedview,代码行数:16,代码来源:autocomplete.php

示例9: autocomplete_SOUR_TITL

/**
* returns SOUR:TITL matching filter
* @return Array of string
*/
function autocomplete_SOUR_TITL($FILTER)
{
    global $TBLPREFIX, $gBitDb;
    $sql = "SELECT 'SOUR' AS type, s_id AS xref, s_file AS ged_id, s_gedcom AS gedrec FROM {$TBLPREFIX}sources WHERE s_name LIKE ? AND s_file=? ORDER BY s_name";
    $rows = $gBitDb->query($sql, array("%{$FILTER}%", PGV_GED_ID), PGV_AUTOCOMPLETE_LIMIT);
    $data = array();
    while ($row = $rows->fetchRows()) {
        $source = Source::getInstance($row);
        if ($source->canDisplayName()) {
            $data[] = $source->getFullName();
        }
    }
    return $data;
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:18,代码来源:autocomplete.php

示例10: search_sources

function search_sources($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[] = "s_gedcom LIKE '%{$q}%'";
        } else {
            $querysql[] = "(s_gedcom LIKE '%{$q}%' OR s_gedcom LIKE '%" . UTF8_strtoupper($q) . "' OR s_gedcom LIKE '%" . UTF8_strtolower($q) . "%')";
        }
    }
    $sql = "SELECT 'SOUR' AS type, s_id AS xref, s_file AS ged_id, s_gedcom AS gedrec FROM {$TBLPREFIX}sources WHERE (" . implode(" {$match} ", $querysql) . ') AND s_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();
    $rows = $gBitDb->query($sql);
    $GED_ID = PGV_GED_ID;
    while ($row = $rows->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'];
        }
        $source = Source::getInstance($row);
        // SQL may have matched on private data or gedcom tags, so check again against privatized data.
        $gedrec = UTF8_strtoupper($source->getGedcomRecord());
        foreach ($queryregex as $q) {
            if (!preg_match('/\\n\\d\\ ' . PGV_REGEX_TAG . ' .*' . $q . '/i', $gedrec)) {
                continue 2;
            }
        }
        if ($skip && preg_match($skipregex, $gedrec)) {
            continue;
        }
        $list[] = $source;
    }
    // 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

示例11: PrintReady

if (!isset($type)) {
    $type = "";
}
$level0type = $type;
if ($type == "INDI") {
    $record = Person::getInstance($pid);
    echo "<b>", PrintReady($record->getFullName()), "</b><br />";
} elseif ($type == "FAM") {
    if (!empty($pid)) {
        $record = Family::getInstance($pid);
    } else {
        $record = Family::getInstance($famid);
    }
    echo "<b>", PrintReady($record->getFullName()), "</b><br />";
} elseif ($type == "SOUR") {
    $record = Source::getInstance($pid);
    echo "<b>", PrintReady($record->getFullName()), "&nbsp;&nbsp;&nbsp;";
    if ($TEXT_DIRECTION == "rtl") {
        echo getRLM();
    }
    echo "(", $pid, ")";
    if ($TEXT_DIRECTION == "rtl") {
        echo getRLM();
    }
    echo "</b><br />";
}
if (strstr($action, "addchild")) {
    if (empty($famid)) {
        print_help_link("edit_add_unlinked_person_help", "qm", "add_unlinked_person");
        echo "<b>", $pgv_lang["add_unlinked_person"], "</b>\n";
    } else {
开发者ID:rathervague,项目名称:phpgedview,代码行数:31,代码来源:edit_interface.php


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