Esempio n. 1
0
function show_gedcom($per)
{
    $dao = getGedcomDAO();
    $rows = $dao->getReferences($per->person_id);
    $ret = 0;
    foreach ($rows as $row) {
        echo "GEDCOM:" . $row["gedfile"] . " " . $row["gedrefid"];
        $ret++;
    }
    return $ret;
}
Esempio n. 2
0
function print_person($search, $per)
{
    global $famarray;
    // if trying to access a restriced person
    if (!$per->isExportable()) {
        return;
    }
    $config = Config::getInstance();
    //get surename right for gedcom NAME field
    //if there is just one name filled in name and surname
    $surname = "";
    if ($per->name->link != "") {
        $surname = $per->name->link;
    }
    $surname .= $per->name->surname;
    if ($per->name->suffix != "") {
        $surname .= $per->name->suffix;
    }
    if ($per->name->forenames != "") {
        $ged_name = $per->name->forenames . " /" . $surname . "/";
    } else {
        $ged_name = $surname;
    }
    //If this person was previously imported from a gedcom file then use that id
    $id = $per->person_id;
    $gdao = getGedcomDAO();
    $gedids = $gdao->getReferences($id);
    if (count($gedids) === 1) {
        $id = $gedids[0]["gedrefid"];
    }
    output_ged(0, "@", $id, "@ INDI");
    output_ged(1, "NAME ", $ged_name);
    output_ged(2, "GIVN ", $per->name->forenames);
    if ($per->name->link != "") {
        output_ged(2, "SPFX ", $per->name->link);
    }
    output_ged(2, "SURN ", $surname);
    if ($per->name->title != "") {
        output_ged(2, "NPFX ", $per->name->title);
    }
    if ($per->name->suffix != "") {
        output_ged(2, "NSFX ", $per->name->suffix);
    }
    if ($per->name->knownas != "") {
        output_ged(2, "NICK ", $per->name->knownas);
    }
    output_ged(1, "SEX ", $per->gender);
    $edao = getEventDAO();
    $e = new Event();
    $e->person->person_id = $per->person_id;
    $edao->getEvents($e, Q_BD, true);
    $sdao = getSourceDAO();
    $classes = array("1 BIRT", "1 BAPM", "1 DEAT", "1 BURI");
    foreach ($e->results as $e) {
        if ($e->hasData()) {
            echo $classes[$e->type] . "\n";
            $events[$e->type] = $e;
            #			$sdao->getEventSources($e);
            echo DateUtil::full_ged_date1($e);
            if ($e->location->place != "") {
                output_ged(2, "PLAC ", $e->location->place);
            }
            if ($e->type == DEATH_EVENT && $per->death_reason != "") {
                output_ged(2, "CAUS ", $per->death_reason);
            }
            if ($e->notes != "") {
                echo "2 NOTE\n";
                output_ged(3, "CONT ", $e->notes);
                if (isset($e->source) && $e->source != "") {
                    output_ged(2, "SOUR ", $e->source->title);
                } else {
                    output_ged(3, "SOUR ", "phpmyfamily");
                }
            }
        }
    }
    if ($per->mother->person_id != "00000" and $per->father->person_id != "00000") {
        $famc = $per->father->person_id . $per->mother->person_id;
        output_ged(1, "FAMC @", $famc . "@");
        if (!array_key_exists($famc, $famarray)) {
            $famarray[$famc] = array();
        }
        $famarray[$famc][] = $per;
    }
    if ($per->narrative != "") {
        //Textfield could have Returns, separate them in gedcom CONT lines
        $narrative = preg_replace("/\n/", "\n2 CONT ", $per->narrative);
        output_ged(1, "NOTE ", $narrative);
    }
    $exploded = explode(" ", $per->updated);
    $updated = DateUtil::ged_date($exploded[0]);
    echo "1 CHAN\n";
    output_ged(2, "DATE ", $updated);
    //find photos
    $eid = -1;
    $sid = -1;
    $images = new Image();
    $images->person = $per;
    $idao = getImageDAO();
    $idao->getImages($images);
    for ($current = 0; $current < $images->numResults; $current++) {
        $img = $images->results[$current];
        output_ged(1, "OBJE @img", $img->image_id, "@");
        output_ged(2, "FILE ", $config->absurl . $img->getImageFile());
        output_ged(2, "FORM ", "jpg");
        output_ged(2, "TITL ", $img->title);
    }
    $trans = new Transcript();
    $trans->person = $per;
    $tdao = getTranscriptDAO();
    $tdao->getTranscripts($trans);
    for ($i = 0; $i < $trans->numResults; $i++) {
        $doc = $trans->results[$i];
        output_ged(1, "SOUR @doc", $doc->transcript_id, "@");
        //TITL not allowed here
        output_ged(2, "TEXT ", $doc->description);
        //FILE not allowed here
    }
    echo "1 SUBM @phpmyfamily@\n";
}