예제 #1
0
function list_participants($event)
{
    $handle = pg_query("SELECT person_fk, sort_order, is_principal\n                            FROM participants\n                            WHERE event_fk = {$event}\n                            ORDER BY sort_order");
    while ($row = pg_fetch_row($handle)) {
        $bp = $row[2] == 'f' ? 'B' : '';
        $p_list[] = square_brace($bp . $row[1]) . linked_name($row[0], './family.php');
    }
    return join($p_list, ', ');
}
        $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";
예제 #3
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";