<?php

/***************************************************************************
 *   source_select.php                                                     *
 *   Yggdrasil: Source Select                                              *
 *                                                                         *
 *   Copyright (C) 2006-2011 by Leif B. Kristensen <*****@*****.**>   *
 *   All rights reserved. For terms of use, see LICENSE.txt                *
 ***************************************************************************/
// This script will update last selected source (LSS).
require "../settings/settings.php";
require "../functions.php";
$person = $_GET['person'];
$source = $_GET['source'];
set_last_selected_source($source);
header("Location: {$app_root}/family.php?person={$person}");
node in the source tree. It has evolved to become the central point of the
application besides the family view. I don't think that any other genealogy
app has anything like it.
*/
// *****************************************************************************
//                               initialization
// *****************************************************************************
require "./settings/settings.php";
require_once "./langs/{$language}.php";
require "./functions.php";
// we'll display only raw dates here
pg_query("SET DATESTYLE TO GERMAN");
// $self = this node, default node is root
$self = isset($_GET['node']) ? $_GET['node'] : 0;
// set $self as active source
set_last_selected_source($self);
// localized source part type label
$label = 'label_' . $language;
// get all attributes of $self in one query
$props = fetch_row_assoc("\n    SELECT\n        ecc({$self}) AS number_of_events,\n        rcc({$self}) AS number_of_relations,\n        ssc({$self}) AS number_of_subsources,\n        usc({$self}) AS number_of_unused_subsources,\n        get_source_text({$self}) AS source_txt,\n        get_prev_page({$self}) AS prev_page,\n        get_next_page({$self}) AS next_page,\n        link_expand(source_text) AS node_txt,\n        parent_id,\n        sort_order,\n        source_date,\n        part_type,\n        spt.{$label},\n        spt.is_leaf\n    FROM\n        sources, source_part_types spt\n    WHERE\n        spt.part_type_id = sources.part_type\n    AND\n        source_id = {$self}\n");
$title_prev = get_source_plain_text($props['prev_page']);
$title_next = get_source_plain_text($props['next_page']);
$title = "S:{$self} " . get_source_plain_text($self);
// limit title tag to a sensible length
if (mb_strlen($title) > 80) {
    $title = mb_substr($title, 0, 80) . '...';
}
// var used by header.php to display context dependent menu items
$source_manager = true;
require "./header.php";
// *****************************************************************************