コード例 #1
0
<?php

/***************************************************************************
 *   get_coprincipal.php                                                   *
 *   Yggdrasil: return person id input field + name for dynamic update     *
 *                                                                         *
 *   Copyright (C) 2006-2011 by Leif B. Kristensen <*****@*****.**>   *
 *   All rights reserved. For terms of use, see LICENSE.txt                *
 ***************************************************************************/
require "../settings/settings.php";
require "../functions.php";
$person = $_GET['person'];
$event = $_GET['event'];
$event_type = $_GET['event_type'];
if (has_coprincipal($event_type)) {
    $coprincipal = get_second_principal($event, $person);
    echo "Med <input type=\"text\" size=\"10\" value=\"{$coprincipal}\" ";
    // dynamic AJAX update of source text
    echo "name=\"coprincipal\" onchange=\" get_name(this.value)\">";
    echo "<span id=\"name\">";
    echo ' ' . linked_name($coprincipal, '../family.php');
    echo "</span>\n";
}
?>

コード例 #2
0
 }
 // process form
 $person = $_POST['person'];
 $event_note = note_to_db($_POST['event_note']);
 $event_date = pad_date($_POST['date_1']) . $_POST['date_type'] . pad_date($_POST['date_2']) . '1';
 $sort_date = parse_sort_date($_POST['sort_date'], $event_date);
 $place = $_POST['place_fk'];
 if ($place == 0) {
     $place = 1;
 }
 $tag = $_POST['tag_fk'];
 pg_query("BEGIN");
 $event = fetch_val("\n        INSERT INTO events (\n            tag_fk,\n            place_fk,\n            event_date,\n            sort_date,\n            event_note\n        )\n        VALUES (\n            {$tag},\n            {$place},\n            '{$event_date}',\n            '{$sort_date}',\n            '{$event_note}'\n        )\n        RETURNING event_id\n    ");
 set_last_selected_place($place);
 add_participant($person, $event);
 if ($_POST['coprincipal'] && has_coprincipal($tag)) {
     // constrain to events which allows for coprincipal, ie tag_type = 2
     $coprincipal = $_POST['coprincipal'];
     add_participant($coprincipal, $event);
 }
 if ($tag == 31) {
     // hard-coded reference to probate
     pg_query("SELECT generate_probate_witnesses({$event})");
 }
 $source_id = add_source($person, $tag, $event, $src, note_to_db($txt));
 $age = $_POST['age'];
 if ($age && is_numeric($age)) {
     // generate birth event
     add_birth($person, $event_date, $age, $source_id);
 }
 if ($tag == 3) {