コード例 #1
0
        $src = src_expand($src);
    }
    $query = "\n        SELECT\n            source_id,\n            is_unused(source_id) AS unused,\n            get_source_text(source_id) AS src_txt,\n            source_date\n        FROM\n            sources\n        WHERE\n            source_text SIMILAR TO '%{$src}%'\n    ";
    if ($scope != 0) {
        $query .= "\n            AND\n                part_type = {$scope}\n        ";
    }
    if ($yr && $diff) {
        $query .= "\n            AND\n                EXTRACT(YEAR FROM source_date)\n                    BETWEEN {$yr} - {$diff} AND {$yr} + {$diff}\n        ";
    }
    if ($yr && !$diff) {
        $query .= "\n            AND\n                EXTRACT(YEAR FROM source_date) = {$yr}\n        ";
    }
    $query .= "\n        ORDER BY\n            source_date\n    ";
    $handle = pg_query($query);
    echo "<table>\n";
    while ($row = pg_fetch_assoc($handle)) {
        $id = $row['source_id'];
        echo '<tr>';
        echo td_numeric(square_brace(to_url('./source_manager.php', array('node' => $id), $id)));
        if ($row['unused'] == 't') {
            echo td(span_type(square_brace(italic($row['source_date'])) . ' ' . $row['src_txt'], 'faded'));
        } else {
            echo td(square_brace(italic($row['source_date'])) . ' ' . $row['src_txt']);
        }
        echo "</tr>\n";
    }
    echo "</table>\n";
    echo '<p>' . pg_num_rows($handle) . ' treff.</p>';
}
echo "</div>\n";
include "./footer.php";
コード例 #2
0
 *   Copyright (C) 2011 by Leif B. Kristensen <*****@*****.**>        *
 *   All rights reserved. For terms of use, see LICENSE.txt                *
 ***************************************************************************/
// This script is basically a report listing sources of one type.
// It is accessed from the Source Part Type Manager via the 'report' link.
require "./settings/settings.php";
require "./functions.php";
require_once "./langs/{$language}.php";
$spt = $_GET['spt'];
$label = 'label_' . $language;
$spt_name = fetch_val("\n    SELECT {$label} FROM source_part_types WHERE part_type_id = {$spt}\n");
$title = "{$_All} {$_sources} {$_of} type {$spt_name}";
require "./header.php";
echo "<div class=\"normal\">\n";
echo "<h2>{$title}</h2>\n";
echo "<table>";
$handle = pg_query("\n    SELECT\n        source_id,\n        link_expand(source_text) AS txt,\n        source_date,\n        ecc(source_id) AS e,\n        rcc(source_id) AS r,\n        ssc(source_id) AS s,\n        usc(source_id) AS u,\n        spt.{$label} AS {$label}\n    FROM\n        sources, source_part_types spt\n    WHERE\n        spt.part_type_id = sources.part_type\n    AND\n        spt.part_type_id = {$spt}\n    AND\n        source_id <> 0\n    ORDER BY\n        source_date,\n        source_text\n");
while ($row = pg_fetch_assoc($handle)) {
    $id = $row['source_id'];
    echo '<tr>';
    echo td(paren(to_url('source_manager.php', array('node' => $id), $_Select) . '&nbsp;/&nbsp;' . to_url('./forms/source_edit.php', array('person' => 0, 'source' => $id), $_Edit)));
    if ($row['e'] || $row['r'] || $row['s']) {
        echo td(square_brace(italic($row['source_date'])) . ' ' . $row['txt'] . node_details($row['e'], $row['r'], $row['s'], $row['u']));
    } else {
        // source is unused, print with gray text
        echo td(span_type(square_brace(italic($row['source_date'])) . conc($row['txt']), "faded"));
    }
    echo "</tr>\n";
}
echo "</table>\n";
include "./footer.php";
コード例 #3
0
function gname($gnum)
{
    // takes gender number, returns localized gender name
    global $_Unknown, $_Male, $_Female, $_NslashA;
    if ($gnum == 0) {
        return span_type($_Unknown, "alert");
    }
    if ($gnum == 1) {
        return $_Male;
    }
    if ($gnum == 2) {
        return $_Female;
    }
    if ($gnum == 9) {
        return $_NslashA;
    }
}
コード例 #4
0
function show_parent($person, $gender)
{
    // print names and lifespans of parents.
    // valid $gender values are 1=father, 2=mother
    global $language, $_Add, $_Insert, $_edit, $_delete, $_Father, $_father, $_Mother, $_mother, $_toolhelp_edit_parent, $_toolhelp_add_parent, $_toolhelp_insert_parent, $_toolhelp_delete_parent;
    $parent_id = fetch_val("SELECT get_parent({$person}, {$gender})");
    $surety = fetch_val("\n        SELECT get_lsurety((\n            SELECT surety_fk\n            FROM relations\n            WHERE parent_fk = {$parent_id}\n            AND child_fk = {$person}\n        ), '{$language}')\n    ");
    if ($gender == 1) {
        $Parent = $_Father;
        $parent = $_father;
        $para = '<p>';
        $newline = '<br />';
    } else {
        // $gender == 2
        $Parent = $_Mother;
        $parent = $_mother;
        $para = '';
        $newline = '</p>';
    }
    echo $para . conc(bold($Parent) . ':') . conc(get_name_and_dates('', $parent_id));
    if ($parent_id) {
        echo conc(curly_brace($surety)) . conc(span_type(paren(to_url('./forms/relation_edit.php', array('person' => $person, 'parent' => $parent_id), $_edit, sprintf($_toolhelp_edit_parent, $parent)) . ' / ' . to_url('./forms/relation_delete.php', array('person' => $person, 'parent' => $parent_id), $_delete, sprintf($_toolhelp_delete_parent, $parent))), "hotlink")) . cite(get_relation_id($person, $gender), 'relation', $person);
    } else {
        echo conc(span_type(paren(to_url('./forms/person_insert.php', array('person' => $person, 'addparent' => 'true', 'gender' => $gender), "{$_Add} {$parent}", sprintf($_toolhelp_add_parent, $parent)) . ' / ' . to_url('./forms/relation_edit.php', array('person' => $person, 'gender' => $gender), "{$_Insert} {$parent}", sprintf($_toolhelp_insert_parent, $parent))), "hotlink"));
    }
    echo "{$newline}\n";
}